Support Constantinople when using Clique. (#247)

Adrian Sutton 6 years ago committed by GitHub
parent 2ee9cb1497
commit 29cfc8c530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSchedule.java
  2. 4
      consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSpecs.java
  3. 7
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MainnetProtocolSpecs.java

@ -60,6 +60,10 @@ public class CliqueProtocolSchedule extends MutableProtocolSchedule<CliqueContex
config config
.getByzantiumBlockNumber() .getByzantiumBlockNumber()
.ifPresent(blockNumber -> protocolSchedule.putMilestone(blockNumber, specs.byzantium())); .ifPresent(blockNumber -> protocolSchedule.putMilestone(blockNumber, specs.byzantium()));
config
.getConstantinopleBlockNumber()
.ifPresent(
blockNumber -> protocolSchedule.putMilestone(blockNumber, specs.constantinople()));
return protocolSchedule; return protocolSchedule;
} }

@ -66,6 +66,10 @@ public class CliqueProtocolSpecs {
return applyCliqueSpecificModifications(MainnetProtocolSpecs.byzantiumDefinition(chainId)); return applyCliqueSpecificModifications(MainnetProtocolSpecs.byzantiumDefinition(chainId));
} }
public ProtocolSpec<CliqueContext> constantinople() {
return applyCliqueSpecificModifications(MainnetProtocolSpecs.constantinopleDefinition(chainId));
}
private ProtocolSpec<CliqueContext> applyCliqueSpecificModifications( private ProtocolSpec<CliqueContext> applyCliqueSpecificModifications(
final ProtocolSpecBuilder<Void> specBuilder) { final ProtocolSpecBuilder<Void> specBuilder) {
final EpochManager epochManager = new EpochManager(epochLength); final EpochManager epochManager = new EpochManager(epochLength);

@ -263,13 +263,16 @@ public abstract class MainnetProtocolSpecs {
*/ */
public static ProtocolSpec<Void> constantinople( public static ProtocolSpec<Void> constantinople(
final int chainId, final ProtocolSchedule<Void> protocolSchedule) { final int chainId, final ProtocolSchedule<Void> protocolSchedule) {
return constantinopleDefinition(chainId).build(protocolSchedule);
}
public static ProtocolSpecBuilder<Void> constantinopleDefinition(final int chainId) {
return byzantiumDefinition(chainId) return byzantiumDefinition(chainId)
.difficultyCalculator(MainnetDifficultyCalculators.CONSTANTINOPLE) .difficultyCalculator(MainnetDifficultyCalculators.CONSTANTINOPLE)
.gasCalculator(ConstantinopleGasCalculator::new) .gasCalculator(ConstantinopleGasCalculator::new)
.evmBuilder(MainnetEvmRegistries::constantinople) .evmBuilder(MainnetEvmRegistries::constantinople)
.blockReward(CONSTANTINOPLE_BLOCK_REWARD) .blockReward(CONSTANTINOPLE_BLOCK_REWARD)
.name("Constantinople") .name("Constantinople");
.build(protocolSchedule);
} }
private static TransactionReceipt frontierTransactionReceiptFactory( private static TransactionReceipt frontierTransactionReceiptFactory(

Loading…
Cancel
Save