diff --git a/core/chain_makers.go b/core/chain_makers.go index d362ee0f14..d2590bcf8c 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -111,7 +111,7 @@ func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) { Difficulty: b.header.Difficulty, } - receipt, _, err := ApplyTransaction(b.config, bc, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, &b.header.GasUsed, vm.Config{}, blockContext) + receipt, _, err := ApplyTransaction(b.config, bc, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, &b.header.GasUsed, &vm.Config{}, blockContext) if err != nil { panic(err) } diff --git a/core/evm.go b/core/evm.go index 748bf3e24b..2cb219b98d 100644 --- a/core/evm.go +++ b/core/evm.go @@ -36,8 +36,8 @@ type ChainContext interface { } // NewEVMContext creates a new context for use in the EVM. -func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author *common.Address) vm.Context { - return vm.Context{ +func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author *common.Address) *vm.Context { + return &vm.Context{ CanTransfer: CanTransfer, Transfer: Transfer, GetHash: GetHashFn(header, chain), diff --git a/core/state_processor.go b/core/state_processor.go index 83ccd94693..28b3f61eaa 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -88,7 +88,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg receipts = make([]*types.Receipt, len(block.Transactions())) for i, tx := range block.Transactions() { statedb.Prepare(tx.Hash(), block.Hash(), i) - receipt, _, err := ApplyTransaction(p.config, p.bc, nil, gp, statedb, header, tx, usedGas, cfg, blockContext) + receipt, _, err := ApplyTransaction(p.config, p.bc, nil, gp, statedb, header, tx, usedGas, &cfg, blockContext) if err != nil { return nil, nil, 0, err } @@ -105,7 +105,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg // and uses the input parameters for its environment. It returns the receipt // for the transaction, gas used and an error if the transaction failed, // indicating the block was invalid. -func ApplyTransaction(config *params.ChainConfig, bc *BlockChain, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config, blockContext *vm.BlockContext) (*types.Receipt, uint64, error) { +func ApplyTransaction(config *params.ChainConfig, bc *BlockChain, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg *vm.Config, blockContext *vm.BlockContext) (*types.Receipt, uint64, error) { msg, err := tx.AsMessage(blockContext.Signer) if err != nil { return nil, 0, err diff --git a/core/vm/evm.go b/core/vm/evm.go index ea699b8190..988fdccee7 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -98,7 +98,7 @@ type BlockContext struct{ type EVM struct { BlockContext *BlockContext // Context provides auxiliary blockchain related information - Context + *Context // StateDB gives access to the underlying state StateDB StateDB // Depth is the current call stack @@ -110,7 +110,7 @@ type EVM struct { chainRules params.Rules // virtual machine configuration options used to initialise the // evm. - vmConfig Config + vmConfig *Config // global (to this context) ethereum virtual machine // used throughout the execution of the tx. interpreter *Interpreter @@ -125,7 +125,7 @@ type EVM struct { // NewEVM returns a new EVM. The returned EVM is not thread safe and should // only ever be used *once*. -func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmConfig Config,blockContext *BlockContext) *EVM { +func NewEVM(ctx *Context, statedb StateDB, chainConfig *params.ChainConfig, vmConfig *Config,blockContext *BlockContext) *EVM { evm := &EVM{ Context: ctx, StateDB: statedb, diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 84e3fc4953..18e342bef9 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -47,7 +47,7 @@ type Config struct { // configuration. type Interpreter struct { evm *EVM - cfg Config + cfg *Config gasTable params.GasTable readOnly bool // Whether to throw on stateful modifications @@ -56,7 +56,7 @@ type Interpreter struct { } // NewInterpreter returns a new instance of the Interpreter. -func NewInterpreter(evm *EVM, cfg Config,blockContext *BlockContext) *Interpreter { +func NewInterpreter(evm *EVM, cfg *Config,blockContext *BlockContext) *Interpreter { // We use the STOP instruction whether to see // the jump table was initialised. If it was not // we'll set the default jump table. diff --git a/eth/tracers/tracer.go b/eth/tracers/tracer.go index 4cec9e633c..885a5ec6ab 100644 --- a/eth/tracers/tracer.go +++ b/eth/tracers/tracer.go @@ -514,7 +514,7 @@ func (jst *Tracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost if jst.err == nil { // Initialize the context if it wasn't done yet if !jst.inited { - jst.ctx["block"] = env.BlockNumber.Uint64() + jst.ctx["block"] = env.BlockContext.BlockNumber.Uint64() jst.inited = true } // If tracing was interrupted, set the error and stop