Filter by total gas rather than GasUsed

See https://github.com/ava-labs/coreth/pull/843
This commit is contained in:
Stephen Buttolph
2025-03-13 12:43:46 +01:00
committed by Quentin Mc Gaw
parent 7b22ec6ef2
commit b05cd69548
2 changed files with 6 additions and 3 deletions
+1 -2
View File
@@ -9,7 +9,6 @@ import (
"testing"
"time"
"github.com/ava-labs/coreth/plugin/evm/ap4"
"github.com/ava-labs/subnet-evm/commontype"
"github.com/ava-labs/subnet-evm/consensus/dummy"
"github.com/ava-labs/subnet-evm/core/rawdb"
@@ -1387,7 +1386,7 @@ func TestInsertChainValidBlockFee(t *testing.T, create func(db ethdb.Database, g
signer := types.LatestSigner(params.TestChainConfig)
tip := big.NewInt(50000 * params.GWei)
transfer := big.NewInt(10000)
_, chain, _, err := GenerateChainWithGenesis(gspec, blockchain.engine, 3, ap4.TargetBlockRate-1, func(i int, gen *BlockGen) {
_, chain, _, err := GenerateChainWithGenesis(gspec, blockchain.engine, 3, 0, func(i int, gen *BlockGen) {
feeCap := new(big.Int).Add(gen.BaseFee(), tip)
tx := types.NewTx(&types.DynamicFeeTx{
ChainID: params.TestChainConfig.ChainID,
+5 -1
View File
@@ -92,10 +92,14 @@ func (f *feeInfoProvider) addHeader(ctx context.Context, header *types.Header) (
timestamp: header.Time,
baseFee: header.BaseFee,
}
totalGasUsed := new(big.Int).SetUint64(header.GasUsed)
minGasUsed := new(big.Int).SetUint64(f.minGasUsed)
// Don't bias the estimate with blocks containing a limited number of transactions paying to
// expedite block production.
var err error
if f.minGasUsed <= header.GasUsed {
if minGasUsed.Cmp(totalGasUsed) <= 0 {
// Compute minimum required tip to be included in previous block
//
// NOTE: Using this approach, we will never recommend that the caller