Add PragueEOF fork

Add the "PragueEOF" fork which is prague+EOF. For genesis and evmtool
trace, the Prague fork is just prague. To use EOF for networks and CLI
traces use the 'PragueEOF' fork. For reverence tests the "Prague" fork
maps to "PrageEOF" because reference tests currently have EOF tests
wired into Prague.

Signed-off-by: Danno Ferrin <danno@numisight.com>
mega-eof
Danno Ferrin 6 months ago
parent 0efc449590
commit 7d3e0c02b6
  1. 3
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  2. 7
      config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java
  3. 7
      config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java
  4. 21
      config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java
  5. 8
      config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java
  6. 8
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java
  7. 11
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java
  8. 76
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java
  9. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java
  10. 2
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EOFTestSubCommand.java
  11. 3
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java
  12. 7
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java
  13. 2
      ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json
  14. 2
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java
  15. 4
      evm/src/main/java/org/hyperledger/besu/evm/EvmSpecVersion.java
  16. 71
      evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java
  17. 16
      evm/src/main/java/org/hyperledger/besu/evm/fluent/EVMExecutor.java
  18. 47
      evm/src/main/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculator.java
  19. 8
      evm/src/test/java/org/hyperledger/besu/evm/code/CodeV1Test.java
  20. 2
      evm/src/test/java/org/hyperledger/besu/evm/fluent/EVMExecutorTest.java
  21. 21
      evm/src/test/java/org/hyperledger/besu/evm/gascalculator/PragueEOFGasCalculatorTest.java
  22. 4
      evm/src/test/java/org/hyperledger/besu/evm/operations/EofCreateOperationTest.java

