refactor: consolidate all preSealVerifyBidBlock checks into verify_bid_block_payload#414
Conversation
…ify_bid_block_payload Mirrors go-bsc's preSealVerifyBidBlock order inside a single function: 1. validate_header (VerifyUnsealedHeader) 2. block_time_upper_check (BlockTimeUpperCheck) 3. coinbase / gas-limit checks 4. extract_bid_block_deposit_value + gas-fee validation 5. validate_bid_block_blob_sidecars 6. per-tx gas cap (EIP-7825) 7. verify_bid_block_system_txs Previously checks 1-2 lived in a separate verify_bid_block_header called after finalize_new_header, and the rest lived in verify_bid_block_payload called before finalize. Now verify_bid_block_payload contains all checks and simulate_bid_block calls it on the finalized header post-finalize (so validate_header sees the correct Parlia extra). system_tx_start is pre-computed from decoded.txs for bind-signing, which still must run before finalize. pre_seal_verify_bid_block now delegates entirely to verify_bid_block_payload. verify_bid_block_header is removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pull Request ReviewThis PR refactors bid block pre-seal validation by merging previously split header and payload checks into a single Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
|
Closing: pre_seal_verify_bid_block already contained all 4 preSealVerifyBidBlock checks. The consolidation was unnecessary. |
Problem
verify_bid_block_payloadwas missing two of the four checks from go-bsc'spreSealVerifyBidBlock:VerifyUnsealedHeaderverify_bid_block_header(separate fn, called after finalize)BlockTimeUpperCheckverify_bid_block_header(separate fn, called after finalize)ExtractBidBlockDepositValue+ gas feeverify_bid_block_payload✓validateBidBlockBlobSidecarsverify_bid_block_payload✓Fix
verify_bid_block_payloadnow contains all go-bscpreSealVerifyBidBlockchecks in order.
verify_bid_block_headeris removed.simulate_bid_blockis restructured to match geth's execution order:system_tx_startfromdecoded.txs(for bind-signing, must precede finalize)bind_sign_bid_block_system_txsset_bid_block_mev_infofinalize_new_headerverify_bid_block_payloadon the finalized header (sovalidate_headersees the correct Parlia extra format)pre_seal_verify_bid_blocknow delegates entirely toverify_bid_block_payload.Test plan
cargo test -p reth_bsc bid_block -- --test-threads=1— all 47 tests passcargo clippy— no warningsverify_bid_block_payload_includes_header_checkscovers the previously-untestedInvalidHeaderrejection path🤖 Generated with Claude Code