implement tentative mainnet TTD (#4260)

* implement tentative mainnet TTD
* fix unit test breakage
* add to change log

Signed-off-by: garyschulte <garyschulte@gmail.com>
pull/4278/head
garyschulte 2 years ago committed by GitHub
parent 1d508bab42
commit ded02391a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      besu/src/test/java/org/hyperledger/besu/RunnerTest.java
  3. 9
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  4. 1
      config/src/main/resources/mainnet.json
  5. 11
      config/src/test/java/org/hyperledger/besu/config/GenesisConfigFileTest.java

@ -6,6 +6,7 @@
- Introduce a cap to reputation score increase [#4230](https://github.com/hyperledger/besu/pull/4230) - Introduce a cap to reputation score increase [#4230](https://github.com/hyperledger/besu/pull/4230)
- Add experimental CLI option for `--Xp2p-peer-lower-bound` [#4200](https://github.com/hyperledger/besu/pull/4200) - Add experimental CLI option for `--Xp2p-peer-lower-bound` [#4200](https://github.com/hyperledger/besu/pull/4200)
- Improve pending blocks retrieval mechanism [#4227](https://github.com/hyperledger/besu/pull/4227) - Improve pending blocks retrieval mechanism [#4227](https://github.com/hyperledger/besu/pull/4227)
- set mainnet terminal total difficulty [#4260](https://github.com/hyperledger/besu/pull/4260)
### Bug Fixes ### Bug Fixes
- Fixes off-by-one error for mainnet TTD fallback [#4223](https://github.com/hyperledger/besu/pull/4223) - Fixes off-by-one error for mainnet TTD fallback [#4223](https://github.com/hyperledger/besu/pull/4223)

@ -403,6 +403,8 @@ public final class RunnerTest {
(node) -> { (node) -> {
// Clear DAO block so that inability to validate DAO block won't interfere with fast sync // Clear DAO block so that inability to validate DAO block won't interfere with fast sync
node.remove("daoForkBlock"); node.remove("daoForkBlock");
// remove merge terminal difficulty for fast sync in the absence of a CL mock
node.remove("terminalTotalDifficulty");
}); });
return GenesisConfigFile.fromConfig(jsonNode); return GenesisConfigFile.fromConfig(jsonNode);
} }

@ -3670,6 +3670,8 @@ public class BesuCommandTest extends CommandTestAbstract {
final Address requestedCoinbase = Address.fromHexString("0000011111222223333344444"); final Address requestedCoinbase = Address.fromHexString("0000011111222223333344444");
parseCommand( parseCommand(
"--network",
"dev",
"--miner-coinbase", "--miner-coinbase",
requestedCoinbase.toString(), requestedCoinbase.toString(),
"--min-gas-price", "--min-gas-price",
@ -3692,7 +3694,8 @@ public class BesuCommandTest extends CommandTestAbstract {
final Path toml = final Path toml =
createTempFile( createTempFile(
"toml", "toml",
"miner-coinbase=\"" "network=\"dev\"\n"
+ "miner-coinbase=\""
+ requestedCoinbase + requestedCoinbase
+ "\"\n" + "\"\n"
+ "min-gas-price=42\n" + "min-gas-price=42\n"
@ -3735,7 +3738,7 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test @Test
public void minGasPriceRequiresMainOption() { public void minGasPriceRequiresMainOption() {
parseCommand("--min-gas-price", "0"); parseCommand("--min-gas-price", "0", "--network", "dev");
verifyOptionsConstraintLoggerCall("--miner-enabled", "--min-gas-price"); verifyOptionsConstraintLoggerCall("--miner-enabled", "--min-gas-price");
@ -3745,7 +3748,7 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test @Test
public void minGasPriceRequiresMainOptionToml() throws IOException { public void minGasPriceRequiresMainOptionToml() throws IOException {
final Path toml = createTempFile("toml", "min-gas-price=0\n"); final Path toml = createTempFile("toml", "min-gas-price=0\nnetwork=\"dev\"\n");
parseCommand("--config-file", toml.toString()); parseCommand("--config-file", toml.toString());

@ -13,6 +13,7 @@
"londonBlock": 12965000, "londonBlock": 12965000,
"arrowGlacierBlock": 13773000, "arrowGlacierBlock": 13773000,
"grayGlacierBlock": 15050000, "grayGlacierBlock": 15050000,
"terminalTotalDifficulty": 58750000000000000000000,
"ethash": { "ethash": {
}, },
"discovery": { "discovery": {

@ -228,6 +228,17 @@ public class GenesisConfigFileTest {
.isEqualTo(UInt256.valueOf(new BigInteger("10790000"))); .isEqualTo(UInt256.valueOf(new BigInteger("10790000")));
} }
@Test
public void assertMainnetTerminalTotalDifficulty() {
GenesisConfigOptions mainnetOptions =
GenesisConfigFile.genesisFileFromResources("/mainnet.json").getConfigOptions();
assertThat(mainnetOptions.getTerminalTotalDifficulty()).isPresent();
// tentative as of 2022-08-11:
assertThat(mainnetOptions.getTerminalTotalDifficulty().get())
.isEqualTo(UInt256.valueOf(new BigInteger("58750000000000000000000")));
}
@Test @Test
public void assertTerminalTotalDifficultyOverride() { public void assertTerminalTotalDifficultyOverride() {
GenesisConfigOptions ropstenOverrideOptions = GenesisConfigOptions ropstenOverrideOptions =

Loading…
Cancel
Save