File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -77,3 +77,7 @@ harness = false
7777[[test ]]
7878name = " simulate-execution"
7979harness = false
80+
81+ [[test ]]
82+ name = " check-subsets"
83+ harness = false
Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ const _DEVELOPER_DOCS: () = ();
5757mod interface;
5858
5959pub use interface:: * ;
60+ pub use type1:: frontend;
61+ pub use wire:: parse;
6062
6163mod type1;
6264// TODO(0xaatif): https://github.com/0xPolygonZero/zk_evm/issues/275
Original file line number Diff line number Diff line change 1+ use common:: { cases, Case } ;
2+ use itertools:: Itertools ;
3+ use mpt_trie:: partial_trie:: PartialTrie ;
4+ use trace_decoder:: { BlockTraceTriePreImages , CombinedPreImages } ;
5+
6+ mod common;
7+
8+ fn main ( ) -> anyhow:: Result < ( ) > {
9+ for Case { name, trace, .. } in cases ( ) . unwrap ( ) {
10+ let BlockTraceTriePreImages :: Combined ( CombinedPreImages { compact } ) =
11+ trace. trie_pre_images
12+ else {
13+ panic ! ( )
14+ } ;
15+ let whole = trace_decoder:: frontend ( trace_decoder:: parse ( & compact) . unwrap ( ) )
16+ . unwrap ( )
17+ . state
18+ . as_hashed_partial_trie ( )
19+ . clone ( ) ;
20+ let all_keys = whole. keys ( ) . collect :: < Vec < _ > > ( ) ;
21+ let len = all_keys. len ( ) ;
22+ for n in 0 ..len {
23+ println ! ( "{name}\t {n}\t {len}" ) ;
24+ for comb in all_keys. iter ( ) . copied ( ) . combinations ( n) {
25+ if let Ok ( sub) = mpt_trie:: trie_subsets:: create_trie_subset ( & whole, comb. clone ( ) ) {
26+ assert_eq ! ( sub. hash( ) , whole. hash( ) , "{comb:?}" )
27+ }
28+ }
29+ }
30+ }
31+ Ok ( ( ) )
32+ }
You can’t perform that action at this time.
0 commit comments