Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ropsten TTD config #3871

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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