From 1cd6bc81aabb6ff21f99931d9bfa1960f4a98da2 Mon Sep 17 00:00:00 2001 From: matkt Date: Wed, 7 Jul 2021 10:48:32 +0200 Subject: [PATCH] fix ropsten consensus issue (#2499) Signed-off-by: Karim TAAM Signed-off-by: Ratan Rai Sur --- .../org/hyperledger/besu/ethereum/core/fees/EIP1559.java | 5 ----- .../EIP1559BlockHeaderGasPriceValidationRule.java | 9 +++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/EIP1559.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/EIP1559.java index 20888cc1b01..c910fe412e3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/EIP1559.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/EIP1559.java @@ -73,11 +73,6 @@ public long computeBaseFee( return baseFee; } - public boolean isValidBaseFee(final long parentBaseFee, final long baseFee) { - return Math.abs(baseFee - parentBaseFee) - <= Math.max(1, parentBaseFee / feeMarket.getBasefeeMaxChangeDenominator()); - } - public boolean isEIP1559(final long blockNumber) { return blockNumber >= initialForkBlknum; } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/EIP1559BlockHeaderGasPriceValidationRule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/EIP1559BlockHeaderGasPriceValidationRule.java index e599d6e8f94..2c06e57a326 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/EIP1559BlockHeaderGasPriceValidationRule.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/EIP1559BlockHeaderGasPriceValidationRule.java @@ -46,17 +46,18 @@ public boolean validate(final BlockHeader header, final BlockHeader parent) { final Long currentBaseFee = header.getBaseFee().orElseThrow(EIP1559MissingBaseFeeFromBlockHeader::new); final long targetGasUsed = eip1559.targetGasUsed(parent); - final long baseFee = + final long expectedBaseFee = eip1559.computeBaseFee( header.getNumber(), parentBaseFee, parent.getGasUsed(), targetGasUsed); - if (baseFee != header.getBaseFee().orElseThrow()) { + if (expectedBaseFee != currentBaseFee) { LOG.info( "Invalid block header: basefee {} does not equal expected basefee {}", header.getBaseFee().orElseThrow(), - baseFee); + expectedBaseFee); return false; } - return baseFee == currentBaseFee && eip1559.isValidBaseFee(parentBaseFee, currentBaseFee); + + return true; } catch (final EIP1559MissingBaseFeeFromBlockHeader e) { LOG.info("Invalid block header: " + e.getMessage()); return false;