eth/tracers: fix a bug in prestateTracer #25884 (#1297)

Co-authored-by: Delweng <delweng@gmail.com>
This commit is contained in:
Daniel Liu 2025-09-09 06:41:52 +08:00 committed by GitHub
parent de4fa1d674
commit d962a06975
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,7 +79,7 @@ func (t *prestateTracer) CaptureStart(env *vm.EVM, from common.Address, to commo
// The sender balance is after reducing: value and gasLimit.
// We need to re-add them to get the pre-tx balance.
fromBal := t.prestate[from].Balance
fromBal := new(big.Int).Set(t.prestate[from].Balance)
gasPrice := env.TxContext.GasPrice
consumedGas := new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(t.gasLimit))
fromBal.Add(fromBal, new(big.Int).Add(value, consumedGas))