Moved ethvm => vm

pull/150/head
obscuren 10 years ago
parent a02dc4ccc3
commit 20c742e474
  1. 12
      ethchain/state_transition.go
  2. 6
      ethpipe/pipe.go
  3. 0
      vm/.ethtest
  4. 2
      vm/address.go
  5. 5
      vm/asm.go
  6. 2
      vm/closure.go
  7. 2
      vm/common.go
  8. 2
      vm/debugger.go
  9. 2
      vm/environment.go
  10. 2
      vm/execution.go
  11. 2
      vm/stack.go
  12. 2
      vm/types.go
  13. 2
      vm/virtual_machine.go
  14. 2
      vm/vm.go
  15. 2
      vm/vm_debug.go
  16. 2
      vm/vm_test.go

@ -7,7 +7,7 @@ import (
"github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethtrie" "github.com/ethereum/eth-go/ethtrie"
"github.com/ethereum/eth-go/ethutil" "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 sender.Nonce += 1
// Transaction gas // Transaction gas
if err = self.UseGas(ethvm.GasTx); err != nil { if err = self.UseGas(vm.GasTx); err != nil {
return return
} }
// Pay data gas // Pay data gas
dataPrice := big.NewInt(int64(len(self.data))) dataPrice := big.NewInt(int64(len(self.data)))
dataPrice.Mul(dataPrice, ethvm.GasData) dataPrice.Mul(dataPrice, vm.GasData)
if err = self.UseGas(dataPrice); err != nil { if err = self.UseGas(dataPrice); err != nil {
return return
} }
@ -261,11 +261,11 @@ func (self *StateTransition) Eval(msg *ethstate.Message, script []byte, context
transactor = self.Sender() transactor = self.Sender()
state = self.state state = self.state
env = NewEnv(state, self.tx, self.block) 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 := vm.New(env, vm.Type(ethutil.Config.VmType))
vm := ethvm.New(env, ethvm.DebugVmTy) vm := vm.New(env, vm.DebugVmTy)
ret, _, err = callerClosure.Call(vm, self.tx.Data) ret, _, err = callerClosure.Call(vm, self.tx.Data)

@ -9,7 +9,7 @@ import (
"github.com/ethereum/eth-go/ethlog" "github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethvm" "github.com/ethereum/eth-go/vm"
) )
var logger = ethlog.NewLogger("PIPE") 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() 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) ret, err := msg.Exec(object.Address(), initiator)
fmt.Println("returned from call", ret, err) fmt.Println("returned from call", ret, err)

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"math/big" "math/big"

@ -1,9 +1,10 @@
package ethvm package vm
import ( import (
"fmt" "fmt"
"github.com/ethereum/eth-go/ethutil"
"math/big" "math/big"
"github.com/ethereum/eth-go/ethutil"
) )
func Disassemble(script []byte) (asm []string) { func Disassemble(script []byte) (asm []string) {

@ -1,4 +1,4 @@
package ethvm package vm
// TODO Re write VM to use values instead of big integers? // TODO Re write VM to use values instead of big integers?

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"math/big" "math/big"

@ -1,4 +1,4 @@
package ethvm package vm
import "github.com/ethereum/eth-go/ethstate" import "github.com/ethereum/eth-go/ethstate"

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"math/big" "math/big"

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"fmt" "fmt"

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"fmt" "fmt"

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"fmt" "fmt"

@ -1,4 +1,4 @@
package ethvm package vm
type VirtualMachine interface { type VirtualMachine interface {
Env() Environment Env() Environment

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"fmt" "fmt"

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"fmt" "fmt"

@ -1,4 +1,4 @@
package ethvm package vm
import ( import (
"bytes" "bytes"
Loading…
Cancel
Save