Removed all implicit logging. Fixed gas issues and jump errors

This commit is contained in:
obscuren 2014-11-11 22:51:26 +01:00
parent 75ee3b3f08
commit 6c9e503eb8
24 changed files with 3871 additions and 225 deletions

View File

@ -328,8 +328,8 @@ func (self *ChainManager) InsertChain(chain *BlockChain) {
for e := chain.Front(); e != nil; e = e.Next() {
link := e.Value.(*link)
self.SetTotalDifficulty(link.td)
self.add(link.block)
self.SetTotalDifficulty(link.td)
self.Ethereum.EventMux().Post(NewBlockEvent{link.block})
self.Ethereum.EventMux().Post(link.messages)
}

View File

@ -4,7 +4,6 @@ import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
@ -229,13 +228,13 @@ func (self *StateTransition) TransitionState() (err error) {
}
msg.Output = ret
} else {
// Add default LOG. Default = big(sender.addr) + 1
addr := ethutil.BigD(receiver.Address())
self.state.AddLog(state.Log{sender.Address(), [][]byte{ethutil.U256(addr.Add(addr, ethutil.Big1)).Bytes()}, nil})
}
}
// Add default LOG. Default = big(sender.addr) + 1
//addr := ethutil.BigD(receiver.Address())
//self.state.AddLog(&state.Log{ethutil.U256(addr.Add(addr, ethutil.Big1)).Bytes(), [][]byte{sender.Address()}, nil})
return
}

View File

