From fb5f25eeee6091ab4f70506a9b0ff36affe4d879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 14 Dec 2017 13:28:44 +0100 Subject: core/vm: Remove snapshot param from Interpreter.Run() --- core/vm/evm.go | 14 +++++++------- core/vm/interpreter.go | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'core/vm') diff --git a/core/vm/evm.go b/core/vm/evm.go index 344435f73..cbb5a03ce 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -38,7 +38,7 @@ type ( ) // run runs the given contract and takes care of running precompiles with a fallback to the byte code interpreter. -func run(evm *EVM, snapshot int, contract *Contract, input []byte) ([]byte, error) { +func run(evm *EVM, contract *Contract, input []byte) ([]byte, error) { if contract.CodeAddr != nil { precompiles := PrecompiledContractsHomestead if evm.ChainConfig().IsByzantium(evm.BlockNumber) { @@ -48,7 +48,7 @@ func run(evm *EVM, snapshot int, contract *Contract, input []byte) ([]byte, erro return RunPrecompiledContract(p, input, contract) } } - return evm.interpreter.Run(snapshot, contract, input) + return evm.interpreter.Run(contract, input) } // Context provides the EVM with auxiliary information. Once provided @@ -171,7 +171,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas contract := NewContract(caller, to, value, gas) contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) - ret, err = run(evm, snapshot, contract, input) + ret, err = run(evm, contract, input) // When an error was returned by the EVM or when setting the creation code // above we revert to the snapshot and consume any gas remaining. Additionally // when we're in homestead this also counts for code storage gas errors. @@ -215,7 +215,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte, contract := NewContract(caller, to, value, gas) contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) - ret, err = run(evm, snapshot, contract, input) + ret, err = run(evm, contract, input) if err != nil { evm.StateDB.RevertToSnapshot(snapshot) if err != errExecutionReverted { @@ -248,7 +248,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by contract := NewContract(caller, to, nil, gas).AsDelegate() contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) - ret, err = run(evm, snapshot, contract, input) + ret, err = run(evm, contract, input) if err != nil { evm.StateDB.RevertToSnapshot(snapshot) if err != errExecutionReverted { @@ -291,7 +291,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte // When an error was returned by the EVM or when setting the creation code // above we revert to the snapshot and consume any gas remaining. Additionally // when we're in Homestead this also counts for code storage gas errors. - ret, err = run(evm, snapshot, contract, input) + ret, err = run(evm, contract, input) if err != nil { evm.StateDB.RevertToSnapshot(snapshot) if err != errExecutionReverted { @@ -338,7 +338,7 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I if evm.vmConfig.NoRecursion && evm.depth > 0 { return nil, contractAddr, gas, nil } - ret, err = run(evm, snapshot, contract, nil) + ret, err = run(evm, contract, nil) // check whether the max code size has been exceeded maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize // if the contract creation ran successfully and no errors were returned diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index ac6000f97..455f970dd 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -107,9 +107,9 @@ func (in *Interpreter) enforceRestrictions(op OpCode, operation operation, stack // the return byte-slice and an error if one occurred. // // It's important to note that any errors returned by the interpreter should be -// considered a revert-and-consume-all-gas operation. No error specific checks -// should be handled to reduce complexity and errors further down the in. -func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret []byte, err error) { +// considered a revert-and-consume-all-gas operation except for +// errExecutionReverted which means revert-and-keep-gas-left. +func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err error) { // Increment the call depth which is restricted to 1024 in.evm.depth++ defer func() { in.evm.depth-- }() -- cgit v1.2.3 From 5258785c81959109138ebeca613f12c277188abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 21 Dec 2017 13:56:11 +0200 Subject: cmd, core, eth/tracers: support fancier js tracing (#15516) * cmd, core, eth/tracers: support fancier js tracing * eth, internal/web3ext: rework trace API, concurrency, chain tracing * eth/tracers: add three more JavaScript tracers * eth/tracers, vendor: swap ottovm to duktape for tracing * core, eth, internal: finalize call tracer and needed extras * eth, tests: prestate tracer, call test suite, rewinding * vendor: fix windows builds for tracer js engine * vendor: temporary duktape fix * eth/tracers: fix up 4byte and evmdis tracer * vendor: pull in latest duktape with my upstream fixes * eth: fix some review comments * eth: rename rewind to reexec to make it more obvious * core/vm: terminate tracing using defers --- core/vm/evm.go | 27 ++++++++++++++++++++++++--- core/vm/interpreter.go | 17 +++++++++++------ core/vm/logger.go | 10 ++++++++++ 3 files changed, 45 insertions(+), 9 deletions(-) (limited to 'core/vm') diff --git a/core/vm/evm.go b/core/vm/evm.go index cbb5a03ce..a3f3a97cb 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -19,6 +19,7 @@ package vm import ( "math/big" "sync/atomic" + "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" @@ -165,13 +166,23 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas } evm.Transfer(evm.StateDB, caller.Address(), to.Address(), value) - // initialise a new contract and set the code that is to be used by the - // E The contract is a scoped environment for this execution context - // only. + // Initialise a new contract and set the code that is to be used by the EVM. + // The contract is a scoped environment for this execution context only. contract := NewContract(caller, to, value, gas) contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) + start := time.Now() + + // Capture the tracer start/end events in debug mode + if evm.vmConfig.Debug && evm.depth == 0 { + evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value) + + defer func() { // Lazy evaluation of the parameters + evm.vmConfig.Tracer.CaptureEnd(ret, gas-contract.Gas, time.Since(start), err) + }() + } ret, err = run(evm, contract, input) + // When an error was returned by the EVM or when setting the creation code // above we revert to the snapshot and consume any gas remaining. Additionally // when we're in homestead this also counts for code storage gas errors. @@ -338,7 +349,14 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I if evm.vmConfig.NoRecursion && evm.depth > 0 { return nil, contractAddr, gas, nil } + + if evm.vmConfig.Debug && evm.depth == 0 { + evm.vmConfig.Tracer.CaptureStart(caller.Address(), contractAddr, true, code, gas, value) + } + start := time.Now() + ret, err = run(evm, contract, nil) + // check whether the max code size has been exceeded maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize // if the contract creation ran successfully and no errors were returned @@ -367,6 +385,9 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I if maxCodeSizeExceeded && err == nil { err = errMaxCodeSizeExceeded } + if evm.vmConfig.Debug && evm.depth == 0 { + evm.vmConfig.Tracer.CaptureEnd(ret, gas-contract.Gas, time.Since(start), err) + } return ret, contractAddr, contract.Gas, err } diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 455f970dd..482e67a3a 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -144,12 +144,17 @@ func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err er ) contract.Input = input - defer func() { - if err != nil && !logged && in.cfg.Debug { - in.cfg.Tracer.CaptureState(in.evm, pcCopy, op, gasCopy, cost, mem, stack, contract, in.evm.depth, err) - } - }() - + if in.cfg.Debug { + defer func() { + if err != nil { + if !logged { + in.cfg.Tracer.CaptureState(in.evm, pcCopy, op, gasCopy, cost, mem, stack, contract, in.evm.depth, err) + } else { + in.cfg.Tracer.CaptureFault(in.evm, pcCopy, op, gasCopy, cost, mem, stack, contract, in.evm.depth, err) + } + } + }() + } // The Interpreter main run loop (contextual). This loop runs until either an // explicit STOP, RETURN or SELFDESTRUCT is executed, an error occurred during // the execution of one of the operations or until the done flag is set by the diff --git a/core/vm/logger.go b/core/vm/logger.go index 75309da92..1a6e43ee3 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -84,7 +84,9 @@ func (s *StructLog) OpName() string { // Note that reference types are actual VM data structures; make copies // if you need to retain them beyond the current call. type Tracer interface { + CaptureStart(from common.Address, to common.Address, call bool, input []byte, gas uint64, value *big.Int) error CaptureState(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, contract *Contract, depth int, err error) error + CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, contract *Contract, depth int, err error) error CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error } @@ -111,6 +113,10 @@ func NewStructLogger(cfg *LogConfig) *StructLogger { return logger } +func (l *StructLogger) CaptureStart(from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) error { + return nil +} + // CaptureState logs a new structured log message and pushes it out to the environment // // CaptureState also tracks SSTORE ops to track dirty values. @@ -161,6 +167,10 @@ func (l *StructLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost ui return nil } +func (l *StructLogger) CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, contract *Contract, depth int, err error) error { + return nil +} + func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error { fmt.Printf("0x%x", output) if err != nil { -- cgit v1.2.3 From 6f69cdd109b1dd692b8dfb15e7c53d2051fbc946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 13 Nov 2017 13:47:27 +0200 Subject: all: switch gas limits from big.Int to uint64 --- core/vm/evm.go | 2 +- core/vm/gas_table.go | 6 ++---- core/vm/instructions.go | 2 +- core/vm/interface.go | 4 ++-- core/vm/noop.go | 4 ++-- core/vm/runtime/env.go | 4 +--- 6 files changed, 9 insertions(+), 13 deletions(-) (limited to 'core/vm') diff --git a/core/vm/evm.go b/core/vm/evm.go index a3f3a97cb..8796a633e 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -69,7 +69,7 @@ type Context struct { // Block information Coinbase common.Address // Provides information for COINBASE - GasLimit *big.Int // Provides information for GASLIMIT + GasLimit uint64 // Provides information for GASLIMIT BlockNumber *big.Int // Provides information for NUMBER Time *big.Int // Provides information for TIME Difficulty *big.Int // Provides information for DIFFICULTY diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index ff109af57..83adba428 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -17,8 +17,6 @@ package vm import ( - "math/big" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/params" @@ -130,7 +128,7 @@ func gasSStore(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, m // 0 => non 0 return params.SstoreSetGas, nil } else if !common.EmptyHash(val) && common.EmptyHash(common.BigToHash(y)) { - evm.StateDB.AddRefund(new(big.Int).SetUint64(params.SstoreRefundGas)) + evm.StateDB.AddRefund(params.SstoreRefundGas) return params.SstoreClearGas, nil } else { @@ -405,7 +403,7 @@ func gasSuicide(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, } if !evm.StateDB.HasSuicided(contract.Address()) { - evm.StateDB.AddRefund(new(big.Int).SetUint64(params.SuicideRefundGas)) + evm.StateDB.AddRefund(params.SuicideRefundGas) } return gas, nil } diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 1d1585fca..766172501 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -472,7 +472,7 @@ func opDifficulty(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stac } func opGasLimit(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) { - stack.push(math.U256(new(big.Int).Set(evm.GasLimit))) + stack.push(math.U256(new(big.Int).SetUint64(evm.GasLimit))) return nil, nil } diff --git a/core/vm/interface.go b/core/vm/interface.go index c0c52732b..1ef91cf1d 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -39,8 +39,8 @@ type StateDB interface { SetCode(common.Address, []byte) GetCodeSize(common.Address) int - AddRefund(*big.Int) - GetRefund() *big.Int + AddRefund(uint64) + GetRefund() uint64 GetState(common.Address, common.Hash) common.Hash SetState(common.Address, common.Hash, common.Hash) diff --git a/core/vm/noop.go b/core/vm/noop.go index 2a04a9565..b71ead0d7 100644 --- a/core/vm/noop.go +++ b/core/vm/noop.go @@ -55,8 +55,8 @@ func (NoopStateDB) GetCodeHash(common.Address) common.Hash func (NoopStateDB) GetCode(common.Address) []byte { return nil } func (NoopStateDB) SetCode(common.Address, []byte) {} func (NoopStateDB) GetCodeSize(common.Address) int { return 0 } -func (NoopStateDB) AddRefund(*big.Int) {} -func (NoopStateDB) GetRefund() *big.Int { return nil } +func (NoopStateDB) AddRefund(uint64) {} +func (NoopStateDB) GetRefund() uint64 { return 0 } func (NoopStateDB) GetState(common.Address, common.Hash) common.Hash { return common.Hash{} } func (NoopStateDB) SetState(common.Address, common.Hash, common.Hash) {} func (NoopStateDB) Suicide(common.Address) bool { return false } diff --git a/core/vm/runtime/env.go b/core/vm/runtime/env.go index 818da1be2..31c9b9cf9 100644 --- a/core/vm/runtime/env.go +++ b/core/vm/runtime/env.go @@ -17,8 +17,6 @@ package runtime import ( - "math/big" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" @@ -35,7 +33,7 @@ func NewEnv(cfg *Config) *vm.EVM { BlockNumber: cfg.BlockNumber, Time: cfg.Time, Difficulty: cfg.Difficulty, - GasLimit: new(big.Int).SetUint64(cfg.GasLimit), + GasLimit: cfg.GasLimit, GasPrice: cfg.GasPrice, } -- cgit v1.2.3 From 1c2378b926b4ae96ae42a4e802058a2fcd42c87b Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 4 Jan 2018 13:18:30 +0100 Subject: tests: update to upstream commit 2bb0c3da3b (#15806) Also raise traceLimit once again and print the VM error and output on failure. --- core/vm/logger.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'core/vm') diff --git a/core/vm/logger.go b/core/vm/logger.go index 1a6e43ee3..119181433 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -100,6 +100,8 @@ type StructLogger struct { logs []StructLog changedValues map[common.Address]Storage + output []byte + err error } // NewStructLogger returns a new logger @@ -172,17 +174,19 @@ func (l *StructLogger) CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost ui } func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error { - fmt.Printf("0x%x", output) - if err != nil { - fmt.Printf(" error: %v\n", err) - } + l.output = output + l.err = err return nil } -// StructLogs returns a list of captured log entries -func (l *StructLogger) StructLogs() []StructLog { - return l.logs -} +// StructLogs returns the captured log entries. +func (l *StructLogger) StructLogs() []StructLog { return l.logs } + +// Error returns the VM error captured by the trace. +func (l *StructLogger) Error() error { return l.err } + +// Output returns the VM return value captured by the trace. +func (l *StructLogger) Output() []byte { return l.output } // WriteTrace writes a formatted trace to the given writer func WriteTrace(writer io.Writer, logs []StructLog) { -- cgit v1.2.3 From 5c2f1e00148f16655d3fb63b93920b1108165c56 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 8 Jan 2018 13:15:57 +0100 Subject: all: update generated code (#15808) * core/types, core/vm, eth, tests: regenerate gencodec files * Makefile: update devtools target Install protoc-gen-go and print reminders about npm, solc and protoc. Also switch to github.com/kevinburke/go-bindata because it's more maintained. * contracts/ens: update contracts and regenerate with solidity v0.4.19 The newer upstream version of the FIFSRegistrar contract doesn't set the resolver anymore. The resolver is now deployed separately. * contracts/release: regenerate with solidity v0.4.19 * contracts/chequebook: fix fallback and regenerate with solidity v0.4.19 The contract didn't have a fallback function, payments would be rejected when compiled with newer solidity. References to 'mortal' and 'owned' use the local file system so we can compile without network access. * p2p/discv5: regenerate with recent stringer * cmd/faucet: regenerate * dashboard: regenerate * eth/tracers: regenerate * internal/jsre/deps: regenerate * dashboard: avoid sed -i because it's not portable * accounts/usbwallet/internal/trezor: fix go generate warnings --- core/vm/gen_structlog.go | 30 +++++++++++++++++------------- core/vm/logger.go | 20 ++++++++++++++------ 2 files changed, 31 insertions(+), 19 deletions(-) (limited to 'core/vm') diff --git a/core/vm/gen_structlog.go b/core/vm/gen_structlog.go index 88df942dc..890c6624d 100644 --- a/core/vm/gen_structlog.go +++ b/core/vm/gen_structlog.go @@ -11,19 +11,22 @@ import ( "github.com/ethereum/go-ethereum/common/math" ) +var _ = (*structLogMarshaling)(nil) + func (s StructLog) MarshalJSON() ([]byte, error) { type StructLog struct { - Pc uint64 `json:"pc"` - Op OpCode `json:"op"` - Gas math.HexOrDecimal64 `json:"gas"` - GasCost math.HexOrDecimal64 `json:"gasCost"` - Memory hexutil.Bytes `json:"memory"` - MemorySize int `json:"memSize"` - Stack []*math.HexOrDecimal256 `json:"stack"` - Storage map[common.Hash]common.Hash `json:"-"` - Depth int `json:"depth"` - Err error `json:"error"` - OpName string `json:"opName"` + Pc uint64 `json:"pc"` + Op OpCode `json:"op"` + Gas math.HexOrDecimal64 `json:"gas"` + GasCost math.HexOrDecimal64 `json:"gasCost"` + Memory hexutil.Bytes `json:"memory"` + MemorySize int `json:"memSize"` + Stack []*math.HexOrDecimal256 `json:"stack"` + Storage map[common.Hash]common.Hash `json:"-"` + Depth int `json:"depth"` + Err error `json:"-"` + OpName string `json:"opName"` + ErrorString string `json:"error"` } var enc StructLog enc.Pc = s.Pc @@ -42,6 +45,7 @@ func (s StructLog) MarshalJSON() ([]byte, error) { enc.Depth = s.Depth enc.Err = s.Err enc.OpName = s.OpName() + enc.ErrorString = s.ErrorString() return json.Marshal(&enc) } @@ -56,7 +60,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { Stack []*math.HexOrDecimal256 `json:"stack"` Storage map[common.Hash]common.Hash `json:"-"` Depth *int `json:"depth"` - Err *error `json:"error"` + Err error `json:"-"` } var dec StructLog if err := json.Unmarshal(input, &dec); err != nil { @@ -93,7 +97,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { s.Depth = *dec.Depth } if dec.Err != nil { - s.Err = *dec.Err + s.Err = dec.Err } return nil } diff --git a/core/vm/logger.go b/core/vm/logger.go index 119181433..4c820d8b5 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -62,22 +62,30 @@ type StructLog struct { Stack []*big.Int `json:"stack"` Storage map[common.Hash]common.Hash `json:"-"` Depth int `json:"depth"` - Err error `json:"error"` + Err error `json:"-"` } // overrides for gencodec type structLogMarshaling struct { - Stack []*math.HexOrDecimal256 - Gas math.HexOrDecimal64 - GasCost math.HexOrDecimal64 - Memory hexutil.Bytes - OpName string `json:"opName"` + Stack []*math.HexOrDecimal256 + Gas math.HexOrDecimal64 + GasCost math.HexOrDecimal64 + Memory hexutil.Bytes + OpName string `json:"opName"` // adds call to OpName() in MarshalJSON + ErrorString string `json:"error"` // adds call to ErrorString() in MarshalJSON } func (s *StructLog) OpName() string { return s.Op.String() } +func (s *StructLog) ErrorString() string { + if s.Err != nil { + return s.Err.Error() + } + return "" +} + // Tracer is used to collect execution traces from an EVM transaction // execution. CaptureState is called for each step of the VM with the // current VM state. -- cgit v1.2.3 From 9d06026c1991fdd8f034ce194fa20a0740c21810 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 8 Jan 2018 14:13:22 +0100 Subject: all: regenerate codecs with gencodec commit 90983d99de (#15830) Fixes #15777 because null is now allowed for hexutil.Bytes. --- core/vm/gen_structlog.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/vm') diff --git a/core/vm/gen_structlog.go b/core/vm/gen_structlog.go index 890c6624d..ade3ca631 100644 --- a/core/vm/gen_structlog.go +++ b/core/vm/gen_structlog.go @@ -55,7 +55,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { Op *OpCode `json:"op"` Gas *math.HexOrDecimal64 `json:"gas"` GasCost *math.HexOrDecimal64 `json:"gasCost"` - Memory hexutil.Bytes `json:"memory"` + Memory *hexutil.Bytes `json:"memory"` MemorySize *int `json:"memSize"` Stack []*math.HexOrDecimal256 `json:"stack"` Storage map[common.Hash]common.Hash `json:"-"` @@ -79,7 +79,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { s.GasCost = uint64(*dec.GasCost) } if dec.Memory != nil { - s.Memory = dec.Memory + s.Memory = *dec.Memory } if dec.MemorySize != nil { s.MemorySize = *dec.MemorySize -- cgit v1.2.3 From 370dca4491de92ee81e0755cee1cb5df12f0f665 Mon Sep 17 00:00:00 2001 From: George Ornbo Date: Tue, 16 Jan 2018 15:45:13 +0000 Subject: core/vm: Fix comment typo --- core/vm/evm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/vm') diff --git a/core/vm/evm.go b/core/vm/evm.go index 8796a633e..46e7baff4 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -391,7 +391,7 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I return ret, contractAddr, contract.Gas, err } -// ChainConfig returns the evmironment's chain configuration +// ChainConfig returns the environment's chain configuration func (evm *EVM) ChainConfig() *params.ChainConfig { return evm.chainConfig } // Interpreter returns the EVM interpreter -- cgit v1.2.3