cmd/evm: fix gasUsed reporting in --create path to return gas used, not gas left

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-04-16 14:38:44 +08:00
parent 0b35ad95f5
commit d6a680682b

View file

@ -318,7 +318,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 {