Skip to content

refactor(rpc): drop the unreachable pre-Jade witness gate - #178

Merged
panos-xyz merged 1 commit into
codex/reth-main-history-prooffrom
refactor/witness-cleanup
Sep 1, 2026
Merged

refactor(rpc): drop the unreachable pre-Jade witness gate#178
panos-xyz merged 1 commit into
codex/reth-main-history-prooffrom
refactor/witness-cleanup

Conversation

@panos-xyz

Copy link
Copy Markdown
Contributor

Follow-up review cleanup on d8ff161.

Drop the pre-Jade gate

ensure_mpt_parent rejected requests whose parent state predates Jade. It cannot fire in practice: the retained proof window spans days, Jade activated months ago, so no in-window parent is ever pre-Jade. The only way to reach it is widening --proofs-history.window across the fork, and it would then answer with a hardfork error when the honest answer is that such a configuration was never supported.

What it cost:

  • an extra sealed_header_by_hash lookup on the runtime for every request, only to read a timestamp
  • a chain_spec field and constructor argument on the RPC handler
  • a rejection path no end-to-end test can reach, because crates/node/tests/assets/test-genesis.json sets jadeForkTime: 0 — only the pure ensure_mpt_parent(bool) unit test covered it

The reasoning survives as a module comment, so the absence of the check reads as a decision rather than an omission.

Comment the two vendored divergences

crates/proofs/NOTICE.md pins that crate to Base b2673bbd, and these are the only two places where it deliberately departs from upstream:

  • proof.rs — force-includes the root node for the legacy shape only (Base does it unconditionally)
  • provider.rs — sorts canonical output (Base never sorts)

Both were uncommented. A future sync from Base would put a conflict in front of whoever is resolving it with no indication that the local side is intentional, and resolving towards upstream would silently restore a half-canonical witness: mode reachable on the wire, but only part of its semantics applied — worse than either consistent state. Both comments now name the divergence, point at reth's HistoricalStateProviderRef::witness as the reference, and say to keep the local side.

Style

parent_block_id documents why the parent is addressed by hash rather than by block_number - 1: executionWitnessByBlockHash accepts any block still in the database, so a height would resolve to the canonical block at that height and replay the requested block against a sibling branch's state, returning a successful but meaningless witness. A hash reaches the canonical check in MorphProofStateProviderFactory and fails the request instead.

The morph_chainspec submodule-path import goes away with the gate, so the remaining imports are consistent with the rest of the crate.

Testing

  • cargo nextest run -p morph-rpc -p morph-proofs — 251 passed
  • cargo nextest run -p morph-node --features test-utils -E 'binary(it)' — 117 passed
  • cargo clippy --all --all-targets -- -D warnings and the morph-node --features test-utils variant — clean
  • cargo fmt --all -- --check — clean

No behaviour change for any reachable request: the removed gate was unreachable, and the added comments are comments.

The gate rejected witness requests whose parent state predates Jade, but no
request can reach that far: the retained window spans days while Jade activated
months ago. It could only fire if an operator widened the window across the fork,
and it would then report a hardfork error where the honest answer is that such a
configuration was never supported. In exchange it cost an extra header lookup on
the runtime, a `chain_spec` dependency on the RPC handler, and a rejection path
that no end-to-end test can exercise, since the e2e genesis activates Jade at
timestamp 0.

The reasoning is kept as a module comment so the next reader does not have to
re-derive why the check is absent.

Also comment the two places where `morph-proofs` deliberately diverges from the
vendored Base source (`proof.rs` conditioning the forced root node, `provider.rs`
sorting canonical output). Those are the only divergences in a crate whose
NOTICE.md pins it to Base `b2673bbd`, so an uncommented conflict during a future
sync would very likely be resolved towards upstream, silently restoring a
half-canonical witness: the mode parameter reachable, but only half of its
semantics applied. Both comments say to keep the local side.

`parent_block_id` gains the reasoning for addressing the parent by hash rather
than by height, which is what makes an abandoned-branch request fail instead of
silently replaying against a sibling branch's state.
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 14825188-ecf6-4f41-a1c2-a2999cd3d6f9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@panos-xyz
panos-xyz merged commit 9489bdd into codex/reth-main-history-proof Sep 1, 2026
3 checks passed
@panos-xyz
panos-xyz deleted the refactor/witness-cleanup branch September 1, 2026 09:55
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