From 870f3b7857eb748bfa699f30e2ca8a45a6e35dfe Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Fri, 17 Jan 2025 05:55:29 +1000 Subject: [PATCH 1/3] default target gas limit for holesky (#8125) * default target gas limit for holesky --------- Signed-off-by: Sally MacFarlane Signed-off-by: Justin Florentine Co-authored-by: Justin Florentine --- CHANGELOG.md | 1 + .../org/hyperledger/besu/cli/BesuCommand.java | 7 +++ .../hyperledger/besu/cli/BesuCommandTest.java | 52 +++++++++++++++++++ .../ethereum/core/MiningConfiguration.java | 1 + 4 files changed, 61 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec39f72e065..fe2d341a3d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Improve debug_traceBlock calls performance and reduce output size [#8076](https://github.com/hyperledger/besu/pull/8076) - Add support for EIP-7702 transaction in the txpool [#8018](https://github.com/hyperledger/besu/pull/8018) [#7984](https://github.com/hyperledger/besu/pull/7984) - Add support for `movePrecompileToAddress` in `StateOverrides` (`eth_call`)[8115](https://github.com/hyperledger/besu/pull/8115) +- Default target-gas-limit to 36M for holesky [#8125](https://github.com/hyperledger/besu/pull/8125) - Add EIP-7623 - Increase calldata cost [#8093](https://github.com/hyperledger/besu/pull/8093) ### Bug fixes diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index edcc248ab34..8ee35458b2f 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -2132,6 +2132,13 @@ private MiningConfiguration getMiningParameters() { getGenesisBlockPeriodSeconds(genesisConfigOptionsSupplier.get()) .ifPresent(miningParameters::setBlockPeriodSeconds); initMiningParametersMetrics(miningParameters); + // if network = holesky, set targetGasLimit to 36,000,000 unless otherwise specified + if (miningParameters.getTargetGasLimit().isEmpty() && NetworkName.HOLESKY.equals(network)) { + logger.info( + "Setting target gas limit for holesky: {}", + MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY); + miningParameters.setTargetGasLimit(MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY); + } return miningParameters; } diff --git a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java index a8bcde0e27d..70cb4d507c4 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java @@ -1911,6 +1911,58 @@ public void holeskyValuesAreUsed() { verify(mockLogger, never()).warn(contains("Holesky is deprecated and will be shutdown")); } + @Test + public void holeskyTargetGasLimitIsSetToHoleskyDefaultWhenNoValueSpecified() { + parseCommand("--network", "holesky"); + + final ArgumentCaptor networkArg = + ArgumentCaptor.forClass(EthNetworkConfig.class); + + final ArgumentCaptor miningArg = + ArgumentCaptor.forClass(MiningConfiguration.class); + + verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any()); + verify(mockControllerBuilder).miningParameters(miningArg.capture()); + verify(mockControllerBuilder).build(); + + assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOLESKY)); + + assertThat(miningArg.getValue().getCoinbase()).isEqualTo(Optional.empty()); + assertThat(miningArg.getValue().getMinTransactionGasPrice()).isEqualTo(Wei.of(1000)); + assertThat(miningArg.getValue().getExtraData()).isEqualTo(Bytes.EMPTY); + assertThat(miningArg.getValue().getTargetGasLimit().getAsLong()) + .isEqualTo(MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY); + + assertThat(commandOutput.toString(UTF_8)).isEmpty(); + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + } + + @Test + public void holeskyTargetGasLimitIsSetToSpecifiedValueWhenValueSpecified() { + long customGasLimit = 99000000; + parseCommand("--network", "holesky", "--target-gas-limit", String.valueOf(customGasLimit)); + + final ArgumentCaptor networkArg = + ArgumentCaptor.forClass(EthNetworkConfig.class); + + final ArgumentCaptor miningArg = + ArgumentCaptor.forClass(MiningConfiguration.class); + + verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any()); + verify(mockControllerBuilder).miningParameters(miningArg.capture()); + verify(mockControllerBuilder).build(); + + assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOLESKY)); + + assertThat(miningArg.getValue().getCoinbase()).isEqualTo(Optional.empty()); + assertThat(miningArg.getValue().getMinTransactionGasPrice()).isEqualTo(Wei.of(1000)); + assertThat(miningArg.getValue().getExtraData()).isEqualTo(Bytes.EMPTY); + assertThat(miningArg.getValue().getTargetGasLimit().getAsLong()).isEqualTo(customGasLimit); + + assertThat(commandOutput.toString(UTF_8)).isEmpty(); + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + } + @Test public void luksoValuesAreUsed() { parseCommand("--network", "lukso"); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java index fb39d164b75..55ffd5ba7d7 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java @@ -35,6 +35,7 @@ @Value.Immutable @Value.Enclosing public abstract class MiningConfiguration { + public static final long DEFAULT_TARGET_GAS_LIMIT_HOLESKY = 36_000_000L; public static final PositiveNumber DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME = PositiveNumber.fromInt((int) Duration.ofSeconds(5).toMillis()); public static final PositiveNumber DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME = From 89632d774352f91d61023d1414ade77a83e1b6a2 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Fri, 17 Jan 2025 16:16:48 +1000 Subject: [PATCH 2/3] Unignore Prague ref tests and remove osakaTime from Prague (#8133) Signed-off-by: Simon Dudley --- .../referencetests/ReferenceTestProtocolSchedules.java | 9 +-------- .../besu/ethereum/vm/BlockchainReferenceTestTools.java | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java index 153f56d636a..7509f04c1cc 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java @@ -106,14 +106,7 @@ public static ReferenceTestProtocolSchedules create(final StubGenesisConfigOptio Map.entry( "CancunToPragueAtTime15k", createSchedule(genesisStub.clone().cancunTime(0).pragueTime(15000))), - Map.entry( - "Prague", - createSchedule( - genesisStub - .clone() - .pragueTime(0) - .osakaTime(0) // TODO remove this once osaka_devnet_0 ships - )), + Map.entry("Prague", createSchedule(genesisStub.clone().pragueTime(0))), Map.entry("Osaka", createSchedule(genesisStub.clone().osakaTime(0))), Map.entry("Amsterdam", createSchedule(genesisStub.clone().futureEipsTime(0))), Map.entry("Bogota", createSchedule(genesisStub.clone().futureEipsTime(0))), diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java index 1af785b02db..f4cb3dc67db 100644 --- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java +++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java @@ -91,9 +91,6 @@ public class BlockchainReferenceTestTools { // EOF tests don't have Prague stuff like deposits right now params.ignore("/stEOF/"); - // None of the Prague tests have withdrawals and deposits handling - params.ignore("\\[Prague\\]"); - // TODO: remove once updated EIP-2537 gas cost artifacts exist params.ignore("/eip2537_bls_12_381_precompiles/"); params.ignore("/stEIP2537/"); From a98e950eac005532a1134f6bb6301a2c4f9668b7 Mon Sep 17 00:00:00 2001 From: daniellehrner Date: Fri, 17 Jan 2025 13:09:39 +0100 Subject: [PATCH 3/3] Add baseFeeUpdateFraction to blobSchedule genesis config (#8128) * Add baseFeeUpdateFraction to blobSchedule genesis config Signed-off-by: Daniel Lehrner * added genesis file for CodeDelegationTransactionAcceptanceTest Signed-off-by: Daniel Lehrner * remove hard coded baseFeeUpdateFraction from CancunFeeMarket & PragueFeeMarket Signed-off-by: Daniel Lehrner * make FeeMarket constructors package private Signed-off-by: Daniel Lehrner --------- Signed-off-by: Daniel Lehrner --- .../src/test/resources/dev/dev_prague.json | 9 ++++--- .../MergeBesuControllerBuilderTest.java | 4 +-- .../besu/config/BlobScheduleOptions.java | 23 ++++++++++++---- config/src/main/resources/holesky.json | 12 +++++++++ config/src/main/resources/mainnet.json | 6 +++-- config/src/main/resources/sepolia.json | 12 +++++++++ .../besu/config/BlobScheduleOptionsTest.java | 3 +++ .../besu/config/GenesisConfigOptionsTest.java | 25 ++++++++++-------- .../resources/mainnet_with_blob_schedule.json | 9 ++++--- .../blockcreation/MergeCoordinatorTest.java | 4 +-- .../merge/blockcreation/MergeReorgTest.java | 4 +-- .../internal/methods/EthGasPriceTest.java | 9 +++---- .../methods/EthGetTransactionReceiptTest.java | 3 +-- .../methods/EthMaxPriorityFeePerGasTest.java | 4 +-- .../mainnet/MainnetProtocolSpecs.java | 23 ++++++++++------ .../mainnet/feemarket/CancunFeeMarket.java | 26 +++++++++++++++---- .../ethereum/mainnet/feemarket/FeeMarket.java | 14 ++++++++++ .../mainnet/feemarket/FixedBaseFeeMarket.java | 2 +- .../mainnet/feemarket/LegacyFeeMarket.java | 2 +- .../mainnet/feemarket/LondonFeeMarket.java | 7 +++-- .../mainnet/feemarket/PragueFeeMarket.java | 23 +++++++++------- .../mainnet/feemarket/ZeroBaseFeeMarket.java | 2 +- .../feemarket/CancunFeeMarketTest.java | 2 +- .../feemarket/LondonFeeMarketTest.java | 6 ++--- ...BlockHeaderGasPriceValidationRuleTest.java | 3 +-- ...yValidationRuleFixedBaseFeeMarketTest.java | 4 +-- .../GasLimitElasticityValidationRuleTest.java | 4 +-- ...tyValidationRuleZeroBaseFeeMarketTest.java | 4 +-- 28 files changed, 168 insertions(+), 81 deletions(-) diff --git a/acceptance-tests/tests/src/test/resources/dev/dev_prague.json b/acceptance-tests/tests/src/test/resources/dev/dev_prague.json index 7a7b56d9508..b5d08734291 100644 --- a/acceptance-tests/tests/src/test/resources/dev/dev_prague.json +++ b/acceptance-tests/tests/src/test/resources/dev/dev_prague.json @@ -18,15 +18,18 @@ "blobSchedule": { "cancun": { "target": 3, - "max": 6 + "max": 6, + "baseFeeUpdateFraction": 3338477 }, "prague": { "target": 6, - "max": 9 + "max": 9, + "baseFeeUpdateFraction": 5007716 }, "osaka": { "target": 9, - "max": 12 + "max": 12, + "baseFeeUpdateFraction": 5007716 } }, "clique": { diff --git a/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java index ce2dab822ff..4fe0735b022 100644 --- a/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java @@ -49,7 +49,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket; -import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket; +import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration; import org.hyperledger.besu.ethereum.storage.StorageProvider; import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStoragePrefixedKeyBlockchainStorage; @@ -106,7 +106,7 @@ public class MergeBesuControllerBuilderTest { BigInteger networkId = BigInteger.ONE; private final BlockHeaderTestFixture headerGenerator = new BlockHeaderTestFixture(); - private final BaseFeeMarket feeMarket = new LondonFeeMarket(0, Optional.of(Wei.of(42))); + private final BaseFeeMarket feeMarket = FeeMarket.london(0, Optional.of(Wei.of(42))); private final TransactionPoolConfiguration poolConfiguration = TransactionPoolConfiguration.DEFAULT; private final ObservableMetricsSystem observableMetricsSystem = new NoOpMetricsSystem(); diff --git a/config/src/main/java/org/hyperledger/besu/config/BlobScheduleOptions.java b/config/src/main/java/org/hyperledger/besu/config/BlobScheduleOptions.java index 1ad458fa398..289ed904bc6 100644 --- a/config/src/main/java/org/hyperledger/besu/config/BlobScheduleOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/BlobScheduleOptions.java @@ -82,15 +82,16 @@ public Map asMap() { public static class BlobSchedule { private final int target; private final int max; + private final int baseFeeUpdateFraction; /** The constant CANCUN_DEFAULT. */ - public static final BlobSchedule CANCUN_DEFAULT = new BlobSchedule(3, 6); + public static final BlobSchedule CANCUN_DEFAULT = new BlobSchedule(3, 6, 3338477); /** The constant PRAGUE_DEFAULT. */ - public static final BlobSchedule PRAGUE_DEFAULT = new BlobSchedule(6, 9); + public static final BlobSchedule PRAGUE_DEFAULT = new BlobSchedule(6, 9, 5007716); /** The constant OSAKA_DEFAULT. */ - public static final BlobSchedule OSAKA_DEFAULT = new BlobSchedule(9, 12); + public static final BlobSchedule OSAKA_DEFAULT = new BlobSchedule(9, 12, 5007716); /** * Instantiates a new Blob schedule. @@ -100,11 +101,14 @@ public static class BlobSchedule { public BlobSchedule(final ObjectNode blobScheduleConfigRoot) { this.target = JsonUtil.getInt(blobScheduleConfigRoot, "target").orElseThrow(); this.max = JsonUtil.getInt(blobScheduleConfigRoot, "max").orElseThrow(); + this.baseFeeUpdateFraction = + JsonUtil.getInt(blobScheduleConfigRoot, "basefeeupdatefraction").orElseThrow(); } - private BlobSchedule(final int target, final int max) { + private BlobSchedule(final int target, final int max, final int baseFeeUpdateFraction) { this.target = target; this.max = max; + this.baseFeeUpdateFraction = baseFeeUpdateFraction; } /** @@ -125,13 +129,22 @@ public int getMax() { return max; } + /** + * Gets base fee update fraction. + * + * @return the base fee update fraction + */ + public int getBaseFeeUpdateFraction() { + return baseFeeUpdateFraction; + } + /** * As map. * * @return the map */ Map asMap() { - return Map.of("target", target, "max", max); + return Map.of("target", target, "max", max, "baseFeeUpdateFraction", baseFeeUpdateFraction); } } } diff --git a/config/src/main/resources/holesky.json b/config/src/main/resources/holesky.json index ea83279953d..e1cc51a85c6 100644 --- a/config/src/main/resources/holesky.json +++ b/config/src/main/resources/holesky.json @@ -15,6 +15,18 @@ "terminalTotalDifficulty": 0, "shanghaiTime": 1696000704, "cancunTime": 1707305664, + "blobSchedule": { + "cancun": { + "target": 3, + "max": 6, + "baseFeeUpdateFraction": 3338477 + }, + "prague": { + "target": 6, + "max": 9, + "baseFeeUpdateFraction": 5007716 + } + }, "ethash": {}, "discovery": { "dns": "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.holesky.ethdisco.net", diff --git a/config/src/main/resources/mainnet.json b/config/src/main/resources/mainnet.json index 5a0fd8d725f..a90e620f153 100644 --- a/config/src/main/resources/mainnet.json +++ b/config/src/main/resources/mainnet.json @@ -19,11 +19,13 @@ "blobSchedule": { "cancun": { "target": 3, - "max": 6 + "max": 6, + "baseFeeUpdateFraction": 3338477 }, "prague": { "target": 6, - "max": 9 + "max": 9, + "baseFeeUpdateFraction": 5007716 } }, "ethash": { diff --git a/config/src/main/resources/sepolia.json b/config/src/main/resources/sepolia.json index 713e46ff640..60603893975 100644 --- a/config/src/main/resources/sepolia.json +++ b/config/src/main/resources/sepolia.json @@ -15,6 +15,18 @@ "terminalTotalDifficulty": 17000000000000000, "shanghaiTime": 1677557088, "cancunTime": 1706655072, + "blobSchedule": { + "cancun": { + "target": 3, + "max": 6, + "baseFeeUpdateFraction": 3338477 + }, + "prague": { + "target": 6, + "max": 9, + "baseFeeUpdateFraction": 5007716 + } + }, "ethash":{}, "discovery": { "dns": "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net", diff --git a/config/src/test/java/org/hyperledger/besu/config/BlobScheduleOptionsTest.java b/config/src/test/java/org/hyperledger/besu/config/BlobScheduleOptionsTest.java index fc746362929..608fd5dddc0 100644 --- a/config/src/test/java/org/hyperledger/besu/config/BlobScheduleOptionsTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/BlobScheduleOptionsTest.java @@ -31,11 +31,14 @@ public void blobScheduleIsParsed() { assertThat(blobScheduleOptions.getCancun()).isNotEmpty(); assertThat(blobScheduleOptions.getCancun().get().getTarget()).isEqualTo(4); assertThat(blobScheduleOptions.getCancun().get().getMax()).isEqualTo(7); + assertThat(blobScheduleOptions.getCancun().get().getBaseFeeUpdateFraction()).isEqualTo(3338477); assertThat(blobScheduleOptions.getPrague()).isNotEmpty(); assertThat(blobScheduleOptions.getPrague().get().getTarget()).isEqualTo(7); assertThat(blobScheduleOptions.getPrague().get().getMax()).isEqualTo(10); + assertThat(blobScheduleOptions.getPrague().get().getBaseFeeUpdateFraction()).isEqualTo(5007716); assertThat(blobScheduleOptions.getOsaka()).isNotEmpty(); assertThat(blobScheduleOptions.getOsaka().get().getTarget()).isEqualTo(10); assertThat(blobScheduleOptions.getOsaka().get().getMax()).isEqualTo(13); + assertThat(blobScheduleOptions.getOsaka().get().getBaseFeeUpdateFraction()).isEqualTo(5007716); } } diff --git a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java index 16622f35c21..d301462492f 100644 --- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java @@ -418,15 +418,18 @@ void asMapIncludesBlobFeeSchedule() { + " \"blobSchedule\": {\n" + " \"cancun\": {\n" + " \"target\": 1,\n" - + " \"max\": 2\n" + + " \"max\": 2,\n" + + " \"baseFeeUpdateFraction\": 3\n" + " },\n" + " \"prague\": {\n" - + " \"target\": 3,\n" - + " \"max\": 4\n" + + " \"target\": 4,\n" + + " \"max\": 5,\n" + + " \"baseFeeUpdateFraction\": 6\n" + " },\n" + " \"osaka\": {\n" - + " \"target\": 4,\n" - + " \"max\": 5\n" + + " \"target\": 7,\n" + + " \"max\": 8,\n" + + " \"baseFeeUpdateFraction\": 9\n" + " }\n" + " }\n" + " }\n" @@ -438,14 +441,14 @@ void asMapIncludesBlobFeeSchedule() { final Map blobSchedule = (Map) map.get("blobSchedule"); assertThat(blobSchedule).containsOnlyKeys("cancun", "prague", "osaka"); assertThat((Map) blobSchedule.get("cancun")) - .containsOnlyKeys("target", "max") - .containsValues(1, 2); + .containsOnlyKeys("target", "max", "baseFeeUpdateFraction") + .containsValues(1, 2, 3); assertThat((Map) blobSchedule.get("prague")) - .containsOnlyKeys("target", "max") - .containsValues(3, 4); + .containsOnlyKeys("target", "max", "baseFeeUpdateFraction") + .containsValues(4, 5, 6); assertThat((Map) blobSchedule.get("osaka")) - .containsOnlyKeys("target", "max") - .containsValues(4, 5); + .containsOnlyKeys("target", "max", "baseFeeUpdateFraction") + .containsValues(7, 8, 9); } private GenesisConfigOptions fromConfigOptions(final Map configOptions) { diff --git a/config/src/test/resources/mainnet_with_blob_schedule.json b/config/src/test/resources/mainnet_with_blob_schedule.json index b313a7dbabe..617bccd965b 100644 --- a/config/src/test/resources/mainnet_with_blob_schedule.json +++ b/config/src/test/resources/mainnet_with_blob_schedule.json @@ -19,15 +19,18 @@ "blobSchedule": { "cancun": { "target": 4, - "max": 7 + "max": 7, + "baseFeeUpdateFraction": 3338477 }, "prague": { "target": 7, - "max": 10 + "max": 10, + "baseFeeUpdateFraction": 5007716 }, "osaka": { "target": 10, - "max": 13 + "max": 13, + "baseFeeUpdateFraction": 5007716 } }, "depositContractAddress": "0x4242424242424242424242424242424242424242", diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java index ea1fa73eaa5..3cfdd70f52d 100644 --- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java +++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java @@ -73,7 +73,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.sorter.BaseFeePendingTransactionsSorter; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket; -import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket; +import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.ethereum.trie.MerkleTrieException; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; import org.hyperledger.besu.metrics.StubMetricsSystem; @@ -158,7 +158,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { private final Address suggestedFeeRecipient = Address.ZERO; private final BlockHeaderTestFixture headerGenerator = new BlockHeaderTestFixture(); private final BaseFeeMarket feeMarket = - new LondonFeeMarket(0, genesisState.getBlock().getHeader().getBaseFee()); + FeeMarket.london(0, genesisState.getBlock().getHeader().getBaseFee()); private final org.hyperledger.besu.metrics.StubMetricsSystem metricsSystem = new StubMetricsSystem(); diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java index 7ec2df35f23..cb8b3977a1a 100644 --- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java +++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java @@ -42,7 +42,7 @@ import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket; -import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket; +import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; import org.hyperledger.besu.testutil.DeterministicEthScheduler; import org.hyperledger.besu.util.LogConfigurator; @@ -81,7 +81,7 @@ public class MergeReorgTest implements MergeGenesisConfigHelper { private final Address coinbase = genesisAllocations(getPowGenesisConfig()).findFirst().get(); private final BlockHeaderTestFixture headerGenerator = new BlockHeaderTestFixture(); private final BaseFeeMarket feeMarket = - new LondonFeeMarket(0, genesisState.getBlock().getHeader().getBaseFee()); + FeeMarket.london(0, genesisState.getBlock().getHeader().getBaseFee()); @BeforeEach public void setUp() { diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java index 6f3360821af..dcb07af6f77 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java @@ -43,10 +43,7 @@ import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; -import org.hyperledger.besu.ethereum.mainnet.feemarket.CancunFeeMarket; import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; -import org.hyperledger.besu.ethereum.mainnet.feemarket.LegacyFeeMarket; -import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket; import org.hyperledger.besu.evm.log.LogsBloomFilter; import java.util.HashMap; @@ -289,11 +286,11 @@ private void verifyGasPriceLimit( } private void mockBaseFeeMarket() { - mockFeeMarket(new LondonFeeMarket(0)); + mockFeeMarket(FeeMarket.london(0)); } private void mockGasPriceMarket() { - mockFeeMarket(new LegacyFeeMarket()); + mockFeeMarket(FeeMarket.legacy()); } private void mockFeeMarket(final FeeMarket feeMarket) { @@ -313,7 +310,7 @@ private void mockBlockchain( final var genesisBlock = createFakeBlock(0, 0, genesisBaseFee); blocksByNumber.put(0L, genesisBlock); - final var baseFeeMarket = new CancunFeeMarket(0, Optional.empty()); + final var baseFeeMarket = FeeMarket.cancun(0, Optional.empty()); var baseFee = genesisBaseFee; for (long i = 1; i <= chainHeadBlockNumber; i++) { diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java index 702f06c7ad4..9ec194c8bc5 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java @@ -48,7 +48,6 @@ import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; import org.hyperledger.besu.ethereum.mainnet.blockhash.FrontierBlockHashProcessor; -import org.hyperledger.besu.ethereum.mainnet.feemarket.CancunFeeMarket; import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; import org.hyperledger.besu.evm.gascalculator.CancunGasCalculator; @@ -322,7 +321,7 @@ private void mockBlockWithBlobTransaction(final Hash blockHash, final long block } private void mockProtocolSpec(final BlockHeader blockHeader) { - FeeMarket feeMarket = new CancunFeeMarket(0, Optional.empty()); + FeeMarket feeMarket = FeeMarket.cancun(0, Optional.empty()); ProtocolSpec spec = mock(ProtocolSpec.class); when(spec.getFeeMarket()).thenReturn(feeMarket); when(spec.getGasCalculator()).thenReturn(new CancunGasCalculator()); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java index 066f97c0d3f..b8ac2fa9c10 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java @@ -38,7 +38,7 @@ import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; -import org.hyperledger.besu.ethereum.mainnet.feemarket.CancunFeeMarket; +import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.evm.log.LogsBloomFilter; import java.math.BigInteger; @@ -148,7 +148,7 @@ private void mockBlockchain(final long chainHeadBlockNumber, final int txsNum) { final var genesisBlock = createFakeBlock(0, 0, genesisBaseFee); blocksByNumber.put(0L, genesisBlock); - final var baseFeeMarket = new CancunFeeMarket(0, Optional.empty()); + final var baseFeeMarket = FeeMarket.cancun(0, Optional.empty()); var baseFee = genesisBaseFee; for (long i = 1; i <= chainHeadBlockNumber; i++) { diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java index e366eaee010..686bed1dd84 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java @@ -677,6 +677,13 @@ static ProtocolSpecBuilder cancunDefinition( final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { final long londonForkBlockNumber = genesisConfigOptions.getLondonBlockNumber().orElse(0L); + + final var cancunBlobSchedule = + genesisConfigOptions + .getBlobScheduleOptions() + .flatMap(BlobScheduleOptions::getCancun) + .orElse(BlobScheduleOptions.BlobSchedule.CANCUN_DEFAULT); + final BaseFeeMarket cancunFeeMarket; if (genesisConfigOptions.isZeroBaseFee()) { cancunFeeMarket = FeeMarket.zeroBaseFee(londonForkBlockNumber); @@ -686,15 +693,12 @@ static ProtocolSpecBuilder cancunDefinition( londonForkBlockNumber, miningConfiguration.getMinTransactionGasPrice()); } else { cancunFeeMarket = - FeeMarket.cancun(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas()); + FeeMarket.cancun( + londonForkBlockNumber, + genesisConfigOptions.getBaseFeePerGas(), + cancunBlobSchedule.getBaseFeeUpdateFraction()); } - final var cancunBlobSchedule = - genesisConfigOptions - .getBlobScheduleOptions() - .flatMap(BlobScheduleOptions::getCancun) - .orElse(BlobScheduleOptions.BlobSchedule.CANCUN_DEFAULT); - final java.util.function.Supplier cancunGasCalcSupplier = () -> new CancunGasCalculator(cancunBlobSchedule.getTarget()); @@ -830,7 +834,10 @@ static ProtocolSpecBuilder pragueDefinition( londonForkBlockNumber, miningConfiguration.getMinTransactionGasPrice()); } else { pragueFeeMarket = - FeeMarket.prague(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas()); + FeeMarket.prague( + londonForkBlockNumber, + genesisConfigOptions.getBaseFeePerGas(), + pragueBlobSchedule.getBaseFeeUpdateFraction()); } return cancunDefinition( diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarket.java index e8642aef9cd..293a68f7807 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarket.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarket.java @@ -14,6 +14,7 @@ */ package org.hyperledger.besu.ethereum.mainnet.feemarket; +import org.hyperledger.besu.config.BlobScheduleOptions; import org.hyperledger.besu.datatypes.BlobGas; import org.hyperledger.besu.datatypes.Wei; @@ -26,11 +27,23 @@ public class CancunFeeMarket extends LondonFeeMarket { private static final Logger LOG = LoggerFactory.getLogger(CancunFeeMarket.class); protected static final BigInteger BLOB_GAS_PRICE = BigInteger.ONE; - private static final BigInteger BLOB_GAS_PRICE_UPDATE_FRACTION = BigInteger.valueOf(3338477); - public CancunFeeMarket( - final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { + private final BigInteger baseFeeUpdateFraction; + + CancunFeeMarket( + final long londonForkBlockNumber, + final Optional baseFeePerGasOverride, + final long baseFeeUpdateFraction) { super(londonForkBlockNumber, baseFeePerGasOverride); + + this.baseFeeUpdateFraction = BigInteger.valueOf(baseFeeUpdateFraction); + } + + CancunFeeMarket(final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { + this( + londonForkBlockNumber, + baseFeePerGasOverride, + BlobScheduleOptions.BlobSchedule.CANCUN_DEFAULT.getBaseFeeUpdateFraction()); } @Override @@ -42,8 +55,7 @@ public boolean implementsDataFee() { public Wei blobGasPricePerGas(final BlobGas excessBlobGas) { final var blobGasPrice = Wei.of( - fakeExponential( - BLOB_GAS_PRICE, excessBlobGas.toBigInteger(), BLOB_GAS_PRICE_UPDATE_FRACTION)); + fakeExponential(BLOB_GAS_PRICE, excessBlobGas.toBigInteger(), baseFeeUpdateFraction)); LOG.atTrace() .setMessage("parentExcessBlobGas: {} blobGasPrice: {}") .addArgument(excessBlobGas::toShortHexString) @@ -67,4 +79,8 @@ protected BigInteger fakeExponential( } return output.divide(denominator); } + + protected BigInteger getBaseFeeUpdateFraction() { + return baseFeeUpdateFraction; + } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java index 05f97647b77..72562c0b372 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java @@ -49,11 +49,25 @@ static BaseFeeMarket cancun( return new CancunFeeMarket(londonForkBlockNumber, baseFeePerGasOverride); } + static BaseFeeMarket cancun( + final long londonForkBlockNumber, + final Optional baseFeePerGasOverride, + final long baseFeeUpdateFraction) { + return new CancunFeeMarket(londonForkBlockNumber, baseFeePerGasOverride, baseFeeUpdateFraction); + } + static BaseFeeMarket prague( final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { return new PragueFeeMarket(londonForkBlockNumber, baseFeePerGasOverride); } + static BaseFeeMarket prague( + final long londonForkBlockNumber, + final Optional baseFeePerGasOverride, + final long baseFeeUpdateFraction) { + return new PragueFeeMarket(londonForkBlockNumber, baseFeePerGasOverride, baseFeeUpdateFraction); + } + static BaseFeeMarket zeroBaseFee(final long londonForkBlockNumber) { return new ZeroBaseFeeMarket(londonForkBlockNumber); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarket.java index e3155a74345..6b31d545350 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarket.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FixedBaseFeeMarket.java @@ -20,7 +20,7 @@ public class FixedBaseFeeMarket extends LondonFeeMarket { - public FixedBaseFeeMarket(final long londonForkBlockNumber, final Wei fixedBaseFee) { + FixedBaseFeeMarket(final long londonForkBlockNumber, final Wei fixedBaseFee) { super(londonForkBlockNumber, Optional.of(fixedBaseFee)); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LegacyFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LegacyFeeMarket.java index 8e73ec2948c..3fcb3b07961 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LegacyFeeMarket.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LegacyFeeMarket.java @@ -21,7 +21,7 @@ public class LegacyFeeMarket implements FeeMarket { private final TransactionPriceCalculator txPriceCalculator; - public LegacyFeeMarket() { + LegacyFeeMarket() { this.txPriceCalculator = TransactionPriceCalculator.frontier(); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java index 5ba94a78ad1..7830f0b7e1b 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java @@ -39,16 +39,15 @@ public class LondonFeeMarket implements BaseFeeMarket { private final TransactionPriceCalculator txPriceCalculator; private final Wei baseFeeFloor; - public LondonFeeMarket(final long londonForkBlockNumber) { + LondonFeeMarket(final long londonForkBlockNumber) { this(londonForkBlockNumber, Optional.empty()); } - public LondonFeeMarket( - final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { + LondonFeeMarket(final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { this(TransactionPriceCalculator.eip1559(), londonForkBlockNumber, baseFeePerGasOverride); } - protected LondonFeeMarket( + LondonFeeMarket( final TransactionPriceCalculator txPriceCalculator, final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/PragueFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/PragueFeeMarket.java index cff7cde0040..b33d92b3380 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/PragueFeeMarket.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/PragueFeeMarket.java @@ -14,23 +14,30 @@ */ package org.hyperledger.besu.ethereum.mainnet.feemarket; +import org.hyperledger.besu.config.BlobScheduleOptions; import org.hyperledger.besu.datatypes.BlobGas; import org.hyperledger.besu.datatypes.Wei; -import java.math.BigInteger; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PragueFeeMarket extends CancunFeeMarket { - private static final BigInteger BLOB_BASE_FEE_UPDATE_FRACTION_ELECTRA = - BigInteger.valueOf(5007716); private static final Logger LOG = LoggerFactory.getLogger(PragueFeeMarket.class); - public PragueFeeMarket( - final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { - super(londonForkBlockNumber, baseFeePerGasOverride); + PragueFeeMarket( + final long londonForkBlockNumber, + final Optional baseFeePerGasOverride, + final long baseFeeUpdateFraction) { + super(londonForkBlockNumber, baseFeePerGasOverride, baseFeeUpdateFraction); + } + + PragueFeeMarket(final long londonForkBlockNumber, final Optional baseFeePerGasOverride) { + this( + londonForkBlockNumber, + baseFeePerGasOverride, + BlobScheduleOptions.BlobSchedule.PRAGUE_DEFAULT.getBaseFeeUpdateFraction()); } @Override @@ -38,9 +45,7 @@ public Wei blobGasPricePerGas(final BlobGas excessBlobGas) { final var blobGasPrice = Wei.of( fakeExponential( - BLOB_GAS_PRICE, - excessBlobGas.toBigInteger(), - BLOB_BASE_FEE_UPDATE_FRACTION_ELECTRA)); + BLOB_GAS_PRICE, excessBlobGas.toBigInteger(), getBaseFeeUpdateFraction())); LOG.atTrace() .setMessage("parentExcessBlobGas: {} blobGasPrice: {}") .addArgument(excessBlobGas::toShortHexString) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java index 156d1d9926b..517385bdeaa 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/ZeroBaseFeeMarket.java @@ -18,7 +18,7 @@ public class ZeroBaseFeeMarket extends FixedBaseFeeMarket { - public ZeroBaseFeeMarket(final long londonForkBlockNumber) { + ZeroBaseFeeMarket(final long londonForkBlockNumber) { super(londonForkBlockNumber, Wei.ZERO); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarketTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarketTest.java index 06fe62de581..8edd2a9f928 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarketTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/CancunFeeMarketTest.java @@ -30,7 +30,7 @@ class CancunFeeMarketTest { @Test void dataPricePerGas() { - CancunFeeMarket cancunFeeMarket = new CancunFeeMarket(0, Optional.empty()); + final BaseFeeMarket cancunFeeMarket = FeeMarket.cancun(0, Optional.empty()); // when no excess blob gas, data price per gas is 1 assertEquals(1, cancunFeeMarket.blobGasPricePerGas(BlobGas.ZERO).getAsBigInteger().intValue()); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarketTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarketTest.java index 032ede3a8ee..4aecb021e0d 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarketTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarketTest.java @@ -40,7 +40,7 @@ public void satisfiesFloorTxCost() { .gasPrice(Wei.of(7)) .createTransaction(KEY_PAIR1); - final LondonFeeMarket londonFeeMarket = new LondonFeeMarket(0); + final BaseFeeMarket londonFeeMarket = FeeMarket.london(0); assertThat(londonFeeMarket.satisfiesFloorTxFee(transaction)).isTrue(); } @@ -54,7 +54,7 @@ public void maxFeePerGasLessThanMinimumBaseFee() { .gasPrice(null) .createTransaction(KEY_PAIR1); - final LondonFeeMarket londonFeeMarket = new LondonFeeMarket(0); + final BaseFeeMarket londonFeeMarket = FeeMarket.london(0); assertThat(londonFeeMarket.satisfiesFloorTxFee(transaction)).isFalse(); } @@ -68,7 +68,7 @@ public void satisfiesFloorTxCostWhenBaseFeeInitialValueIsZero() { .gasPrice(null) .createTransaction(KEY_PAIR1); - final LondonFeeMarket londonFeeMarket = new LondonFeeMarket(0, Optional.of(Wei.ZERO)); + final BaseFeeMarket londonFeeMarket = FeeMarket.london(0, Optional.of(Wei.ZERO)); assertThat(londonFeeMarket.satisfiesFloorTxFee(transaction)).isTrue(); } } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java index 2cd1936b3ab..384bcff501c 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/BaseFeeMarketBlockHeaderGasPriceValidationRuleTest.java @@ -20,7 +20,6 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket; import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; -import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket; import java.util.Optional; @@ -30,7 +29,7 @@ public class BaseFeeMarketBlockHeaderGasPriceValidationRuleTest { private static final long FORK_BLOCK = 800L; - private final BaseFeeMarket baseFeeMarket = new LondonFeeMarket(FORK_BLOCK); + private final BaseFeeMarket baseFeeMarket = FeeMarket.london(FORK_BLOCK); private BaseFeeMarketBlockHeaderGasPriceValidationRule validationRule; private final BaseFeeMarket feeMarket = FeeMarket.london(FORK_BLOCK); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleFixedBaseFeeMarketTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleFixedBaseFeeMarketTest.java index 94b58fa6904..effa3d4d192 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleFixedBaseFeeMarketTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleFixedBaseFeeMarketTest.java @@ -21,7 +21,7 @@ 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 org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import java.util.Optional; @@ -32,7 +32,7 @@ public class GasLimitElasticityValidationRuleFixedBaseFeeMarketTest { private static final Optional fixedBaseFeeMarket = - Optional.of(new FixedBaseFeeMarket(10, Wei.ONE)); + Optional.of(FeeMarket.fixedBaseFee(10, Wei.ONE)); public GasLimitRangeAndDeltaValidationRule uut = new GasLimitRangeAndDeltaValidationRule(5000, MAX_VALUE, fixedBaseFeeMarket); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleTest.java index 1f74233445c..12b3d6926ca 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleTest.java @@ -20,7 +20,7 @@ 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.LondonFeeMarket; +import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import java.util.Optional; @@ -30,7 +30,7 @@ public class GasLimitElasticityValidationRuleTest { - private static final Optional baseFeeMarket = Optional.of(new LondonFeeMarket(10)); + private static final Optional baseFeeMarket = Optional.of(FeeMarket.london(10)); public GasLimitRangeAndDeltaValidationRule uut = new GasLimitRangeAndDeltaValidationRule(5000, MAX_VALUE, baseFeeMarket); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleZeroBaseFeeMarketTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleZeroBaseFeeMarketTest.java index 39462a22cdb..54278b47d2d 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleZeroBaseFeeMarketTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/GasLimitElasticityValidationRuleZeroBaseFeeMarketTest.java @@ -20,7 +20,7 @@ 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.ZeroBaseFeeMarket; +import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import java.util.Optional; @@ -31,7 +31,7 @@ public class GasLimitElasticityValidationRuleZeroBaseFeeMarketTest { private static final Optional zeroBaseFeeMarket = - Optional.of(new ZeroBaseFeeMarket(10)); + Optional.of(FeeMarket.zeroBaseFee(10)); public GasLimitRangeAndDeltaValidationRule uut = new GasLimitRangeAndDeltaValidationRule(5000, MAX_VALUE, zeroBaseFeeMarket);