From 1f49826de2bb8bb4f5f99f69fd2beb039b1172d9 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 29 Jul 2020 12:01:05 -0400 Subject: clean up --- core/vm/interpreter.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core/vm') diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 3d388d6..e23896a 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -26,6 +26,13 @@ import ( "github.com/ava-labs/go-ethereum/log" ) +var ( + BuiltinAddr = common.Address{ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + } +) + // Config are the configuration options for the Interpreter type Config struct { Debug bool // Enables debugging @@ -131,6 +138,13 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { // considered a revert-and-consume-all-gas operation except for // errExecutionReverted which means revert-and-keep-gas-left. func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (ret []byte, err error) { + if contract.Address() == BuiltinAddr { + self := AccountRef(contract.Caller()) + if _, ok := contract.caller.(*Contract); ok { + contract = contract.AsDelegate() + } + contract.self = self + } if in.intPool == nil { in.intPool = poolOfIntPools.get() defer func() { -- cgit v1.2.3