Make witness generation conform to draft specs#8
Make witness generation conform to draft specs#8jsign wants to merge 8 commits intoparadigmxyz:mainfrom
Conversation
…ince sorting is done at generation
| - name: Run EF tests | ||
| run: ./scripts/run_ef_tests.sh | ||
|
|
||
| execution-witness-tests: |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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] { |
There was a problem hiding this comment.
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) }) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)] |
| CancunToPragueAtTime15k, | ||
| /// Prague | ||
| Prague, | ||
| /// Prague to Osaka at time 15k |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Example of successful run https://github.com/jsign/stateless/actions/runs/22102548450/job/63875960907?pr=1
Signed-off-by: jsign <jsign.uy@gmail.com>
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!