ethstate => state

This commit is contained in:
obscuren
2014-10-31 14:43:14 +01:00
parent 0ed1a8b50a
commit af8f5f0b69
36 changed files with 167 additions and 167 deletions

View File

@ -26,8 +26,8 @@ import (
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
"gopkg.in/qml.v1"
)
@ -40,7 +40,7 @@ type DebuggerWindow struct {
vm *vm.DebugVm
Db *Debugger
state *ethstate.State
state *state.State
}
func NewDebuggerWindow(lib *UiLib) *DebuggerWindow {
@ -141,17 +141,17 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
keyPair = self.lib.eth.KeyManager().KeyPair()
)
state := self.lib.eth.StateManager().TransState()
statedb := self.lib.eth.StateManager().TransState()
account := self.lib.eth.StateManager().TransState().GetAccount(keyPair.Address())
contract := ethstate.NewStateObject([]byte{0})
contract := statedb.NewStateObject([]byte{0})
contract.SetBalance(value)
self.SetAsm(script)
block := self.lib.eth.ChainManager().CurrentBlock
callerClosure := vm.NewClosure(&ethstate.Message{}, account, contract, script, gas, gasPrice)
env := utils.NewEnv(state, block, account.Address(), value)
callerClosure := vm.NewClosure(&state.Message{}, account, contract, script, gas, gasPrice)
env := utils.NewEnv(statedb, block, account.Address(), value)
evm := vm.NewDebugVm(env)
evm.Dbg = self.Db
@ -172,7 +172,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
}
}
state.Reset()
statedb.Reset()
if !self.Db.interrupt {
self.Db.done = true
@ -267,13 +267,13 @@ type storeVal struct {
Key, Value string
}
func (self *Debugger) BreakHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *ethstate.StateObject) bool {
func (self *Debugger) BreakHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool {
self.main.Logln("break on instr:", pc)
return self.halting(pc, op, mem, stack, stateObject)
}
func (self *Debugger) StepHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *ethstate.StateObject) bool {
func (self *Debugger) StepHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool {
return self.halting(pc, op, mem, stack, stateObject)
}
@ -285,7 +285,7 @@ func (self *Debugger) BreakPoints() []int64 {
return self.breakPoints
}
func (d *Debugger) halting(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *ethstate.StateObject) bool {
func (d *Debugger) halting(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool {
d.win.Root().Call("setInstruction", pc)
d.win.Root().Call("clearMem")
d.win.Root().Call("clearStack")

View File

@ -21,9 +21,9 @@ import (
"encoding/json"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/ui/qt"
"github.com/ethereum/go-ethereum/xeth"
"gopkg.in/qml.v1"
@ -38,7 +38,7 @@ type AppContainer interface {
NewBlock(*chain.Block)
NewWatcher(chan bool)
Messages(ethstate.Messages, string)
Messages(state.Messages, string)
Post(string, int)
}
@ -80,7 +80,7 @@ func (app *ExtApplication) run() {
// Subscribe to events
mux := app.lib.eth.EventMux()
app.events = mux.Subscribe(chain.NewBlockEvent{}, ethstate.Messages(nil))
app.events = mux.Subscribe(chain.NewBlockEvent{}, state.Messages(nil))
// Call the main loop
go app.mainLoop()
@ -109,7 +109,7 @@ func (app *ExtApplication) mainLoop() {
case chain.NewBlockEvent:
app.container.NewBlock(ev.Block)
case ethstate.Messages:
case state.Messages:
for id, filter := range app.filters {
msgs := filter.FilterMessages(ev)
if len(msgs) > 0 {

View File

@ -28,9 +28,9 @@ import (
"path/filepath"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
"github.com/howeyc/fsnotify"
"gopkg.in/qml.v1"
@ -143,7 +143,7 @@ func (app *HtmlApplication) NewBlock(block *chain.Block) {
app.webView.Call("onNewBlockCb", b)
}
func (self *HtmlApplication) Messages(messages ethstate.Messages, id string) {
func (self *HtmlApplication) Messages(messages state.Messages, id string) {
var msgs []javascript.JSMessage
for _, m := range messages {
msgs = append(msgs, javascript.NewJSMessage(m))

View File

@ -22,8 +22,8 @@ import (
"runtime"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
"gopkg.in/qml.v1"
)
@ -70,7 +70,7 @@ func (app *QmlApplication) NewBlock(block *chain.Block) {
app.win.Call("onNewBlockCb", pblock)
}
func (self *QmlApplication) Messages(msgs ethstate.Messages, id string) {
func (self *QmlApplication) Messages(msgs state.Messages, id string) {
fmt.Println("IMPLEMENT QML APPLICATION MESSAGES METHOD")
}

View File

@ -27,9 +27,9 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/ui/qt"
"github.com/ethereum/go-ethereum/xeth"
"gopkg.in/qml.v1"
@ -213,7 +213,7 @@ func (self *UiLib) StartDebugger() {
func (self *UiLib) NewFilter(object map[string]interface{}) (id int) {
filter := qt.NewFilterFromMap(object, self.eth)
filter.MessageCallback = func(messages ethstate.Messages) {
filter.MessageCallback = func(messages state.Messages) {
self.win.Root().Call("invokeFilterCallback", xeth.ToJSMessages(messages), id)
}
id = self.eth.InstallFilter(filter)

View File

@ -4,19 +4,19 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
type VMEnv struct {
state *ethstate.State
state *state.State
block *chain.Block
transactor []byte
value *big.Int
}
func NewEnv(state *ethstate.State, block *chain.Block, transactor []byte, value *big.Int) *VMEnv {
func NewEnv(state *state.State, block *chain.Block, transactor []byte, value *big.Int) *VMEnv {
return &VMEnv{
state: state,
block: block,
@ -25,17 +25,17 @@ func NewEnv(state *ethstate.State, block *chain.Block, transactor []byte, value
}
}
func (self *VMEnv) Origin() []byte { return self.transactor }
func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number }
func (self *VMEnv) PrevHash() []byte { return self.block.PrevHash }
func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase }
func (self *VMEnv) Time() int64 { return self.block.Time }
func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty }
func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
func (self *VMEnv) Value() *big.Int { return self.value }
func (self *VMEnv) State() *ethstate.State { return self.state }
func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit }
func (self *VMEnv) AddLog(ethstate.Log) {}
func (self *VMEnv) Origin() []byte { return self.transactor }
func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number }
func (self *VMEnv) PrevHash() []byte { return self.block.PrevHash }
func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase }
func (self *VMEnv) Time() int64 { return self.block.Time }
func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty }
func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
func (self *VMEnv) Value() *big.Int { return self.value }
func (self *VMEnv) State() *state.State { return self.state }
func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit }
func (self *VMEnv) AddLog(state.Log) {}
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}