-
Notifications
You must be signed in to change notification settings - Fork 20.9k
eth, eth/filters: implement API error code for pruned blocks #31361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I have folded #31366 into this PR. Doesn't make sense to have it standalone, since changes are required in the API backend to support earliest. |
eth/api_backend.go
Outdated
@@ -428,3 +455,8 @@ func (b *EthAPIBackend) StateAtBlock(ctx context.Context, block *types.Block, re | |||
func (b *EthAPIBackend) StateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (*types.Transaction, vm.BlockContext, *state.StateDB, tracers.StateReleaseFunc, error) { | |||
return b.eth.stateAtTransaction(ctx, block, txIndex, reexec) | |||
} | |||
|
|||
type prunedHistoryError struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's indeed weird to have duplicated error definitions in different package. Nitpick :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep agree I now made the definition in api_backend public instead.
Please rebase. Otherwise sgtm. Note: There may be other areas that also require cutoff handling. It's fine to merge these first |
I thought of all state-related APIs (eth_getBalance, eth_call) but I doubt archive nodes will want to prune their node. Makes me think we should probably check in the prune history command and explicitly reject it for archive nodes. |
… state. duplicate prunedHistoryError into eth/filters package. add HistoryCutoff method to eth backend
With history pruning, we want to redefine what the "earliest" block tag means. We need to assign a special negative integer value to this constant, otherwise we cannot tell it apart from block zero, the genesis block.
…filter on a blockhash before the prune point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased. It passes workload tests on Sepolia, so I will merge.
…m#31361) Implements ethereum#31275 --------- Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com> Co-authored-by: Felix Lange <fjl@twurst.com>
…m#31361) Implements ethereum#31275 --------- Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com> Co-authored-by: Felix Lange <fjl@twurst.com>
These were caused by crossed merges of recent PRs ethereum#31414 and ethereum#31361
…m#31361) Implements ethereum#31275 --------- Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com> Co-authored-by: Felix Lange <fjl@twurst.com>
These were caused by crossed merges of recent PRs ethereum#31414 and ethereum#31361
This changes the API backend to return null for not-found blocks. This behavior is required by the RPC When `BlockByNumberOrHash` always returned an error for this case ever since being added in #19491. The backend method has a couple of call sites, and all of them handle a `nil` block result because `BlockByNumber` returns `nil` for not-found. The only case where this makes a real difference is for `eth_getBlockReceipts`, which was changed in #31361 to actually forward the error from `BlockByNumberOrHash` to the caller.
This changes the API backend to return null for not-found blocks. This behavior is required by the RPC When `BlockByNumberOrHash` always returned an error for this case ever since being added in ethereum#19491. The backend method has a couple of call sites, and all of them handle a `nil` block result because `BlockByNumber` returns `nil` for not-found. The only case where this makes a real difference is for `eth_getBlockReceipts`, which was changed in ethereum#31361 to actually forward the error from `BlockByNumberOrHash` to the caller. Signed-off-by: jsvisa <delweng@gmail.com>
Implements #31275
I find it a bit weird to define the error type in
eth/
but I feel like that is the place to return it.