@ -1504,7 +1504,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
}
if (genesisConfigOptionsSupplier.get().getCancunTime().isPresent()
|| genesisConfigOptionsSupplier.get().getPragueTime().isPresent()) {
|| genesisConfigOptionsSupplier.get().getPragueTime().isPresent()
|| genesisConfigOptionsSupplier.get().getPragueEOFTime().isPresent()) {
if (kzgTrustedSetupFile != null) {
KZGPointEvalPrecompiledContract.init(kzgTrustedSetupFile);
} else {

@ -249,6 +249,13 @@ public interface GenesisConfigOptions {
*/
OptionalLong getPragueTime();
/**
* Gets Prague EOF time.
*
* @return the prague time
*/
OptionalLong getPragueEOFTime();
/**
* Gets future eips time.
*

@ -298,6 +298,11 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
return getOptionalLong("praguetime");
}
@Override
public OptionalLong getPragueEOFTime() {
return getOptionalLong("pragueeoftime");
}
@Override
public OptionalLong getFutureEipsTime() {
return getOptionalLong("futureeipstime");
@ -457,6 +462,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
getShanghaiTime().ifPresent(l -> builder.put("shanghaiTime", l));
getCancunTime().ifPresent(l -> builder.put("cancunTime", l));
getPragueTime().ifPresent(l -> builder.put("pragueTime", l));
getPragueEOFTime().ifPresent(l -> builder.put("pragueEOFTime", l));
getTerminalBlockNumber().ifPresent(l -> builder.put("terminalBlockNumber", l));
getTerminalBlockHash().ifPresent(h -> builder.put("terminalBlockHash", h.toHexString()));
getFutureEipsTime().ifPresent(l -> builder.put("futureEipsTime", l));
@ -605,6 +611,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
getShanghaiTime(),
getCancunTime(),
getPragueTime(),
getPragueEOFTime(),
getFutureEipsTime(),
getExperimentalEipsTime());
// when adding forks add an entry to ${REPO_ROOT}/config/src/test/resources/all_forks.json

@ -49,6 +49,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
private OptionalLong shanghaiTime = OptionalLong.empty();
private OptionalLong cancunTime = OptionalLong.empty();
private OptionalLong pragueTime = OptionalLong.empty();
private OptionalLong pragueEOFTime = OptionalLong.empty();
private OptionalLong futureEipsTime = OptionalLong.empty();
private OptionalLong experimentalEipsTime = OptionalLong.empty();
private OptionalLong terminalBlockNumber = OptionalLong.empty();
@ -80,9 +81,6 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
private boolean zeroBaseFee = false;
private boolean fixedBaseFee = false;
/** Default constructor. */
public StubGenesisConfigOptions() {}
@Override
public StubGenesisConfigOptions clone() {
try {
@ -242,6 +240,11 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
return pragueTime;
}
@Override
public OptionalLong getPragueEOFTime() {
return pragueEOFTime;
}
@Override
public OptionalLong getFutureEipsTime() {
return futureEipsTime;
@ -635,6 +638,18 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
return this;
}
/**
* PragueEOF time.
*
* @param timestamp the timestamp
* @return the stub genesis config options
*/
public StubGenesisConfigOptions pragueEOFTime(final long timestamp) {
pragueTime = OptionalLong.of(timestamp);
pragueEOFTime = pragueTime;
return this;
}
/**
* Future EIPs Time block.
*

@ -199,6 +199,13 @@ class GenesisConfigOptionsTest {
assertThat(config.getPragueTime()).hasValue(1670470143);
}
@Test
void shouldGetPragueEOFTime() {
final GenesisConfigOptions config =
fromConfigOptions(singletonMap("pragueEOFTime", 1670470143));
assertThat(config.getPragueEOFTime()).hasValue(1670470143);
}
@Test
void shouldGetFutureEipsTime() {
final GenesisConfigOptions config = fromConfigOptions(singletonMap("futureEipsTime", 1337));
@ -232,6 +239,7 @@ class GenesisConfigOptionsTest {
assertThat(config.getShanghaiTime()).isEmpty();
assertThat(config.getCancunTime()).isEmpty();
assertThat(config.getPragueTime()).isEmpty();
assertThat(config.getPragueEOFTime()).isEmpty();
assertThat(config.getFutureEipsTime()).isEmpty();
assertThat(config.getExperimentalEipsTime()).isEmpty();
}

@ -319,6 +319,14 @@ public final class GenesisState {
if (pragueTimestamp.isPresent()) {
return genesis.getTimestamp() >= pragueTimestamp.getAsLong();
}
return isPragueEOFAtGenesis(genesis);
}
private static boolean isPragueEOFAtGenesis(final GenesisConfigFile genesis) {
final OptionalLong pragueEOFTimestamp = genesis.getConfigOptions().getPragueEOFTime();
if (pragueEOFTimestamp.isPresent()) {
return genesis.getTimestamp() >= pragueEOFTimestamp.getAsLong();
}
return isFutureEipsTimeAtGenesis(genesis);
}

@ -189,6 +189,17 @@ public class MainnetProtocolSpecFactory {
miningParameters);
}
public ProtocolSpecBuilder pragueEOFDefinition(final GenesisConfigOptions genesisConfigOptions) {
return MainnetProtocolSpecs.pragueEOFDefinition(
chainId,
contractSizeLimit,
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
evmConfiguration,
miningParameters);
}
/**
* The "future" fork consists of EIPs that have been approved for Ethereum Mainnet but not
* scheduled for a fork. This is also known as "Eligible For Inclusion" (EFI) or "Considered for

@ -58,6 +58,7 @@ 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.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;
@ -735,9 +736,6 @@ public abstract class MainnetProtocolSpecs {
final GenesisConfigOptions genesisConfigOptions,
final EvmConfiguration evmConfiguration,
final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
final Address depositContractAddress =
genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS);
@ -750,13 +748,54 @@ public abstract class MainnetProtocolSpecs {
genesisConfigOptions,
evmConfiguration,
miningParameters)
// EVM changes to support EOF EIPs (3670, 4200, 4750, 5450)
// EIP-3074 AUTH and AUTCALL gas
.gasCalculator(PragueGasCalculator::new)
// EIP-3074 AUTH and AUTCALL
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.prague(
gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration))
// change contract call creator to accept EOF code
// EIP-2537 BLS12-381 precompiles
.precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::prague)
// EIP-7002 Withdrawls / EIP-6610 Deposits / EIP-7685 Requests
.requestsValidator(pragueRequestsValidator(depositContractAddress))
// EIP-7002 Withdrawls / EIP-6610 Deposits / EIP-7685 Requests
.requestProcessorCoordinator(pragueRequestsProcessors(depositContractAddress))
// EIP-2935 Blockhash processor
.blockHashProcessor(new PragueBlockHashProcessor())
.name("Prague");
}
static ProtocolSpecBuilder pragueEOFDefinition(
final Optional<BigInteger> chainId,
final OptionalInt configContractSizeLimit,
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
final EvmConfiguration evmConfiguration,
final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
return pragueDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
evmConfiguration,
miningParameters)
// EIP-7692 EOF v1 Gas calculator
.gasCalculator(PragueEOFGasCalculator::new)
// EIP-7692 EOF v1 EVM and opcodes
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.pragueEOF(
gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration))
// EIP-7698 EOF v1 creation transaction
.contractCreationProcessorBuilder(
(gasCalculator, evm) ->
new ContractCreationProcessor(
@ -766,30 +805,7 @@ public abstract class MainnetProtocolSpecs {
List.of(MaxCodeSizeRule.of(contractSizeLimit), EOFValidationCodeRule.of(1)),
1,
SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES))
// warm blockahsh contract
.transactionProcessorBuilder(
(gasCalculator,
feeMarket,
transactionValidator,
contractCreationProcessor,
messageCallProcessor) ->
new MainnetTransactionProcessor(
gasCalculator,
transactionValidator,
contractCreationProcessor,
messageCallProcessor,
true,
true,
stackSizeLimit,
feeMarket,
CoinbaseFeePriceCalculator.eip1559()))
// use prague precompiled contracts
.precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::prague)
.requestsValidator(pragueRequestsValidator(depositContractAddress))
.requestProcessorCoordinator(pragueRequestsProcessors(depositContractAddress))
.blockHashProcessor(new PragueBlockHashProcessor())
.name("Prague");
.name("PragueEOF");
}
static ProtocolSpecBuilder futureEipsDefinition(
@ -802,7 +818,7 @@ public abstract class MainnetProtocolSpecs {
final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
return pragueDefinition(
return pragueEOFDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,

@ -252,6 +252,7 @@ public class ProtocolScheduleBuilder {
lastForkBlock = validateForkOrder("Shanghai", config.getShanghaiTime(), lastForkBlock);
lastForkBlock = validateForkOrder("Cancun", config.getCancunTime(), lastForkBlock);
lastForkBlock = validateForkOrder("Prague", config.getPragueTime(), lastForkBlock);
lastForkBlock = validateForkOrder("PragueEOF", config.getPragueEOFTime(), lastForkBlock);
lastForkBlock = validateForkOrder("FutureEips", config.getFutureEipsTime(), lastForkBlock);
lastForkBlock =
validateForkOrder("ExperimentalEips", config.getExperimentalEipsTime(), lastForkBlock);
@ -331,6 +332,7 @@ public class ProtocolScheduleBuilder {
timestampMilestone(config.getShanghaiTime(), specFactory.shanghaiDefinition(config)),
timestampMilestone(config.getCancunTime(), specFactory.cancunDefinition(config)),
timestampMilestone(config.getPragueTime(), specFactory.pragueDefinition(config)),
timestampMilestone(config.getPragueEOFTime(), specFactory.pragueEOFDefinition(config)),
timestampMilestone(config.getFutureEipsTime(), specFactory.futureEipsDefinition(config)),
timestampMilestone(
config.getExperimentalEipsTime(), specFactory.experimentalEipsDefinition(config)),

@ -165,7 +165,7 @@ public class EOFTestSubCommand implements Runnable {
continue;
}
TestResult actualResult;
if (evmVersion.ordinal() < EvmSpecVersion.PRAGUE.ordinal()) {
if (evmVersion.ordinal() < EvmSpecVersion.PRAGUE_EOF.ordinal()) {
actualResult = failed("EOF_InvalidCode");
} else {
actualResult = considerCode(code);

@ -116,6 +116,9 @@ class MainnetGenesisFileModule extends GenesisFileModule {
Map.entry(
"prague",
createSchedule(new StubGenesisConfigOptions().pragueTime(0).baseFeePerGas(0x0a))),
Map.entry(
"pragueeof",
createSchedule(new StubGenesisConfigOptions().pragueEOFTime(0).baseFeePerGas(0x0a))),
Map.entry(
"futureeips",
createSchedule(new StubGenesisConfigOptions().futureEipsTime(0).baseFeePerGas(0x0a))),

@ -31,6 +31,7 @@ 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.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;
@ -131,6 +132,8 @@ public abstract class BenchmarkExecutor {
return switch (EvmSpecVersion.valueOf(fork.toUpperCase(Locale.ROOT))) {
case HOMESTEAD -> new HomesteadGasCalculator();
case FRONTIER -> new FrontierGasCalculator();
case TANGERINE_WHISTLE -> null;
case SPURIOUS_DRAGON -> null;
case BYZANTIUM -> new ByzantiumGasCalculator();
case CONSTANTINOPLE -> new ConstantinopleGasCalculator();
case PETERSBURG -> new PetersburgGasCalculator();
@ -139,7 +142,9 @@ public abstract class BenchmarkExecutor {
case LONDON, PARIS -> new LondonGasCalculator();
case SHANGHAI -> new ShanghaiGasCalculator();
case CANCUN -> new CancunGasCalculator();
default -> new PragueGasCalculator();
case PRAGUE -> new PragueGasCalculator();
case PRAGUE_EOF, OSAKA, AMSTERDAM, BOGOTA, POLIS, BANGKOK, FUTURE_EIPS, EXPERIMENTAL_EIPS ->
new PragueEOFGasCalculator();
};
}

@ -8,7 +8,7 @@
"--coinbase",
"4444588443C3A91288C5002483449ABA1054192B",
"--fork",
"prague"
"pragueeof"
],
"stdin": "",
"stdout": [

@ -86,7 +86,7 @@ public class ReferenceTestProtocolSchedules {
builder.put(
"CancunToPragueAtTime15k",
createSchedule(genesisStub.clone().cancunTime(0).pragueTime(15000)));
builder.put("Prague", createSchedule(genesisStub.clone().pragueTime(0)));
builder.put("Prague", createSchedule(genesisStub.clone().pragueEOFTime(0)));
builder.put("Future_EIPs", createSchedule(genesisStub.clone().futureEipsTime(0)));
builder.put("Experimental_EIPs", createSchedule(genesisStub.clone().experimentalEipsTime(0)));
return new ReferenceTestProtocolSchedules(builder.build());

@ -49,7 +49,9 @@ public enum EvmSpecVersion {
/** Cancun evm spec version. */
CANCUN(0, true, "Cancun", "Finalized"),
/** Prague evm spec version. */
PRAGUE(1, false, "Prague", "In Development"),
PRAGUE(0, false, "Prague", "In Development"),
/** PragueEOF evm spec version. */
PRAGUE_EOF(1, false, "PragueEOF", "Prague + EOF. In Development"),
/** Osaka evm spec version. */
OSAKA(1, false, "Osaka", "Placeholder"),
/** Amstedam evm spec version. */

@ -24,6 +24,7 @@ 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.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;
@ -968,6 +969,74 @@ public class MainnetEVMs {
// EIP-3074 AUTH and AUTHCALL
registry.put(new AuthOperation(gasCalculator));
registry.put(new AuthCallOperation(gasCalculator));
}
/**
* PragueEOF evm.
*
* @param evmConfiguration the evm configuration
* @return the evm
*/
public static EVM pragueEOF(final EvmConfiguration evmConfiguration) {
return pragueEOF(DEV_NET_CHAIN_ID, evmConfiguration);
}
/**
* PragueEOF 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);
}
/**
* PragueEOF evm.
*
* @param gasCalculator the gas calculator
* @param chainId the chain id
* @param evmConfiguration the evm configuration
* @return the evm
*/
public static EVM pragueEOF(
final GasCalculator gasCalculator,
final BigInteger chainId,
final EvmConfiguration evmConfiguration) {
return new EVM(
pragueEOFOperations(gasCalculator, chainId),
gasCalculator,
evmConfiguration,
EvmSpecVersion.PRAGUE_EOF);
}
/**
* Operation registry for PragueEOF's operations.
*
* @param gasCalculator the gas calculator
* @param chainId the chain id
* @return the operation registry
*/
public static OperationRegistry pragueEOFOperations(
final GasCalculator gasCalculator, final BigInteger chainId) {
OperationRegistry operationRegistry = new OperationRegistry();
registerPragueEOFOperations(operationRegistry, gasCalculator, chainId);
return operationRegistry;
}
/**
* Register PragueEOF's operations.
*
* @param registry the registry
* @param gasCalculator the gas calculator
* @param chainID the chain id
*/
public static void registerPragueEOFOperations(
final OperationRegistry registry,
final GasCalculator gasCalculator,
final BigInteger chainID) {
registerPragueOperations(registry, gasCalculator, chainID);
// EIP-663 Unlimited Swap and Dup
registry.put(new DupNOperation(gasCalculator));
@ -1068,7 +1137,7 @@ public class MainnetEVMs {
final OperationRegistry registry,
final GasCalculator gasCalculator,
final BigInteger chainID) {
registerPragueOperations(registry, gasCalculator, chainID);
registerPragueEOFOperations(registry, gasCalculator, chainID);
}
/**

@ -161,6 +161,7 @@ public class EVMExecutor {
case SHANGHAI -> shanghai(chainId, evmConfiguration);
case CANCUN -> cancun(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);
@ -506,6 +507,21 @@ public class EVMExecutor {
return executor;
}
/**
* Instantiate Osaka 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.
*

@ -0,0 +1,47 @@
/*
* Copyright contributors to Hyperledger Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.gascalculator;
import static org.hyperledger.besu.datatypes.Address.BLS12_MAP_FP2_TO_G2;
/**
* Gas Calculator for Prague
*
* <p>Placeholder for new gas schedule items. If Prague finalzies without changes this can be
* removed
*
* <UL>
* <LI>TBD
* </UL>
*/
public class PragueEOFGasCalculator extends PragueGasCalculator {
/** Instantiates a new Prague Gas Calculator. */
public PragueEOFGasCalculator() {
this(BLS12_MAP_FP2_TO_G2.toArrayUnsafe()[19]);
}
/**
* Instantiates a new Prague Gas Calculator
*
* @param maxPrecompile the max precompile
*/
protected PragueEOFGasCalculator(final int maxPrecompile) {
super(maxPrecompile);
}
// EXTCALL costing will show up here...
}

@ -25,7 +25,6 @@ import java.util.stream.IntStream;
import java.util.stream.Stream;
import org.apache.tuweni.bytes.Bytes;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@ -364,9 +363,8 @@ class CodeV1Test {
@ParameterizedTest
@ValueSource(strings = {"e5", "e500"})
@Disabled("Out of Shahghai, will likely return in Cancun or Prague")
void testJumpCallFTruncated(final String code) {
assertValidation("Truncated CALLF", code);
assertValidation("Truncated JUMPF", code);
}
@ParameterizedTest
@ -377,9 +375,8 @@ class CodeV1Test {
@ParameterizedTest
@ValueSource(strings = {"e50004", "e503ff", "e5ffff"})
@Disabled("Out of Shahghai, will likely return in Cancun or Prague")
void testJumpFWrongSection(final String code) {
assertValidation("CALLF to non-existent section -", code, false, 3);
assertValidation("JUMPF to non-existent section -", code, false, 3);
}
@ParameterizedTest
@ -396,7 +393,6 @@ class CodeV1Test {
@ParameterizedTest
@ValueSource(strings = {"e50001", "e50002", "e50000"})
@Disabled("Out of Shahghai, will likely return in Cancun or Prague")
void testJumpFValid(final String code) {
assertValidation(null, code, false, 3);
}

@ -128,7 +128,7 @@ class EVMExecutorTest {
assertThat(cancunEVM.getChainId()).contains(defaultChainId);
EVMExecutor pragueEVM =
EVMExecutor.prague(defaultChainId.toBigInteger(), EvmConfiguration.DEFAULT);
EVMExecutor.pragueEOF(defaultChainId.toBigInteger(), EvmConfiguration.DEFAULT);
assertThat(pragueEVM.getChainId()).contains(defaultChainId);
EVMExecutor futureEipsVM = EVMExecutor.futureEips(EvmConfiguration.DEFAULT);

@ -0,0 +1,21 @@
/*
* Copyright contributors to Hyperledger Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.gascalculator;
public class PragueEOFGasCalculatorTest {
// EXTCALL tests will show up here...
}

@ -78,7 +78,7 @@ class EofCreateOperationTest {
when(newAccount.isStorageEmpty()).thenReturn(true);
when(worldUpdater.updater()).thenReturn(worldUpdater);
final EVM evm = MainnetEVMs.prague(EvmConfiguration.DEFAULT);
final EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT);
final MessageFrame createFrame = messageFrame.getMessageFrameStack().peek();
assertThat(createFrame).isNotNull();
final ContractCreationProcessor ccp =
@ -112,7 +112,7 @@ class EofCreateOperationTest {
when(newAccount.isStorageEmpty()).thenReturn(true);
when(worldUpdater.updater()).thenReturn(worldUpdater);
final EVM evm = MainnetEVMs.prague(EvmConfiguration.DEFAULT);
final EVM evm = MainnetEVMs.pragueEOF(EvmConfiguration.DEFAULT);
var precompiles = MainnetPrecompiledContracts.prague(evm.getGasCalculator());
final MessageFrame createFrame = messageFrame.getMessageFrameStack().peek();
assertThat(createFrame).isNotNull();

Loading…
Cancel
Save