cmd/evm: fix gasUsed in evm run cmd (#34732)

In the --create path, execFunc returns gasLeft as the second return
value, but the rest of the code treats this value as "gas used" (printed
as such, and compared in timedExec). This makes gas reporting incorrect
and can cause benchmark consistency checks to fail.
This commit is contained in:
Daniel Liu 2026-05-12 03:32:19 +08:00 committed by GitHub
parent 22919cec1b
commit 298c83502b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -321,7 +321,7 @@ func runCmd(ctx *cli.Context) error {
// don't mutate the state!
runtimeConfig.State = prestate.Copy()
output, _, gasLeft, err := runtime.Create(input, &runtimeConfig)
return output, gasLeft, err
return output, initialGas - gasLeft, err
}
} else {
if len(code) > 0 {