Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move EOF to the Osaka Fork #7719

Merged
merged 8 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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 <danno@numisight.com>
  • Loading branch information
shemnon committed Oct 10, 2024
commit 25c0fcf8974b7c3192893b25d60dd9ffc3988902
3 changes: 1 addition & 2 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1405,9 +1405,8 @@ private void configureNativeLibs() {
}

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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,6 @@ default boolean isConsensusMigration() {
*/
OptionalLong getCancunTime();

/**
* Gets cancun EOF time.
*
* @return the cancun EOF time
*/
OptionalLong getCancunEOFTime();

/**
* Gets prague time.
*
Expand All @@ -257,11 +250,11 @@ default boolean isConsensusMigration() {
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,6 @@ public OptionalLong getShanghaiTime() {
return getOptionalLong("shanghaitime");
}

@Override
public OptionalLong getCancunEOFTime() {
return getOptionalLong("cancuneoftime");
}

@Override
public OptionalLong getCancunTime() {
return getOptionalLong("cancuntime");
Expand All @@ -308,8 +303,8 @@ public OptionalLong getPragueTime() {
}

@Override
public OptionalLong getPragueEOFTime() {
return getOptionalLong("pragueeoftime");
public OptionalLong getOsakaTime() {
return getOptionalLong("osakatime");
}

@Override
Expand Down Expand Up @@ -484,9 +479,8 @@ public Map<String, Object> asMap() {
getMergeNetSplitBlockNumber().ifPresent(l -> builder.put("mergeNetSplitBlock", l));
getShanghaiTime().ifPresent(l -> builder.put("shanghaiTime", l));
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));
Expand Down Expand Up @@ -638,9 +632,8 @@ public List<Long> getForkBlockTimestamps() {
Stream.of(
getShanghaiTime(),
getCancunTime(),
getCancunEOFTime(),
getPragueTime(),
getPragueEOFTime(),
getOsakaTime(),
getFutureEipsTime(),
getExperimentalEipsTime());
// when adding forks add an entry to ${REPO_ROOT}/config/src/test/resources/all_forks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
private OptionalLong mergeNetSplitBlockNumber = OptionalLong.empty();
private OptionalLong shanghaiTime = OptionalLong.empty();
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();
Expand Down Expand Up @@ -241,19 +240,14 @@ public OptionalLong getCancunTime() {
return cancunTime;
}

@Override
public OptionalLong getCancunEOFTime() {
return cancunEOFTime;
}

@Override
public OptionalLong getPragueTime() {
return pragueTime;
}

@Override
public OptionalLong getPragueEOFTime() {
return pragueEOFTime;
public OptionalLong getOsakaTime() {
return osakaTime;
}

@Override
Expand Down Expand Up @@ -648,17 +642,6 @@ public StubGenesisConfigOptions cancunTime(final long timestamp) {
return this;
}

/**
* Cancun EOF time.
*
* @param timestamp the timestamp
* @return the stub genesis config options
*/
public StubGenesisConfigOptions cancunEOFTime(final long timestamp) {
cancunEOFTime = OptionalLong.of(timestamp);
return this;
}

/**
* Prague time.
*
Expand All @@ -671,14 +654,13 @@ public StubGenesisConfigOptions pragueTime(final long timestamp) {
}

/**
* 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,16 @@ void shouldGetCancunTime() {
assertThat(config.getCancunTime()).hasValue(1670470142);
}

@Test
void shouldGetCancunEOFTime() {
final GenesisConfigOptions config =
fromConfigOptions(singletonMap("cancunEOFTime", 1670470142));
assertThat(config.getCancunEOFTime()).hasValue(1670470142);
}

@Test
void shouldGetPragueTime() {
final GenesisConfigOptions config = fromConfigOptions(singletonMap("pragueTime", 1670470143));
assertThat(config.getPragueTime()).hasValue(1670470143);
}

@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
Expand Down Expand Up @@ -245,9 +237,8 @@ void shouldNotReturnEmptyOptionalWhenBlockNumberNotSpecified() {
assertThat(config.getMergeNetSplitBlockNumber()).isEmpty();
assertThat(config.getShanghaiTime()).isEmpty();
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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,8 @@ enum MainnetHardforkId implements HardforkId {
SHANGHAI(true, "Shanghai"),
/** Cancun fork. */
CANCUN(true, "Cancun"),
/** Cancun + EOF fork. */
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. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,29 +304,21 @@ private static boolean isCancunAtGenesis(final GenesisConfigFile genesis) {
if (cancunTimestamp.isPresent()) {
return genesis.getTimestamp() >= cancunTimestamp.getAsLong();
}
return isPragueAtGenesis(genesis) || isCancunEOFAtGenesis(genesis);
}

private static boolean isCancunEOFAtGenesis(final GenesisConfigFile genesis) {
final OptionalLong cancunEOFTimestamp = genesis.getConfigOptions().getCancunEOFTime();
if (cancunEOFTimestamp.isPresent()) {
return genesis.getTimestamp() >= cancunEOFTimestamp.getAsLong();
}
return isPragueEOFAtGenesis(genesis);
return isPragueAtGenesis(genesis) || isOsakaAtGenesis(genesis);
}

private static boolean isPragueAtGenesis(final GenesisConfigFile genesis) {
final OptionalLong pragueTimestamp = genesis.getConfigOptions().getPragueTime();
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,6 @@ public ProtocolSpecBuilder cancunDefinition(final GenesisConfigOptions genesisCo
metricsSystem);
}

public ProtocolSpecBuilder cancunEOFDefinition(final GenesisConfigOptions genesisConfigOptions) {
return MainnetProtocolSpecs.cancunEOFDefinition(
chainId,
isRevertReasonEnabled,
genesisConfigOptions,
evmConfiguration,
miningParameters,
isParallelTxProcessingEnabled,
metricsSystem);
}

public ProtocolSpecBuilder pragueDefinition(final GenesisConfigOptions genesisConfigOptions) {
return MainnetProtocolSpecs.pragueDefinition(
chainId,
Expand All @@ -224,8 +213,8 @@ public ProtocolSpecBuilder pragueDefinition(final GenesisConfigOptions genesisCo
metricsSystem);
}

public ProtocolSpecBuilder pragueEOFDefinition(final GenesisConfigOptions genesisConfigOptions) {
return MainnetProtocolSpecs.pragueEOFDefinition(
public ProtocolSpecBuilder osakaDefinition(final GenesisConfigOptions genesisConfigOptions) {
return MainnetProtocolSpecs.osakaDefinition(
chainId,
isRevertReasonEnabled,
genesisConfigOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
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;
Expand Down Expand Up @@ -736,27 +736,6 @@ static ProtocolSpecBuilder cancunDefinition(
.name("Cancun");
}

static ProtocolSpecBuilder cancunEOFDefinition(
final Optional<BigInteger> chainId,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
final EvmConfiguration evmConfiguration,
final MiningParameters miningParameters,
final boolean isParallelTxProcessingEnabled,
final MetricsSystem metricsSystem) {

ProtocolSpecBuilder protocolSpecBuilder =
cancunDefinition(
chainId,
enableRevertReason,
genesisConfigOptions,
evmConfiguration,
miningParameters,
isParallelTxProcessingEnabled,
metricsSystem);
return addEOF(chainId, evmConfiguration, protocolSpecBuilder).name("CancunEOF");
}

static ProtocolSpecBuilder pragueDefinition(
final Optional<BigInteger> chainId,
final boolean enableRevertReason,
Expand Down Expand Up @@ -815,7 +794,7 @@ static ProtocolSpecBuilder pragueDefinition(
.name("Prague");
}

static ProtocolSpecBuilder pragueEOFDefinition(
static ProtocolSpecBuilder osakaDefinition(
final Optional<BigInteger> chainId,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
Expand All @@ -833,21 +812,13 @@ static ProtocolSpecBuilder pragueEOFDefinition(
miningParameters,
isParallelTxProcessingEnabled,
metricsSystem);
return addEOF(chainId, evmConfiguration, protocolSpecBuilder).name("PragueEOF");
}

private static ProtocolSpecBuilder addEOF(
final Optional<BigInteger> chainId,
final EvmConfiguration evmConfiguration,
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 ->
Expand All @@ -856,7 +827,8 @@ private static ProtocolSpecBuilder addEOF(
true,
List.of(MaxCodeSizeRule.from(evm), EOFValidationCodeRule.from(evm)),
1,
SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES));
SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES))
.name("Osaka");
}

static ProtocolSpecBuilder futureEipsDefinition(
Expand All @@ -867,7 +839,7 @@ static ProtocolSpecBuilder futureEipsDefinition(
final MiningParameters miningParameters,
final boolean isParallelTxProcessingEnabled,
final MetricsSystem metricsSystem) {
return pragueEOFDefinition(
return osakaDefinition(
chainId,
enableRevertReason,
genesisConfigOptions,
Expand Down
Loading