Skip to content

Commit d9d9f18

Browse files
committed
more docs
1 parent 39b977c commit d9d9f18

File tree

5 files changed

+24
-48
lines changed

5 files changed

+24
-48
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111
- Add missing payload attribute extraction in `EvolvePayloadBuilder` to properly handle transactions submitted via Engine API ([#33](https://github.com/evstack/ev-reth/pull/33))
1212
- Remove unused configuration parameters to clean up codebase ([#32](https://github.com/evstack/ev-reth/pull/32))
13+
- Ensure `stateRoot` follows Ethereum post-state semantics to avoid false fork reports caused by height-1 root mismatches
1314

1415
### Changed
1516
- Use `best_transactions` instead of `pending_transactions` queue for improved transaction selection logic ([#29](https://github.com/evstack/ev-reth/pull/29))

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ Reth had to ignore block-hash mismatches and upstream tooling flagged every bloc
464464
networks can opt-in to canonical keccak block hashes by setting `hashRewireActivationHeight` inside
465465
the `evolve` section of the chainspec:
466466

467+
Separately, Ethereum clients expect `stateRoot` to be the current block's post-state root (after
468+
executing this block's transactions on top of the parent). If an integration accidentally supplies
469+
the parent (height-1) root instead, execution clients can report persistent "forks" that are really
470+
just state-root mismatches. ev-reth computes and exposes the canonical post-state root so state-root
471+
validation behaves like standard Ethereum.
472+
467473
```json
468474
"config": {
469475
...,

crates/node/src/builder.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ where
177177
}
178178
}
179179

180-
// Finish building the block - this calculates the proper state root
180+
// Finish building the block. This computes the *current block's* post-state root.
181+
//
182+
// Ethereum clients expect `header.state_root` to equal the post-state after executing the
183+
// transactions in this block on top of the parent state. Accidentally using the parent
184+
// (height-1) state root here can make downstream execution clients think each block is on
185+
// a different fork, even when the chain is otherwise canonical.
181186
let BlockBuilderOutcome {
182187
execution_result: _,
183188
hashed_state: _,
@@ -189,6 +194,9 @@ where
189194

190195
let mut sealed_block = block.sealed_block().clone();
191196

197+
// Legacy mode: preserve historical behavior where the Engine API block hash did not match
198+
// the canonical keccak header hash. We intentionally re-seal with an alternate hash while
199+
// keeping the Ethereum `state_root` intact for normal state-root validation.
192200
if !self.config.is_hash_rewire_active_for_block(block_number) {
193201
let legacy_hash = sealed_block.header().state_root;
194202
let legacy_block = sealed_block.clone_block();

crates/node/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ pub struct EvolvePayloadBuilderConfig {
4848
#[serde(default)]
4949
pub contract_size_limit_activation_height: Option<u64>,
5050
/// Block height at which canonical hash rewiring activates.
51+
///
52+
/// Before activation, ev-reth operates in "legacy" mode to support deployments that flowed an
53+
/// application-level hash through Engine API payloads. In that mode the node may bypass block
54+
/// hash mismatches and re-seal blocks with an alternate hash for compatibility.
55+
///
56+
/// After activation, the node enforces canonical keccak block hashes as expected by standard
57+
/// Ethereum tooling. Note that `header.state_root` always follows Ethereum semantics (the
58+
/// current block's post-state root), independent of this setting.
5159
#[serde(default)]
5260
pub hash_rewire_activation_height: Option<u64>,
5361
}

docs/canonical-hash-plan.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)