|
|
@ -38,27 +38,37 @@ public class ProtocolScheduleBuilder { |
|
|
|
private final PrivacyParameters privacyParameters; |
|
|
|
private final PrivacyParameters privacyParameters; |
|
|
|
private final boolean isMetadataEnabled; |
|
|
|
private final boolean isMetadataEnabled; |
|
|
|
private final BadBlockManager badBlockManager = new BadBlockManager(); |
|
|
|
private final BadBlockManager badBlockManager = new BadBlockManager(); |
|
|
|
|
|
|
|
private final boolean quorumCompatibilityMode; |
|
|
|
|
|
|
|
|
|
|
|
public ProtocolScheduleBuilder( |
|
|
|
public ProtocolScheduleBuilder( |
|
|
|
final GenesisConfigOptions config, |
|
|
|
final GenesisConfigOptions config, |
|
|
|
final BigInteger defaultChainId, |
|
|
|
final BigInteger defaultChainId, |
|
|
|
final Function<ProtocolSpecBuilder, ProtocolSpecBuilder> protocolSpecAdapter, |
|
|
|
final Function<ProtocolSpecBuilder, ProtocolSpecBuilder> protocolSpecAdapter, |
|
|
|
final PrivacyParameters privacyParameters, |
|
|
|
final PrivacyParameters privacyParameters, |
|
|
|
final boolean isMetadataEnabled) { |
|
|
|
final boolean isMetadataEnabled, |
|
|
|
|
|
|
|
final boolean quorumCompatibilityMode) { |
|
|
|
this( |
|
|
|
this( |
|
|
|
config, |
|
|
|
config, |
|
|
|
Optional.of(defaultChainId), |
|
|
|
Optional.of(defaultChainId), |
|
|
|
protocolSpecAdapter, |
|
|
|
protocolSpecAdapter, |
|
|
|
privacyParameters, |
|
|
|
privacyParameters, |
|
|
|
isMetadataEnabled); |
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ProtocolScheduleBuilder( |
|
|
|
public ProtocolScheduleBuilder( |
|
|
|
final GenesisConfigOptions config, |
|
|
|
final GenesisConfigOptions config, |
|
|
|
final Function<ProtocolSpecBuilder, ProtocolSpecBuilder> protocolSpecAdapter, |
|
|
|
final Function<ProtocolSpecBuilder, ProtocolSpecBuilder> protocolSpecAdapter, |
|
|
|
final PrivacyParameters privacyParameters, |
|
|
|
final PrivacyParameters privacyParameters, |
|
|
|
final boolean isMetadataEnabled) { |
|
|
|
final boolean isMetadataEnabled, |
|
|
|
this(config, Optional.empty(), protocolSpecAdapter, privacyParameters, isMetadataEnabled); |
|
|
|
final boolean quorumCompatibilityMode) { |
|
|
|
|
|
|
|
this( |
|
|
|
|
|
|
|
config, |
|
|
|
|
|
|
|
Optional.empty(), |
|
|
|
|
|
|
|
protocolSpecAdapter, |
|
|
|
|
|
|
|
privacyParameters, |
|
|
|
|
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ProtocolScheduleBuilder( |
|
|
|
private ProtocolScheduleBuilder( |
|
|
@ -66,12 +76,14 @@ public class ProtocolScheduleBuilder { |
|
|
|
final Optional<BigInteger> defaultChainId, |
|
|
|
final Optional<BigInteger> defaultChainId, |
|
|
|
final Function<ProtocolSpecBuilder, ProtocolSpecBuilder> protocolSpecAdapter, |
|
|
|
final Function<ProtocolSpecBuilder, ProtocolSpecBuilder> protocolSpecAdapter, |
|
|
|
final PrivacyParameters privacyParameters, |
|
|
|
final PrivacyParameters privacyParameters, |
|
|
|
final boolean isMetadataEnabled) { |
|
|
|
final boolean isMetadataEnabled, |
|
|
|
|
|
|
|
final boolean quorumCompatibilityMode) { |
|
|
|
this.config = config; |
|
|
|
this.config = config; |
|
|
|
this.defaultChainId = defaultChainId; |
|
|
|
this.defaultChainId = defaultChainId; |
|
|
|
this.protocolSpecAdapter = protocolSpecAdapter; |
|
|
|
this.protocolSpecAdapter = protocolSpecAdapter; |
|
|
|
this.privacyParameters = privacyParameters; |
|
|
|
this.privacyParameters = privacyParameters; |
|
|
|
this.isMetadataEnabled = isMetadataEnabled; |
|
|
|
this.isMetadataEnabled = isMetadataEnabled; |
|
|
|
|
|
|
|
this.quorumCompatibilityMode = quorumCompatibilityMode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ProtocolSchedule createProtocolSchedule() { |
|
|
|
public ProtocolSchedule createProtocolSchedule() { |
|
|
@ -85,12 +97,12 @@ public class ProtocolScheduleBuilder { |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
OptionalLong.of(0), |
|
|
|
OptionalLong.of(0), |
|
|
|
MainnetProtocolSpecs.frontierDefinition( |
|
|
|
MainnetProtocolSpecs.frontierDefinition( |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize(), quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getHomesteadBlockNumber(), |
|
|
|
config.getHomesteadBlockNumber(), |
|
|
|
MainnetProtocolSpecs.homesteadDefinition( |
|
|
|
MainnetProtocolSpecs.homesteadDefinition( |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize(), quorumCompatibilityMode)); |
|
|
|
|
|
|
|
|
|
|
|
config |
|
|
|
config |
|
|
|
.getDaoForkBlock() |
|
|
|
.getDaoForkBlock() |
|
|
@ -102,12 +114,16 @@ public class ProtocolScheduleBuilder { |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
OptionalLong.of(daoBlockNumber), |
|
|
|
OptionalLong.of(daoBlockNumber), |
|
|
|
MainnetProtocolSpecs.daoRecoveryInitDefinition( |
|
|
|
MainnetProtocolSpecs.daoRecoveryInitDefinition( |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
OptionalLong.of(daoBlockNumber + 1), |
|
|
|
OptionalLong.of(daoBlockNumber + 1), |
|
|
|
MainnetProtocolSpecs.daoRecoveryTransitionDefinition( |
|
|
|
MainnetProtocolSpecs.daoRecoveryTransitionDefinition( |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
|
|
|
|
|
|
|
|
// Return to the previous protocol spec after the dao fork has completed.
|
|
|
|
// Return to the previous protocol spec after the dao fork has completed.
|
|
|
|
protocolSchedule.putMilestone(daoBlockNumber + 10, originalProtocolSpec); |
|
|
|
protocolSchedule.putMilestone(daoBlockNumber + 10, originalProtocolSpec); |
|
|
@ -117,44 +133,71 @@ public class ProtocolScheduleBuilder { |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getTangerineWhistleBlockNumber(), |
|
|
|
config.getTangerineWhistleBlockNumber(), |
|
|
|
MainnetProtocolSpecs.tangerineWhistleDefinition( |
|
|
|
MainnetProtocolSpecs.tangerineWhistleDefinition( |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize(), quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getSpuriousDragonBlockNumber(), |
|
|
|
config.getSpuriousDragonBlockNumber(), |
|
|
|
MainnetProtocolSpecs.spuriousDragonDefinition( |
|
|
|
MainnetProtocolSpecs.spuriousDragonDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getByzantiumBlockNumber(), |
|
|
|
config.getByzantiumBlockNumber(), |
|
|
|
MainnetProtocolSpecs.byzantiumDefinition( |
|
|
|
MainnetProtocolSpecs.byzantiumDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize(), isMetadataEnabled)); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getConstantinopleBlockNumber(), |
|
|
|
config.getConstantinopleBlockNumber(), |
|
|
|
MainnetProtocolSpecs.constantinopleDefinition( |
|
|
|
MainnetProtocolSpecs.constantinopleDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize(), isMetadataEnabled)); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getConstantinopleFixBlockNumber(), |
|
|
|
config.getConstantinopleFixBlockNumber(), |
|
|
|
MainnetProtocolSpecs.constantinopleFixDefinition( |
|
|
|
MainnetProtocolSpecs.constantinopleFixDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize(), isMetadataEnabled)); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getIstanbulBlockNumber(), |
|
|
|
config.getIstanbulBlockNumber(), |
|
|
|
MainnetProtocolSpecs.istanbulDefinition( |
|
|
|
MainnetProtocolSpecs.istanbulDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize(), isMetadataEnabled)); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getMuirGlacierBlockNumber(), |
|
|
|
config.getMuirGlacierBlockNumber(), |
|
|
|
MainnetProtocolSpecs.muirGlacierDefinition( |
|
|
|
MainnetProtocolSpecs.muirGlacierDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize(), isMetadataEnabled)); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
|
|
|
|
|
|
|
|
if (ExperimentalEIPs.berlinEnabled) { |
|
|
|
if (ExperimentalEIPs.berlinEnabled) { |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getBerlinBlockNumber(), |
|
|
|
config.getBerlinBlockNumber(), |
|
|
|
MainnetProtocolSpecs.berlinDefinition( |
|
|
|
MainnetProtocolSpecs.berlinDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize(), isMetadataEnabled)); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
isMetadataEnabled, |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (ExperimentalEIPs.eip1559Enabled) { |
|
|
|
if (ExperimentalEIPs.eip1559Enabled) { |
|
|
@ -169,7 +212,8 @@ public class ProtocolScheduleBuilder { |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
isMetadataEnabled, |
|
|
|
isMetadataEnabled, |
|
|
|
config)); |
|
|
|
config, |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// specs for classic network
|
|
|
|
// specs for classic network
|
|
|
@ -183,7 +227,9 @@ public class ProtocolScheduleBuilder { |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
OptionalLong.of(classicBlockNumber), |
|
|
|
OptionalLong.of(classicBlockNumber), |
|
|
|
ClassicProtocolSpecs.classicRecoveryInitDefinition( |
|
|
|
ClassicProtocolSpecs.classicRecoveryInitDefinition( |
|
|
|
config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
protocolSchedule.putMilestone(classicBlockNumber + 1, originalProtocolSpce); |
|
|
|
protocolSchedule.putMilestone(classicBlockNumber + 1, originalProtocolSpce); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -191,12 +237,18 @@ public class ProtocolScheduleBuilder { |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getEcip1015BlockNumber(), |
|
|
|
config.getEcip1015BlockNumber(), |
|
|
|
ClassicProtocolSpecs.tangerineWhistleDefinition( |
|
|
|
ClassicProtocolSpecs.tangerineWhistleDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getDieHardBlockNumber(), |
|
|
|
config.getDieHardBlockNumber(), |
|
|
|
ClassicProtocolSpecs.dieHardDefinition( |
|
|
|
ClassicProtocolSpecs.dieHardDefinition( |
|
|
|
chainId, config.getContractSizeLimit(), config.getEvmStackSize())); |
|
|
|
chainId, |
|
|
|
|
|
|
|
config.getContractSizeLimit(), |
|
|
|
|
|
|
|
config.getEvmStackSize(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getGothamBlockNumber(), |
|
|
|
config.getGothamBlockNumber(), |
|
|
@ -204,7 +256,8 @@ public class ProtocolScheduleBuilder { |
|
|
|
chainId, |
|
|
|
chainId, |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEcip1017EraRounds())); |
|
|
|
config.getEcip1017EraRounds(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getDefuseDifficultyBombBlockNumber(), |
|
|
|
config.getDefuseDifficultyBombBlockNumber(), |
|
|
@ -212,7 +265,8 @@ public class ProtocolScheduleBuilder { |
|
|
|
chainId, |
|
|
|
chainId, |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEcip1017EraRounds())); |
|
|
|
config.getEcip1017EraRounds(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getAtlantisBlockNumber(), |
|
|
|
config.getAtlantisBlockNumber(), |
|
|
@ -221,7 +275,8 @@ public class ProtocolScheduleBuilder { |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
isMetadataEnabled, |
|
|
|
isMetadataEnabled, |
|
|
|
config.getEcip1017EraRounds())); |
|
|
|
config.getEcip1017EraRounds(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getAghartaBlockNumber(), |
|
|
|
config.getAghartaBlockNumber(), |
|
|
@ -230,7 +285,8 @@ public class ProtocolScheduleBuilder { |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
isMetadataEnabled, |
|
|
|
isMetadataEnabled, |
|
|
|
config.getEcip1017EraRounds())); |
|
|
|
config.getEcip1017EraRounds(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getPhoenixBlockNumber(), |
|
|
|
config.getPhoenixBlockNumber(), |
|
|
@ -239,7 +295,8 @@ public class ProtocolScheduleBuilder { |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
isMetadataEnabled, |
|
|
|
isMetadataEnabled, |
|
|
|
config.getEcip1017EraRounds())); |
|
|
|
config.getEcip1017EraRounds(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
addProtocolSpec( |
|
|
|
addProtocolSpec( |
|
|
|
protocolSchedule, |
|
|
|
protocolSchedule, |
|
|
|
config.getThanosBlockNumber(), |
|
|
|
config.getThanosBlockNumber(), |
|
|
@ -248,7 +305,8 @@ public class ProtocolScheduleBuilder { |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getContractSizeLimit(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
config.getEvmStackSize(), |
|
|
|
isMetadataEnabled, |
|
|
|
isMetadataEnabled, |
|
|
|
config.getEcip1017EraRounds())); |
|
|
|
config.getEcip1017EraRounds(), |
|
|
|
|
|
|
|
quorumCompatibilityMode)); |
|
|
|
|
|
|
|
|
|
|
|
LOG.info("Protocol schedule created with milestones: {}", protocolSchedule.listMilestones()); |
|
|
|
LOG.info("Protocol schedule created with milestones: {}", protocolSchedule.listMilestones()); |
|
|
|
return protocolSchedule; |
|
|
|
return protocolSchedule; |
|
|
|