diff --git a/acceptance-tests/src/test/resources/ibft/ibft.json b/acceptance-tests/src/test/resources/ibft/ibft.json index 5206103a92..50967cc5d8 100644 --- a/acceptance-tests/src/test/resources/ibft/ibft.json +++ b/acceptance-tests/src/test/resources/ibft/ibft.json @@ -7,7 +7,7 @@ "eip155Block": 3, "eip158Block": 3, "byzantiumBlock": 1035301, - "revisedibft": { + "ibft2": { "blockperiodseconds": 1, "epochlength": 30000, "requesttimeoutseconds": 5 diff --git a/config/src/main/java/tech/pegasys/pantheon/config/GenesisConfigOptions.java b/config/src/main/java/tech/pegasys/pantheon/config/GenesisConfigOptions.java index b31b77e796..8d9673c16f 100644 --- a/config/src/main/java/tech/pegasys/pantheon/config/GenesisConfigOptions.java +++ b/config/src/main/java/tech/pegasys/pantheon/config/GenesisConfigOptions.java @@ -19,17 +19,17 @@ public interface GenesisConfigOptions { boolean isEthHash(); - boolean isIbft(); + boolean isIbftLegacy(); - boolean isRevisedIbft(); + boolean isIbft2(); boolean isClique(); - IbftConfigOptions getIbftConfigOptions(); + IbftConfigOptions getIbftLegacyConfigOptions(); CliqueConfigOptions getCliqueConfigOptions(); - IbftConfigOptions getRevisedIbftConfigOptions(); + IbftConfigOptions getIbft2ConfigOptions(); EthashConfigOptions getEthashConfigOptions(); diff --git a/config/src/main/java/tech/pegasys/pantheon/config/JsonGenesisConfigOptions.java b/config/src/main/java/tech/pegasys/pantheon/config/JsonGenesisConfigOptions.java index 1265b84c22..18ee4ad291 100644 --- a/config/src/main/java/tech/pegasys/pantheon/config/JsonGenesisConfigOptions.java +++ b/config/src/main/java/tech/pegasys/pantheon/config/JsonGenesisConfigOptions.java @@ -20,8 +20,8 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { private static final String ETHASH_CONFIG_KEY = "ethash"; - private static final String IBFT_CONFIG_KEY = "ibft"; - private static final String REVISED_IBFT_CONFIG_KEY = "revisedibft"; + private static final String IBFT_LEGACY_CONFIG_KEY = "ibft"; + private static final String IBFT2_CONFIG_KEY = "ibft2"; private static final String CLIQUE_CONFIG_KEY = "clique"; private final JsonObject configRoot; @@ -35,8 +35,8 @@ public boolean isEthHash() { } @Override - public boolean isIbft() { - return configRoot.containsKey(IBFT_CONFIG_KEY); + public boolean isIbftLegacy() { + return configRoot.containsKey(IBFT_LEGACY_CONFIG_KEY); } @Override @@ -45,21 +45,21 @@ public boolean isClique() { } @Override - public boolean isRevisedIbft() { - return configRoot.containsKey(REVISED_IBFT_CONFIG_KEY); + public boolean isIbft2() { + return configRoot.containsKey(IBFT2_CONFIG_KEY); } @Override - public IbftConfigOptions getIbftConfigOptions() { - return isIbft() - ? new IbftConfigOptions(configRoot.getJsonObject(IBFT_CONFIG_KEY)) + public IbftConfigOptions getIbftLegacyConfigOptions() { + return isIbftLegacy() + ? new IbftConfigOptions(configRoot.getJsonObject(IBFT_LEGACY_CONFIG_KEY)) : IbftConfigOptions.DEFAULT; } @Override - public IbftConfigOptions getRevisedIbftConfigOptions() { - return isRevisedIbft() - ? new IbftConfigOptions(configRoot.getJsonObject(REVISED_IBFT_CONFIG_KEY)) + public IbftConfigOptions getIbft2ConfigOptions() { + return isIbft2() + ? new IbftConfigOptions(configRoot.getJsonObject(IBFT2_CONFIG_KEY)) : IbftConfigOptions.DEFAULT; } diff --git a/config/src/test-support/java/tech/pegasys/pantheon/config/StubGenesisConfigOptions.java b/config/src/test-support/java/tech/pegasys/pantheon/config/StubGenesisConfigOptions.java index 27fdfc049c..6ab5abbf7e 100644 --- a/config/src/test-support/java/tech/pegasys/pantheon/config/StubGenesisConfigOptions.java +++ b/config/src/test-support/java/tech/pegasys/pantheon/config/StubGenesisConfigOptions.java @@ -32,7 +32,7 @@ public boolean isEthHash() { } @Override - public boolean isIbft() { + public boolean isIbftLegacy() { return false; } @@ -42,12 +42,12 @@ public boolean isClique() { } @Override - public boolean isRevisedIbft() { + public boolean isIbft2() { return false; } @Override - public IbftConfigOptions getIbftConfigOptions() { + public IbftConfigOptions getIbftLegacyConfigOptions() { return IbftConfigOptions.DEFAULT; } @@ -57,7 +57,7 @@ public CliqueConfigOptions getCliqueConfigOptions() { } @Override - public IbftConfigOptions getRevisedIbftConfigOptions() { + public IbftConfigOptions getIbft2ConfigOptions() { return IbftConfigOptions.DEFAULT; } diff --git a/config/src/test/java/tech/pegasys/pantheon/config/GenesisConfigOptionsTest.java b/config/src/test/java/tech/pegasys/pantheon/config/GenesisConfigOptionsTest.java index a7fac49800..b14359ed77 100644 --- a/config/src/test/java/tech/pegasys/pantheon/config/GenesisConfigOptionsTest.java +++ b/config/src/test/java/tech/pegasys/pantheon/config/GenesisConfigOptionsTest.java @@ -37,17 +37,17 @@ public void shouldNotUseEthHashIfEthHashNotPresent() { } @Test - public void shouldUseIbftWhenIbftInConfig() { + public void shouldUseIbftLegacyWhenIbftInConfig() { final GenesisConfigOptions config = fromConfigOptions(singletonMap("ibft", emptyMap())); - assertThat(config.isIbft()).isTrue(); - assertThat(config.getIbftConfigOptions()).isNotSameAs(IbftConfigOptions.DEFAULT); + assertThat(config.isIbftLegacy()).isTrue(); + assertThat(config.getIbftLegacyConfigOptions()).isNotSameAs(IbftConfigOptions.DEFAULT); } @Test - public void shouldNotUseIbftIfIbftNotPresent() { + public void shouldNotUseIbftLegacyIfIbftNotPresent() { final GenesisConfigOptions config = fromConfigOptions(emptyMap()); - assertThat(config.isIbft()).isFalse(); - assertThat(config.getIbftConfigOptions()).isSameAs(IbftConfigOptions.DEFAULT); + assertThat(config.isIbftLegacy()).isFalse(); + assertThat(config.getIbftLegacyConfigOptions()).isSameAs(IbftConfigOptions.DEFAULT); } @Test @@ -130,7 +130,7 @@ public void shouldGetChainIdWhenSpecified() { public void shouldSupportEmptyGenesisConfig() { final GenesisConfigOptions config = GenesisConfigFile.fromConfig("{}").getConfigOptions(); assertThat(config.isEthHash()).isFalse(); - assertThat(config.isIbft()).isFalse(); + assertThat(config.isIbftLegacy()).isFalse(); assertThat(config.isClique()).isFalse(); assertThat(config.getHomesteadBlockNumber()).isEmpty(); } diff --git a/config/src/test/java/tech/pegasys/pantheon/config/IbftConfigOptionsTest.java b/config/src/test/java/tech/pegasys/pantheon/config/IbftConfigOptionsTest.java index 18add31e3a..161e1be1ff 100644 --- a/config/src/test/java/tech/pegasys/pantheon/config/IbftConfigOptionsTest.java +++ b/config/src/test/java/tech/pegasys/pantheon/config/IbftConfigOptionsTest.java @@ -84,6 +84,6 @@ private IbftConfigOptions fromConfigOptions(final Map ibftConfig return GenesisConfigFile.fromConfig( new JsonObject(singletonMap("config", singletonMap("ibft", ibftConfigOptions)))) .getConfigOptions() - .getIbftConfigOptions(); + .getIbftLegacyConfigOptions(); } } diff --git a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftProtocolSchedule.java b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftProtocolSchedule.java index f7157a5b8d..014028980e 100644 --- a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftProtocolSchedule.java +++ b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftProtocolSchedule.java @@ -35,7 +35,7 @@ public class IbftProtocolSchedule { private static final int DEFAULT_CHAIN_ID = 1; public static ProtocolSchedule create(final GenesisConfigOptions config) { - final IbftConfigOptions ibftConfig = config.getIbftConfigOptions(); + final IbftConfigOptions ibftConfig = config.getIbftLegacyConfigOptions(); final long epochLength = ibftConfig.getEpochLength(); final long blockPeriod = ibftConfig.getBlockPeriodSeconds(); final EpochManager epochManager = new EpochManager(epochLength); diff --git a/consensus/ibftlegacy/src/main/java/tech/pegasys/pantheon/consensus/ibftlegacy/IbftProtocolSchedule.java b/consensus/ibftlegacy/src/main/java/tech/pegasys/pantheon/consensus/ibftlegacy/IbftProtocolSchedule.java index f0f1b0e89c..1e45af85d0 100644 --- a/consensus/ibftlegacy/src/main/java/tech/pegasys/pantheon/consensus/ibftlegacy/IbftProtocolSchedule.java +++ b/consensus/ibftlegacy/src/main/java/tech/pegasys/pantheon/consensus/ibftlegacy/IbftProtocolSchedule.java @@ -37,7 +37,7 @@ public class IbftProtocolSchedule { private static final int DEFAULT_CHAIN_ID = 1; public static ProtocolSchedule create(final GenesisConfigOptions config) { - final IbftConfigOptions ibftConfig = config.getIbftConfigOptions(); + final IbftConfigOptions ibftConfig = config.getIbftLegacyConfigOptions(); final long epochLength = ibftConfig.getEpochLength(); final long blockPeriod = ibftConfig.getBlockPeriodSeconds(); final EpochManager epochManager = new EpochManager(epochLength); diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftLegacyPantheonController.java b/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftLegacyPantheonController.java index 94b498a778..9edf80f2c0 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftLegacyPantheonController.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftLegacyPantheonController.java @@ -121,7 +121,8 @@ public static PantheonController init( final WorldStateArchive worldStateArchive = new WorldStateArchive(worldStateStorage); genesisState.writeStateTo(worldStateArchive.getMutable(Hash.EMPTY_TRIE_HASH)); - final IbftConfigOptions ibftConfig = genesisConfig.getConfigOptions().getIbftConfigOptions(); + final IbftConfigOptions ibftConfig = + genesisConfig.getConfigOptions().getIbftLegacyConfigOptions(); final EpochManager epochManager = new EpochManager(ibftConfig.getEpochLength()); final VoteTally voteTally = diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftPantheonController.java b/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftPantheonController.java index c6ac82bf41..7505de24c5 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftPantheonController.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/controller/IbftPantheonController.java @@ -143,8 +143,7 @@ public static PantheonController init( final WorldStateArchive worldStateArchive = new WorldStateArchive(worldStateStorage); genesisState.writeStateTo(worldStateArchive.getMutable(Hash.EMPTY_TRIE_HASH)); - final IbftConfigOptions ibftConfig = - genesisConfig.getConfigOptions().getRevisedIbftConfigOptions(); + final IbftConfigOptions ibftConfig = genesisConfig.getConfigOptions().getIbft2ConfigOptions(); final EpochManager epochManager = new EpochManager(ibftConfig.getEpochLength()); final BlockInterface blockInterface = new IbftBlockInterface(); diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java b/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java index 21c556ed0d..75b881501d 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java @@ -63,7 +63,7 @@ static PantheonController fromConfig( nodeKeys, metricsSystem, privacyParameters); - } else if (configOptions.isRevisedIbft()) { + } else if (configOptions.isIbft2()) { return IbftPantheonController.init( storageProvider, genesisConfigFile, @@ -72,7 +72,7 @@ static PantheonController fromConfig( networkId, nodeKeys, metricsSystem); - } else if (configOptions.isIbft()) { + } else if (configOptions.isIbftLegacy()) { return IbftLegacyPantheonController.init( storageProvider, genesisConfigFile,