Skip to content

Commit

Permalink
feat(tracing/hooks.go): add ContractCode method to OpContext interfac…
Browse files Browse the repository at this point in the history
…e to provide access to contract code

feat(vm/interpreter.go): add ContractCode method to ScopeContext to return the code of the contract being executed
  • Loading branch information
kchojn committed Sep 19, 2024
1 parent c4c2c4f commit 85df9c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/tracing/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,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
Expand Down

0 comments on commit 85df9c2

Please sign in to comment.