-
Notifications
You must be signed in to change notification settings - Fork 148
Return multi-gas in execution result #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR adds up the dynamic and constant opcode multi-gas cost in the EVM interpreter, and then return it in the ExecutionResult struct. Close NIT-3468
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds tracking of multi-dimensional gas (“multi-gas”) throughout the EVM execution and surfaces it in the ExecutionResult
.
- Extend the
EVM.Call
API to return ausedMultiGas
value and update all call sites. - Record static and dynamic multi-gas usage in the interpreter and aggregate it in state transition.
- Propagate
UsedMultiGas
into theExecutionResult
struct.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/state_test.go | Adjusted benchmark call to accept the extra blank return value |
core/vm/runtime/runtime.go | Updated Execute/Call wrappers to ignore the new multi-gas return |
core/vm/interpreter_test.go | Updated test to accept the additional blank return from Call |
core/vm/interpreter.go | Track and accumulate multi-gas for static and dynamic operations |
core/vm/instructions.go | Updated CALL opcode handler to unpack the new return value |
core/vm/gas_table_test.go | Adapted tests to ignore the new multi-gas return |
core/vm/evm.go | Extended EVM.Call signature and added zero‐gas fallbacks |
core/vm/contract.go | Added UsedMultiGas field to Contract |
core/state_transition.go | Added UsedMultiGas to ExecutionResult and propagate refunds |
core/state_processor.go | Updated system call sites to unpack extra return from Call |
Comments suppressed due to low confidence (3)
core/vm/interpreter.go:294
- [nitpick] The variable
multigasDynamicCost
could be renamed todynamicMultiGasCost
to align withdynamicCost
and improve readability.
var multigasDynamicCost *multigas.MultiGas
core/state_transition.go:754
- There are no tests verifying the new
UsedMultiGas
field inExecutionResult
; consider adding test cases to validate multi-gas is correctly computed and returned.
UsedMultiGas: usedMultiGas,
core/vm/evm.go:202
- Update the doc comment above
EVM.Call
to include the newusedMultiGas
return parameter, explaining its purpose and units.
func (evm *EVM) Call(caller common.Address, addr common.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, usedMultiGas *multigas.MultiGas, err error) {
This will be handled properly in a future issue.
Pull the following changes: * OffchainLabs/go-ethereum#488 * OffchainLabs/go-ethereum#497
This PR adds up the dynamic and constant opcode multi-gas cost in the EVM interpreter, and then return it in the ExecutionResult struct.
Close NIT-3468