Skip to content

Commit

Permalink
Merge pull request #648 from onflow/mpeter/fix-hardhat-ignition-deplo…
Browse files Browse the repository at this point in the history
…yment

Set a non-zero `BaseFeePerGas` on block responses
  • Loading branch information
m-Peter authored Nov 7, 2024
2 parents 1d6f350 + e8ae478 commit 8d71209
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (

const maxFeeHistoryBlockCount = 1024

var baseFeesPerGas = big.NewInt(1)

// A map containing all the valid method names that are found
// in the Ethereum JSON-RPC API specification.
// Update accordingly if any new methods are added/removed.
Expand Down Expand Up @@ -937,7 +939,7 @@ func (b *BlockChainAPI) FeeHistory(
oldestBlock = (*hexutil.Big)(big.NewInt(int64(block.Height)))
}

baseFees = append(baseFees, (*hexutil.Big)(big.NewInt(0)))
baseFees = append(baseFees, (*hexutil.Big)(baseFeesPerGas))

rewards = append(rewards, blockRewards)

Expand Down Expand Up @@ -1053,7 +1055,7 @@ func (b *BlockChainAPI) prepareBlockResponse(
GasLimit: hexutil.Uint64(blockGasLimit),
Nonce: types.BlockNonce{0x1},
Timestamp: hexutil.Uint64(block.Timestamp),
BaseFeePerGas: hexutil.Big(*big.NewInt(0)),
BaseFeePerGas: hexutil.Big(*baseFeesPerGas),
LogsBloom: types.LogsBloom([]*types.Log{}),
Miner: evmTypes.CoinbaseAddress.ToCommon(),
Sha3Uncles: types.EmptyUncleHash,
Expand Down Expand Up @@ -1230,8 +1232,7 @@ func (b *BlockChainAPI) GetUncleByBlockNumberAndIndex(

// MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.
func (b *BlockChainAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error) {
fee := hexutil.Big(*big.NewInt(1))
return &fee, nil
return (*hexutil.Big)(b.config.GasPrice), nil
}

// Mining returns true if client is actively mining new blocks.
Expand Down
2 changes: 1 addition & 1 deletion tests/web3js/eth_non_interactive_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ it('get fee history', async () => {
{
oldestBlock: 1n,
reward: [['0x96'], ['0x96'], ['0x96']], // gas price is 150 during testing
baseFeePerGas: [0n, 0n, 0n],
baseFeePerGas: [1n, 1n, 1n],
gasUsedRatio: [0, 0, 0.006205458333333334]
}
)
Expand Down

0 comments on commit 8d71209

Please sign in to comment.