Moved ethvm => vm
This commit is contained in:
parent
a02dc4ccc3
commit
20c742e474
@ -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…
Reference in New Issue
Block a user