Skip to content

Block pipeline ​

This page describes the current version

The internals on this page can change between v0.x versions. The project measures each change and records each decision in Every change, measured.

This page follows one block from engine_newPayload to the answer VALID. The goal of the pipeline is a short time to the answer. One thread executes the transactions in order. Other threads do all the work that they can do beside it, before and during execution.

The node writes the block to the database later, on a writer thread. For that part, read Writing blocks.

Overview ​

StepThreadWhat it does
1. Decodeengine, compute poolReads the payload and checks the block hash. The compute pool hashes the transactions.
2. Place the blockengineFinds the parent and decides how to execute.
3. Senderscompute poolRecovers the sender of each transaction.
4. Prewarmprewarm poolRuns the transactions ahead of execution.
5. Trie prefetchcoordinator, prefetch poolReads the trie paths of the keys that the prewarm writes.
6. ExecutionengineExecutes the transactions in order and checks the header.
7. DiffengineCollects the changes of the block.
8. State rootengine, coordinator, compute and I/O poolsComputes the state root and compares it with the header. The coordinator finds the trie paths during step 6.
9. KeepengineKeeps the block in memory until the writer writes it.
The stages of one block and the time of the measured stagesNine stages from decode to keep. The bars show the median time of a block on Cinder, without and with three changes. Without the changes: total 58 ms. Execution 44 ms. State root after execution 10 ms. With the changes: total 50 ms. Execution 44 ms. State root after execution 4 ms.1Decode2Place3Senders4Prewarm5Prefetch6Execution7Diff8State root9Keepstart with step 6median shown belowmedian shown below010203040506070Without the changesexecution 4458 msroot 10With the changesexecution 4450 msroot 4Median time of a block on Cinder, ms
Execution (step 6) State root after execution (step 8) Other: total minus the two medians
Medians of a block on one Cinder instance in the interleaved A/B of 2026-10-13 on live mainnet, on the dedicated server. The A/B compares blocks without the three changes with blocks with them. Total and state root are from latest.json (latency_ab). Execution is the median of 439 and 439 blocks from ab-2026-10-13.json. The three values are medians of separate columns, so the parts do not always add up to the total. The grey part is the total minus the other two. Record: numbers, how we measure.

Steps 3, 4 and 5 start at the same time as step 6. The work of step 8 also starts during step 6 (read The streaming root).

The threads ​

--threads N sets the size of the compute pool. The default is min(8, CPUs - 2), at least 1, from the CPUs that the process can use. With N of 1, the node starts no pools. The writer thread still runs, but steps 3, 4 and 5 do not run beside step 6. With N of 2 or more, the node also starts these pools:

  • Prewarm pool. N threads at nice 5. Under CPU contention, the executing thread keeps its core.
  • I/O pool. 32 threads for the reads of the state root. These threads mostly wait on the disk, so many reads are in flight at the same time. While the block executes, the pool also does the read-ahead of slot runs.
  • Prefetch pool. 16 threads at nice 5 for the trie paths during execution.

With any N, the node starts the coordinator thread of the streaming root, at nice 5. With N of 2 or more, the coordinator uses the prefetch pool for its reads. With N of 1, it reads the nodes itself.

While the node executes or writes a block, it sets a busy flag. The mempool prewarm and the transaction validation thread pause while the node holds the flag.

The executing thread on a core of its own ​

In engine mode with 4 or more usable CPUs, the node keeps one core for the executing thread. At start, it finds the first CPU that the process can use and the SMT siblings of that CPU. All other threads run on the remaining CPUs. During a block, the executing thread runs on that one CPU, and the SMT siblings stay free. If the process can raise its priority, the executing thread runs at nice -5 during the block. This needs the CAP_SYS_NICE capability. Without it, the thread keeps its nice and still gets the core. Between blocks, the executing thread runs on the other CPUs. On mainnet blocks, this cut the time of the block by 2.3 ms by median. --no-exec-iso turns it off. Under numactl, the first CPU of the given NUMA node becomes the executing core. For the setup, read Tuning.

