erigon
erigon copied to clipboard
Add "latestIndexed" defaultBlock param value
Goal: allow a block to be ignored for purposes of RPC, until all ancillary internal data structures for that block that power other RPC methods have been built (and become available to an external rpcdaemon).
Changes:
- Add defaultBlock param-value
latestIndexed, to refer to the lowest block-height that has passed all stages - For chains not driven by CL fork-choice, for which
latestcurrently meanslatestExecuted, changelatestto meanlatestIndexedinstead.
Making latest mean latestIndexed provides safety by default, and matches geth semantics.
People who want to trade safety for efficiency, to see partially-processed blocks during first sync after restart, can make this desire explicit by passing latestExecuted rather than latest.
matches geth semantics - what does it mean? I don't see this parameter in geth source code
FYI: some related PR https://github.com/ledgerwatch/erigon/pull/7532
matches geth semantics - what does it mean? I don't see this parameter in geth source code
Geth's RPC code inherently can't see a block until that block goes through all stages of processing (since in geth, RPC can only get a handle on blocks through the chain head, and that's the last thing to be advanced during block insert.) eth_blockNumber("latest") in geth has the semantics of returning a reference to the highest known "finished" block.
This PR would make Erigon's eth_blockNumber("latest") do the same thing that Geth's eth_blockNumber("latest") does: avoid revealing unfinished blocks.
This PR also introduces an explicit name for this semantics, latestIndexed, to distinguish it from the current semantics, which is also known as latestExecuted. Client software that wants to get a specific semantics, but not fall back to some other semantics if it isn't, can do so by using the explicit name. (I presume that this explicit-ness is the reason that latestExecuted was added, despite latest also being aliased to latestExecuted.)
Changing the meaning of latest is the reason I did the PR. Adding another explicit name isn't so important. (But I'm not sure why you wouldn't add it. Adding values to an enum never breaks API compatibility; existing clients just won't know about those options, and so won't use them.)
This PR is stale because it has been open for 40 days with no activity.
Hello, We encountered a similar problem and ended up seeing an inconsistent state in the logs. Is there a reason this PR is stale?
@gdevanla what is your version?
@AskAlexSharov We are on erigon version 2.42.0-stable-beb97784
Closing since it's very old