core/tracing, core/vm: add ContractCode to the OpContext (#30466)

Extends the opcontext interface to include accessor for code being executed in current context. While it is possible to get the code via `statedb.GetCode`, that approach doesn't work for initcode.
pull/30503/head
Karol Chojnowski 1 month ago committed by GitHub
parent f2e13c7e33
commit 55ed8fef0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      core/tracing/hooks.go
  2. 5
      core/vm/interpreter.go

@ -34,6 +34,7 @@ type OpContext interface {
Address() common.Address
CallValue() *uint256.Int
CallInput() []byte
ContractCode() []byte
}
// StateDB gives tracers access to the whole state.

@ -84,6 +84,11 @@ func (ctx *ScopeContext) CallInput() []byte {
return ctx.Contract.Input
}
// ContractCode returns the code of the contract being executed.
func (ctx *ScopeContext) ContractCode() []byte {
return ctx.Contract.Code
}
// EVMInterpreter represents an EVM interpreter
type EVMInterpreter struct {
evm *EVM

Loading…
Cancel
Save