-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(mpt): Copy-on-hash #1001
feat(mpt): Copy-on-hash #1001
Conversation
📚
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files☔ View full report in Codecov by Sentry. |
IMO this hit is not significant enough to be a blocker for the interop workstream. |
Yeah, agree. @ratankaliani & @hashcashier, please report back in the issues if the additional cache is needed for your usecases. |
37c8dae
to
456dd2e
Compare
Overview
Adjusts the MPT crate to copy-on-hash rather than hash-in-place when computing the root hash of the trie.
This is less efficient, but is needed for completing execution of Optimistic blocks in the interop proof. Doing this enables for us to not rely solely on the
L2AccountProof
hint for output root computation, which depends on the block the proof is fetched within being canonical.Benchmarks
The slowdown isn't crazy significant, but more
keccak256
operations may not be amazing for users runningkona
on zkVMs. Native wallclock benchmarks don't directly translate to prover cost, but do give a rough indication on the hit (Benchmark: "Compute root, fully open trie - 65,536 nodes"):Asterisc
Interestingly, doesn't really affect
asterisc
cycle count nor wallclock time (but note, we only ran one block, not a range proof):main
(61ed1419
) -~4610000000
cycles.cl/mpt/copy-when-sealing
(37c8dae
) -~4630000000
cycles.If we care about this hit, we can look into adding some additional caching that preserves the full cache of the trie in-memory, but prevents re-hashing nodes whose cache has not been invalidated by a write.
Meta
closes #981