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 <danno.ferrin@gmail.com>
pull/1816/head
Danno Ferrin 4 years ago committed by GitHub
parent e69e1f5b36
commit 2d83e13bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      CHANGELOG.md
  2. 4
      acceptance-tests/tests/src/test/resources/clique/clique.json
  3. 2
      acceptance-tests/tests/src/test/resources/ibft/ibft.json
  4. 9
      acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_genesis.json
  5. 9
      acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_ibft_genesis.json
  6. 9
      acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_v2_genesis.json
  7. 1
      besu/src/test/java/org/hyperledger/besu/RunnerTest.java
  8. 2
      besu/src/test/resources/ibftlegacy_genesis.json
  9. 3
      besu/src/test/resources/operator/config_generate_keys.json
  10. 5
      besu/src/test/resources/operator/config_import_keys.json
  11. 5
      besu/src/test/resources/operator/config_import_keys_invalid_keys.json
  12. 9
      besu/src/test/resources/org/hyperledger/besu/chainimport/clique/genesis.json
  13. 9
      besu/src/test/resources/org/hyperledger/besu/chainimport/ethash/genesis.json
  14. 9
      besu/src/test/resources/org/hyperledger/besu/chainimport/unsupported/genesis.json
  15. 2
      config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java
  16. 19
      config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java
  17. 14
      config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java
  18. 7
      config/src/main/resources/dev.json
  19. 8
      config/src/main/resources/goerli.json
  20. 6
      config/src/main/resources/mainnet.json
  21. 2
      config/src/main/resources/rinkeby.json
  22. 2
      config/src/main/resources/ropsten.json
  23. 9
      config/src/main/resources/yolo.json
  24. 6
      config/src/test/java/org/hyperledger/besu/config/GenesisConfigFileTest.java
  25. 8
      config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java
  26. 4
      config/src/test/resources/valid_config.json
  27. 4
      config/src/test/resources/valid_config_with_custom_forks.json
  28. 4
      config/src/test/resources/valid_config_with_etc_forks.json
  29. 4
      config/src/test/resources/valid_config_with_quorum_config.json
  30. 8
      config/src/test/resources/valid_config_with_unexpected_forks.json
  31. 1
      consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java
  32. 9
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json
  33. 4
      ethereum/core/src/jmh/java/org/hyperledger/besu/ethereum/vm/operations/BlockHashOperationBenchmark.java
  34. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicProtocolSpecs.java
  35. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/IstanbulGasCalculator.java
  36. 8
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java
  37. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PetersburgGasCalculator.java
  38. 7
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java
  39. 2
      ethereum/core/src/main/resources/infura.json
  40. 2
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java
  41. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionTest.java
  42. 19
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java
  43. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/RefundSstoreGasTest.java
  44. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/BLAKE2BFPrecompileContractTest.java
  45. 2
      ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis1.json
  46. 2
      ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis2.json
  47. 2
      ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis3.json
  48. 2
      ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis4.json
  49. 2
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java
  50. 9
      ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/corruptSmartPermissioning.json
  51. 9
      ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/noSmartPermissioning.json
  52. 9
      ethereum/permissioning/src/test/resources/NodeSmartContractPermissioningControllerTest/preseededSmartPermissioning.json
  53. 9
      ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/corruptSmartPermissioning.json
  54. 9
      ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/noSmartPermissioning.json
  55. 9
      ethereum/permissioning/src/test/resources/TransactionSmartContractPermissioningControllerTest/preseededSmartPermissioning.json
  56. 4
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java
  57. 2
      ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java
  58. 5
      testutil/src/main/resources/fork-chain-data/genesis-outdated.json
  59. 7
      testutil/src/main/resources/fork-chain-data/genesis-upgraded.json
  60. 5
      testutil/src/main/resources/mainnet-data/mainnet.json

@ -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

@ -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

@ -3,8 +3,6 @@
"chainId": 4,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 1035301,
"ibft2": {

@ -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
}

@ -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,

@ -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
}

@ -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);
}

