Reflect VM Env changes

This commit is contained in:
obscuren 2014-10-23 01:01:41 +02:00
parent 2e45e4d015
commit 411b9800ae
4 changed files with 14 additions and 10 deletions

View File

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

View File

@ -382,7 +382,7 @@ func (gui *Gui) update() {
state := gui.eth.StateManager().TransState()
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")
miningLabel := gui.getObjectByName("miningLabel")
@ -410,7 +410,7 @@ func (gui *Gui) update() {
case ethchain.NewBlockEvent:
gui.processBlock(ev.Block, false)
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:
@ -424,7 +424,7 @@ func (gui *Gui) update() {
unconfirmedFunds.Add(unconfirmedFunds, tx.Value)
}
gui.setWalletValue(object.Balance, unconfirmedFunds)
gui.setWalletValue(object.Balance(), unconfirmedFunds)
gui.insertTransaction("pre", tx)
@ -442,7 +442,7 @@ func (gui *Gui) update() {
gui.txDb.Put(tx.Hash(), tx.RlpEncode())
}
gui.setWalletValue(object.Balance, nil)
gui.setWalletValue(object.Balance(), nil)
state.UpdateStateObject(object)
}

View File

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

View File

@ -5,6 +5,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/vm"
)
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) State() *ethstate.State { return self.state }
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)
}