@ -31,7 +31,7 @@ func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
func (self *VMEnv) Value() *big.Int { return self.tx.Value }
func (self *VMEnv) State() *state.State { return self.state }
func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit }
func (self *VMEnv) AddLog(log state.Log) {
func (self *VMEnv) AddLog(log *state.Log) {
self.state.AddLog(log)
}
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {

View File

@ -46,6 +46,7 @@ var (
gas = flag.String("gas", "1000000", "gas amount")
price = flag.String("price", "0", "gas price")
dump = flag.Bool("dump", false, "dump state after run")
data = flag.String("data", "", "data")
)
func perr(v ...interface{}) {
@ -66,7 +67,7 @@ func main() {
tstart := time.Now()
env := NewVmEnv()
ret, _, e := closure.Call(vm.New(env, vm.DebugVmTy), nil)
ret, _, e := closure.Call(vm.New(env, vm.DebugVmTy), ethutil.Hex2Bytes(*data))
logger.Flush()
if e != nil {
@ -110,7 +111,7 @@ func (VmEnv) GasLimit() *big.Int { return nil }
func (VmEnv) Difficulty() *big.Int { return nil }
func (VmEnv) Value() *big.Int { return nil }
func (self *VmEnv) State() *state.State { return self.state }
func (VmEnv) AddLog(state.Log) {}
func (VmEnv) AddLog(*state.Log) {}
func (VmEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return nil
}

View File

@ -29,7 +29,7 @@ import (
const (
ClientIdentifier = "Mist"
Version = "0.7.3"
Version = "0.7.4"
)
var ethereum *eth.Ethereum

View File

@ -35,7 +35,7 @@ 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) AddLog(*state.Log) {}
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}

View File

@ -24,7 +24,7 @@ const (
// The size of the output buffer for writing messages
outputBufferSize = 50
// Current protocol version
ProtocolVersion = 39
ProtocolVersion = 40
// Current P2P version
P2PVersion = 2
// Ethereum network version

View File

@ -13,8 +13,8 @@ type Log struct {
Data []byte
}
func NewLogFromValue(decoder *ethutil.Value) Log {
log := Log{
func NewLogFromValue(decoder *ethutil.Value) *Log {
log := &Log{
Address: decoder.Get(0).Bytes(),
Data: decoder.Get(2).Bytes(),
}
@ -27,15 +27,15 @@ func NewLogFromValue(decoder *ethutil.Value) Log {
return log
}
func (self Log) RlpData() interface{} {
func (self *Log) RlpData() interface{} {
return []interface{}{self.Address, ethutil.ByteSliceToInterface(self.Topics), self.Data}
}
func (self Log) String() string {
func (self *Log) String() string {
return fmt.Sprintf(`log: %x %x %x`, self.Address, self.Topics, self.Data)
}
type Logs []Log
type Logs []*Log
func (self Logs) RlpData() interface{} {
data := make([]interface{}, len(self))

View File

@ -37,7 +37,7 @@ func (self *State) EmptyLogs() {
self.logs = nil
}
func (self *State) AddLog(log Log) {
func (self *State) AddLog(log *Log) {
self.logs = append(self.logs, log)
}

View File

@ -1,6 +1,6 @@
{
"genesis_rlp_hex": "f8abf8a7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a008bf6a98374f333b84e7d063d607696ac7cbbd409bd20fbe6a741c2dfc0eb28580830200008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0",
"genesis_state_root": "08bf6a98374f333b84e7d063d607696ac7cbbd409bd20fbe6a741c2dfc0eb285",
"genesis_rlp_hex": "f9012ff9012aa00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0c67c70f5d7d3049337d1dcc0503a249881120019a8e7322774dbfe57b463718ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b84000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0",
"genesis_state_root": "c67c70f5d7d3049337d1dcc0503a249881120019a8e7322774dbfe57b463718c",
"initial_alloc": {
"51ba59315b3a95761d0863b05ccc7a7f54703d99": "1606938044258990275541962092341162602522202993782792835301376",
"e4157b34ea9615cfbde6b4fda419828124b70c78": "1606938044258990275541962092341162602522202993782792835301376",
@ -11,5 +11,5 @@
"e6716f9544a56c530d868e4bfbacb172315bdead": "1606938044258990275541962092341162602522202993782792835301376",
"1a26338f0d905e295fccb71fa9ea849ffa12aaf4": "1606938044258990275541962092341162602522202993782792835301376"
},
"genesis_hash": "f68067286ddb7245c2203b18135456de1fc4ed6a24a2d9014195faa7900025bf"
"genesis_hash": "955f36d073ccb026b78ab3424c15cf966a7563aa270413859f78702b9e8e22cb"
}

View File

@ -37,14 +37,14 @@
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "1000000000000000000",
"code" : "0x6001600101600055",
"nonce" : 0,
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "1000000000000000000",
"code" : "",
"nonce" : 0,
"code" : "0x",
"nonce" : "0",
"storage" : {
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2142,28 +2142,29 @@
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x62126af4605016600057",
"code" : "0x62126af460500b600055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "0",
"gas" : "9696",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62126af4605016600057",
"code" : "0x62126af460500b600055",
"nonce" : "0",
"storage" : {
"0x" : "0x126af4"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62126af4605016600057",
"code" : "0x62126af460500b600055",
"nonce" : "0",
"storage" : {
}
@ -2355,28 +2356,29 @@
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x60ff68f0000000000000000116600057",
"code" : "0x60ff68f000000000000000010b600055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "0",
"gas" : "9696",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60ff68f0000000000000000116600057",
"code" : "0x60ff68f000000000000000010b600055",
"nonce" : "0",
"storage" : {
"0x" : "0xff"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60ff68f0000000000000000116600057",
"code" : "0x60ff68f000000000000000010b600055",
"nonce" : "0",
"storage" : {
}
@ -2439,28 +2441,29 @@
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x62122f6a600016600057",
"code" : "0x62122f6a60000b600055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9995",
"gas" : "9696",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62122f6a600016600057",
"code" : "0x62122f6a60000b600055",
"nonce" : "0",
"storage" : {
"0x" : "0x6a"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62122f6a600016600057",
"code" : "0x62122f6a60000b600055",
"nonce" : "0",
"storage" : {
}
@ -2481,28 +2484,29 @@
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x62126af4600116600057",
"code" : "0x62126af460010b600055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9995",
"gas" : "9696",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62126af4600116600057",
"code" : "0x62126af460010b600055",
"nonce" : "0",
"storage" : {
"0x" : "0x6af4"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62126af4600116600057",
"code" : "0x62126af460010b600055",
"nonce" : "0",
"storage" : {
}
@ -2523,28 +2527,29 @@
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x6212faf4600116600057",
"code" : "0x6212faf460010b600055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9995",
"gas" : "9696",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6212faf4600116600057",
"code" : "0x6212faf460010b600055",
"nonce" : "0",
"storage" : {
"0x" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf4"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6212faf4600116600057",
"code" : "0x6212faf460010b600055",
"nonce" : "0",
"storage" : {
}
@ -2565,28 +2570,29 @@
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x66f000000000000161ffff16600057",
"code" : "0x66f000000000000161ffff0b600055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "0",
"gas" : "9696",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x66f000000000000161ffff16600057",
"code" : "0x66f000000000000161ffff0b600055",
"nonce" : "0",
"storage" : {
"0x" : "0xf0000000000001"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x66f000000000000161ffff16600057",
"code" : "0x66f000000000000161ffff0b600055",
"nonce" : "0",
"storage" : {
}
@ -2607,28 +2613,29 @@
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x62122ff4600016600057",
"code" : "0x62122ff460000b600055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9995",
"gas" : "9696",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62122ff4600016600057",
"code" : "0x62122ff460000b600055",
"nonce" : "0",
"storage" : {
"0x" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x62122ff4600016600057",
"code" : "0x62122ff460000b600055",
"nonce" : "0",
"storage" : {
}

View File

@ -363,7 +363,7 @@
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9995",
"gas" : "0",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -384,6 +384,48 @@
}
}
},
"jump1" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x620fffff620fffff0156",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "0",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x620fffff620fffff0156",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x620fffff620fffff0156",
"nonce" : "0",
"storage" : {
}
}
}
},
"jumpi0" : {
"callcreates" : [
],
@ -1301,7 +1343,7 @@
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "10000",
"gas" : "0",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1479,7 +1521,7 @@
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9995",
"gas" : "0",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -1,55 +0,0 @@
{
"namecoin": {
"pre": {
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1": {
"nonce": "1",
"balance": "2500000000000000000",
"storage": {},
"code": "0x"
},
"c305c901078781c232a2a521c2af7980f8385ee9": {
"nonce": "0",
"balance": "0",
"storage": {},
"code": "0x600035560f0f601d5960203560003557600160005460206000f2602758600060205460206020f2"
}
},
"exec": {
"origin": "82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
"code": "0x600035560f0f601d5960203560003557600160005460206000f2602758600060205460206020f2",
"value": "0",
"address": "c305c901078781c232a2a521c2af7980f8385ee9",
"gas": "10000",
"caller": "82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
"data": "0x000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004e",
"gasPrice": "1000000000000"
},
"callcreates": [],
"gas": "9663",
"env": {
"currentTimestamp": "1405282164",
"currentGasLimit": "999023",
"previousHash": "112a6e7995fcb66376f44e52f011c38d328a9ed3a1dac6eebb1376fccd055fad",
"currentCoinbase": "82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
"currentDifficulty": "4190208",
"currentNumber": "1"
},
"post": {
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1": {
"nonce": "1",
"balance": "2500000000000000000",
"storage": {},
"code": "0x"
},
"c305c901078781c232a2a521c2af7980f8385ee9": {
"nonce": "0",
"balance": "0",
"storage": {
"0x2d": "0x4e"
},
"code": "0x600035560f0f601d5960203560003557600160005460206000f2602758600060205460206020f2"
}
},
"out": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
}

View File

@ -407,7 +407,7 @@
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9999",
"gas" : "0",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2597,7 +2597,7 @@
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9998",
"gas" : "0",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -1,23 +1,24 @@
module.exports = {
blockgenesis: require('./blockgenesistest'),
genesishashes: require('./genesishashestest'),
hexencode: require('./hexencodetest'),
keyaddrtests: require('./keyaddrtest'),
namecoin: require('./namecoin'),
rlptest: require('./rlptest'),
trietest: require('./trietest'),
trietestnextprev: require('./trietestnextprev'),
txtest: require('./txtest'),
vmtests: {
random: require('./vmtests/random'),
vmArithmeticTest: require('./vmtests/vmArithmeticTest'),
vmBitwiseLogicOperationTest: require('./vmtests/vmBitwiseLogicOperationTest'),
vmBlockInfoTest: require('./vmtests/vmBlockInfoTest'),
vmEnvironmentalInfoTest: require('./vmtests/vmEnvironmentalInfoTest'),
vmIOandFlowOperationsTest: require('./vmtests/vmIOandFlowOperationsTest'),
vmPushDupSwapTest: require('./vmtests/vmPushDupSwapTest'),
vmSha3Test: require('./vmtests/vmSha3Test'),
vmSystemOperationsTest: require('./vmtests/vmSystemOperationsTest'),
vmtests: require('./vmtests/vmtests')
blockgenesis: require('./BasicTests/blockgenesistest'),
genesishashes: require('./BasicTests/genesishashestest'),
hexencode: require('./BasicTests/hexencodetest'),
keyaddrtests: require('./BasicTests/keyaddrtest'),
rlptest: require('./BasicTests/rlptest'),
trietest: require('./TrieTests/trietest'),
trietestnextprev: require('./TrieTests/trietestnextprev'),
txtest: require('./BasicTests/txtest'),
StateTests: {
stPreCompiledContracts: require('./StateTests/stPreCompiledContracts'),
stSystemOperationsTest: require('./StateTests/stSystemOperationsTest'),
},
VMTests: {
vmArithmeticTest: require('./VMTests/vmArithmeticTest'),
vmBitwiseLogicOperationTest: require('./VMTests/vmBitwiseLogicOperationTest'),
vmBlockInfoTest: require('./VMTests/vmBlockInfoTest'),
vmEnvironmentalInfoTest: require('./VMTests/vmEnvironmentalInfoTest'),
vmIOandFlowOperationsTest: require('./VMTests/vmIOandFlowOperationsTest'),
vmPushDupSwapTest: require('./VMTests/vmPushDupSwapTest'),
vmSha3Test: require('./VMTests/vmSha3Test'),
vmtestst: require('./VMTests/vmtests'),
}
};

View File

@ -1,45 +0,0 @@
{
"randomVMtest" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x33410c45815741f394",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9794",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x33410c45815741f394",
"nonce" : "0",
"storage" : {
"0x01" : "0x0f4240"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x33410c45815741f394",
"nonce" : "0",
"storage" : {
}
}
}
}
}

View File

@ -1,44 +0,0 @@
{
"randomVMtest" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x7d",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9999",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x7d",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x7d",
"nonce" : "0",
"storage" : {
}
}
}
}
}

View File

@ -113,7 +113,7 @@ func TestEnvironmentalInfo(t *testing.T) {
}
func TestFlowOperation(t *testing.T) {
// helper.Logger.SetLogLevel(5)
helper.Logger.SetLogLevel(5)
const fn = "../files/vmtests/vmIOandFlowOperationsTest.json"
RunVmTest(fn, t)
}

View File

@ -20,7 +20,7 @@ type Environment interface {
BlockHash() []byte
GasLimit() *big.Int
Transfer(from, to Account, amount *big.Int) error
AddLog(state.Log)
AddLog(*state.Log)
}
type Object interface {

View File

@ -47,6 +47,8 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
if r := recover(); r != nil {
self.Endl()
closure.UseGas(closure.Gas)
ret = closure.Return(nil)
err = fmt.Errorf("%v", r)
@ -735,7 +737,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
for i := 0; i < n; i++ {
topics[i] = stack.Pop().Bytes()
}
self.env.AddLog(state.Log{closure.Address(), topics, data})
self.env.AddLog(&state.Log{closure.Address(), topics, data})
case MLOAD:
offset := stack.Pop()
val := ethutil.BigD(mem.Get(offset.Int64(), 32))

View File

@ -34,7 +34,7 @@ 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) AddLog(*state.Log) {}
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}