diff --git a/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java
index 88a675d4f10..7b13a211a70 100644
--- a/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java
+++ b/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java
@@ -130,6 +130,7 @@ protected ProtocolSchedule createProtocolSchedule() {
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
diff --git a/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java
index c4a412e4dc8..6ab517efd6c 100644
--- a/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java
+++ b/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java
@@ -286,6 +286,7 @@ protected ProtocolSchedule createProtocolSchedule() {
isRevertReasonEnabled,
bftExtraDataCodec().get(),
evmConfiguration,
+ miningParameters,
badBlockManager);
}
diff --git a/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java
index fc258583092..4c2e0ee47a3 100644
--- a/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java
+++ b/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java
@@ -95,6 +95,7 @@ protected ProtocolSchedule createProtocolSchedule() {
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
diff --git a/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java
index 62bce6ac69b..623aa2918f5 100644
--- a/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java
+++ b/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java
@@ -173,7 +173,11 @@ protected MiningCoordinator createTransitionMiningCoordinator(
@Override
protected ProtocolSchedule createProtocolSchedule() {
return MergeProtocolSchedule.create(
- configOptionsSupplier.get(), privacyParameters, isRevertReasonEnabled, badBlockManager);
+ configOptionsSupplier.get(),
+ privacyParameters,
+ isRevertReasonEnabled,
+ miningParameters,
+ badBlockManager);
}
@Override
diff --git a/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
index a622001ef89..747949aac12 100644
--- a/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
+++ b/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
@@ -326,6 +326,7 @@ protected ProtocolSchedule createProtocolSchedule() {
isRevertReasonEnabled,
bftExtraDataCodec().get(),
evmConfiguration,
+ miningParameters,
badBlockManager);
}
diff --git a/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java b/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java
index ea82011bb53..bd396228ade 100644
--- a/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java
+++ b/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java
@@ -33,6 +33,7 @@
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.forkid.ForkId;
import org.hyperledger.besu.ethereum.forkid.ForkIdManager;
import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule;
@@ -188,11 +189,13 @@ private static MilestoneStreamingTransitionProtocolSchedule createSchedule(
MilestoneStreamingProtocolSchedule preMergeProtocolSchedule =
new MilestoneStreamingProtocolSchedule(
(DefaultProtocolSchedule)
- MainnetProtocolSchedule.fromConfig(configOptions, new BadBlockManager()));
+ MainnetProtocolSchedule.fromConfig(
+ configOptions, MiningParameters.MINING_DISABLED, new BadBlockManager()));
MilestoneStreamingProtocolSchedule postMergeProtocolSchedule =
new MilestoneStreamingProtocolSchedule(
(DefaultProtocolSchedule)
- MergeProtocolSchedule.create(configOptions, false, new BadBlockManager()));
+ MergeProtocolSchedule.create(
+ configOptions, false, MiningParameters.MINING_DISABLED, new BadBlockManager()));
final MilestoneStreamingTransitionProtocolSchedule schedule =
new MilestoneStreamingTransitionProtocolSchedule(
preMergeProtocolSchedule, postMergeProtocolSchedule);
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 e3c935eca69..1645688f098 100644
--- a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java
+++ b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java
@@ -504,6 +504,13 @@ default boolean isConsensusMigration() {
*/
boolean isZeroBaseFee();
+ /**
+ * Force a Base Fee as Gas Price network to used with London/EIP-1559.
+ *
+ * @return true, if you want the next block to use the base fee as gas price.
+ */
+ boolean isFixedBaseFee();
+
/**
* The deposit contract address that should be in the logger field in Receipt of Deposit
* transaction
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 d2ce8401fc6..5c1a2037017 100644
--- a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java
+++ b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java
@@ -47,6 +47,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
private static final String DISCOVERY_CONFIG_KEY = "discovery";
private static final String CHECKPOINT_CONFIG_KEY = "checkpoint";
private static final String ZERO_BASE_FEE_KEY = "zerobasefee";
+ private static final String FIXED_BASE_FEE_KEY = "fixedbasefee";
private static final String DEPOSIT_CONTRACT_ADDRESS_KEY = "depositcontractaddress";
private final ObjectNode configRoot;
@@ -421,6 +422,11 @@ public boolean isZeroBaseFee() {
return getOptionalBoolean(ZERO_BASE_FEE_KEY).orElse(false);
}
+ @Override
+ public boolean isFixedBaseFee() {
+ return getOptionalBoolean(FIXED_BASE_FEE_KEY).orElse(false);
+ }
+
@Override
public Optional
getDepositContractAddress() {
Optional inputAddress = JsonUtil.getString(configRoot, DEPOSIT_CONTRACT_ADDRESS_KEY);
@@ -492,6 +498,10 @@ public Map asMap() {
builder.put("zeroBaseFee", true);
}
+ if (isFixedBaseFee()) {
+ builder.put("fixedBaseFee", true);
+ }
+
return builder.build();
}
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 d3705487cd4..3b8562533bb 100644
--- a/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java
+++ b/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java
@@ -78,6 +78,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
private TransitionsConfigOptions transitions = TransitionsConfigOptions.DEFAULT;
private static final DiscoveryOptions DISCOVERY_OPTIONS = DiscoveryOptions.DEFAULT;
private boolean zeroBaseFee = false;
+ private boolean fixedBaseFee = false;
@Override
public StubGenesisConfigOptions clone() {
@@ -424,6 +425,11 @@ public boolean isZeroBaseFee() {
return zeroBaseFee;
}
+ @Override
+ public boolean isFixedBaseFee() {
+ return fixedBaseFee;
+ }
+
@Override
public List getForkBlockNumbers() {
return Collections.emptyList();
@@ -704,6 +710,17 @@ public StubGenesisConfigOptions zeroBaseFee(final boolean zeroBaseFee) {
return this;
}
+ /**
+ * Fixed base fee per gas stub genesis config options.
+ *
+ * @param fixedBaseFee the zero base fee override
+ * @return the stub genesis config options
+ */
+ public StubGenesisConfigOptions fixedBaseFee(final boolean fixedBaseFee) {
+ this.fixedBaseFee = fixedBaseFee;
+ return this;
+ }
+
/**
* Classic fork block stub genesis config options.
*
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 03007233592..bb4a8f94a96 100644
--- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java
+++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java
@@ -295,6 +295,27 @@ void asMapIncludesZeroBaseFee() {
assertThat(config.asMap()).containsOnlyKeys("zeroBaseFee").containsValue(true);
}
+ @Test
+ void isFixedBaseFeeShouldDefaultToFalse() {
+ final GenesisConfigOptions config = GenesisConfigFile.fromConfig("{}").getConfigOptions();
+
+ assertThat(config.isFixedBaseFee()).isFalse();
+ }
+
+ @Test
+ void isFixedBaseFeeParsedCorrectly() {
+ final GenesisConfigOptions config = fromConfigOptions(Map.of("fixedbasefee", true));
+
+ assertThat(config.isFixedBaseFee()).isTrue();
+ }
+
+ @Test
+ void asMapIncludesFixedBaseFee() {
+ final GenesisConfigOptions config = fromConfigOptions(Map.of("fixedbasefee", true));
+
+ assertThat(config.asMap()).containsOnlyKeys("fixedBaseFee").containsValue(true);
+ }
+
@Test
void shouldGetDepositContractAddress() {
final GenesisConfigOptions config =
diff --git a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java
index 5f1351c40a9..18bd44f440d 100644
--- a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java
+++ b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java
@@ -22,6 +22,7 @@
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
@@ -58,6 +59,7 @@ public class CliqueProtocolSchedule {
* @param privacyParameters the privacy parameters
* @param isRevertReasonEnabled the is revert reason enabled
* @param evmConfiguration the evm configuration
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -68,6 +70,7 @@ public static ProtocolSchedule create(
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
final CliqueConfigOptions cliqueConfig = config.getCliqueConfigOptions();
@@ -103,6 +106,7 @@ public static ProtocolSchedule create(
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager)
.createProtocolSchedule();
}
@@ -115,6 +119,7 @@ public static ProtocolSchedule create(
* @param nodeKey the node key
* @param isRevertReasonEnabled the is revert reason enabled
* @param evmConfiguration the evm configuration
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -125,6 +130,7 @@ public static ProtocolSchedule create(
final NodeKey nodeKey,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return create(
config,
@@ -133,6 +139,7 @@ public static ProtocolSchedule create(
PrivacyParameters.DEFAULT,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java
index a6eefb94115..30a3967da9c 100644
--- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java
+++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java
@@ -32,6 +32,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
@@ -66,6 +67,7 @@ public void protocolSpecsAreCreatedAtBlockDefinedInJson() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
final ProtocolSpec homesteadSpec = protocolSchedule.getByBlockHeader(blockHeader(1));
@@ -89,6 +91,7 @@ public void parametersAlignWithMainnetWithAdjustments() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.getByBlockHeader(blockHeader(0));
@@ -112,6 +115,7 @@ public void zeroEpochLengthThrowsException() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Epoch length in config must be greater than zero");
@@ -131,6 +135,7 @@ public void negativeEpochLengthThrowsException() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Epoch length in config must be greater than zero");
@@ -154,6 +159,7 @@ public void shouldValidateBaseFeeMarketTransition() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
BlockHeader emptyFrontierParent =
diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java
index b6edc930477..7dcbfa34bac 100644
--- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java
+++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java
@@ -106,6 +106,7 @@ public void setup() {
proposerNodeKey,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
final Address otherAddress = Util.publicKeyToAddress(otherKeyPair.getPublicKey());
diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java
index 185674aa90c..9ff2b713ce8 100644
--- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java
+++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java
@@ -104,6 +104,7 @@ public void setup() {
proposerNodeKey,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
cliqueEthContext = mock(EthContext.class, RETURNS_DEEP_STUBS);
blockHeaderBuilder = new BlockHeaderTestFixture();
diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java
index 2a334f8b030..2578a805686 100644
--- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java
+++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java
@@ -19,6 +19,7 @@
import org.hyperledger.besu.consensus.common.ForksSchedule;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule;
@@ -52,6 +53,7 @@ public abstract class BaseBftProtocolScheduleBuilder {
* @param isRevertReasonEnabled the is revert reason enabled
* @param bftExtraDataCodec the bft extra data codec
* @param evmConfiguration the evm configuration
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -62,6 +64,7 @@ public BftProtocolSchedule createProtocolSchedule(
final boolean isRevertReasonEnabled,
final BftExtraDataCodec bftExtraDataCodec,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
final Map> specMap = new HashMap<>();
@@ -83,6 +86,7 @@ public BftProtocolSchedule createProtocolSchedule(
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager)
.createProtocolSchedule();
return new BftProtocolSchedule((DefaultProtocolSchedule) protocolSchedule);
diff --git a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java
index f310912c595..1d1d21e33f7 100644
--- a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java
+++ b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java
@@ -21,6 +21,7 @@
import org.hyperledger.besu.consensus.common.bft.BftProtocolSchedule;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
@@ -175,6 +176,7 @@ private BftProtocolSchedule createProtocolSchedule(
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
return new BftProtocolSchedule(
diff --git a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java
index 9734468e06f..9b05bd7a365 100644
--- a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java
+++ b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java
@@ -31,6 +31,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule;
@@ -243,6 +244,7 @@ protected BlockHeaderValidator.Builder createBlockHeaderRuleset(
false,
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
}
diff --git a/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java b/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java
index cd34570827f..55a2f3551a1 100644
--- a/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java
+++ b/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java
@@ -332,6 +332,7 @@ private static ControllerAndState createControllerAndFinalState(
forksSchedule,
IBFT_EXTRA_DATA_ENCODER,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
/////////////////////////////////////////////////////////////////////////////////////
diff --git a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java
index bc4e6982ed2..4f2e4da4341 100644
--- a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java
+++ b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java
@@ -21,6 +21,7 @@
import org.hyperledger.besu.consensus.common.bft.BftExtraDataCodec;
import org.hyperledger.besu.consensus.common.bft.BftProtocolSchedule;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket;
@@ -41,6 +42,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
* @param isRevertReasonEnabled the is revert reason enabled
* @param bftExtraDataCodec the bft extra data codec
* @param evmConfiguration the evm configuration
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -51,6 +53,7 @@ public static BftProtocolSchedule create(
final boolean isRevertReasonEnabled,
final BftExtraDataCodec bftExtraDataCodec,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return new IbftProtocolScheduleBuilder()
.createProtocolSchedule(
@@ -60,6 +63,7 @@ public static BftProtocolSchedule create(
isRevertReasonEnabled,
bftExtraDataCodec,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
@@ -70,6 +74,7 @@ public static BftProtocolSchedule create(
* @param forksSchedule the forks schedule
* @param bftExtraDataCodec the bft extra data codec
* @param evmConfiguration the evm configuration
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -78,6 +83,7 @@ public static BftProtocolSchedule create(
final ForksSchedule forksSchedule,
final BftExtraDataCodec bftExtraDataCodec,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return create(
config,
@@ -86,6 +92,7 @@ public static BftProtocolSchedule create(
false,
bftExtraDataCodec,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java
index de8ead1d23e..5ff7d2b5338 100644
--- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java
+++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java
@@ -40,6 +40,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
@@ -101,6 +102,7 @@ private BftProtocolSchedule createProtocolSchedule(
false,
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
}
diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java
index 621340d8299..25c5c1d10b8 100644
--- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java
+++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java
@@ -120,6 +120,7 @@ public BlockHeaderValidator.Builder createBlockHeaderRuleset(
false,
bftExtraDataEncoder,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
final ProtocolContext protContext =
new ProtocolContext(
diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java
index 2521737f81c..feb5bbc97d7 100644
--- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java
+++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java
@@ -69,6 +69,7 @@
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule;
@@ -179,6 +180,7 @@ public void setup() {
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
ProtocolSchedule protocolSchedule =
diff --git a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java
index 506dc217a35..ab1c940a8ef 100644
--- a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java
+++ b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java
@@ -17,6 +17,7 @@
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
@@ -43,14 +44,21 @@ public class MergeProtocolSchedule {
*
* @param config the config
* @param isRevertReasonEnabled the is revert reason enabled
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
public static ProtocolSchedule create(
final GenesisConfigOptions config,
final boolean isRevertReasonEnabled,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
- return create(config, PrivacyParameters.DEFAULT, isRevertReasonEnabled, badBlockManager);
+ return create(
+ config,
+ PrivacyParameters.DEFAULT,
+ isRevertReasonEnabled,
+ miningParameters,
+ badBlockManager);
}
/**
@@ -59,6 +67,7 @@ public static ProtocolSchedule create(
* @param config the config
* @param privacyParameters the privacy parameters
* @param isRevertReasonEnabled the is revert reason enabled
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -66,6 +75,7 @@ public static ProtocolSchedule create(
final GenesisConfigOptions config,
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
Map> postMergeModifications =
@@ -84,6 +94,7 @@ public static ProtocolSchedule create(
privacyParameters,
isRevertReasonEnabled,
EvmConfiguration.DEFAULT,
+ miningParameters,
badBlockManager)
.createProtocolSchedule();
}
diff --git a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java
index bae3e518d9b..f15f0c1e9f2 100644
--- a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java
+++ b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java
@@ -19,6 +19,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Difficulty;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PermissionTransactionFilter;
import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
@@ -62,15 +63,19 @@ public TransitionProtocolSchedule(
*
* @param genesisConfigOptions {@link GenesisConfigOptions} containing the config options for the
* milestone starting points
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return an initialised TransitionProtocolSchedule using post-merge defaults
*/
public static TransitionProtocolSchedule fromConfig(
- final GenesisConfigOptions genesisConfigOptions, final BadBlockManager badBlockManager) {
+ final GenesisConfigOptions genesisConfigOptions,
+ final MiningParameters miningParameters,
+ final BadBlockManager badBlockManager) {
ProtocolSchedule preMergeProtocolSchedule =
- MainnetProtocolSchedule.fromConfig(genesisConfigOptions, badBlockManager);
+ MainnetProtocolSchedule.fromConfig(genesisConfigOptions, miningParameters, badBlockManager);
ProtocolSchedule postMergeProtocolSchedule =
- MergeProtocolSchedule.create(genesisConfigOptions, false, badBlockManager);
+ MergeProtocolSchedule.create(
+ genesisConfigOptions, false, miningParameters, badBlockManager);
return new TransitionProtocolSchedule(
preMergeProtocolSchedule, postMergeProtocolSchedule, PostMergeContext.get());
}
diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java
index 5f6c38a34f5..a4a07054d34 100644
--- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java
+++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java
@@ -22,6 +22,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
@@ -46,7 +47,8 @@ public void protocolSpecsAreCreatedAtBlockDefinedInJson() {
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
final ProtocolSchedule protocolSchedule =
- MergeProtocolSchedule.create(config, false, new BadBlockManager());
+ MergeProtocolSchedule.create(
+ config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
final ProtocolSpec homesteadSpec = protocolSchedule.getByBlockHeader(blockHeader(1));
final ProtocolSpec londonSpec = protocolSchedule.getByBlockHeader(blockHeader(1559));
@@ -61,7 +63,8 @@ public void mergeSpecificModificationsAreUnappliedForShanghai() {
final GenesisConfigOptions config = GenesisConfigFile.mainnet().getConfigOptions();
final ProtocolSchedule protocolSchedule =
- MergeProtocolSchedule.create(config, false, new BadBlockManager());
+ MergeProtocolSchedule.create(
+ config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
final long lastParisBlockNumber = 17034869L;
final ProtocolSpec parisSpec =
@@ -96,7 +99,8 @@ public void mergeSpecificModificationsAreUnappliedForCancun_whenShanghaiNotConfi
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
final ProtocolSchedule protocolSchedule =
- MergeProtocolSchedule.create(config, false, new BadBlockManager());
+ MergeProtocolSchedule.create(
+ config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
final ProtocolSpec parisSpec =
protocolSchedule.getByBlockHeader(
@@ -123,7 +127,8 @@ public void mergeSpecificModificationsAreUnappliedForCancun_whenShanghaiNotConfi
public void mergeSpecificModificationsAreUnappliedForAllMainnetForksAfterParis() {
final GenesisConfigOptions config = GenesisConfigFile.mainnet().getConfigOptions();
final ProtocolSchedule protocolSchedule =
- MergeProtocolSchedule.create(config, false, new BadBlockManager());
+ MergeProtocolSchedule.create(
+ config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
final long lastParisBlockNumber = 17034869L;
final ProtocolSpec parisSpec =
@@ -152,7 +157,10 @@ public void mergeSpecificModificationsAreUnappliedForAllMainnetForksAfterParis()
public void parametersAlignWithMainnetWithAdjustments() {
final ProtocolSpec london =
MergeProtocolSchedule.create(
- GenesisConfigFile.DEFAULT.getConfigOptions(), false, new BadBlockManager())
+ GenesisConfigFile.DEFAULT.getConfigOptions(),
+ false,
+ MiningParameters.MINING_DISABLED,
+ new BadBlockManager())
.getByBlockHeader(blockHeader(0));
assertThat(london.getName()).isEqualTo("Paris");
diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java
index d7fcec771a4..80615552e74 100644
--- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java
+++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java
@@ -21,6 +21,7 @@
import org.hyperledger.besu.consensus.merge.MergeProtocolSchedule;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import java.io.IOException;
@@ -59,6 +60,9 @@ default Stream genesisAllocations(final GenesisConfigFile configFile) {
default ProtocolSchedule getMergeProtocolSchedule() {
return MergeProtocolSchedule.create(
- getPosGenesisConfigFile().getConfigOptions(), false, new BadBlockManager());
+ getPosGenesisConfigFile().getConfigOptions(),
+ false,
+ MiningParameters.MINING_DISABLED,
+ new BadBlockManager());
}
}
diff --git a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java
index dcfb049dade..f66973ef6a9 100644
--- a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java
+++ b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java
@@ -150,6 +150,7 @@ private record ControllerAndState(
private boolean useLondonMilestone = false;
private boolean useShanghaiMilestone = false;
private boolean useZeroBaseFee = false;
+ private boolean useFixedBaseFee = false;
public static final int EPOCH_LENGTH = 10_000;
public static final int BLOCK_TIMER_SEC = 3;
public static final int ROUND_TIMER_SEC = 12;
@@ -227,6 +228,11 @@ public TestContextBuilder useZeroBaseFee(final boolean useZeroBaseFee) {
return this;
}
+ public TestContextBuilder useFixedBaseFee(final boolean useFixedBaseFee) {
+ this.useFixedBaseFee = useFixedBaseFee;
+ return this;
+ }
+
public TestContextBuilder qbftForks(final List qbftForks) {
this.qbftForks = qbftForks;
return this;
@@ -294,6 +300,7 @@ public TestContext build() {
useLondonMilestone,
useShanghaiMilestone,
useZeroBaseFee,
+ useFixedBaseFee,
qbftForks);
// Add each networkNode to the Multicaster (such that each can receive msgs from local node).
@@ -375,6 +382,7 @@ private static ControllerAndState createControllerAndFinalState(
final boolean useLondonMilestone,
final boolean useShanghaiMilestone,
final boolean useZeroBaseFee,
+ final boolean useFixedBaseFee,
final List qbftForks) {
final MiningParameters miningParams =
@@ -407,6 +415,9 @@ private static ControllerAndState createControllerAndFinalState(
if (useZeroBaseFee) {
genesisConfigOptions.zeroBaseFee(true);
}
+ if (useFixedBaseFee) {
+ genesisConfigOptions.fixedBaseFee(true);
+ }
genesisConfigOptions.qbftConfigOptions(
new JsonQbftConfigOptions(JsonUtil.objectNodeFromMap(qbftConfigValues)));
genesisConfigOptions.transitions(TestTransitions.createQbftTestTransitions(qbftForks));
@@ -425,6 +436,7 @@ private static ControllerAndState createControllerAndFinalState(
forksSchedule,
BFT_EXTRA_DATA_ENCODER,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
final BftValidatorOverrides validatorOverrides = convertBftForks(qbftForks);
diff --git a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/test/ValidatorContractTest.java b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/test/ValidatorContractTest.java
index b1949e7917a..c5978560065 100644
--- a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/test/ValidatorContractTest.java
+++ b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/test/ValidatorContractTest.java
@@ -167,6 +167,57 @@ public void retrievesValidatorsFromValidatorContract_ShanghaiFork_ZeroBaseFee()
assertThat(validatorProvider.getValidatorsForBlock(block1)).containsExactly(NODE_ADDRESS);
}
+ @Test
+ public void retrievesValidatorsFromValidatorContract_LondonFork_FixedBaseFee() {
+ // Using London on a free gas network
+ final TestContext context =
+ new TestContextBuilder()
+ .indexOfFirstLocallyProposedBlock(0)
+ .nodeParams(
+ List.of(new NodeParams(NODE_ADDRESS, NodeKeyUtils.createFrom(NODE_PRIVATE_KEY))))
+ .clock(TestClock.fixed())
+ .genesisFile(Resources.getResource("genesis_validator_contract_london.json").getFile())
+ .useValidatorContract(true)
+ .useLondonMilestone(true)
+ .useFixedBaseFee(true)
+ .buildAndStart();
+
+ createNewBlockAsProposer(context, 1);
+
+ final ValidatorProvider validatorProvider = context.getValidatorProvider();
+ final BlockHeader genesisBlock = context.getBlockchain().getBlockHeader(0).get();
+ final BlockHeader block1 = context.getBlockchain().getBlockHeader(1).get();
+ assertThat(validatorProvider.getValidatorsForBlock(genesisBlock)).containsExactly(NODE_ADDRESS);
+ assertThat(validatorProvider.getValidatorsForBlock(block1)).containsExactly(NODE_ADDRESS);
+ }
+
+ @Test
+ public void retrievesValidatorsFromValidatorContract_ShanghaiFork_FixedBaseFee() {
+ // Using Shanghai on a free gas network
+ final TestContext context =
+ new TestContextBuilder()
+ .indexOfFirstLocallyProposedBlock(0)
+ .nodeParams(
+ List.of(new NodeParams(NODE_ADDRESS, NodeKeyUtils.createFrom(NODE_PRIVATE_KEY))))
+ .clock(TestClock.fixed())
+ .genesisFile(
+ Resources.getResource("genesis_validator_contract_shanghai.json").getFile())
+ .useValidatorContract(true)
+ .useShanghaiMilestone(true)
+ .useFixedBaseFee(true)
+ .buildAndStart();
+
+ createNewBlockAsProposerFixedTime(
+ context, 1,
+ 266L); // 10s ahead of genesis timestamp in genesis_validator_contract_shanghai.json
+
+ final ValidatorProvider validatorProvider = context.getValidatorProvider();
+ final BlockHeader genesisBlock = context.getBlockchain().getBlockHeader(0).get();
+ final BlockHeader block1 = context.getBlockchain().getBlockHeader(1).get();
+ assertThat(validatorProvider.getValidatorsForBlock(genesisBlock)).containsExactly(NODE_ADDRESS);
+ assertThat(validatorProvider.getValidatorsForBlock(block1)).containsExactly(NODE_ADDRESS);
+ }
+
@Test
public void transitionsFromBlockHeaderModeToValidatorContractMode() {
final List qbftForks =
diff --git a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java
index 01d87b7cd92..d611e82372a 100644
--- a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java
+++ b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java
@@ -24,6 +24,7 @@
import org.hyperledger.besu.consensus.common.bft.BftExtraDataCodec;
import org.hyperledger.besu.consensus.common.bft.BftProtocolSchedule;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
@@ -45,6 +46,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
* @param isRevertReasonEnabled the is revert reason enabled
* @param bftExtraDataCodec the bft extra data codec
* @param evmConfiguration the evm configuration
+ * @param miningParameters The mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -55,6 +57,7 @@ public static BftProtocolSchedule create(
final boolean isRevertReasonEnabled,
final BftExtraDataCodec bftExtraDataCodec,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return new QbftProtocolScheduleBuilder()
.createProtocolSchedule(
@@ -64,6 +67,7 @@ public static BftProtocolSchedule create(
isRevertReasonEnabled,
bftExtraDataCodec,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
@@ -74,6 +78,7 @@ public static BftProtocolSchedule create(
* @param qbftForksSchedule the qbft forks schedule
* @param bftExtraDataCodec the bft extra data codec
* @param evmConfiguration the evm configuration
+ * @param miningParameters The mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -82,6 +87,7 @@ public static BftProtocolSchedule create(
final ForksSchedule qbftForksSchedule,
final BftExtraDataCodec bftExtraDataCodec,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return create(
config,
@@ -90,6 +96,7 @@ public static BftProtocolSchedule create(
false,
bftExtraDataCodec,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
@@ -100,6 +107,7 @@ public static BftProtocolSchedule create(
* @param qbftForksSchedule the qbft forks schedule
* @param isRevertReasonEnabled the is revert reason enabled
* @param bftExtraDataCodec the bft extra data codec
+ * @param miningParameters The mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
@@ -108,6 +116,7 @@ public static ProtocolSchedule create(
final ForksSchedule qbftForksSchedule,
final boolean isRevertReasonEnabled,
final BftExtraDataCodec bftExtraDataCodec,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return create(
config,
@@ -116,6 +125,7 @@ public static ProtocolSchedule create(
isRevertReasonEnabled,
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
+ miningParameters,
badBlockManager);
}
diff --git a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleTest.java b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleTest.java
index 16a5f4ca31a..3243484152d 100644
--- a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleTest.java
+++ b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleTest.java
@@ -35,6 +35,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
@@ -136,6 +137,7 @@ private BftProtocolSchedule createProtocolSchedule(
false,
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
}
diff --git a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/statemachine/QbftBlockHeightManagerTest.java b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/statemachine/QbftBlockHeightManagerTest.java
index b582f1a9b88..4a2dd5b9b86 100644
--- a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/statemachine/QbftBlockHeightManagerTest.java
+++ b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/statemachine/QbftBlockHeightManagerTest.java
@@ -68,6 +68,7 @@
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule;
@@ -179,6 +180,7 @@ QbftContext.class, validators, new QbftExtraDataCodec()),
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
ProtocolSchedule protocolSchedule =
diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/BlockchainImporter.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/BlockchainImporter.java
index a3ad8d4d693..2a62331d336 100644
--- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/BlockchainImporter.java
+++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/BlockchainImporter.java
@@ -19,6 +19,7 @@
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
@@ -43,7 +44,9 @@ public class BlockchainImporter {
public BlockchainImporter(final URL blocksUrl, final String genesisJson) throws Exception {
protocolSchedule =
MainnetProtocolSchedule.fromConfig(
- GenesisConfigFile.fromConfig(genesisJson).getConfigOptions(), new BadBlockManager());
+ GenesisConfigFile.fromConfig(genesisJson).getConfigOptions(),
+ MiningParameters.newDefault(),
+ new BadBlockManager());
final BlockHeaderFunctions blockHeaderFunctions =
ScheduleBasedBlockHeaderFunctions.create(protocolSchedule);
blocks = new ArrayList<>();
diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java
index 797129710ed..a261ff2351a 100644
--- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java
+++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java
@@ -108,6 +108,7 @@ public void initServerAndClient() throws Exception {
synchronizer,
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()),
mock(ProtocolContext.class),
mock(FilterManager.class),
diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java
index 357f41b8e46..2b8b1ae3475 100644
--- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java
+++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java
@@ -137,7 +137,8 @@ public static void initServerAndClient() throws Exception {
peerDiscoveryMock,
blockchainQueries,
synchronizer,
- MainnetProtocolSchedule.fromConfig(genesisConfigOptions, new BadBlockManager()),
+ MainnetProtocolSchedule.fromConfig(
+ genesisConfigOptions, MiningParameters.MINING_DISABLED, new BadBlockManager()),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java
index 0ce460866e5..a5f90791ce6 100644
--- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java
+++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java
@@ -118,6 +118,7 @@ public static void initServerAndClient() throws Exception {
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()),
mock(ProtocolContext.class),
mock(FilterManager.class),
diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java
index edea0a43150..2f62e490beb 100644
--- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java
+++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java
@@ -122,6 +122,7 @@ public void initServer() throws Exception {
synchronizer,
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()),
mock(ProtocolContext.class),
mock(FilterManager.class),
diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java
index 0f20776e456..2ff0833bc69 100644
--- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java
+++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java
@@ -110,6 +110,7 @@ public void beforeEach() {
synchronizer,
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()),
mock(ProtocolContext.class),
mock(FilterManager.class),
diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java
index 0a43cd0e37e..e650f9d490b 100644
--- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java
+++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java
@@ -111,6 +111,7 @@ public void initServer() throws Exception {
synchronizer,
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()),
mock(ProtocolContext.class),
mock(FilterManager.class),
diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java
index 9b5c688ddd3..bedd7aa4c36 100644
--- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java
+++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java
@@ -173,7 +173,10 @@ public void before() throws URISyntaxException {
peerDiscoveryMock,
blockchainQueries,
synchronizer,
- MainnetProtocolSchedule.fromConfig(genesisConfigOptions, new BadBlockManager()),
+ MainnetProtocolSchedule.fromConfig(
+ genesisConfigOptions,
+ MiningParameters.MINING_DISABLED,
+ new BadBlockManager()),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java
index 3e8cc8a685c..560c149877e 100644
--- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java
+++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java
@@ -364,6 +364,7 @@ private AbstractBlockCreator createBlockCreator(
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule())
.build();
diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
index a3b657dbc3d..a7dab2f124e 100644
--- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
+++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
@@ -221,6 +221,7 @@ public void emptyPendingTransactionsResultsInEmptyVettingResult() {
FixedDifficultyProtocolSchedule.create(
GenesisConfigFile.development().getConfigOptions(),
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
final MainnetTransactionProcessor mainnetTransactionProcessor =
protocolSchedule.getByBlockHeader(blockHeader(0)).getTransactionProcessor();
diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java
index 10d54576b42..39db9c05cf2 100644
--- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java
+++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java
@@ -22,6 +22,7 @@
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration;
@@ -59,6 +60,7 @@ protected ProtocolSchedule createProtocolSchedule() {
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
}
diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java
index 4a961d07e80..8250039b2b9 100644
--- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java
+++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java
@@ -71,6 +71,7 @@ protected ProtocolSchedule createProtocolSchedule() {
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
}
diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java
index ad3ce47887a..f7fd4486d1b 100644
--- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java
+++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java
@@ -93,6 +93,7 @@ void createMainnetBlock1() throws IOException {
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule())
.build();
@@ -148,6 +149,7 @@ void createMainnetBlock1_fixedDifficulty1() {
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule())
.build();
@@ -193,6 +195,7 @@ void rewardBeneficiary_zeroReward_skipZeroRewardsFalse() {
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
final ExecutionContextTestFixture executionContextTestFixture =
@@ -261,6 +264,7 @@ void rewardBeneficiary_zeroReward_skipZeroRewardsTrue() {
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
final ExecutionContextTestFixture executionContextTestFixture =
diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java
index f92f0813fcd..b7f8395d92f 100644
--- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java
+++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java
@@ -16,6 +16,7 @@
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder;
@@ -30,6 +31,7 @@ public static ProtocolSchedule create(
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return new ProtocolScheduleBuilder(
config,
@@ -40,6 +42,7 @@ public static ProtocolSchedule create(
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager)
.createProtocolSchedule();
}
@@ -48,19 +51,28 @@ public static ProtocolSchedule create(
final GenesisConfigOptions config,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return create(
config,
PrivacyParameters.DEFAULT,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
public static ProtocolSchedule create(
final GenesisConfigOptions config,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
- return create(config, PrivacyParameters.DEFAULT, false, evmConfiguration, badBlockManager);
+ return create(
+ config,
+ PrivacyParameters.DEFAULT,
+ false,
+ evmConfiguration,
+ miningParameters,
+ badBlockManager);
}
}
diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java
index 6982d28d4e6..794f96cfb39 100644
--- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java
+++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java
@@ -16,6 +16,7 @@
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyCalculators;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule;
@@ -37,6 +38,7 @@ public class MainnetProtocolSchedule {
* @param privacyParameters the parameters set for private transactions
* @param isRevertReasonEnabled whether storing the revert reason is for failed transactions
* @param evmConfiguration how to configure the EVMs jumpdest cache
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return A configured mainnet protocol schedule
*/
@@ -45,10 +47,16 @@ public static ProtocolSchedule fromConfig(
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
if (FixedDifficultyCalculators.isFixedDifficultyInConfig(config)) {
return FixedDifficultyProtocolSchedule.create(
- config, privacyParameters, isRevertReasonEnabled, evmConfiguration, badBlockManager);
+ config,
+ privacyParameters,
+ isRevertReasonEnabled,
+ evmConfiguration,
+ miningParameters,
+ badBlockManager);
}
return new ProtocolScheduleBuilder(
config,
@@ -57,6 +65,7 @@ public static ProtocolSchedule fromConfig(
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager)
.createProtocolSchedule();
}
@@ -68,6 +77,7 @@ public static ProtocolSchedule fromConfig(
* starting points
* @param isRevertReasonEnabled whether storing the revert reason is for failed transactions
* @param evmConfiguration how to configure the EVMs jumpdest cache
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return A configured mainnet protocol schedule
*/
@@ -75,12 +85,14 @@ public static ProtocolSchedule fromConfig(
final GenesisConfigOptions config,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return fromConfig(
config,
PrivacyParameters.DEFAULT,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
@@ -90,14 +102,22 @@ public static ProtocolSchedule fromConfig(
* @param config {@link GenesisConfigOptions} containing the config options for the milestone
* starting points
* @param evmConfiguration size of
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return A configured mainnet protocol schedule
*/
public static ProtocolSchedule fromConfig(
final GenesisConfigOptions config,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
- return fromConfig(config, PrivacyParameters.DEFAULT, false, evmConfiguration, badBlockManager);
+ return fromConfig(
+ config,
+ PrivacyParameters.DEFAULT,
+ false,
+ evmConfiguration,
+ miningParameters,
+ badBlockManager);
}
/**
@@ -105,12 +125,20 @@ public static ProtocolSchedule fromConfig(
*
* @param config {@link GenesisConfigOptions} containing the config options for the milestone
* starting points
+ * @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return A configured mainnet protocol schedule
*/
public static ProtocolSchedule fromConfig(
- final GenesisConfigOptions config, final BadBlockManager badBlockManager) {
+ final GenesisConfigOptions config,
+ final MiningParameters miningParameters,
+ final BadBlockManager badBlockManager) {
return fromConfig(
- config, PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, badBlockManager);
+ config,
+ PrivacyParameters.DEFAULT,
+ false,
+ EvmConfiguration.DEFAULT,
+ miningParameters,
+ badBlockManager);
}
}
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 de7f92465bf..06bc45084a7 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
@@ -15,6 +15,7 @@
package org.hyperledger.besu.ethereum.mainnet;
import org.hyperledger.besu.config.GenesisConfigOptions;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import java.math.BigInteger;
@@ -30,6 +31,7 @@ public class MainnetProtocolSpecFactory {
private final boolean isRevertReasonEnabled;
private final OptionalLong ecip1017EraRounds;
private final EvmConfiguration evmConfiguration;
+ private final MiningParameters miningParameters;
public MainnetProtocolSpecFactory(
final Optional chainId,
@@ -37,13 +39,15 @@ public MainnetProtocolSpecFactory(
final OptionalInt evmStackSize,
final boolean isRevertReasonEnabled,
final OptionalLong ecip1017EraRounds,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
this.chainId = chainId;
this.contractSizeLimit = contractSizeLimit;
this.evmStackSize = evmStackSize;
this.isRevertReasonEnabled = isRevertReasonEnabled;
this.ecip1017EraRounds = ecip1017EraRounds;
this.evmConfiguration = evmConfiguration;
+ this.miningParameters = miningParameters;
}
public ProtocolSpecBuilder frontierDefinition() {
@@ -113,7 +117,8 @@ public ProtocolSpecBuilder londonDefinition(final GenesisConfigOptions genesisCo
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
public ProtocolSpecBuilder arrowGlacierDefinition(
@@ -124,7 +129,8 @@ public ProtocolSpecBuilder arrowGlacierDefinition(
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
public ProtocolSpecBuilder grayGlacierDefinition(
@@ -135,7 +141,8 @@ public ProtocolSpecBuilder grayGlacierDefinition(
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
public ProtocolSpecBuilder parisDefinition(final GenesisConfigOptions genesisConfigOptions) {
@@ -145,7 +152,8 @@ public ProtocolSpecBuilder parisDefinition(final GenesisConfigOptions genesisCon
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
public ProtocolSpecBuilder shanghaiDefinition(final GenesisConfigOptions genesisConfigOptions) {
@@ -155,7 +163,8 @@ public ProtocolSpecBuilder shanghaiDefinition(final GenesisConfigOptions genesis
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
public ProtocolSpecBuilder cancunDefinition(final GenesisConfigOptions genesisConfigOptions) {
@@ -165,7 +174,8 @@ public ProtocolSpecBuilder cancunDefinition(final GenesisConfigOptions genesisCo
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
public ProtocolSpecBuilder pragueDefinition(final GenesisConfigOptions genesisConfigOptions) {
@@ -175,7 +185,8 @@ public ProtocolSpecBuilder pragueDefinition(final GenesisConfigOptions genesisCo
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
/**
@@ -196,7 +207,8 @@ public ProtocolSpecBuilder futureEipsDefinition(final GenesisConfigOptions genes
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
/**
@@ -217,7 +229,8 @@ public ProtocolSpecBuilder experimentalEipsDefinition(
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
}
////////////////////////////////////////////////////////////////////////////////////////////////
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 2e5f114157c..ca226484112 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
@@ -24,6 +24,7 @@
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Deposit;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
@@ -433,7 +434,8 @@ static ProtocolSpecBuilder londonDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ 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);
@@ -442,7 +444,10 @@ static ProtocolSpecBuilder londonDefinition(
final BaseFeeMarket londonFeeMarket =
genesisConfigOptions.isZeroBaseFee()
? FeeMarket.zeroBaseFee(londonForkBlockNumber)
- : FeeMarket.london(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas());
+ : genesisConfigOptions.isFixedBaseFee()
+ ? FeeMarket.fixedBaseFee(
+ londonForkBlockNumber, miningParameters.getMinTransactionGasPrice())
+ : FeeMarket.london(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas());
return berlinDefinition(
chainId,
configContractSizeLimit,
@@ -515,14 +520,16 @@ static ProtocolSpecBuilder arrowGlacierDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
return londonDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
.difficultyCalculator(MainnetDifficultyCalculators.ARROW_GLACIER)
.name("ArrowGlacier");
}
@@ -533,14 +540,16 @@ static ProtocolSpecBuilder grayGlacierDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
return arrowGlacierDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
.difficultyCalculator(MainnetDifficultyCalculators.GRAY_GLACIER)
.name("GrayGlacier");
}
@@ -551,7 +560,8 @@ static ProtocolSpecBuilder parisDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
return grayGlacierDefinition(
chainId,
@@ -559,7 +569,8 @@ static ProtocolSpecBuilder parisDefinition(
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.paris(gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration))
@@ -577,7 +588,8 @@ static ProtocolSpecBuilder shanghaiDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
// extra variables need to support flipping the warm coinbase flag.
final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
@@ -588,7 +600,8 @@ static ProtocolSpecBuilder shanghaiDefinition(
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
// gas calculator has new code to support EIP-3860 limit and meter initcode
.gasCalculator(ShanghaiGasCalculator::new)
// EVM has a new operation for EIP-3855 PUSH0 instruction
@@ -638,14 +651,18 @@ static ProtocolSpecBuilder cancunDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
final long londonForkBlockNumber = genesisConfigOptions.getLondonBlockNumber().orElse(0L);
final BaseFeeMarket cancunFeeMarket =
genesisConfigOptions.isZeroBaseFee()
? FeeMarket.zeroBaseFee(londonForkBlockNumber)
- : FeeMarket.cancun(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas());
+ : genesisConfigOptions.isFixedBaseFee()
+ ? FeeMarket.fixedBaseFee(
+ londonForkBlockNumber, miningParameters.getMinTransactionGasPrice())
+ : FeeMarket.cancun(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas());
return shanghaiDefinition(
chainId,
@@ -653,7 +670,8 @@ static ProtocolSpecBuilder cancunDefinition(
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
.feeMarket(cancunFeeMarket)
// gas calculator for EIP-4844 blob gas
.gasCalculator(CancunGasCalculator::new)
@@ -710,7 +728,8 @@ static ProtocolSpecBuilder pragueDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
@@ -720,7 +739,8 @@ static ProtocolSpecBuilder pragueDefinition(
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
// EVM changes to support EOF EIPs (3670, 4200, 4750, 5450)
.gasCalculator(PragueGasCalculator::new)
.evmBuilder(
@@ -749,7 +769,8 @@ static ProtocolSpecBuilder futureEipsDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
return pragueDefinition(
@@ -758,7 +779,8 @@ static ProtocolSpecBuilder futureEipsDefinition(
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
// Use Future EIP configured EVM
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
@@ -786,7 +808,8 @@ static ProtocolSpecBuilder experimentalEipsDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
- final EvmConfiguration evmConfiguration) {
+ final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters) {
final Address depositContractAddress =
genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS);
@@ -797,7 +820,8 @@ static ProtocolSpecBuilder experimentalEipsDefinition(
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
- evmConfiguration)
+ evmConfiguration,
+ miningParameters)
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.experimentalEips(
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 14fcedba2f3..58db065155b 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 @@
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.privacy.PrivateTransactionValidator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
@@ -40,6 +41,7 @@ public class ProtocolScheduleBuilder {
private final PrivacyParameters privacyParameters;
private final boolean isRevertReasonEnabled;
private final EvmConfiguration evmConfiguration;
+ private final MiningParameters miningParameters;
private final BadBlockManager badBlockManager;
private DefaultProtocolSchedule protocolSchedule;
@@ -51,6 +53,7 @@ public ProtocolScheduleBuilder(
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
this(
config,
@@ -59,6 +62,7 @@ public ProtocolScheduleBuilder(
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
@@ -68,6 +72,7 @@ public ProtocolScheduleBuilder(
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
this(
config,
@@ -76,6 +81,7 @@ public ProtocolScheduleBuilder(
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ miningParameters,
badBlockManager);
}
@@ -86,6 +92,7 @@ private ProtocolScheduleBuilder(
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
+ final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
this.config = config;
this.protocolSpecAdapters = protocolSpecAdapters;
@@ -93,6 +100,7 @@ private ProtocolScheduleBuilder(
this.isRevertReasonEnabled = isRevertReasonEnabled;
this.evmConfiguration = evmConfiguration;
this.defaultChainId = defaultChainId;
+ this.miningParameters = miningParameters;
this.badBlockManager = badBlockManager;
}
@@ -113,7 +121,8 @@ private void initSchedule(
config.getEvmStackSize(),
isRevertReasonEnabled,
config.getEcip1017EraRounds(),
- evmConfiguration);
+ evmConfiguration,
+ miningParameters);
validateForkOrdering();
diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java
index 637ffb471ec..fc5defbd105 100644
--- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java
+++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java
@@ -53,6 +53,10 @@ static BaseFeeMarket zeroBaseFee(final long londonForkBlockNumber) {
return new ZeroBaseFeeMarket(londonForkBlockNumber);
}
+ static BaseFeeMarket fixedBaseFee(final long londonForkBlockNumber, final Wei fixedBaseFee) {
+ return new FixedBaseFeeMarket(londonForkBlockNumber, fixedBaseFee);
+ }
+
static FeeMarket legacy() {
return new LegacyFeeMarket();
}
diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarket.java
new file mode 100644
index 00000000000..5aeddd06720
--- /dev/null
+++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarket.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright Hyperledger Besu Contributors.
+ *
+ * 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.ethereum.mainnet.feemarket;
+
+import org.hyperledger.besu.datatypes.Wei;
+
+import java.util.Optional;
+
+public class FixedBaseFeeMarket extends LondonFeeMarket {
+
+ public FixedBaseFeeMarket(final long londonForkBlockNumber, final Wei fixedBaseFee) {
+ super(londonForkBlockNumber, Optional.of(fixedBaseFee));
+ }
+
+ @Override
+ public Wei computeBaseFee(
+ final long blockNumber,
+ final Wei parentBaseFee,
+ final long parentBlockGasUsed,
+ final long targetGasUsed) {
+
+ return baseFeeInitialValue;
+ }
+
+ @Override
+ public ValidationMode baseFeeValidationMode(final long blockNumber) {
+ return ValidationMode.NONE;
+ }
+}
diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
index 2fff3a629fa..d1a148ceedf 100644
--- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
+++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
@@ -35,7 +35,7 @@ public class LondonFeeMarket implements BaseFeeMarket {
private static final Wei DEFAULT_BASEFEE_FLOOR = Wei.of(7L);
- private final Wei baseFeeInitialValue;
+ protected final Wei baseFeeInitialValue;
private final long londonForkBlockNumber;
private final TransactionPriceCalculator txPriceCalculator;
private final Wei baseFeeFloor;
diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java
index c2f406cad04..7b32e3f84c8 100644
--- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java
+++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java
@@ -16,22 +16,10 @@
import org.hyperledger.besu.datatypes.Wei;
-import java.util.Optional;
-
-public class ZeroBaseFeeMarket extends LondonFeeMarket {
+public class ZeroBaseFeeMarket extends FixedBaseFeeMarket {
public ZeroBaseFeeMarket(final long londonForkBlockNumber) {
- super(londonForkBlockNumber, Optional.of(Wei.ZERO));
- }
-
- @Override
- public Wei computeBaseFee(
- final long blockNumber,
- final Wei parentBaseFee,
- final long parentBlockGasUsed,
- final long targetGasUsed) {
-
- return Wei.ZERO;
+ super(londonForkBlockNumber, Wei.ZERO);
}
@Override
diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java
index cf142eb2ed8..f0ffbb98622 100644
--- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java
+++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java
@@ -142,7 +142,10 @@ public static BlockchainSetupUtil createForEthashChain(
private static ProtocolSchedule mainnetProtocolScheduleProvider(
final GenesisConfigFile genesisConfigFile) {
return MainnetProtocolSchedule.fromConfig(
- genesisConfigFile.getConfigOptions(), EvmConfiguration.DEFAULT, new BadBlockManager());
+ genesisConfigFile.getConfigOptions(),
+ EvmConfiguration.DEFAULT,
+ MiningParameters.newDefault(),
+ new BadBlockManager());
}
private static ProtocolContext mainnetProtocolContextProvider(
diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java
index 25c65b357f8..40f4c8c9312 100644
--- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java
+++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java
@@ -140,6 +140,7 @@ public ExecutionContextTestFixture build() {
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
}
diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java
index b0292fda057..0df40c56da3 100644
--- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java
+++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java
@@ -39,6 +39,7 @@ public class ProtocolScheduleFixture {
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.newDefault(),
new BadBlockManager());
private static GenesisConfigOptions getMainnetConfigOptions() {
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java
index f4b589cf608..afb0e195f35 100644
--- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java
@@ -20,6 +20,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
@@ -34,6 +35,7 @@ public void reportedDifficultyForAllBlocksIsAFixedValue() {
FixedDifficultyProtocolSchedule.create(
GenesisConfigFile.development().getConfigOptions(),
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
final BlockHeaderTestFixture headerBuilder = new BlockHeaderTestFixture();
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java
index 91bece386e2..b68104d81ba 100644
--- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java
@@ -23,6 +23,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
@@ -60,6 +61,7 @@ public void setup() {
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
}
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java
index 60406fa05e2..a8b5b772f8e 100644
--- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java
@@ -18,6 +18,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
@@ -74,6 +75,7 @@ public void shouldOnlyUseFrontierWhenEmptyJsonConfigIsUsed() {
MainnetProtocolSchedule.fromConfig(
GenesisConfigFile.fromConfig("{}").getConfigOptions(),
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
Assertions.assertThat(sched.getByBlockHeader(blockHeader(1L)).getName()).isEqualTo("Frontier");
Assertions.assertThat(sched.getByBlockHeader(blockHeader(Long.MAX_VALUE)).getName())
@@ -88,6 +90,7 @@ public void createFromConfigWithSettings() {
MainnetProtocolSchedule.fromConfig(
GenesisConfigFile.fromConfig(json).getConfigOptions(),
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
Assertions.assertThat(sched.getByBlockHeader(blockHeader(1)).getName()).isEqualTo("Frontier");
Assertions.assertThat(sched.getByBlockHeader(blockHeader(2)).getName()).isEqualTo("Homestead");
@@ -119,6 +122,7 @@ public void outOfOrderConstantinoplesFail() {
MainnetProtocolSchedule.fromConfig(
GenesisConfigFile.fromConfig(json).getConfigOptions(),
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()));
}
@@ -131,6 +135,7 @@ public void shouldCreateGoerliConfig() throws Exception {
this.getClass().getResource("/goerli.json"), StandardCharsets.UTF_8))
.getConfigOptions(),
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
Assertions.assertThat(sched.getByBlockHeader(blockHeader(0L)).getName())
.isEqualTo("Petersburg");
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java
index ab1c64d2748..c7be26039e3 100644
--- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java
@@ -26,6 +26,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
@@ -59,6 +60,7 @@ public void setup() {
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
}
@@ -213,6 +215,7 @@ private MilestoneStreamingProtocolSchedule createScheduleModifiedAt(final int bl
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
return new MilestoneStreamingProtocolSchedule(
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarketTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarketTest.java
new file mode 100644
index 00000000000..0e0873b39ce
--- /dev/null
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarketTest.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright Hyperledger Besu Contributors.
+ *
+ * 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.ethereum.mainnet.feemarket;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.hyperledger.besu.crypto.KeyPair;
+import org.hyperledger.besu.crypto.SignatureAlgorithmFactory;
+import org.hyperledger.besu.datatypes.BlobGas;
+import org.hyperledger.besu.datatypes.TransactionType;
+import org.hyperledger.besu.datatypes.Wei;
+import org.hyperledger.besu.ethereum.core.Transaction;
+import org.hyperledger.besu.ethereum.core.TransactionTestFixture;
+
+import java.util.Optional;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class FixedBaseFeeMarketTest {
+
+ private static final KeyPair KEY_PAIR1 =
+ SignatureAlgorithmFactory.getInstance().generateKeyPair();
+ private static final long FORK_BLOCK = 0;
+ private FixedBaseFeeMarket fixedBaseFeeMarket;
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ fixedBaseFeeMarket = new FixedBaseFeeMarket(FORK_BLOCK, Wei.ONE);
+ }
+
+ @Test
+ public void getBasefeeMaxChangeDenominatorShouldUseLondonDefault() {
+ assertThat(fixedBaseFeeMarket.getBasefeeMaxChangeDenominator())
+ .isEqualTo(LondonFeeMarket.DEFAULT_BASEFEE_MAX_CHANGE_DENOMINATOR);
+ }
+
+ @Test
+ public void getInitialBasefeeShouldBeZero() {
+ assertThat(fixedBaseFeeMarket.getInitialBasefee()).isEqualTo(Wei.ONE);
+ }
+
+ @Test
+ public void getSlackCoefficientShouldUseLondonDefault() {
+ assertThat(fixedBaseFeeMarket.getSlackCoefficient())
+ .isEqualTo(LondonFeeMarket.DEFAULT_SLACK_COEFFICIENT);
+ }
+
+ @Test
+ public void getTransactionPriceCalculatorShouldBeEIP1559() {
+ // only eip1559 will read the fee per gas values
+ final Transaction transaction =
+ new TransactionTestFixture()
+ .type(TransactionType.EIP1559)
+ .maxFeePerGas(Optional.of(Wei.of(8)))
+ .maxPriorityFeePerGas(Optional.of(Wei.of(8)))
+ .gasPrice(null)
+ .createTransaction(KEY_PAIR1);
+
+ assertThat(
+ fixedBaseFeeMarket
+ .getTransactionPriceCalculator()
+ .price(transaction, Optional.of(Wei.ZERO)))
+ .isEqualTo(Wei.of(8));
+ }
+
+ @Test
+ public void satisfiesFloorTxCostWhenGasFeeIsNonZero() {
+ final Transaction transaction =
+ new TransactionTestFixture()
+ .type(TransactionType.FRONTIER)
+ .gasPrice(Wei.of(7))
+ .createTransaction(KEY_PAIR1);
+ assertThat(fixedBaseFeeMarket.satisfiesFloorTxFee(transaction)).isTrue();
+ }
+
+ @Test
+ public void satisfiesFloorTxCostWhenGasFeeIsZero() {
+ final Transaction transaction =
+ new TransactionTestFixture()
+ .type(TransactionType.EIP1559)
+ .maxFeePerGas(Optional.of(Wei.ZERO))
+ .maxPriorityFeePerGas(Optional.of(Wei.ZERO))
+ .gasPrice(null)
+ .createTransaction(KEY_PAIR1);
+ assertThat(fixedBaseFeeMarket.satisfiesFloorTxFee(transaction)).isFalse();
+ }
+
+ @Test
+ public void computeBaseFeeReturnsFixedValue() {
+ assertThat(fixedBaseFeeMarket.computeBaseFee(1L, Wei.of(1), 1L, 2L)).isEqualTo(Wei.ONE);
+ }
+
+ @Test
+ public void baseFeeValidationModeShouldBeNoneWhenIsForkBlock() {
+ assertThat(fixedBaseFeeMarket.baseFeeValidationMode(FORK_BLOCK))
+ .isEqualTo(BaseFeeMarket.ValidationMode.NONE);
+ }
+
+ @Test
+ public void baseFeeValidationModeShouldBeNoneWhenIsNotForkBlock() {
+ assertThat(fixedBaseFeeMarket.baseFeeValidationMode(FORK_BLOCK + 1))
+ .isEqualTo(BaseFeeMarket.ValidationMode.NONE);
+ }
+
+ @Test
+ public void gasLimitValidationModeShouldBeInitialWhenIsForkBlock() {
+ assertThat(fixedBaseFeeMarket.gasLimitValidationMode(FORK_BLOCK))
+ .isEqualTo(BaseFeeMarket.ValidationMode.INITIAL);
+ }
+
+ @Test
+ public void gasLimitValidationModeShouldBeOngoingWhenIsNotForkBlock() {
+ assertThat(fixedBaseFeeMarket.gasLimitValidationMode(FORK_BLOCK + 1))
+ .isEqualTo(BaseFeeMarket.ValidationMode.ONGOING);
+ }
+
+ @Test
+ public void isBeforeForkBlockShouldBeTrue() {
+ final FixedBaseFeeMarket fixedBaseFeeMarket = new FixedBaseFeeMarket(10, Wei.ONE);
+ assertThat(fixedBaseFeeMarket.isBeforeForkBlock(9)).isTrue();
+ }
+
+ @Test
+ public void isBeforeForkBlockShouldBeFalse() {
+ final FixedBaseFeeMarket fixedBaseFeeMarket = new FixedBaseFeeMarket(10, Wei.ONE);
+ assertThat(fixedBaseFeeMarket.isBeforeForkBlock(10)).isFalse();
+ assertThat(fixedBaseFeeMarket.isBeforeForkBlock(11)).isFalse();
+ }
+
+ @Test
+ public void implementsDataFeedShouldReturnFalse() {
+ assertThat(fixedBaseFeeMarket.implementsDataFee()).isFalse();
+ }
+
+ @Test
+ public void dataPriceShouldReturnsZero() {
+ assertThat(fixedBaseFeeMarket.blobGasPricePerGas(BlobGas.ONE)).isEqualTo(Wei.ZERO);
+ }
+}
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java
index ca2cfe4d565..2cd1936b3ab 100644
--- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java
@@ -128,4 +128,29 @@ public void shouldReturnTrueIfUsingZeroBaseFeeMarketOnNonZeroLondonForkBlock() {
blockHeader(FORK_BLOCK - 1, 0, Optional.of(londonFeeMarketBaseFee))))
.isTrue();
}
+
+ @Test
+ public void shouldReturnTrueIfUsingFixedBaseFeeMarket() {
+ final BaseFeeMarket fixedBaseFeeMarket = FeeMarket.fixedBaseFee(FORK_BLOCK, Wei.ONE);
+ final var validationRule =
+ new BaseFeeMarketBlockHeaderGasPriceValidationRule(fixedBaseFeeMarket);
+ assertThat(
+ validationRule.validate(
+ blockHeader(FORK_BLOCK + 2, 0, Optional.of(fixedBaseFeeMarket.getInitialBasefee())),
+ blockHeader(FORK_BLOCK + 1, 0, Optional.of(feeMarket.getInitialBasefee()), 2)))
+ .isTrue();
+ }
+
+ @Test
+ public void shouldReturnTrueIfUsingFixedBaseFeeMarketOnNonZeroLondonForkBlock() {
+ final BaseFeeMarket zeroBaseFeeMarket = FeeMarket.fixedBaseFee(FORK_BLOCK, Wei.ONE);
+ final var validationRule =
+ new BaseFeeMarketBlockHeaderGasPriceValidationRule(zeroBaseFeeMarket);
+ final Wei londonFeeMarketBaseFee = feeMarket.getInitialBasefee();
+ assertThat(
+ validationRule.validate(
+ blockHeader(FORK_BLOCK, 0, Optional.of(londonFeeMarketBaseFee)),
+ blockHeader(FORK_BLOCK - 1, 0, Optional.of(londonFeeMarketBaseFee))))
+ .isTrue();
+ }
}
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleFixedBaseFeeMarketTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleFixedBaseFeeMarketTest.java
new file mode 100644
index 00000000000..7f2387cdca0
--- /dev/null
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleFixedBaseFeeMarketTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright Hyperledger Besu Contributors.
+ *
+ * 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.ethereum.mainnet.headervalidationrules;
+
+import static java.lang.Long.MAX_VALUE;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.hyperledger.besu.datatypes.Wei;
+import org.hyperledger.besu.ethereum.core.BlockHeader;
+import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
+import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket;
+import org.hyperledger.besu.ethereum.mainnet.feemarket.FixedBaseFeeMarket;
+
+import java.util.Optional;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+public class GasLimitElasticityValidationRuleFixedBaseFeeMarketTest {
+
+ private static final Optional fixedBaseFeeMarket =
+ Optional.of(new FixedBaseFeeMarket(10, Wei.ONE));
+
+ public GasLimitRangeAndDeltaValidationRule uut =
+ new GasLimitRangeAndDeltaValidationRule(5000, MAX_VALUE, fixedBaseFeeMarket);
+
+ @ParameterizedTest
+ @CsvSource({
+ "20000000, 10000000, 10, true",
+ "20019530, 10000000, 10, true",
+ "20019531, 10000000, 10, false",
+ "19980470, 10000000, 10, true",
+ "19980469, 10000000, 10, false",
+ "20000000, 20000000, 11, true",
+ "20019530, 20000000, 11, true",
+ "20019531, 20000000, 11, false",
+ "19980470, 20000000, 11, true",
+ "19980469, 20000000, 11, false",
+ "40039061, 40000000, 11, true",
+ "40039062, 40000000, 11, false",
+ "39960939, 40000000, 11, true",
+ "39960938, 40000000, 11, false",
+ "4999, 40000000, 11, false"
+ })
+ public void test(
+ final long headerGasLimit,
+ final long parentGasLimit,
+ final long headerNumber,
+ final boolean expectedResult) {
+
+ final BlockHeaderTestFixture blockHeaderBuilder = new BlockHeaderTestFixture();
+
+ blockHeaderBuilder.number(headerNumber);
+ blockHeaderBuilder.gasLimit(headerGasLimit);
+ final BlockHeader header = blockHeaderBuilder.buildHeader();
+
+ blockHeaderBuilder.number(headerNumber - 1);
+ blockHeaderBuilder.gasLimit(parentGasLimit);
+ final BlockHeader parent = blockHeaderBuilder.buildHeader();
+
+ assertThat(uut.validate(header, parent)).isEqualTo(expectedResult);
+ }
+}
diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/AbstractIsolationTests.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/AbstractIsolationTests.java
index 33710bd4a4f..2d18bee3268 100644
--- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/AbstractIsolationTests.java
+++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/AbstractIsolationTests.java
@@ -105,7 +105,9 @@ public abstract class AbstractIsolationTests {
.createKeyPair(SECPPrivateKey.create(Bytes32.fromHexString(key), "ECDSA"));
protected final ProtocolSchedule protocolSchedule =
MainnetProtocolSchedule.fromConfig(
- GenesisConfigFile.development().getConfigOptions(), new BadBlockManager());
+ GenesisConfigFile.development().getConfigOptions(),
+ MiningParameters.MINING_DISABLED,
+ new BadBlockManager());
protected final GenesisState genesisState =
GenesisState.fromConfig(GenesisConfigFile.development(), protocolSchedule);
protected final MutableBlockchain blockchain = createInMemoryBlockchain(genesisState.getBlock());
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java
index 67a81b4518e..1a69dd1daba 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java
@@ -21,6 +21,7 @@
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
@@ -58,6 +59,7 @@ public void setup() {
GenesisConfigFile.development().getConfigOptions(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
}
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java
index f1720c61c50..08d2262c2d5 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java
@@ -17,6 +17,7 @@
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
@@ -65,6 +66,7 @@ public void blockHeadersRoundTrip() throws IOException {
GenesisConfigFile.development().getConfigOptions(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager()));
for (int i = 0; i < 50; ++i) {
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java
index 808005f858d..9912d66f381 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java
@@ -22,6 +22,7 @@
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.core.Difficulty;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule;
import org.hyperledger.besu.ethereum.eth.manager.ChainState;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
@@ -55,6 +56,7 @@ public class ChainHeadTrackerTest {
GenesisConfigFile.development().getConfigOptions(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
private final TrailingPeerLimiter trailingPeerLimiter = mock(TrailingPeerLimiter.class);
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java
index 5ee3192fa02..622d66587c7 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java
@@ -39,6 +39,7 @@
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
@@ -94,7 +95,8 @@ public class BackwardSyncContextTest {
@Spy
private ProtocolSchedule protocolSchedule =
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions(), new BadBlockManager());
+ MainnetProtocolSchedule.fromConfig(
+ new StubGenesisConfigOptions(), MiningParameters.MINING_DISABLED, new BadBlockManager());
@Spy
private ProtocolSpec protocolSpec =
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java
index 1656d7a7b48..a506e7fa3f7 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java
@@ -29,6 +29,7 @@
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
@@ -68,7 +69,8 @@ public class BackwardSyncStepTest {
private BackwardSyncContext context;
private final ProtocolSchedule protocolSchedule =
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions(), new BadBlockManager());
+ MainnetProtocolSchedule.fromConfig(
+ new StubGenesisConfigOptions(), MiningParameters.MINING_DISABLED, new BadBlockManager());
private final DeterministicEthScheduler ethScheduler = new DeterministicEthScheduler();
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java
index e8ae62d40b7..cb5cb0aed16 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java
@@ -31,6 +31,7 @@
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
@@ -74,7 +75,8 @@ public class ForwardSyncStepTest {
private RespondingEthPeer peer;
private final ProtocolSchedule protocolSchedule =
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions(), new BadBlockManager());
+ MainnetProtocolSchedule.fromConfig(
+ new StubGenesisConfigOptions(), MiningParameters.MINING_DISABLED, new BadBlockManager());
private MutableBlockchain localBlockchain;
GenericKeyValueStorageFacade headersStorage;
GenericKeyValueStorageFacade blocksStorage;
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java
index e811df51f1b..082b50796ed 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java
@@ -60,6 +60,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
@@ -195,6 +196,7 @@ protected static ExecutionContextTestFixture createExecutionContextTestFixtureBa
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
final ExecutionContextTestFixture executionContextTestFixture =
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java
index 762e7cf7a94..62dde1f8f41 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java
@@ -116,6 +116,7 @@ public TestNode(
GenesisConfigFile.development().getConfigOptions(),
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager());
final GenesisState genesisState = GenesisState.fromConfig(genesisConfigFile, protocolSchedule);
diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java
index 422f21a8705..5410cfc92d7 100644
--- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java
+++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java
@@ -366,6 +366,7 @@ private void setupScheduleWith(final StubGenesisConfigOptions config) {
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
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 8f18a796592..5b5f2e0fb8b 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
@@ -21,6 +21,7 @@
import org.hyperledger.besu.crypto.SignatureAlgorithmType;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
@@ -76,7 +77,7 @@ ProtocolSchedule provideProtocolSchedule(
}
}
return MainnetProtocolSchedule.fromConfig(
- configOptions, evmConfiguration, new BadBlockManager());
+ configOptions, evmConfiguration, MiningParameters.newDefault(), new BadBlockManager());
}
public static Map> createSchedules() {
@@ -134,6 +135,7 @@ private static Supplier createSchedule(final GenesisConfigOpti
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
}
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 dae9badfd1b..0a137c4ea82 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
@@ -18,6 +18,7 @@
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder;
@@ -106,6 +107,7 @@ private static ProtocolSchedule createSchedule(final GenesisConfigOptions option
PrivacyParameters.DEFAULT,
false,
EvmConfiguration.DEFAULT,
+ MiningParameters.MINING_DISABLED,
new BadBlockManager())
.createProtocolSchedule();
}
diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java
index df9fac4bdc2..6377b1ae3ba 100644
--- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java
+++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java
@@ -27,6 +27,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder;
import org.hyperledger.besu.ethereum.core.Difficulty;
+import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.log.LogsBloomFilter;
@@ -58,64 +59,64 @@ public static Stream getTestParametersForConfig() throws IOException
MainnetProtocolSchedule.fromConfig(
GenesisConfigFile.mainnet()
.getConfigOptions(postMergeOverrides),
- EvmConfiguration.DEFAULT, new BadBlockManager())),
+ EvmConfiguration.DEFAULT, MiningParameters.newDefault(), new BadBlockManager())),
Arguments.of(
"/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierForkBlock.json",
MainnetProtocolSchedule.fromConfig(
- new StubGenesisConfigOptions().grayGlacierBlock(15050000), new BadBlockManager())
+ new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierTimeDiff1.json",
MainnetProtocolSchedule.fromConfig(
- new StubGenesisConfigOptions().grayGlacierBlock(15050000), new BadBlockManager())
+ new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierTimeDiff2.json",
MainnetProtocolSchedule.fromConfig(
- new StubGenesisConfigOptions().grayGlacierBlock(15050000), new BadBlockManager())
+ new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfArrowGlacier/difficultyArrowGlacierForkBlock.json",
MainnetProtocolSchedule.fromConfig(
- new StubGenesisConfigOptions().arrowGlacierBlock(13773000), new BadBlockManager())
+ new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfArrowGlacier/difficultyArrowGlacierTimeDiff1.json",
MainnetProtocolSchedule.fromConfig(
- new StubGenesisConfigOptions().arrowGlacierBlock(13773000), new BadBlockManager())
+ new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfArrowGlacier/difficultyArrowGlacierTimeDiff2.json",
MainnetProtocolSchedule.fromConfig(
- new StubGenesisConfigOptions().arrowGlacierBlock(13773000), new BadBlockManager())
+ new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfByzantium/difficultyByzantium.json",
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().byzantiumBlock(0), new BadBlockManager())
+ MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().byzantiumBlock(0), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfConstantinople/difficultyConstantinople.json",
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().constantinopleBlock(0), new BadBlockManager())
+ MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().constantinopleBlock(0), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfEIP2384/difficultyEIP2384.json",
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), new BadBlockManager())
+ MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfEIP2384/difficultyEIP2384_random.json",
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), new BadBlockManager())
+ MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfEIP2384/difficultyEIP2384_random_to20M.json",
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), new BadBlockManager())
+ MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfFrontier/difficultyFrontier.json",
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions(), new BadBlockManager())
+ MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions(), MiningParameters.newDefault(), new BadBlockManager())
),
Arguments.of(
"/DifficultyTests/dfHomestead/difficultyHomestead.json",
- MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().homesteadBlock(0), new BadBlockManager())
+ MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().homesteadBlock(0), MiningParameters.newDefault(), new BadBlockManager())
));
}
diff --git a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/RetestethContext.java b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/RetestethContext.java
index a9b5050be37..e34d9f44731 100644
--- a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/RetestethContext.java
+++ b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/RetestethContext.java
@@ -158,7 +158,7 @@ private boolean buildContext(
JsonUtil.getObjectNode(genesisConfig, "config").get());
protocolSchedule =
MainnetProtocolSchedule.fromConfig(
- jsonGenesisConfigOptions, EvmConfiguration.DEFAULT, badBlockManager);
+ jsonGenesisConfigOptions, EvmConfiguration.DEFAULT, miningParameters, badBlockManager);
if ("NoReward".equalsIgnoreCase(sealEngine)) {
protocolSchedule = new NoRewardProtocolScheduleWrapper(protocolSchedule, badBlockManager);
}