Skip to content

fix(rpc): add block timestamp validation in eth_simulateV1#21397

Merged
mattsse merged 1 commit intomainfrom
fix/eth-simulate-timestamp-validation
Jan 26, 2026
Merged

fix(rpc): add block timestamp validation in eth_simulateV1#21397
mattsse merged 1 commit intomainfrom
fix/eth-simulate-timestamp-validation

Conversation

@mattsse
Copy link
Collaborator

@mattsse mattsse commented Jan 24, 2026

Summary

Adds block timestamp validation for eth_simulateV1 to ensure timestamps are strictly increasing when overridden.

Changes

  • Updated EthSimulateError::BlockTimestampInvalid to include got and parent fields for detailed error messages
  • Added validation in simulate_v1 to check timestamp ordering
  • Returns error code -38021 with message matching geth format: "block timestamps must be in order: X <= Y"

Motivation

Fixes failing Hive rpc-compat test: ethSimulate-block-timestamp-order-38021.io

The execution-apis spec requires that block timestamps in eth_simulateV1 must be strictly increasing. This aligns reth with geth's behavior.

Dependencies

Builds on #21396 (block number validation).

Test

The fix can be verified by running the Hive rpc-compat tests for eth_simulateV1.

@mattsse mattsse added the A-rpc Related to the RPC implementation label Jan 24, 2026
@mattsse mattsse requested a review from Rjected as a code owner January 24, 2026 12:49
@mattsse mattsse added the A-rpc Related to the RPC implementation label Jan 24, 2026
@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Jan 24, 2026
@mattsse mattsse force-pushed the fix/eth-simulate-timestamp-validation branch from b04e66b to ef9c665 Compare January 24, 2026 12:57
@mattsse mattsse force-pushed the fix/eth-simulate-block-number-validation branch 2 times, most recently from 4f9826c to 5c4e391 Compare January 24, 2026 13:15
@mattsse mattsse force-pushed the fix/eth-simulate-timestamp-validation branch from ef9c665 to 5d38d8d Compare January 24, 2026 13:24
Base automatically changed from fix/eth-simulate-block-number-validation to main January 26, 2026 13:56
@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Jan 26, 2026
Validates that block timestamps are strictly increasing when overridden in
eth_simulateV1 calls. Returns error code -38021 (BlockTimestampInvalid)
if a timestamp is less than or equal to the previous block timestamp.

This aligns with the geth implementation and the execution-apis spec.
Fixes failing Hive rpc-compat tests for eth_simulateV1.

Amp-Thread-ID: https://ampcode.com/threads/T-019bf01b-ec5c-775e-9997-98c5dd7248ac
Co-authored-by: Amp <amp@ampcode.com>
@mattsse mattsse force-pushed the fix/eth-simulate-timestamp-validation branch from 5d38d8d to 5878acf Compare January 26, 2026 14:04
@mattsse mattsse enabled auto-merge January 26, 2026 14:04
@mattsse mattsse added this pull request to the merge queue Jan 26, 2026
Merged via the queue into main with commit c7faafd Jan 26, 2026
45 checks passed
@mattsse mattsse deleted the fix/eth-simulate-timestamp-validation branch January 26, 2026 14:21
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Jan 26, 2026
rakita pushed a commit that referenced this pull request Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rpc Related to the RPC implementation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants