@@ -11,7 +11,7 @@ use u4::{AsNibbles, U4};
1111
1212/// See <https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie>.
1313///
14- /// Portions of the trie may be indirected : see [`Self::insert_hash`].
14+ /// Portions of the trie may be _hashed out_ : see [`Self::insert_hash`].
1515#[ derive( Debug , Clone , PartialEq , Eq ) ]
1616struct TypedMpt < T > {
1717 inner : HashedPartialTrie ,
@@ -28,6 +28,8 @@ impl<T> TypedMpt<T> {
2828 }
2929 }
3030 /// Insert a node which represents an out-of-band sub-trie.
31+ ///
32+ /// See [module documentation](super) for more.
3133 fn insert_hash ( & mut self , key : TrieKey , hash : H256 ) -> anyhow:: Result < ( ) > {
3234 self . inner . insert ( key. into_nibbles ( ) , hash) ?;
3335 Ok ( ( ) )
@@ -201,8 +203,8 @@ impl TransactionTrie {
201203 pub const fn as_hashed_partial_trie ( & self ) -> & mpt_trie:: partial_trie:: HashedPartialTrie {
202204 & self . untyped
203205 }
204- /// Indirect (hash) parts of the trie that aren't in `txn_ixs`.
205- pub fn mask ( & mut self , txn_ixs : impl IntoIterator < Item = usize > ) -> anyhow:: Result < ( ) > {
206+ /// _Hash out_ parts of the trie that aren't in `txn_ixs`.
207+ pub fn intersect ( & mut self , txn_ixs : impl IntoIterator < Item = usize > ) -> anyhow:: Result < ( ) > {
206208 self . untyped = mpt_trie:: trie_subsets:: create_trie_subset (
207209 & self . untyped ,
208210 txn_ixs
@@ -246,8 +248,8 @@ impl ReceiptTrie {
246248 pub const fn as_hashed_partial_trie ( & self ) -> & mpt_trie:: partial_trie:: HashedPartialTrie {
247249 & self . untyped
248250 }
249- /// Indirect (hash) parts of the trie that aren't in `txn_ixs`.
250- pub fn mask ( & mut self , txn_ixs : impl IntoIterator < Item = usize > ) -> anyhow:: Result < ( ) > {
251+ /// _Hash out_ parts of the trie that aren't in `txn_ixs`.
252+ pub fn intersect ( & mut self , txn_ixs : impl IntoIterator < Item = usize > ) -> anyhow:: Result < ( ) > {
251253 self . untyped = mpt_trie:: trie_subsets:: create_trie_subset (
252254 & self . untyped ,
253255 txn_ixs
@@ -273,7 +275,7 @@ pub trait StateTrie {
273275 fn insert_hash_by_key ( & mut self , key : TrieKey , hash : H256 ) -> anyhow:: Result < ( ) > ;
274276 fn get_by_address ( & self , address : Address ) -> Option < AccountRlp > ;
275277 fn reporting_remove ( & mut self , address : Address ) -> anyhow:: Result < Option < TrieKey > > ;
276- fn mask ( & mut self , address : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > ;
278+ fn intersect ( & mut self , address : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > ;
277279 fn iter ( & self ) -> impl Iterator < Item = ( H256 , AccountRlp ) > + ' _ ;
278280 fn root ( & self ) -> H256 ;
279281}
@@ -322,7 +324,7 @@ impl StateTrie for StateMpt {
322324 #[ expect( deprecated) ]
323325 self . insert_by_hashed_address ( keccak_hash:: keccak ( address) , account)
324326 }
325- /// Insert an indirected part of the trie
327+ /// Insert an _hashed out_ part of the trie
326328 fn insert_hash_by_key ( & mut self , key : TrieKey , hash : H256 ) -> anyhow:: Result < ( ) > {
327329 self . typed . insert_hash ( key, hash)
328330 }
@@ -338,7 +340,7 @@ impl StateTrie for StateMpt {
338340 TrieKey :: from_address ( address) ,
339341 )
340342 }
341- fn mask ( & mut self , addresses : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > {
343+ fn intersect ( & mut self , addresses : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > {
342344 let inner = mpt_trie:: trie_subsets:: create_trie_subset (
343345 self . typed . as_hashed_partial_trie ( ) ,
344346 addresses. into_iter ( ) . map ( TrieKey :: into_nibbles) ,
@@ -370,7 +372,7 @@ impl From<StateMpt> for HashedPartialTrie {
370372
371373pub struct StateSmt {
372374 address2state : BTreeMap < Address , AccountRlp > ,
373- indirected : BTreeMap < TrieKey , H256 > ,
375+ hashed_out : BTreeMap < TrieKey , H256 > ,
374376}
375377
376378impl StateTrie for StateSmt {
@@ -382,7 +384,7 @@ impl StateTrie for StateSmt {
382384 Ok ( self . address2state . insert ( address, account) )
383385 }
384386 fn insert_hash_by_key ( & mut self , key : TrieKey , hash : H256 ) -> anyhow:: Result < ( ) > {
385- self . indirected . insert ( key, hash) ;
387+ self . hashed_out . insert ( key, hash) ;
386388 Ok ( ( ) )
387389 }
388390 fn get_by_address ( & self , address : Address ) -> Option < AccountRlp > {
@@ -392,7 +394,7 @@ impl StateTrie for StateSmt {
392394 self . address2state . remove ( & address) ;
393395 Ok ( None )
394396 }
395- fn mask ( & mut self , address : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > {
397+ fn intersect ( & mut self , address : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > {
396398 let _ = address;
397399 Ok ( ( ) )
398400 }
@@ -440,8 +442,8 @@ impl StorageTrie {
440442 pub fn as_mut_hashed_partial_trie_unchecked ( & mut self ) -> & mut HashedPartialTrie {
441443 & mut self . untyped
442444 }
443- /// Indirect (hash) the parts of the trie that aren't in `paths`.
444- pub fn mask ( & mut self , paths : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > {
445+ /// _Hash out_ the parts of the trie that aren't in `paths`.
446+ pub fn intersect ( & mut self , paths : impl IntoIterator < Item = TrieKey > ) -> anyhow:: Result < ( ) > {
445447 self . untyped = mpt_trie:: trie_subsets:: create_trie_subset (
446448 & self . untyped ,
447449 paths. into_iter ( ) . map ( TrieKey :: into_nibbles) ,
0 commit comments