From efb6906e1361c39c43783f9825c80bc3b45a1d40 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Thu, 10 Oct 2024 17:43:17 -0600 Subject: [PATCH] Move EOF to the Osaka Fork (#7719) * Move EOF to the Osaka Fork * Ensure Osaka activations are working * Remove CancunEOF and PragueEOF forks * Move EOF tools to default to Osaka Signed-off-by: Danno Ferrin * remove eof tests that fail only because of fork Signed-off-by: Danno Ferrin * Restore CancunEOF * Update unit tests to use "Cancun" as pre-eof fork * Make PC in trace zeroed to start of code section 0 * Update extcall to consider precompiles warm * Add stack checking to CALLF operation Signed-off-by: Danno Ferrin --------- Signed-off-by: Danno Ferrin Co-authored-by: Sally MacFarlane --- .../org/hyperledger/besu/cli/BesuCommand.java | 2 +- .../besu/config/GenesisConfigOptions.java | 6 +- .../besu/config/JsonGenesisConfigOptions.java | 8 +- .../besu/config/StubGenesisConfigOptions.java | 13 ++- .../besu/config/GenesisConfigOptionsTest.java | 9 +- .../besu/datatypes/HardforkId.java | 2 - .../besu/ethereum/chain/GenesisState.java | 12 +-- .../mainnet/MainnetProtocolSpecFactory.java | 4 +- .../mainnet/MainnetProtocolSpecs.java | 13 ++- .../mainnet/ProtocolScheduleBuilder.java | 9 +- .../besu/evmtool/CodeValidateSubCommand.java | 2 +- .../besu/evmtool/EOFTestSubCommand.java | 4 +- .../evmtool/MainnetGenesisFileModule.java | 11 +- .../besu/evmtool/PrettyPrintSubCommand.java | 2 +- .../evmtool/benchmarks/BenchmarkExecutor.java | 16 +-- ...ue-eof-rjump.json => osaka-eof-rjump.json} | 43 +++++--- .../besu/evmtool/state-test/create-eof.json | 4 +- .../state-test/create-invalid-eof.json | 4 +- .../besu/evmtool/trace/create-eof-error.json | 2 +- .../besu/evmtool/trace/create-eof.json | 4 +- .../besu/evmtool/trace/eof-section.json | 8 +- .../hyperledger/besu/evmtool/trace/eof.json | 4 +- .../besu/evmtool/trace/initcode-error.json | 2 +- .../ReferenceTestProtocolSchedules.java | 11 +- .../ethereum/eof/EOFReferenceTestTools.java | 49 ++++++--- .../hyperledger/besu/evm/EvmSpecVersion.java | 8 +- .../org/hyperledger/besu/evm/MainnetEVMs.java | 102 +++--------------- .../besu/evm/fluent/EVMExecutor.java | 16 --- ...alculator.java => OsakaGasCalculator.java} | 6 +- .../operation/AbstractExtCallOperation.java | 27 ++--- .../besu/evm/operation/CallFOperation.java | 9 ++ .../besu/evm/tracing/StandardJsonTracer.java | 4 +- .../besu/evm/code/CodeFactoryTest.java | 8 +- .../hyperledger/besu/evm/code/CodeV0Test.java | 2 +- .../besu/evm/fluent/EVMExecutorTest.java | 6 +- ...rTest.java => OsakaGasCalculatorTest.java} | 6 +- .../besu/evm/internal/CodeCacheTest.java | 2 +- .../evm/operation/Create2OperationTest.java | 2 +- .../evm/operation/CreateOperationTest.java | 4 +- .../evm/operation/DataCopyOperationTest.java | 2 +- .../evm/operation/EofCreateOperationTest.java | 4 +- .../evm/operation/ExtCallOperationTest.java | 12 +-- .../ExtDelegateCallOperationTest.java | 12 +-- .../operation/ExtStaticCallOperationTest.java | 13 +-- .../besu/evm/operation/JumpOperationTest.java | 2 +- .../operation/SelfDestructOperationTest.java | 2 +- .../ContractCreationProcessorTest.java | 2 +- .../tracing/ExtendedOperationTracerTest.java | 4 +- .../besu/testfuzz/EofContainerSubCommand.java | 2 +- .../besu/testfuzz/InternalClient.java | 2 +- 50 files changed, 225 insertions(+), 278 deletions(-) rename ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/{prague-eof-rjump.json => osaka-eof-rjump.json} (92%) rename evm/src/main/java/org/hyperledger/besu/evm/gascalculator/{PragueEOFGasCalculator.java => OsakaGasCalculator.java} (89%) rename evm/src/test/java/org/hyperledger/besu/evm/gascalculator/{PragueEOFGasCalculatorTest.java => OsakaGasCalculatorTest.java} (88%) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index c8c0eaf6ab..678b489baf 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -1407,7 +1407,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { if (genesisConfigOptionsSupplier.get().getCancunTime().isPresent() || genesisConfigOptionsSupplier.get().getCancunEOFTime().isPresent() || genesisConfigOptionsSupplier.get().getPragueTime().isPresent() - || genesisConfigOptionsSupplier.get().getPragueEOFTime().isPresent()) { + || genesisConfigOptionsSupplier.get().getOsakaTime().isPresent()) { if (kzgTrustedSetupFile != null) { KZGPointEvalPrecompiledContract.init(kzgTrustedSetupFile); } else { diff --git a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java index 07ddd0d7ea..e2458c9324 100644 --- a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java @@ -257,11 +257,11 @@ public interface GenesisConfigOptions { OptionalLong getPragueTime(); /** - * Gets Prague EOF time. + * Gets Osaka time. * - * @return the prague time + * @return the osaka time */ - OptionalLong getPragueEOFTime(); + OptionalLong getOsakaTime(); /** * Gets future eips time. diff --git a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java index 83b1f48fb4..51f85f0ec8 100644 --- a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java @@ -308,8 +308,8 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { } @Override - public OptionalLong getPragueEOFTime() { - return getOptionalLong("pragueeoftime"); + public OptionalLong getOsakaTime() { + return getOptionalLong("osakatime"); } @Override @@ -486,7 +486,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { getCancunTime().ifPresent(l -> builder.put("cancunTime", l)); getCancunEOFTime().ifPresent(l -> builder.put("cancunEOFTime", l)); getPragueTime().ifPresent(l -> builder.put("pragueTime", l)); - getPragueEOFTime().ifPresent(l -> builder.put("pragueEOFTime", l)); + getOsakaTime().ifPresent(l -> builder.put("osakaTime", l)); getTerminalBlockNumber().ifPresent(l -> builder.put("terminalBlockNumber", l)); getTerminalBlockHash().ifPresent(h -> builder.put("terminalBlockHash", h.toHexString())); getFutureEipsTime().ifPresent(l -> builder.put("futureEipsTime", l)); @@ -640,7 +640,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { getCancunTime(), getCancunEOFTime(), getPragueTime(), - getPragueEOFTime(), + getOsakaTime(), getFutureEipsTime(), getExperimentalEipsTime()); // when adding forks add an entry to ${REPO_ROOT}/config/src/test/resources/all_forks.json diff --git a/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java index ee9584fd3a..c9c8dad795 100644 --- a/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java @@ -50,7 +50,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable private OptionalLong cancunTime = OptionalLong.empty(); private OptionalLong cancunEOFTime = OptionalLong.empty(); private OptionalLong pragueTime = OptionalLong.empty(); - private OptionalLong pragueEOFTime = OptionalLong.empty(); + private OptionalLong osakaTime = OptionalLong.empty(); private OptionalLong futureEipsTime = OptionalLong.empty(); private OptionalLong experimentalEipsTime = OptionalLong.empty(); private OptionalLong terminalBlockNumber = OptionalLong.empty(); @@ -252,8 +252,8 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable } @Override - public OptionalLong getPragueEOFTime() { - return pragueEOFTime; + public OptionalLong getOsakaTime() { + return osakaTime; } @Override @@ -671,14 +671,13 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable } /** - * PragueEOF time. + * Osaka time. * * @param timestamp the timestamp * @return the stub genesis config options */ - public StubGenesisConfigOptions pragueEOFTime(final long timestamp) { - pragueTime = OptionalLong.of(timestamp); - pragueEOFTime = pragueTime; + public StubGenesisConfigOptions osakaTime(final long timestamp) { + osakaTime = OptionalLong.of(timestamp); return this; } diff --git a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java index 69494a9c9c..fe8149cc65 100644 --- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java @@ -207,10 +207,9 @@ class GenesisConfigOptionsTest { } @Test - void shouldGetPragueEOFTime() { - final GenesisConfigOptions config = - fromConfigOptions(singletonMap("pragueEOFTime", 1670470143)); - assertThat(config.getPragueEOFTime()).hasValue(1670470143); + void shouldGetOsakaTime() { + final GenesisConfigOptions config = fromConfigOptions(singletonMap("osakaTime", 1670470143)); + assertThat(config.getOsakaTime()).hasValue(1670470143); } @Test @@ -247,7 +246,7 @@ class GenesisConfigOptionsTest { assertThat(config.getCancunTime()).isEmpty(); assertThat(config.getCancunEOFTime()).isEmpty(); assertThat(config.getPragueTime()).isEmpty(); - assertThat(config.getPragueEOFTime()).isEmpty(); + assertThat(config.getOsakaTime()).isEmpty(); assertThat(config.getFutureEipsTime()).isEmpty(); assertThat(config.getExperimentalEipsTime()).isEmpty(); } diff --git a/datatypes/src/main/java/org/hyperledger/besu/datatypes/HardforkId.java b/datatypes/src/main/java/org/hyperledger/besu/datatypes/HardforkId.java index 85ec84b4ad..d8b938a1b3 100644 --- a/datatypes/src/main/java/org/hyperledger/besu/datatypes/HardforkId.java +++ b/datatypes/src/main/java/org/hyperledger/besu/datatypes/HardforkId.java @@ -81,8 +81,6 @@ public interface HardforkId { CANCUN_EOF(false, "Cancun + EOF"), /** Prague fork. */ PRAGUE(false, "Prague"), - /** Prague + EOF fork. */ - PRAGUE_EOF(false, "Prague + EOF"), /** Osaka fork. */ OSAKA(false, "Osaka"), /** Amsterdam fork. */ diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java index 00b20a0170..c2243986c2 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java @@ -312,7 +312,7 @@ public final class GenesisState { if (cancunEOFTimestamp.isPresent()) { return genesis.getTimestamp() >= cancunEOFTimestamp.getAsLong(); } - return isPragueEOFAtGenesis(genesis); + return false; } private static boolean isPragueAtGenesis(final GenesisConfigFile genesis) { @@ -320,13 +320,13 @@ public final class GenesisState { if (pragueTimestamp.isPresent()) { return genesis.getTimestamp() >= pragueTimestamp.getAsLong(); } - return isPragueEOFAtGenesis(genesis); + return isOsakaAtGenesis(genesis); } - private static boolean isPragueEOFAtGenesis(final GenesisConfigFile genesis) { - final OptionalLong pragueEOFTimestamp = genesis.getConfigOptions().getPragueEOFTime(); - if (pragueEOFTimestamp.isPresent()) { - return genesis.getTimestamp() >= pragueEOFTimestamp.getAsLong(); + private static boolean isOsakaAtGenesis(final GenesisConfigFile genesis) { + final OptionalLong osakaTimestamp = genesis.getConfigOptions().getOsakaTime(); + if (osakaTimestamp.isPresent()) { + return genesis.getTimestamp() >= osakaTimestamp.getAsLong(); } return isFutureEipsTimeAtGenesis(genesis); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java index 55bfb363ba..615a476251 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java @@ -224,8 +224,8 @@ public class MainnetProtocolSpecFactory { metricsSystem); } - public ProtocolSpecBuilder pragueEOFDefinition(final GenesisConfigOptions genesisConfigOptions) { - return MainnetProtocolSpecs.pragueEOFDefinition( + public ProtocolSpecBuilder osakaDefinition(final GenesisConfigOptions genesisConfigOptions) { + return MainnetProtocolSpecs.osakaDefinition( chainId, isRevertReasonEnabled, genesisConfigOptions, diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java index b5b2f678d6..3426171477 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java @@ -57,8 +57,8 @@ import org.hyperledger.besu.evm.gascalculator.FrontierGasCalculator; import org.hyperledger.besu.evm.gascalculator.HomesteadGasCalculator; import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator; import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator; +import org.hyperledger.besu.evm.gascalculator.OsakaGasCalculator; import org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator; -import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator; import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator; import org.hyperledger.besu.evm.gascalculator.ShanghaiGasCalculator; import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator; @@ -815,7 +815,7 @@ public abstract class MainnetProtocolSpecs { .name("Prague"); } - static ProtocolSpecBuilder pragueEOFDefinition( + static ProtocolSpecBuilder osakaDefinition( final Optional chainId, final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, @@ -833,7 +833,7 @@ public abstract class MainnetProtocolSpecs { miningParameters, isParallelTxProcessingEnabled, metricsSystem); - return addEOF(chainId, evmConfiguration, protocolSpecBuilder).name("PragueEOF"); + return addEOF(chainId, evmConfiguration, protocolSpecBuilder).name("Osaka"); } private static ProtocolSpecBuilder addEOF( @@ -842,12 +842,11 @@ public abstract class MainnetProtocolSpecs { final ProtocolSpecBuilder protocolSpecBuilder) { return protocolSpecBuilder // EIP-7692 EOF v1 Gas calculator - .gasCalculator(PragueEOFGasCalculator::new) + .gasCalculator(OsakaGasCalculator::new) // EIP-7692 EOF v1 EVM and opcodes .evmBuilder( (gasCalculator, jdCacheConfig) -> - MainnetEVMs.pragueEOF( - gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration)) + MainnetEVMs.osaka(gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration)) // EIP-7698 EOF v1 creation transaction .contractCreationProcessorBuilder( evm -> @@ -867,7 +866,7 @@ public abstract class MainnetProtocolSpecs { final MiningParameters miningParameters, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { - return pragueEOFDefinition( + return osakaDefinition( chainId, enableRevertReason, genesisConfigOptions, diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java index beac906be5..52003bc96c 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java @@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.mainnet; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.datatypes.HardforkId; +import org.hyperledger.besu.datatypes.HardforkId.MainnetHardforkId; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.MiningParameters; import org.hyperledger.besu.ethereum.core.PrivacyParameters; @@ -277,7 +278,7 @@ public class ProtocolScheduleBuilder { lastForkBlock = validateForkOrder("Cancun", config.getCancunTime(), lastForkBlock); lastForkBlock = validateForkOrder("CancunEOF", config.getCancunEOFTime(), lastForkBlock); lastForkBlock = validateForkOrder("Prague", config.getPragueTime(), lastForkBlock); - lastForkBlock = validateForkOrder("PragueEOF", config.getPragueEOFTime(), lastForkBlock); + lastForkBlock = validateForkOrder("Osaka", config.getOsakaTime(), lastForkBlock); lastForkBlock = validateForkOrder("FutureEips", config.getFutureEipsTime(), lastForkBlock); lastForkBlock = validateForkOrder("ExperimentalEips", config.getExperimentalEipsTime(), lastForkBlock); @@ -413,9 +414,9 @@ public class ProtocolScheduleBuilder { config.getPragueTime(), specFactory.pragueDefinition(config)), timestampMilestone( - HardforkId.MainnetHardforkId.PRAGUE_EOF, - config.getPragueEOFTime(), - specFactory.pragueEOFDefinition(config)), + MainnetHardforkId.OSAKA, + config.getOsakaTime(), + specFactory.osakaDefinition(config)), timestampMilestone( HardforkId.MainnetHardforkId.FUTURE_EIPS, config.getFutureEipsTime(), diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/CodeValidateSubCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/CodeValidateSubCommand.java index d8be71cde1..bc5ef06f03 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/CodeValidateSubCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/CodeValidateSubCommand.java @@ -86,7 +86,7 @@ public class CodeValidateSubCommand implements Runnable { String fork = parentCommand != null && parentCommand.hasFork() ? parentCommand.getFork() - : EvmSpecVersion.PRAGUE.getName(); + : EvmSpecVersion.OSAKA.getName(); evm = Suppliers.memoize( diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EOFTestSubCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EOFTestSubCommand.java index fb28701f77..7906cfd953 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EOFTestSubCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EOFTestSubCommand.java @@ -94,7 +94,7 @@ public class EOFTestSubCommand implements Runnable { } ProtocolSpec protocolSpec = ReferenceTestProtocolSchedules.getInstance() - .geSpecByName(fork == null ? EvmSpecVersion.PRAGUE.getName() : fork); + .geSpecByName(fork == null ? EvmSpecVersion.OSAKA.getName() : fork); evm = protocolSpec.getEvm(); final JavaType javaType = @@ -181,7 +181,7 @@ public class EOFTestSubCommand implements Runnable { continue; } TestResult actualResult; - if (evmVersion.ordinal() < EvmSpecVersion.PRAGUE_EOF.ordinal()) { + if (evmVersion.ordinal() < EvmSpecVersion.OSAKA.ordinal()) { actualResult = failed("EOF_InvalidCode"); } else { actualResult = considerCode(code); diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java index 0ce7bf98f5..8dc8a74c1f 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java @@ -157,15 +157,16 @@ class MainnetGenesisFileModule extends GenesisFileModule { .chainId(chainId))), Map.entry( "prague", - createSchedule( - new StubGenesisConfigOptions().pragueTime(0).baseFeePerGas(0x0a).chainId(chainId))), - Map.entry( - "pragueeof", createSchedule( new StubGenesisConfigOptions() - .pragueEOFTime(0) + .pragueTime(0) + .osakaTime(0) // TODO remove this once osaka_devnet_0 launches .baseFeePerGas(0x0a) .chainId(chainId))), + Map.entry( + "osaka", + createSchedule( + new StubGenesisConfigOptions().osakaTime(0).baseFeePerGas(0x0a).chainId(chainId))), Map.entry( "futureeips", createSchedule( diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/PrettyPrintSubCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/PrettyPrintSubCommand.java index e24c24a21e..c6fac36563 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/PrettyPrintSubCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/PrettyPrintSubCommand.java @@ -101,7 +101,7 @@ public class PrettyPrintSubCommand implements Runnable { "Pretty printing of legacy EVM is not supported. Patches welcome!"); } else { - String fork = EvmSpecVersion.PRAGUE.getName(); + String fork = EvmSpecVersion.OSAKA.getName(); if (parentCommand.hasFork()) { fork = parentCommand.getFork(); } diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java index 082fae7f69..35d5de5d66 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java @@ -30,8 +30,8 @@ import org.hyperledger.besu.evm.gascalculator.GasCalculator; import org.hyperledger.besu.evm.gascalculator.HomesteadGasCalculator; import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator; import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator; +import org.hyperledger.besu.evm.gascalculator.OsakaGasCalculator; import org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator; -import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator; import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator; import org.hyperledger.besu.evm.gascalculator.ShanghaiGasCalculator; import org.hyperledger.besu.evm.precompile.PrecompiledContract; @@ -142,17 +142,11 @@ public abstract class BenchmarkExecutor { case LONDON, PARIS -> new LondonGasCalculator(); case SHANGHAI -> new ShanghaiGasCalculator(); case CANCUN -> new CancunGasCalculator(); + case CANCUN_EOF -> new OsakaGasCalculator(); case PRAGUE -> new PragueGasCalculator(); - case CANCUN_EOF, - PRAGUE_EOF, - OSAKA, - AMSTERDAM, - BOGOTA, - POLIS, - BANGKOK, - FUTURE_EIPS, - EXPERIMENTAL_EIPS -> - new PragueEOFGasCalculator(); + case OSAKA -> new OsakaGasCalculator(); + case AMSTERDAM, BOGOTA, POLIS, BANGKOK, FUTURE_EIPS, EXPERIMENTAL_EIPS -> + new OsakaGasCalculator(); }; } diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/prague-eof-rjump.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/osaka-eof-rjump.json similarity index 92% rename from ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/prague-eof-rjump.json rename to ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/osaka-eof-rjump.json index b9d2e54179..8cca437e34 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/prague-eof-rjump.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/osaka-eof-rjump.json @@ -4,13 +4,13 @@ "stdin" ], "stdin": { - "tests/prague/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_PragueEIP7692-blockchain_test]": { - "network": "Prague", + "tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]": { + "network": "Osaka", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "coinbase": "0x0000000000000000000000000000000000000000", - "stateRoot": "0x34ccf8774a5b8833da9451a3f7f8a0af0147956c058f0831dab07c348d7ac0d9", + "stateRoot": "0xbeb30acb62768b375f7e7d36f6ba9240cb692ebd0ee04c9321c756cf4ff1c437", "transactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "receiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -28,7 +28,7 @@ "excessBlobGas": "0x00", "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "requestsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "hash": "0xc9397e8a1b99cbb2b885852fde56de8fa686091a4f4430163f5237d7aaf33a14" + "hash": "0x367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9" }, "pre": { "0x00000000219ab540356cbb839cbe05303d7705fa": { @@ -75,6 +75,12 @@ "code": "0x3373fffffffffffffffffffffffffffffffffffffffe146090573615156028575f545f5260205ff35b366038141561012e5760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061012e57600154600101600155600354806003026004013381556001015f3581556001016020359055600101600355005b6003546002548082038060101160a4575060105b5f5b81811460dd5780604c02838201600302600401805490600101805490600101549160601b83528260140152906034015260010160a6565b910180921460ed579060025560f8565b90505f6002555f6003555b5f548061049d141561010757505f5b60015460028282011161011c5750505f610122565b01600290035b5f555f600155604c025ff35b5f5ffd", "storage": {} }, + "0x00b42dbf2194e931e80326d950320f7d9dbeac02": { + "nonce": "0x01", + "balance": "0x00", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe146098573615156028575f545f5260205ff35b36606014156101445760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061014457600154600101600155600354806004026004013381556001015f35815560010160203581556001016040359055600101600355005b6003546002548082038060011160ac575060015b5f5b81811460f15780607402838201600402600401805490600101805490600101805490600101549260601b84529083601401528260340152906054015260010160ae565b9101809214610103579060025561010e565b90505f6002555f6003555b5f548061049d141561011d57505f5b6001546001828201116101325750505f610138565b01600190035b5f555f6001556074025ff35b5f5ffd", + "storage": {} + }, "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { "nonce": "0x01", "balance": "0x00", @@ -161,12 +167,18 @@ "code": "0x3373fffffffffffffffffffffffffffffffffffffffe146090573615156028575f545f5260205ff35b366038141561012e5760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061012e57600154600101600155600354806003026004013381556001015f3581556001016020359055600101600355005b6003546002548082038060101160a4575060105b5f5b81811460dd5780604c02838201600302600401805490600101805490600101549160601b83528260140152906034015260010160a6565b910180921460ed579060025560f8565b90505f6002555f6003555b5f548061049d141561010757505f5b60015460028282011161011c5750505f610122565b01600290035b5f555f600155604c025ff35b5f5ffd", "storage": {} }, + "0x00b42dbf2194e931e80326d950320f7d9dbeac02": { + "nonce": "0x01", + "balance": "0x00", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe146098573615156028575f545f5260205ff35b36606014156101445760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061014457600154600101600155600354806004026004013381556001015f35815560010160203581556001016040359055600101600355005b6003546002548082038060011160ac575060015b5f5b81811460f15780607402838201600402600401805490600101805490600101805490600101549260601b84529083601401528260340152906054015260010160ae565b9101809214610103579060025561010e565b90505f6002555f6003555b5f548061049d141561011d57505f5b6001546001828201116101325750505f610138565b01600190035b5f555f6001556074025ff35b5f5ffd", + "storage": {} + }, "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { "nonce": "0x01", "balance": "0x00", "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", "storage": { - "0x00": "0xc9397e8a1b99cbb2b885852fde56de8fa686091a4f4430163f5237d7aaf33a14" + "0x00": "0x367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9" } }, "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": { @@ -182,14 +194,15 @@ "storage": {} } }, - "genesisRLP": "0xf90262f9025ba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a034ccf8774a5b8833da9451a3f7f8a0af0147956c058f0831dab07c348d7ac0d9a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000808088016345785d8a0000808000a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421c0c0c0c0", + "lastblockhash": "0xfb5d1d0e218fa7873bc188f07f3e0a7c78027ff6e6e199c48ba1facd3c3726fd", + "genesisRLP": "0xf90262f9025ba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0beb30acb62768b375f7e7d36f6ba9240cb692ebd0ee04c9321c756cf4ff1c437a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000808088016345785d8a0000808000a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421c0c0c0c0", "blocks": [ { "blockHeader": { - "parentHash": "0xc9397e8a1b99cbb2b885852fde56de8fa686091a4f4430163f5237d7aaf33a14", + "parentHash": "0x367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9", "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "coinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", - "stateRoot": "0x1a4885d1f64bac16e5ab17fb13e23fb5d1a0ec2ca4519c81714683f69c8d9a84", + "stateRoot": "0x4ab70cbe1abe50d6bb3c8cdb3e9e66111f142cd68ab73870e9ce9e0dd1d6ead2", "transactionsTrie": "0xec9d10cff79619f2df45db8c66526ef3fbd32d283fdd2dcc9b55c0efe643d8c3", "receiptTrie": "0x9593f56abf23bcbb26d27b0c6e46a56415d9103ed6b4d8ac7b4182f9f250cafa", "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -207,7 +220,7 @@ "excessBlobGas": "0x00", "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "requestsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "hash": "0x879cf54bf493b6585db592b1b24ec30a8a7fbe3b9146d3fb20ca36200f2aca87" + "hash": "0xfb5d1d0e218fa7873bc188f07f3e0a7c78027ff6e6e199c48ba1facd3c3726fd" }, "transactions": [ { @@ -229,22 +242,22 @@ "withdrawals": [], "depositRequests": [], "withdrawalRequests": [], - "rlp": "0xf902c9f9025fa0c9397e8a1b99cbb2b885852fde56de8fa686091a4f4430163f5237d7aaf33a14a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa01a4885d1f64bac16e5ab17fb13e23fb5d1a0ec2ca4519c81714683f69c8d9a84a0ec9d10cff79619f2df45db8c66526ef3fbd32d283fdd2dcc9b55c0efe643d8c3a09593f56abf23bcbb26d27b0c6e46a56415d9103ed6b4d8ac7b4182f9f250cafab9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800188016345785d8a000082a8648203e800a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f862f860800a83989680940000000000000000000000000000000000001000808026a0e5d462429669f661291a8dc4c49a092cfd4922b6f3f31c9189a2f4adf5ecd730a001494afaf472fbb80bcb107ffeb918a2b9115f454027840615d6d20d63c69ac0c0c0c0", + "consolidationRequests": [], + "rlp": "0xf902c9f9025fa0367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa04ab70cbe1abe50d6bb3c8cdb3e9e66111f142cd68ab73870e9ce9e0dd1d6ead2a0ec9d10cff79619f2df45db8c66526ef3fbd32d283fdd2dcc9b55c0efe643d8c3a09593f56abf23bcbb26d27b0c6e46a56415d9103ed6b4d8ac7b4182f9f250cafab9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800188016345785d8a000082a8648203e800a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f862f860800a83989680940000000000000000000000000000000000001000808026a0e5d462429669f661291a8dc4c49a092cfd4922b6f3f31c9189a2f4adf5ecd730a001494afaf472fbb80bcb107ffeb918a2b9115f454027840615d6d20d63c69ac0c0c0c0", "blocknumber": "1" } ], - "lastblockhash": "0x879cf54bf493b6585db592b1b24ec30a8a7fbe3b9146d3fb20ca36200f2aca87", "sealEngine": "NoProof", "_info": { - "hash": "0xbfd1223f9b5b8dbf202178f7c1f18dc089cb24e54c9cb7fc9831907547e937c4", + "hash": "0xd0cc15d832c8c0b9cf5bdc0eab79c3b632193a11fde3d5ef32bb07e8c65ba6bd", "comment": "`execution-spec-tests` generated test", - "filling-transition-tool": "Hyperledger Besu evm 24.7-develop-8ca7129", + "filling-transition-tool": "Hyperledger Besu evm 24.9-develop-0d63955", "description": "Test function documentation:\nEOF1V4200_0002 (Valid) EOF code containing RJUMP (Zero)", - "url": "https://github.com/ethereum/execution-spec-tests/blob/891a6111370c89d4ce89bf91589c6d5ff6785158/tests/prague/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py#L63", + "url": "https://github.com/ethereum/execution-spec-tests/blob/96efd737b258eeb8efb615e9123d931b6dfda302/tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py#L44", "reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4200.md", "reference-spec-version": "17d4a8d12d2b5e0f2985c866376c16c8c6df7cba" } } }, - "stdout": "Considering tests/prague/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_PragueEIP7692-blockchain_test]\nBlock 1 (0x879cf54bf493b6585db592b1b24ec30a8a7fbe3b9146d3fb20ca36200f2aca87) Imported\nChain import successful - tests/prague/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_PragueEIP7692-blockchain_test]\n" + "stdout": "Considering tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]\nBlock 1 (0xfb5d1d0e218fa7873bc188f07f3e0a7c78027ff6e6e199c48ba1facd3c3726fd) Imported\nChain import successful - tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]\n" } diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json index e924043042..72ada37da7 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json @@ -45,7 +45,7 @@ }, "out": "0x", "post": { - "CancunEOF": [ + "Osaka": [ { "hash": "0x1a8642a04dae90535f00f53d3a30284c4db051d508a653db89eb100ba9aecbf3", "logs": "0xf48b954a6a6f4ce6b28e4950b7027413f4bdc8f459df6003b6e8d7a1567c8940", @@ -79,7 +79,7 @@ {"pc":5,"section":0,"op":95,"gas":"0x793d71","gasCost":"0x2","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH0"}, {"pc":6,"section":0,"op":95,"gas":"0x793d6f","gasCost":"0x2","memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH0"}, {"pc":7,"section":0,"op":238,"immediate":"0x00","gas":"0x793d6d","gasCost":"0x0","memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"RETURNCONTRACT"}, - {"output":"","gasUsed":"0xe433","test":"create-eof","fork":"CancunEOF","d":0,"g":0,"v":0,"postHash":"0x1a8642a04dae90535f00f53d3a30284c4db051d508a653db89eb100ba9aecbf3","postLogsHash":"0xf48b954a6a6f4ce6b28e4950b7027413f4bdc8f459df6003b6e8d7a1567c8940","pass":true}, + {"output":"","gasUsed":"0xe433","test":"create-eof","fork":"Osaka","d":0,"g":0,"v":0,"postHash":"0x1a8642a04dae90535f00f53d3a30284c4db051d508a653db89eb100ba9aecbf3","postLogsHash":"0xf48b954a6a6f4ce6b28e4950b7027413f4bdc8f459df6003b6e8d7a1567c8940","pass":true}, {"pc":0,"op":239,"gas":"0x794068","gasCost":"0x0","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"INVALID","error":"Bad instruction"}, {"output":"","gasUsed":"0x7a1200","test":"create-eof","fork":"Cancun","d":0,"g":0,"v":0,"postHash":"0xaa80d89bc89f58da8de41d3894bd1a241896ff91f7a5964edaefb39e8e3a4a98","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true,"error":"INVALID_OPERATION"} ] diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json index e2eb67602e..f3448aa5a2 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json @@ -45,7 +45,7 @@ }, "out": "0x", "post": { - "Prague": [ + "Osaka": [ { "hash": "0x1a8642a04dae90535f00f53d3a30284c4db051d508a653db89eb100ba9aecbf3", "logs": "0xf48b954a6a6f4ce6b28e4950b7027413f4bdc8f459df6003b6e8d7a1567c8940", @@ -71,7 +71,7 @@ } }, "stdout": [ - {"output":"","gasUsed":"0xd198","test":"create-eof","fork":"Prague","d":0,"g":0,"v":0,"postHash":"0x2a9c58298ba5d4ec86ca682b9fcc9ff67c3fc44dbd39f85a2f9b74bfe4e5178e","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":false,"error":"Invalid EOF Layout: unexpected_header_kind expected 1 actual 17"}, + {"output":"","gasUsed":"0xd198","test":"create-eof","fork":"Osaka","d":0,"g":0,"v":0,"postHash":"0x2a9c58298ba5d4ec86ca682b9fcc9ff67c3fc44dbd39f85a2f9b74bfe4e5178e","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":false,"error":"Invalid EOF Layout: unexpected_header_kind expected 1 actual 17"}, {"pc":0,"op":239,"gas":"0x794068","gasCost":"0x0","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"INVALID","error":"Bad instruction"}, {"output":"","gasUsed":"0x7a1200","test":"create-eof","fork":"Cancun","d":0,"g":0,"v":0,"postHash":"0xaa80d89bc89f58da8de41d3894bd1a241896ff91f7a5964edaefb39e8e3a4a98","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true,"error":"INVALID_OPERATION"} ] diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof-error.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof-error.json index cd4c3fa14a..0b1396f261 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof-error.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof-error.json @@ -8,7 +8,7 @@ "--coinbase", "4444588443C3A91288C5002483449ABA1054192B", "--fork", - "CancunEOF" + "Osaka" ], "stdin": "", "stdout": "EOF Code Invalid : incompatible_container_kind opcode STOP is only valid for runtime.\n" diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json index 1fa459916b..6740c86719 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json @@ -8,7 +8,7 @@ "--coinbase", "4444588443C3A91288C5002483449ABA1054192B", "--fork", - "CancunEOF" + "Osaka" ], "stdin": "", "stdout": [ @@ -20,6 +20,6 @@ {"pc":5,"section":0,"op":95,"gas":"0x2540be109","gasCost":"0x2","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH0"}, {"pc":6,"section":0,"op":95,"gas":"0x2540be107","gasCost":"0x2","memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH0"}, {"pc":7,"section":0,"op":238,"immediate":"0x00","gas":"0x2540be105","gasCost":"0x0","memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"RETURNCONTRACT"}, - {"stateRoot":"0x9790b070a5749acec6a7252a867f795df3c2cb5b800fb509ea259a1c0b5d96c1","output":"0x","gasUsed":"0x129b","pass":true,"fork":"CancunEOF"} + {"stateRoot":"0x9790b070a5749acec6a7252a867f795df3c2cb5b800fb509ea259a1c0b5d96c1","output":"0x","gasUsed":"0x129b","pass":true,"fork":"Osaka"} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json index 439c69195a..f25557fa7e 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json @@ -7,17 +7,17 @@ "--coinbase", "4444588443C3A91288C5002483449ABA1054192B", "--fork", - "PragueEOF" + "Osaka" ], "stdin": "", "stdout": [ {"pc":0,"section":0,"op":227,"immediate":"0x0002","gas":"0x2540be400","gasCost":"0x5","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"CALLF"}, - {"pc":0,"section":2,"op":229,"immediate":"0x0002","gas":"0x2540be3fb","gasCost":"0x5","memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"JUMPF"}, - {"pc":0,"section":1,"op":228,"gas":"0x2540be3f6","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"RETF"}, + {"pc":11,"section":2,"op":229,"immediate":"0x0001","gas":"0x2540be3fb","gasCost":"0x5","memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"JUMPF"}, + {"pc":10,"section":1,"op":228,"gas":"0x2540be3f6","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"RETF"}, {"pc":3,"section":0,"op":97,"immediate":"0x2015","gas":"0x2540be3f3","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH2"}, {"pc":6,"section":0,"op":96,"immediate":"0x01","gas":"0x2540be3f0","gasCost":"0x3","memSize":0,"stack":["0x2015"],"depth":1,"refund":0,"opName":"PUSH1"}, {"pc":8,"section":0,"op":85,"gas":"0x2540be3ed","gasCost":"0x5654","memSize":0,"stack":["0x2015","0x1"],"depth":1,"refund":0,"opName":"SSTORE"}, {"pc":9,"section":0,"op":0,"gas":"0x2540b8d99","gasCost":"0x0","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"}, - {"stateRoot":"0x761f723ceabb467d438fe74abf025c10bf65592b84ec389850038eb572f2b0fa","output":"0x","gasUsed":"0x5667","pass":true,"fork":"PragueEOF"} + {"stateRoot":"0x761f723ceabb467d438fe74abf025c10bf65592b84ec389850038eb572f2b0fa","output":"0x","gasUsed":"0x5667","pass":true,"fork":"Osaka"} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json index c9553c9209..ddce2bf2af 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json @@ -7,11 +7,11 @@ "--coinbase", "4444588443C3A91288C5002483449ABA1054192B", "--fork", - "PragueEOF" + "Osaka" ], "stdin": "", "stdout": [ {"pc":0,"section":0,"op":0,"gas":"0x2540be400","gasCost":"0x0","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"}, - {"stateRoot":"0xdae5f2c233bf9fbb7413d06ce744a3345dbf971b5bb5638736c0388f43a61a4b","output":"0x","gasUsed":"0x0","pass":true,"fork":"PragueEOF"} + {"stateRoot":"0xdae5f2c233bf9fbb7413d06ce744a3345dbf971b5bb5638736c0388f43a61a4b","output":"0x","gasUsed":"0x0","pass":true,"fork":"Osaka"} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/initcode-error.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/initcode-error.json index b88134778e..4225259fa4 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/initcode-error.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/initcode-error.json @@ -7,7 +7,7 @@ "--coinbase", "4444588443C3A91288C5002483449ABA1054192B", "--fork", - "CancunEOF" + "Osaka" ], "stdin": "", "stdout": "To evaluate INITCODE mode EOF code use the --create flag\n" diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java index bcdf5e25d5..976c8e70d2 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java @@ -105,8 +105,15 @@ public class ReferenceTestProtocolSchedules { Map.entry( "CancunToPragueAtTime15k", createSchedule(genesisStub.clone().cancunTime(0).pragueTime(15000))), - Map.entry("Prague", createSchedule(genesisStub.clone().pragueEOFTime(0))), - Map.entry("Osaka", createSchedule(genesisStub.clone().futureEipsTime(0))), + Map.entry( + "Prague", + createSchedule( + genesisStub + .clone() + .pragueTime(0) + .osakaTime(0) // TODO remove this once osaka_devnet_0 ships + )), + Map.entry("Osaka", createSchedule(genesisStub.clone().osakaTime(0))), Map.entry("Amsterdam", createSchedule(genesisStub.clone().futureEipsTime(0))), Map.entry("Bogota", createSchedule(genesisStub.clone().futureEipsTime(0))), Map.entry("Polis", createSchedule(genesisStub.clone().futureEipsTime(0))), diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/eof/EOFReferenceTestTools.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/eof/EOFReferenceTestTools.java index 6a736831ff..334bb0be33 100644 --- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/eof/EOFReferenceTestTools.java +++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/eof/EOFReferenceTestTools.java @@ -15,6 +15,7 @@ package org.hyperledger.besu.ethereum.eof; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import java.nio.file.Path; import java.util.Arrays; @@ -33,6 +34,7 @@ import org.hyperledger.besu.ethereum.referencetests.ReferenceTestProtocolSchedul import org.hyperledger.besu.evm.Code; import org.hyperledger.besu.evm.EVM; import org.hyperledger.besu.evm.code.CodeInvalid; +import org.hyperledger.besu.evm.code.CodeV1; import org.hyperledger.besu.evm.code.EOFLayout; import org.hyperledger.besu.testutil.JsonTestParameters; @@ -41,7 +43,7 @@ public class EOFReferenceTestTools { static { final String eips = - System.getProperty("test.ethereum.eof.eips", "Prague,Osaka,Amsterdam,Bogota,Polis,Bangkok"); + System.getProperty("test.ethereum.eof.eips", "Osaka,Amsterdam,Bogota,Polis,Bangkok"); EIPS_TO_RUN = Arrays.asList(eips.split(",")); } @@ -79,6 +81,10 @@ public class EOFReferenceTestTools { if (EIPS_TO_RUN.isEmpty()) { params.ignoreAll(); } + + // EOF was moved from Prague to Osaka + params.ignore("-Prague\\["); + } private EOFReferenceTestTools() { @@ -132,28 +138,37 @@ public class EOFReferenceTestTools { } else { parsedCode = evm.getCodeUncached(code); } + if (expected.result()) { assertThat(parsedCode.isValid()) .withFailMessage( () -> "Valid code failed with " + ((CodeInvalid) parsedCode).getInvalidReason()) .isTrue(); - } else { - assertThat(parsedCode.isValid()) - .withFailMessage("Invalid code expected " + expected.exception() + " but was valid") - .isFalse(); - if (name.contains("eip7692")) { - // if the test is from EEST, validate the exception name. - assertThat(((CodeInvalid) parsedCode).getInvalidReason()) - .withFailMessage( - () -> - "Expected exception :%s actual exception: %s" - .formatted( - expected.exception(), - (parsedCode.isValid() - ? null - : ((CodeInvalid) parsedCode).getInvalidReason()))) - .containsIgnoringCase(expected.exception().replace("EOFException.", "")); + } else if (parsedCode.isValid()) { + if (parsedCode instanceof CodeV1 codeV1 + && expected.exception().contains("EOF_IncompatibleContainerKind")) { + // one last container type check + var parsedMode = codeV1.getEofLayout().containerMode().get(); + String actual = parsedMode == null ? "RUNTIME" : parsedMode.toString(); + String expectedContainerKind = containerKind == null ? "RUNTIME" : containerKind; + assertThat(actual) + .withFailMessage("EOF_IncompatibleContainerKind expected") + .isNotEqualTo(expectedContainerKind); + } else { + fail("Invalid code expected " + expected.exception() + " but was valid"); } + } else if (name.contains("eip7692")) { + // if the test is from EEST, validate the exception name. + assertThat(((CodeInvalid) parsedCode).getInvalidReason()) + .withFailMessage( + () -> + "Expected exception :%s actual exception: %s" + .formatted( + expected.exception(), + (parsedCode.isValid() + ? null + : ((CodeInvalid) parsedCode).getInvalidReason()))) + .containsIgnoringCase(expected.exception().replace("EOFException.", "")); } } else { assertThat(false) diff --git a/evm/src/main/java/org/hyperledger/besu/evm/EvmSpecVersion.java b/evm/src/main/java/org/hyperledger/besu/evm/EvmSpecVersion.java index 7d4344c6bc..d675496d7a 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/EvmSpecVersion.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/EvmSpecVersion.java @@ -55,8 +55,6 @@ public enum EvmSpecVersion { CANCUN_EOF(MainnetHardforkId.CANCUN_EOF, 0x6000, 0xc000, 1), /** Prague evm spec version. */ PRAGUE(MainnetHardforkId.PRAGUE, 0x6000, 0xc000, 0), - /** PragueEOF evm spec version. */ - PRAGUE_EOF(MainnetHardforkId.PRAGUE_EOF, 0x6000, 0xc000, 1), /** Osaka evm spec version. */ OSAKA(MainnetHardforkId.OSAKA, 0x6000, 0xc000, 1), /** Amsterdam evm spec version. */ @@ -183,11 +181,11 @@ public enum EvmSpecVersion { * @return the EVM spec version for that fork, or null if no fork matched. */ public static EvmSpecVersion fromName(final String name) { - // TODO remove once PragueEOF settles + // TODO remove once CancunEOF tests are removed from EEST if ("prague".equalsIgnoreCase(name)) { - return EvmSpecVersion.PRAGUE_EOF; + return EvmSpecVersion.OSAKA; } - // TODO remove once PragueEOF settles + // TODO remove once CancunEOF tests are removed from EEST if ("cancuneof".equalsIgnoreCase(name)) { return EvmSpecVersion.CANCUN_EOF; } diff --git a/evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java b/evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java index 998776d714..482a34209e 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java @@ -23,8 +23,8 @@ import org.hyperledger.besu.evm.gascalculator.GasCalculator; import org.hyperledger.besu.evm.gascalculator.HomesteadGasCalculator; import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator; import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator; +import org.hyperledger.besu.evm.gascalculator.OsakaGasCalculator; import org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator; -import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator; import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator; import org.hyperledger.besu.evm.gascalculator.ShanghaiGasCalculator; import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator; @@ -1025,72 +1025,70 @@ public class MainnetEVMs { final GasCalculator gasCalculator, final BigInteger chainID) { registerCancunOperations(registry, gasCalculator, chainID); - - // TODO add EOF operations here once PragueEOF is collapsed into Prague } /** - * PragueEOF evm. + * Osaka evm. * * @param evmConfiguration the evm configuration * @return the evm */ - public static EVM pragueEOF(final EvmConfiguration evmConfiguration) { - return pragueEOF(DEV_NET_CHAIN_ID, evmConfiguration); + public static EVM osaka(final EvmConfiguration evmConfiguration) { + return osaka(DEV_NET_CHAIN_ID, evmConfiguration); } /** - * PragueEOF evm. + * Osaka evm. * * @param chainId the chain id * @param evmConfiguration the evm configuration * @return the evm */ - public static EVM pragueEOF(final BigInteger chainId, final EvmConfiguration evmConfiguration) { - return pragueEOF(new PragueEOFGasCalculator(), chainId, evmConfiguration); + public static EVM osaka(final BigInteger chainId, final EvmConfiguration evmConfiguration) { + return osaka(new OsakaGasCalculator(), chainId, evmConfiguration); } /** - * PragueEOF evm. + * Osaka evm. * * @param gasCalculator the gas calculator * @param chainId the chain id * @param evmConfiguration the evm configuration * @return the evm */ - public static EVM pragueEOF( + public static EVM osaka( final GasCalculator gasCalculator, final BigInteger chainId, final EvmConfiguration evmConfiguration) { return new EVM( - pragueEOFOperations(gasCalculator, chainId), + osakaOperations(gasCalculator, chainId), gasCalculator, evmConfiguration, - EvmSpecVersion.PRAGUE_EOF); + EvmSpecVersion.OSAKA); } /** - * Operation registry for PragueEOF's operations. + * Operation registry for Osaka's operations. * * @param gasCalculator the gas calculator * @param chainId the chain id * @return the operation registry */ - public static OperationRegistry pragueEOFOperations( + public static OperationRegistry osakaOperations( final GasCalculator gasCalculator, final BigInteger chainId) { OperationRegistry operationRegistry = new OperationRegistry(); - registerPragueEOFOperations(operationRegistry, gasCalculator, chainId); + registerOsakaOperations(operationRegistry, gasCalculator, chainId); return operationRegistry; } /** - * Register PragueEOF's operations. + * Register Osaka's operations. * * @param registry the registry * @param gasCalculator the gas calculator * @param chainID the chain id */ - public static void registerPragueEOFOperations( + public static void registerOsakaOperations( final OperationRegistry registry, final GasCalculator gasCalculator, final BigInteger chainID) { @@ -1140,74 +1138,6 @@ public class MainnetEVMs { registry.put(new ReturnContractOperation(gasCalculator)); } - /** - * Osaka evm. - * - * @param evmConfiguration the evm configuration - * @return the evm - */ - public static EVM osaka(final EvmConfiguration evmConfiguration) { - return osaka(DEV_NET_CHAIN_ID, evmConfiguration); - } - - /** - * Osaka evm. - * - * @param chainId the chain id - * @param evmConfiguration the evm configuration - * @return the evm - */ - public static EVM osaka(final BigInteger chainId, final EvmConfiguration evmConfiguration) { - return osaka(new PragueGasCalculator(), chainId, evmConfiguration); - } - - /** - * Osaka evm. - * - * @param gasCalculator the gas calculator - * @param chainId the chain id - * @param evmConfiguration the evm configuration - * @return the evm - */ - public static EVM osaka( - final GasCalculator gasCalculator, - final BigInteger chainId, - final EvmConfiguration evmConfiguration) { - return new EVM( - osakaOperations(gasCalculator, chainId), - gasCalculator, - evmConfiguration, - EvmSpecVersion.OSAKA); - } - - /** - * Operation registry for osaka's operations. - * - * @param gasCalculator the gas calculator - * @param chainId the chain id - * @return the operation registry - */ - public static OperationRegistry osakaOperations( - final GasCalculator gasCalculator, final BigInteger chainId) { - OperationRegistry operationRegistry = new OperationRegistry(); - registerOsakaOperations(operationRegistry, gasCalculator, chainId); - return operationRegistry; - } - - /** - * Register osaka operations. - * - * @param registry the registry - * @param gasCalculator the gas calculator - * @param chainID the chain id - */ - public static void registerOsakaOperations( - final OperationRegistry registry, - final GasCalculator gasCalculator, - final BigInteger chainID) { - registerPragueEOFOperations(registry, gasCalculator, chainID); - } - /** * Amsterdam evm. * diff --git a/evm/src/main/java/org/hyperledger/besu/evm/fluent/EVMExecutor.java b/evm/src/main/java/org/hyperledger/besu/evm/fluent/EVMExecutor.java index a182ae9454..fbf62f3e41 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/fluent/EVMExecutor.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/fluent/EVMExecutor.java @@ -164,7 +164,6 @@ public class EVMExecutor { case CANCUN -> cancun(chainId, evmConfiguration); case CANCUN_EOF -> cancunEOF(chainId, evmConfiguration); case PRAGUE -> prague(chainId, evmConfiguration); - case PRAGUE_EOF -> pragueEOF(chainId, evmConfiguration); case OSAKA -> osaka(chainId, evmConfiguration); case AMSTERDAM -> amsterdam(chainId, evmConfiguration); case BOGOTA -> bogota(chainId, evmConfiguration); @@ -525,21 +524,6 @@ public class EVMExecutor { return executor; } - /** - * Instantiate PragueEOF evm executor. - * - * @param chainId the chain ID - * @param evmConfiguration the evm configuration - * @return the evm executor - */ - public static EVMExecutor pragueEOF( - final BigInteger chainId, final EvmConfiguration evmConfiguration) { - final EVMExecutor executor = new EVMExecutor(MainnetEVMs.pragueEOF(chainId, evmConfiguration)); - executor.precompileContractRegistry = - MainnetPrecompiledContracts.prague(executor.evm.getGasCalculator()); - return executor; - } - /** * Instantiate Osaka evm executor. * diff --git a/evm/src/main/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculator.java b/evm/src/main/java/org/hyperledger/besu/evm/gascalculator/OsakaGasCalculator.java similarity index 89% rename from evm/src/main/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculator.java rename to evm/src/main/java/org/hyperledger/besu/evm/gascalculator/OsakaGasCalculator.java index 5fa2fe8725..b4155dac52 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculator.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/gascalculator/OsakaGasCalculator.java @@ -26,13 +26,13 @@ import static org.hyperledger.besu.datatypes.Address.BLS12_MAP_FP2_TO_G2; *
  • TBD * */ -public class PragueEOFGasCalculator extends PragueGasCalculator { +public class OsakaGasCalculator extends PragueGasCalculator { static final long MIN_RETAINED_GAS = 5_000; static final long MIN_CALLEE_GAS = 2300; /** Instantiates a new Prague Gas Calculator. */ - public PragueEOFGasCalculator() { + public OsakaGasCalculator() { this(BLS12_MAP_FP2_TO_G2.toArrayUnsafe()[19]); } @@ -41,7 +41,7 @@ public class PragueEOFGasCalculator extends PragueGasCalculator { * * @param maxPrecompile the max precompile */ - protected PragueEOFGasCalculator(final int maxPrecompile) { + protected OsakaGasCalculator(final int maxPrecompile) { super(maxPrecompile); } diff --git a/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractExtCallOperation.java b/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractExtCallOperation.java index c82e8c1633..7a0296bf56 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractExtCallOperation.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractExtCallOperation.java @@ -109,15 +109,16 @@ public abstract class AbstractExtCallOperation extends AbstractCallOperation { long inputOffset = inputDataOffset(frame); long inputLength = inputDataLength(frame); + GasCalculator gasCalculator = gasCalculator(); if (!zeroValue && isStatic(frame)) { return new OperationResult( - gasCalculator().callValueTransferGasCost(), ExceptionalHaltReason.ILLEGAL_STATE_CHANGE); + gasCalculator.callValueTransferGasCost(), ExceptionalHaltReason.ILLEGAL_STATE_CHANGE); } if (toBytes.size() > Address.SIZE) { return new OperationResult( - gasCalculator().memoryExpansionGasCost(frame, inputOffset, inputLength) - + (zeroValue ? 0 : gasCalculator().callValueTransferGasCost()) - + gasCalculator().getColdAccountAccessCost(), + gasCalculator.memoryExpansionGasCost(frame, inputOffset, inputLength) + + (zeroValue ? 0 : gasCalculator.callValueTransferGasCost()) + + gasCalculator.getColdAccountAccessCost(), ExceptionalHaltReason.ADDRESS_OUT_OF_RANGE); } Address to = Words.toAddress(toBytes); @@ -125,7 +126,7 @@ public abstract class AbstractExtCallOperation extends AbstractCallOperation { if (contract != null) { final DelegatedCodeGasCostHelper.Result result = - deductDelegatedCodeGasCost(frame, gasCalculator(), contract); + deductDelegatedCodeGasCost(frame, gasCalculator, contract); if (result.status() != DelegatedCodeGasCostHelper.Status.SUCCESS) { return new Operation.OperationResult( result.gasCost(), ExceptionalHaltReason.INSUFFICIENT_GAS); @@ -134,12 +135,12 @@ public abstract class AbstractExtCallOperation extends AbstractCallOperation { boolean accountCreation = contract == null && !zeroValue; long cost = - gasCalculator().memoryExpansionGasCost(frame, inputOffset, inputLength) - + (zeroValue ? 0 : gasCalculator().callValueTransferGasCost()) - + (frame.warmUpAddress(to) - ? gasCalculator().getWarmStorageReadCost() - : gasCalculator().getColdAccountAccessCost()) - + (accountCreation ? gasCalculator().newAccountGasCost() : 0); + gasCalculator.memoryExpansionGasCost(frame, inputOffset, inputLength) + + (zeroValue ? 0 : gasCalculator.callValueTransferGasCost()) + + (frame.warmUpAddress(to) || gasCalculator.isPrecompile(to) + ? gasCalculator.getWarmStorageReadCost() + : gasCalculator.getColdAccountAccessCost()) + + (accountCreation ? gasCalculator.newAccountGasCost() : 0); long currentGas = frame.getRemainingGas() - cost; if (currentGas < 0) { return new OperationResult(cost, ExceptionalHaltReason.INSUFFICIENT_GAS); @@ -163,14 +164,14 @@ public abstract class AbstractExtCallOperation extends AbstractCallOperation { return softFailure(frame, cost); } - long retainedGas = Math.max(currentGas / 64, gasCalculator().getMinRetainedGas()); + long retainedGas = Math.max(currentGas / 64, gasCalculator.getMinRetainedGas()); long childGas = currentGas - retainedGas; final Account account = frame.getWorldUpdater().get(frame.getRecipientAddress()); final Wei balance = (zeroValue || account == null) ? Wei.ZERO : account.getBalance(); // There myst be a minimum gas for a call to have access to. - if (childGas < gasCalculator().getMinCalleeGas()) { + if (childGas < gasCalculator.getMinCalleeGas()) { return softFailure(frame, cost); } // transferring value you don't have is not a halting exception, just a failure diff --git a/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java b/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java index c699063415..e1eb96f035 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java @@ -17,6 +17,7 @@ package org.hyperledger.besu.evm.operation; import org.hyperledger.besu.evm.Code; import org.hyperledger.besu.evm.EVM; import org.hyperledger.besu.evm.code.CodeSection; +import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.gascalculator.GasCalculator; import org.hyperledger.besu.evm.internal.ReturnStack; @@ -30,6 +31,9 @@ public class CallFOperation extends AbstractOperation { /** The Call F success. */ static final OperationResult callfSuccess = new OperationResult(5, null); + static final OperationResult callfStackOverflow = + new OperationResult(5, ExceptionalHaltReason.TOO_MANY_STACK_ITEMS); + /** * Instantiates a new Call F operation. * @@ -49,6 +53,11 @@ public class CallFOperation extends AbstractOperation { int pc = frame.getPC(); int section = code.readBigEndianU16(pc + 1); CodeSection info = code.getCodeSection(section); + int operandStackSize = frame.stackSize(); + if (operandStackSize >= 1024 + || operandStackSize > 1024 - info.getMaxStackHeight() + info.getInputs()) { + return callfStackOverflow; + } frame.getReturnStack().push(new ReturnStack.ReturnStackItem(frame.getSection(), pc + 2)); frame.setPC(info.getEntryPoint() - 1); // will be +1ed at end of operations loop frame.setSection(section); diff --git a/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java b/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java index a289c665d2..baf052ba4e 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java @@ -127,9 +127,7 @@ public class StandardJsonTracer implements OperationTracer { for (int i = messageFrame.stackSize() - 1; i >= 0; i--) { stack.add("\"" + shortBytes(messageFrame.getStackItem(i)) + "\""); } - pc = - messageFrame.getPC() - - messageFrame.getCode().getCodeSection(messageFrame.getSection()).getEntryPoint(); + pc = messageFrame.getPC() - messageFrame.getCode().getCodeSection(0).getEntryPoint(); section = messageFrame.getSection(); gas = shortNumber(messageFrame.getRemainingGas()); memorySize = messageFrame.memoryWordSize() * 32; diff --git a/evm/src/test/java/org/hyperledger/besu/evm/code/CodeFactoryTest.java b/evm/src/test/java/org/hyperledger/besu/evm/code/CodeFactoryTest.java index 6f60ab7865..ac27d3f21e 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/code/CodeFactoryTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/code/CodeFactoryTest.java @@ -594,26 +594,26 @@ class CodeFactoryTest { } private static void validCode(final String str) { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); Code code = evm.getCodeUncached(bytesFromPrettyPrint(str)); assertThat(code.isValid()).isTrue(); } private static void invalidCode(final String str, final String error) { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); Code code = evm.getCodeUncached(bytesFromPrettyPrint(str)); assertThat(code.isValid()).isFalse(); assertThat(((CodeInvalid) code).getInvalidReason()).contains(error); } private static void invalidCode(final String str) { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); Code code = evm.getCodeUncached(bytesFromPrettyPrint(str)); assertThat(code.isValid()).isFalse(); } private static void invalidCodeForCreation(final String str) { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); Code code = evm.getCodeForCreation(bytesFromPrettyPrint(str)); assertThat(code.isValid()).isFalse(); } diff --git a/evm/src/test/java/org/hyperledger/besu/evm/code/CodeV0Test.java b/evm/src/test/java/org/hyperledger/besu/evm/code/CodeV0Test.java index 3b16b1c923..54d457e628 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/code/CodeV0Test.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/code/CodeV0Test.java @@ -47,7 +47,7 @@ class CodeV0Test { @BeforeEach void startUp() { - evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); } @Test diff --git a/evm/src/test/java/org/hyperledger/besu/evm/fluent/EVMExecutorTest.java b/evm/src/test/java/org/hyperledger/besu/evm/fluent/EVMExecutorTest.java index aa9dcdb23f..eaa8dbc8c4 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/fluent/EVMExecutorTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/fluent/EVMExecutorTest.java @@ -131,9 +131,13 @@ class EVMExecutorTest { assertThat(cancunEOFEVM.getChainId()).contains(defaultChainId); EVMExecutor pragueEVM = - EVMExecutor.pragueEOF(defaultChainId.toBigInteger(), EvmConfiguration.DEFAULT); + EVMExecutor.prague(defaultChainId.toBigInteger(), EvmConfiguration.DEFAULT); assertThat(pragueEVM.getChainId()).contains(defaultChainId); + EVMExecutor osakaEVM = + EVMExecutor.osaka(defaultChainId.toBigInteger(), EvmConfiguration.DEFAULT); + assertThat(osakaEVM.getChainId()).contains(defaultChainId); + EVMExecutor futureEipsVM = EVMExecutor.futureEips(EvmConfiguration.DEFAULT); assertThat(futureEipsVM.getChainId()).contains(defaultChainId); } diff --git a/evm/src/test/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculatorTest.java b/evm/src/test/java/org/hyperledger/besu/evm/gascalculator/OsakaGasCalculatorTest.java similarity index 88% rename from evm/src/test/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculatorTest.java rename to evm/src/test/java/org/hyperledger/besu/evm/gascalculator/OsakaGasCalculatorTest.java index 46fe1dcba8..3236c13e83 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculatorTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/gascalculator/OsakaGasCalculatorTest.java @@ -20,11 +20,11 @@ import org.hyperledger.besu.datatypes.Address; import org.junit.jupiter.api.Test; -class PragueEOFGasCalculatorTest { +class OsakaGasCalculatorTest { @Test void testPrecompileSize() { - PragueEOFGasCalculator subject = new PragueEOFGasCalculator(); + OsakaGasCalculator subject = new OsakaGasCalculator(); assertThat(subject.isPrecompile(Address.precompiled(0x14))).isFalse(); assertThat(subject.isPrecompile(Address.BLS12_MAP_FP2_TO_G2)).isTrue(); } @@ -32,7 +32,7 @@ class PragueEOFGasCalculatorTest { @Test void testNewConstants() { CancunGasCalculator cancunGas = new CancunGasCalculator(); - PragueEOFGasCalculator praugeGasCalculator = new PragueEOFGasCalculator(); + OsakaGasCalculator praugeGasCalculator = new OsakaGasCalculator(); assertThat(praugeGasCalculator.getMinCalleeGas()).isGreaterThan(cancunGas.getMinCalleeGas()); assertThat(praugeGasCalculator.getMinRetainedGas()) diff --git a/evm/src/test/java/org/hyperledger/besu/evm/internal/CodeCacheTest.java b/evm/src/test/java/org/hyperledger/besu/evm/internal/CodeCacheTest.java index 7b8a74b0cd..cffd7ef5fa 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/internal/CodeCacheTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/internal/CodeCacheTest.java @@ -30,7 +30,7 @@ class CodeCacheTest { @Test void testScale() { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); final Bytes contractBytes = Bytes.fromHexString("0xDEAD" + op + "BEEF" + op + "B0B0" + op + "C0DE" + op + "FACE"); final CodeScale scale = new CodeScale(); diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/Create2OperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/Create2OperationTest.java index 4b2a5449ed..a70b09a60b 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/Create2OperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/Create2OperationTest.java @@ -56,7 +56,7 @@ public class Create2OperationTest { private MessageFrame messageFrame; private final WorldUpdater worldUpdater = mock(WorldUpdater.class); private final MutableAccount account = mock(MutableAccount.class); - private final EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + private final EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); private final MutableAccount newAccount = mock(MutableAccount.class); private final Create2Operation operation = diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/CreateOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/CreateOperationTest.java index 482df37fd6..697d87ef1e 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/CreateOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/CreateOperationTest.java @@ -219,7 +219,7 @@ class CreateOperationTest { @Test void eofV1CannotCall() { - final EVM pragueEvm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + final EVM pragueEvm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); final UInt256 memoryOffset = UInt256.fromHexString("0xFF"); final UInt256 memoryLength = UInt256.valueOf(SIMPLE_CREATE.size()); final MessageFrame messageFrame = @@ -248,7 +248,7 @@ class CreateOperationTest { final UInt256 memoryLength, final UInt256 value, final int depth) { - final EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + final EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); final MessageFrame messageFrame = MessageFrame.builder() .type(MessageFrame.Type.CONTRACT_CREATION) diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java index af5922aa07..aa2ed37b5c 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.params.provider.MethodSource; class DataCopyOperationTest { - static EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + static EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); static Collection datacopyTestVector() { return Arrays.asList( diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/EofCreateOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/EofCreateOperationTest.java index d5d1212dfb..5e9be62665 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/EofCreateOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/EofCreateOperationTest.java @@ -62,7 +62,7 @@ class EofCreateOperationTest { @Test void innerContractIsCorrect() { - final EVM evm = MainnetEVMs.cancunEOF(EvmConfiguration.DEFAULT); + final EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); Code code = evm.getCodeUncached(INNER_CONTRACT); assertThat(code.isValid()).isTrue(); @@ -92,7 +92,7 @@ class EofCreateOperationTest { @Test void eofCreatePassesInCallData() { Bytes outerContract = EOF_CREATE_CONTRACT; - final EVM evm = MainnetEVMs.cancunEOF(EvmConfiguration.DEFAULT); + final EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); Code code = evm.getCodeUncached(outerContract); if (!code.isValid()) { diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCallOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCallOperationTest.java index 93b1011501..ee974c15c5 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCallOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCallOperationTest.java @@ -27,7 +27,7 @@ import org.hyperledger.besu.evm.MainnetEVMs; import org.hyperledger.besu.evm.account.MutableAccount; import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; -import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator; +import org.hyperledger.besu.evm.gascalculator.OsakaGasCalculator; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @@ -44,7 +44,7 @@ public class ExtCallOperationTest { private final WorldUpdater worldUpdater = mock(WorldUpdater.class); private final MutableAccount account = mock(MutableAccount.class); - private static final EVM EOF_EVM = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + private static final EVM EOF_EVM = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); public static final Code LEGACY_CODE = EOF_EVM.getCodeUncached(Bytes.of(ExtCallOperation.OPCODE, 1)); public static final Code SIMPLE_EOF = @@ -115,7 +115,7 @@ public class ExtCallOperationTest { final Bytes stackItem, final boolean validCode, final boolean warmAddress) { - final ExtCallOperation operation = new ExtCallOperation(new PragueEOFGasCalculator()); + final ExtCallOperation operation = new ExtCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() @@ -206,7 +206,7 @@ public class ExtCallOperationTest { final Wei valueSent, final Wei valueWeiHave, final boolean isStatic) { - final ExtCallOperation operation = new ExtCallOperation(new PragueEOFGasCalculator()); + final ExtCallOperation operation = new ExtCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() @@ -242,7 +242,7 @@ public class ExtCallOperationTest { @Test void overflowTest() { - final ExtCallOperation operation = new ExtCallOperation(new PragueEOFGasCalculator()); + final ExtCallOperation operation = new ExtCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() @@ -281,7 +281,7 @@ public class ExtCallOperationTest { @Test void legacyTest() { - final ExtCallOperation operation = new ExtCallOperation(new PragueEOFGasCalculator()); + final ExtCallOperation operation = new ExtCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtDelegateCallOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtDelegateCallOperationTest.java index 62a10dcc2d..b08635748c 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtDelegateCallOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtDelegateCallOperationTest.java @@ -27,7 +27,7 @@ import org.hyperledger.besu.evm.MainnetEVMs; import org.hyperledger.besu.evm.account.MutableAccount; import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; -import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator; +import org.hyperledger.besu.evm.gascalculator.OsakaGasCalculator; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @@ -45,7 +45,7 @@ public class ExtDelegateCallOperationTest { private final WorldUpdater worldUpdater = mock(WorldUpdater.class); private final MutableAccount account = mock(MutableAccount.class); // private final MutableAccount targetAccount = mock(MutableAccount.class); - private static final EVM EOF_EVM = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + private static final EVM EOF_EVM = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); public static final Code LEGACY_CODE = EOF_EVM.getCodeUncached(Bytes.of(ExtDelegateCallOperation.OPCODE, 1)); public static final Code SIMPLE_EOF = @@ -119,7 +119,7 @@ public class ExtDelegateCallOperationTest { final boolean validCode, final boolean warmAddress) { final ExtDelegateCallOperation operation = - new ExtDelegateCallOperation(new PragueEOFGasCalculator()); + new ExtDelegateCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() @@ -180,7 +180,7 @@ public class ExtDelegateCallOperationTest { final ExceptionalHaltReason haltReason, final Bytes stackItem) { final ExtDelegateCallOperation operation = - new ExtDelegateCallOperation(new PragueEOFGasCalculator()); + new ExtDelegateCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() @@ -227,7 +227,7 @@ public class ExtDelegateCallOperationTest { @Test void overflowTest() { final ExtDelegateCallOperation operation = - new ExtDelegateCallOperation(new PragueEOFGasCalculator()); + new ExtDelegateCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() .initialGas(400000) @@ -265,7 +265,7 @@ public class ExtDelegateCallOperationTest { @Test void legacyTest() { final ExtDelegateCallOperation operation = - new ExtDelegateCallOperation(new PragueEOFGasCalculator()); + new ExtDelegateCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtStaticCallOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtStaticCallOperationTest.java index ed306e89c7..6b96b960cd 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtStaticCallOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/ExtStaticCallOperationTest.java @@ -27,7 +27,7 @@ import org.hyperledger.besu.evm.MainnetEVMs; import org.hyperledger.besu.evm.account.MutableAccount; import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; -import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator; +import org.hyperledger.besu.evm.gascalculator.OsakaGasCalculator; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @@ -44,7 +44,7 @@ public class ExtStaticCallOperationTest { private final WorldUpdater worldUpdater = mock(WorldUpdater.class); private final MutableAccount account = mock(MutableAccount.class); - private static final EVM EOF_EVM = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + private static final EVM EOF_EVM = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); public static final Code LEGACY_CODE = EOF_EVM.getCodeUncached(Bytes.of(ExtStaticCallOperation.OPCODE, 1)); public static final Code SIMPLE_EOF = @@ -115,8 +115,7 @@ public class ExtStaticCallOperationTest { final Bytes stackItem, final boolean validCode, final boolean warmAddress) { - final ExtStaticCallOperation operation = - new ExtStaticCallOperation(new PragueEOFGasCalculator()); + final ExtStaticCallOperation operation = new ExtStaticCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() @@ -152,8 +151,7 @@ public class ExtStaticCallOperationTest { @Test void overflowTest() { - final ExtStaticCallOperation operation = - new ExtStaticCallOperation(new PragueEOFGasCalculator()); + final ExtStaticCallOperation operation = new ExtStaticCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() .initialGas(400000) @@ -190,8 +188,7 @@ public class ExtStaticCallOperationTest { @Test void legacyTest() { - final ExtStaticCallOperation operation = - new ExtStaticCallOperation(new PragueEOFGasCalculator()); + final ExtStaticCallOperation operation = new ExtStaticCallOperation(new OsakaGasCalculator()); final var messageFrame = new TestMessageFrameBuilder() diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/JumpOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/JumpOperationTest.java index 7b9fab338e..c97c81b022 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/JumpOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/JumpOperationTest.java @@ -56,7 +56,7 @@ class JumpOperationTest { @BeforeEach void init() { - evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); } @Test diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/SelfDestructOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/SelfDestructOperationTest.java index d3a3db754b..8fbd4d142d 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/SelfDestructOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/SelfDestructOperationTest.java @@ -55,7 +55,7 @@ public class SelfDestructOperationTest { @Mock private WorldUpdater worldUpdater; @Mock private MutableAccount accountOriginator; @Mock private MutableAccount accountBeneficiary; - private final EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + private final EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); private final SelfDestructOperation frontierOperation = new SelfDestructOperation(new ConstantinopleGasCalculator()); diff --git a/evm/src/test/java/org/hyperledger/besu/evm/processor/ContractCreationProcessorTest.java b/evm/src/test/java/org/hyperledger/besu/evm/processor/ContractCreationProcessorTest.java index 3420df88dc..8b3d6ac51a 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/processor/ContractCreationProcessorTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/processor/ContractCreationProcessorTest.java @@ -45,7 +45,7 @@ import org.mockito.junit.jupiter.MockitoExtension; class ContractCreationProcessorTest extends AbstractMessageProcessorTest { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); private ContractCreationProcessor processor; diff --git a/evm/src/test/java/org/hyperledger/besu/evm/tracing/ExtendedOperationTracerTest.java b/evm/src/test/java/org/hyperledger/besu/evm/tracing/ExtendedOperationTracerTest.java index bd043f933b..90c6adff35 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/tracing/ExtendedOperationTracerTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/tracing/ExtendedOperationTracerTest.java @@ -55,7 +55,7 @@ class ExtendedOperationTracerTest { @Test void shouldCallTraceAccountCreationResultIfIsExtendedTracing() { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); final ContractCreationProcessor contractCreationProcessor = new ContractCreationProcessor(evm, false, Collections.emptyList(), 0); @@ -69,7 +69,7 @@ class ExtendedOperationTracerTest { @Test void shouldNotCallTraceAccountCreationResultIfIsNotExtendedTracing() { - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); final ContractCreationProcessor contractCreationProcessor = new ContractCreationProcessor(evm, false, Collections.emptyList(), 0); diff --git a/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/EofContainerSubCommand.java b/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/EofContainerSubCommand.java index 27c4547d26..9b4d6e2e64 100644 --- a/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/EofContainerSubCommand.java +++ b/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/EofContainerSubCommand.java @@ -119,7 +119,7 @@ public class EofContainerSubCommand implements Runnable { .constructParametricType(Map.class, String.class, EOFTestCaseSpec.class); List fuzzingClients = new ArrayList<>(); - EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + EVM evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); long validContainers; long totalContainers; diff --git a/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/InternalClient.java b/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/InternalClient.java index a6d7035fe8..5d2adb8e91 100644 --- a/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/InternalClient.java +++ b/testfuzz/src/main/java/org/hyperledger/besu/testfuzz/InternalClient.java @@ -31,7 +31,7 @@ class InternalClient implements FuzzingClient { public InternalClient(final String clientName) { this.name = clientName; - this.evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT); + this.evm = MainnetEVMs.osaka(EvmConfiguration.DEFAULT); } @Override