Repository navigation
perf(rpc): hash cached block transactions once - #28552
Merged
Merged
Conversation
Transactions read from the database carry no hash. A block response with full transactions clones the cached block before converting it, so every request hashed every transaction of the block again on the clone, and the cached block never kept the hashes. The state cache now hashes the transactions of a fetched block once before sharing it. On a mainnet block with full transactions (eth_getBlockByNumber, block 26406938), one connection went from 1060 to 1650 requests/s (mean 940 to 605 us) and 16 connections from 9.3k to 12.4k requests/s.
Member
👁️ Cyclops Security Review✅ Reviewed 5428905 (latest) · Coverage: partial · no open findings · report |
Drop the hashing pass from the state cache's block fetch. It ran for every fetched block, including for callers that never read transaction hashes (fee history rewards, header and count lookups). reth-core's `clone_into_rpc_block` now hashes each transaction through the reference before cloning it, so the first full-transaction response fills the hashes on the cached block and later responses reuse them. Bumps reth-core to paradigmxyz/reth-core#89, which also brings in the codec changes from paradigmxyz/reth-core#72, #81, #83 and #84.
paradigmxyz/reth-core#89 merged as 5dabd396f4, with the same tree as the PR commit pinned before.
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-tempoxyz__tempo
that referenced
this pull request
Nov 17, 2026
Automated nightly update of reth dependencies from `paradigmxyz/reth` main branch. ## Upstream reth changes [`31d05e1...f551b68`](paradigmxyz/reth@31d05e1...f551b68) 🔗 Amp thread: https://ampcode.com/threads/T-01a1e993-b347-76cd-8ff2-f35efe2c042f **RPC** - Replaced soketto with tokio-tungstenite for WebSockets, then wrote WS frames directly, without tungstenite. Close replies are now preserved, and the WS connection closes on oversized fragmented messages ([#28553](paradigmxyz/reth#28553), [#28557](paradigmxyz/reth#28557), [#28558](paradigmxyz/reth#28558), [#28544](paradigmxyz/reth#28544)) - Added timeouts for stalled WebSocket reads and idle HTTP/1 keep-alive connections ([#28515](paradigmxyz/reth#28515), [#28545](paradigmxyz/reth#28545)) - HTTP hardening: - Over-limit streamed request bodies get a 413 response, and refused upgrades get a 400. - Only the request line is logged. - The content-type check compares only the JSON media type. - Request input is kept out of params and version errors. - ([#28546](paradigmxyz/reth#28546), [#28547](paradigmxyz/reth#28547), [#28493](paradigmxyz/reth#28493), [#28503](paradigmxyz/reth#28503)) - Server performance work: - The RPC service is built once per connection. - Sync blocking IO closures run directly. - Params are no longer copied for async methods. - Response buffers are copied less often. - Pubsub notifications are serialized once. - ([#28522](paradigmxyz/reth#28522), [#28517](paradigmxyz/reth#28517), [#28519](paradigmxyz/reth#28519), [#28500](paradigmxyz/reth#28500), [#28499](paradigmxyz/reth#28499)) - Faster lookups: - Receipt and tx lookup misses take a single provider read. - Cached block transactions are hashed once. - MEV bundle metadata is no longer cloned per transaction. - ([#28524](paradigmxyz/reth#28524), [#28552](paradigmxyz/reth#28552), [#28512](paradigmxyz/reth#28512)) **Engine / Consensus** - Split the engine tree handler into modules, and split the chain-state `in_memory` module so in-memory blocks sit behind a single lock ([#28507](paradigmxyz/reth#28507), [#28506](paradigmxyz/reth#28506), [#28543](paradigmxyz/reth#28543)) - BAL hash validation still runs when the requests hash check is skipped, and BAL retention is capped at the bodies prune distance ([#28535](paradigmxyz/reth#28535), [#28529](paradigmxyz/reth#28529)) - The engine request span is kept on payload build workers ([#28571](paradigmxyz/reth#28571)) **Trie** - Queued proof jobs are dropped together with their handle, and V1 proofs receive the sorted overlay ([#28509](paradigmxyz/reth#28509), [#28570](paradigmxyz/reth#28570)) - Added bucketed fuzz coverage ([#28541](paradigmxyz/reth#28541)) **Storage / DB** - History reads are floored at the lowest changeset, RPC trie reverts are no longer cached, and side chain blocks are served by hash ([#28549](paradigmxyz/reth#28549), [#28511](paradigmxyz/reth#28511), [#28528](paradigmxyz/reth#28528)) - The CLI archives RocksDB SSTs one file at a time ([#28456](paradigmxyz/reth#28456)) **EVM** - Absent accounts are added to witness keys ([#28527](paradigmxyz/reth#28527)) - Updated evm2 to e681662 ([#28540](paradigmxyz/reth#28540)) **Txpool** - Added the `--txpool.enforce-tracked-nonce` flag ([#28526](paradigmxyz/reth#28526)) **Build** - Version metadata is stamped into the binaries, and the build timestamp is left out of libmdbx ([#28567](paradigmxyz/reth#28567), [#28573](paradigmxyz/reth#28573)) **Testing** - Trie workers are drained in the engine hashing task test ([#28554](paradigmxyz/reth#28554)) ## Migrations 🔗 Amp thread: https://ampcode.com/threads/T-01a1e994-010c-74bf-ba4d-8f9ddde55ac8 - Bumped the reth git dependencies (including the `jsonrpsee` entry pinned to the reth repo) from `31d05e14` to `0e57f259`, `reth-core` from `275ce4cf` to `5dabd396`, and evm2 and its DaniPopes patch entries from `66687c18` to `e681662b`. - Replaced the removed `GasParams::eip7702_auth_state_gas()` helper. Intrinsic gas now adds `new_account_state_gas()` and `GasId::TxEip7702PerAuthState` itself. - Renamed the remaining `eip7702_auth_state_gas()` calls in the `gas_params.rs` tests to `new_account_state_gas()`. The expected values (225,000 state, 250,000 total per auth) stay the same. - Dropped the `state_refund` field from `GasSettlement`, since upstream removed it. It is gone from `prepare_aa`, `execute_aa`, and every test that builds a `GasSettlement`. - `execute_aa` now subtracts the authorization state-gas refund from `state_gas_spent` itself after `settle_transaction` returns. Before, `settle_transaction` received it through `state_refund`. The refund goes back to the reservoir, so it should not count as state gas spent. [GitHub Workflow](https://github.com/tempoxyz/tempo/actions/runs/44086786369) --------- Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Transactions read from the database carry no hash.
eth_getBlockByNumber/ByHashwith full transactions clones the cached block before converting it, so every request hashed every transaction of the block again on the clone, and the cached block never kept the hashes. Keccak was about a third of the node's CPU for these requests.This bumps reth-core to include paradigmxyz/reth-core#89, where
clone_into_rpc_blockhashes each transaction through the reference before cloning it. The first full-transaction response fills the hashes on the cached block and later responses reuse them, while callers that never read hashes pay nothing. The bump also brings in the codec changes since the last pin (paradigmxyz/reth-core#72, paradigmxyz/reth-core#81, paradigmxyz/reth-core#83, paradigmxyz/reth-core#84).Mainnet block 26406938 with full transactions, live node, two interleaved runs per build. Measured at 4950575, which hashed in the state cache instead; not re-measured at the current head, where repeated requests take the same path:
Blocks served from the in-memory chain already carry hashes and are unchanged.