Skip to content

Commit

Permalink
ropsten TTD config (#3871)
Browse files Browse the repository at this point in the history
* ropsten TTD config

Signed-off-by: garyschulte <garyschulte@gmail.com>
  • Loading branch information
garyschulte authored May 19, 2022
1 parent f89db68 commit 40a6ca2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- GraphQL - allow null log topics in queries which match any topic [#3662](https://github.com/hyperledger/besu/pull/3662)
- multi-arch docker builds for amd64 and arm64 [#2954](https://github.com/hyperledger/besu/pull/2954)
- Filter Netty native lib errors likewise the pure Java implementation [#3807](https://github.com/hyperledger/besu/pull/3807)
- Add ropsten terminal total difficulty config [#3871](https://github.com/hyperledger/besu/pull/3871)

### Bug Fixes
- Stop the BlockPropagationManager when it receives the TTD reached event [#3809](https://github.com/hyperledger/besu/pull/3809)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ private GenesisConfigFile(final ObjectNode config) {
}

public static GenesisConfigFile mainnet() {
try {
return fromConfig(
Resources.toString(GenesisConfigFile.class.getResource("/mainnet.json"), UTF_8));
} catch (final IOException e) {
throw new IllegalStateException(e);
}
return genesisFileFromResources("/mainnet.json");
}

public static ObjectNode mainnetJsonNode() {
Expand All @@ -64,18 +59,17 @@ public static ObjectNode mainnetJsonNode() {
}

public static GenesisConfigFile development() {
try {
return fromConfig(
Resources.toString(GenesisConfigFile.class.getResource("/dev.json"), UTF_8));
} catch (final IOException e) {
throw new IllegalStateException(e);
}
return genesisFileFromResources("/dev.json");
}

public static GenesisConfigFile ecip1049dev() {
return genesisFileFromResources("/ecip1049_dev.json");
}

public static GenesisConfigFile genesisFileFromResources(final String resourceName) {
try {
return fromConfig(
Resources.toString(GenesisConfigFile.class.getResource("/ecip1049_dev.json"), UTF_8));
Resources.toString(GenesisConfigFile.class.getResource(resourceName), UTF_8));
} catch (final IOException e) {
throw new IllegalStateException(e);
}
Expand Down
1 change: 1 addition & 0 deletions config/src/main/resources/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"muirGlacierBlock": 7117117,
"berlinBlock": 9812189,
"londonBlock": 10499401,
"terminalTotalDifficulty": 43531756765713534,
"ethash": {
},
"discovery": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,27 @@ public void shouldGetEmptyTerminalTotalDifficultyAtGenesis() {
assertThat(EMPTY_CONFIG.getConfigOptions().getTerminalTotalDifficulty()).isNotPresent();
}

@Test
public void assertRopstenTerminalTotalDifficulty() {
GenesisConfigOptions ropstenOptions =
GenesisConfigFile.genesisFileFromResources("/ropsten.json").getConfigOptions();

assertThat(ropstenOptions.getTerminalTotalDifficulty()).isPresent();
assertThat(ropstenOptions.getTerminalTotalDifficulty().get())
.isEqualTo(UInt256.valueOf(43531756765713534L));
}

@Test
public void assertTerminalTotalDifficultyOverride() {
GenesisConfigOptions ropstenOverrideOptions =
GenesisConfigFile.genesisFileFromResources("/ropsten.json")
.getConfigOptions(Map.of("terminalTotalDifficulty", String.valueOf(Long.MAX_VALUE)));

assertThat(ropstenOverrideOptions.getTerminalTotalDifficulty()).isPresent();
assertThat(ropstenOverrideOptions.getTerminalTotalDifficulty().get())
.isEqualTo(UInt256.valueOf(Long.MAX_VALUE));
}

@Test
public void shouldFindParisForkAndAlias() {
GenesisConfigFile parisGenesis =
Expand Down

0 comments on commit 40a6ca2

Please sign in to comment.