Repository navigation
fix(firehose): emit the built block access list when a block has no sidecar - #99
Conversation
On the live path, the Firehose header gets block_access_list_rlp from the payload's BAL sidecar. A block the engine downloads can carry a block_access_list_hash and no sidecar. Its Firehose header then kept the hash and had no RLP, although the node built the list and checked it against the header. The header now falls back to the RLP of the built list when there is no sidecar. validate_post_execution checks the built list against the header hash before the Firehose flush, so the emitted bytes match the header. The sidecar still wins when the block has one.
|
|
||
| // Firehose live path: the EIP-7928 block access list RLP for the emitted header, taken | ||
| // before `validate_post_execution` consumes the built list. | ||
| let fh_bal_rlp = fh_tracer |
There was a problem hiding this comment.
The tests only cover firehose_bal_rlp, not this line.
Add a test that has the node download a block from a peer that serves no BAL, with the tracer on, and checks that the emitted header has the BAL bytes.
That's the case this PR fixes, and the test should fail without it.
There was a problem hiding this comment.
Added in 8ad0429: crates/engine/tree/tests/firehose_live_tracing_bal_without_sidecar.rs. With the tracer on, the node downloads an Amsterdam block from a peer that serves no BAL. The test checks that the emitted header carries the BAL RLP and that it hashes to the header's block_access_list_hash. With the payload_validator.rs changes reverted, it fails with emitted no BAL RLP. With them, it passes.
…decar Review on paradigmxyz#99: the node downloads an Amsterdam block from a peer that serves no BAL, with the tracer on. The test checks that the emitted header carries the RLP of the BAL the node built, and that it hashes to the header's block_access_list_hash. It fails without the fix with "emitted no BAL RLP".
052ddc5
into
streamingfast:release/reth-2.x
On the live path, the Firehose header gets
block_access_list_rlpfrom the payload's BAL sidecar. A block that the engine downloads from a peer (BlockOrPayload::Block) can carry ablock_access_list_hashand no sidecar. For that block the Firehose header keeps the hash and has no RLP, although the node built the list and checked it against the header.This PR falls back to the RLP of the built list when there is no sidecar. The traced serial path enables the BAL builder whenever the block declares a BAL hash (
has_block_access_list), so the built list exists for such a block. The newfirehose_bal_rlphelper picks the bytes, and the payload validator calls it only while the tracer is active, beforevalidate_post_executionconsumes the built list.validate_post_executionchecks the built list against the header hash before the Firehose flush, so the emitted bytes always match the header. The sidecar still wins when the block has one, so payload blocks emit exactly the same bytes as before.Tests
Unit tests in
payload_validator.rscover the three cases: the sidecar wins over the built list, the built list is used without a sidecar, and nothing is emitted without either.Fail before, pass after. The helper does not exist on
release/reth-2.x, so the tests do not compile there. As a negative control, I changed the helper to the old behavior (sidecar only). Thenfirehose_bal_rlp_uses_the_built_list_without_a_sidecarfails and the other two pass. With this PR, all three pass.tests/firehose_live_tracing_bal_without_sidecar.rscovers the downloaded block end to end. With the tracer on, the node downloads an Amsterdam block from a peer that serves no BAL. The test checks that the emitted header carries the RLP of the built BAL, and that this RLP hashes to the header'sblock_access_list_hash. With thepayload_validator.rschanges reverted, it fails withemitted no BAL RLP. With them, it passes.Notes
cargo clippy -p reth-engine-tree --all-targets -- -D warningsfails onrelease/reth-2.xalready, on lines this PR does not touch:type_repetition_in_bounds(payload_validator.rs, theEvm: FirehoseLiveHooksbounds),needless_pass_by_ref_mut(payload_validator.rs),unused_mut(crates/rpc/rpc/src/debug.rs:1604), and thereth-firehoselints. With those allowed, clippy is clean.cargo +nightly fmtalso wants to reformatcrates/engine/tree/src/tree/payload_processor/bal/firehose.rsonrelease/reth-2.x. This PR leaves that file alone.