@ -154,9 +154,7 @@ public class BonsaiWorldStateUpdater extends AbstractWorldUpdater<BonsaiWorldVie
accountsToUpdate . computeIfAbsent (
accountsToUpdate . computeIfAbsent (
deletedAddress ,
deletedAddress ,
__ - > loadAccountFromParent ( deletedAddress , new BonsaiValue < > ( null , null ) ) ) ;
__ - > loadAccountFromParent ( deletedAddress , new BonsaiValue < > ( null , null ) ) ) ;
if ( accountValue . getOriginal ( ) ! = null ) {
storageToClear . add ( deletedAddress ) ;
storageToClear . add ( deletedAddress ) ;
}
final BonsaiValue < Bytes > codeValue = codeToUpdate . get ( deletedAddress ) ;
final BonsaiValue < Bytes > codeValue = codeToUpdate . get ( deletedAddress ) ;
if ( codeValue ! = null ) {
if ( codeValue ! = null ) {
codeValue . setUpdated ( null ) ;
codeValue . setUpdated ( null ) ;
@ -271,7 +269,7 @@ public class BonsaiWorldStateUpdater extends AbstractWorldUpdater<BonsaiWorldVie
if ( localCode = = null ) {
if ( localCode = = null ) {
return wrappedWorldView ( ) . getCode ( address ) ;
return wrappedWorldView ( ) . getCode ( address ) ;
} else {
} else {
return Optional . of ( localCode . getUpdated ( ) ) ;
return Optional . ofNullable ( localCode . getUpdated ( ) ) ;
}
}
}
}
@ -294,7 +292,7 @@ public class BonsaiWorldStateUpdater extends AbstractWorldUpdater<BonsaiWorldVie
storageToUpdate . computeIfAbsent ( address , key - > new HashMap < > ( ) ) ;
storageToUpdate . computeIfAbsent ( address , key - > new HashMap < > ( ) ) ;
final BonsaiValue < UInt256 > value = localAccountStorage . get ( slotHash ) ;
final BonsaiValue < UInt256 > value = localAccountStorage . get ( slotHash ) ;
if ( value ! = null ) {
if ( value ! = null ) {
return Optional . of ( value . getUpdated ( ) ) ;
return Optional . ofNullable ( value . getUpdated ( ) ) ;
} else {
} else {
final Optional < UInt256 > valueUInt =
final Optional < UInt256 > valueUInt =
wrappedWorldView ( ) . getStorageValueBySlotHash ( address , slotHash ) ;
wrappedWorldView ( ) . getStorageValueBySlotHash ( address , slotHash ) ;
@ -306,6 +304,9 @@ public class BonsaiWorldStateUpdater extends AbstractWorldUpdater<BonsaiWorldVie
@Override
@Override
public UInt256 getOriginalStorageValue ( final Address address , final UInt256 storageKey ) {
public UInt256 getOriginalStorageValue ( final Address address , final UInt256 storageKey ) {
// TODO maybe log the read into the trie layer?
// TODO maybe log the read into the trie layer?
if ( storageToClear . contains ( address ) ) {
return UInt256 . ZERO ;
}
final Map < Hash , BonsaiValue < UInt256 > > localAccountStorage =
final Map < Hash , BonsaiValue < UInt256 > > localAccountStorage =
storageToUpdate . computeIfAbsent ( address , key - > new HashMap < > ( ) ) ;
storageToUpdate . computeIfAbsent ( address , key - > new HashMap < > ( ) ) ;
final Hash slotHashBytes = Hash . hash ( storageKey . toBytes ( ) ) ;
final Hash slotHashBytes = Hash . hash ( storageKey . toBytes ( ) ) ;