core: fix pre-check for account balance under EIP-1559 (#23244)

When processing a transaction with London fork rules, EIP-1559 mandates
checking that the sender must have sufficient balance to cover gas * gasFeeCap.

In the EIP's pseudocode, this check happens after the value transferred by the
transaction has already been deducted. However, in go-ethereum, the balance
has not yet been updated when the check happens, and therefore needs to be
added explicitly.

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
Marius van der Wijden
2021-07-22 15:39:40 +02:00
committed by GitHub
parent f05419f0fb
commit 97aacd9b35
7 changed files with 84 additions and 2 deletions

View File

@ -369,7 +369,7 @@ func TestOverriddenTraceCall(t *testing.T) {
config: &TraceCallConfig{
Tracer: &tracer,
},
expectErr: core.ErrInsufficientFundsForTransfer,
expectErr: core.ErrInsufficientFunds,
expect: nil,
},
// Successful simple contract call