Skip to content

refactor: consolidate all preSealVerifyBidBlock checks into verify_bid_block_payload#414

Closed
chee-chyuan wants to merge 1 commit into
develop-hardfork-pasteurfrom
fix/mev-preseal-verify-consolidate
Closed

refactor: consolidate all preSealVerifyBidBlock checks into verify_bid_block_payload#414
chee-chyuan wants to merge 1 commit into
develop-hardfork-pasteurfrom
fix/mev-preseal-verify-consolidate

Conversation

@chee-chyuan

Copy link
Copy Markdown
Contributor

Problem

verify_bid_block_payload was missing two of the four checks from go-bsc's
preSealVerifyBidBlock:

go-bsc reth-bsc (before)
VerifyUnsealedHeader verify_bid_block_header (separate fn, called after finalize)
BlockTimeUpperCheck verify_bid_block_header (separate fn, called after finalize)
ExtractBidBlockDepositValue + gas fee verify_bid_block_payload
validateBidBlockBlobSidecars verify_bid_block_payload

Fix

verify_bid_block_payload now contains all go-bsc preSealVerifyBidBlock
checks in order. verify_bid_block_header is removed.

simulate_bid_block is restructured to match geth's execution order:

  1. Pre-compute system_tx_start from decoded.txs (for bind-signing, must precede finalize)
  2. bind_sign_bid_block_system_txs
  3. Header overwrite + set_bid_block_mev_info
  4. finalize_new_header
  5. verify_bid_block_payload on the finalized header (so validate_header sees the correct Parlia extra format)

pre_seal_verify_bid_block now delegates entirely to verify_bid_block_payload.

Test plan

  • cargo test -p reth_bsc bid_block -- --test-threads=1 — all 47 tests pass
  • cargo clippy — no warnings
  • verify_bid_block_payload_includes_header_checks covers the previously-untested InvalidHeader rejection path

🤖 Generated with Claude Code

…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>
@hashdit-bot

hashdit-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

Pull Request Review

This PR refactors bid block pre-seal validation by merging previously split header and payload checks into a single verify_bid_block_payload function, aligning the check order with go-bsc’s preSealVerifyBidBlock. It also updates simulate_bid_block to finalize the header before running full verification, while precomputing system_tx_start earlier for bind-signing flow correctness. Tests were updated accordingly to ensure header-related rejection paths are now covered through the consolidated verifier.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

@chee-chyuan

Copy link
Copy Markdown
Contributor Author

Closing: pre_seal_verify_bid_block already contained all 4 preSealVerifyBidBlock checks. The consolidation was unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant