Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/txpool/blobpool/blobpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserve txpool.Addres
p.recheck(addr, nil)
}
var (
basefee = uint256.MustFromBig(eip1559.CalcBaseFee(p.chain.Config(), p.head, p.head.Time+1))
basefee = uint256.MustFromBig(eip1559.CalcBaseFee(p.chain.Config(), p.head, p.chain.Config().NextBlockTime(p.head.Time)))
blobfee = uint256.NewInt(params.BlobTxMinBlobGasprice)
)
if p.head.ExcessBlobGas != nil {
Expand Down Expand Up @@ -835,7 +835,7 @@ func (p *BlobPool) Reset(oldHead, newHead *types.Header) {
}
// Reset the price heap for the new set of basefee/blobfee pairs
var (
basefee = uint256.MustFromBig(eip1559.CalcBaseFee(p.chain.Config(), newHead, newHead.Time+1))
basefee = uint256.MustFromBig(eip1559.CalcBaseFee(p.chain.Config(), newHead, p.chain.Config().NextBlockTime(newHead.Time)))
blobfee = uint256.MustFromBig(big.NewInt(params.BlobTxMinBlobGasprice))
)
if newHead.ExcessBlobGas != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ func (pool *LegacyPool) runReorg(done chan struct{}, reset *txpoolResetRequest,
pool.demoteUnexecutables()
if reset.newHead != nil {
if pool.chainconfig.IsLondon(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) {
pendingBaseFee := eip1559.CalcBaseFee(pool.chainconfig, reset.newHead, reset.newHead.Time+1)
pendingBaseFee := eip1559.CalcBaseFee(pool.chainconfig, reset.newHead, pool.chainconfig.NextBlockTime(reset.newHead.Time))
pool.priced.SetBaseFee(pendingBaseFee)
} else {
pool.priced.Reheap()
Expand Down
2 changes: 1 addition & 1 deletion eth/gasprice/feehistory.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (oracle *Oracle) processBlock(bf *blockFees, percentiles []float64) {
bf.results.baseFee = new(big.Int)
}
if config.IsLondon(big.NewInt(int64(bf.blockNumber + 1))) {
bf.results.nextBaseFee = eip1559.CalcBaseFee(config, bf.header, bf.header.Time+1)
bf.results.nextBaseFee = eip1559.CalcBaseFee(config, bf.header, config.NextBlockTime(bf.header.Time))
} else {
bf.results.nextBaseFee = new(big.Int)
}
Expand Down
2 changes: 1 addition & 1 deletion graphql/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ func (b *Block) NextBaseFeePerGas(ctx context.Context) (*hexutil.Big, error) {
return nil, nil
}
}
nextBaseFee := eip1559.CalcBaseFee(chaincfg, header, header.Time+1)
nextBaseFee := eip1559.CalcBaseFee(chaincfg, header, chaincfg.NextBlockTime(header.Time))
return (*hexutil.Big)(nextBaseFee), nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ func NewRPCPendingTransaction(tx *types.Transaction, current *types.Header, conf
blockTime = uint64(0)
)
if current != nil {
baseFee = eip1559.CalcBaseFee(config, current, current.Time+1)
baseFee = eip1559.CalcBaseFee(config, current, config.NextBlockTime(current.Time))
blockNumber = current.Number.Uint64()
blockTime = current.Time
}
Expand Down
12 changes: 12 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ type ChainConfig struct {

// Optimism config, nil if not active
Optimism *OptimismConfig `json:"optimism,omitempty"`

// Seconds per L2 block
BlockTime uint64 `json:"blockTime,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to call this config var out as an op-stack diff with a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in fed1b3c.

}

// EthashConfig is the consensus engine configs for proof-of-work based sealing.
Expand Down Expand Up @@ -1349,3 +1352,12 @@ func ptrValueString[T any](t *T) string {
}
return fmt.Sprintf("%v", *t)
}

func (c *ChainConfig) NextBlockTime(currentBlockTime uint64) uint64 {
if c.BlockTime != 0 {
return currentBlockTime + c.BlockTime
}

// to be compatible with existing call sites
return currentBlockTime + 1
}