mirror of
https://github.com/vacp2p/status-linea-besu.git
synced 2026-01-08 21:38:15 -05:00
feat: add fixed basefee options (#6562)
* feat: add fixed basefee options Signed-off-by: Suraneti Rodsuwan <suraneti.rod@gmail.com> * Refactor zero base fee to be extension of fixed base fee Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * feat: use MiningParameters to fixed base fee Signed-off-by: Suraneti Rodsuwan <suraneti.rod@gmail.com> * feat: add mining parameters arg on protocol schedule builder * feat: add miningParameters on gray glacier and prague Signed-off-by: Suraneti Rodsuwan <suraneti.rod@gmail.com> * feat: add miningParameters on gray glacier and prague Signed-off-by: Suraneti Rodsuwan <suraneti.rod@gmail.com> * feat: add miningParameters on paris,shanghai,future,experimental Signed-off-by: Suraneti Rodsuwan <suraneti.rod@gmail.com> --------- Signed-off-by: Suraneti Rodsuwan <suraneti.rod@gmail.com> Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> Signed-off-by: Suraneti <suraneti.rod@gmail.com> Co-authored-by: Matthew Whitehead <matthew1001@gmail.com> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
This commit is contained in:
@@ -130,6 +130,7 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -286,6 +286,7 @@ public class IbftBesuControllerBuilder extends BftBesuControllerBuilder {
|
||||
isRevertReasonEnabled,
|
||||
bftExtraDataCodec().get(),
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ public class MainnetBesuControllerBuilder extends BesuControllerBuilder {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,11 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder {
|
||||
@Override
|
||||
protected ProtocolSchedule createProtocolSchedule() {
|
||||
return MergeProtocolSchedule.create(
|
||||
configOptionsSupplier.get(), privacyParameters, isRevertReasonEnabled, badBlockManager);
|
||||
configOptionsSupplier.get(),
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -326,6 +326,7 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder {
|
||||
isRevertReasonEnabled,
|
||||
bftExtraDataCodec().get(),
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.chain.Blockchain;
|
||||
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 @@ public class ForkIdsNetworkConfigTest {
|
||||
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);
|
||||
|
||||
@@ -504,6 +504,13 @@ public interface GenesisConfigOptions {
|
||||
*/
|
||||
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
|
||||
|
||||
@@ -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 class JsonGenesisConfigOptions implements GenesisConfigOptions {
|
||||
return getOptionalBoolean(ZERO_BASE_FEE_KEY).orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFixedBaseFee() {
|
||||
return getOptionalBoolean(FIXED_BASE_FEE_KEY).orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Address> getDepositContractAddress() {
|
||||
Optional<String> inputAddress = JsonUtil.getString(configRoot, DEPOSIT_CONTRACT_ADDRESS_KEY);
|
||||
@@ -492,6 +498,10 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
|
||||
builder.put("zeroBaseFee", true);
|
||||
}
|
||||
|
||||
if (isFixedBaseFee()) {
|
||||
builder.put("fixedBaseFee", true);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -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 class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
|
||||
return zeroBaseFee;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFixedBaseFee() {
|
||||
return fixedBaseFee;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getForkBlockNumbers() {
|
||||
return Collections.emptyList();
|
||||
@@ -704,6 +710,17 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -295,6 +295,27 @@ class GenesisConfigOptionsTest {
|
||||
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 =
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.hyperledger.besu.cryptoservices.NodeKey;
|
||||
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 class CliqueProtocolSchedule {
|
||||
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 class CliqueProtocolSchedule {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager)
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
@@ -115,6 +119,7 @@ public class CliqueProtocolSchedule {
|
||||
* @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 class CliqueProtocolSchedule {
|
||||
final NodeKey nodeKey,
|
||||
final boolean isRevertReasonEnabled,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
return create(
|
||||
config,
|
||||
@@ -133,6 +139,7 @@ public class CliqueProtocolSchedule {
|
||||
PrivacyParameters.DEFAULT,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.hyperledger.besu.datatypes.Wei;
|
||||
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 class CliqueProtocolScheduleTest {
|
||||
NODE_KEY,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
final ProtocolSpec homesteadSpec = protocolSchedule.getByBlockHeader(blockHeader(1));
|
||||
@@ -89,6 +91,7 @@ public class CliqueProtocolScheduleTest {
|
||||
NODE_KEY,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.getByBlockHeader(blockHeader(0));
|
||||
|
||||
@@ -112,6 +115,7 @@ public class CliqueProtocolScheduleTest {
|
||||
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 class CliqueProtocolScheduleTest {
|
||||
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 class CliqueProtocolScheduleTest {
|
||||
NODE_KEY,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
BlockHeader emptyFrontierParent =
|
||||
|
||||
@@ -106,6 +106,7 @@ public class CliqueBlockCreatorTest {
|
||||
proposerNodeKey,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
final Address otherAddress = Util.publicKeyToAddress(otherKeyPair.getPublicKey());
|
||||
|
||||
@@ -104,6 +104,7 @@ public class CliqueMinerExecutorTest {
|
||||
proposerNodeKey,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
cliqueEthContext = mock(EthContext.class, RETURNS_DEEP_STUBS);
|
||||
blockHeaderBuilder = new BlockHeaderTestFixture();
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.hyperledger.besu.config.GenesisConfigOptions;
|
||||
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 abstract class BaseBftProtocolScheduleBuilder {
|
||||
final boolean isRevertReasonEnabled,
|
||||
final BftExtraDataCodec bftExtraDataCodec,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
final Map<Long, Function<ProtocolSpecBuilder, ProtocolSpecBuilder>> specMap = new HashMap<>();
|
||||
|
||||
@@ -83,6 +86,7 @@ public abstract class BaseBftProtocolScheduleBuilder {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager)
|
||||
.createProtocolSchedule();
|
||||
return new BftProtocolSchedule((DefaultProtocolSchedule) protocolSchedule);
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions;
|
||||
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 @@ public class CombinedProtocolScheduleFactoryTest {
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
return new BftProtocolSchedule(
|
||||
|
||||
@@ -31,6 +31,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.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 @@ public class BaseBftProtocolScheduleBuilderTest {
|
||||
false,
|
||||
bftExtraDataCodec,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
}
|
||||
|
||||
|
||||
@@ -332,6 +332,7 @@ public class TestContextBuilder {
|
||||
forksSchedule,
|
||||
IBFT_EXTRA_DATA_ENCODER,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.hyperledger.besu.consensus.common.bft.BaseBftProtocolScheduleBuilder;
|
||||
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 class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
final boolean isRevertReasonEnabled,
|
||||
final BftExtraDataCodec bftExtraDataCodec,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
return new IbftProtocolScheduleBuilder()
|
||||
.createProtocolSchedule(
|
||||
@@ -60,6 +63,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
isRevertReasonEnabled,
|
||||
bftExtraDataCodec,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
@@ -70,6 +74,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
* @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 class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
final ForksSchedule<BftConfigOptions> forksSchedule,
|
||||
final BftExtraDataCodec bftExtraDataCodec,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
return create(
|
||||
config,
|
||||
@@ -86,6 +92,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
false,
|
||||
bftExtraDataCodec,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext;
|
||||
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 @@ public class IbftProtocolScheduleTest {
|
||||
false,
|
||||
bftExtraDataCodec,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ public class BftBlockCreatorTest {
|
||||
false,
|
||||
bftExtraDataEncoder,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
final ProtocolContext protContext =
|
||||
new ProtocolContext(
|
||||
|
||||
@@ -69,6 +69,7 @@ import org.hyperledger.besu.ethereum.core.Block;
|
||||
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 class IbftBlockHeightManagerTest {
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
ProtocolSchedule protocolSchedule =
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.hyperledger.besu.consensus.merge;
|
||||
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 class MergeProtocolSchedule {
|
||||
* @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 class MergeProtocolSchedule {
|
||||
final GenesisConfigOptions config,
|
||||
final PrivacyParameters privacyParameters,
|
||||
final boolean isRevertReasonEnabled,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
|
||||
Map<Long, Function<ProtocolSpecBuilder, ProtocolSpecBuilder>> postMergeModifications =
|
||||
@@ -84,6 +94,7 @@ public class MergeProtocolSchedule {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
EvmConfiguration.DEFAULT,
|
||||
miningParameters,
|
||||
badBlockManager)
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext;
|
||||
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 class TransitionProtocolSchedule implements ProtocolSchedule {
|
||||
*
|
||||
* @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());
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.hyperledger.besu.datatypes.Wei;
|
||||
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 class MergeProtocolScheduleTest {
|
||||
|
||||
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 class MergeProtocolScheduleTest {
|
||||
|
||||
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 class MergeProtocolScheduleTest {
|
||||
|
||||
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 class MergeProtocolScheduleTest {
|
||||
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 class MergeProtocolScheduleTest {
|
||||
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");
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
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 @@ public interface MergeGenesisConfigHelper {
|
||||
|
||||
default ProtocolSchedule getMergeProtocolSchedule() {
|
||||
return MergeProtocolSchedule.create(
|
||||
getPosGenesisConfigFile().getConfigOptions(), false, new BadBlockManager());
|
||||
getPosGenesisConfigFile().getConfigOptions(),
|
||||
false,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ public class TestContextBuilder {
|
||||
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 class TestContextBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TestContextBuilder useFixedBaseFee(final boolean useFixedBaseFee) {
|
||||
this.useFixedBaseFee = useFixedBaseFee;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TestContextBuilder qbftForks(final List<QbftFork> qbftForks) {
|
||||
this.qbftForks = qbftForks;
|
||||
return this;
|
||||
@@ -294,6 +300,7 @@ public class TestContextBuilder {
|
||||
useLondonMilestone,
|
||||
useShanghaiMilestone,
|
||||
useZeroBaseFee,
|
||||
useFixedBaseFee,
|
||||
qbftForks);
|
||||
|
||||
// Add each networkNode to the Multicaster (such that each can receive msgs from local node).
|
||||
@@ -375,6 +382,7 @@ public class TestContextBuilder {
|
||||
final boolean useLondonMilestone,
|
||||
final boolean useShanghaiMilestone,
|
||||
final boolean useZeroBaseFee,
|
||||
final boolean useFixedBaseFee,
|
||||
final List<QbftFork> qbftForks) {
|
||||
|
||||
final MiningParameters miningParams =
|
||||
@@ -407,6 +415,9 @@ public class TestContextBuilder {
|
||||
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 @@ public class TestContextBuilder {
|
||||
forksSchedule,
|
||||
BFT_EXTRA_DATA_ENCODER,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
final BftValidatorOverrides validatorOverrides = convertBftForks(qbftForks);
|
||||
|
||||
@@ -167,6 +167,57 @@ public class ValidatorContractTest {
|
||||
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<QbftFork> qbftForks =
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.hyperledger.besu.consensus.common.bft.BaseBftProtocolScheduleBuilder;
|
||||
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 class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
final boolean isRevertReasonEnabled,
|
||||
final BftExtraDataCodec bftExtraDataCodec,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
return new QbftProtocolScheduleBuilder()
|
||||
.createProtocolSchedule(
|
||||
@@ -64,6 +67,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
isRevertReasonEnabled,
|
||||
bftExtraDataCodec,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
@@ -74,6 +78,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
* @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 class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
final ForksSchedule<QbftConfigOptions> qbftForksSchedule,
|
||||
final BftExtraDataCodec bftExtraDataCodec,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
return create(
|
||||
config,
|
||||
@@ -90,6 +96,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
false,
|
||||
bftExtraDataCodec,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
@@ -100,6 +107,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
* @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 class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
final ForksSchedule<QbftConfigOptions> qbftForksSchedule,
|
||||
final boolean isRevertReasonEnabled,
|
||||
final BftExtraDataCodec bftExtraDataCodec,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
return create(
|
||||
config,
|
||||
@@ -116,6 +125,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder
|
||||
isRevertReasonEnabled,
|
||||
bftExtraDataCodec,
|
||||
EvmConfiguration.DEFAULT,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext;
|
||||
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 @@ public class QbftProtocolScheduleTest {
|
||||
false,
|
||||
bftExtraDataCodec,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ import org.hyperledger.besu.ethereum.core.Block;
|
||||
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 class QbftBlockHeightManagerTest {
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
ProtocolSchedule protocolSchedule =
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager;
|
||||
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<>();
|
||||
|
||||
@@ -108,6 +108,7 @@ public class JsonRpcHttpServiceHostAllowlistTest {
|
||||
synchronizer,
|
||||
MainnetProtocolSchedule.fromConfig(
|
||||
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager()),
|
||||
mock(ProtocolContext.class),
|
||||
mock(FilterManager.class),
|
||||
|
||||
@@ -137,7 +137,8 @@ public class JsonRpcHttpServiceLoginTest {
|
||||
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),
|
||||
|
||||
@@ -118,6 +118,7 @@ public class JsonRpcHttpServiceTestBase {
|
||||
MainnetProtocolSchedule.fromConfig(
|
||||
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager()),
|
||||
mock(ProtocolContext.class),
|
||||
mock(FilterManager.class),
|
||||
|
||||
@@ -122,6 +122,7 @@ public class JsonRpcHttpServiceTlsClientAuthTest {
|
||||
synchronizer,
|
||||
MainnetProtocolSchedule.fromConfig(
|
||||
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager()),
|
||||
mock(ProtocolContext.class),
|
||||
mock(FilterManager.class),
|
||||
|
||||
@@ -110,6 +110,7 @@ class JsonRpcHttpServiceTlsMisconfigurationTest {
|
||||
synchronizer,
|
||||
MainnetProtocolSchedule.fromConfig(
|
||||
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager()),
|
||||
mock(ProtocolContext.class),
|
||||
mock(FilterManager.class),
|
||||
|
||||
@@ -111,6 +111,7 @@ public class JsonRpcHttpServiceTlsTest {
|
||||
synchronizer,
|
||||
MainnetProtocolSchedule.fromConfig(
|
||||
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager()),
|
||||
mock(ProtocolContext.class),
|
||||
mock(FilterManager.class),
|
||||
|
||||
@@ -173,7 +173,10 @@ public class WebSocketServiceLoginTest {
|
||||
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),
|
||||
|
||||
@@ -364,6 +364,7 @@ abstract class AbstractBlockCreatorTest {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule())
|
||||
.build();
|
||||
|
||||
@@ -221,6 +221,7 @@ public abstract class AbstractBlockTransactionSelectorTest {
|
||||
FixedDifficultyProtocolSchedule.create(
|
||||
GenesisConfigFile.development().getConfigOptions(),
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
final MainnetTransactionProcessor mainnetTransactionProcessor =
|
||||
protocolSchedule.getByBlockHeader(blockHeader(0)).getTransactionProcessor();
|
||||
|
||||
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.when;
|
||||
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 @@ public class LegacyFeeMarketBlockTransactionSelectorTest
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public class LondonFeeMarketBlockTransactionSelectorTest
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule())
|
||||
.build();
|
||||
@@ -148,6 +149,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule())
|
||||
.build();
|
||||
@@ -193,6 +195,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
final ExecutionContextTestFixture executionContextTestFixture =
|
||||
@@ -261,6 +264,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
final ExecutionContextTestFixture executionContextTestFixture =
|
||||
|
||||
@@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.difficulty.fixed;
|
||||
|
||||
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 class FixedDifficultyProtocolSchedule {
|
||||
final PrivacyParameters privacyParameters,
|
||||
final boolean isRevertReasonEnabled,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
return new ProtocolScheduleBuilder(
|
||||
config,
|
||||
@@ -40,6 +42,7 @@ public class FixedDifficultyProtocolSchedule {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager)
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
@@ -48,19 +51,28 @@ public class FixedDifficultyProtocolSchedule {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.mainnet;
|
||||
|
||||
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 class MainnetProtocolSchedule {
|
||||
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 class MainnetProtocolSchedule {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager)
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
@@ -68,6 +77,7 @@ public class MainnetProtocolSchedule {
|
||||
* 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 class MainnetProtocolSchedule {
|
||||
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 class MainnetProtocolSchedule {
|
||||
* @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 class MainnetProtocolSchedule {
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<BigInteger> chainId,
|
||||
@@ -37,13 +39,15 @@ public class 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 class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
public ProtocolSpecBuilder arrowGlacierDefinition(
|
||||
@@ -124,7 +129,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
public ProtocolSpecBuilder grayGlacierDefinition(
|
||||
@@ -135,7 +141,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
public ProtocolSpecBuilder parisDefinition(final GenesisConfigOptions genesisConfigOptions) {
|
||||
@@ -145,7 +152,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
public ProtocolSpecBuilder shanghaiDefinition(final GenesisConfigOptions genesisConfigOptions) {
|
||||
@@ -155,7 +163,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
public ProtocolSpecBuilder cancunDefinition(final GenesisConfigOptions genesisConfigOptions) {
|
||||
@@ -165,7 +174,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
public ProtocolSpecBuilder pragueDefinition(final GenesisConfigOptions genesisConfigOptions) {
|
||||
@@ -175,7 +185,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,7 +207,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +229,8 @@ public class MainnetProtocolSpecFactory {
|
||||
evmStackSize,
|
||||
isRevertReasonEnabled,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.hyperledger.besu.ethereum.MainnetBlockValidator;
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
configStackSizeLimit,
|
||||
enableRevertReason,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration)
|
||||
evmConfiguration,
|
||||
miningParameters)
|
||||
.evmBuilder(
|
||||
(gasCalculator, jdCacheConfig) ->
|
||||
MainnetEVMs.paris(gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration))
|
||||
@@ -577,7 +588,8 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
configStackSizeLimit,
|
||||
enableRevertReason,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration)
|
||||
evmConfiguration,
|
||||
miningParameters)
|
||||
.feeMarket(cancunFeeMarket)
|
||||
// gas calculator for EIP-4844 blob gas
|
||||
.gasCalculator(CancunGasCalculator::new)
|
||||
@@ -710,7 +728,8 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
configStackSizeLimit,
|
||||
enableRevertReason,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration)
|
||||
evmConfiguration,
|
||||
miningParameters)
|
||||
// EVM changes to support EOF EIPs (3670, 4200, 4750, 5450)
|
||||
.gasCalculator(PragueGasCalculator::new)
|
||||
.evmBuilder(
|
||||
@@ -749,7 +769,8 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
configStackSizeLimit,
|
||||
enableRevertReason,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration)
|
||||
evmConfiguration,
|
||||
miningParameters)
|
||||
// Use Future EIP configured EVM
|
||||
.evmBuilder(
|
||||
(gasCalculator, jdCacheConfig) ->
|
||||
@@ -786,7 +808,8 @@ public abstract class MainnetProtocolSpecs {
|
||||
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 @@ public abstract class MainnetProtocolSpecs {
|
||||
configStackSizeLimit,
|
||||
enableRevertReason,
|
||||
genesisConfigOptions,
|
||||
evmConfiguration)
|
||||
evmConfiguration,
|
||||
miningParameters)
|
||||
.evmBuilder(
|
||||
(gasCalculator, jdCacheConfig) ->
|
||||
MainnetEVMs.experimentalEips(
|
||||
|
||||
@@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.mainnet;
|
||||
|
||||
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 class ProtocolScheduleBuilder {
|
||||
final PrivacyParameters privacyParameters,
|
||||
final boolean isRevertReasonEnabled,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
this(
|
||||
config,
|
||||
@@ -59,6 +62,7 @@ public class ProtocolScheduleBuilder {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
@@ -68,6 +72,7 @@ public class ProtocolScheduleBuilder {
|
||||
final PrivacyParameters privacyParameters,
|
||||
final boolean isRevertReasonEnabled,
|
||||
final EvmConfiguration evmConfiguration,
|
||||
final MiningParameters miningParameters,
|
||||
final BadBlockManager badBlockManager) {
|
||||
this(
|
||||
config,
|
||||
@@ -76,6 +81,7 @@ public class ProtocolScheduleBuilder {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
miningParameters,
|
||||
badBlockManager);
|
||||
}
|
||||
|
||||
@@ -86,6 +92,7 @@ public class 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 @@ public class ProtocolScheduleBuilder {
|
||||
this.isRevertReasonEnabled = isRevertReasonEnabled;
|
||||
this.evmConfiguration = evmConfiguration;
|
||||
this.defaultChainId = defaultChainId;
|
||||
this.miningParameters = miningParameters;
|
||||
this.badBlockManager = badBlockManager;
|
||||
}
|
||||
|
||||
@@ -113,7 +121,8 @@ public class ProtocolScheduleBuilder {
|
||||
config.getEvmStackSize(),
|
||||
isRevertReasonEnabled,
|
||||
config.getEcip1017EraRounds(),
|
||||
evmConfiguration);
|
||||
evmConfiguration,
|
||||
miningParameters);
|
||||
|
||||
validateForkOrdering();
|
||||
|
||||
|
||||
@@ -53,6 +53,10 @@ public interface FeeMarket {
|
||||
return new ZeroBaseFeeMarket(londonForkBlockNumber);
|
||||
}
|
||||
|
||||
static BaseFeeMarket fixedBaseFee(final long londonForkBlockNumber, final Wei fixedBaseFee) {
|
||||
return new FixedBaseFeeMarket(londonForkBlockNumber, fixedBaseFee);
|
||||
}
|
||||
|
||||
static FeeMarket legacy() {
|
||||
return new LegacyFeeMarket();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -16,22 +16,10 @@ package org.hyperledger.besu.ethereum.mainnet.feemarket;
|
||||
|
||||
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
|
||||
|
||||
@@ -142,7 +142,10 @@ public class BlockchainSetupUtil {
|
||||
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(
|
||||
|
||||
@@ -140,6 +140,7 @@ public class ExecutionContextTestFixture {
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class ProtocolScheduleFixture {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.newDefault(),
|
||||
new BadBlockManager());
|
||||
|
||||
private static GenesisConfigOptions getMainnetConfigOptions() {
|
||||
|
||||
@@ -20,6 +20,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.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 class FixedProtocolScheduleTest {
|
||||
FixedDifficultyProtocolSchedule.create(
|
||||
GenesisConfigFile.development().getConfigOptions(),
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
final BlockHeaderTestFixture headerBuilder = new BlockHeaderTestFixture();
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions;
|
||||
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 class DefaultProtocolScheduleTest {
|
||||
privacyParameters,
|
||||
isRevertReasonEnabled,
|
||||
evmConfiguration,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,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.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 class MainnetProtocolScheduleTest {
|
||||
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 class MainnetProtocolScheduleTest {
|
||||
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 class MainnetProtocolScheduleTest {
|
||||
MainnetProtocolSchedule.fromConfig(
|
||||
GenesisConfigFile.fromConfig(json).getConfigOptions(),
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager()));
|
||||
}
|
||||
|
||||
@@ -131,6 +135,7 @@ public class MainnetProtocolScheduleTest {
|
||||
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");
|
||||
|
||||
@@ -26,6 +26,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.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 @@ class ProtocolScheduleBuilderTest {
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
}
|
||||
|
||||
@@ -213,6 +215,7 @@ class ProtocolScheduleBuilderTest {
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
return new MilestoneStreamingProtocolSchedule(
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -128,4 +128,29 @@ public class BaseFeeMarketBlockHeaderGasPriceValidationRuleTest {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<BaseFeeMarket> 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);
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager;
|
||||
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 final class BlockBodiesMessageTest {
|
||||
GenesisConfigFile.development().getConfigOptions(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.hyperledger.besu.ethereum.eth.messages;
|
||||
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 final class BlockHeadersMessageTest {
|
||||
GenesisConfigFile.development().getConfigOptions(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager()));
|
||||
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager;
|
||||
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);
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
|
||||
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 =
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
|
||||
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();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
|
||||
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<Hash, BlockHeader> headersStorage;
|
||||
GenericKeyValueStorageFacade<Hash, Block> blocksStorage;
|
||||
|
||||
@@ -60,6 +60,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder;
|
||||
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 @@ public abstract class AbstractTransactionPoolTest {
|
||||
new PrivacyParameters(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
final ExecutionContextTestFixture executionContextTestFixture =
|
||||
|
||||
@@ -116,6 +116,7 @@ public class TestNode implements Closeable {
|
||||
GenesisConfigFile.development().getConfigOptions(),
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager());
|
||||
|
||||
final GenesisState genesisState = GenesisState.fromConfig(genesisConfigFile, protocolSchedule);
|
||||
|
||||
@@ -366,6 +366,7 @@ public class TransactionPoolFactoryTest {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.hyperledger.besu.crypto.SignatureAlgorithmFactory;
|
||||
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 @@ class MainnetGenesisFileModule extends GenesisFileModule {
|
||||
}
|
||||
}
|
||||
return MainnetProtocolSchedule.fromConfig(
|
||||
configOptions, evmConfiguration, new BadBlockManager());
|
||||
configOptions, evmConfiguration, MiningParameters.newDefault(), new BadBlockManager());
|
||||
}
|
||||
|
||||
public static Map<String, Supplier<ProtocolSchedule>> createSchedules() {
|
||||
@@ -134,6 +135,7 @@ class MainnetGenesisFileModule extends GenesisFileModule {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.hyperledger.besu.ethereum.referencetests;
|
||||
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 @@ public class ReferenceTestProtocolSchedules {
|
||||
PrivacyParameters.DEFAULT,
|
||||
false,
|
||||
EvmConfiguration.DEFAULT,
|
||||
MiningParameters.MINING_DISABLED,
|
||||
new BadBlockManager())
|
||||
.createProtocolSchedule();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager;
|
||||
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 class DifficultyCalculatorTests {
|
||||
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())
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ public class RetestethContext {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user