Skip to content

fix(executor): prevent header validation panic, enforce strict timestamps, validate chain_id#8

Open
wpank wants to merge 3 commits into
Nunchi-trade:mainfrom
wpank:fix/executor-header-timestamp-chainid-validation
Open

fix(executor): prevent header validation panic, enforce strict timestamps, validate chain_id#8
wpank wants to merge 3 commits into
Nunchi-trade:mainfrom
wpank:fix/executor-header-timestamp-chainid-validation

Conversation

@wpank
Copy link
Copy Markdown

@wpank wpank commented May 30, 2026

Summary

  • #118: validate_header_against_parent panics when parent.number == u64::MAX due to unchecked parent.number + 1 overflow. Fixed by using checked_add and returning an ExecutionError::BlockValidation on overflow.

  • #119: Timestamp validation uses < (allows header.timestamp == parent.timestamp), violating Ethereum consensus rules that require strictly increasing timestamps. Fixed by changing to <=.

  • #121: decode_tx_env accepts the chain_id parameter but never validates it (parameter was prefixed with _). Added chain ID validation that rejects transactions with mismatched chain IDs. Pre-EIP-155 legacy transactions without a chain ID are still accepted for backward compatibility.

Test plan

  • Added validate_header_against_parent_max_block_number test: verifies u64::MAX parent number returns error instead of panicking
  • Updated validate_header_against_parent_timestamp test: verifies equal timestamps are now rejected
  • Added validate_header_rejects_equal_timestamp test: dedicated test for strict timestamp enforcement
  • Added decode_tx_env_rejects_wrong_chain_id test: verifies wrong chain ID is rejected
  • Added decode_tx_env_accepts_matching_chain_id test: verifies correct chain ID is accepted
  • Added execute_skips_wrong_chain_id_tx test: verifies wrong chain ID tx is skipped in block execution (not crash)
  • All 50 unit tests and 45 integration tests pass

🤖 Generated with Claude Code

will pankiewicz and others added 3 commits May 29, 2026 22:45
…amps, validate chain_id

Fix three executor validation bugs:

- #118: validate_header_against_parent panics on parent.number == u64::MAX
  due to unchecked addition. Use checked_add and return an error on overflow.

- #119: Timestamp validation allows header.timestamp == parent.timestamp.
  Change from `<` to `<=` to enforce strictly increasing timestamps per
  Ethereum consensus rules.

- #121: decode_tx_env ignores the chain_id parameter (prefixed with `_`).
  Add chain_id validation that rejects transactions whose chain_id does
  not match the executor's configured chain_id. Pre-EIP-155 legacy
  transactions without a chain_id are still accepted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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