Reflect VM Env changes

pull/152/head
obscuren 10 years ago
parent 2e45e4d015
commit 411b9800ae
  1. 10
      mist/debugger.go
  2. 8
      mist/gui.go
  3. 2
      mist/main.go
  4. 4
      utils/vm_env.go

@ -127,7 +127,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
state := self.lib.eth.StateManager().TransState() state := self.lib.eth.StateManager().TransState()
account := self.lib.eth.StateManager().TransState().GetAccount(keyPair.Address()) account := self.lib.eth.StateManager().TransState().GetAccount(keyPair.Address())
contract := ethstate.NewStateObject([]byte{0}) contract := ethstate.NewStateObject([]byte{0})
contract.Balance = value contract.SetBalance(value)
self.SetAsm(script) self.SetAsm(script)
@ -135,14 +135,14 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
callerClosure := vm.NewClosure(&ethstate.Message{}, account, contract, script, gas, gasPrice) callerClosure := vm.NewClosure(&ethstate.Message{}, account, contract, script, gas, gasPrice)
env := utils.NewEnv(state, block, account.Address(), value) env := utils.NewEnv(state, block, account.Address(), value)
vm := vm.NewDebugVm(env) evm := vm.NewDebugVm(env)
vm.Dbg = self.Db evm.Dbg = self.Db
self.vm = vm self.vm = evm
self.Db.done = false self.Db.done = false
self.Logf("callsize %d", len(script)) self.Logf("callsize %d", len(script))
go func() { go func() {
ret, g, err := callerClosure.Call(vm, data) ret, g, err := callerClosure.Call(evm, data)
tot := new(big.Int).Mul(g, gasPrice) tot := new(big.Int).Mul(g, gasPrice)
self.Logf("gas usage %v total price = %v (%v)", g, tot, ethutil.CurrencyToString(tot)) self.Logf("gas usage %v total price = %v (%v)", g, tot, ethutil.CurrencyToString(tot))
if err != nil { if err != nil {

@ -382,7 +382,7 @@ func (gui *Gui) update() {
state := gui.eth.StateManager().TransState() state := gui.eth.StateManager().TransState()
unconfirmedFunds := new(big.Int) unconfirmedFunds := new(big.Int)
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance))) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance())))
lastBlockLabel := gui.getObjectByName("lastBlockLabel") lastBlockLabel := gui.getObjectByName("lastBlockLabel")
miningLabel := gui.getObjectByName("miningLabel") miningLabel := gui.getObjectByName("miningLabel")
@ -410,7 +410,7 @@ func (gui *Gui) update() {
case ethchain.NewBlockEvent: case ethchain.NewBlockEvent:
gui.processBlock(ev.Block, false) gui.processBlock(ev.Block, false)
if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 {
gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance, nil) gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil)
} }
case ethchain.TxEvent: case ethchain.TxEvent:
@ -424,7 +424,7 @@ func (gui *Gui) update() {
unconfirmedFunds.Add(unconfirmedFunds, tx.Value) unconfirmedFunds.Add(unconfirmedFunds, tx.Value)
} }
gui.setWalletValue(object.Balance, unconfirmedFunds) gui.setWalletValue(object.Balance(), unconfirmedFunds)
gui.insertTransaction("pre", tx) gui.insertTransaction("pre", tx)
@ -442,7 +442,7 @@ func (gui *Gui) update() {
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) gui.txDb.Put(tx.Hash(), tx.RlpEncode())
} }
gui.setWalletValue(object.Balance, nil) gui.setWalletValue(object.Balance(), nil)
state.UpdateStateObject(object) state.UpdateStateObject(object)
} }

@ -12,7 +12,7 @@ import (
const ( const (
ClientIdentifier = "Mist" ClientIdentifier = "Mist"
Version = "0.7.0" Version = "0.7.1"
) )
var ethereum *eth.Ethereum var ethereum *eth.Ethereum

@ -5,6 +5,7 @@ import (
"github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/vm"
) )
type VMEnv struct { type VMEnv struct {
@ -34,3 +35,6 @@ func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
func (self *VMEnv) Value() *big.Int { return self.value } func (self *VMEnv) Value() *big.Int { return self.value }
func (self *VMEnv) State() *ethstate.State { return self.state } func (self *VMEnv) State() *ethstate.State { return self.state }
func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit } func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit }
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}

Loading…
Cancel
Save