feat: add seismic-alloy-trie minimal crate (part of no-trie-fork)#80
Draft
feat: add seismic-alloy-trie minimal crate (part of no-trie-fork)#80
Conversation
samlaf
commented
Mar 5, 2026
Cargo.toml
Outdated
Comment on lines
+148
to
+149
| # TODO(samlaf): pointing to rev from https://github.com/SeismicSystems/seismic-alloy-core/pull/58 | ||
| # Before merging this PR, merge the one from seismic-alloy-core and update the rev here. |
Contributor
Author
There was a problem hiding this comment.
TODO: points to SeismicSystems/seismic-alloy-core#58
samlaf
commented
Mar 5, 2026
Comment on lines
+20
to
+23
| pub fn storage_root_unhashed<T: Into<FlaggedStorage>>( | ||
| storage: impl IntoIterator<Item = (B256, T)>, | ||
| ) -> B256 { | ||
| storage_root_unsorted(storage.into_iter().map(|(slot, value)| (keccak256(slot), value))) |
Contributor
Author
There was a problem hiding this comment.
Still not 100% sure what's the best / less error-prone design here. The issue with having this is that reth could forget in some place to use this one and instead use the stock alloy-trie's storage_root_unashed, passing it an unshielded FlaggedStorage by mistake.
What we could do is to re-export all of alloy-trie (except for these functions; thereby forcing downstream consumers to use these Into variants) as part of this crate (similar to how the alloy monorepo re-exports alloy-core).
Contributor
Author
There was a problem hiding this comment.
Claude analysis:
That's a reasonable approach. But consider an even simpler option first: can you just shadow the function name?
If seismic-alloy-trie re-exports a storage_root() that takes FlaggedStorage, and seismic-reth depends on seismic-alloy-trie (which it already does), then
anyone doing use seismic_alloy_trie::storage_root gets the correct version. The upstream alloy_trie::storage_root still exists but nobody should be
importing from alloy_trie::root directly — and you can grep for that.
But if you want a compile-time guarantee, your fork approach works. The minimal change would be:
1. Keep seismic-trie as a thin fork of alloy-trie
2. Remove storage_root(), storage_root_unsorted(), storage_root_unhashed() from the ethereum feature
3. Keep TrieAccount, state_root_*(), ordered_trie_root*() — those are fine and widely used
4. The seismic-alloy-trie crate provides the replacement storage_root() with FlaggedStorage
That way, any code that accidentally calls alloy_trie::storage_root() gets a compile error. The fork diff is tiny — just deleting 3 functions — and easy
to maintain across upstream updates.
You don't even need a separate seismic feature flag for this. Just delete those 3 functions from the ethereum module. They're convenience helpers, and
the only correct version now lives in seismic-alloy-trie.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE
This adds a new minimal seismic-alloy-trie wrapper crate around alloy-trie. alloy-trie has functions to compute the storage state root, but they take
into<U256>as arguments. We want to be passing FlaggedStorage, so instead of forking alloy-trie like we previously did, I'm adding equivalent functions here that we should use in reth (and foundry?) instead.See design in https://hackmd.io/ZOGfcUP2SyKmPeOuz0tmvg