erigontech / erigontech/silkworm

sync: update stage bodies validation rules

Open
#2,347 0 comments 0 reactions 0 assignees View on GitHub
pos sync
Dominant language
C++
Stars
318
Forks
84
PR merge metrics
No merged PRs in 30d

Description

BodiesStage was meant to check `rule_set_->pre_validate_block_body` to perform a "full body validation", but for optimization reasons the root hash checks were skipped, because they are expensive and are already done in https://github.com/erigontech/silkworm/blob/master/silkworm/sync/internals/body_sequence.cpp#L70-L71 . The remaining checks were performed (pre_validate_transactions, validate_ommers).

Since then `pre_validate_block_body` has grown to include more checks (block.withdrawals, header.withdrawals_root, blob_gas_used).

We need to ensure that these checks are performed either at the time of block consumption in sync, or in BodiesStage.
It would be nice to refactor the code in such a way that future updates to the rules are automatically applied in the BodiesStage.

Note: a header corresponding to the body is not available in sync, but becomes available in the stage.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.