EIP-3554: Difficulty Bomb Delay to December 1st 2021 (#2289)

* implemented EIP-3554: Difficulty Bomb Delay to December 1st 2021

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* update CHANGELOG.md

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
pull/2300/head
matkt 4 years ago committed by GitHub
parent 3627662f82
commit 4fce5aea06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java
  3. 1
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java

@ -8,6 +8,7 @@
* Added support for the London Network Upgrade, although the block number must be set manually with `--override-genesis-config=londonBlock=<blocknumber>`. This is because the block numbers haven't been determined yet. The next release will include the number in the genesis file so it will support London with no intervention. [\#2237](https://github.com/hyperledger/besu/pull/2237)
* Implemented [EIP-3541](https://eips.ethereum.org/EIPS/eip-3541): Reject new contracts starting with the 0xEF byte [\#2243](https://github.com/hyperledger/besu/pull/2243)
* Implemented [EIP-3529](https://eips.ethereum.org/EIPS/eip-3529): Reduction in refunds [\#2238](https://github.com/hyperledger/besu/pull/2238)
* Implemented [EIP-3554](https://eips.ethereum.org/EIPS/eip-3554): Difficulty Bomb Delay [\#2289](https://github.com/hyperledger/besu/pull/2289)
### Bug Fixes

@ -39,6 +39,7 @@ public abstract class MainnetDifficultyCalculators {
private static final long BYZANTIUM_FAKE_BLOCK_OFFSET = 2_999_999L;
private static final long CONSTANTINOPLE_FAKE_BLOCK_OFFSET = 4_999_999L;
private static final long MUIR_GLACIER_FAKE_BLOCK_OFFSET = 8_999_999L;
private static final long LONDON_FAKE_BLOCK_OFFSET = 9_699_999L;
private MainnetDifficultyCalculators() {}
@ -82,6 +83,11 @@ public abstract class MainnetDifficultyCalculators {
(time, parent, protocolContext) ->
calculateThawedDifficulty(time, parent, MUIR_GLACIER_FAKE_BLOCK_OFFSET);
// As per https://eips.ethereum.org/EIPS/eip-3554
static DifficultyCalculator LONDON =
(time, parent, protocolContext) ->
calculateThawedDifficulty(time, parent, LONDON_FAKE_BLOCK_OFFSET);
private static BigInteger calculateThawedDifficulty(
final long time, final BlockHeader parent, final long fakeBlockOffset) {
final BigInteger parentDifficulty = difficulty(parent.getDifficulty());

@ -575,6 +575,7 @@ public abstract class MainnetProtocolSpecs {
MainnetEvmRegistries.london(gasCalculator, chainId.orElse(BigInteger.ZERO)))
.transactionPriceCalculator(transactionPriceCalculator.orElseThrow())
.eip1559(Optional.of(eip1559))
.difficultyCalculator(MainnetDifficultyCalculators.LONDON)
.gasBudgetCalculator(TransactionGasBudgetCalculator.eip1559(eip1559))
.blockHeaderValidatorBuilder(MainnetBlockHeaderValidator.createEip1559Validator(eip1559))
.ommerHeaderValidatorBuilder(

Loading…
Cancel
Save