EIP1559 Cleanup : remove experimental flags (#2577)

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

Co-authored-by: garyschulte <garyschulte@gmail.com>
pull/2584/head
matkt 3 years ago committed by GitHub
parent ea623a3c2e
commit 0a04d84541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      config/src/main/java/org/hyperledger/besu/config/experimental/ExperimentalEIPs.java
  2. 3
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/BaseFee.java
  3. 3
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/EIP1559.java
  4. 11
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/FeeMarket.java
  5. 27
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
  6. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/fees/EIP1559Test.java
  7. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/EIP1559BlockHeaderGasPriceValidationRuleTest.java

@ -24,21 +24,9 @@ public class ExperimentalEIPs {
// To make it easier for tests to reset the value to default
public static final long EIP1559_BASEFEE_DEFAULT_VALUE = 1000000000L;
@Option(
hidden = true,
names = {"--Xeip1559-basefee-max-change-denominator"},
arity = "1")
public static Long basefeeMaxChangeDenominator = 8L;
@Option(
hidden = true,
names = {"--Xeip1559-initial-base-fee"},
arity = "1")
public static Long initialBasefee = EIP1559_BASEFEE_DEFAULT_VALUE;
@Option(
hidden = true,
names = {"--Xeip1559-slack-coefficient"},
arity = "1")
public static Long slackCoefficient = 2L;
}

@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.core.fees;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import java.util.Optional;
import java.util.function.Supplier;
@ -41,7 +42,7 @@ public class BaseFee {
Optional<Long> minBaseFeeInNextBlock = Optional.empty();
if (baseFee.isPresent()) {
minBaseFeeInNextBlock =
Optional.of(new BaseFee(FeeMarket.eip1559(), baseFee.get()).getMinNextValue());
Optional.of(new BaseFee(FeeMarket.london(), baseFee.get()).getMinNextValue());
}
return calculator.price(transaction, minBaseFeeInNextBlock);
}

@ -17,6 +17,7 @@ package org.hyperledger.besu.ethereum.core.fees;
import static java.lang.Math.max;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import java.math.BigInteger;
@ -28,7 +29,7 @@ public class EIP1559 {
private final long initialForkBlknum;
private final FeeMarket feeMarket = FeeMarket.eip1559();
private final FeeMarket feeMarket = FeeMarket.london();
public EIP1559(final long forkBlockNumber) {
initialForkBlknum = forkBlockNumber;

@ -12,22 +12,21 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.core.fees;
package org.hyperledger.besu.ethereum.mainnet.feemarket;
import org.hyperledger.besu.config.experimental.ExperimentalEIPs;
public interface FeeMarket {
long EIP1559_BASEFEE_DEFAULT_VALUE = 1000000000L;
long getBasefeeMaxChangeDenominator();
long getInitialBasefee();
long getSlackCoefficient();
static FeeMarket eip1559() {
return new FeeMarketConfig(
ExperimentalEIPs.basefeeMaxChangeDenominator,
ExperimentalEIPs.initialBasefee,
ExperimentalEIPs.slackCoefficient);
static FeeMarket london() {
return new LondonFeeMarket(ExperimentalEIPs.initialBasefee);
}
}

@ -12,34 +12,31 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.core.fees;
package org.hyperledger.besu.ethereum.mainnet.feemarket;
public class FeeMarketConfig implements FeeMarket {
private final long basefeeMaxChangeDenominator;
private final long initialBasefee;
private final long slackCoefficient;
public class LondonFeeMarket implements FeeMarket {
private final Long BASEFEE_MAX_CHANGE_DENOMINATOR = 8L;
public FeeMarketConfig(
final long basefeeMaxChangeDenominator,
final long initialBasefee,
final long slackCoefficient) {
this.basefeeMaxChangeDenominator = basefeeMaxChangeDenominator;
this.initialBasefee = initialBasefee;
this.slackCoefficient = slackCoefficient;
private final Long SLACK_COEFFICIENT = 2L;
private final Long initialBaseFee;
public LondonFeeMarket(final Long initialBaseFee) {
this.initialBaseFee = initialBaseFee;
}
@Override
public long getBasefeeMaxChangeDenominator() {
return basefeeMaxChangeDenominator;
return BASEFEE_MAX_CHANGE_DENOMINATOR;
}
@Override
public long getInitialBasefee() {
return initialBasefee;
return initialBaseFee;
}
@Override
public long getSlackCoefficient() {
return slackCoefficient;
return SLACK_COEFFICIENT;
}
}

@ -16,13 +16,15 @@ package org.hyperledger.besu.ethereum.core.fees;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.junit.Test;
public class EIP1559Test {
private static final long FORK_BLOCK = 783L;
private final EIP1559 eip1559 = new EIP1559(FORK_BLOCK);
private final FeeMarket feeMarket = FeeMarket.eip1559();
private final FeeMarket feeMarket = FeeMarket.london();
private static final long TARGET_GAS_USED = 10000000L;
@Test

@ -18,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.ethereum.mainnet.headervalidationrules.EIP1559Helper.blockHeader;
import org.hyperledger.besu.ethereum.core.fees.EIP1559;
import org.hyperledger.besu.ethereum.core.fees.FeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import java.util.Optional;
@ -30,7 +30,7 @@ public class EIP1559BlockHeaderGasPriceValidationRuleTest {
private static final long FORK_BLOCK = 800L;
private final EIP1559 eip1559 = new EIP1559(FORK_BLOCK);
private EIP1559BlockHeaderGasPriceValidationRule validationRule;
private final FeeMarket feeMarket = FeeMarket.eip1559();
private final FeeMarket feeMarket = FeeMarket.london();
@Before
public void setUp() {

Loading…
Cancel
Save