Browse Source

deprecate GAS_PRICE

pull/32/head
Jae Kwon 10 years ago
parent
commit
7c953bb675
3 changed files with 20 additions and 20 deletions
  1. +3
    -2
      vm/common.go
  2. +12
    -12
      vm/opcodes.go
  3. +5
    -6
      vm/vm.go

+ 3
- 2
vm/common.go View File

@ -11,8 +11,9 @@ var (
type Word [32]byte 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 { func (w Word) IsZero() bool {
accum := byte(0) accum := byte(0)
for _, byt := range w { for _, byt := range w {


+ 12
- 12
vm/opcodes.go View File

@ -52,7 +52,7 @@ const (
CALLDATACOPY CALLDATACOPY
CODESIZE CODESIZE
CODECOPY CODECOPY
GASPRICE
GASPRICE_DEPRECATED
EXTCODESIZE EXTCODESIZE
EXTCODECOPY EXTCODECOPY
) )
@ -204,17 +204,17 @@ var opCodeToString = map[OpCode]string{
SHA3: "SHA3", SHA3: "SHA3",
// 0x30 range - closure state // 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 // 0x40 range - block operations
BLOCKHASH: "BLOCKHASH", BLOCKHASH: "BLOCKHASH",


+ 5
- 6
vm/vm.go View File

@ -41,7 +41,6 @@ type VMParams struct {
BlockHash Word BlockHash Word
BlockTime int64 BlockTime int64
GasLimit uint64 GasLimit uint64
GasPrice uint64
CallStackLimit uint64 CallStackLimit uint64
Origin Word 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. // 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) { 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) 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) copy(dest, data)
fmt.Printf(" => [%v, %v, %v] %X\n", memOff, codeOff, length, 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 case EXTCODESIZE: // 0x3B
addr := stack.Pop() addr := stack.Pop()


Loading…
Cancel
Save