From 70e90532fe153b4e8c90c43a3529bbf1403067d1 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Tue, 24 Oct 2023 19:30:49 -0600 Subject: [PATCH] Update reference tests to Cancun (#6054) * Update reference tests to Cancun Update reference tests to cancun tests. Signed-off-by: Danno Ferrin * update the subrepo Signed-off-by: Danno Ferrin * update the EIP-6110 acceptance tests Signed-off-by: Danno Ferrin * update to develop Signed-off-by: Danno Ferrin --------- Signed-off-by: Danno Ferrin Signed-off-by: Sally MacFarlane Co-authored-by: Sally MacFarlane --- .../mainnet/ParentBeaconBlockRootHelper.java | 4 +-- .../besu/evmtool/StateTestSubCommand.java | 8 ++++++ .../hyperledger/besu/evmtool/T8nExecutor.java | 1 - ethereum/referencetests/build.gradle | 2 +- .../BlockchainReferenceTestCaseSpec.java | 1 + .../BonsaiReferenceTestWorldState.java | 25 +++++++------------ .../src/reference-test/external-resources | 2 +- .../vm/BlockchainReferenceTestTools.java | 7 ------ .../vm/GeneralStateReferenceTestTools.java | 7 ------ 9 files changed, 21 insertions(+), 36 deletions(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java index 5f257c3dd32..3715263fd2b 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java @@ -19,7 +19,6 @@ import org.hyperledger.besu.evm.account.MutableAccount; import org.hyperledger.besu.evm.worldstate.WorldUpdater; -import com.google.common.primitives.Longs; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.units.bigints.UInt256; @@ -49,8 +48,7 @@ static void storeParentBeaconBlockRoot( final UInt256 timestampIndex = UInt256.valueOf(timestampReduced); final UInt256 rootIndex = UInt256.valueOf(timestampExtended); - account.setStorageValue( - timestampIndex, UInt256.fromBytes(Bytes.of(Longs.toByteArray(timestamp)))); + account.setStorageValue(timestampIndex, UInt256.fromBytes(Bytes.ofUnsignedLong(timestamp))); account.setStorageValue(rootIndex, UInt256.fromBytes(root)); worldUpdater.commit(); } diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java index a2d966f0675..f45797f9643 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java @@ -100,6 +100,11 @@ public class StateTestSubCommand implements Runnable { description = "Limit execution to one value variable.") private Integer valueIndex = null; + @Option( + names = {"--fork-index"}, + description = "Limit execution to one fork.") + private String forkIndex = null; + @ParentCommand private final EvmToolCommand parentCommand; // picocli does it magically @@ -197,6 +202,9 @@ private void traceTestSpecs(final String test, final ListBesu reference-test style test cases should supply a stateroot to verify to prevent bonsai - * regressions. + * For reference tests world state root validation is handled in the harness, this stubs out the + * behavior to always pass. * * @param calculatedStateRoot state root calculated during bonsai persist step. * @param header supplied reference test block header. */ @Override protected void verifyWorldStateRoot(final Hash calculatedStateRoot, final BlockHeader header) { - if (!disableRootHashVerification) { - super.verifyWorldStateRoot(calculatedStateRoot, header); - } + // The test harness validates the root hash, no need to validate in-line for reference test } @JsonCreator @@ -127,10 +120,6 @@ public Stream streamAccounts(final Bytes32 startKeyHash, fina return this.refTestStorage.streamAccounts(this, startKeyHash, limit); } - public void disableRootHashVerification() { - disableRootHashVerification = true; - } - static class NoOpTrieLogManager implements TrieLogManager { private final Subscribers trieLogObservers = Subscribers.create(); private final TrieLogFactory trieLogFactory = new TrieLogFactoryImpl(); @@ -150,7 +139,9 @@ public void saveTrieLog( public void addCachedLayer( final BlockHeader blockHeader, final Hash worldStateRootHash, - final BonsaiWorldState forWorldState) {} + final BonsaiWorldState forWorldState) { + // reference tests do not cache layers + } @Override public boolean containWorldStateStorage(final Hash blockHash) { @@ -179,7 +170,9 @@ public long getMaxLayersToLoad() { } @Override - public void reset() {} + public void reset() { + // reference test world states are not re-used + } @Override public Optional getTrieLogLayer(final Hash blockHash) { diff --git a/ethereum/referencetests/src/reference-test/external-resources b/ethereum/referencetests/src/reference-test/external-resources index 661356317ac..02c1859633a 160000 --- a/ethereum/referencetests/src/reference-test/external-resources +++ b/ethereum/referencetests/src/reference-test/external-resources @@ -1 +1 @@ -Subproject commit 661356317ac6df52208d54187e692472a25a01f8 +Subproject commit 02c1859633abbdf776956136931ea247485c9f90 diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java index 9d6f7982d8d..af6405fb0ff 100644 --- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java +++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java @@ -82,13 +82,6 @@ public class BlockchainReferenceTestTools { // Perfectly valid test pre-merge. params.ignore("UncleFromSideChain_(Merge|Shanghai|Cancun|Prague|Osaka|Bogota)"); - // Reference Tests are old. Max blob count is 6. - params.ignore("blobhashListBounds5"); - params.ignore("blockWithAllTransactionTypes"); - - // EIP-4788 is still in flux and the current fill is not against the final address - params.ignore("\\[Cancun\\]"); - // EOF tests are written against an older version of the spec params.ignore("/stEOF/"); } diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/GeneralStateReferenceTestTools.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/GeneralStateReferenceTestTools.java index 83388fe2526..af6181dab00 100644 --- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/GeneralStateReferenceTestTools.java +++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/GeneralStateReferenceTestTools.java @@ -21,10 +21,8 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; -import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.Transaction; -import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; import org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams; @@ -35,10 +33,8 @@ import org.hyperledger.besu.ethereum.referencetests.ReferenceTestProtocolSchedules; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState; import org.hyperledger.besu.ethereum.rlp.RLP; -import org.hyperledger.besu.ethereum.worldstate.DefaultMutableWorldState; import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.log.Log; -import org.hyperledger.besu.evm.worldstate.WorldState; import org.hyperledger.besu.evm.worldstate.WorldUpdater; import org.hyperledger.besu.testutil.JsonTestParameters; @@ -109,9 +105,6 @@ private static ProtocolSpec protocolSpec(final String name) { params.ignore("CALLBlake2f_MaxRounds.*"); params.ignore("loopMul-.*"); - // Reference Tests are old. Max blob count is 6. - params.ignore("blobhashListBounds5"); - // EOF tests are written against an older version of the spec params.ignore("/stEOF/"); }