You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c2fca0f
Browse filesBrowse the repository at this point in the historyBrowse files
Skip consensus params on eth_getLogs contexts (#4734)
On the default pebbledb receipt store, `eth_getLogs`, filter polls and
log subscriptions scan block by block, and each block builds four or
five SDK contexts through `RPCContextProvider`. Every build calls
`GetConsensusParams`, which costs 14 store reads, but nothing on the log
path reads `ctx.ConsensusParams()`. Under getLogs load on v6.7.2, this
was about 26% of node CPU in an RPC operator's production profile.
This change adds `RPCContextProviderWithoutConsensusParams`, which
returns the same context without `ConsensusParams`. It is passed to
`NewEVMHTTPServer` and `NewEVMWebSocketServer` as `logCtxProvider` and
used only by `FilterAPI` and the subscription `LogFetcher`. Every other
API keeps `RPCContextProvider`, including newHeads, which reads the
block gas limit. The change is RPC-only and does not touch state or
consensus code.
Measured on a local single-validator chain (v6.7.2 with this change
applied, about 45k blocks, `worker_pool_size = 1024`), 20 parallel
2000-block `eth_getLogs` calls went from 5.4 to 13.7 req/s, with p50
dropping from 3.7s to 1.5s. A single 2000-block query went from about
390ms to 145ms, and a 1490-log response hashed identically before and
after. The new app test checks that the provider differs from
`RPCContextProvider` only in `ConsensusParams`, and the `evmrpc` suites
run their log tests against contexts without them.
Part of PLT-1566.
0 commit comments