Block Lifecycle, Topology, and Leader Rotation
This page puts the full block path into one place: who injects actions, how
validators and sentries connect, how proposer rotation works, what runs in
begin_block and end_block, where delayed actions
re-enter, and where hashing and VoteAppHash sit relative to
execution. It is written to be both human-scannable and agent-friendly: short
tables, explicit hook points, and scope notes where the protocol baseline and
current local implementation have not fully converged.
crates/hl-engine/src/exchange.rs (private repo path)
Exchange Pipeline DOT (omitted from public export)
1. Scope Split
Protocol / RE Baseline
protocol
The reconstructed lifecycle from binary strings, runtime traces, and RE notes:
RecoverUsers -> BeginBlock -> DeliverSignedActions -> Commit -> RespHash -> Check,
plus the consensus/gossip topology around it.
Current Local Main
local impl
The current engine on main now matches the widened execution note
on begin-block ordering: BOLE at slot 3 and delayed CoreWriter drain at slot 8.
The remaining open work is ActionDelayer mode semantics and deeper per-effect
internals, not the top-level slot map.
2. Network Topology
The execution pipeline only makes sense in the actual network layout. User actions do not flow directly into every validator. Broadcasters, validators, sentries, gossip peers, ABCI state transfer, and EVM KV snapshots all sit in the path.
signed action bundles"] B --> V["Active validators"] V --> S["Sentries / approved peers"] V <-->|4001 / 4002| V2["Other validators"] S <-->|4001 / 4002| V2 V --> G["Gossip stream
ClientBlocks, heartbeats, concise messages"] V --> A["ABCI state transfer"] V --> E["EVM KV transfer"] G --> F["Followers / replay nodes / observers"]
| Edge | Purpose | Current evidence |
|---|---|---|
| User -> Broadcaster | Bundle signed actions behind whitelisted broadcaster addresses and per-broadcaster nonces. | Observed in action flow and mempool notes. |
| Peer -> 4001 | ABCI stream, block streaming, concise message families, heartbeats. | Confirmed in gossip RE. |
| Peer -> 4002 | Peer discovery / RPC verification / gossip status checks. | Confirmed in gossip RE. |
| Unknown peers | Rejected if not validator or sentry, over peer cap, duplicated, or no quorum yet. | Confirmed rejection strings. |
3. Leader Election and Round Flow
Active Set
Mainnet currently observes 24 active validators; testnet observes top 50 by stake.
Proposer Rule
RoundRobinTtl is the confirmed proposer-selection family, with future proposers precomputed.
Exclusions
Jailed or disabled validators leave proposer rotation and active signing duty.
Advance Path
Missed proposal -> timeouts -> TC -> round advance, without committing the missing block.
round advance sources:
- normal QC progression
- timeout certificate (TC)
- active-set / signer gating
- jail / disable state changes across epoch transitions
4. Block Lifecycle
Recover Users / Pre-Execution Context
Context, active-set state, and user surfaces are assembled before execution. In replay terms this is the stage before Exchange::process_block actually mutates state.
BeginBlock
Runs the pre-action effects pipeline. This is where funding, OI-cap cleanup, stale-mark handling, vote-tracker pruning, and BOLE begin-block logic hook in.
Drain Matured Delayed Actions
ActionDelayer re-injects matured CoreWriter actions so they execute as ordinary L1 actions in a future block.
Deliver Signed Actions
Signed bundles are unpacked, actor resolution and broadcaster constraints are applied, and action handlers mutate exchange, clearinghouse, bridge, BOLE, vault, and outcome state.
EndBlock
Post-action execution hooks run here. In the current local engine this is the mark-price and book-derived cleanup layer rather than another large governance/matching phase.
EVM / CoreWriter
EVM blocks are built, CoreWriter intents are scanned, and delayed actions may be enqueued for future begin_block execution.
Commit, RespHash, Check
Execution responses feed RespHash and LtHash. Replay and parity tooling then compare local outputs against known app-hash or runtime checkpoints.
VoteAppHash
Validators periodically vote on app-hash checkpoints. The current observed cadence is every 2000 blocks, with quorum app-hash artifacts used for mismatch detection.
5. Hook Points
| Hook | What runs there | Why it matters |
|---|---|---|
begin_block |
Funding distribution, funding-rate update, OI-cap cancels, empty-book pruning, vote-tracker pruning, recent-OI reset, stale-mark refresh, stale-guard updates, BOLE begin-block logic. | This is the highest-leverage ordering surface for replay parity. |
process_matured_delayed_actions |
CoreWriter-delayed actions re-enter as normal L1 execution. Current local main drains them after the 9 standard begin-block effects; exact binary placement is still open. | This is where EVM-to-L1 delayed intents rejoin the main state machine, and one of the remaining ordering-closure items for replay parity. |
| Action dispatcher | Trading, transfers, vaults, bridge, BOLE, outcome actions, governance, validator actions. | This is the broadest mutation surface and the source of most response hashes. |
end_block |
Book-derived and mark-price cleanup hooks. | Needed so replay matches the same post-action mark state. |
| EVM scan | CoreWriter extraction and delayed-action enqueue. | Bridges L1 and EVM state transitions. |
| RespHash / LtHash | Hash execution responses into L1 and EVM accumulator lanes. | Direct app-hash parity boundary. |
6. BeginBlock Details
The top-level begin-block ordering is now aligned across the widened RE note and current local main. The table below separates the 9 named effects from the supplementary per-book maintenance that follows them.
| Order | Named begin-block effect | Role |
|---|---|---|
| 1 | update_oracle |
Pre-process oracle state for the new block |
| 2 | distribute_funding |
Settle accumulated funding payments |
| 3 | apply_bole_liquidations |
BOLE lending liquidation pass |
| 4 | update_funding_rates |
Sample premium and update funding EMAs |
| 5 | refresh_hip3_stale_mark_pxs |
Refresh stale HIP-3 mark prices |
| 6 | prune_book_empty_user_states |
Remove empty user-state entries |
| 7 | update_staking_rewards |
Stage staking rewards for the current epoch |
| 8 | update_action_delayer |
Drain matured delayed CoreWriter actions |
| 9 | update_aligned_quote_token |
Sample validator risk-free-rate votes |
| 10 | supplementary maintenance | check_trigger_orders, OI-cap cancel, vote-tracker prune, recent-OI reset, stale-mark guards |
aligned
BOLE now sits at slot 3 and delayed CoreWriter execution at slot 8 across the
widened note and current local main. The remaining open questions on
this lane are guard cadence and ActionDelayer control semantics.
7. VoteAppHash and Runtime Checkpoints
| Surface | Role |
|---|---|
RespHash |
Hashes execution responses into the L1 accumulator family. |
LtHash16 |
Incremental state-hash accumulator family for L1 and EVM categories. |
VoteAppHash |
Validator agreement signal on checkpointed app hash, observed every 2000 blocks. |
quorum_app_hashes |
Best runtime truth source for replay mismatch localization. |
8. Open Gaps
| Gap | Why it matters |
|---|---|
| Per-effect semantics beyond ordering | Ordering is now aligned; the remaining work is guard cadence, thresholds, and ActionDelayer mode semantics. |
| Full action inventory page | The paper still compresses too many action families into prose instead of explicit tables. |
| Topology visuals for sentry / peer roles | The high-level network map exists now, but the exact sentry role split can still be sharpened. |
| RespHash / VoteAppHash per-phase proof loop | Needed to tie lifecycle docs directly to replay diagnostics. |