mirror of https://github.com/status-im/op-geth.git
xeth, tests: fixed api
This commit is contained in:
parent
30b27336ea
commit
a977f3c0dc
|
@ -124,7 +124,7 @@ func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, erro
|
||||||
obj.SetBalance(balance)
|
obj.SetBalance(balance)
|
||||||
obj.SetNonce(nonce)
|
obj.SetNonce(nonce)
|
||||||
for k, v := range acct.Storage {
|
for k, v := range acct.Storage {
|
||||||
statedb.SetState(common.HexToAddress(addrString), common.HexToHash(k), common.FromHex(v))
|
statedb.SetState(common.HexToAddress(addrString), common.HexToHash(k), common.HexToHash(v))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sync objects to trie
|
// sync objects to trie
|
||||||
|
|
|
@ -22,7 +22,7 @@ func NewObject(state *state.StateObject) *Object {
|
||||||
return &Object{state}
|
return &Object{state}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Object) StorageString(str string) *common.Value {
|
func (self *Object) StorageString(str string) []byte {
|
||||||
if common.IsHex(str) {
|
if common.IsHex(str) {
|
||||||
return self.storage(common.Hex2Bytes(str[2:]))
|
return self.storage(common.Hex2Bytes(str[2:]))
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,12 +30,12 @@ func (self *Object) StorageString(str string) *common.Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Object) StorageValue(addr *common.Value) *common.Value {
|
func (self *Object) StorageValue(addr *common.Value) []byte {
|
||||||
return self.storage(addr.Bytes())
|
return self.storage(addr.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Object) storage(addr []byte) *common.Value {
|
func (self *Object) storage(addr []byte) []byte {
|
||||||
return self.StateObject.GetStorage(common.BigD(addr))
|
return self.StateObject.GetState(common.BytesToHash(addr)).Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Object) Storage() (storage map[string]string) {
|
func (self *Object) Storage() (storage map[string]string) {
|
||||||
|
|
|
@ -488,7 +488,7 @@ func (self *XEth) NumberToHuman(balance string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *XEth) StorageAt(addr, storageAddr string) string {
|
func (self *XEth) StorageAt(addr, storageAddr string) string {
|
||||||
return common.ToHex(self.State().state.GetState(common.HexToAddress(addr), common.HexToHash(storageAddr)))
|
return self.State().state.GetState(common.HexToAddress(addr), common.HexToHash(storageAddr)).Hex()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *XEth) BalanceAt(addr string) string {
|
func (self *XEth) BalanceAt(addr string) string {
|
||||||
|
|
Loading…
Reference in New Issue