|
|
|
@ -14,32 +14,32 @@ |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
package org.hyperledger.besu.ethereum.bonsai.worldview; |
|
|
|
|
package org.hyperledger.besu.ethereum.trie.bonsai.worldview; |
|
|
|
|
|
|
|
|
|
import static org.hyperledger.besu.ethereum.bonsai.BonsaiAccount.fromRLP; |
|
|
|
|
import static org.hyperledger.besu.ethereum.bonsai.storage.BonsaiWorldStateKeyValueStorage.WORLD_BLOCK_HASH_KEY; |
|
|
|
|
import static org.hyperledger.besu.ethereum.bonsai.storage.BonsaiWorldStateKeyValueStorage.WORLD_ROOT_HASH_KEY; |
|
|
|
|
import static org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier.TRIE_BRANCH_STORAGE; |
|
|
|
|
import static org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiWorldStateKeyValueStorage.WORLD_BLOCK_HASH_KEY; |
|
|
|
|
import static org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiWorldStateKeyValueStorage.WORLD_ROOT_HASH_KEY; |
|
|
|
|
import static org.hyperledger.besu.ethereum.trie.bonsai.worldview.BonsaiWorldView.encodeTrieValue; |
|
|
|
|
|
|
|
|
|
import org.hyperledger.besu.datatypes.Address; |
|
|
|
|
import org.hyperledger.besu.datatypes.Hash; |
|
|
|
|
import org.hyperledger.besu.datatypes.StorageSlotKey; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.BonsaiAccount; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.BonsaiValue; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.BonsaiWorldStateProvider; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.cache.CachedMerkleTrieLoader; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.cache.CachedWorldStorageManager; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.storage.BonsaiSnapshotWorldStateKeyValueStorage; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.storage.BonsaiWorldStateKeyValueStorage; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.storage.BonsaiWorldStateKeyValueStorage.BonsaiStorageSubscriber; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.storage.BonsaiWorldStateLayerStorage; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.trielog.TrieLogManager; |
|
|
|
|
import org.hyperledger.besu.ethereum.bonsai.worldview.BonsaiWorldStateUpdateAccumulator.StorageConsumingMap; |
|
|
|
|
import org.hyperledger.besu.ethereum.core.BlockHeader; |
|
|
|
|
import org.hyperledger.besu.ethereum.core.MutableWorldState; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.MerkleTrie; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.MerkleTrieException; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.NodeLoader; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.BonsaiAccount; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.BonsaiValue; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.BonsaiWorldStateProvider; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.cache.CachedMerkleTrieLoader; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.cache.CachedWorldStorageManager; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiSnapshotWorldStateKeyValueStorage; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiWorldStateKeyValueStorage; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiWorldStateKeyValueStorage.BonsaiStorageSubscriber; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiWorldStateLayerStorage; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.trielog.TrieLogManager; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.bonsai.worldview.BonsaiWorldStateUpdateAccumulator.StorageConsumingMap; |
|
|
|
|
import org.hyperledger.besu.ethereum.trie.patricia.StoredMerklePatriciaTrie; |
|
|
|
|
import org.hyperledger.besu.ethereum.worldstate.WorldStateStorage; |
|
|
|
|
import org.hyperledger.besu.evm.account.Account; |
|
|
|
@ -309,7 +309,7 @@ public class BonsaiWorldState |
|
|
|
|
bonsaiUpdater -> |
|
|
|
|
bonsaiUpdater.putStorageValueBySlotHash( |
|
|
|
|
updatedAddressHash, slotHash, updatedStorage)); |
|
|
|
|
storageTrie.put(slotHash, BonsaiWorldView.encodeTrieValue(updatedStorage)); |
|
|
|
|
storageTrie.put(slotHash, encodeTrieValue(updatedStorage)); |
|
|
|
|
} |
|
|
|
|
} catch (MerkleTrieException e) { |
|
|
|
|
// need to throw to trigger the heal
|
|
|
|
@ -347,7 +347,8 @@ public class BonsaiWorldState |
|
|
|
|
final BonsaiAccount oldAccount = |
|
|
|
|
worldStateStorage |
|
|
|
|
.getAccount(address.addressHash()) |
|
|
|
|
.map(bytes -> fromRLP(BonsaiWorldState.this, address, bytes, true)) |
|
|
|
|
.map( |
|
|
|
|
bytes -> BonsaiAccount.fromRLP(BonsaiWorldState.this, address, bytes, true)) |
|
|
|
|
.orElse(null); |
|
|
|
|
if (oldAccount == null) { |
|
|
|
|
// This is when an account is both created and deleted within the scope of the same
|
|
|
|
@ -537,7 +538,7 @@ public class BonsaiWorldState |
|
|
|
|
public Account get(final Address address) { |
|
|
|
|
return worldStateStorage |
|
|
|
|
.getAccount(address.addressHash()) |
|
|
|
|
.map(bytes -> fromRLP(accumulator, address, bytes, true)) |
|
|
|
|
.map(bytes -> BonsaiAccount.fromRLP(accumulator, address, bytes, true)) |
|
|
|
|
.orElse(null); |
|
|
|
|
} |
|
|
|
|
|