Skip to content

Commit 65c1ff7

Browse files
committed
Remove storage root verification
Signed-off-by: Miroslav Kovar <miroslavkovar@protonmail.com>
1 parent 108e652 commit 65c1ff7

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/BlockAccessListDataRequest.java

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.hyperledger.besu.ethereum.rlp.RLP;
2727
import org.hyperledger.besu.ethereum.trie.common.PmtStateTrieAccountValue;
2828
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
29-
import org.hyperledger.besu.ethereum.trie.pathbased.common.worldview.PathBasedWorldView;
3029
import org.hyperledger.besu.ethereum.trie.patricia.StoredMerklePatriciaTrie;
3130
import org.hyperledger.besu.ethereum.worldstate.WorldStateStorageCoordinator;
3231
import org.hyperledger.besu.plugin.services.storage.WorldStateKeyValueStorage;
@@ -101,12 +100,7 @@ protected int doPersist(
101100

102101
final Hash updatedStorageRoot = currentValue.getStorageRoot();
103102
if (!accountChanges.storageChanges().isEmpty()) {
104-
applyStorageChangesAndVerifyStorageRoot(
105-
accountHash,
106-
updatedStorageRoot,
107-
accountChanges,
108-
worldStateStorageCoordinator,
109-
bonsaiUpdater);
103+
applyStorageChanges(accountHash, accountChanges, bonsaiUpdater);
110104
}
111105

112106
final PmtStateTrieAccountValue updatedValue =
@@ -122,44 +116,20 @@ protected int doPersist(
122116
return 0;
123117
}
124118

125-
private void applyStorageChangesAndVerifyStorageRoot(
119+
private void applyStorageChanges(
126120
final Hash accountHash,
127-
final Hash expectedStorageRoot,
128121
final BlockAccessListChanges.AccountFinalChanges accountChanges,
129-
final WorldStateStorageCoordinator worldStateStorageCoordinator,
130122
final BonsaiWorldStateKeyValueStorage.Updater bonsaiUpdater) {
131-
final StoredMerklePatriciaTrie<Bytes, Bytes> storageTrie =
132-
new StoredMerklePatriciaTrie<>(
133-
(location, hash) ->
134-
worldStateStorageCoordinator.getAccountStorageTrieNode(accountHash, location, hash),
135-
Bytes32.wrap(expectedStorageRoot.getBytes()),
136-
value -> value,
137-
value -> value);
138-
139123
for (final var storageChange : accountChanges.storageChanges()) {
140124
final Hash slotHash = storageChange.slot().getSlotHash();
141125
final UInt256 value = storageChange.value();
142-
final Bytes slotKey = slotHash.getBytes();
143126

144127
if (value.equals(UInt256.ZERO)) {
145128
bonsaiUpdater.removeStorageValueBySlotHash(accountHash, slotHash);
146-
storageTrie.remove(slotKey);
147129
} else {
148130
bonsaiUpdater.putStorageValueBySlotHash(accountHash, slotHash, value.toBytes());
149-
storageTrie.put(slotKey, PathBasedWorldView.encodeTrieValue(value.toBytes()));
150131
}
151132
}
152-
153-
final Hash calculatedStorageRoot = Hash.wrap(storageTrie.getRootHash());
154-
if (!calculatedStorageRoot.equals(expectedStorageRoot)) {
155-
throw new IllegalStateException(
156-
"Storage root mismatch for account "
157-
+ accountHash
158-
+ ": expected "
159-
+ expectedStorageRoot
160-
+ " but got "
161-
+ calculatedStorageRoot);
162-
}
163133
}
164134

165135
@Override

0 commit comments

Comments
 (0)