Derive gasIncrementAmount from MaxGasEIP1559 and DecayRange. (#850)

* Derive gasIncrementAmount from MaxGasEIP1559 and DecayRange.

* Update default decay range

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
pull/852/head
Abdelhamid Bakhta 5 years ago committed by GitHub
parent 636b93487b
commit 67ae915468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      config/src/main/java/org/hyperledger/besu/config/experimental/ExperimentalEIPs.java
  2. 1
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/FeeMarket.java
  3. 9
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/FeeMarketConfig.java

@ -69,13 +69,7 @@ public class ExperimentalEIPs {
hidden = true, hidden = true,
names = {"--Xeip1559-decay-range"}, names = {"--Xeip1559-decay-range"},
arity = "1") arity = "1")
public static Long decayRange = 800000L; public static Long decayRange = 1000000L;
@Option(
hidden = true,
names = {"--Xeip1559-gas-increment-amount"},
arity = "1")
public static Long gasIncrementAmount = 10L;
@Option( @Option(
hidden = true, hidden = true,

@ -40,7 +40,6 @@ public interface FeeMarket {
ExperimentalEIPs.targetGasUsed, ExperimentalEIPs.targetGasUsed,
ExperimentalEIPs.slackCoefficient, ExperimentalEIPs.slackCoefficient,
ExperimentalEIPs.decayRange, ExperimentalEIPs.decayRange,
ExperimentalEIPs.gasIncrementAmount,
ExperimentalEIPs.initialBasefee, ExperimentalEIPs.initialBasefee,
ExperimentalEIPs.perTxGasLimit); ExperimentalEIPs.perTxGasLimit);
} }

@ -18,26 +18,27 @@ public class FeeMarketConfig implements FeeMarket {
private final long basefeeMaxChangeDenominator; private final long basefeeMaxChangeDenominator;
private final long targetGasUsed; private final long targetGasUsed;
private final long decayRange; private final long decayRange;
private final long gasIncrementAmount;
private final long initialBasefee; private final long initialBasefee;
private final long perTxGaslimit; private final long perTxGaslimit;
private final long slackCoefficient; private final long slackCoefficient;
private final long maxGas;
private final long gasIncrementAmount;
public FeeMarketConfig( public FeeMarketConfig(
final long basefeeMaxChangeDenominator, final long basefeeMaxChangeDenominator,
final long targetGasUsed, final long targetGasUsed,
final long slackCoefficient, final long slackCoefficient,
final long decayRange, final long decayRange,
final long gasIncrementAmount,
final long initialBasefee, final long initialBasefee,
final long perTxGaslimit) { final long perTxGaslimit) {
this.basefeeMaxChangeDenominator = basefeeMaxChangeDenominator; this.basefeeMaxChangeDenominator = basefeeMaxChangeDenominator;
this.targetGasUsed = targetGasUsed; this.targetGasUsed = targetGasUsed;
this.slackCoefficient = slackCoefficient; this.slackCoefficient = slackCoefficient;
this.decayRange = decayRange; this.decayRange = decayRange;
this.gasIncrementAmount = gasIncrementAmount;
this.initialBasefee = initialBasefee; this.initialBasefee = initialBasefee;
this.perTxGaslimit = perTxGaslimit; this.perTxGaslimit = perTxGaslimit;
this.maxGas = slackCoefficient * targetGasUsed;
this.gasIncrementAmount = this.maxGas / 2 / this.decayRange;
} }
@Override @Override
@ -52,7 +53,7 @@ public class FeeMarketConfig implements FeeMarket {
@Override @Override
public long getMaxGas() { public long getMaxGas() {
return slackCoefficient * targetGasUsed; return maxGas;
} }
@Override @Override

Loading…
Cancel
Save