mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-09 23:47:57 -05:00
[NC-1752] Fix SSTORE original value (#79)
* [NC-1752] Delegate calls to getOriginalAccount all the way to the actual store. Ensures we get the actual original value even when updaters are nested due to nested calls. * Upgrade ethereum reference tests to include the new sstore tests. Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
This commit is contained in:
@@ -79,7 +79,7 @@ public abstract class AbstractWorldUpdater<W extends WorldView, A extends Accoun
|
||||
|
||||
@Override
|
||||
public Account getOriginalAccount(final Address address) {
|
||||
return world.get(address);
|
||||
return world.getOriginalAccount(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,14 +77,6 @@ public interface WorldUpdater extends MutableWorldView {
|
||||
*/
|
||||
MutableAccount getMutable(Address address);
|
||||
|
||||
/**
|
||||
* Retrieve the original account, prior to any modifications made by this updater.
|
||||
*
|
||||
* @param address the address of the account.
|
||||
* @return the account {@code address} or {@code null} if the account does not exist.
|
||||
*/
|
||||
Account getOriginalAccount(Address address);
|
||||
|
||||
/**
|
||||
* Deletes the provided account.
|
||||
*
|
||||
|
||||
@@ -14,7 +14,18 @@ package tech.pegasys.pantheon.ethereum.core;
|
||||
|
||||
/** Generic interface for a view over the accounts of the world state. */
|
||||
public interface WorldView {
|
||||
WorldView EMPTY = address -> null;
|
||||
WorldView EMPTY =
|
||||
new WorldView() {
|
||||
@Override
|
||||
public Account get(final Address address) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Account getOriginalAccount(final Address address) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an account provided it's address.
|
||||
@@ -24,4 +35,12 @@ public interface WorldView {
|
||||
* such account.
|
||||
*/
|
||||
Account get(Address address);
|
||||
|
||||
/**
|
||||
* Retrieve the original account, prior to any modifications made in this transaction.
|
||||
*
|
||||
* @param address the address of the account.
|
||||
* @return the account {@code address} or {@code null} if the account does not exist.
|
||||
*/
|
||||
Account getOriginalAccount(Address address);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,11 @@ public class DefaultMutableWorldState implements MutableWorldState {
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Account getOriginalAccount(final Address address) {
|
||||
return get(address);
|
||||
}
|
||||
|
||||
private AccountState deserializeAccount(
|
||||
final Address address, final Hash addressHash, final BytesValue encoded) throws RLPException {
|
||||
final RLPInput in = RLP.input(encoded);
|
||||
|
||||
Reference in New Issue
Block a user