Allow to set any value for baseFeePerGas in the genesis file (#4177)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/4195/head
Fabio Di Fabio 2 years ago committed by GitHub
parent b02653a053
commit 93da04cf00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      CHANGELOG.md
  2. 12
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
  3. 7
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarketTest.java

@ -19,13 +19,15 @@ Besu requires a restart post-merge to re-enable remote transaction processing [#
- Several logging improvements
### Bug Fixes
- fix for stack overflow when searching for TTD block [#4169](https://github.com/hyperledger/besu/pull/4169)
- fix for chain stuck issue [#4175](https://github.com/hyperledger/besu/pull/4175)
- Allow to set any value for baseFeePerGas in the genesis file [#4177](https://github.com/hyperledger/besu/pull/4177)
- Fix for stack overflow when searching for TTD block [#4169](https://github.com/hyperledger/besu/pull/4169)
- Fix for chain stuck issue [#4175](https://github.com/hyperledger/besu/pull/4175)
### Download links
- https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/22.7.0-RC3/besu-22.7.0-RC3.tar.gz / sha256: `6a1ee89c82db9fa782d34733d8a8c726670378bcb71befe013da48d7928490a6`
- https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/22.7.0-RC3/besu-22.7.0-RC3.zip / sha256: `5de22445ab2a270cf33e1850cd28f1946442b7104738f0d1ac253a009c53414e`
## 22.7.0-RC2
### Additions and Improvements

@ -32,14 +32,13 @@ public class LondonFeeMarket implements BaseFeeMarket {
GenesisConfigFile.BASEFEE_AT_GENESIS_DEFAULT_VALUE;
static final long DEFAULT_BASEFEE_MAX_CHANGE_DENOMINATOR = 8L;
static final long DEFAULT_SLACK_COEFFICIENT = 2L;
// required for integer arithmetic to work when baseFee > 0
private static final Wei DEFAULT_BASEFEE_FLOOR = Wei.of(7L);
private static final Logger LOG = LoggerFactory.getLogger(LondonFeeMarket.class);
private final Wei baseFeeInitialValue;
private final long londonForkBlockNumber;
private final TransactionPriceCalculator txPriceCalculator;
private Wei baseFeeFloor = DEFAULT_BASEFEE_FLOOR;
private final Wei baseFeeFloor;
public LondonFeeMarket(final long londonForkBlockNumber) {
this(londonForkBlockNumber, Optional.empty());
@ -50,14 +49,7 @@ public class LondonFeeMarket implements BaseFeeMarket {
this.txPriceCalculator = TransactionPriceCalculator.eip1559();
this.londonForkBlockNumber = londonForkBlockNumber;
this.baseFeeInitialValue = baseFeePerGasOverride.orElse(DEFAULT_BASEFEE_INITIAL_VALUE);
if (baseFeeInitialValue.isZero()) {
baseFeeFloor = Wei.ZERO;
} else if (baseFeeInitialValue.lessThan(DEFAULT_BASEFEE_FLOOR)) {
throw new IllegalStateException(
String.format(
"baseFee must be either 0 or > %s wei to avoid integer arithmetic issues",
DEFAULT_BASEFEE_FLOOR));
}
this.baseFeeFloor = baseFeeInitialValue.isZero() ? Wei.ZERO : DEFAULT_BASEFEE_FLOOR;
}
@Override

@ -15,7 +15,6 @@
package org.hyperledger.besu.ethereum.mainnet.feemarket;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.hyperledger.besu.crypto.KeyPair;
import org.hyperledger.besu.crypto.SignatureAlgorithmFactory;
@ -72,10 +71,4 @@ public class LondonFeeMarketTest {
final LondonFeeMarket londonFeeMarket = new LondonFeeMarket(0, Optional.of(Wei.ZERO));
assertThat(londonFeeMarket.satisfiesFloorTxCost(transaction)).isTrue();
}
@Test
public void throwsWhenBaseFeeOverrideIsNonZeroAndBelowFloor() {
assertThatThrownBy(() -> new LondonFeeMarket(0, Optional.of(Wei.of(6))))
.isInstanceOf(IllegalStateException.class);
}
}

Loading…
Cancel
Save