diff --git a/core/gaspool.go b/core/gaspool.go index e3795c1ee9..ba14e2dfbe 100644 --- a/core/gaspool.go +++ b/core/gaspool.go @@ -38,7 +38,7 @@ func (gp *GasPool) AddGas(amount uint64) *GasPool { // available and returns an error otherwise. func (gp *GasPool) SubGas(amount uint64) error { if uint64(*gp) < amount { - return ErrGasLimitReached + return fmt.Errorf("%w, have: %d, need: %d", ErrGasLimitReached, uint64(*gp), amount) } *(*uint64)(gp) -= amount return nil diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 1407d4a8b3..d8c48b5809 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -158,7 +158,7 @@ func TestStateProcessorErrors(t *testing.T) { txs: []*types.Transaction{ makeTx(key1, 0, common.Address{}, big.NewInt(0), 21000000, big.NewInt(12500000000), nil), }, - want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached", + want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached, have: 4712388, need: 21000000", }, { // ErrInsufficientFundsForTransfer txs: []*types.Transaction{ @@ -186,7 +186,7 @@ func TestStateProcessorErrors(t *testing.T) { txs: []*types.Transaction{ makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas*1000, big.NewInt(12500000000), nil), }, - want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached", + want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached, have: 4712388, need: 21000000", }, { // ErrFeeCapTooLow txs: []*types.Transaction{ diff --git a/miner/worker.go b/miner/worker.go index c8c4a2fe0e..2c54ac833b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -970,7 +970,7 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr } if gp.Gas() < params.TxGas && tx.Gas() > 0 { - log.Trace("Not enough gas for further transactions", "gp", gp) + log.Warn("Not enough gas for further transactions", "hash", tx.Hash().Hex(), "tx.Gas", tx.Gas(), "gp", gp, "need", params.TxGas) break } // Error may be ignored here. The error has already been checked @@ -1033,7 +1033,7 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr for { // If we don't have enough gas for any further transactions then we're done if gp.Gas() < params.TxGas { - log.Trace("Not enough gas for further transactions", "gp", gp) + log.Warn("Not enough gas for further transactions", "gp", gp, "need", params.TxGas) break } if txs == nil { @@ -1115,7 +1115,7 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr switch { case errors.Is(err, core.ErrGasLimitReached): // Pop the current out-of-gas transaction without shifting in the next from the account - log.Trace("Gas limit exceeded for current block", "sender", from) + log.Warn("Gas limit exceeded for current block", "hash", tx.Hash().Hex(), "tx.Gas", tx.Gas(), "err", err) txs.Pop() case errors.Is(err, core.ErrNonceTooLow):