Memory between blocks ​

Each thread of the node allocates the memory of a block from an arena. After each block, the node keeps up to 512 MB in the scratch arena of the engine thread and up to 64 MB in each other arena, and gives the rest back to the system. It gives free heap pages back only when the heap is larger than 1 GB. Before this change, the node gave the memory back after each block, and the next block took it again. That cost the kernel time on each block. On mainnet blocks, to keep the memory cut the time of the block by 0.8 ms by median.

1. Decode ​

The engine thread reads the payload. It finds the fork from the timestamp and checks the version of the method. If the version does not match the fork, the answer is the error -38005 (Unsupported fork). A timestamp at or after --amsterdam-time also gets -38005 (read Engine API). The node builds the header and the block from the payload fields and computes the block hash. The hashes of the transactions and the transactions root are most of the decode work. The node computes them on the compute pool, which is idle before execution starts. This makes the decode shorter (issue #43). The Changelog gives the measured time.

The node checks the transactions and extraData (at most 32 bytes) before the block hash, as reth does. A transaction that is empty or does not decode makes the answer INVALID. If the hash is not the blockHash of the payload, the answer is INVALID. If the blob versioned hashes of the transactions are not the hashes in the request, the answer is also INVALID. For the latestValidHash of each case, read Engine API.

For each transaction, the node asks the pool if it already has the transaction. If the pool admitted the transaction, the node takes the sender from the pool. About half of the transactions of a mainnet block come with a known sender this way.

2. Place the block ​

The node finds the parent of the block. The answer depends on where the parent is:

ParentWhat happens
The database headThe node executes the block on the database.
A valid block in memoryThe node executes the block over the diffs of its unwritten ancestors.
An invalid blockINVALID, without execution.
A pending blockThe block also becomes pending: ACCEPTED.
A canonical block 1 or 2 blocks below the database headA fork below the database head, for example a sibling of the head. The node executes the block over reverse layers from the undo records: VALID or INVALID.
A canonical block deeper below the database head, within the undo windowA fork below the database head. The block becomes pending: ACCEPTED.
Not knownSYNCING. Above the database head, the node keeps the block (at most 256 blocks and 256 MB) and executes it when its parent comes. For the effect after a restart, read SYNCING for a long time after a restart.

If the node already knows the block, it returns the earlier answer. If the block is already a canonical block in the database, the answer is VALID.

Before execution, the node publishes a batch that the writer finished. If more than 4 canonical blocks deeper than the persist depth are not written yet, the block waits for the writer. Forks do not count. For these rules, read Writing blocks.

The layered state ​

A block whose parent is in memory reads its state through layers:

  1. The diffs of the unwritten ancestors, newest first.
  2. A view of the database head.

The first layer that has a value gives it. A layer that cleared the storage of an account gives zero for every slot of that account that it does not hold.

3. Senders ​

A separate thread recovers the senders on the compute pool. The compute pool is free while the block executes. Execution starts at once. Only one thread claims each sender: the sender thread, a prewarm run or execution. Execution waits only for the sender of the transaction that it needs next.

4. Prewarm ​

The prewarm runs every transaction of the block in parallel and in advance, on the prewarm pool. It discards the results. The goal is to read the state that execution will read, so that execution finds it in memory.

  • Shared writes. The runs share their writes. A later transaction reads what an earlier run wrote, so its run follows the real state of the block more often. An example is a swap after a swap on the same pool.
  • No nonce or balance stop. A run accepts a nonce above the nonce of the account, and it increases a balance that is too low. The run of an earlier transaction from the same sender may not have published its writes yet. Without this, the runs of a bundle of transactions from one sender stopped at once and read nothing. The prewarm of reth does the same. A nonce below the nonce of the account still stops a run. Execution keeps all the checks. The mempool warm keeps them too: a pool transaction with a nonce gap may never be mined.
  • Second pass. A transaction whose first run started before earlier runs published their writes runs again, if execution did not reach it yet.
  • Skip. Execution publishes its position. The prewarm skips the transactions that execution already reached.
  • Stop. When execution ends, the prewarm stops.
  • Quiet reads. The prewarm reads through a quiet backend. A speculative run can ask for data that does not exist yet, for example the code of a contract that an earlier transaction of the block creates. Such an error stays in the run and does not fail the block.

5. Trie prefetch ​

The state root later walks the trie path of every key that the block writes. Each prewarm run hands its written keys on as soon as the run ends. With the streaming root, the coordinator takes them as hints. Without it, a drainer thread takes them. Each one reads their trie paths on the prefetch pool while execution continues:

  • It puts the stored nodes that it reads into the node cache.
  • At the end of each path, it rebuilds the leaf or bottom branch from the flat records and caches it too.

The prefetch reads only the keys that a run wrote. Execution reads the keys that the runs only read from the flat tables, which the prewarm already brought into memory.

6. Execution ​

The engine thread executes the block on the layered state, in order:

  1. The header checks against the parent, for example the number, the timestamp, the base fee and the excess blob gas.
  2. The system calls of the fork, for example the beacon root and the history calls.
  3. Each transaction. An invalid transaction makes the block invalid.
  4. The withdrawals and the execution requests.
  5. The header checks of the result: gas used, transactions root, receipts root, logs bloom, withdrawals root, blob gas used and requests hash.

When execution ends, the engine thread stops the prewarm and waits for its threads. The log line shows this wait as wait. If a check failed, the answer is INVALID with the name of the rule.

The interpreter is a computed-goto interpreter. It puts the call frames in a scratch arena for each thread, so a call frame needs no heap allocation. The stack pointer and the gas stay in registers, and each opcode handler ends with its own dispatch. MLOAD, MSTORE and CALLDATALOAD read a word in place. These changes made block execution faster on the mainnet blocks of the engine benchmark (issue #134). The Changelog gives the measured time.

Read-ahead of slot runs ​

Many contracts keep a struct or an array in storage slots with consecutive keys. The database keys a slot by its hash, so each slot of such a run is a separate read. When the block loads slot K of a contract, and it loaded slot K-1 of that contract before, the node reads the next slots of the run (K+1 to K+4) on the I/O pool. The block then finds these slots in the cache. The prewarm runs give their slots to the read-ahead too. A block reads ahead at most 4 096 slots. The read-ahead does not give values to execution: execution reads each slot again from the cache, so the result of the block does not depend on the read-ahead.

The read-ahead is on when --threads is 2 or more. CINDER_READ_AHEAD=0 turns it off. The counts are in the read-ahead part of the log line. The node has the read-ahead from 0.9.7 (issue #361).

7. Diff ​

The node collects the changes of the block into a state diff: every account, slot and code that differs from the state before the block, as final values. The diff is the record of the block in memory. Its children read through it, and the writer writes it later.

8. State root ​

The node computes the state root on one of three paths.

On the database head ​

When the parent is the database head, the node uses the execution state of the block as it is. That state already holds the values before the block and the final values. The node does not apply the diff again.

Over the trie nodes of unwritten ancestors ​

When the parent is not written yet, the root can start from the state root of the parent. Each block that can stay unwritten keeps the trie nodes that it changed, in memory, by hash. The view of the block gets an overlay of these nodes, newest ancestor first. A trie walk asks the overlay by hash before it reads the cache or the database. A hash names exactly one node, so a node from the overlay is always the one that the parent expects.

The node takes this path when every unwritten ancestor has its table of trie nodes.

Replay ​

On the replay path, the node builds a new state over the database view. It applies the diffs of all unwritten ancestors, oldest first, then the diff of the block. Then it computes the root over all these changes. The node uses this path in these cases:

  • An ancestor has no table of trie nodes. This is the case for the reverse layers of a fork below the database head.
  • The overlay path fails. The node never gives a verdict from the overlay path alone. It logs the failure and computes the root again with the replay.

Block building and the re-runs of cinder-bench-node also use the replay path.

The streaming root ​

The node starts the work of the root while the block executes. At the first write of each account or slot, the executing thread adds a pointer to a write log. The thread does not copy or hash the key. At the end of each transaction, the new entries of the log become visible to a coordinator thread.

The coordinator thread runs at nice 5. It takes the keys from the log and finds the trie path of each key in the tries of the block: the account trie at the base state root, and one storage trie for each account. It gets the trie nodes from the overlay and the node cache first. The prefetch pool reads the nodes that are not there. The keys that the prewarm writes come as hints: the coordinator only reads their nodes into the node cache. The coordinator does not read values.

When execution ends, the coordinator resolves the remaining keys if there are 384 or fewer. If more keys remain, it stops, and the prefetch of the root computation reads them. Then the coordinator gives the tries to the root computation. Each storage trie goes to the one task that computes the root of that account. Each node has the hash that its parent expects, as in all trie reads. Thus the stream changes only when and where the node finds the trie nodes. It does not change the nodes.

The stream does not give a verdict alone. If the streamed root fails or is not the state root of the header, the node computes the root again without the stream, and that result gives the answer. If the coordinator does not stop in 2 s (CINDER_SROOT_TIMEOUT_MS), the node computes the root without the stream. If the coordinator needs more than 256 MB for one block, it stops, and the root reads the rest itself.

Debug builds compute every streamed root also without the stream and compare the two (CINDER_SROOT_CHECK). CINDER_SROOT=0 turns the stream off.

How the state root is computed while the block executesFour lanes in time. The executing thread runs the transactions and adds a pointer to the write log at the first write of each key. At the end of each transaction the new entries become visible to the coordinator. The coordinator finds the trie path of each key and the I/O pool reads the missing nodes. When execution ends, the coordinator resolves the remaining keys and hands the tries to the root computation. The median state root after execution is 10 ms without the stream and 4 ms with it.Executing threadWrite logCoordinatorI/O pooltx 1tx 2tx 3checkspointerspointerspointerstrie pathsreadstrie pathsreadstrie pathsreadsrest of keysrootTime, not to scale: the block executes from left to right
Median state root after execution: 10 ms without the stream, 4 ms with it.
Schematic of the streaming state root; the shapes are not measured. The two medians are from the interleaved A/B of 2026-10-13 on mainnet (dedicated server, 878 blocks). Record: block pipeline. Data: latest.json (latency_ab).

On mainnet blocks, against the root without the stream, the root after execution went from 10 to 4 ms by median, and the time of the block went down by 4.2 ms by median. The execution time did not change. For the switches of the stream, read Configuration.

The root computation ​

On each path, the root computation has these parts:

  • Prefetch. The I/O pool reads the trie paths of the changed keys. When the stream resolved all the changed keys, or when fewer than 16 keys changed, the node skips this prefetch. Most of the paths are already in the cache from step 5.
  • Storage roots. The compute pool computes the storage roots of the accounts in parallel, one account for each task. A contract with 64 or more changed slots gets its storage root over the 16 sub-tries of its trie in parallel. This applies only when the contract already has storage and the block does not clear it.
  • Account trie. With 64 or more changed accounts, the node updates the 16 sub-tries under the root branch in parallel.
  • Hashing. The node hashes the changed nodes level by level. Nodes of one level do not depend on each other, so it hashes four at a time with AVX2 keccak. Cinder needs a CPU with AVX2 and BMI2.

If the root is not the state root of the header, the answer is INVALID with state root mismatch.

9. Keep ​

A valid block stays in memory as a node of the block tree:

  • The diff, with the final storage roots of the changed accounts.
  • The history of the block: body, receipts, senders and transaction hashes, ready for the database.
  • The trie nodes that the block changed, for the roots of its children. The block keeps them only while the writer is on or --persist-depth is more than 0.
  • The full RLP of the block, while the writer is on. If the branch of the block dies under a batch of the writer, the block becomes pending again and the node can run it again.

Then the engine thread returns VALID. Before it sends the answer, it removes the transactions of a valid block from the pool. The pool keeps their blobs for engine_getBlobs.

Measured time ​

In a 30-minute desktop window on mainnet (against reth 2.0, 2026-10-05, 150 blocks), the blocks had these mean times:

BlockBlocksExecution (read wait)RootnewPayload
Parent written (the database head)9975 ms (33 ms)22 ms110 ms
Parent not written, root over its trie nodes51108 ms (50 ms)33 ms156 ms

The blocks on an unwritten parent are slower mostly in execution. They run while the writer writes on the same disk. For the latest numbers against reth, read Performance.

Caches ​

The node keeps data across blocks in these caches. The bytecode, JUMPDEST and precompile caches use a hash of the content as their key, so their entries need no invalidation. The cross-block cache holds the state of the database head. The node updates it when the database head moves.

CacheKeySizeEffect
Cross-block cacheaccount, slot, trie path--cache-mb, default 1024 MBThe state of the database head in memory. See State database.
Bytecodecode hashup to 128 MB or 49 152 entriesDatabase reads of the executing thread fell from 573 to 168 per block.
JUMPDEST analyses and code copiescode hashup to 256 MiB (64 MiB before 0.9.5)Their share of the CPU of the executing thread fell from 13.8% to 4.7%.
Keccak-256 resultsthe input (20, 32, 64 or 96 bytes)44 MiB of address spaceThe 96-byte table (0.9.5): on blocks with much bot gas, 97% of the 96-byte inputs come from the cache (#230).
Precompile resultskeccak of precompile, fork and input8 192 slotsThe prewarm computes them first, so execution can find the result in the cache.

Bytecode ​

Code never changes under its hash. The node never removes an entry, so a pointer to cached code stays valid. When the cache is full, it stores nothing new and the node reads code from the database. The node uses this cache only when the cross-block cache is on.

JUMPDEST analyses ​

The EVM must know the valid jump destinations of a contract before it runs it. The node keeps the analyses in one table for the process. From 0.9.5, the table also holds a copy of each code with 33 bytes of STOP after its end, so the interpreter needs no end-of-code test. The executing thread and the prewarm threads share it. The JSON-RPC threads read it too. They add only code of the chain (never code of a state override, of a contract that the call created or of the pending block), and only up to half of the limits of bytes and entries. A lookup takes no lock. An insert takes a lock. Past the limit, each block uses a cache of its own for the analyses of new contracts.

Precompile results ​

The precompiles cost about 11 ms per mainnet block on the executing thread, mostly ecrecover and modexp. The node keeps the results of the costly precompiles: ecrecover, modexp, bn254 multiplication and pairing, KZG point evaluation, BLS12-381 and P-256. The prewarm runs the same calls with the same inputs first. The node keeps the results in a fixed table of slots with sequence locks. It keeps only outputs of 256 bytes or less. A lookup takes no lock. The cost of a precompile depends only on its input. So a hit with too little gas computes the call again and fails in the same way.

Forks and pending blocks ​

The node keeps every valid block in memory until the writer writes it. A reorg among the blocks in memory needs no change to the database. The forkchoice update moves the head to another branch of the tree.

A fork below the database head is different. The parent is a block that the node already wrote. The node builds reverse layers from the undo records, from the database head down to the fork base. Over these layers, the state is the state of the fork base. The database does not change.

  • A parent 1 or 2 blocks below the database head (for example a sibling of the head). The node executes the block over the layers at engine_newPayload and answers VALID or INVALID, as reth does.
  • A deeper parent. The node keeps the block as a pending block and answers ACCEPTED. It does not execute it yet. When a forkchoice update selects a pending head, the node waits for the writer, so that the database head does not move. Then it executes the pending blocks over the layers, oldest first. If a block is invalid, that block and its pending descendants become INVALID.

When a forkchoice update selects a valid block of such a fork, the node does not write. The branch becomes the head in memory at once and keeps its layers. New blocks on the branch execute over the layers. The writer thread then removes the old blocks above the fork base and writes the branch in one transaction. For this write, read Forks below the database head.

The undo window limits the depth of such a fork to 128 blocks. For the undo records, read State database.