From 2d83e13bb82ce88f808d6e6a7ddcde15b7d90eee Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Tue, 19 Jan 2021 08:16:45 -0700 Subject: [PATCH] Genesis config cleanup (#1812) * Finish internal ConstantinopleFix->Petersburg transition, including class names. Only backwards compatibility and retesteth use of the name will remain. * Remove four unused config fields from json configs. These are fields with no code uses of any sort. All are implied by other fields. eip150Hash, eip155Block, eip160Block, and daoForkSupport. * Remove redundant fork block fields where their value is implied Signed-off-by: Danno Ferrin --- CHANGELOG.md | 17 +++++++++++++++++ .../src/test/resources/clique/clique.json | 4 +--- .../tests/src/test/resources/ibft/ibft.json | 2 -- .../simple_permissioning_genesis.json | 9 +-------- .../simple_permissioning_ibft_genesis.json | 9 +-------- .../simple_permissioning_v2_genesis.json | 9 +-------- .../java/org/hyperledger/besu/RunnerTest.java | 1 - .../test/resources/ibftlegacy_genesis.json | 2 -- .../operator/config_generate_keys.json | 3 --- .../operator/config_import_keys.json | 5 +---- .../config_import_keys_invalid_keys.json | 5 +---- .../besu/chainimport/clique/genesis.json | 9 +-------- .../besu/chainimport/ethash/genesis.json | 9 +-------- .../besu/chainimport/unsupported/genesis.json | 9 +-------- .../besu/config/GenesisConfigOptions.java | 2 +- .../besu/config/JsonGenesisConfigOptions.java | 19 +++---------------- .../besu/config/StubGenesisConfigOptions.java | 14 ++++++-------- config/src/main/resources/dev.json | 7 ------- config/src/main/resources/goerli.json | 8 -------- config/src/main/resources/mainnet.json | 6 +----- config/src/main/resources/rinkeby.json | 2 -- config/src/main/resources/ropsten.json | 2 -- config/src/main/resources/yolo.json | 9 --------- .../besu/config/GenesisConfigFileTest.java | 6 +++--- .../besu/config/GenesisConfigOptionsTest.java | 8 ++++---- config/src/test/resources/valid_config.json | 4 +--- .../valid_config_with_custom_forks.json | 4 +--- .../valid_config_with_etc_forks.json | 4 +--- .../valid_config_with_quorum_config.json | 4 +--- .../valid_config_with_unexpected_forks.json | 8 +++----- .../clique/CliqueProtocolScheduleTest.java | 1 - .../api/jsonrpc/trace/chain-data/genesis.json | 9 +-------- .../BlockHashOperationBenchmark.java | 4 ++-- .../mainnet/ClassicProtocolSpecs.java | 2 +- .../mainnet/IstanbulGasCalculator.java | 2 +- .../mainnet/MainnetProtocolSpecs.java | 8 ++++---- ...ator.java => PetersburgGasCalculator.java} | 2 +- .../mainnet/ProtocolScheduleBuilder.java | 7 +++---- ethereum/core/src/main/resources/infura.json | 2 -- .../core/ExecutionContextTestFixture.java | 2 +- .../besu/ethereum/core/TransactionTest.java | 2 +- .../mainnet/MainnetProtocolScheduleTest.java | 19 ++++++++----------- .../ethereum/mainnet/RefundSstoreGasTest.java | 2 +- .../BLAKE2BFPrecompileContractTest.java | 4 ++-- .../besu/ethereum/chain/genesis1.json | 2 -- .../besu/ethereum/chain/genesis2.json | 2 -- .../besu/ethereum/chain/genesis3.json | 2 -- .../besu/ethereum/chain/genesis4.json | 2 -- .../besu/ethereum/eth/manager/EthPeer.java | 2 +- .../corruptSmartPermissioning.json | 9 +-------- .../noSmartPermissioning.json | 9 +-------- .../preseededSmartPermissioning.json | 9 +-------- .../corruptSmartPermissioning.json | 9 +-------- .../noSmartPermissioning.json | 9 +-------- .../preseededSmartPermissioning.json | 9 +-------- .../ReferenceTestProtocolSchedules.java | 4 ++-- .../retesteth/methods/TestSetChainParams.java | 2 +- .../fork-chain-data/genesis-outdated.json | 5 ----- .../fork-chain-data/genesis-upgraded.json | 7 +------ .../main/resources/mainnet-data/mainnet.json | 5 +---- 60 files changed, 89 insertions(+), 264 deletions(-) rename ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/{ConstantinopleFixGasCalculator.java => PetersburgGasCalculator.java} (96%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14a3805729..830bb5d0ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 21.2.0-RC1 + +### 21.2 Breaking Changes +There are currently no breaking changes in 21.2 + +### Additions and Improvements +* Removed unused flags in default genesis configs [\#1812](https://github.com/hyperledger/besu/pull/1812) + +### Bug Fixes + +### Early Access Features + +#### Previously identified known issues + +- [Fast sync when running Besu on cloud providers](KNOWN_ISSUES.md#fast-sync-when-running-besu-on-cloud-providers) +- [Privacy users with private transactions created using v1.3.4 or earlier](KNOWN_ISSUES.md#privacy-users-with-private-transactions-created-using-v134-or-earlier) + ## 20.10.4 ### Additions and Improvements diff --git a/acceptance-tests/tests/src/test/resources/clique/clique.json b/acceptance-tests/tests/src/test/resources/clique/clique.json index 971ccb4041..8fb3c6dc33 100644 --- a/acceptance-tests/tests/src/test/resources/clique/clique.json +++ b/acceptance-tests/tests/src/test/resources/clique/clique.json @@ -3,12 +3,10 @@ "chainId": 4, "homesteadBlock": 1, "eip150Block": 2, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, "eip158Block": 4, "byzantiumBlock": 5, "constantinopleBlock": 6, - "constantinopleFixBlock": 7, + "petersburgBlock": 7, "clique": { "blockperiodseconds": 10, "epochlength": 30000 diff --git a/acceptance-tests/tests/src/test/resources/ibft/ibft.json b/acceptance-tests/tests/src/test/resources/ibft/ibft.json index 01765901fd..c838bb7cf3 100644 --- a/acceptance-tests/tests/src/test/resources/ibft/ibft.json +++ b/acceptance-tests/tests/src/test/resources/ibft/ibft.json @@ -3,8 +3,6 @@ "chainId": 4, "homesteadBlock": 1, "eip150Block": 2, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, "eip158Block": 3, "byzantiumBlock": 1035301, "ibft2": { diff --git a/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_genesis.json b/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_genesis.json index 0d8508e7b9..5aee1cc13b 100644 --- a/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_genesis.json +++ b/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_genesis.json @@ -1,14 +1,7 @@ { "config": { "chainId": 999, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } diff --git a/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_ibft_genesis.json b/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_ibft_genesis.json index 725161f82e..907547b0ca 100644 --- a/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_ibft_genesis.json +++ b/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_ibft_genesis.json @@ -1,14 +1,7 @@ { "config": { "chainId": 999, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ibft2": { "blockperiodseconds": 5, "epochlength": 30000, diff --git a/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_v2_genesis.json b/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_v2_genesis.json index ce6c9d00b6..1802856c79 100644 --- a/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_v2_genesis.json +++ b/acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_v2_genesis.json @@ -1,14 +1,7 @@ { "config": { "chainId": 999, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } diff --git a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java index e0b728e33b..001d759ac1 100644 --- a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java +++ b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java @@ -377,7 +377,6 @@ public final class RunnerTest { (node) -> { // Clear DAO block so that inability to validate DAO block won't interfere with fast sync node.remove("daoForkBlock"); - node.put("daoForkSupport", false); }); return GenesisConfigFile.fromConfig(jsonNode); } diff --git a/besu/src/test/resources/ibftlegacy_genesis.json b/besu/src/test/resources/ibftlegacy_genesis.json index 84a297fd19..6930159d99 100644 --- a/besu/src/test/resources/ibftlegacy_genesis.json +++ b/besu/src/test/resources/ibftlegacy_genesis.json @@ -3,8 +3,6 @@ "chainId": 2017, "homesteadBlock": 0, "eip150Block": 0, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 0, "eip158Block": 0, "ibft": { diff --git a/besu/src/test/resources/operator/config_generate_keys.json b/besu/src/test/resources/operator/config_generate_keys.json index 6402efbbf8..3723fdc3bc 100644 --- a/besu/src/test/resources/operator/config_generate_keys.json +++ b/besu/src/test/resources/operator/config_generate_keys.json @@ -2,10 +2,7 @@ "genesis": { "config": { "chainId": 2017, - "constantinoplefixblock": 0, - "homesteadBlock": 0, "eip150Block": 0, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "ibft2": { } diff --git a/besu/src/test/resources/operator/config_import_keys.json b/besu/src/test/resources/operator/config_import_keys.json index b8b55169cb..b3a0d8edd8 100644 --- a/besu/src/test/resources/operator/config_import_keys.json +++ b/besu/src/test/resources/operator/config_import_keys.json @@ -2,10 +2,7 @@ "genesis": { "config": { "chainId": 2017, - "constantinoplefixblock": 0, - "homesteadBlock": 0, - "eip150Block": 0, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "petersburgBlock": 0, "ibft2": { } diff --git a/besu/src/test/resources/operator/config_import_keys_invalid_keys.json b/besu/src/test/resources/operator/config_import_keys_invalid_keys.json index 69d2a84dce..3fc4561e3a 100644 --- a/besu/src/test/resources/operator/config_import_keys_invalid_keys.json +++ b/besu/src/test/resources/operator/config_import_keys_invalid_keys.json @@ -2,10 +2,7 @@ "genesis": { "config": { "chainId": 2017, - "constantinoplefixblock": 0, - "homesteadBlock": 0, - "eip150Block": 0, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "petersburgBlock": 0, "ibft2": { } diff --git a/besu/src/test/resources/org/hyperledger/besu/chainimport/clique/genesis.json b/besu/src/test/resources/org/hyperledger/besu/chainimport/clique/genesis.json index c46060ffd3..43f399bf0e 100644 --- a/besu/src/test/resources/org/hyperledger/besu/chainimport/clique/genesis.json +++ b/besu/src/test/resources/org/hyperledger/besu/chainimport/clique/genesis.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "contractSizeLimit": 2147483647, "clique": { "blockperiodseconds": 15, diff --git a/besu/src/test/resources/org/hyperledger/besu/chainimport/ethash/genesis.json b/besu/src/test/resources/org/hyperledger/besu/chainimport/ethash/genesis.json index 9c7ed48ad8..71e5a4ab79 100644 --- a/besu/src/test/resources/org/hyperledger/besu/chainimport/ethash/genesis.json +++ b/besu/src/test/resources/org/hyperledger/besu/chainimport/ethash/genesis.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "contractSizeLimit": 2147483647, "ethash": { "fixeddifficulty": 100 diff --git a/besu/src/test/resources/org/hyperledger/besu/chainimport/unsupported/genesis.json b/besu/src/test/resources/org/hyperledger/besu/chainimport/unsupported/genesis.json index fd6b595d2d..f0d9a8e18d 100644 --- a/besu/src/test/resources/org/hyperledger/besu/chainimport/unsupported/genesis.json +++ b/besu/src/test/resources/org/hyperledger/besu/chainimport/unsupported/genesis.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "contractSizeLimit": 2147483647, "ibft2": { "blockperiodseconds": 1, diff --git a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java index 100b004f42..c279fe34ae 100644 --- a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java @@ -55,7 +55,7 @@ public interface GenesisConfigOptions { OptionalLong getConstantinopleBlockNumber(); - OptionalLong getConstantinopleFixBlockNumber(); + OptionalLong getPetersburgBlockNumber(); OptionalLong getIstanbulBlockNumber(); diff --git a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java index f0f42e8a24..96cd2304c5 100644 --- a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java @@ -201,7 +201,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { } @Override - public OptionalLong getConstantinopleFixBlockNumber() { + public OptionalLong getPetersburgBlockNumber() { final OptionalLong petersburgBlock = getOptionalLong("petersburgblock"); final OptionalLong constantinopleFixBlock = getOptionalLong("constantinoplefixblock"); if (constantinopleFixBlock.isPresent()) { @@ -331,24 +331,20 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { .ifPresent( l -> { builder.put("daoForkBlock", l); - builder.put("daoForkSupport", Boolean.TRUE); }); getTangerineWhistleBlockNumber() .ifPresent( l -> { builder.put("eip150Block", l); - getOptionalString("eip150hash") - .ifPresent(eip150hash -> builder.put("eip150Hash", eip150hash)); }); getSpuriousDragonBlockNumber() .ifPresent( l -> { - builder.put("eip155Block", l); builder.put("eip158Block", l); }); getByzantiumBlockNumber().ifPresent(l -> builder.put("byzantiumBlock", l)); getConstantinopleBlockNumber().ifPresent(l -> builder.put("constantinopleBlock", l)); - getConstantinopleFixBlockNumber().ifPresent(l -> builder.put("petersburgBlock", l)); + getPetersburgBlockNumber().ifPresent(l -> builder.put("petersburgBlock", l)); getIstanbulBlockNumber().ifPresent(l -> builder.put("istanbulBlock", l)); getMuirGlacierBlockNumber().ifPresent(l -> builder.put("muirGlacierBlock", l)); getBerlinBlockNumber().ifPresent(l -> builder.put("berlinBlock", l)); @@ -379,15 +375,6 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { return builder.build(); } - private Optional getOptionalString(final String key) { - if (configOverrides.containsKey(key)) { - final String value = configOverrides.get(key); - return value == null || value.isEmpty() ? Optional.empty() : Optional.of(value); - } else { - return JsonUtil.getString(configRoot, key); - } - } - private OptionalLong getOptionalLong(final String key) { if (configOverrides.containsKey(key)) { final String value = configOverrides.get(key); @@ -442,7 +429,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { getSpuriousDragonBlockNumber(), getByzantiumBlockNumber(), getConstantinopleBlockNumber(), - getConstantinopleFixBlockNumber(), + getPetersburgBlockNumber(), getIstanbulBlockNumber(), getMuirGlacierBlockNumber(), getEIP1559BlockNumber(), diff --git a/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java index 451be307a2..5ebe262baa 100644 --- a/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java @@ -34,7 +34,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions { private OptionalLong spuriousDragonBlockNumber = OptionalLong.empty(); private OptionalLong byzantiumBlockNumber = OptionalLong.empty(); private OptionalLong constantinopleBlockNumber = OptionalLong.empty(); - private OptionalLong constantinopleFixBlockNumber = OptionalLong.empty(); + private OptionalLong petersburgBlockNumber = OptionalLong.empty(); private OptionalLong istanbulBlockNumber = OptionalLong.empty(); private OptionalLong muirGlacierBlockNumber = OptionalLong.empty(); private OptionalLong berlinBlockNumber = OptionalLong.empty(); @@ -135,8 +135,8 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions { } @Override - public OptionalLong getConstantinopleFixBlockNumber() { - return constantinopleFixBlockNumber; + public OptionalLong getPetersburgBlockNumber() { + return petersburgBlockNumber; } @Override @@ -234,18 +234,16 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions { .ifPresent( l -> { builder.put("daoForkBlock", l); - builder.put("daoForkSupport", Boolean.TRUE); }); getTangerineWhistleBlockNumber().ifPresent(l -> builder.put("eip150Block", l)); getSpuriousDragonBlockNumber() .ifPresent( l -> { - builder.put("eip155Block", l); builder.put("eip158Block", l); }); getByzantiumBlockNumber().ifPresent(l -> builder.put("byzantiumBlock", l)); getConstantinopleBlockNumber().ifPresent(l -> builder.put("constantinopleBlock", l)); - getConstantinopleFixBlockNumber().ifPresent(l -> builder.put("petersburgBlock", l)); + getPetersburgBlockNumber().ifPresent(l -> builder.put("petersburgBlock", l)); getIstanbulBlockNumber().ifPresent(l -> builder.put("istanbulBlock", l)); getMuirGlacierBlockNumber().ifPresent(l -> builder.put("muirGlacierBlock", l)); getBerlinBlockNumber().ifPresent(l -> builder.put("berlinBlock", l)); @@ -318,8 +316,8 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions { return this; } - public StubGenesisConfigOptions constantinopleFixBlock(final long blockNumber) { - constantinopleFixBlockNumber = OptionalLong.of(blockNumber); + public StubGenesisConfigOptions petersburgBlock(final long blockNumber) { + petersburgBlockNumber = OptionalLong.of(blockNumber); return this; } diff --git a/config/src/main/resources/dev.json b/config/src/main/resources/dev.json index 05a4f830ba..6081b311d4 100644 --- a/config/src/main/resources/dev.json +++ b/config/src/main/resources/dev.json @@ -1,13 +1,6 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, "petersburgBlock": 0, "contractSizeLimit": 2147483647, "ethash": { diff --git a/config/src/main/resources/goerli.json b/config/src/main/resources/goerli.json index 61f6fdb082..0eb0e48c62 100644 --- a/config/src/main/resources/goerli.json +++ b/config/src/main/resources/goerli.json @@ -1,14 +1,6 @@ { "config":{ "chainId":5, - "homesteadBlock":0, - "eip150Block":0, - "eip150Hash": "0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a", - "eip155Block":0, - "eip158Block":0, - "eip160Block":0, - "byzantiumBlock":0, - "constantinopleBlock":0, "petersburgBlock":0, "istanbulBlock":1561651, "clique":{ diff --git a/config/src/main/resources/mainnet.json b/config/src/main/resources/mainnet.json index e2f9b1b964..e130f72aa8 100644 --- a/config/src/main/resources/mainnet.json +++ b/config/src/main/resources/mainnet.json @@ -1,15 +1,11 @@ { "config": { "chainId": 1, - "daoForkBlock": 1920000, "homesteadBlock": 1150000, - "daoForkSupport": true, + "daoForkBlock": 1920000, "eip150Block": 2463000, - "eip150Hash": "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0", - "eip155Block": 2675000, "eip158Block": 2675000, "byzantiumBlock": 4370000, - "constantinopleBlock": 7280000, "petersburgBlock": 7280000, "istanbulBlock": 9069000, "muirGlacierBlock": 9200000, diff --git a/config/src/main/resources/rinkeby.json b/config/src/main/resources/rinkeby.json index 7332f8dfc5..7dd0279810 100644 --- a/config/src/main/resources/rinkeby.json +++ b/config/src/main/resources/rinkeby.json @@ -3,8 +3,6 @@ "chainId": 4, "homesteadBlock": 1, "eip150Block": 2, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, "eip158Block": 3, "byzantiumBlock": 1035301, "constantinopleBlock": 3660663, diff --git a/config/src/main/resources/ropsten.json b/config/src/main/resources/ropsten.json index 3f518203be..74947aa559 100644 --- a/config/src/main/resources/ropsten.json +++ b/config/src/main/resources/ropsten.json @@ -1,8 +1,6 @@ { "config": { "chainId": 3, - "homesteadBlock": 0, - "daoForkBlock": 0, "eip150Block": 0, "eip158Block": 10, "byzantiumBlock": 1700000, diff --git a/config/src/main/resources/yolo.json b/config/src/main/resources/yolo.json index de6038aed3..c3cff5f236 100644 --- a/config/src/main/resources/yolo.json +++ b/config/src/main/resources/yolo.json @@ -1,15 +1,6 @@ { "config":{ "chainId":133519467574834, - "homesteadBlock":0, - "eip150Block":0, - "eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block":0, - "eip158Block":0, - "byzantiumBlock":0, - "constantinopleBlock":0, - "petersburgBlock":0, - "istanbulBlock":0, "yoloV2Block":0, "clique":{ "period":15, diff --git a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigFileTest.java b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigFileTest.java index c70ef408aa..e2c3417348 100644 --- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigFileTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigFileTest.java @@ -292,7 +292,7 @@ public class GenesisConfigFileTest { public void testNoOverride() { final GenesisConfigFile config = GenesisConfigFile.development(); - assertThat(config.getConfigOptions().getConstantinopleFixBlockNumber()).hasValue(0); + assertThat(config.getConfigOptions().getPetersburgBlockNumber()).hasValue(0); assertThat(config.getConfigOptions().getIstanbulBlockNumber()).isNotPresent(); assertThat(config.getConfigOptions().getChainId()).hasValue(BigInteger.valueOf(2018)); assertThat(config.getConfigOptions().getContractSizeLimit()).hasValue(2147483647); @@ -305,14 +305,14 @@ public class GenesisConfigFileTest { // petersburg node final GenesisConfigFile config = GenesisConfigFile.development(); - assertThat(config.getConfigOptions().getConstantinopleFixBlockNumber()).hasValue(0); + assertThat(config.getConfigOptions().getPetersburgBlockNumber()).hasValue(0); // constantinopleFix node final Map override = new HashMap<>(); override.put("constantinopleFixBlock", "1000"); assertThatExceptionOfType(RuntimeException.class) - .isThrownBy(() -> config.getConfigOptions(override).getConstantinopleFixBlockNumber()) + .isThrownBy(() -> config.getConfigOptions(override).getPetersburgBlockNumber()) .withMessage( "Genesis files cannot specify both petersburgBlock and constantinopleFixBlock."); ; 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 c048a204d9..930f20f8f7 100644 --- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java @@ -128,13 +128,13 @@ public class GenesisConfigOptionsTest { public void shouldGetConstantinopleFixBlockNumber() { final GenesisConfigOptions config = fromConfigOptions(singletonMap("constantinopleFixBlock", 1000)); - assertThat(config.getConstantinopleFixBlockNumber()).hasValue(1000); + assertThat(config.getPetersburgBlockNumber()).hasValue(1000); } @Test public void shouldGetPetersburgBlockNumber() { final GenesisConfigOptions config = fromConfigOptions(singletonMap("petersburgBlock", 1000)); - assertThat(config.getConstantinopleFixBlockNumber()).hasValue(1000); + assertThat(config.getPetersburgBlockNumber()).hasValue(1000); } @Test @@ -144,7 +144,7 @@ public class GenesisConfigOptionsTest { configMap.put("petersburgBlock", 1000); final GenesisConfigOptions config = fromConfigOptions(configMap); assertThatExceptionOfType(RuntimeException.class) - .isThrownBy(config::getConstantinopleFixBlockNumber) + .isThrownBy(config::getPetersburgBlockNumber) .withMessage( "Genesis files cannot specify both petersburgBlock and constantinopleFixBlock."); } @@ -204,7 +204,7 @@ public class GenesisConfigOptionsTest { assertThat(config.getSpuriousDragonBlockNumber()).isEmpty(); assertThat(config.getByzantiumBlockNumber()).isEmpty(); assertThat(config.getConstantinopleBlockNumber()).isEmpty(); - assertThat(config.getConstantinopleFixBlockNumber()).isEmpty(); + assertThat(config.getPetersburgBlockNumber()).isEmpty(); assertThat(config.getIstanbulBlockNumber()).isEmpty(); assertThat(config.getMuirGlacierBlockNumber()).isEmpty(); assertThat(config.getBerlinBlockNumber()).isEmpty(); diff --git a/config/src/test/resources/valid_config.json b/config/src/test/resources/valid_config.json index 609e88cf95..c098a6c84b 100644 --- a/config/src/test/resources/valid_config.json +++ b/config/src/test/resources/valid_config.json @@ -1,9 +1,7 @@ { "chainId": 61, - "eip150Block": 2, "homesteadBlock": 1, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, + "eip150Block": 2, "eip158Block": 3, "byzantiumBlock": 1035301, "ibft2": { diff --git a/config/src/test/resources/valid_config_with_custom_forks.json b/config/src/test/resources/valid_config_with_custom_forks.json index fa082c8276..82916ed86c 100644 --- a/config/src/test/resources/valid_config_with_custom_forks.json +++ b/config/src/test/resources/valid_config_with_custom_forks.json @@ -1,9 +1,7 @@ { "chainId": 4, - "eip150Block": 2, "homesteadBlock": 1, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, + "eip150Block": 2, "eip158Block": 3, "byzantiumBlock": 1035301, "ibft2": { diff --git a/config/src/test/resources/valid_config_with_etc_forks.json b/config/src/test/resources/valid_config_with_etc_forks.json index aa3e067406..a7e546568d 100644 --- a/config/src/test/resources/valid_config_with_etc_forks.json +++ b/config/src/test/resources/valid_config_with_etc_forks.json @@ -1,9 +1,7 @@ { "chainId": 61, - "eip150Block": 2, "homesteadBlock": 1, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, + "eip150Block": 2, "eip158Block": 3, "classicForkBlock": 1920000, "byzantiumBlock": 1035301, diff --git a/config/src/test/resources/valid_config_with_quorum_config.json b/config/src/test/resources/valid_config_with_quorum_config.json index 55a2f19de8..2c1db33dfc 100644 --- a/config/src/test/resources/valid_config_with_quorum_config.json +++ b/config/src/test/resources/valid_config_with_quorum_config.json @@ -1,9 +1,7 @@ { "chainId": 4, - "eip150Block": 2, "homesteadBlock": 1, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, + "eip150Block": 2, "eip158Block": 3, "byzantiumBlock": 1035301, "isQuorum": true, diff --git a/config/src/test/resources/valid_config_with_unexpected_forks.json b/config/src/test/resources/valid_config_with_unexpected_forks.json index 41146106be..49c107adc7 100644 --- a/config/src/test/resources/valid_config_with_unexpected_forks.json +++ b/config/src/test/resources/valid_config_with_unexpected_forks.json @@ -1,15 +1,13 @@ { "chainId": 61, + "homesteadBlock": 1, "eip150Block": 2, + "eip158Block": 3, "unexpectedFork1Block": 7, - "homesteadBlock": 1, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, "unexpectedFork2Block": 9, - "eip158Block": 3, + "unexpectedFork3Block": 150000, "classicForkBlock": 1920000, "byzantiumBlock": 1035301, - "unexpectedFork3Block": 150000, "ibft2": { "blockperiodseconds": 2, "epochlength": 30000, diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java index aa76a7fa3b..07ad127584 100644 --- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java +++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java @@ -42,7 +42,6 @@ public class CliqueProtocolScheduleTest { + "{\"chainId\": 4,\n" + "\"homesteadBlock\": 1,\n" + "\"eip150Block\": 2,\n" - + "\"eip155Block\": 3,\n" + "\"eip158Block\": 3,\n" + "\"byzantiumBlock\": 1035301}" + "}"; diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json index 88287d7956..afc1b9de73 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json @@ -1,14 +1,7 @@ { "config": { "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "eip160Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "istanbulBlock": 0, "ethash": { "fixeddifficulty": 15 diff --git a/ethereum/core/src/jmh/java/org/hyperledger/besu/ethereum/vm/operations/BlockHashOperationBenchmark.java b/ethereum/core/src/jmh/java/org/hyperledger/besu/ethereum/vm/operations/BlockHashOperationBenchmark.java index d118515bb0..837a7d36b4 100644 --- a/ethereum/core/src/jmh/java/org/hyperledger/besu/ethereum/vm/operations/BlockHashOperationBenchmark.java +++ b/ethereum/core/src/jmh/java/org/hyperledger/besu/ethereum/vm/operations/BlockHashOperationBenchmark.java @@ -14,7 +14,7 @@ */ package org.hyperledger.besu.ethereum.vm.operations; -import org.hyperledger.besu.ethereum.mainnet.ConstantinopleFixGasCalculator; +import org.hyperledger.besu.ethereum.mainnet.PetersburgGasCalculator; import org.hyperledger.besu.ethereum.vm.BlockHashLookup; import org.hyperledger.besu.ethereum.vm.MessageFrame; @@ -44,7 +44,7 @@ public class BlockHashOperationBenchmark { @Setup public void prepare() throws Exception { operationBenchmarkHelper = OperationBenchmarkHelper.create(); - operation = new BlockHashOperation(new ConstantinopleFixGasCalculator()); + operation = new BlockHashOperation(new PetersburgGasCalculator()); frame = operationBenchmarkHelper.createMessageFrame(); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicProtocolSpecs.java index a859ecc61f..09700e53df 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicProtocolSpecs.java @@ -187,7 +187,7 @@ public class ClassicProtocolSpecs { ecip1017EraRounds, quorumCompatibilityMode) .evmBuilder(MainnetEvmRegistries::constantinople) - .gasCalculator(ConstantinopleFixGasCalculator::new) + .gasCalculator(PetersburgGasCalculator::new) .evmBuilder(gasCalculator -> MainnetEvmRegistries.constantinople(gasCalculator)) .precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::istanbul) .name("Agharta"); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/IstanbulGasCalculator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/IstanbulGasCalculator.java index 6fc1ecec4f..498f29b01c 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/IstanbulGasCalculator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/IstanbulGasCalculator.java @@ -21,7 +21,7 @@ import org.hyperledger.besu.ethereum.core.Transaction; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.units.bigints.UInt256; -public class IstanbulGasCalculator extends ConstantinopleFixGasCalculator { +public class IstanbulGasCalculator extends PetersburgGasCalculator { private static final Gas TX_DATA_ZERO_COST = Gas.of(4L); private static final Gas ISTANBUL_TX_DATA_NON_ZERO_COST = Gas.of(16L); 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 0d2a700246..dee278c46f 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 @@ -321,7 +321,7 @@ public abstract class MainnetProtocolSpecs { .name("Constantinople"); } - public static ProtocolSpecBuilder constantinopleFixDefinition( + public static ProtocolSpecBuilder petersburgDefinition( final Optional chainId, final OptionalInt contractSizeLimit, final OptionalInt configStackSizeLimit, @@ -333,8 +333,8 @@ public abstract class MainnetProtocolSpecs { configStackSizeLimit, enableRevertReason, quorumCompatibilityMode) - .gasCalculator(ConstantinopleFixGasCalculator::new) - .name("ConstantinopleFix"); + .gasCalculator(PetersburgGasCalculator::new) + .name("Petersburg"); } public static ProtocolSpecBuilder istanbulDefinition( @@ -345,7 +345,7 @@ public abstract class MainnetProtocolSpecs { final boolean quorumCompatibilityMode) { final int contractSizeLimit = configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT); - return constantinopleFixDefinition( + return petersburgDefinition( chainId, configContractSizeLimit, configStackSizeLimit, diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ConstantinopleFixGasCalculator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PetersburgGasCalculator.java similarity index 96% rename from ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ConstantinopleFixGasCalculator.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PetersburgGasCalculator.java index 59b81c21a5..60d4184afe 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ConstantinopleFixGasCalculator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PetersburgGasCalculator.java @@ -25,7 +25,7 @@ import org.apache.tuweni.units.bigints.UInt256; *

Neither {@link TangerineWhistleGasCalculator} nor {@link SpuriousDragonGasCalculator} overrode * these two methods so {@link FrontierGasCalculator} is the source. */ -public class ConstantinopleFixGasCalculator extends ConstantinopleGasCalculator { +public class PetersburgGasCalculator extends ConstantinopleGasCalculator { /** Same as {#link {@link FrontierGasCalculator#STORAGE_SET_GAS_COST} */ private static final Gas STORAGE_SET_GAS_COST = Gas.of(20_000L); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java index 093d314882..d9230d3d34 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java @@ -162,8 +162,8 @@ public class ProtocolScheduleBuilder { quorumCompatibilityMode)); addProtocolSpec( protocolSchedule, - config.getConstantinopleFixBlockNumber(), - MainnetProtocolSpecs.constantinopleFixDefinition( + config.getPetersburgBlockNumber(), + MainnetProtocolSpecs.petersburgDefinition( chainId, config.getContractSizeLimit(), config.getEvmStackSize(), @@ -362,8 +362,7 @@ public class ProtocolScheduleBuilder { lastForkBlock = validateForkOrder("Constantinople", config.getConstantinopleBlockNumber(), lastForkBlock); lastForkBlock = - validateForkOrder( - "ConstantinopleFix", config.getConstantinopleFixBlockNumber(), lastForkBlock); + validateForkOrder("Petersburg", config.getPetersburgBlockNumber(), lastForkBlock); lastForkBlock = validateForkOrder("Istanbul", config.getIstanbulBlockNumber(), lastForkBlock); lastForkBlock = validateForkOrder("MuirGlacier", config.getMuirGlacierBlockNumber(), lastForkBlock); diff --git a/ethereum/core/src/main/resources/infura.json b/ethereum/core/src/main/resources/infura.json index 1775579f29..27b4f56cec 100644 --- a/ethereum/core/src/main/resources/infura.json +++ b/ethereum/core/src/main/resources/infura.json @@ -3,9 +3,7 @@ "chainId": 1337, "homesteadBlock":0, "eip150Block":0, - "eip155Block":10, "eip158Block":10, - "eip160Block":10 }, "nonce": "0x0000000000000042", "alloc": { diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java index 15345b5158..cea7d932d5 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java @@ -114,7 +114,7 @@ public class ExecutionContextTestFixture { if (protocolSchedule == null) { protocolSchedule = new ProtocolScheduleBuilder( - new StubGenesisConfigOptions().constantinopleFixBlock(0), + new StubGenesisConfigOptions().petersburgBlock(0), BigInteger.valueOf(42), Function.identity(), new PrivacyParameters(), diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionTest.java index c7d92a8d6d..7af6d0e834 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionTest.java @@ -96,7 +96,7 @@ public class TransactionTest { } @Test - public void constantinopleFix() { + public void petersburg() { milestone("ConstantinopleFix"); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java index 23b2c64386..86b437d428 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java @@ -41,8 +41,7 @@ public class MainnetProtocolScheduleTest { Assertions.assertThat(sched.getByBlockNumber(4_730_000L).getName()).isEqualTo("Byzantium"); // Constantinople was originally scheduled for 7_080_000, but postponed Assertions.assertThat(sched.getByBlockNumber(7_080_000L).getName()).isEqualTo("Byzantium"); - Assertions.assertThat(sched.getByBlockNumber(7_280_000L).getName()) - .isEqualTo("ConstantinopleFix"); + Assertions.assertThat(sched.getByBlockNumber(7_280_000L).getName()).isEqualTo("Petersburg"); Assertions.assertThat(sched.getByBlockNumber(9_069_000L).getName()).isEqualTo("Istanbul"); Assertions.assertThat(sched.getByBlockNumber(9_200_000L).getName()).isEqualTo("MuirGlacier"); Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) @@ -60,7 +59,7 @@ public class MainnetProtocolScheduleTest { @Test public void createFromConfigWithSettings() { final String json = - "{\"config\": {\"homesteadBlock\": 2, \"daoForkBlock\": 3, \"eip150Block\": 14, \"eip158Block\": 15, \"byzantiumBlock\": 16, \"constantinopleBlock\": 18, \"constantinopleFixBlock\": 19, \"chainId\":1234}}"; + "{\"config\": {\"homesteadBlock\": 2, \"daoForkBlock\": 3, \"eip150Block\": 14, \"eip158Block\": 15, \"byzantiumBlock\": 16, \"constantinopleBlock\": 18, \"petersburgBlock\": 19, \"chainId\":1234}}"; final ProtocolSchedule sched = MainnetProtocolSchedule.fromConfig(GenesisConfigFile.fromConfig(json).getConfigOptions()); Assertions.assertThat(sched.getByBlockNumber(1).getName()).isEqualTo("Frontier"); @@ -72,16 +71,16 @@ public class MainnetProtocolScheduleTest { Assertions.assertThat(sched.getByBlockNumber(15).getName()).isEqualTo("SpuriousDragon"); Assertions.assertThat(sched.getByBlockNumber(16).getName()).isEqualTo("Byzantium"); Assertions.assertThat(sched.getByBlockNumber(18).getName()).isEqualTo("Constantinople"); - Assertions.assertThat(sched.getByBlockNumber(19).getName()).isEqualTo("ConstantinopleFix"); + Assertions.assertThat(sched.getByBlockNumber(19).getName()).isEqualTo("Petersburg"); } @Test public void outOfOrderConstantinoplesFail() { final String json = - "{\"config\": {\"homesteadBlock\": 2, \"daoForkBlock\": 3, \"eip150Block\": 14, \"eip158Block\": 15, \"byzantiumBlock\": 16, \"constantinopleBlock\": 18, \"constantinopleFixBlock\": 17, \"chainId\":1234}}"; + "{\"config\": {\"homesteadBlock\": 2, \"daoForkBlock\": 3, \"eip150Block\": 14, \"eip158Block\": 15, \"byzantiumBlock\": 16, \"constantinopleBlock\": 18, \"petersburgBlock\": 17, \"chainId\":1234}}"; Assertions.assertThatExceptionOfType(RuntimeException.class) .describedAs( - "Genesis Config Error: 'ConstantinopleFix' is scheduled for block 17 but it must be on or after block 18.") + "Genesis Config Error: 'Petersburg' is scheduled for block 17 but it must be on or after block 18.") .isThrownBy( () -> MainnetProtocolSchedule.fromConfig( @@ -101,8 +100,7 @@ public class MainnetProtocolScheduleTest { Assertions.assertThat(sched.getByBlockNumber(10L).getName()).isEqualTo("SpuriousDragon"); Assertions.assertThat(sched.getByBlockNumber(1_700_000L).getName()).isEqualTo("Byzantium"); Assertions.assertThat(sched.getByBlockNumber(4_230_000L).getName()).isEqualTo("Constantinople"); - Assertions.assertThat(sched.getByBlockNumber(4_939_394L).getName()) - .isEqualTo("ConstantinopleFix"); + Assertions.assertThat(sched.getByBlockNumber(4_939_394L).getName()).isEqualTo("Petersburg"); Assertions.assertThat(sched.getByBlockNumber(6_485_846L).getName()).isEqualTo("Istanbul"); Assertions.assertThat(sched.getByBlockNumber(7_117_117L).getName()).isEqualTo("MuirGlacier"); Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) @@ -117,7 +115,7 @@ public class MainnetProtocolScheduleTest { Resources.toString( this.getClass().getResource("/goerli.json"), StandardCharsets.UTF_8)) .getConfigOptions()); - Assertions.assertThat(sched.getByBlockNumber(0L).getName()).isEqualTo("ConstantinopleFix"); + Assertions.assertThat(sched.getByBlockNumber(0L).getName()).isEqualTo("Petersburg"); Assertions.assertThat(sched.getByBlockNumber(1_561_651L).getName()).isEqualTo("Istanbul"); Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); } @@ -136,8 +134,7 @@ public class MainnetProtocolScheduleTest { Assertions.assertThat(sched.getByBlockNumber(3L).getName()).isEqualTo("SpuriousDragon"); Assertions.assertThat(sched.getByBlockNumber(1_035_301L).getName()).isEqualTo("Byzantium"); Assertions.assertThat(sched.getByBlockNumber(3_660_663L).getName()).isEqualTo("Constantinople"); - Assertions.assertThat(sched.getByBlockNumber(4_321_234L).getName()) - .isEqualTo("ConstantinopleFix"); + Assertions.assertThat(sched.getByBlockNumber(4_321_234L).getName()).isEqualTo("Petersburg"); Assertions.assertThat(sched.getByBlockNumber(5_435_345L).getName()).isEqualTo("Istanbul"); Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/RefundSstoreGasTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/RefundSstoreGasTest.java index 327d3a5f8a..010f409ef8 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/RefundSstoreGasTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/RefundSstoreGasTest.java @@ -40,7 +40,7 @@ public class RefundSstoreGasTest { @Parameters(name = "calculator: {0}, original: {2}, current: {3}, new: {4}") public static Object[][] scenarios() { final GasCalculator constantinople = new ConstantinopleGasCalculator(); - final GasCalculator petersburg = new ConstantinopleFixGasCalculator(); + final GasCalculator petersburg = new PetersburgGasCalculator(); final GasCalculator istanbul = new IstanbulGasCalculator(); return new Object[][] { // Zero no-op diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/BLAKE2BFPrecompileContractTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/BLAKE2BFPrecompileContractTest.java index 193ed28127..865713ea54 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/BLAKE2BFPrecompileContractTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/BLAKE2BFPrecompileContractTest.java @@ -18,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import org.hyperledger.besu.ethereum.core.Gas; -import org.hyperledger.besu.ethereum.mainnet.ConstantinopleFixGasCalculator; +import org.hyperledger.besu.ethereum.mainnet.PetersburgGasCalculator; import org.hyperledger.besu.ethereum.vm.MessageFrame; import org.apache.tuweni.bytes.Bytes; @@ -29,7 +29,7 @@ import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class BLAKE2BFPrecompileContractTest { private final BLAKE2BFPrecompileContract contract = - new BLAKE2BFPrecompileContract(new ConstantinopleFixGasCalculator()); + new BLAKE2BFPrecompileContract(new PetersburgGasCalculator()); public BLAKE2BFPrecompileContractTest() {} diff --git a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis1.json b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis1.json index 4e2e5739b2..5005c8d6c2 100644 --- a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis1.json +++ b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis1.json @@ -1,8 +1,6 @@ { "config": { "chainId": 15, - "homesteadBlock": 0, - "eip155Block": 0, "eip158Block": 0 }, "alloc": { diff --git a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis2.json b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis2.json index f9775cc0c8..b7ed04352c 100644 --- a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis2.json +++ b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis2.json @@ -1,8 +1,6 @@ { "config": { "chainId": 15, - "homesteadBlock": 0, - "eip155Block": 0, "eip158Block": 0 }, "coinbase": "0x0000000000000000000000000000000000000000", diff --git a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis3.json b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis3.json index 05d71204c8..2168a9db94 100644 --- a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis3.json +++ b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis3.json @@ -3,8 +3,6 @@ "chainId": 385, "homesteadBlock": 1, "eip150Block": 2, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, "eip158Block": 3, "byzantiumBlock": 4, "clique": { diff --git a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis4.json b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis4.json index 084b95d169..3713fb40e6 100644 --- a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis4.json +++ b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis4.json @@ -3,8 +3,6 @@ "chainId": 385, "homesteadBlock": 1, "eip150Block": 2, - "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "eip155Block": 3, "eip158Block": 3, "byzantiumBlock": 4, "clique": { diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java index 66c08c21f3..5526143f42 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java @@ -91,7 +91,7 @@ public class EthPeer { knownBlocks = Collections.newSetFromMap( Collections.synchronizedMap( - new LinkedHashMap(16, 0.75f, true) { + new LinkedHashMap<>(16, 0.75f, true) { @Override protected boolean removeEldestEntry(final Map.Entry eldest) { return size() > maxTrackedSeenBlocks; diff --git a/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/corruptSmartPermissioning.json b/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/corruptSmartPermissioning.json index c67f6b7d4e..19d6df5310 100644 --- a/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/corruptSmartPermissioning.json +++ b/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/corruptSmartPermissioning.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } diff --git a/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/noSmartPermissioning.json b/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/noSmartPermissioning.json index 27aa588c39..384502681b 100644 --- a/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/noSmartPermissioning.json +++ b/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/noSmartPermissioning.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } diff --git a/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/preseededSmartPermissioning.json b/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/preseededSmartPermissioning.json index 309d1a9ff3..87c35c216e 100644 --- a/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/preseededSmartPermissioning.json +++ b/ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/preseededSmartPermissioning.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } diff --git a/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/corruptSmartPermissioning.json b/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/corruptSmartPermissioning.json index 4b59f298d5..0992990533 100644 --- a/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/corruptSmartPermissioning.json +++ b/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/corruptSmartPermissioning.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } diff --git a/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/noSmartPermissioning.json b/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/noSmartPermissioning.json index 27aa588c39..384502681b 100644 --- a/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/noSmartPermissioning.json +++ b/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/noSmartPermissioning.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } diff --git a/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/preseededSmartPermissioning.json b/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/preseededSmartPermissioning.json index 6dd7ef265d..a2c472b93d 100644 --- a/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/preseededSmartPermissioning.json +++ b/ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/preseededSmartPermissioning.json @@ -1,14 +1,7 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "constantinopleFixBlock": 0, + "petersburgBlock": 0, "ethash": { "fixeddifficulty": 100 } 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 6607c97bcb..ff0f758c6e 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 @@ -58,8 +58,8 @@ public class ReferenceTestProtocolSchedules { builder.put( "Constantinople", createSchedule(new StubGenesisConfigOptions().constantinopleBlock(0))); builder.put( - "ConstantinopleFix", - createSchedule(new StubGenesisConfigOptions().constantinopleFixBlock(0))); + "ConstantinopleFix", createSchedule(new StubGenesisConfigOptions().petersburgBlock(0))); + builder.put("Petersburg", createSchedule(new StubGenesisConfigOptions().petersburgBlock(0))); builder.put("Istanbul", createSchedule(new StubGenesisConfigOptions().istanbulBlock(0))); builder.put("MuirGlacier", createSchedule(new StubGenesisConfigOptions().muirGlacierBlock(0))); if (ExperimentalEIPs.berlinEnabled) { diff --git a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java index 0c8c5915db..96b2f9582a 100644 --- a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java +++ b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java @@ -118,7 +118,7 @@ public class TestSetChainParams implements JsonRpcMethod { maybeMoveToNumber(params, "EIP158ForkBlock", config, "eip158Block"); maybeMoveToNumber(params, "byzantiumForkBlock", config, "byzantiumBlock"); maybeMoveToNumber(params, "constantinopleForkBlock", config, "constantinopleBlock"); - maybeMoveToNumber(params, "constantinopleFixForkBlock", config, "constantinopleFixBlock"); + maybeMoveToNumber(params, "constantinopleFixForkBlock", config, "petersburgBlock"); maybeMoveToNumber(params, "istanbulForkBlock", config, "istanbulBlock"); maybeMoveToNumber(params, "muirGlacierForkBlock", config, "muirGlacierBlock"); maybeMoveToNumber(params, "berlinForkBlock", config, "berlinBlock"); diff --git a/testutil/src/main/resources/fork-chain-data/genesis-outdated.json b/testutil/src/main/resources/fork-chain-data/genesis-outdated.json index 4648bb5f36..ac2a6363af 100644 --- a/testutil/src/main/resources/fork-chain-data/genesis-outdated.json +++ b/testutil/src/main/resources/fork-chain-data/genesis-outdated.json @@ -1,11 +1,6 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 5, "contractSizeLimit": 2147483647, diff --git a/testutil/src/main/resources/fork-chain-data/genesis-upgraded.json b/testutil/src/main/resources/fork-chain-data/genesis-upgraded.json index 14dd549a70..62bdf3742d 100644 --- a/testutil/src/main/resources/fork-chain-data/genesis-upgraded.json +++ b/testutil/src/main/resources/fork-chain-data/genesis-upgraded.json @@ -1,14 +1,9 @@ { "config": { "chainId": 2018, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 5, - "constantinopleFixBlock": 7, + "petersburgBlock": 7, "contractSizeLimit": 2147483647, "ethash": { "fixeddifficulty": 100 diff --git a/testutil/src/main/resources/mainnet-data/mainnet.json b/testutil/src/main/resources/mainnet-data/mainnet.json index 925b6e575c..39f1b08521 100644 --- a/testutil/src/main/resources/mainnet-data/mainnet.json +++ b/testutil/src/main/resources/mainnet-data/mainnet.json @@ -3,14 +3,11 @@ "chainId": 1, "homesteadBlock": 1150000, "daoForkBlock": 1920000, - "daoForkSupport": true, "eip150Block": 2463000, - "eip150Hash": "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0", - "eip155Block": 2675000, "eip158Block": 2675000, "byzantiumBlock": 4370000, "constantinopleBlock": 7280000, - "constantinopleFixBlock": 7280000, + "petersburgBlock": 7280000, "ethash": { }