Skip to content

Make witness generation conform to draft specs#8

Open
jsign wants to merge 8 commits intoparadigmxyz:mainfrom
jsign:jsign/witness-generation-testing
Open

Make witness generation conform to draft specs#8
jsign wants to merge 8 commits intoparadigmxyz:mainfrom
jsign:jsign/witness-generation-testing

Conversation

@jsign
Copy link
Contributor

@jsign jsign commented Feb 17, 2026

For context, please see paradigmxyz/reth#22289 PR description.

This PR contains some extra fixes that now live in this repo. It temporarily adds a patch in crates to use that Reth branch.

I'll create PR comments to explain better the changes.

Trying to get some feelings about this PR plus the Reth mentioned one!

- name: Run EF tests
run: ./scripts/run_ef_tests.sh

execution-witness-tests:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filled all the EEST tests for Osaka with spec witness generation from jsign/execution-specs#3. Then uploaded the tarball to some place so we can have a CI here for checking.

with:
cache-on-failure: true
- name: Run Execution Witness tests
run: cargo run -p ef-test-runner --release -- $EXECUTION_WITNESS_TESTS_URL
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ef-test-runner is a CLI tool to run EEST tests that I did a while ago in Reth but wasn't migrated to this repo. Moved here since it was useful to debug fixtures, plus added a feature to allow pulling .tar.gz for running which simplifies CI.

// update/insert first, then delete. This matches witness generation ordering.
let sorted_slots = storage.storage.into_iter().sorted_unstable_by_key(|(slot, _)| *slot);
let sorted_slots = sorted_slots.collect::<Vec<_>>();
for is_delete_pass in [false, true] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same rule for post-state root calculation as mentioned in the Reth PR. First do update+insertions and then deletions to minimize the branch compressions which forces adding sibilings to MPT nodes in the witness.

.try_for_each(|(name, case)| {
Self::run_single_case(&name, &case)
.map(|_| ())
.map_err(|err| Error::TestCaseFailed { name, err: Box::new(err) })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a bit more info when a fixture fails to show the fixture name.


program_inputs.push((block.clone(), exec_witness));

// Compare the generated witness against the fixture's expected witness (if present)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support in the testing crate to deserialize the executionWitness new field in fixtures, so we can compare the spec execution witness against the Reth generated one to see if they match.

Basically, this is how we know if Reth conforms to the spec.

///
/// Uses serde aliases to accept both alloy's field names (`state`/`codes`/`headers`)
/// and the fixture's field names (`nodes`/`bytecodes`/`ancestors`).
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Default)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

CancunToPragueAtTime15k,
/// Prague
Prague,
/// Prague to Osaka at time 15k
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A missing fork used in tests. Prob should be done in the Reth repo too eventually.

- name: Run EF tests
run: ./scripts/run_ef_tests.sh

execution-witness-tests:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: jsign <jsign.uy@gmail.com>
@jsign jsign marked this pull request as ready for review February 18, 2026 00:22
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