From 20c742e47406c13ebc6427951f6fcf1b0056ea26 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 18 Oct 2014 13:31:20 +0200 Subject: [PATCH] Moved ethvm => vm --- ethchain/state_transition.go | 12 ++++++------ ethpipe/pipe.go | 6 +++--- {ethvm => vm}/.ethtest | 0 {ethvm => vm}/address.go | 2 +- {ethvm => vm}/asm.go | 5 +++-- {ethvm => vm}/closure.go | 2 +- {ethvm => vm}/common.go | 2 +- {ethvm => vm}/debugger.go | 2 +- {ethvm => vm}/environment.go | 2 +- {ethvm => vm}/execution.go | 2 +- {ethvm => vm}/stack.go | 2 +- {ethvm => vm}/types.go | 2 +- {ethvm => vm}/virtual_machine.go | 2 +- {ethvm => vm}/vm.go | 2 +- {ethvm => vm}/vm_debug.go | 2 +- {ethvm => vm}/vm_test.go | 2 +- 16 files changed, 24 insertions(+), 23 deletions(-) rename {ethvm => vm}/.ethtest (100%) rename {ethvm => vm}/address.go (98%) rename {ethvm => vm}/asm.go (98%) rename {ethvm => vm}/closure.go (99%) rename {ethvm => vm}/common.go (98%) rename {ethvm => vm}/debugger.go (95%) rename {ethvm => vm}/environment.go (96%) rename {ethvm => vm}/execution.go (99%) rename {ethvm => vm}/stack.go (99%) rename {ethvm => vm}/types.go (99%) rename {ethvm => vm}/virtual_machine.go (92%) rename {ethvm => vm}/vm.go (99%) rename {ethvm => vm}/vm_debug.go (99%) rename {ethvm => vm}/vm_test.go (99%) diff --git a/ethchain/state_transition.go b/ethchain/state_transition.go index 5bb084ae4..79321eaac 100644 --- a/ethchain/state_transition.go +++ b/ethchain/state_transition.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethtrie" "github.com/ethereum/eth-go/ethutil" - "github.com/ethereum/eth-go/ethvm" + "github.com/ethereum/eth-go/vm" ) /* @@ -160,13 +160,13 @@ func (self *StateTransition) TransitionState() (err error) { sender.Nonce += 1 // Transaction gas - if err = self.UseGas(ethvm.GasTx); err != nil { + if err = self.UseGas(vm.GasTx); err != nil { return } // Pay data gas dataPrice := big.NewInt(int64(len(self.data))) - dataPrice.Mul(dataPrice, ethvm.GasData) + dataPrice.Mul(dataPrice, vm.GasData) if err = self.UseGas(dataPrice); err != nil { return } @@ -261,11 +261,11 @@ func (self *StateTransition) Eval(msg *ethstate.Message, script []byte, context transactor = self.Sender() state = self.state env = NewEnv(state, self.tx, self.block) - callerClosure = ethvm.NewClosure(msg, transactor, context, script, self.gas, self.gasPrice) + callerClosure = vm.NewClosure(msg, transactor, context, script, self.gas, self.gasPrice) ) - //vm := ethvm.New(env, ethvm.Type(ethutil.Config.VmType)) - vm := ethvm.New(env, ethvm.DebugVmTy) + //vm := vm.New(env, vm.Type(ethutil.Config.VmType)) + vm := vm.New(env, vm.DebugVmTy) ret, _, err = callerClosure.Call(vm, self.tx.Data) diff --git a/ethpipe/pipe.go b/ethpipe/pipe.go index 39ee0ef07..5e5ff7000 100644 --- a/ethpipe/pipe.go +++ b/ethpipe/pipe.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/eth-go/ethlog" "github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethutil" - "github.com/ethereum/eth-go/ethvm" + "github.com/ethereum/eth-go/vm" ) var logger = ethlog.NewLogger("PIPE") @@ -58,9 +58,9 @@ func (self *Pipe) ExecuteObject(object *Object, data []byte, value, gas, price * self.Vm.State = self.World().State().Copy() - vm := ethvm.New(NewEnv(self.Vm.State, block, value.BigInt(), initiator.Address()), ethvm.Type(ethutil.Config.VmType)) + evm := vm.New(NewEnv(self.Vm.State, block, value.BigInt(), initiator.Address()), vm.Type(ethutil.Config.VmType)) - msg := ethvm.NewExecution(vm, object.Address(), data, gas.BigInt(), price.BigInt(), value.BigInt()) + msg := vm.NewExecution(evm, object.Address(), data, gas.BigInt(), price.BigInt(), value.BigInt()) ret, err := msg.Exec(object.Address(), initiator) fmt.Println("returned from call", ret, err) diff --git a/ethvm/.ethtest b/vm/.ethtest similarity index 100% rename from ethvm/.ethtest rename to vm/.ethtest diff --git a/ethvm/address.go b/vm/address.go similarity index 98% rename from ethvm/address.go rename to vm/address.go index f987c4761..cfb7f36d9 100644 --- a/ethvm/address.go +++ b/vm/address.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "math/big" diff --git a/ethvm/asm.go b/vm/asm.go similarity index 98% rename from ethvm/asm.go rename to vm/asm.go index 7ff15a240..d081e2b09 100644 --- a/ethvm/asm.go +++ b/vm/asm.go @@ -1,9 +1,10 @@ -package ethvm +package vm import ( "fmt" - "github.com/ethereum/eth-go/ethutil" "math/big" + + "github.com/ethereum/eth-go/ethutil" ) func Disassemble(script []byte) (asm []string) { diff --git a/ethvm/closure.go b/vm/closure.go similarity index 99% rename from ethvm/closure.go rename to vm/closure.go index 2d2204e5f..5a1e1d4d5 100644 --- a/ethvm/closure.go +++ b/vm/closure.go @@ -1,4 +1,4 @@ -package ethvm +package vm // TODO Re write VM to use values instead of big integers? diff --git a/ethvm/common.go b/vm/common.go similarity index 98% rename from ethvm/common.go rename to vm/common.go index 617a8279f..6921b38ff 100644 --- a/ethvm/common.go +++ b/vm/common.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "math/big" diff --git a/ethvm/debugger.go b/vm/debugger.go similarity index 95% rename from ethvm/debugger.go rename to vm/debugger.go index 6144b5d6a..fdd5e34e2 100644 --- a/ethvm/debugger.go +++ b/vm/debugger.go @@ -1,4 +1,4 @@ -package ethvm +package vm import "github.com/ethereum/eth-go/ethstate" diff --git a/ethvm/environment.go b/vm/environment.go similarity index 96% rename from ethvm/environment.go rename to vm/environment.go index b04fa332e..2d933b65c 100644 --- a/ethvm/environment.go +++ b/vm/environment.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "math/big" diff --git a/ethvm/execution.go b/vm/execution.go similarity index 99% rename from ethvm/execution.go rename to vm/execution.go index f5f1ce70d..6bed43026 100644 --- a/ethvm/execution.go +++ b/vm/execution.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "fmt" diff --git a/ethvm/stack.go b/vm/stack.go similarity index 99% rename from ethvm/stack.go rename to vm/stack.go index 4ac023fb9..55fdb6d15 100644 --- a/ethvm/stack.go +++ b/vm/stack.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "fmt" diff --git a/ethvm/types.go b/vm/types.go similarity index 99% rename from ethvm/types.go rename to vm/types.go index 6c433e3fd..5fd92052b 100644 --- a/ethvm/types.go +++ b/vm/types.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "fmt" diff --git a/ethvm/virtual_machine.go b/vm/virtual_machine.go similarity index 92% rename from ethvm/virtual_machine.go rename to vm/virtual_machine.go index dd2e568cf..cc8cd39a9 100644 --- a/ethvm/virtual_machine.go +++ b/vm/virtual_machine.go @@ -1,4 +1,4 @@ -package ethvm +package vm type VirtualMachine interface { Env() Environment diff --git a/ethvm/vm.go b/vm/vm.go similarity index 99% rename from ethvm/vm.go rename to vm/vm.go index 4df98328e..72d4f7131 100644 --- a/ethvm/vm.go +++ b/vm/vm.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "fmt" diff --git a/ethvm/vm_debug.go b/vm/vm_debug.go similarity index 99% rename from ethvm/vm_debug.go rename to vm/vm_debug.go index da9ad8d59..785e699c7 100644 --- a/ethvm/vm_debug.go +++ b/vm/vm_debug.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "fmt" diff --git a/ethvm/vm_test.go b/vm/vm_test.go similarity index 99% rename from ethvm/vm_test.go rename to vm/vm_test.go index 6b7cc2f5c..047b76121 100644 --- a/ethvm/vm_test.go +++ b/vm/vm_test.go @@ -1,4 +1,4 @@ -package ethvm +package vm import ( "bytes"