|
|
@ -187,7 +187,9 @@ class GenesisConfigFileTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void shouldOverrideConfigOptionsBaseFeeWhenSpecified() { |
|
|
|
void shouldOverrideConfigOptionsBaseFeeWhenSpecified() { |
|
|
|
GenesisConfigOptions withOverrides = |
|
|
|
GenesisConfigOptions withOverrides = |
|
|
|
EMPTY_CONFIG.getConfigOptions(Map.of("baseFeePerGas", Wei.of(8).toString())); |
|
|
|
EMPTY_CONFIG |
|
|
|
|
|
|
|
.withOverrides(Map.of("baseFeePerGas", Wei.of(8).toString())) |
|
|
|
|
|
|
|
.getConfigOptions(); |
|
|
|
assertThat(withOverrides.getBaseFeePerGas()).contains(Wei.of(8L)); |
|
|
|
assertThat(withOverrides.getBaseFeePerGas()).contains(Wei.of(8L)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -229,7 +231,8 @@ class GenesisConfigFileTest { |
|
|
|
void assertTerminalTotalDifficultyOverride() { |
|
|
|
void assertTerminalTotalDifficultyOverride() { |
|
|
|
GenesisConfigOptions sepoliaOverrideOptions = |
|
|
|
GenesisConfigOptions sepoliaOverrideOptions = |
|
|
|
GenesisConfigFile.fromResource("/sepolia.json") |
|
|
|
GenesisConfigFile.fromResource("/sepolia.json") |
|
|
|
.getConfigOptions(Map.of("terminalTotalDifficulty", String.valueOf(Long.MAX_VALUE))); |
|
|
|
.withOverrides(Map.of("terminalTotalDifficulty", String.valueOf(Long.MAX_VALUE))) |
|
|
|
|
|
|
|
.getConfigOptions(); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(sepoliaOverrideOptions.getTerminalTotalDifficulty()).isPresent(); |
|
|
|
assertThat(sepoliaOverrideOptions.getTerminalTotalDifficulty()).isPresent(); |
|
|
|
assertThat(sepoliaOverrideOptions.getTerminalTotalDifficulty()) |
|
|
|
assertThat(sepoliaOverrideOptions.getTerminalTotalDifficulty()) |
|
|
@ -355,10 +358,12 @@ class GenesisConfigFileTest { |
|
|
|
override.put("contractSizeLimit", bigBlockString); |
|
|
|
override.put("contractSizeLimit", bigBlockString); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(config.getForkBlockNumbers()).isNotEmpty(); |
|
|
|
assertThat(config.getForkBlockNumbers()).isNotEmpty(); |
|
|
|
assertThat(config.getConfigOptions(override).getIstanbulBlockNumber()).hasValue(bigBlock); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getIstanbulBlockNumber()) |
|
|
|
assertThat(config.getConfigOptions(override).getChainId()) |
|
|
|
.hasValue(bigBlock); |
|
|
|
|
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getChainId()) |
|
|
|
.hasValue(BigInteger.valueOf(bigBlock)); |
|
|
|
.hasValue(BigInteger.valueOf(bigBlock)); |
|
|
|
assertThat(config.getConfigOptions(override).getContractSizeLimit()).hasValue(bigBlock); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getContractSizeLimit()) |
|
|
|
|
|
|
|
.hasValue(bigBlock); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -370,9 +375,11 @@ class GenesisConfigFileTest { |
|
|
|
override.put("contractSizeLimit", null); |
|
|
|
override.put("contractSizeLimit", null); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(config.getForkBlockNumbers()).isNotEmpty(); |
|
|
|
assertThat(config.getForkBlockNumbers()).isNotEmpty(); |
|
|
|
assertThat(config.getConfigOptions(override).getIstanbulBlockNumber()).isNotPresent(); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getIstanbulBlockNumber()) |
|
|
|
assertThat(config.getConfigOptions(override).getChainId()).isNotPresent(); |
|
|
|
.isNotPresent(); |
|
|
|
assertThat(config.getConfigOptions(override).getContractSizeLimit()).isNotPresent(); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getChainId()).isNotPresent(); |
|
|
|
|
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getContractSizeLimit()) |
|
|
|
|
|
|
|
.isNotPresent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -388,10 +395,12 @@ class GenesisConfigFileTest { |
|
|
|
// all lower case
|
|
|
|
// all lower case
|
|
|
|
override.put("contractsizelimit", bigBlockString); |
|
|
|
override.put("contractsizelimit", bigBlockString); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(config.getConfigOptions(override).getIstanbulBlockNumber()).hasValue(bigBlock); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getIstanbulBlockNumber()) |
|
|
|
assertThat(config.getConfigOptions(override).getChainId()) |
|
|
|
.hasValue(bigBlock); |
|
|
|
|
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getChainId()) |
|
|
|
.hasValue(BigInteger.valueOf(bigBlock)); |
|
|
|
.hasValue(BigInteger.valueOf(bigBlock)); |
|
|
|
assertThat(config.getConfigOptions(override).getContractSizeLimit()).hasValue(bigBlock); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getContractSizeLimit()) |
|
|
|
|
|
|
|
.hasValue(bigBlock); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -402,9 +411,11 @@ class GenesisConfigFileTest { |
|
|
|
override.put("chainId", ""); |
|
|
|
override.put("chainId", ""); |
|
|
|
override.put("contractSizeLimit", ""); |
|
|
|
override.put("contractSizeLimit", ""); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(config.getConfigOptions(override).getIstanbulBlockNumber()).isNotPresent(); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getIstanbulBlockNumber()) |
|
|
|
assertThat(config.getConfigOptions(override).getChainId()).isNotPresent(); |
|
|
|
.isNotPresent(); |
|
|
|
assertThat(config.getConfigOptions(override).getContractSizeLimit()).isNotPresent(); |
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getChainId()).isNotPresent(); |
|
|
|
|
|
|
|
assertThat(config.withOverrides(override).getConfigOptions().getContractSizeLimit()) |
|
|
|
|
|
|
|
.isNotPresent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -431,7 +442,8 @@ class GenesisConfigFileTest { |
|
|
|
override.put("constantinopleFixBlock", "1000"); |
|
|
|
override.put("constantinopleFixBlock", "1000"); |
|
|
|
|
|
|
|
|
|
|
|
assertThatExceptionOfType(RuntimeException.class) |
|
|
|
assertThatExceptionOfType(RuntimeException.class) |
|
|
|
.isThrownBy(() -> config.getConfigOptions(override).getPetersburgBlockNumber()) |
|
|
|
.isThrownBy( |
|
|
|
|
|
|
|
() -> config.withOverrides(override).getConfigOptions().getPetersburgBlockNumber()) |
|
|
|
.withMessage( |
|
|
|
.withMessage( |
|
|
|
"Genesis files cannot specify both petersburgBlock and constantinopleFixBlock."); |
|
|
|
"Genesis files cannot specify both petersburgBlock and constantinopleFixBlock."); |
|
|
|
} |
|
|
|
} |
|
|
|