-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use common::{cases, Case}; | ||
use itertools::Itertools; | ||
use mpt_trie::partial_trie::PartialTrie; | ||
use trace_decoder::{BlockTraceTriePreImages, CombinedPreImages}; | ||
|
||
mod common; | ||
|
||
fn main() -> anyhow::Result<()> { | ||
for Case { name, trace, .. } in cases().unwrap() { | ||
println!("{name}"); | ||
let BlockTraceTriePreImages::Combined(CombinedPreImages { compact }) = | ||
trace.trie_pre_images | ||
else { | ||
panic!() | ||
}; | ||
let whole = trace_decoder::frontend(trace_decoder::parse(&compact).unwrap()) | ||
.unwrap() | ||
.state | ||
.as_hashed_partial_trie() | ||
.clone(); | ||
let all_keys = whole.keys().collect::<Vec<_>>(); | ||
let len = all_keys.len(); | ||
for n in 0..len { | ||
println!("{n}/{len}"); | ||
for comb in all_keys.iter().copied().combinations(n) { | ||
if let Ok(sub) = mpt_trie::trie_subsets::create_trie_subset(&whole, comb) { | ||
assert_eq!(sub.hash(), whole.hash()) | ||
} | ||
} | ||
} | ||
} | ||
Ok(()) | ||
} |