File tree Expand file tree Collapse file tree
crates/eth-sparse-mpt/src
v1/reth_sparse_trie/trie_fetcher Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,10 +105,8 @@ where
105105 }
106106}
107107
108- fn pad_path ( mut path : Nibbles ) -> B256 {
109- while path. len ( ) < 64 {
110- path. push_unchecked ( 0 ) ;
111- }
108+ fn pad_path ( path : Nibbles ) -> B256 {
109+ // `pack_to` writes left-aligned into the zeroed buffer
112110 let mut res = B256 :: default ( ) ;
113111 path. pack_to ( res. as_mut_slice ( ) ) ;
114112 res
Original file line number Diff line number Diff line change @@ -138,10 +138,9 @@ impl MissingNodesFetcher {
138138 }
139139}
140140
141- fn pad_path ( mut path : Nibbles ) -> B256 {
142- while path. len ( ) < 64 {
143- path. push_unchecked ( 0 ) ;
144- }
141+ fn pad_path ( path : Nibbles ) -> B256 {
142+ // `pack_to` writes left-aligned into the zeroed buffer, leaving trailing
143+ // bytes zero, so explicit right-padding to 64 nibbles is unnecessary.
145144 let mut res = B256 :: default ( ) ;
146145 path. pack_to ( res. as_mut_slice ( ) ) ;
147146 res
You can’t perform that action at this time.
0 commit comments