@ -3,8 +3,6 @@
"chainId": 2017,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"ibft": {

@ -2,10 +2,7 @@
"genesis": {
"config": {
"chainId": 2017,
"constantinoplefixblock": 0,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ibft2": {
}

@ -2,10 +2,7 @@
"genesis": {
"config": {
"chainId": 2017,
"constantinoplefixblock": 0,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"petersburgBlock": 0,
"ibft2": {
}

@ -2,10 +2,7 @@
"genesis": {
"config": {
"chainId": 2017,
"constantinoplefixblock": 0,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"petersburgBlock": 0,
"ibft2": {
}

@ -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,

@ -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

@ -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,

@ -55,7 +55,7 @@ public interface GenesisConfigOptions {
OptionalLong getConstantinopleBlockNumber();
OptionalLong getConstantinopleFixBlockNumber();
OptionalLong getPetersburgBlockNumber();
OptionalLong getIstanbulBlockNumber();

@ -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<String> 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(),

@ -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;
}

@ -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": {

@ -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":{

@ -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,

@ -3,8 +3,6 @@
"chainId": 4,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 1035301,
"constantinopleBlock": 3660663,

@ -1,8 +1,6 @@
{
"config": {
"chainId": 3,
"homesteadBlock": 0,
"daoForkBlock": 0,
"eip150Block": 0,
"eip158Block": 10,
"byzantiumBlock": 1700000,

@ -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,

@ -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<String, String> 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.");
;

@ -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();

@ -1,9 +1,7 @@
{
"chainId": 61,
"eip150Block": 2,
"homesteadBlock": 1,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip150Block": 2,
"eip158Block": 3,
"byzantiumBlock": 1035301,
"ibft2": {

@ -1,9 +1,7 @@
{
"chainId": 4,
"eip150Block": 2,
"homesteadBlock": 1,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip150Block": 2,
"eip158Block": 3,
"byzantiumBlock": 1035301,
"ibft2": {

@ -1,9 +1,7 @@
{
"chainId": 61,
"eip150Block": 2,
"homesteadBlock": 1,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip150Block": 2,
"eip158Block": 3,
"classicForkBlock": 1920000,
"byzantiumBlock": 1035301,

@ -1,9 +1,7 @@
{
"chainId": 4,
"eip150Block": 2,
"homesteadBlock": 1,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip150Block": 2,
"eip158Block": 3,
"byzantiumBlock": 1035301,
"isQuorum": true,

@ -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,

@ -42,7 +42,6 @@ public class CliqueProtocolScheduleTest {
+ "{\"chainId\": 4,\n"
+ "\"homesteadBlock\": 1,\n"
+ "\"eip150Block\": 2,\n"
+ "\"eip155Block\": 3,\n"
+ "\"eip158Block\": 3,\n"
+ "\"byzantiumBlock\": 1035301}"
+ "}";

@ -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

@ -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();
}

@ -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");

@ -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);

@ -321,7 +321,7 @@ public abstract class MainnetProtocolSpecs {
.name("Constantinople");
}
public static ProtocolSpecBuilder constantinopleFixDefinition(
public static ProtocolSpecBuilder petersburgDefinition(
final Optional<BigInteger> 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,

@ -25,7 +25,7 @@ import org.apache.tuweni.units.bigints.UInt256;
* <p>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);

@ -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);

@ -3,9 +3,7 @@
"chainId": 1337,
"homesteadBlock":0,
"eip150Block":0,
"eip155Block":10,
"eip158Block":10,
"eip160Block":10
},
"nonce": "0x0000000000000042",
"alloc": {

@ -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(),

@ -96,7 +96,7 @@ public class TransactionTest {
}
@Test
public void constantinopleFix() {
public void petersburg() {
milestone("ConstantinopleFix");
}

@ -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");
}

@ -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

@ -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() {}

@ -1,8 +1,6 @@
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc": {

@ -1,8 +1,6 @@
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"coinbase": "0x0000000000000000000000000000000000000000",

@ -3,8 +3,6 @@
"chainId": 385,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 4,
"clique": {

@ -3,8 +3,6 @@
"chainId": 385,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 4,
"clique": {

@ -91,7 +91,7 @@ public class EthPeer {
knownBlocks =
Collections.newSetFromMap(
Collections.synchronizedMap(
new LinkedHashMap<Hash, Boolean>(16, 0.75f, true) {
new LinkedHashMap<>(16, 0.75f, true) {
@Override
protected boolean removeEldestEntry(final Map.Entry<Hash, Boolean> eldest) {
return size() > maxTrackedSeenBlocks;

@ -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
}

@ -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
}

@ -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
}

@ -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
}

@ -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
}

@ -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
}

@ -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) {

@ -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");

@ -1,11 +1,6 @@
{
"config": {
"chainId": 2018,
"homesteadBlock": 0,
"daoForkBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 5,
"contractSizeLimit": 2147483647,

@ -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

@ -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": {
}

Loading…
Cancel
Save