From 3e37ed1b8217a3704d9a9d8a2f16c5fb31af5427 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 8 Apr 2026 12:44:39 +0200 Subject: [PATCH] core: fix tx-inclusion tests --- core/gaspool.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/gaspool.go b/core/gaspool.go index 9ce156bb9b..06071aebdb 100644 --- a/core/gaspool.go +++ b/core/gaspool.go @@ -74,19 +74,21 @@ func (gp *GasPool) ReturnGas(returned uint64, gasUsed uint64) error { } // ReturnGasAmsterdam calculates the new remaining gas in the pool after the -// execution of a message. The remaining gas in the pool is -// block.gasLimit - max(cumulative_regular, cumulative_state) +// execution of a message. func (gp *GasPool) ReturnGasAmsterdam(txRegular, txState, receiptGasUsed uint64) error { gp.cumulativeRegular += txRegular gp.cumulativeState += txState gp.cumulativeUsed += receiptGasUsed + // Block validity: both dimensions must fit within the gas limit. blockUsed := max(gp.cumulativeRegular, gp.cumulativeState) if gp.initial < blockUsed { return fmt.Errorf("%w: block gas overflow: initial %d, used %d (regular: %d, state: %d)", ErrGasLimitReached, gp.initial, blockUsed, gp.cumulativeRegular, gp.cumulativeState) } - gp.remaining = gp.initial - blockUsed + // TX inclusion: only the regular dimension is checked when deciding + // whether the next transaction fits. + gp.remaining = gp.initial - gp.cumulativeRegular return nil }