From 7c953bb675a134babe6ea59d8e678a3e979757f1 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Wed, 18 Mar 2015 23:12:53 -0700 Subject: [PATCH] deprecate GAS_PRICE --- vm/common.go | 5 +++-- vm/opcodes.go | 24 ++++++++++++------------ vm/vm.go | 11 +++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/vm/common.go b/vm/common.go index 4ca4657f..6ac0f6bb 100644 --- a/vm/common.go +++ b/vm/common.go @@ -11,8 +11,9 @@ var ( type Word [32]byte -func (w Word) Copy() Word { return w } -func (w Word) Bytes() []byte { return w[:] } // copied. +func (w Word) String() string { return string(w[:]) } +func (w Word) Copy() Word { return w } +func (w Word) Bytes() []byte { return w[:] } // copied. func (w Word) IsZero() bool { accum := byte(0) for _, byt := range w { diff --git a/vm/opcodes.go b/vm/opcodes.go index b570525c..902c7770 100644 --- a/vm/opcodes.go +++ b/vm/opcodes.go @@ -52,7 +52,7 @@ const ( CALLDATACOPY CODESIZE CODECOPY - GASPRICE + GASPRICE_DEPRECATED EXTCODESIZE EXTCODECOPY ) @@ -204,17 +204,17 @@ var opCodeToString = map[OpCode]string{ SHA3: "SHA3", // 0x30 range - closure state - ADDRESS: "ADDRESS", - BALANCE: "BALANCE", - ORIGIN: "ORIGIN", - CALLER: "CALLER", - CALLVALUE: "CALLVALUE", - CALLDATALOAD: "CALLDATALOAD", - CALLDATASIZE: "CALLDATASIZE", - CALLDATACOPY: "CALLDATACOPY", - CODESIZE: "CODESIZE", - CODECOPY: "CODECOPY", - GASPRICE: "TXGASPRICE", + ADDRESS: "ADDRESS", + BALANCE: "BALANCE", + ORIGIN: "ORIGIN", + CALLER: "CALLER", + CALLVALUE: "CALLVALUE", + CALLDATALOAD: "CALLDATALOAD", + CALLDATASIZE: "CALLDATASIZE", + CALLDATACOPY: "CALLDATACOPY", + CODESIZE: "CODESIZE", + CODECOPY: "CODECOPY", + GASPRICE_DEPRECATED: "TXGASPRICE_DEPRECATED", // 0x40 range - block operations BLOCKHASH: "BLOCKHASH", diff --git a/vm/vm.go b/vm/vm.go index 45b3d211..116ad1ec 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -41,7 +41,6 @@ type VMParams struct { BlockHash Word BlockTime int64 GasLimit uint64 - GasPrice uint64 CallStackLimit uint64 Origin Word } @@ -69,8 +68,8 @@ func NewVM(appState AppState, params VMParams) *VM { // When the function returns, *gas will be the amount of remaining gas. func (vm *VM) Call(caller, callee *Account, code, input []byte, value uint64, gas *uint64) (output []byte, err error) { - if len(callee.Code) == 0 { - panic("Call() requires callee with code") + if len(code) == 0 { + panic("Call() requires code") } fmt.Printf("(%d) (%X) %X (code=%d) gas: %v (d) %X\n", vm.callDepth, caller.Address[:4], callee.Address, len(callee.Code), *gas, input) @@ -351,9 +350,9 @@ func (vm *VM) Call(caller, callee *Account, code, input []byte, value uint64, ga copy(dest, data) fmt.Printf(" => [%v, %v, %v] %X\n", memOff, codeOff, length, data) - case GASPRICE: // 0x3A - stack.Push64(vm.params.GasPrice) - fmt.Printf(" => %X\n", vm.params.GasPrice) + case GASPRICE_DEPRECATED: // 0x3A + stack.Push(Zero) + fmt.Printf(" => %X (GASPRICE IS DEPRECATED)\n") case EXTCODESIZE: // 0x3B addr := stack.Pop()