@ -341,15 +341,12 @@ public class BonsaiWorldState
final Optional < BonsaiWorldStateKeyValueStorage . BonsaiUpdater > maybeStateUpdater ,
final BonsaiWorldStateUpdateAccumulator worldStateUpdater ) {
maybeStateUpdater . ifPresent (
bonsaiUpdater - > {
for ( final Address address : worldStateUpdater . getStorageToClear ( ) ) {
// because we are clearing persisted values we need the account root as persisted
final BonsaiAccount oldAccount =
worldStateStorage
. getAccount ( address . addressHash ( ) )
. map (
bytes - > BonsaiAccount . 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
@ -362,7 +359,6 @@ public class BonsaiWorldState
( location , key ) - > getStorageTrieNode ( addressHash , location , key ) ,
oldAccount . getStorageRoot ( ) ) ;
try {
final StorageConsumingMap < StorageSlotKey , BonsaiValue < UInt256 > > storageToDelete =
worldStateUpdater . getStorageToUpdate ( ) . get ( address ) ;
Map < Bytes32 , Bytes > entriesToDelete = storageTrie . entriesFrom ( Bytes32 . ZERO , 256 ) ;
@ -371,10 +367,11 @@ public class BonsaiWorldState
( k , v ) - > {
final StorageSlotKey storageSlotKey =
new StorageSlotKey ( Hash . wrap ( k ) , Optional . empty ( ) ) ;
final UInt256 slotValue =
UInt256 . fromBytes ( Bytes32 . leftPad ( RLP . decodeValue ( v ) ) ) ;
final UInt256 slotValue = UInt256 . fromBytes ( Bytes32 . leftPad ( RLP . decodeValue ( v ) ) ) ;
maybeStateUpdater . ifPresent (
bonsaiUpdater - >
bonsaiUpdater . removeStorageValueBySlotHash (
address . addressHash ( ) , storageSlotKey . getSlotHash ( ) ) ;
address . addressHash ( ) , storageSlotKey . getSlotHash ( ) ) ) ;
storageToDelete
. computeIfAbsent (
storageSlotKey , key - > new BonsaiValue < > ( slotValue , null , true ) )
@ -393,7 +390,6 @@ public class BonsaiWorldState
e . getMessage ( ) , Optional . of ( Address . wrap ( address ) ) , e . getHash ( ) , e . getLocation ( ) ) ;
}
}
} ) ;
}
@Override