From 7c24cd790d39b67ee16ad7f1b1a805fcb131dc8a Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 28 Nov 2014 19:39:20 -0500 Subject: fix panic on bad sender --- chain/transaction_pool.go | 6 +++++- chain/types/transaction.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/chain/transaction_pool.go b/chain/transaction_pool.go index 119712ba8..ae96b0251 100644 --- a/chain/transaction_pool.go +++ b/chain/transaction_pool.go @@ -116,7 +116,11 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { // Get the sender //sender := pool.Ethereum.BlockManager().procState.GetAccount(tx.Sender()) - sender := pool.Ethereum.BlockManager().CurrentState().GetAccount(tx.Sender()) + senderAddr := tx.Sender() + if senderAddr == nil { + return fmt.Errorf("Invalid sender") + } + sender := pool.Ethereum.BlockManager().CurrentState().GetAccount(senderAddr) totAmount := new(big.Int).Set(tx.Value) // Make sure there's enough in the sender's account. Having insufficient diff --git a/chain/types/transaction.go b/chain/types/transaction.go index 626a7e5ce..5599512f6 100644 --- a/chain/types/transaction.go +++ b/chain/types/transaction.go @@ -116,7 +116,7 @@ func (tx *Transaction) Sender() []byte { // Validate the returned key. // Return nil if public key isn't in full format - if len(pubkey) != 0 && pubkey[0] != 4 { + if len(pubkey) == 0 || pubkey[0] != 4 { return nil } -- cgit v1.2.3 From 47793b606c33e93d9a4295ba4db12165182d9e72 Mon Sep 17 00:00:00 2001 From: zelig Date: Fri, 5 Dec 2014 21:14:55 +0000 Subject: initial commit for eth-p2p integration --- eth/error.go | 73 +++++++++++++ eth/protocol.go | 294 +++++++++++++++++++++++++++++++++++++++++++++++++++ eth/protocol_test.go | 133 +++++++++++++++++++++++ 3 files changed, 500 insertions(+) create mode 100644 eth/error.go create mode 100644 eth/protocol.go create mode 100644 eth/protocol_test.go diff --git a/eth/error.go b/eth/error.go new file mode 100644 index 000000000..cb4459435 --- /dev/null +++ b/eth/error.go @@ -0,0 +1,73 @@ +package eth + +import ( + "fmt" + // "github.com/ethereum/go-ethereum/logger" +) + +const ( + ErrMsgTooLarge = iota + ErrDecode + ErrInvalidMsgCode + ErrProtocolVersionMismatch + ErrNetworkIdMismatch + ErrGenesisBlockMismatch + ErrNoStatusMsg + ErrExtraStatusMsg + ErrInvalidBlock +) + +var errorToString = map[int]string{ + ErrMsgTooLarge: "Message too long", + ErrDecode: "Invalid message", + ErrInvalidMsgCode: "Invalid message code", + ErrProtocolVersionMismatch: "Protocol version mismatch", + ErrNetworkIdMismatch: "NetworkId mismatch", + ErrGenesisBlockMismatch: "Genesis block mismatch", + ErrNoStatusMsg: "No status message", + ErrExtraStatusMsg: "Extra status message", + ErrInvalidBlock: "Invalid block", +} + +type protocolError struct { + Code int + fatal bool + message string + format string + params []interface{} + // size int +} + +func newProtocolError(code int, format string, params ...interface{}) *protocolError { + return &protocolError{Code: code, format: format, params: params} +} + +func ProtocolError(code int, format string, params ...interface{}) (err *protocolError) { + err = newProtocolError(code, format, params...) + // report(err) + if err.Fatal() { + logger.Errorln(err) + } else { + logger.Debugln(err) + } + return +} + +func (self protocolError) Error() (message string) { + message = self.message + if message == "" { + message, ok := errorToString[self.Code] + if !ok { + panic("invalid error code") + } + if self.format != "" { + message += ": " + fmt.Sprintf(self.format, self.params...) + } + self.message = message + } + return +} + +func (self *protocolError) Fatal() bool { + return self.fatal +} diff --git a/eth/protocol.go b/eth/protocol.go new file mode 100644 index 000000000..992fc7550 --- /dev/null +++ b/eth/protocol.go @@ -0,0 +1,294 @@ +package eth + +import ( + "bytes" + "math" + "math/big" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethutil" + ethlogger "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" +) + +var logger = ethlogger.NewLogger("SERV") + +// ethProtocol represents the ethereum wire protocol +// instance is running on each peer +type ethProtocol struct { + eth backend + td *big.Int + peer *p2p.Peer + rw p2p.MsgReadWriter +} + +// backend is the interface the ethereum protocol backend should implement +// used as an argument to EthProtocol +type backend interface { + GetTransactions() (txs []*types.Transaction) + AddTransactions(txs []*types.Transaction) + GetBlockHashes(hash []byte, amount uint32) (hashes [][]byte) + AddHash(hash []byte, peer *p2p.Peer) (more bool) + GetBlock(hash []byte) (block *types.Block) + AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) + AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) +} + +const ( + ProtocolVersion = 43 + // 0x00 // PoC-1 + // 0x01 // PoC-2 + // 0x07 // PoC-3 + // 0x09 // PoC-4 + // 0x17 // PoC-5 + // 0x1c // PoC-6 + NetworkId = 0 + ProtocolLength = uint64(8) + ProtocolMaxMsgSize = 10 * 1024 * 1024 + + blockHashesBatchSize = 256 +) + +// eth protocol message codes +const ( + StatusMsg = iota + GetTxMsg // unused + TxMsg + GetBlockHashesMsg + BlockHashesMsg + GetBlocksMsg + BlocksMsg + NewBlockMsg +) + +// message structs used for rlp decoding +type newBlockMsgData struct { + Block *types.Block + TD *big.Int +} + +type getBlockHashesMsgData struct { + Hash []byte + Amount uint32 +} + +// main entrypoint, wrappers starting a server running the eth protocol +// use this constructor to attach the protocol (class) to server caps +func EthProtocol(eth backend) *p2p.Protocol { + return &p2p.Protocol{ + Name: "eth", + Version: ProtocolVersion, + Length: ProtocolLength, + Run: func(peer *p2p.Peer, rw p2p.MsgReadWriter) error { + return runEthProtocol(eth, peer, rw) + }, + } +} + +func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { + self := ðProtocol{ + eth: eth, + rw: rw, + peer: peer, + } + err = self.handleStatus() + if err == nil { + go func() { + for { + err = self.handle() + if err != nil { + break + } + } + }() + } + return +} + +func (self *ethProtocol) handle() error { + msg, err := self.rw.ReadMsg() + if err != nil { + return err + } + if msg.Size > ProtocolMaxMsgSize { + return ProtocolError(ErrMsgTooLarge, "%v > %v", msg.Size, ProtocolMaxMsgSize) + } + // make sure that the payload has been fully consumed + defer msg.Discard() + + switch msg.Code { + + case StatusMsg: + return ProtocolError(ErrExtraStatusMsg, "") + + case GetTxMsg: + txs := self.eth.GetTransactions() + // TODO: rewrite using rlp flat + txsInterface := make([]interface{}, len(txs)) + for i, tx := range txs { + txsInterface[i] = tx.RlpData() + } + return self.rw.EncodeMsg(TxMsg, txsInterface...) + + case TxMsg: + var txs []*types.Transaction + if err := msg.Decode(&txs); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + self.eth.AddTransactions(txs) + + case GetBlockHashesMsg: + var request getBlockHashesMsgData + if err := msg.Decode(&request); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + hashes := self.eth.GetBlockHashes(request.Hash, request.Amount) + return self.rw.EncodeMsg(BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...) + + case BlockHashesMsg: + // TODO: redo using lazy decode , this way very inefficient on known chains + // s := rlp.NewListStream(msg.Payload, uint64(msg.Size)) + var blockHashes [][]byte + if err := msg.Decode(&blockHashes); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + fetchMore := true + for _, hash := range blockHashes { + fetchMore = self.eth.AddHash(hash, self.peer) + if !fetchMore { + break + } + } + if fetchMore { + return self.FetchHashes(blockHashes[len(blockHashes)-1]) + } + + case GetBlocksMsg: + // Limit to max 300 blocks + var blockHashes [][]byte + if err := msg.Decode(&blockHashes); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + max := int(math.Min(float64(len(blockHashes)), 300.0)) + var blocks []interface{} + for i, hash := range blockHashes { + if i >= max { + break + } + block := self.eth.GetBlock(hash) + if block != nil { + blocks = append(blocks, block.Value().Raw()) + } + } + return self.rw.EncodeMsg(BlocksMsg, blocks...) + + case BlocksMsg: + var blocks []*types.Block + if err := msg.Decode(&blocks); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + for _, block := range blocks { + fetchHashes, err := self.eth.AddBlock(nil, block, self.peer) + if err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } + if fetchHashes { + if err := self.FetchHashes(block.Hash()); err != nil { + return err + } + } + } + + case NewBlockMsg: + var request newBlockMsgData + if err := msg.Decode(&request); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + var fetchHashes bool + // this should reset td and offer blockpool as candidate new peer? + if fetchHashes, err = self.eth.AddBlock(request.TD, request.Block, self.peer); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } + if fetchHashes { + return self.FetchHashes(request.Block.Hash()) + } + + default: + return ProtocolError(ErrInvalidMsgCode, "%v", msg.Code) + } + return nil +} + +type statusMsgData struct { + ProtocolVersion uint + NetworkId uint + TD *big.Int + CurrentBlock []byte + GenesisBlock []byte +} + +func (self *ethProtocol) statusMsg() p2p.Msg { + td, currentBlock, genesisBlock := self.eth.Status() + + return p2p.NewMsg(StatusMsg, + uint32(ProtocolVersion), + uint32(NetworkId), + td, + currentBlock, + genesisBlock, + ) +} + +func (self *ethProtocol) handleStatus() error { + // send precanned status message + if err := self.rw.WriteMsg(self.statusMsg()); err != nil { + return err + } + + // read and handle remote status + msg, err := self.rw.ReadMsg() + if err != nil { + return err + } + + if msg.Code != StatusMsg { + return ProtocolError(ErrNoStatusMsg, "first msg has code %x (!= %x)", msg.Code, StatusMsg) + } + + if msg.Size > ProtocolMaxMsgSize { + return ProtocolError(ErrMsgTooLarge, "%v > %v", msg.Size, ProtocolMaxMsgSize) + } + + var status statusMsgData + if err := msg.Decode(&status); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + + _, _, genesisBlock := self.eth.Status() + + if bytes.Compare(status.GenesisBlock, genesisBlock) != 0 { + return ProtocolError(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock, genesisBlock) + } + + if status.NetworkId != NetworkId { + return ProtocolError(ErrNetworkIdMismatch, "%d (!= %d)", status.NetworkId, NetworkId) + } + + if ProtocolVersion != status.ProtocolVersion { + return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) + } + + logger.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + + if self.eth.AddPeer(status.TD, status.CurrentBlock, self.peer) { + return self.FetchHashes(status.CurrentBlock) + } + + return nil +} + +func (self *ethProtocol) FetchHashes(from []byte) error { + logger.Debugf("Fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) + return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) +} diff --git a/eth/protocol_test.go b/eth/protocol_test.go new file mode 100644 index 000000000..757e87fa4 --- /dev/null +++ b/eth/protocol_test.go @@ -0,0 +1,133 @@ +package eth + +import ( + "io" + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/p2p" +) + +type testMsgReadWriter struct { + in chan p2p.Msg + out chan p2p.Msg +} + +func (self *testMsgReadWriter) In(msg p2p.Msg) { + self.in <- msg +} + +func (self *testMsgReadWriter) Out(msg p2p.Msg) { + self.in <- msg +} + +func (self *testMsgReadWriter) WriteMsg(msg p2p.Msg) error { + self.out <- msg + return nil +} + +func (self *testMsgReadWriter) EncodeMsg(code uint64, data ...interface{}) error { + return self.WriteMsg(p2p.NewMsg(code, data)) +} + +func (self *testMsgReadWriter) ReadMsg() (p2p.Msg, error) { + msg, ok := <-self.in + if !ok { + return msg, io.EOF + } + return msg, nil +} + +func errorCheck(t *testing.T, expCode int, err error) { + perr, ok := err.(*protocolError) + if ok && perr != nil { + if code := perr.Code; code != expCode { + ok = false + } + } + if !ok { + t.Errorf("expected error code %v, got %v", ErrNoStatusMsg, err) + } +} + +type TestBackend struct { + getTransactions func() []*types.Transaction + addTransactions func(txs []*types.Transaction) + getBlockHashes func(hash []byte, amount uint32) (hashes [][]byte) + addHash func(hash []byte, peer *p2p.Peer) (more bool) + getBlock func(hash []byte) *types.Block + addBlock func(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) + addPeer func(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + status func() (td *big.Int, currentBlock []byte, genesisBlock []byte) +} + +func (self *TestBackend) GetTransactions() (txs []*types.Transaction) { + if self.getTransactions != nil { + txs = self.getTransactions() + } + return +} + +func (self *TestBackend) AddTransactions(txs []*types.Transaction) { + if self.addTransactions != nil { + self.addTransactions(txs) + } +} + +func (self *TestBackend) GetBlockHashes(hash []byte, amount uint32) (hashes [][]byte) { + if self.getBlockHashes != nil { + hashes = self.getBlockHashes(hash, amount) + } + return +} + +func (self *TestBackend) AddHash(hash []byte, peer *p2p.Peer) (more bool) { + if self.addHash != nil { + more = self.addHash(hash, peer) + } + return +} +func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { + if self.getBlock != nil { + block = self.getBlock(hash) + } + return +} + +func (self *TestBackend) AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) { + if self.addBlock != nil { + fetchHashes, err = self.addBlock(td, block, peer) + } + return +} + +func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) { + if self.addPeer != nil { + fetchHashes = self.addPeer(td, currentBlock, peer) + } + return +} + +func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { + if self.status != nil { + td, currentBlock, genesisBlock = self.status() + } + return +} + +func TestEth(t *testing.T) { + quit := make(chan bool) + rw := &testMsgReadWriter{make(chan p2p.Msg, 10), make(chan p2p.Msg, 10)} + testBackend := &TestBackend{} + var err error + go func() { + err = runEthProtocol(testBackend, nil, rw) + close(quit) + }() + statusMsg := p2p.NewMsg(4) + rw.In(statusMsg) + <-quit + errorCheck(t, ErrNoStatusMsg, err) + // read(t, remote, []byte("hello, world"), nil) +} -- cgit v1.2.3 From 31a9fdced84cdefd17f98f1c6a018cb1ab67ad8a Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 9 Dec 2014 23:54:02 +0000 Subject: no logging in error (to be refactored into p2p) --- eth/error.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/eth/error.go b/eth/error.go index cb4459435..9355d6457 100644 --- a/eth/error.go +++ b/eth/error.go @@ -2,7 +2,6 @@ package eth import ( "fmt" - // "github.com/ethereum/go-ethereum/logger" ) const ( @@ -45,11 +44,6 @@ func newProtocolError(code int, format string, params ...interface{}) *protocolE func ProtocolError(code int, format string, params ...interface{}) (err *protocolError) { err = newProtocolError(code, format, params...) // report(err) - if err.Fatal() { - logger.Errorln(err) - } else { - logger.Debugln(err) - } return } -- cgit v1.2.3 From e74f9f27dbd8917d06cbaf68395893358d476f68 Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 9 Dec 2014 23:55:50 +0000 Subject: eth protocol changes - changed backend interface - using callbacks for blockPool - use rlp stream for lazy decoding - use peer as logger - add id (peer pubkey) to ethProtocol fields - add testPeer to protocol test (temporary) --- eth/protocol.go | 136 ++++++++++++++++++++++++++++++--------------------- eth/protocol_test.go | 56 ++++++++++++++++----- 2 files changed, 122 insertions(+), 70 deletions(-) diff --git a/eth/protocol.go b/eth/protocol.go index 992fc7550..380bcc8d2 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -7,18 +7,16 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" - ethlogger "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/rlp" ) -var logger = ethlogger.NewLogger("SERV") - // ethProtocol represents the ethereum wire protocol // instance is running on each peer type ethProtocol struct { eth backend - td *big.Int peer *p2p.Peer + id string rw p2p.MsgReadWriter } @@ -26,28 +24,21 @@ type ethProtocol struct { // used as an argument to EthProtocol type backend interface { GetTransactions() (txs []*types.Transaction) - AddTransactions(txs []*types.Transaction) + AddTransactions([]*types.Transaction) GetBlockHashes(hash []byte, amount uint32) (hashes [][]byte) - AddHash(hash []byte, peer *p2p.Peer) (more bool) + AddBlockHashes(next func() ([]byte, bool), peerId string) GetBlock(hash []byte) (block *types.Block) - AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) - AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + AddBlock(block *types.Block, peerId string) (err error) + AddPeer(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) + RemovePeer(peerId string) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) } const ( - ProtocolVersion = 43 - // 0x00 // PoC-1 - // 0x01 // PoC-2 - // 0x07 // PoC-3 - // 0x09 // PoC-4 - // 0x17 // PoC-5 - // 0x1c // PoC-6 + ProtocolVersion = 43 NetworkId = 0 ProtocolLength = uint64(8) ProtocolMaxMsgSize = 10 * 1024 * 1024 - - blockHashesBatchSize = 256 ) // eth protocol message codes @@ -74,7 +65,8 @@ type getBlockHashesMsgData struct { } // main entrypoint, wrappers starting a server running the eth protocol -// use this constructor to attach the protocol (class) to server caps +// use this constructor to attach the protocol ("class") to server caps +// the Dev p2p layer then runs the protocol instance on each peer func EthProtocol(eth backend) *p2p.Protocol { return &p2p.Protocol{ Name: "eth", @@ -86,11 +78,14 @@ func EthProtocol(eth backend) *p2p.Protocol { } } +// the main loop that handles incoming messages +// note RemovePeer in the post-disconnect hook func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { self := ðProtocol{ eth: eth, rw: rw, peer: peer, + id: (string)(peer.Identity().Pubkey()), } err = self.handleStatus() if err == nil { @@ -98,6 +93,7 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro for { err = self.handle() if err != nil { + self.eth.RemovePeer(self.id) break } } @@ -132,6 +128,7 @@ func (self *ethProtocol) handle() error { return self.rw.EncodeMsg(TxMsg, txsInterface...) case TxMsg: + // TODO: rework using lazy RLP stream var txs []*types.Transaction if err := msg.Decode(&txs); err != nil { return ProtocolError(ErrDecode, "%v", err) @@ -148,29 +145,26 @@ func (self *ethProtocol) handle() error { case BlockHashesMsg: // TODO: redo using lazy decode , this way very inefficient on known chains - // s := rlp.NewListStream(msg.Payload, uint64(msg.Size)) - var blockHashes [][]byte - if err := msg.Decode(&blockHashes); err != nil { - return ProtocolError(ErrDecode, "%v", err) - } - fetchMore := true - for _, hash := range blockHashes { - fetchMore = self.eth.AddHash(hash, self.peer) - if !fetchMore { - break + msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) + var err error + iter := func() (hash []byte, ok bool) { + hash, err = msgStream.Bytes() + if err == nil { + ok = true } + return } - if fetchMore { - return self.FetchHashes(blockHashes[len(blockHashes)-1]) + self.eth.AddBlockHashes(iter, self.id) + if err != nil && err != rlp.EOL { + return ProtocolError(ErrDecode, "%v", err) } case GetBlocksMsg: - // Limit to max 300 blocks var blockHashes [][]byte if err := msg.Decode(&blockHashes); err != nil { return ProtocolError(ErrDecode, "%v", err) } - max := int(math.Min(float64(len(blockHashes)), 300.0)) + max := int(math.Min(float64(len(blockHashes)), blockHashesBatchSize)) var blocks []interface{} for i, hash := range blockHashes { if i >= max { @@ -184,20 +178,19 @@ func (self *ethProtocol) handle() error { return self.rw.EncodeMsg(BlocksMsg, blocks...) case BlocksMsg: - var blocks []*types.Block - if err := msg.Decode(&blocks); err != nil { - return ProtocolError(ErrDecode, "%v", err) - } - for _, block := range blocks { - fetchHashes, err := self.eth.AddBlock(nil, block, self.peer) - if err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } - if fetchHashes { - if err := self.FetchHashes(block.Hash()); err != nil { - return err + msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) + for { + var block *types.Block + if err := msgStream.Decode(&block); err != nil { + if err == rlp.EOL { + break + } else { + return ProtocolError(ErrDecode, "%v", err) } } + if err := self.eth.AddBlock(block, self.id); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } } case NewBlockMsg: @@ -205,13 +198,24 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } - var fetchHashes bool - // this should reset td and offer blockpool as candidate new peer? - if fetchHashes, err = self.eth.AddBlock(request.TD, request.Block, self.peer); err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } - if fetchHashes { - return self.FetchHashes(request.Block.Hash()) + hash := request.Block.Hash() + // to simplify backend interface adding a new block + // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer + // (or selected as new best peer) + if self.eth.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) { + called := true + iter := func() (hash []byte, ok bool) { + if called { + called = false + return hash, true + } else { + return + } + } + self.eth.AddBlockHashes(iter, self.id) + if err := self.eth.AddBlock(request.Block, self.id); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } } default: @@ -279,16 +283,34 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) } - logger.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) - if self.eth.AddPeer(status.TD, status.CurrentBlock, self.peer) { - return self.FetchHashes(status.CurrentBlock) - } + self.eth.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) return nil } -func (self *ethProtocol) FetchHashes(from []byte) error { - logger.Debugf("Fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) +func (self *ethProtocol) requestBlockHashes(from []byte) error { + self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) } + +func (self *ethProtocol) requestBlocks(hashes [][]byte) error { + self.peer.Debugf("fetching %v blocks", len(hashes)) + return self.rw.EncodeMsg(GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)) +} + +func (self *ethProtocol) invalidBlock(err error) { + ProtocolError(ErrInvalidBlock, "%v", err) + self.peer.Disconnect(p2p.DiscSubprotocolError) +} + +func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *protocolError) { + err = ProtocolError(code, format, params...) + if err.Fatal() { + self.peer.Errorln(err) + } else { + self.peer.Debugln(err) + } + return +} diff --git a/eth/protocol_test.go b/eth/protocol_test.go index 757e87fa4..a166ea6cd 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p" ) @@ -55,10 +56,11 @@ type TestBackend struct { getTransactions func() []*types.Transaction addTransactions func(txs []*types.Transaction) getBlockHashes func(hash []byte, amount uint32) (hashes [][]byte) - addHash func(hash []byte, peer *p2p.Peer) (more bool) + addBlockHashes func(next func() ([]byte, bool), peerId string) getBlock func(hash []byte) *types.Block - addBlock func(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) - addPeer func(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + addBlock func(block *types.Block, peerId string) (err error) + addPeer func(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) + removePeer func(peerId string) status func() (td *big.Int, currentBlock []byte, genesisBlock []byte) } @@ -82,12 +84,12 @@ func (self *TestBackend) GetBlockHashes(hash []byte, amount uint32) (hashes [][] return } -func (self *TestBackend) AddHash(hash []byte, peer *p2p.Peer) (more bool) { - if self.addHash != nil { - more = self.addHash(hash, peer) +func (self *TestBackend) AddBlockHashes(next func() ([]byte, bool), peerId string) { + if self.addBlockHashes != nil { + self.addBlockHashes(next, peerId) } - return } + func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { if self.getBlock != nil { block = self.getBlock(hash) @@ -95,20 +97,26 @@ func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { return } -func (self *TestBackend) AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) { +func (self *TestBackend) AddBlock(block *types.Block, peerId string) (err error) { if self.addBlock != nil { - fetchHashes, err = self.addBlock(td, block, peer) + err = self.addBlock(block, peerId) } return } -func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) { +func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) { if self.addPeer != nil { - fetchHashes = self.addPeer(td, currentBlock, peer) + best = self.addPeer(td, currentBlock, peerId, requestBlockHashes, requestBlocks, invalidBlock) } return } +func (self *TestBackend) RemovePeer(peerId string) { + if self.removePeer != nil { + self.removePeer(peerId) + } +} + func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { if self.status != nil { td, currentBlock, genesisBlock = self.status() @@ -116,13 +124,35 @@ func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBloc return } -func TestEth(t *testing.T) { +// TODO: refactor this into p2p/client_identity +type peerId struct { + pubkey []byte +} + +func (self *peerId) String() string { + return "test peer" +} + +func (self *peerId) Pubkey() (pubkey []byte) { + pubkey = self.pubkey + if len(pubkey) == 0 { + pubkey = crypto.GenerateNewKeyPair().PublicKey + self.pubkey = pubkey + } + return +} + +func testPeer() *p2p.Peer { + return p2p.NewPeer(&peerId{}, []p2p.Cap{}) +} + +func TestErrNoStatusMsg(t *testing.T) { quit := make(chan bool) rw := &testMsgReadWriter{make(chan p2p.Msg, 10), make(chan p2p.Msg, 10)} testBackend := &TestBackend{} var err error go func() { - err = runEthProtocol(testBackend, nil, rw) + err = runEthProtocol(testBackend, testPeer(), rw) close(quit) }() statusMsg := p2p.NewMsg(4) -- cgit v1.2.3 From 3e38f8af23bfed66e392bb570449e739c10d2641 Mon Sep 17 00:00:00 2001 From: zelig Date: Wed, 10 Dec 2014 04:12:25 +0000 Subject: initial commit for eth blockpool + test --- eth/block_pool.go | 514 +++++++++++++++++++++++++++++++++++++++++++++++++ eth/block_pool_test.go | 198 +++++++++++++++++++ 2 files changed, 712 insertions(+) create mode 100644 eth/block_pool.go create mode 100644 eth/block_pool_test.go diff --git a/eth/block_pool.go b/eth/block_pool.go new file mode 100644 index 000000000..2c5ebb1e3 --- /dev/null +++ b/eth/block_pool.go @@ -0,0 +1,514 @@ +package eth + +import ( + "bytes" + "fmt" + "math" + "math/big" + "sync" + "time" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/event" + ethlogger "github.com/ethereum/go-ethereum/logger" +) + +var poolLogger = ethlogger.NewLogger("Blockpool") + +const ( + blockHashesBatchSize = 256 + blockBatchSize = 64 + blockRequestInterval = 10 // seconds + blockRequestRepetition = 1 + cacheTimeout = 3 // minutes + blockTimeout = 5 // minutes +) + +type poolNode struct { + hash []byte + block *types.Block + child *poolNode + parent *poolNode + root *nodePointer + knownParent bool + suicide chan bool + peer string + source string + blockRequestRoot bool + blockRequestControl *bool + blockRequestQuit *(chan bool) +} + +// the minimal interface for chain manager +type chainManager interface { + KnownBlock(hash []byte) bool + AddBlock(*types.Block) error + CheckPoW(*types.Block) bool +} + +type BlockPool struct { + chainManager chainManager + eventer event.TypeMux + + // pool Pool + lock sync.Mutex + pool map[string]*poolNode + + peersLock sync.Mutex + peers map[string]*peerInfo + peer *peerInfo + + quit chan bool + wg sync.WaitGroup + running bool +} + +type peerInfo struct { + td *big.Int + currentBlock []byte + id string + requestBlockHashes func([]byte) error + requestBlocks func([][]byte) error + invalidBlock func(error) +} + +type nodePointer struct { + hash []byte +} + +type peerChangeEvent struct { + *peerInfo +} + +func NewBlockPool(chMgr chainManager) *BlockPool { + return &BlockPool{ + chainManager: chMgr, + pool: make(map[string]*poolNode), + peers: make(map[string]*peerInfo), + quit: make(chan bool), + running: true, + } +} + +func (self *BlockPool) Stop() { + self.lock.Lock() + if !self.running { + self.lock.Unlock() + return + } + self.running = false + self.lock.Unlock() + + poolLogger.Infoln("Stopping") + + close(self.quit) + self.wg.Wait() + poolLogger.Infoln("Stopped") + +} + +// Entry point for eth protocol to add block hashes received via BlockHashesMsg +// only hashes from the best peer is handled +// this method is always responsible to initiate further hash requests until +// a known parent is reached unless cancelled by a peerChange event +func (self *BlockPool) AddBlockHashes(next func() ([]byte, bool), peerId string) { + // subscribe to peerChangeEvent before we check for best peer + peerChange := self.eventer.Subscribe(peerChangeEvent{}) + defer peerChange.Unsubscribe() + // check if this peer is the best + peer, best := self.getPeer(peerId) + if !best { + return + } + root := &nodePointer{} + // peer is still the best + hashes := make(chan []byte) + var lastPoolNode *poolNode + + // using a for select loop so that peer change (new best peer) can abort the parallel thread that processes hashes of the earlier best peer + for { + hash, ok := next() + if ok { + hashes <- hash + } else { + break + } + select { + case <-self.quit: + return + case <-peerChange.Chan(): + // remember where we left off with this peer + if lastPoolNode != nil { + root.hash = lastPoolNode.hash + go self.killChain(lastPoolNode) + } + case hash := <-hashes: + self.lock.Lock() + defer self.lock.Unlock() + // check if known block connecting the downloaded chain to our blockchain + if self.chainManager.KnownBlock(hash) { + poolLogger.Infof("known block (%x...)\n", hash[0:4]) + if lastPoolNode != nil { + lastPoolNode.knownParent = true + go self.requestBlocksLoop(lastPoolNode) + } else { + // all hashes known if topmost one is in blockchain + } + return + } + // + var currentPoolNode *poolNode + // check if lastPoolNode has the correct parent node (hash matching), + // then just assign to currentPoolNode + if lastPoolNode != nil && lastPoolNode.parent != nil && bytes.Compare(lastPoolNode.parent.hash, hash) == 0 { + currentPoolNode = lastPoolNode.parent + } else { + // otherwise look up in pool + currentPoolNode = self.pool[string(hash)] + // if node does not exist, create it and index in the pool + if currentPoolNode == nil { + currentPoolNode = &poolNode{ + hash: hash, + } + self.pool[string(hash)] = currentPoolNode + } + } + // set up parent-child nodes (doubly linked list) + self.link(currentPoolNode, lastPoolNode) + // ! we trust the node iff + // (1) node marked as by the same peer or + // (2) it has a PoW valid block retrieved + if currentPoolNode.peer == peer.id || currentPoolNode.block != nil { + // the trusted checkpoint from which we request hashes down to known head + lastPoolNode = self.pool[string(currentPoolNode.root.hash)] + break + } + currentPoolNode.peer = peer.id + currentPoolNode.root = root + lastPoolNode = currentPoolNode + } + } + // lastPoolNode is nil if and only if the node with stored root hash is already cleaned up + // after valid block insertion, therefore in this case the blockpool active chain is connected to the blockchain, so no need to request further hashes or request blocks + if lastPoolNode != nil { + root.hash = lastPoolNode.hash + peer.requestBlockHashes(lastPoolNode.hash) + go self.requestBlocksLoop(lastPoolNode) + } + return +} + +func (self *BlockPool) requestBlocksLoop(node *poolNode) { + suicide := time.After(blockTimeout * time.Minute) + requestTimer := time.After(0) + var controlChan chan bool + closedChan := make(chan bool) + quit := make(chan bool) + close(closedChan) + requestBlocks := true + origNode := node + self.lock.Lock() + node.blockRequestRoot = true + b := false + control := &b + node.blockRequestControl = control + node.blockRequestQuit = &quit + self.lock.Unlock() + blocks := 0 + self.wg.Add(1) +loop: + for { + if requestBlocks { + controlChan = closedChan + } else { + self.lock.Lock() + if *node.blockRequestControl { + controlChan = closedChan + *node.blockRequestControl = false + } + self.lock.Unlock() + } + select { + case <-quit: + break loop + case <-suicide: + go self.killChain(origNode) + break loop + + case <-requestTimer: + requestBlocks = true + + case <-controlChan: + controlChan = nil + // this iteration takes care of requesting blocks only starting from the first node with a missing block (moving target), + // max up to the next checkpoint (n.blockRequestRoot true) + nodes := []*poolNode{} + n := node + next := node + self.lock.Lock() + for n != nil && (n == node || !n.blockRequestRoot) && (requestBlocks || n.block != nil) { + if n.block != nil { + if len(nodes) == 0 { + // nil control indicates that node is not needed anymore + // block can be inserted to blockchain and deleted if knownParent + n.blockRequestControl = nil + blocks++ + next = next.child + } else { + // this is needed to indicate that when a new chain forks from an existing one + // triggering a reorg will ? renew the blockTimeout period ??? + // if there is a block but control == nil should start fetching blocks, see link function + n.blockRequestControl = control + } + } else { + nodes = append(nodes, n) + n.blockRequestControl = control + } + n = n.child + } + // if node is connected to the blockchain, we can immediately start inserting + // blocks to the blockchain and delete nodes + if node.knownParent { + go self.insertChainFrom(node) + } + if next.blockRequestRoot && next != node { + // no more missing blocks till the checkpoint, quitting + poolLogger.Debugf("fetched %v blocks on active chain, batch %v-%v", blocks, origNode, n) + break loop + } + self.lock.Unlock() + + // reset starting node to the first descendant node with missing block + node = next + if !requestBlocks { + continue + } + go self.requestBlocks(nodes) + requestTimer = time.After(blockRequestInterval * time.Second) + } + } + self.wg.Done() + return +} + +func (self *BlockPool) requestBlocks(nodes []*poolNode) { + // distribute block request among known peers + self.peersLock.Lock() + peerCount := len(self.peers) + poolLogger.Debugf("requesting %v missing blocks from %v peers", len(nodes), peerCount) + blockHashes := make([][][]byte, peerCount) + repetitions := int(math.Max(float64(peerCount)/2.0, float64(blockRequestRepetition))) + for n, node := range nodes { + for i := 0; i < repetitions; i++ { + blockHashes[n%peerCount] = append(blockHashes[n%peerCount], node.hash) + n++ + } + } + i := 0 + for _, peer := range self.peers { + peer.requestBlocks(blockHashes[i]) + i++ + } + self.peersLock.Unlock() +} + +func (self *BlockPool) insertChainFrom(node *poolNode) { + self.lock.Lock() + defer self.lock.Unlock() + for node != nil && node.blockRequestControl == nil { + err := self.chainManager.AddBlock(node.block) + if err != nil { + poolLogger.Debugf("invalid block %v", node.hash) + poolLogger.Debugf("penalise peers %v (hash), %v (block)", node.peer, node.source) + // penalise peer in node.source + go self.killChain(node) + return + } + poolLogger.Debugf("insert block %v into blockchain", node.hash) + node = node.child + } + // if block insertion succeeds, mark the child as knownParent + // trigger request blocks reorg + if node != nil { + node.knownParent = true + *(node.blockRequestControl) = true + } +} + +// AddPeer is called by the eth protocol instance running on the peer after +// the status message has been received with total difficulty and current block hash +// AddPeer can only be used once, RemovePeer needs to be called when the peer disconnects +func (self *BlockPool) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) bool { + self.peersLock.Lock() + defer self.peersLock.Unlock() + if self.peers[peerId] != nil { + panic("peer already added") + } + info := &peerInfo{ + td: td, + currentBlock: currentBlock, + id: peerId, //peer.Identity().Pubkey() + requestBlockHashes: requestBlockHashes, + requestBlocks: requestBlocks, + invalidBlock: invalidBlock, + } + self.peers[peerId] = info + poolLogger.Debugf("add new peer %v with td %v", peerId, td) + currentTD := ethutil.Big0 + if self.peer != nil { + currentTD = self.peer.td + } + if td.Cmp(currentTD) > 0 { + self.peer = info + self.eventer.Post(peerChangeEvent{info}) + poolLogger.Debugf("peer %v promoted to best peer", peerId) + requestBlockHashes(currentBlock) + return true + } + return false +} + +// RemovePeer is called by the eth protocol when the peer disconnects +func (self *BlockPool) RemovePeer(peerId string) { + self.peersLock.Lock() + defer self.peersLock.Unlock() + if self.peers[peerId] != nil { + panic("peer already removed") + } + self.peers[peerId] = nil + poolLogger.Debugf("remove peer %v", peerId[0:4]) + + // if current best peer is removed, need find a better one + if peerId == self.peer.id { + var newPeer *peerInfo + max := ethutil.Big0 + // peer with the highest self-acclaimed TD is chosen + for _, info := range self.peers { + if info.td.Cmp(max) > 0 { + max = info.td + newPeer = info + } + } + self.peer = newPeer + self.eventer.Post(peerChangeEvent{newPeer}) + if newPeer != nil { + poolLogger.Debugf("peer %v with td %v spromoted to best peer", newPeer.id[0:4], newPeer.td) + newPeer.requestBlockHashes(newPeer.currentBlock) + } else { + poolLogger.Warnln("no peers left") + } + } +} + +func (self *BlockPool) getPeer(peerId string) (*peerInfo, bool) { + self.peersLock.Lock() + defer self.peersLock.Unlock() + if self.peer.id == peerId { + return self.peer, true + } + info, ok := self.peers[peerId] + if !ok { + panic("unknown peer") + } + return info, false +} + +// if same peer gave different chain before, this will overwrite it +// if currentPoolNode existed as a non-leaf node the earlier fork is delinked +// if same parent hash is found, we can abort, we do not allow the same peer to change minds about parent of same hash, if errored first time round, will get penalized. +// if lastPoolNode had a different parent the earlier parent (with entire subtree) is delinked, this situation cannot normally arise though +// just in case reset lastPoolNode as non-root (unlikely) + +func (self *BlockPool) link(parent, child *poolNode) { + // reactivate node scheduled for suicide + if parent.suicide != nil { + close(parent.suicide) + parent.suicide = nil + } + if parent.child != child { + orphan := parent.child + orphan.parent = nil + go self.killChain(orphan) + parent.child = child + } + if child != nil { + if child.parent != parent { + orphan := child.parent + orphan.child = nil + go func() { + // if it is a aberrant reverse fork, zip down to bottom + for orphan.parent != nil { + orphan = orphan.parent + } + self.killChain(orphan) + }() + child.parent = parent + } + child.knownParent = false + } +} + +func (self *BlockPool) killChain(node *poolNode) { + if node == nil { + return + } + poolLogger.Debugf("suicide scheduled on node %v", node) + suicide := make(chan bool) + self.lock.Lock() + node.suicide = suicide + self.lock.Unlock() + timer := time.After(cacheTimeout * time.Minute) + self.wg.Add(1) + select { + case <-self.quit: + case <-suicide: + // cancel suicide = close node.suicide to reactivate node + case <-timer: + poolLogger.Debugf("suicide on node %v", node) + self.lock.Lock() + defer self.lock.Unlock() + // proceed up via child links until another suicide root found or chain ends + // abort request blocks loops that start above + // and delete nodes from pool then quit the suicide process + okToAbort := node.blockRequestRoot + for node != nil && (node.suicide == suicide || node.suicide == nil) { + self.pool[string(node.hash)] = nil + if okToAbort && node.blockRequestQuit != nil { + quit := *(node.blockRequestQuit) + if quit != nil { // not yet closed + *(node.blockRequestQuit) = nil + close(quit) + } + } else { + okToAbort = true + } + node = node.child + } + } + self.wg.Done() +} + +// AddBlock is the entry point for the eth protocol when blockmsg is received upon requests +// It has a strict interpretation of the protocol in that if the block received has not been requested, it results in an error (which can be ignored) +// block is checked for PoW +// only the first PoW-valid block for a hash is considered legit +func (self *BlockPool) AddBlock(block *types.Block, peerId string) (err error) { + hash := block.Hash() + self.lock.Lock() + defer self.lock.Unlock() + node, ok := self.pool[string(hash)] + if !ok && !self.chainManager.KnownBlock(hash) { + return fmt.Errorf("unrequested block %x", hash) + } + if node.block != nil { + return + } + // validate block for PoW + if !self.chainManager.CheckPoW(block) { + return fmt.Errorf("invalid pow on block %x", hash) + } + node.block = block + node.source = peerId + return nil +} diff --git a/eth/block_pool_test.go b/eth/block_pool_test.go new file mode 100644 index 000000000..315cc748d --- /dev/null +++ b/eth/block_pool_test.go @@ -0,0 +1,198 @@ +package eth + +import ( + "bytes" + "fmt" + "log" + "os" + "sync" + "testing" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethutil" + ethlogger "github.com/ethereum/go-ethereum/logger" +) + +var sys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel)) + +type testChainManager struct { + knownBlock func(hash []byte) bool + addBlock func(*types.Block) error + checkPoW func(*types.Block) bool +} + +func (self *testChainManager) KnownBlock(hash []byte) bool { + if self.knownBlock != nil { + return self.knownBlock(hash) + } + return false +} + +func (self *testChainManager) AddBlock(block *types.Block) error { + if self.addBlock != nil { + return self.addBlock(block) + } + return nil +} + +func (self *testChainManager) CheckPoW(block *types.Block) bool { + if self.checkPoW != nil { + return self.checkPoW(block) + } + return false +} + +func knownBlock(hashes ...[]byte) (f func([]byte) bool) { + f = func(block []byte) bool { + for _, hash := range hashes { + if bytes.Compare(block, hash) == 0 { + return true + } + } + return false + } + return +} + +func addBlock(hashes ...[]byte) (f func(*types.Block) error) { + f = func(block *types.Block) error { + for _, hash := range hashes { + if bytes.Compare(block.Hash(), hash) == 0 { + return fmt.Errorf("invalid by test") + } + } + return nil + } + return +} + +func checkPoW(hashes ...[]byte) (f func(*types.Block) bool) { + f = func(block *types.Block) bool { + for _, hash := range hashes { + if bytes.Compare(block.Hash(), hash) == 0 { + return false + } + } + return true + } + return +} + +func newTestChainManager(knownBlocks [][]byte, invalidBlocks [][]byte, invalidPoW [][]byte) *testChainManager { + return &testChainManager{ + knownBlock: knownBlock(knownBlocks...), + addBlock: addBlock(invalidBlocks...), + checkPoW: checkPoW(invalidPoW...), + } +} + +type intToHash map[int][]byte + +type hashToInt map[string]int + +type testHashPool struct { + intToHash + hashToInt +} + +func newHash(i int) []byte { + return crypto.Sha3([]byte(string(i))) +} + +func newTestBlockPool(knownBlockIndexes []int, invalidBlockIndexes []int, invalidPoWIndexes []int) (hashPool *testHashPool, blockPool *BlockPool) { + hashPool = &testHashPool{make(intToHash), make(hashToInt)} + knownBlocks := hashPool.indexesToHashes(knownBlockIndexes) + invalidBlocks := hashPool.indexesToHashes(invalidBlockIndexes) + invalidPoW := hashPool.indexesToHashes(invalidPoWIndexes) + blockPool = NewBlockPool(newTestChainManager(knownBlocks, invalidBlocks, invalidPoW)) + return +} + +func (self *testHashPool) indexesToHashes(indexes []int) (hashes [][]byte) { + for _, i := range indexes { + hash, found := self.intToHash[i] + if !found { + hash = newHash(i) + self.intToHash[i] = hash + self.hashToInt[string(hash)] = i + } + hashes = append(hashes, hash) + } + return +} + +func (self *testHashPool) hashesToIndexes(hashes [][]byte) (indexes []int) { + for _, hash := range hashes { + i, found := self.hashToInt[string(hash)] + if !found { + i = -1 + } + indexes = append(indexes, i) + } + return +} + +type protocolChecker struct { + blockHashesRequests []int + blocksRequests [][]int + invalidBlocks []error + hashPool *testHashPool + lock sync.Mutex +} + +// -1 is special: not found (a hash never seen) +func (self *protocolChecker) requestBlockHashesCallBack() (requestBlockHashesCallBack func([]byte) error) { + requestBlockHashesCallBack = func(hash []byte) error { + indexes := self.hashPool.hashesToIndexes([][]byte{hash}) + self.lock.Lock() + defer self.lock.Unlock() + self.blockHashesRequests = append(self.blockHashesRequests, indexes[0]) + return nil + } + return +} + +func (self *protocolChecker) requestBlocksCallBack() (requestBlocksCallBack func([][]byte) error) { + requestBlocksCallBack = func(hashes [][]byte) error { + indexes := self.hashPool.hashesToIndexes(hashes) + self.lock.Lock() + defer self.lock.Unlock() + self.blocksRequests = append(self.blocksRequests, indexes) + return nil + } + return +} + +func (self *protocolChecker) invalidBlockCallBack() (invalidBlockCallBack func(error)) { + invalidBlockCallBack = func(err error) { + self.invalidBlocks = append(self.invalidBlocks, err) + } + return +} + +func TestAddPeer(t *testing.T) { + ethlogger.AddLogSystem(sys) + knownBlockIndexes := []int{0, 1} + invalidBlockIndexes := []int{2, 3} + invalidPoWIndexes := []int{4, 5} + hashPool, blockPool := newTestBlockPool(knownBlockIndexes, invalidBlockIndexes, invalidPoWIndexes) + // TODO: + // hashPool, blockPool, blockChainChecker = newTestBlockPool(knownBlockIndexes, invalidBlockIndexes, invalidPoWIndexes) + peer0 := &protocolChecker{ + // blockHashesRequests: make([]int), + // blocksRequests: make([][]int), + // invalidBlocks: make([]error), + hashPool: hashPool, + } + best := blockPool.AddPeer(ethutil.Big1, newHash(100), "0", + peer0.requestBlockHashesCallBack(), + peer0.requestBlocksCallBack(), + peer0.invalidBlockCallBack(), + ) + if !best { + t.Errorf("peer not accepted as best") + } + blockPool.Stop() + +} -- cgit v1.2.3 From e5aa38cb0f846cde3e0d70e751cfa6d53a889e99 Mon Sep 17 00:00:00 2001 From: zelig Date: Fri, 5 Dec 2014 21:14:55 +0000 Subject: initial commit for eth-p2p integration --- eth/error.go | 73 +++++++++++++ eth/protocol.go | 294 +++++++++++++++++++++++++++++++++++++++++++++++++++ eth/protocol_test.go | 133 +++++++++++++++++++++++ 3 files changed, 500 insertions(+) create mode 100644 eth/error.go create mode 100644 eth/protocol.go create mode 100644 eth/protocol_test.go diff --git a/eth/error.go b/eth/error.go new file mode 100644 index 000000000..cb4459435 --- /dev/null +++ b/eth/error.go @@ -0,0 +1,73 @@ +package eth + +import ( + "fmt" + // "github.com/ethereum/go-ethereum/logger" +) + +const ( + ErrMsgTooLarge = iota + ErrDecode + ErrInvalidMsgCode + ErrProtocolVersionMismatch + ErrNetworkIdMismatch + ErrGenesisBlockMismatch + ErrNoStatusMsg + ErrExtraStatusMsg + ErrInvalidBlock +) + +var errorToString = map[int]string{ + ErrMsgTooLarge: "Message too long", + ErrDecode: "Invalid message", + ErrInvalidMsgCode: "Invalid message code", + ErrProtocolVersionMismatch: "Protocol version mismatch", + ErrNetworkIdMismatch: "NetworkId mismatch", + ErrGenesisBlockMismatch: "Genesis block mismatch", + ErrNoStatusMsg: "No status message", + ErrExtraStatusMsg: "Extra status message", + ErrInvalidBlock: "Invalid block", +} + +type protocolError struct { + Code int + fatal bool + message string + format string + params []interface{} + // size int +} + +func newProtocolError(code int, format string, params ...interface{}) *protocolError { + return &protocolError{Code: code, format: format, params: params} +} + +func ProtocolError(code int, format string, params ...interface{}) (err *protocolError) { + err = newProtocolError(code, format, params...) + // report(err) + if err.Fatal() { + logger.Errorln(err) + } else { + logger.Debugln(err) + } + return +} + +func (self protocolError) Error() (message string) { + message = self.message + if message == "" { + message, ok := errorToString[self.Code] + if !ok { + panic("invalid error code") + } + if self.format != "" { + message += ": " + fmt.Sprintf(self.format, self.params...) + } + self.message = message + } + return +} + +func (self *protocolError) Fatal() bool { + return self.fatal +} diff --git a/eth/protocol.go b/eth/protocol.go new file mode 100644 index 000000000..992fc7550 --- /dev/null +++ b/eth/protocol.go @@ -0,0 +1,294 @@ +package eth + +import ( + "bytes" + "math" + "math/big" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethutil" + ethlogger "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" +) + +var logger = ethlogger.NewLogger("SERV") + +// ethProtocol represents the ethereum wire protocol +// instance is running on each peer +type ethProtocol struct { + eth backend + td *big.Int + peer *p2p.Peer + rw p2p.MsgReadWriter +} + +// backend is the interface the ethereum protocol backend should implement +// used as an argument to EthProtocol +type backend interface { + GetTransactions() (txs []*types.Transaction) + AddTransactions(txs []*types.Transaction) + GetBlockHashes(hash []byte, amount uint32) (hashes [][]byte) + AddHash(hash []byte, peer *p2p.Peer) (more bool) + GetBlock(hash []byte) (block *types.Block) + AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) + AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) +} + +const ( + ProtocolVersion = 43 + // 0x00 // PoC-1 + // 0x01 // PoC-2 + // 0x07 // PoC-3 + // 0x09 // PoC-4 + // 0x17 // PoC-5 + // 0x1c // PoC-6 + NetworkId = 0 + ProtocolLength = uint64(8) + ProtocolMaxMsgSize = 10 * 1024 * 1024 + + blockHashesBatchSize = 256 +) + +// eth protocol message codes +const ( + StatusMsg = iota + GetTxMsg // unused + TxMsg + GetBlockHashesMsg + BlockHashesMsg + GetBlocksMsg + BlocksMsg + NewBlockMsg +) + +// message structs used for rlp decoding +type newBlockMsgData struct { + Block *types.Block + TD *big.Int +} + +type getBlockHashesMsgData struct { + Hash []byte + Amount uint32 +} + +// main entrypoint, wrappers starting a server running the eth protocol +// use this constructor to attach the protocol (class) to server caps +func EthProtocol(eth backend) *p2p.Protocol { + return &p2p.Protocol{ + Name: "eth", + Version: ProtocolVersion, + Length: ProtocolLength, + Run: func(peer *p2p.Peer, rw p2p.MsgReadWriter) error { + return runEthProtocol(eth, peer, rw) + }, + } +} + +func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { + self := ðProtocol{ + eth: eth, + rw: rw, + peer: peer, + } + err = self.handleStatus() + if err == nil { + go func() { + for { + err = self.handle() + if err != nil { + break + } + } + }() + } + return +} + +func (self *ethProtocol) handle() error { + msg, err := self.rw.ReadMsg() + if err != nil { + return err + } + if msg.Size > ProtocolMaxMsgSize { + return ProtocolError(ErrMsgTooLarge, "%v > %v", msg.Size, ProtocolMaxMsgSize) + } + // make sure that the payload has been fully consumed + defer msg.Discard() + + switch msg.Code { + + case StatusMsg: + return ProtocolError(ErrExtraStatusMsg, "") + + case GetTxMsg: + txs := self.eth.GetTransactions() + // TODO: rewrite using rlp flat + txsInterface := make([]interface{}, len(txs)) + for i, tx := range txs { + txsInterface[i] = tx.RlpData() + } + return self.rw.EncodeMsg(TxMsg, txsInterface...) + + case TxMsg: + var txs []*types.Transaction + if err := msg.Decode(&txs); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + self.eth.AddTransactions(txs) + + case GetBlockHashesMsg: + var request getBlockHashesMsgData + if err := msg.Decode(&request); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + hashes := self.eth.GetBlockHashes(request.Hash, request.Amount) + return self.rw.EncodeMsg(BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...) + + case BlockHashesMsg: + // TODO: redo using lazy decode , this way very inefficient on known chains + // s := rlp.NewListStream(msg.Payload, uint64(msg.Size)) + var blockHashes [][]byte + if err := msg.Decode(&blockHashes); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + fetchMore := true + for _, hash := range blockHashes { + fetchMore = self.eth.AddHash(hash, self.peer) + if !fetchMore { + break + } + } + if fetchMore { + return self.FetchHashes(blockHashes[len(blockHashes)-1]) + } + + case GetBlocksMsg: + // Limit to max 300 blocks + var blockHashes [][]byte + if err := msg.Decode(&blockHashes); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + max := int(math.Min(float64(len(blockHashes)), 300.0)) + var blocks []interface{} + for i, hash := range blockHashes { + if i >= max { + break + } + block := self.eth.GetBlock(hash) + if block != nil { + blocks = append(blocks, block.Value().Raw()) + } + } + return self.rw.EncodeMsg(BlocksMsg, blocks...) + + case BlocksMsg: + var blocks []*types.Block + if err := msg.Decode(&blocks); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + for _, block := range blocks { + fetchHashes, err := self.eth.AddBlock(nil, block, self.peer) + if err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } + if fetchHashes { + if err := self.FetchHashes(block.Hash()); err != nil { + return err + } + } + } + + case NewBlockMsg: + var request newBlockMsgData + if err := msg.Decode(&request); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + var fetchHashes bool + // this should reset td and offer blockpool as candidate new peer? + if fetchHashes, err = self.eth.AddBlock(request.TD, request.Block, self.peer); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } + if fetchHashes { + return self.FetchHashes(request.Block.Hash()) + } + + default: + return ProtocolError(ErrInvalidMsgCode, "%v", msg.Code) + } + return nil +} + +type statusMsgData struct { + ProtocolVersion uint + NetworkId uint + TD *big.Int + CurrentBlock []byte + GenesisBlock []byte +} + +func (self *ethProtocol) statusMsg() p2p.Msg { + td, currentBlock, genesisBlock := self.eth.Status() + + return p2p.NewMsg(StatusMsg, + uint32(ProtocolVersion), + uint32(NetworkId), + td, + currentBlock, + genesisBlock, + ) +} + +func (self *ethProtocol) handleStatus() error { + // send precanned status message + if err := self.rw.WriteMsg(self.statusMsg()); err != nil { + return err + } + + // read and handle remote status + msg, err := self.rw.ReadMsg() + if err != nil { + return err + } + + if msg.Code != StatusMsg { + return ProtocolError(ErrNoStatusMsg, "first msg has code %x (!= %x)", msg.Code, StatusMsg) + } + + if msg.Size > ProtocolMaxMsgSize { + return ProtocolError(ErrMsgTooLarge, "%v > %v", msg.Size, ProtocolMaxMsgSize) + } + + var status statusMsgData + if err := msg.Decode(&status); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + + _, _, genesisBlock := self.eth.Status() + + if bytes.Compare(status.GenesisBlock, genesisBlock) != 0 { + return ProtocolError(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock, genesisBlock) + } + + if status.NetworkId != NetworkId { + return ProtocolError(ErrNetworkIdMismatch, "%d (!= %d)", status.NetworkId, NetworkId) + } + + if ProtocolVersion != status.ProtocolVersion { + return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) + } + + logger.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + + if self.eth.AddPeer(status.TD, status.CurrentBlock, self.peer) { + return self.FetchHashes(status.CurrentBlock) + } + + return nil +} + +func (self *ethProtocol) FetchHashes(from []byte) error { + logger.Debugf("Fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) + return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) +} diff --git a/eth/protocol_test.go b/eth/protocol_test.go new file mode 100644 index 000000000..757e87fa4 --- /dev/null +++ b/eth/protocol_test.go @@ -0,0 +1,133 @@ +package eth + +import ( + "io" + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/p2p" +) + +type testMsgReadWriter struct { + in chan p2p.Msg + out chan p2p.Msg +} + +func (self *testMsgReadWriter) In(msg p2p.Msg) { + self.in <- msg +} + +func (self *testMsgReadWriter) Out(msg p2p.Msg) { + self.in <- msg +} + +func (self *testMsgReadWriter) WriteMsg(msg p2p.Msg) error { + self.out <- msg + return nil +} + +func (self *testMsgReadWriter) EncodeMsg(code uint64, data ...interface{}) error { + return self.WriteMsg(p2p.NewMsg(code, data)) +} + +func (self *testMsgReadWriter) ReadMsg() (p2p.Msg, error) { + msg, ok := <-self.in + if !ok { + return msg, io.EOF + } + return msg, nil +} + +func errorCheck(t *testing.T, expCode int, err error) { + perr, ok := err.(*protocolError) + if ok && perr != nil { + if code := perr.Code; code != expCode { + ok = false + } + } + if !ok { + t.Errorf("expected error code %v, got %v", ErrNoStatusMsg, err) + } +} + +type TestBackend struct { + getTransactions func() []*types.Transaction + addTransactions func(txs []*types.Transaction) + getBlockHashes func(hash []byte, amount uint32) (hashes [][]byte) + addHash func(hash []byte, peer *p2p.Peer) (more bool) + getBlock func(hash []byte) *types.Block + addBlock func(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) + addPeer func(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + status func() (td *big.Int, currentBlock []byte, genesisBlock []byte) +} + +func (self *TestBackend) GetTransactions() (txs []*types.Transaction) { + if self.getTransactions != nil { + txs = self.getTransactions() + } + return +} + +func (self *TestBackend) AddTransactions(txs []*types.Transaction) { + if self.addTransactions != nil { + self.addTransactions(txs) + } +} + +func (self *TestBackend) GetBlockHashes(hash []byte, amount uint32) (hashes [][]byte) { + if self.getBlockHashes != nil { + hashes = self.getBlockHashes(hash, amount) + } + return +} + +func (self *TestBackend) AddHash(hash []byte, peer *p2p.Peer) (more bool) { + if self.addHash != nil { + more = self.addHash(hash, peer) + } + return +} +func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { + if self.getBlock != nil { + block = self.getBlock(hash) + } + return +} + +func (self *TestBackend) AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) { + if self.addBlock != nil { + fetchHashes, err = self.addBlock(td, block, peer) + } + return +} + +func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) { + if self.addPeer != nil { + fetchHashes = self.addPeer(td, currentBlock, peer) + } + return +} + +func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { + if self.status != nil { + td, currentBlock, genesisBlock = self.status() + } + return +} + +func TestEth(t *testing.T) { + quit := make(chan bool) + rw := &testMsgReadWriter{make(chan p2p.Msg, 10), make(chan p2p.Msg, 10)} + testBackend := &TestBackend{} + var err error + go func() { + err = runEthProtocol(testBackend, nil, rw) + close(quit) + }() + statusMsg := p2p.NewMsg(4) + rw.In(statusMsg) + <-quit + errorCheck(t, ErrNoStatusMsg, err) + // read(t, remote, []byte("hello, world"), nil) +} -- cgit v1.2.3 From eb5cb04aa991d59a6597479fbddf5dec51093ed6 Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 9 Dec 2014 23:54:02 +0000 Subject: no logging in error (to be refactored into p2p) --- eth/error.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/eth/error.go b/eth/error.go index cb4459435..9355d6457 100644 --- a/eth/error.go +++ b/eth/error.go @@ -2,7 +2,6 @@ package eth import ( "fmt" - // "github.com/ethereum/go-ethereum/logger" ) const ( @@ -45,11 +44,6 @@ func newProtocolError(code int, format string, params ...interface{}) *protocolE func ProtocolError(code int, format string, params ...interface{}) (err *protocolError) { err = newProtocolError(code, format, params...) // report(err) - if err.Fatal() { - logger.Errorln(err) - } else { - logger.Debugln(err) - } return } -- cgit v1.2.3 From d957dd2c9f5adefdedf702223de39634c1f4a32b Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 9 Dec 2014 23:55:50 +0000 Subject: eth protocol changes - changed backend interface - using callbacks for blockPool - use rlp stream for lazy decoding - use peer as logger - add id (peer pubkey) to ethProtocol fields - add testPeer to protocol test (temporary) --- eth/protocol.go | 136 ++++++++++++++++++++++++++++++--------------------- eth/protocol_test.go | 56 ++++++++++++++++----- 2 files changed, 122 insertions(+), 70 deletions(-) diff --git a/eth/protocol.go b/eth/protocol.go index 992fc7550..380bcc8d2 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -7,18 +7,16 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" - ethlogger "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/rlp" ) -var logger = ethlogger.NewLogger("SERV") - // ethProtocol represents the ethereum wire protocol // instance is running on each peer type ethProtocol struct { eth backend - td *big.Int peer *p2p.Peer + id string rw p2p.MsgReadWriter } @@ -26,28 +24,21 @@ type ethProtocol struct { // used as an argument to EthProtocol type backend interface { GetTransactions() (txs []*types.Transaction) - AddTransactions(txs []*types.Transaction) + AddTransactions([]*types.Transaction) GetBlockHashes(hash []byte, amount uint32) (hashes [][]byte) - AddHash(hash []byte, peer *p2p.Peer) (more bool) + AddBlockHashes(next func() ([]byte, bool), peerId string) GetBlock(hash []byte) (block *types.Block) - AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) - AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + AddBlock(block *types.Block, peerId string) (err error) + AddPeer(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) + RemovePeer(peerId string) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) } const ( - ProtocolVersion = 43 - // 0x00 // PoC-1 - // 0x01 // PoC-2 - // 0x07 // PoC-3 - // 0x09 // PoC-4 - // 0x17 // PoC-5 - // 0x1c // PoC-6 + ProtocolVersion = 43 NetworkId = 0 ProtocolLength = uint64(8) ProtocolMaxMsgSize = 10 * 1024 * 1024 - - blockHashesBatchSize = 256 ) // eth protocol message codes @@ -74,7 +65,8 @@ type getBlockHashesMsgData struct { } // main entrypoint, wrappers starting a server running the eth protocol -// use this constructor to attach the protocol (class) to server caps +// use this constructor to attach the protocol ("class") to server caps +// the Dev p2p layer then runs the protocol instance on each peer func EthProtocol(eth backend) *p2p.Protocol { return &p2p.Protocol{ Name: "eth", @@ -86,11 +78,14 @@ func EthProtocol(eth backend) *p2p.Protocol { } } +// the main loop that handles incoming messages +// note RemovePeer in the post-disconnect hook func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { self := ðProtocol{ eth: eth, rw: rw, peer: peer, + id: (string)(peer.Identity().Pubkey()), } err = self.handleStatus() if err == nil { @@ -98,6 +93,7 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro for { err = self.handle() if err != nil { + self.eth.RemovePeer(self.id) break } } @@ -132,6 +128,7 @@ func (self *ethProtocol) handle() error { return self.rw.EncodeMsg(TxMsg, txsInterface...) case TxMsg: + // TODO: rework using lazy RLP stream var txs []*types.Transaction if err := msg.Decode(&txs); err != nil { return ProtocolError(ErrDecode, "%v", err) @@ -148,29 +145,26 @@ func (self *ethProtocol) handle() error { case BlockHashesMsg: // TODO: redo using lazy decode , this way very inefficient on known chains - // s := rlp.NewListStream(msg.Payload, uint64(msg.Size)) - var blockHashes [][]byte - if err := msg.Decode(&blockHashes); err != nil { - return ProtocolError(ErrDecode, "%v", err) - } - fetchMore := true - for _, hash := range blockHashes { - fetchMore = self.eth.AddHash(hash, self.peer) - if !fetchMore { - break + msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) + var err error + iter := func() (hash []byte, ok bool) { + hash, err = msgStream.Bytes() + if err == nil { + ok = true } + return } - if fetchMore { - return self.FetchHashes(blockHashes[len(blockHashes)-1]) + self.eth.AddBlockHashes(iter, self.id) + if err != nil && err != rlp.EOL { + return ProtocolError(ErrDecode, "%v", err) } case GetBlocksMsg: - // Limit to max 300 blocks var blockHashes [][]byte if err := msg.Decode(&blockHashes); err != nil { return ProtocolError(ErrDecode, "%v", err) } - max := int(math.Min(float64(len(blockHashes)), 300.0)) + max := int(math.Min(float64(len(blockHashes)), blockHashesBatchSize)) var blocks []interface{} for i, hash := range blockHashes { if i >= max { @@ -184,20 +178,19 @@ func (self *ethProtocol) handle() error { return self.rw.EncodeMsg(BlocksMsg, blocks...) case BlocksMsg: - var blocks []*types.Block - if err := msg.Decode(&blocks); err != nil { - return ProtocolError(ErrDecode, "%v", err) - } - for _, block := range blocks { - fetchHashes, err := self.eth.AddBlock(nil, block, self.peer) - if err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } - if fetchHashes { - if err := self.FetchHashes(block.Hash()); err != nil { - return err + msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) + for { + var block *types.Block + if err := msgStream.Decode(&block); err != nil { + if err == rlp.EOL { + break + } else { + return ProtocolError(ErrDecode, "%v", err) } } + if err := self.eth.AddBlock(block, self.id); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } } case NewBlockMsg: @@ -205,13 +198,24 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } - var fetchHashes bool - // this should reset td and offer blockpool as candidate new peer? - if fetchHashes, err = self.eth.AddBlock(request.TD, request.Block, self.peer); err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } - if fetchHashes { - return self.FetchHashes(request.Block.Hash()) + hash := request.Block.Hash() + // to simplify backend interface adding a new block + // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer + // (or selected as new best peer) + if self.eth.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) { + called := true + iter := func() (hash []byte, ok bool) { + if called { + called = false + return hash, true + } else { + return + } + } + self.eth.AddBlockHashes(iter, self.id) + if err := self.eth.AddBlock(request.Block, self.id); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } } default: @@ -279,16 +283,34 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) } - logger.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) - if self.eth.AddPeer(status.TD, status.CurrentBlock, self.peer) { - return self.FetchHashes(status.CurrentBlock) - } + self.eth.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) return nil } -func (self *ethProtocol) FetchHashes(from []byte) error { - logger.Debugf("Fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) +func (self *ethProtocol) requestBlockHashes(from []byte) error { + self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) } + +func (self *ethProtocol) requestBlocks(hashes [][]byte) error { + self.peer.Debugf("fetching %v blocks", len(hashes)) + return self.rw.EncodeMsg(GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)) +} + +func (self *ethProtocol) invalidBlock(err error) { + ProtocolError(ErrInvalidBlock, "%v", err) + self.peer.Disconnect(p2p.DiscSubprotocolError) +} + +func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *protocolError) { + err = ProtocolError(code, format, params...) + if err.Fatal() { + self.peer.Errorln(err) + } else { + self.peer.Debugln(err) + } + return +} diff --git a/eth/protocol_test.go b/eth/protocol_test.go index 757e87fa4..a166ea6cd 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p" ) @@ -55,10 +56,11 @@ type TestBackend struct { getTransactions func() []*types.Transaction addTransactions func(txs []*types.Transaction) getBlockHashes func(hash []byte, amount uint32) (hashes [][]byte) - addHash func(hash []byte, peer *p2p.Peer) (more bool) + addBlockHashes func(next func() ([]byte, bool), peerId string) getBlock func(hash []byte) *types.Block - addBlock func(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) - addPeer func(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) + addBlock func(block *types.Block, peerId string) (err error) + addPeer func(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) + removePeer func(peerId string) status func() (td *big.Int, currentBlock []byte, genesisBlock []byte) } @@ -82,12 +84,12 @@ func (self *TestBackend) GetBlockHashes(hash []byte, amount uint32) (hashes [][] return } -func (self *TestBackend) AddHash(hash []byte, peer *p2p.Peer) (more bool) { - if self.addHash != nil { - more = self.addHash(hash, peer) +func (self *TestBackend) AddBlockHashes(next func() ([]byte, bool), peerId string) { + if self.addBlockHashes != nil { + self.addBlockHashes(next, peerId) } - return } + func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { if self.getBlock != nil { block = self.getBlock(hash) @@ -95,20 +97,26 @@ func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { return } -func (self *TestBackend) AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) { +func (self *TestBackend) AddBlock(block *types.Block, peerId string) (err error) { if self.addBlock != nil { - fetchHashes, err = self.addBlock(td, block, peer) + err = self.addBlock(block, peerId) } return } -func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) { +func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) { if self.addPeer != nil { - fetchHashes = self.addPeer(td, currentBlock, peer) + best = self.addPeer(td, currentBlock, peerId, requestBlockHashes, requestBlocks, invalidBlock) } return } +func (self *TestBackend) RemovePeer(peerId string) { + if self.removePeer != nil { + self.removePeer(peerId) + } +} + func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { if self.status != nil { td, currentBlock, genesisBlock = self.status() @@ -116,13 +124,35 @@ func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBloc return } -func TestEth(t *testing.T) { +// TODO: refactor this into p2p/client_identity +type peerId struct { + pubkey []byte +} + +func (self *peerId) String() string { + return "test peer" +} + +func (self *peerId) Pubkey() (pubkey []byte) { + pubkey = self.pubkey + if len(pubkey) == 0 { + pubkey = crypto.GenerateNewKeyPair().PublicKey + self.pubkey = pubkey + } + return +} + +func testPeer() *p2p.Peer { + return p2p.NewPeer(&peerId{}, []p2p.Cap{}) +} + +func TestErrNoStatusMsg(t *testing.T) { quit := make(chan bool) rw := &testMsgReadWriter{make(chan p2p.Msg, 10), make(chan p2p.Msg, 10)} testBackend := &TestBackend{} var err error go func() { - err = runEthProtocol(testBackend, nil, rw) + err = runEthProtocol(testBackend, testPeer(), rw) close(quit) }() statusMsg := p2p.NewMsg(4) -- cgit v1.2.3 From 4366fdfc13d68357c1f94cd3355ef50e35980920 Mon Sep 17 00:00:00 2001 From: zelig Date: Wed, 10 Dec 2014 04:12:25 +0000 Subject: initial commit for eth blockpool + test --- eth/block_pool.go | 514 +++++++++++++++++++++++++++++++++++++++++++++++++ eth/block_pool_test.go | 198 +++++++++++++++++++ 2 files changed, 712 insertions(+) create mode 100644 eth/block_pool.go create mode 100644 eth/block_pool_test.go diff --git a/eth/block_pool.go b/eth/block_pool.go new file mode 100644 index 000000000..2c5ebb1e3 --- /dev/null +++ b/eth/block_pool.go @@ -0,0 +1,514 @@ +package eth + +import ( + "bytes" + "fmt" + "math" + "math/big" + "sync" + "time" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/event" + ethlogger "github.com/ethereum/go-ethereum/logger" +) + +var poolLogger = ethlogger.NewLogger("Blockpool") + +const ( + blockHashesBatchSize = 256 + blockBatchSize = 64 + blockRequestInterval = 10 // seconds + blockRequestRepetition = 1 + cacheTimeout = 3 // minutes + blockTimeout = 5 // minutes +) + +type poolNode struct { + hash []byte + block *types.Block + child *poolNode + parent *poolNode + root *nodePointer + knownParent bool + suicide chan bool + peer string + source string + blockRequestRoot bool + blockRequestControl *bool + blockRequestQuit *(chan bool) +} + +// the minimal interface for chain manager +type chainManager interface { + KnownBlock(hash []byte) bool + AddBlock(*types.Block) error + CheckPoW(*types.Block) bool +} + +type BlockPool struct { + chainManager chainManager + eventer event.TypeMux + + // pool Pool + lock sync.Mutex + pool map[string]*poolNode + + peersLock sync.Mutex + peers map[string]*peerInfo + peer *peerInfo + + quit chan bool + wg sync.WaitGroup + running bool +} + +type peerInfo struct { + td *big.Int + currentBlock []byte + id string + requestBlockHashes func([]byte) error + requestBlocks func([][]byte) error + invalidBlock func(error) +} + +type nodePointer struct { + hash []byte +} + +type peerChangeEvent struct { + *peerInfo +} + +func NewBlockPool(chMgr chainManager) *BlockPool { + return &BlockPool{ + chainManager: chMgr, + pool: make(map[string]*poolNode), + peers: make(map[string]*peerInfo), + quit: make(chan bool), + running: true, + } +} + +func (self *BlockPool) Stop() { + self.lock.Lock() + if !self.running { + self.lock.Unlock() + return + } + self.running = false + self.lock.Unlock() + + poolLogger.Infoln("Stopping") + + close(self.quit) + self.wg.Wait() + poolLogger.Infoln("Stopped") + +} + +// Entry point for eth protocol to add block hashes received via BlockHashesMsg +// only hashes from the best peer is handled +// this method is always responsible to initiate further hash requests until +// a known parent is reached unless cancelled by a peerChange event +func (self *BlockPool) AddBlockHashes(next func() ([]byte, bool), peerId string) { + // subscribe to peerChangeEvent before we check for best peer + peerChange := self.eventer.Subscribe(peerChangeEvent{}) + defer peerChange.Unsubscribe() + // check if this peer is the best + peer, best := self.getPeer(peerId) + if !best { + return + } + root := &nodePointer{} + // peer is still the best + hashes := make(chan []byte) + var lastPoolNode *poolNode + + // using a for select loop so that peer change (new best peer) can abort the parallel thread that processes hashes of the earlier best peer + for { + hash, ok := next() + if ok { + hashes <- hash + } else { + break + } + select { + case <-self.quit: + return + case <-peerChange.Chan(): + // remember where we left off with this peer + if lastPoolNode != nil { + root.hash = lastPoolNode.hash + go self.killChain(lastPoolNode) + } + case hash := <-hashes: + self.lock.Lock() + defer self.lock.Unlock() + // check if known block connecting the downloaded chain to our blockchain + if self.chainManager.KnownBlock(hash) { + poolLogger.Infof("known block (%x...)\n", hash[0:4]) + if lastPoolNode != nil { + lastPoolNode.knownParent = true + go self.requestBlocksLoop(lastPoolNode) + } else { + // all hashes known if topmost one is in blockchain + } + return + } + // + var currentPoolNode *poolNode + // check if lastPoolNode has the correct parent node (hash matching), + // then just assign to currentPoolNode + if lastPoolNode != nil && lastPoolNode.parent != nil && bytes.Compare(lastPoolNode.parent.hash, hash) == 0 { + currentPoolNode = lastPoolNode.parent + } else { + // otherwise look up in pool + currentPoolNode = self.pool[string(hash)] + // if node does not exist, create it and index in the pool + if currentPoolNode == nil { + currentPoolNode = &poolNode{ + hash: hash, + } + self.pool[string(hash)] = currentPoolNode + } + } + // set up parent-child nodes (doubly linked list) + self.link(currentPoolNode, lastPoolNode) + // ! we trust the node iff + // (1) node marked as by the same peer or + // (2) it has a PoW valid block retrieved + if currentPoolNode.peer == peer.id || currentPoolNode.block != nil { + // the trusted checkpoint from which we request hashes down to known head + lastPoolNode = self.pool[string(currentPoolNode.root.hash)] + break + } + currentPoolNode.peer = peer.id + currentPoolNode.root = root + lastPoolNode = currentPoolNode + } + } + // lastPoolNode is nil if and only if the node with stored root hash is already cleaned up + // after valid block insertion, therefore in this case the blockpool active chain is connected to the blockchain, so no need to request further hashes or request blocks + if lastPoolNode != nil { + root.hash = lastPoolNode.hash + peer.requestBlockHashes(lastPoolNode.hash) + go self.requestBlocksLoop(lastPoolNode) + } + return +} + +func (self *BlockPool) requestBlocksLoop(node *poolNode) { + suicide := time.After(blockTimeout * time.Minute) + requestTimer := time.After(0) + var controlChan chan bool + closedChan := make(chan bool) + quit := make(chan bool) + close(closedChan) + requestBlocks := true + origNode := node + self.lock.Lock() + node.blockRequestRoot = true + b := false + control := &b + node.blockRequestControl = control + node.blockRequestQuit = &quit + self.lock.Unlock() + blocks := 0 + self.wg.Add(1) +loop: + for { + if requestBlocks { + controlChan = closedChan + } else { + self.lock.Lock() + if *node.blockRequestControl { + controlChan = closedChan + *node.blockRequestControl = false + } + self.lock.Unlock() + } + select { + case <-quit: + break loop + case <-suicide: + go self.killChain(origNode) + break loop + + case <-requestTimer: + requestBlocks = true + + case <-controlChan: + controlChan = nil + // this iteration takes care of requesting blocks only starting from the first node with a missing block (moving target), + // max up to the next checkpoint (n.blockRequestRoot true) + nodes := []*poolNode{} + n := node + next := node + self.lock.Lock() + for n != nil && (n == node || !n.blockRequestRoot) && (requestBlocks || n.block != nil) { + if n.block != nil { + if len(nodes) == 0 { + // nil control indicates that node is not needed anymore + // block can be inserted to blockchain and deleted if knownParent + n.blockRequestControl = nil + blocks++ + next = next.child + } else { + // this is needed to indicate that when a new chain forks from an existing one + // triggering a reorg will ? renew the blockTimeout period ??? + // if there is a block but control == nil should start fetching blocks, see link function + n.blockRequestControl = control + } + } else { + nodes = append(nodes, n) + n.blockRequestControl = control + } + n = n.child + } + // if node is connected to the blockchain, we can immediately start inserting + // blocks to the blockchain and delete nodes + if node.knownParent { + go self.insertChainFrom(node) + } + if next.blockRequestRoot && next != node { + // no more missing blocks till the checkpoint, quitting + poolLogger.Debugf("fetched %v blocks on active chain, batch %v-%v", blocks, origNode, n) + break loop + } + self.lock.Unlock() + + // reset starting node to the first descendant node with missing block + node = next + if !requestBlocks { + continue + } + go self.requestBlocks(nodes) + requestTimer = time.After(blockRequestInterval * time.Second) + } + } + self.wg.Done() + return +} + +func (self *BlockPool) requestBlocks(nodes []*poolNode) { + // distribute block request among known peers + self.peersLock.Lock() + peerCount := len(self.peers) + poolLogger.Debugf("requesting %v missing blocks from %v peers", len(nodes), peerCount) + blockHashes := make([][][]byte, peerCount) + repetitions := int(math.Max(float64(peerCount)/2.0, float64(blockRequestRepetition))) + for n, node := range nodes { + for i := 0; i < repetitions; i++ { + blockHashes[n%peerCount] = append(blockHashes[n%peerCount], node.hash) + n++ + } + } + i := 0 + for _, peer := range self.peers { + peer.requestBlocks(blockHashes[i]) + i++ + } + self.peersLock.Unlock() +} + +func (self *BlockPool) insertChainFrom(node *poolNode) { + self.lock.Lock() + defer self.lock.Unlock() + for node != nil && node.blockRequestControl == nil { + err := self.chainManager.AddBlock(node.block) + if err != nil { + poolLogger.Debugf("invalid block %v", node.hash) + poolLogger.Debugf("penalise peers %v (hash), %v (block)", node.peer, node.source) + // penalise peer in node.source + go self.killChain(node) + return + } + poolLogger.Debugf("insert block %v into blockchain", node.hash) + node = node.child + } + // if block insertion succeeds, mark the child as knownParent + // trigger request blocks reorg + if node != nil { + node.knownParent = true + *(node.blockRequestControl) = true + } +} + +// AddPeer is called by the eth protocol instance running on the peer after +// the status message has been received with total difficulty and current block hash +// AddPeer can only be used once, RemovePeer needs to be called when the peer disconnects +func (self *BlockPool) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) bool { + self.peersLock.Lock() + defer self.peersLock.Unlock() + if self.peers[peerId] != nil { + panic("peer already added") + } + info := &peerInfo{ + td: td, + currentBlock: currentBlock, + id: peerId, //peer.Identity().Pubkey() + requestBlockHashes: requestBlockHashes, + requestBlocks: requestBlocks, + invalidBlock: invalidBlock, + } + self.peers[peerId] = info + poolLogger.Debugf("add new peer %v with td %v", peerId, td) + currentTD := ethutil.Big0 + if self.peer != nil { + currentTD = self.peer.td + } + if td.Cmp(currentTD) > 0 { + self.peer = info + self.eventer.Post(peerChangeEvent{info}) + poolLogger.Debugf("peer %v promoted to best peer", peerId) + requestBlockHashes(currentBlock) + return true + } + return false +} + +// RemovePeer is called by the eth protocol when the peer disconnects +func (self *BlockPool) RemovePeer(peerId string) { + self.peersLock.Lock() + defer self.peersLock.Unlock() + if self.peers[peerId] != nil { + panic("peer already removed") + } + self.peers[peerId] = nil + poolLogger.Debugf("remove peer %v", peerId[0:4]) + + // if current best peer is removed, need find a better one + if peerId == self.peer.id { + var newPeer *peerInfo + max := ethutil.Big0 + // peer with the highest self-acclaimed TD is chosen + for _, info := range self.peers { + if info.td.Cmp(max) > 0 { + max = info.td + newPeer = info + } + } + self.peer = newPeer + self.eventer.Post(peerChangeEvent{newPeer}) + if newPeer != nil { + poolLogger.Debugf("peer %v with td %v spromoted to best peer", newPeer.id[0:4], newPeer.td) + newPeer.requestBlockHashes(newPeer.currentBlock) + } else { + poolLogger.Warnln("no peers left") + } + } +} + +func (self *BlockPool) getPeer(peerId string) (*peerInfo, bool) { + self.peersLock.Lock() + defer self.peersLock.Unlock() + if self.peer.id == peerId { + return self.peer, true + } + info, ok := self.peers[peerId] + if !ok { + panic("unknown peer") + } + return info, false +} + +// if same peer gave different chain before, this will overwrite it +// if currentPoolNode existed as a non-leaf node the earlier fork is delinked +// if same parent hash is found, we can abort, we do not allow the same peer to change minds about parent of same hash, if errored first time round, will get penalized. +// if lastPoolNode had a different parent the earlier parent (with entire subtree) is delinked, this situation cannot normally arise though +// just in case reset lastPoolNode as non-root (unlikely) + +func (self *BlockPool) link(parent, child *poolNode) { + // reactivate node scheduled for suicide + if parent.suicide != nil { + close(parent.suicide) + parent.suicide = nil + } + if parent.child != child { + orphan := parent.child + orphan.parent = nil + go self.killChain(orphan) + parent.child = child + } + if child != nil { + if child.parent != parent { + orphan := child.parent + orphan.child = nil + go func() { + // if it is a aberrant reverse fork, zip down to bottom + for orphan.parent != nil { + orphan = orphan.parent + } + self.killChain(orphan) + }() + child.parent = parent + } + child.knownParent = false + } +} + +func (self *BlockPool) killChain(node *poolNode) { + if node == nil { + return + } + poolLogger.Debugf("suicide scheduled on node %v", node) + suicide := make(chan bool) + self.lock.Lock() + node.suicide = suicide + self.lock.Unlock() + timer := time.After(cacheTimeout * time.Minute) + self.wg.Add(1) + select { + case <-self.quit: + case <-suicide: + // cancel suicide = close node.suicide to reactivate node + case <-timer: + poolLogger.Debugf("suicide on node %v", node) + self.lock.Lock() + defer self.lock.Unlock() + // proceed up via child links until another suicide root found or chain ends + // abort request blocks loops that start above + // and delete nodes from pool then quit the suicide process + okToAbort := node.blockRequestRoot + for node != nil && (node.suicide == suicide || node.suicide == nil) { + self.pool[string(node.hash)] = nil + if okToAbort && node.blockRequestQuit != nil { + quit := *(node.blockRequestQuit) + if quit != nil { // not yet closed + *(node.blockRequestQuit) = nil + close(quit) + } + } else { + okToAbort = true + } + node = node.child + } + } + self.wg.Done() +} + +// AddBlock is the entry point for the eth protocol when blockmsg is received upon requests +// It has a strict interpretation of the protocol in that if the block received has not been requested, it results in an error (which can be ignored) +// block is checked for PoW +// only the first PoW-valid block for a hash is considered legit +func (self *BlockPool) AddBlock(block *types.Block, peerId string) (err error) { + hash := block.Hash() + self.lock.Lock() + defer self.lock.Unlock() + node, ok := self.pool[string(hash)] + if !ok && !self.chainManager.KnownBlock(hash) { + return fmt.Errorf("unrequested block %x", hash) + } + if node.block != nil { + return + } + // validate block for PoW + if !self.chainManager.CheckPoW(block) { + return fmt.Errorf("invalid pow on block %x", hash) + } + node.block = block + node.source = peerId + return nil +} diff --git a/eth/block_pool_test.go b/eth/block_pool_test.go new file mode 100644 index 000000000..315cc748d --- /dev/null +++ b/eth/block_pool_test.go @@ -0,0 +1,198 @@ +package eth + +import ( + "bytes" + "fmt" + "log" + "os" + "sync" + "testing" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethutil" + ethlogger "github.com/ethereum/go-ethereum/logger" +) + +var sys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel)) + +type testChainManager struct { + knownBlock func(hash []byte) bool + addBlock func(*types.Block) error + checkPoW func(*types.Block) bool +} + +func (self *testChainManager) KnownBlock(hash []byte) bool { + if self.knownBlock != nil { + return self.knownBlock(hash) + } + return false +} + +func (self *testChainManager) AddBlock(block *types.Block) error { + if self.addBlock != nil { + return self.addBlock(block) + } + return nil +} + +func (self *testChainManager) CheckPoW(block *types.Block) bool { + if self.checkPoW != nil { + return self.checkPoW(block) + } + return false +} + +func knownBlock(hashes ...[]byte) (f func([]byte) bool) { + f = func(block []byte) bool { + for _, hash := range hashes { + if bytes.Compare(block, hash) == 0 { + return true + } + } + return false + } + return +} + +func addBlock(hashes ...[]byte) (f func(*types.Block) error) { + f = func(block *types.Block) error { + for _, hash := range hashes { + if bytes.Compare(block.Hash(), hash) == 0 { + return fmt.Errorf("invalid by test") + } + } + return nil + } + return +} + +func checkPoW(hashes ...[]byte) (f func(*types.Block) bool) { + f = func(block *types.Block) bool { + for _, hash := range hashes { + if bytes.Compare(block.Hash(), hash) == 0 { + return false + } + } + return true + } + return +} + +func newTestChainManager(knownBlocks [][]byte, invalidBlocks [][]byte, invalidPoW [][]byte) *testChainManager { + return &testChainManager{ + knownBlock: knownBlock(knownBlocks...), + addBlock: addBlock(invalidBlocks...), + checkPoW: checkPoW(invalidPoW...), + } +} + +type intToHash map[int][]byte + +type hashToInt map[string]int + +type testHashPool struct { + intToHash + hashToInt +} + +func newHash(i int) []byte { + return crypto.Sha3([]byte(string(i))) +} + +func newTestBlockPool(knownBlockIndexes []int, invalidBlockIndexes []int, invalidPoWIndexes []int) (hashPool *testHashPool, blockPool *BlockPool) { + hashPool = &testHashPool{make(intToHash), make(hashToInt)} + knownBlocks := hashPool.indexesToHashes(knownBlockIndexes) + invalidBlocks := hashPool.indexesToHashes(invalidBlockIndexes) + invalidPoW := hashPool.indexesToHashes(invalidPoWIndexes) + blockPool = NewBlockPool(newTestChainManager(knownBlocks, invalidBlocks, invalidPoW)) + return +} + +func (self *testHashPool) indexesToHashes(indexes []int) (hashes [][]byte) { + for _, i := range indexes { + hash, found := self.intToHash[i] + if !found { + hash = newHash(i) + self.intToHash[i] = hash + self.hashToInt[string(hash)] = i + } + hashes = append(hashes, hash) + } + return +} + +func (self *testHashPool) hashesToIndexes(hashes [][]byte) (indexes []int) { + for _, hash := range hashes { + i, found := self.hashToInt[string(hash)] + if !found { + i = -1 + } + indexes = append(indexes, i) + } + return +} + +type protocolChecker struct { + blockHashesRequests []int + blocksRequests [][]int + invalidBlocks []error + hashPool *testHashPool + lock sync.Mutex +} + +// -1 is special: not found (a hash never seen) +func (self *protocolChecker) requestBlockHashesCallBack() (requestBlockHashesCallBack func([]byte) error) { + requestBlockHashesCallBack = func(hash []byte) error { + indexes := self.hashPool.hashesToIndexes([][]byte{hash}) + self.lock.Lock() + defer self.lock.Unlock() + self.blockHashesRequests = append(self.blockHashesRequests, indexes[0]) + return nil + } + return +} + +func (self *protocolChecker) requestBlocksCallBack() (requestBlocksCallBack func([][]byte) error) { + requestBlocksCallBack = func(hashes [][]byte) error { + indexes := self.hashPool.hashesToIndexes(hashes) + self.lock.Lock() + defer self.lock.Unlock() + self.blocksRequests = append(self.blocksRequests, indexes) + return nil + } + return +} + +func (self *protocolChecker) invalidBlockCallBack() (invalidBlockCallBack func(error)) { + invalidBlockCallBack = func(err error) { + self.invalidBlocks = append(self.invalidBlocks, err) + } + return +} + +func TestAddPeer(t *testing.T) { + ethlogger.AddLogSystem(sys) + knownBlockIndexes := []int{0, 1} + invalidBlockIndexes := []int{2, 3} + invalidPoWIndexes := []int{4, 5} + hashPool, blockPool := newTestBlockPool(knownBlockIndexes, invalidBlockIndexes, invalidPoWIndexes) + // TODO: + // hashPool, blockPool, blockChainChecker = newTestBlockPool(knownBlockIndexes, invalidBlockIndexes, invalidPoWIndexes) + peer0 := &protocolChecker{ + // blockHashesRequests: make([]int), + // blocksRequests: make([][]int), + // invalidBlocks: make([]error), + hashPool: hashPool, + } + best := blockPool.AddPeer(ethutil.Big1, newHash(100), "0", + peer0.requestBlockHashesCallBack(), + peer0.requestBlocksCallBack(), + peer0.invalidBlockCallBack(), + ) + if !best { + t.Errorf("peer not accepted as best") + } + blockPool.Stop() + +} -- cgit v1.2.3 From 02017ed0e019ea2692c1e184873d09f41551a0ec Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:03:24 +0000 Subject: initial commit for new backend (eth.Ethereum) --- eth/backend.go | 357 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 357 insertions(+) create mode 100644 eth/backend.go diff --git a/eth/backend.go b/eth/backend.go new file mode 100644 index 000000000..9154ca0f5 --- /dev/null +++ b/eth/backend.go @@ -0,0 +1,357 @@ +package eth + +import ( + "encoding/json" + "net" + "path" + "sync" + + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/event" + ethlogger "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/state" +) + +const ( + seedNodeAddress = "poc-7.ethdev.com:30300" +) + +var logger = ethlogger.NewLogger("SERV") + +type Ethereum struct { + // Channel for shutting down the ethereum + shutdownChan chan bool + quit chan bool + + // DB interface + db ethutil.Database + // State manager for processing new blocks and managing the over all states + blockManager *core.BlockManager + + // The transaction pool. Transaction can be pushed on this pool + // for later including in the blocks + txPool *core.TxPool + // The canonical chain + chainManager *core.ChainManager + // The block pool + blockPool *BlockPool + // Event + eventMux *event.TypeMux + + // Nonce + Nonce uint64 + + ListenAddr string + + blacklist p2p.Blacklist + server *p2p.Server + txSub event.Subscription + blockSub event.Subscription + + // Capabilities for outgoing peers + // serverCaps Caps + peersFile string + + Mining bool + + RpcServer *rpc.JsonRpcServer + + keyManager *crypto.KeyManager + + clientIdentity p2p.ClientIdentity + + synclock sync.Mutex + syncGroup sync.WaitGroup + + filterMu sync.RWMutex + filterId int + filters map[int]*core.Filter +} + +func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.KeyManager, nat p2p.NAT, port string, maxPeers int) (*Ethereum, error) { + + saveProtocolVersion(db) + ethutil.Config.Db = db + + // FIXME: + blacklist := p2p.NewBlacklist() + // Sorry Py person. I must blacklist. you perform badly + blacklist.Put(ethutil.Hex2Bytes("64656330303561383532336435376331616537643864663236623336313863373537353163636634333530626263396330346237336262623931383064393031")) + + peersFile := path.Join(ethutil.Config.ExecPath, "known_peers.json") + + nonce, _ := ethutil.RandomUint64() + + listenAddr := ":" + port + + eth := &Ethereum{ + shutdownChan: make(chan bool), + quit: make(chan bool), + db: db, + Nonce: nonce, + // serverCaps: caps, + peersFile: peersFile, + ListenAddr: listenAddr, + keyManager: keyManager, + clientIdentity: identity, + blacklist: blacklist, + eventMux: &event.TypeMux{}, + filters: make(map[int]*core.Filter), + } + + eth.txPool = core.NewTxPool(eth) + eth.chainManager = core.NewChainManager(eth.EventMux()) + eth.blockManager = core.NewBlockManager(eth) + eth.chainManager.SetProcessor(eth.blockManager) + + hasBlock := eth.chainManager.HasBlock + insertChain := eth.chainManager.InsertChain + // pow := ezp.New() + // verifyPoW := pow.Verify + verifyPoW := func(*types.Block) bool { return true } + eth.blockPool = NewBlockPool(hasBlock, insertChain, verifyPoW) + + // Start the tx pool + eth.txPool.Start() + + ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool) + protocols := []p2p.Protocol{ethProto} + + server := &p2p.Server{ + Identity: identity, + MaxPeers: maxPeers, + Protocols: protocols, + ListenAddr: listenAddr, + Blacklist: blacklist, + NAT: nat, + } + + eth.server = server + + return eth, nil +} + +func (s *Ethereum) KeyManager() *crypto.KeyManager { + return s.keyManager +} + +func (s *Ethereum) ClientIdentity() p2p.ClientIdentity { + return s.clientIdentity +} + +func (s *Ethereum) ChainManager() *core.ChainManager { + return s.chainManager +} + +func (s *Ethereum) BlockManager() *core.BlockManager { + return s.blockManager +} + +func (s *Ethereum) TxPool() *core.TxPool { + return s.txPool +} + +func (s *Ethereum) BlockPool() *BlockPool { + return s.blockPool +} + +func (s *Ethereum) EventMux() *event.TypeMux { + return s.eventMux +} +func (self *Ethereum) Db() ethutil.Database { + return self.db +} + +func (s *Ethereum) IsMining() bool { + return s.Mining +} + +func (s *Ethereum) IsListening() bool { + if s.ListenAddr == "" { + return false + } else { + return true + } +} + +func (s *Ethereum) PeerCount() int { + return s.server.PeerCount() +} + +func (s *Ethereum) Peers() []*p2p.Peer { + return s.server.Peers() +} + +// Start the ethereum +func (s *Ethereum) Start(seed bool) error { + err := s.server.Start() + if err != nil { + return err + } + s.blockPool.Start() + s.blockManager.Start() + + go s.filterLoop() + + // broadcast transactions + s.txSub = s.eventMux.Subscribe(core.TxPreEvent{}) + go s.txBroadcastLoop() + + // broadcast mined blocks + s.blockSub = s.eventMux.Subscribe(core.NewMinedBlockEvent{}) + go s.blockBroadcastLoop() + + // TODO: read peers here + if seed { + logger.Infof("Connect to seed node %v", seedNodeAddress) + if err := s.SuggestPeer(seedNodeAddress); err != nil { + return err + } + } + + logger.Infoln("Server started") + return nil +} + +func (self *Ethereum) SuggestPeer(addr string) error { + netaddr, err := net.ResolveTCPAddr("tcp", addr) + if err != nil { + logger.Errorf("couldn't resolve %s:", addr, err) + return err + } + + self.server.SuggestPeer(netaddr.IP, netaddr.Port, nil) + return nil +} + +func (s *Ethereum) Stop() { + // Close the database + defer s.db.Close() + + // + // WritePeers(s.peersFile, s.server.PeerAddresses()) + close(s.quit) + + s.txSub.Unsubscribe() // quits txBroadcastLoop + s.blockSub.Unsubscribe() // quits blockBroadcastLoop + + if s.RpcServer != nil { + s.RpcServer.Stop() + } + s.txPool.Stop() + s.blockManager.Stop() + s.eventMux.Stop() + s.blockPool.Stop() + + logger.Infoln("Server stopped") + close(s.shutdownChan) +} + +// This function will wait for a shutdown and resumes main thread execution +func (s *Ethereum) WaitForShutdown() { + <-s.shutdownChan +} + +func WritePeers(path string, addresses []string) { + if len(addresses) > 0 { + data, _ := json.MarshalIndent(addresses, "", " ") + ethutil.WriteFile(path, data) + } +} + +func ReadPeers(path string) (ips []string, err error) { + var data string + data, err = ethutil.ReadAllFile(path) + if err != nil { + json.Unmarshal([]byte(data), &ips) + } + return +} + +// now tx broadcasting is taken out of txPool +// handled here via subscription, efficiency? +func (self *Ethereum) txBroadcastLoop() { + // automatically stops if unsubscribe + for obj := range self.txSub.Chan() { + event := obj.(core.TxPreEvent) + self.server.Broadcast("eth", TxMsg, []interface{}{event.Tx.RlpData()}) + } +} + +func (self *Ethereum) blockBroadcastLoop() { + // automatically stops if unsubscribe + for obj := range self.txSub.Chan() { + event := obj.(core.NewMinedBlockEvent) + self.server.Broadcast("eth", NewBlockMsg, event.Block.Value().Val) + } +} + +func saveProtocolVersion(db ethutil.Database) { + d, _ := db.Get([]byte("ProtocolVersion")) + protocolVersion := ethutil.NewValue(d).Uint() + + if protocolVersion == 0 { + db.Put([]byte("ProtocolVersion"), ethutil.NewValue(ProtocolVersion).Bytes()) + } +} + +// InstallFilter adds filter for blockchain events. +// The filter's callbacks will run for matching blocks and messages. +// The filter should not be modified after it has been installed. +func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { + self.filterMu.Lock() + id = self.filterId + self.filters[id] = filter + self.filterId++ + self.filterMu.Unlock() + return id +} + +func (self *Ethereum) UninstallFilter(id int) { + self.filterMu.Lock() + delete(self.filters, id) + self.filterMu.Unlock() +} + +// GetFilter retrieves a filter installed using InstallFilter. +// The filter may not be modified. +func (self *Ethereum) GetFilter(id int) *core.Filter { + self.filterMu.RLock() + defer self.filterMu.RUnlock() + return self.filters[id] +} + +func (self *Ethereum) filterLoop() { + // Subscribe to events + events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Messages(nil)) + for event := range events.Chan() { + switch event.(type) { + case core.NewBlockEvent: + self.filterMu.RLock() + for _, filter := range self.filters { + if filter.BlockCallback != nil { + e := event.(core.NewBlockEvent) + filter.BlockCallback(e.Block) + } + } + self.filterMu.RUnlock() + case state.Messages: + self.filterMu.RLock() + for _, filter := range self.filters { + if filter.MessageCallback != nil { + e := event.(state.Messages) + msgs := filter.FilterMessages(e) + if len(msgs) > 0 { + filter.MessageCallback(msgs) + } + } + } + self.filterMu.RUnlock() + } + } +} -- cgit v1.2.3 From c44e02589877722af7ef61738ff7ec05a7a14279 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:04:50 +0000 Subject: protocol - new interface explicit backend components txPool, chainManager, blockPool - added protoErrorDisconnect for blockpool callback (FIXME: handling peer disconnects) --- eth/protocol.go | 102 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/eth/protocol.go b/eth/protocol.go index 380bcc8d2..3b5b49696 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -14,26 +14,33 @@ import ( // ethProtocol represents the ethereum wire protocol // instance is running on each peer type ethProtocol struct { - eth backend - peer *p2p.Peer - id string - rw p2p.MsgReadWriter + txPool txPool + chainManager chainManager + blockPool blockPool + peer *p2p.Peer + id string + rw p2p.MsgReadWriter } // backend is the interface the ethereum protocol backend should implement // used as an argument to EthProtocol -type backend interface { - GetTransactions() (txs []*types.Transaction) +type txPool interface { AddTransactions([]*types.Transaction) - GetBlockHashes(hash []byte, amount uint32) (hashes [][]byte) - AddBlockHashes(next func() ([]byte, bool), peerId string) +} + +type chainManager interface { + GetBlockHashesFromHash(hash []byte, amount uint64) (hashes [][]byte) GetBlock(hash []byte) (block *types.Block) - AddBlock(block *types.Block, peerId string) (err error) - AddPeer(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) - RemovePeer(peerId string) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) } +type blockPool interface { + AddBlockHashes(next func() ([]byte, bool), peerId string) + AddBlock(block *types.Block, peerId string) + AddPeer(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, peerError func(int, string, ...interface{})) (best bool) + RemovePeer(peerId string) +} + const ( ProtocolVersion = 43 NetworkId = 0 @@ -61,31 +68,33 @@ type newBlockMsgData struct { type getBlockHashesMsgData struct { Hash []byte - Amount uint32 + Amount uint64 } // main entrypoint, wrappers starting a server running the eth protocol // use this constructor to attach the protocol ("class") to server caps // the Dev p2p layer then runs the protocol instance on each peer -func EthProtocol(eth backend) *p2p.Protocol { - return &p2p.Protocol{ +func EthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool) p2p.Protocol { + return p2p.Protocol{ Name: "eth", Version: ProtocolVersion, Length: ProtocolLength, Run: func(peer *p2p.Peer, rw p2p.MsgReadWriter) error { - return runEthProtocol(eth, peer, rw) + return runEthProtocol(txPool, chainManager, blockPool, peer, rw) }, } } // the main loop that handles incoming messages // note RemovePeer in the post-disconnect hook -func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { +func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { self := ðProtocol{ - eth: eth, - rw: rw, - peer: peer, - id: (string)(peer.Identity().Pubkey()), + txPool: txPool, + chainManager: chainManager, + blockPool: blockPool, + rw: rw, + peer: peer, + id: (string)(peer.Identity().Pubkey()), } err = self.handleStatus() if err == nil { @@ -93,7 +102,7 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro for { err = self.handle() if err != nil { - self.eth.RemovePeer(self.id) + self.blockPool.RemovePeer(self.id) break } } @@ -118,29 +127,20 @@ func (self *ethProtocol) handle() error { case StatusMsg: return ProtocolError(ErrExtraStatusMsg, "") - case GetTxMsg: - txs := self.eth.GetTransactions() - // TODO: rewrite using rlp flat - txsInterface := make([]interface{}, len(txs)) - for i, tx := range txs { - txsInterface[i] = tx.RlpData() - } - return self.rw.EncodeMsg(TxMsg, txsInterface...) - case TxMsg: // TODO: rework using lazy RLP stream var txs []*types.Transaction if err := msg.Decode(&txs); err != nil { return ProtocolError(ErrDecode, "%v", err) } - self.eth.AddTransactions(txs) + self.txPool.AddTransactions(txs) case GetBlockHashesMsg: var request getBlockHashesMsgData if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } - hashes := self.eth.GetBlockHashes(request.Hash, request.Amount) + hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount) return self.rw.EncodeMsg(BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...) case BlockHashesMsg: @@ -154,7 +154,7 @@ func (self *ethProtocol) handle() error { } return } - self.eth.AddBlockHashes(iter, self.id) + self.blockPool.AddBlockHashes(iter, self.id) if err != nil && err != rlp.EOL { return ProtocolError(ErrDecode, "%v", err) } @@ -170,7 +170,7 @@ func (self *ethProtocol) handle() error { if i >= max { break } - block := self.eth.GetBlock(hash) + block := self.chainManager.GetBlock(hash) if block != nil { blocks = append(blocks, block.Value().Raw()) } @@ -188,9 +188,7 @@ func (self *ethProtocol) handle() error { return ProtocolError(ErrDecode, "%v", err) } } - if err := self.eth.AddBlock(block, self.id); err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } + self.blockPool.AddBlock(block, self.id) } case NewBlockMsg: @@ -202,7 +200,7 @@ func (self *ethProtocol) handle() error { // to simplify backend interface adding a new block // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer // (or selected as new best peer) - if self.eth.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) { + if self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) { called := true iter := func() (hash []byte, ok bool) { if called { @@ -212,10 +210,8 @@ func (self *ethProtocol) handle() error { return } } - self.eth.AddBlockHashes(iter, self.id) - if err := self.eth.AddBlock(request.Block, self.id); err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } + self.blockPool.AddBlockHashes(iter, self.id) + self.blockPool.AddBlock(request.Block, self.id) } default: @@ -233,7 +229,7 @@ type statusMsgData struct { } func (self *ethProtocol) statusMsg() p2p.Msg { - td, currentBlock, genesisBlock := self.eth.Status() + td, currentBlock, genesisBlock := self.chainManager.Status() return p2p.NewMsg(StatusMsg, uint32(ProtocolVersion), @@ -269,7 +265,7 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrDecode, "%v", err) } - _, _, genesisBlock := self.eth.Status() + _, _, genesisBlock := self.chainManager.Status() if bytes.Compare(status.GenesisBlock, genesisBlock) != 0 { return ProtocolError(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock, genesisBlock) @@ -285,7 +281,7 @@ func (self *ethProtocol) handleStatus() error { self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) - self.eth.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) + self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) return nil } @@ -300,11 +296,6 @@ func (self *ethProtocol) requestBlocks(hashes [][]byte) error { return self.rw.EncodeMsg(GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)) } -func (self *ethProtocol) invalidBlock(err error) { - ProtocolError(ErrInvalidBlock, "%v", err) - self.peer.Disconnect(p2p.DiscSubprotocolError) -} - func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *protocolError) { err = ProtocolError(code, format, params...) if err.Fatal() { @@ -314,3 +305,14 @@ func (self *ethProtocol) protoError(code int, format string, params ...interface } return } + +func (self *ethProtocol) protoErrorDisconnect(code int, format string, params ...interface{}) { + err := ProtocolError(code, format, params...) + if err.Fatal() { + self.peer.Errorln(err) + // disconnect + } else { + self.peer.Debugln(err) + } + +} -- cgit v1.2.3 From 3308d82b234f93dbba80d332e495dcf157aacbe8 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:07:05 +0000 Subject: add protocol error types specific to blockpool --- eth/error.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eth/error.go b/eth/error.go index 9355d6457..d1daad575 100644 --- a/eth/error.go +++ b/eth/error.go @@ -14,6 +14,8 @@ const ( ErrNoStatusMsg ErrExtraStatusMsg ErrInvalidBlock + ErrInvalidPoW + ErrUnrequestedBlock ) var errorToString = map[int]string{ @@ -26,6 +28,8 @@ var errorToString = map[int]string{ ErrNoStatusMsg: "No status message", ErrExtraStatusMsg: "Extra status message", ErrInvalidBlock: "Invalid block", + ErrInvalidPoW: "Invalid PoW", + ErrUnrequestedBlock: "Unrequested block", } type protocolError struct { -- cgit v1.2.3 From 76070b46742338f354ab47a2c5a202e808daae23 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:08:18 +0000 Subject: blockpool rewritten , tests broken FIXME --- eth/block_pool.go | 1226 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 863 insertions(+), 363 deletions(-) diff --git a/eth/block_pool.go b/eth/block_pool.go index 2c5ebb1e3..64d1e73fa 100644 --- a/eth/block_pool.go +++ b/eth/block_pool.go @@ -1,369 +1,159 @@ package eth import ( - "bytes" - "fmt" "math" "math/big" + "math/rand" + "sort" "sync" "time" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/event" ethlogger "github.com/ethereum/go-ethereum/logger" ) var poolLogger = ethlogger.NewLogger("Blockpool") const ( - blockHashesBatchSize = 256 - blockBatchSize = 64 - blockRequestInterval = 10 // seconds - blockRequestRepetition = 1 - cacheTimeout = 3 // minutes - blockTimeout = 5 // minutes + blockHashesBatchSize = 256 + blockBatchSize = 64 + blocksRequestInterval = 10 // seconds + blocksRequestRepetition = 1 + blockHashesRequestInterval = 10 // seconds + blocksRequestMaxIdleRounds = 10 + cacheTimeout = 3 // minutes + blockTimeout = 5 // minutes ) type poolNode struct { - hash []byte - block *types.Block - child *poolNode - parent *poolNode - root *nodePointer - knownParent bool - suicide chan bool - peer string - source string - blockRequestRoot bool - blockRequestControl *bool - blockRequestQuit *(chan bool) -} - -// the minimal interface for chain manager -type chainManager interface { - KnownBlock(hash []byte) bool - AddBlock(*types.Block) error - CheckPoW(*types.Block) bool + lock sync.RWMutex + hash []byte + block *types.Block + child *poolNode + parent *poolNode + section *section + knownParent bool + peer string + source string + complete bool } type BlockPool struct { - chainManager chainManager - eventer event.TypeMux - - // pool Pool - lock sync.Mutex + lock sync.RWMutex pool map[string]*poolNode - peersLock sync.Mutex + peersLock sync.RWMutex peers map[string]*peerInfo peer *peerInfo quit chan bool wg sync.WaitGroup running bool + + // the minimal interface with blockchain + hasBlock func(hash []byte) bool + insertChain func(types.Blocks) error + verifyPoW func(*types.Block) bool } type peerInfo struct { - td *big.Int - currentBlock []byte - id string + lock sync.RWMutex + + td *big.Int + currentBlock []byte + id string + requestBlockHashes func([]byte) error requestBlocks func([][]byte) error - invalidBlock func(error) -} + peerError func(int, string, ...interface{}) -type nodePointer struct { - hash []byte + sections map[string]*section + roots []*poolNode + quitC chan bool } -type peerChangeEvent struct { - *peerInfo -} - -func NewBlockPool(chMgr chainManager) *BlockPool { +func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(*types.Block) bool, +) *BlockPool { return &BlockPool{ - chainManager: chMgr, - pool: make(map[string]*poolNode), - peers: make(map[string]*peerInfo), - quit: make(chan bool), - running: true, + hasBlock: hasBlock, + insertChain: insertChain, + verifyPoW: verifyPoW, } } -func (self *BlockPool) Stop() { +// allows restart +func (self *BlockPool) Start() { self.lock.Lock() - if !self.running { + if self.running { self.lock.Unlock() return } - self.running = false + self.running = true + self.quit = make(chan bool) + self.pool = make(map[string]*poolNode) self.lock.Unlock() - poolLogger.Infoln("Stopping") + self.peersLock.Lock() + self.peers = make(map[string]*peerInfo) + self.peersLock.Unlock() - close(self.quit) - self.wg.Wait() - poolLogger.Infoln("Stopped") + poolLogger.Infoln("Started") } -// Entry point for eth protocol to add block hashes received via BlockHashesMsg -// only hashes from the best peer is handled -// this method is always responsible to initiate further hash requests until -// a known parent is reached unless cancelled by a peerChange event -func (self *BlockPool) AddBlockHashes(next func() ([]byte, bool), peerId string) { - // subscribe to peerChangeEvent before we check for best peer - peerChange := self.eventer.Subscribe(peerChangeEvent{}) - defer peerChange.Unsubscribe() - // check if this peer is the best - peer, best := self.getPeer(peerId) - if !best { +func (self *BlockPool) Stop() { + self.lock.Lock() + if !self.running { + self.lock.Unlock() return } - root := &nodePointer{} - // peer is still the best - hashes := make(chan []byte) - var lastPoolNode *poolNode - - // using a for select loop so that peer change (new best peer) can abort the parallel thread that processes hashes of the earlier best peer - for { - hash, ok := next() - if ok { - hashes <- hash - } else { - break - } - select { - case <-self.quit: - return - case <-peerChange.Chan(): - // remember where we left off with this peer - if lastPoolNode != nil { - root.hash = lastPoolNode.hash - go self.killChain(lastPoolNode) - } - case hash := <-hashes: - self.lock.Lock() - defer self.lock.Unlock() - // check if known block connecting the downloaded chain to our blockchain - if self.chainManager.KnownBlock(hash) { - poolLogger.Infof("known block (%x...)\n", hash[0:4]) - if lastPoolNode != nil { - lastPoolNode.knownParent = true - go self.requestBlocksLoop(lastPoolNode) - } else { - // all hashes known if topmost one is in blockchain - } - return - } - // - var currentPoolNode *poolNode - // check if lastPoolNode has the correct parent node (hash matching), - // then just assign to currentPoolNode - if lastPoolNode != nil && lastPoolNode.parent != nil && bytes.Compare(lastPoolNode.parent.hash, hash) == 0 { - currentPoolNode = lastPoolNode.parent - } else { - // otherwise look up in pool - currentPoolNode = self.pool[string(hash)] - // if node does not exist, create it and index in the pool - if currentPoolNode == nil { - currentPoolNode = &poolNode{ - hash: hash, - } - self.pool[string(hash)] = currentPoolNode - } - } - // set up parent-child nodes (doubly linked list) - self.link(currentPoolNode, lastPoolNode) - // ! we trust the node iff - // (1) node marked as by the same peer or - // (2) it has a PoW valid block retrieved - if currentPoolNode.peer == peer.id || currentPoolNode.block != nil { - // the trusted checkpoint from which we request hashes down to known head - lastPoolNode = self.pool[string(currentPoolNode.root.hash)] - break - } - currentPoolNode.peer = peer.id - currentPoolNode.root = root - lastPoolNode = currentPoolNode - } - } - // lastPoolNode is nil if and only if the node with stored root hash is already cleaned up - // after valid block insertion, therefore in this case the blockpool active chain is connected to the blockchain, so no need to request further hashes or request blocks - if lastPoolNode != nil { - root.hash = lastPoolNode.hash - peer.requestBlockHashes(lastPoolNode.hash) - go self.requestBlocksLoop(lastPoolNode) - } - return -} - -func (self *BlockPool) requestBlocksLoop(node *poolNode) { - suicide := time.After(blockTimeout * time.Minute) - requestTimer := time.After(0) - var controlChan chan bool - closedChan := make(chan bool) - quit := make(chan bool) - close(closedChan) - requestBlocks := true - origNode := node - self.lock.Lock() - node.blockRequestRoot = true - b := false - control := &b - node.blockRequestControl = control - node.blockRequestQuit = &quit + self.running = false self.lock.Unlock() - blocks := 0 - self.wg.Add(1) -loop: - for { - if requestBlocks { - controlChan = closedChan - } else { - self.lock.Lock() - if *node.blockRequestControl { - controlChan = closedChan - *node.blockRequestControl = false - } - self.lock.Unlock() - } - select { - case <-quit: - break loop - case <-suicide: - go self.killChain(origNode) - break loop - - case <-requestTimer: - requestBlocks = true - - case <-controlChan: - controlChan = nil - // this iteration takes care of requesting blocks only starting from the first node with a missing block (moving target), - // max up to the next checkpoint (n.blockRequestRoot true) - nodes := []*poolNode{} - n := node - next := node - self.lock.Lock() - for n != nil && (n == node || !n.blockRequestRoot) && (requestBlocks || n.block != nil) { - if n.block != nil { - if len(nodes) == 0 { - // nil control indicates that node is not needed anymore - // block can be inserted to blockchain and deleted if knownParent - n.blockRequestControl = nil - blocks++ - next = next.child - } else { - // this is needed to indicate that when a new chain forks from an existing one - // triggering a reorg will ? renew the blockTimeout period ??? - // if there is a block but control == nil should start fetching blocks, see link function - n.blockRequestControl = control - } - } else { - nodes = append(nodes, n) - n.blockRequestControl = control - } - n = n.child - } - // if node is connected to the blockchain, we can immediately start inserting - // blocks to the blockchain and delete nodes - if node.knownParent { - go self.insertChainFrom(node) - } - if next.blockRequestRoot && next != node { - // no more missing blocks till the checkpoint, quitting - poolLogger.Debugf("fetched %v blocks on active chain, batch %v-%v", blocks, origNode, n) - break loop - } - self.lock.Unlock() - // reset starting node to the first descendant node with missing block - node = next - if !requestBlocks { - continue - } - go self.requestBlocks(nodes) - requestTimer = time.After(blockRequestInterval * time.Second) - } - } - self.wg.Done() - return -} + poolLogger.Infoln("Stopping") -func (self *BlockPool) requestBlocks(nodes []*poolNode) { - // distribute block request among known peers + close(self.quit) + self.lock.Lock() self.peersLock.Lock() - peerCount := len(self.peers) - poolLogger.Debugf("requesting %v missing blocks from %v peers", len(nodes), peerCount) - blockHashes := make([][][]byte, peerCount) - repetitions := int(math.Max(float64(peerCount)/2.0, float64(blockRequestRepetition))) - for n, node := range nodes { - for i := 0; i < repetitions; i++ { - blockHashes[n%peerCount] = append(blockHashes[n%peerCount], node.hash) - n++ - } - } - i := 0 - for _, peer := range self.peers { - peer.requestBlocks(blockHashes[i]) - i++ - } + self.peers = nil + self.pool = nil + self.peer = nil + self.wg.Wait() + self.lock.Unlock() self.peersLock.Unlock() -} + poolLogger.Infoln("Stopped") -func (self *BlockPool) insertChainFrom(node *poolNode) { - self.lock.Lock() - defer self.lock.Unlock() - for node != nil && node.blockRequestControl == nil { - err := self.chainManager.AddBlock(node.block) - if err != nil { - poolLogger.Debugf("invalid block %v", node.hash) - poolLogger.Debugf("penalise peers %v (hash), %v (block)", node.peer, node.source) - // penalise peer in node.source - go self.killChain(node) - return - } - poolLogger.Debugf("insert block %v into blockchain", node.hash) - node = node.child - } - // if block insertion succeeds, mark the child as knownParent - // trigger request blocks reorg - if node != nil { - node.knownParent = true - *(node.blockRequestControl) = true - } } // AddPeer is called by the eth protocol instance running on the peer after // the status message has been received with total difficulty and current block hash // AddPeer can only be used once, RemovePeer needs to be called when the peer disconnects -func (self *BlockPool) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) bool { +func (self *BlockPool) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, peerError func(int, string, ...interface{})) bool { self.peersLock.Lock() defer self.peersLock.Unlock() if self.peers[peerId] != nil { panic("peer already added") } - info := &peerInfo{ + peer := &peerInfo{ td: td, currentBlock: currentBlock, id: peerId, //peer.Identity().Pubkey() requestBlockHashes: requestBlockHashes, requestBlocks: requestBlocks, - invalidBlock: invalidBlock, + peerError: peerError, } - self.peers[peerId] = info + self.peers[peerId] = peer poolLogger.Debugf("add new peer %v with td %v", peerId, td) currentTD := ethutil.Big0 if self.peer != nil { currentTD = self.peer.td } if td.Cmp(currentTD) > 0 { - self.peer = info - self.eventer.Post(peerChangeEvent{info}) + self.peer.stop(peer) + peer.start(self.peer) poolLogger.Debugf("peer %v promoted to best peer", peerId) - requestBlockHashes(currentBlock) + self.peer = peer return true } return false @@ -373,14 +163,15 @@ func (self *BlockPool) AddPeer(td *big.Int, currentBlock []byte, peerId string, func (self *BlockPool) RemovePeer(peerId string) { self.peersLock.Lock() defer self.peersLock.Unlock() - if self.peers[peerId] != nil { - panic("peer already removed") + peer := self.peers[peerId] + if peer == nil { + return } self.peers[peerId] = nil poolLogger.Debugf("remove peer %v", peerId[0:4]) // if current best peer is removed, need find a better one - if peerId == self.peer.id { + if self.peer != nil && peerId == self.peer.id { var newPeer *peerInfo max := ethutil.Big0 // peer with the highest self-acclaimed TD is chosen @@ -390,21 +181,499 @@ func (self *BlockPool) RemovePeer(peerId string) { newPeer = info } } - self.peer = newPeer - self.eventer.Post(peerChangeEvent{newPeer}) + self.peer.stop(peer) + peer.start(self.peer) if newPeer != nil { - poolLogger.Debugf("peer %v with td %v spromoted to best peer", newPeer.id[0:4], newPeer.td) - newPeer.requestBlockHashes(newPeer.currentBlock) + poolLogger.Debugf("peer %v with td %v promoted to best peer", newPeer.id[0:4], newPeer.td) } else { poolLogger.Warnln("no peers left") } } } -func (self *BlockPool) getPeer(peerId string) (*peerInfo, bool) { +// Entry point for eth protocol to add block hashes received via BlockHashesMsg +// only hashes from the best peer is handled +// this method is always responsible to initiate further hash requests until +// a known parent is reached unless cancelled by a peerChange event +// this process also launches all request processes on each chain section +// this function needs to run asynchronously for one peer since the message is discarded??? +func (self *BlockPool) AddBlockHashes(next func() ([]byte, bool), peerId string) { + + // check if this peer is the best + peer, best := self.getPeer(peerId) + if !best { + return + } + // peer is still the best + + var child *poolNode + var depth int + + // iterate using next (rlp stream lazy decoder) feeding hashesC + self.wg.Add(1) + go func() { + for { + select { + case <-self.quit: + return + case <-peer.quitC: + // if the peer is demoted, no more hashes taken + break + default: + hash, ok := next() + if !ok { + // message consumed chain skeleton built + break + } + // check if known block connecting the downloaded chain to our blockchain + if self.hasBlock(hash) { + poolLogger.Infof("known block (%x...)\n", hash[0:4]) + if child != nil { + child.Lock() + // mark child as absolute pool root with parent known to blockchain + child.knownParent = true + child.Unlock() + } + break + } + // + var parent *poolNode + // look up node in pool + parent = self.get(hash) + if parent != nil { + // reached a known chain in the pool + // request blocks on the newly added part of the chain + if child != nil { + self.link(parent, child) + + // activate the current chain + self.activateChain(parent, peer, true) + poolLogger.Debugf("potential chain of %v blocks added, reached blockpool, activate chain", depth) + break + } + // if this is the first hash, we expect to find it + parent.RLock() + grandParent := parent.parent + parent.RUnlock() + if grandParent != nil { + // activate the current chain + self.activateChain(parent, peer, true) + poolLogger.Debugf("block hash found, activate chain") + break + } + // the first node is the root of a chain in the pool, rejoice and continue + } + // if node does not exist, create it and index in the pool + section := §ion{} + if child == nil { + section.top = parent + } + parent = &poolNode{ + hash: hash, + child: child, + section: section, + peer: peerId, + } + self.set(hash, parent) + poolLogger.Debugf("create potential block for %x...", hash[0:4]) + + depth++ + child = parent + } + } + if child != nil { + poolLogger.Debugf("chain of %v hashes added", depth) + // start a processSection on the last node, but switch off asking + // hashes and blocks until next peer confirms this chain + section := self.processSection(child) + peer.addSection(child.hash, section) + section.start() + } + }() +} + +// AddBlock is the entry point for the eth protocol when blockmsg is received upon requests +// It has a strict interpretation of the protocol in that if the block received has not been requested, it results in an error (which can be ignored) +// block is checked for PoW +// only the first PoW-valid block for a hash is considered legit +func (self *BlockPool) AddBlock(block *types.Block, peerId string) { + hash := block.Hash() + node := self.get(hash) + node.RLock() + b := node.block + node.RUnlock() + if b != nil { + return + } + if node == nil && !self.hasBlock(hash) { + self.peerError(peerId, ErrUnrequestedBlock, "%x", hash) + return + } + // validate block for PoW + if !self.verifyPoW(block) { + self.peerError(peerId, ErrInvalidPoW, "%x", hash) + } + node.Lock() + node.block = block + node.source = peerId + node.Unlock() +} + +// iterates down a known poolchain and activates fetching processes +// on each chain section for the peer +// stops if the peer is demoted +// registers last section root as root for the peer (in case peer is promoted a second time, to remember) +func (self *BlockPool) activateChain(node *poolNode, peer *peerInfo, on bool) { + self.wg.Add(1) + go func() { + for { + node.sectionRLock() + bottom := node.section.bottom + if bottom == nil { // the chain section is being created or killed + break + } + // register this section with the peer + if peer != nil { + peer.addSection(bottom.hash, bottom.section) + if on { + bottom.section.start() + } else { + bottom.section.start() + } + } + if bottom.parent == nil { + node = bottom + break + } + // if peer demoted stop activation + select { + case <-peer.quitC: + break + default: + } + + node = bottom.parent + bottom.sectionRUnlock() + } + // remember root for this peer + peer.addRoot(node) + self.wg.Done() + }() +} + +// main worker thread on each section in the poolchain +// - kills the section if there are blocks missing after an absolute time +// - kills the section if there are maxIdleRounds of idle rounds of block requests with no response +// - periodically polls the chain section for missing blocks which are then requested from peers +// - registers the process controller on the peer so that if the peer is promoted as best peer the second time (after a disconnect of a better one), all active processes are switched back on unless they expire and killed () +// - when turned off (if peer disconnects and new peer connects with alternative chain), no blockrequests are made but absolute expiry timer is ticking +// - when turned back on it recursively calls itself on the root of the next chain section +// - when exits, signals to +func (self *BlockPool) processSection(node *poolNode) *section { + // absolute time after which sub-chain is killed if not complete (some blocks are missing) + suicideTimer := time.After(blockTimeout * time.Minute) + var blocksRequestTimer, blockHashesRequestTimer <-chan time.Time + var nodeC, missingC, processC chan *poolNode + controlC := make(chan bool) + resetC := make(chan bool) + var hashes [][]byte + var i, total, missing, lastMissing, depth int + var blockHashesRequests, blocksRequests int + var idle int + var init, alarm, done, same, running, once bool + orignode := node + hash := node.hash + + node.sectionLock() + defer node.sectionUnlock() + section := §ion{controlC: controlC, resetC: resetC} + node.section = section + + go func() { + self.wg.Add(1) + for { + node.sectionRLock() + controlC = node.section.controlC + node.sectionRUnlock() + + if init { + // missing blocks read from nodeC + // initialized section + if depth == 0 { + break + } + // enable select case to read missing block when ready + processC = missingC + missingC = make(chan *poolNode, lastMissing) + nodeC = nil + // only do once + init = false + } else { + if !once { + missingC = nil + processC = nil + i = 0 + total = 0 + lastMissing = 0 + } + } + + // went through all blocks in section + if i != 0 && i == lastMissing { + if len(hashes) > 0 { + // send block requests to peers + self.requestBlocks(blocksRequests, hashes) + } + blocksRequests++ + poolLogger.Debugf("[%x] block request attempt %v: missing %v/%v/%v", hash[0:4], blocksRequests, missing, total, depth) + if missing == lastMissing { + // idle round + if same { + // more than once + idle++ + // too many idle rounds + if idle > blocksRequestMaxIdleRounds { + poolLogger.Debugf("[%x] block requests had %v idle rounds (%v total attempts): missing %v/%v/%v\ngiving up...", hash[0:4], idle, blocksRequests, missing, total, depth) + self.killChain(node, nil) + break + } + } else { + idle = 0 + } + same = true + } else { + if missing == 0 { + // no missing nodes + poolLogger.Debugf("block request process complete on section %x... (%v total blocksRequests): missing %v/%v/%v", hash[0:4], blockHashesRequests, blocksRequests, missing, total, depth) + node.Lock() + orignode.complete = true + node.Unlock() + blocksRequestTimer = nil + if blockHashesRequestTimer == nil { + // not waiting for hashes any more + poolLogger.Debugf("hash request on root %x... successful (%v total attempts)\nquitting...", hash[0:4], blockHashesRequests) + break + } // otherwise suicide if no hashes coming + } + same = false + } + lastMissing = missing + i = 0 + missing = 0 + // ready for next round + done = true + } + if done && alarm { + poolLogger.Debugf("start checking if new blocks arrived (attempt %v): missing %v/%v/%v", blocksRequests, missing, total, depth) + blocksRequestTimer = time.After(blocksRequestInterval * time.Second) + alarm = false + done = false + // processC supposed to be empty and never closed so just swap, no need to allocate + tempC := processC + processC = missingC + missingC = tempC + } + select { + case <-self.quit: + break + case <-suicideTimer: + self.killChain(node, nil) + poolLogger.Warnf("[%x] timeout. (%v total attempts): missing %v/%v/%v", hash[0:4], blocksRequests, missing, total, depth) + break + case <-blocksRequestTimer: + alarm = true + case <-blockHashesRequestTimer: + orignode.RLock() + parent := orignode.parent + orignode.RUnlock() + if parent != nil { + // if not root of chain, switch off + poolLogger.Debugf("[%x] parent found, hash requests deactivated (after %v total attempts)\n", hash[0:4], blockHashesRequests) + blockHashesRequestTimer = nil + } else { + blockHashesRequests++ + poolLogger.Debugf("[%x] hash request on root (%v total attempts)\n", hash[0:4], blockHashesRequests) + self.requestBlockHashes(parent.hash) + blockHashesRequestTimer = time.After(blockHashesRequestInterval * time.Second) + } + case r, ok := <-controlC: + if !ok { + break + } + if running && !r { + poolLogger.Debugf("process on section %x... (%v total attempts): missing %v/%v/%v", hash[0:4], blocksRequests, missing, total, depth) + + alarm = false + blocksRequestTimer = nil + blockHashesRequestTimer = nil + processC = nil + } + if !running && r { + poolLogger.Debugf("[%x] on", hash[0:4]) + + orignode.RLock() + parent := orignode.parent + complete := orignode.complete + knownParent := orignode.knownParent + orignode.RUnlock() + if !complete { + poolLogger.Debugf("[%x] activate block requests", hash[0:4]) + blocksRequestTimer = time.After(0) + } + if parent == nil && !knownParent { + // if no parent but not connected to blockchain + poolLogger.Debugf("[%x] activate block hashes requests", hash[0:4]) + blockHashesRequestTimer = time.After(0) + } else { + blockHashesRequestTimer = nil + } + alarm = true + processC = missingC + if !once { + // if not run at least once fully, launch iterator + processC = make(chan *poolNode) + missingC = make(chan *poolNode) + self.foldUp(orignode, processC) + once = true + } + } + total = lastMissing + case <-resetC: + once = false + init = false + done = false + case node, ok := <-processC: + if !ok { + // channel closed, first iteration finished + init = true + once = true + continue + } + i++ + // if node has no block + node.RLock() + block := node.block + nhash := node.hash + knownParent := node.knownParent + node.RUnlock() + if !init { + depth++ + } + if block == nil { + missing++ + if !init { + total++ + } + hashes = append(hashes, nhash) + if len(hashes) == blockBatchSize { + self.requestBlocks(blocksRequests, hashes) + hashes = nil + } + missingC <- node + } else { + // block is found + if knownParent { + // connected to the blockchain, insert the longest chain of blocks + var blocks types.Blocks + child := node + parent := node + node.sectionRLock() + for child != nil && child.block != nil { + parent = child + blocks = append(blocks, parent.block) + child = parent.child + } + node.sectionRUnlock() + poolLogger.Debugf("[%x] insert %v blocks into blockchain", hash[0:4], len(blocks)) + if err := self.insertChain(blocks); err != nil { + // TODO: not clear which peer we need to address + // peerError should dispatch to peer if still connected and disconnect + self.peerError(node.source, ErrInvalidBlock, "%v", err) + poolLogger.Debugf("invalid block %v", node.hash) + poolLogger.Debugf("penalise peers %v (hash), %v (block)", node.peer, node.source) + // penalise peer in node.source + self.killChain(node, nil) + // self.disconnect() + break + } + // if suceeded mark the next one (no block yet) as connected to blockchain + if child != nil { + child.Lock() + child.knownParent = true + child.Unlock() + } + // reset starting node to first node with missing block + orignode = child + // pop the inserted ancestors off the channel + for i := 1; i < len(blocks); i++ { + <-processC + } + // delink inserted chain section + self.killChain(node, parent) + } + } + } + } + poolLogger.Debugf("[%x] quit after\n%v block hashes requests\n%v block requests: missing %v/%v/%v", hash[0:4], blockHashesRequests, blocksRequests, missing, total, depth) + + self.wg.Done() + node.sectionLock() + node.section.controlC = nil + node.sectionUnlock() + // this signals that controller not available + }() + return section + +} + +func (self *BlockPool) peerError(peerId string, code int, format string, params ...interface{}) { + self.peersLock.RLock() + defer self.peersLock.RUnlock() + peer, ok := self.peers[peerId] + if ok { + peer.peerError(code, format, params...) + } +} + +func (self *BlockPool) requestBlockHashes(hash []byte) { + self.peersLock.Lock() + defer self.peersLock.Unlock() + if self.peer != nil { + self.peer.requestBlockHashes(hash) + } +} + +func (self *BlockPool) requestBlocks(attempts int, hashes [][]byte) { + // distribute block request among known peers self.peersLock.Lock() defer self.peersLock.Unlock() - if self.peer.id == peerId { + peerCount := len(self.peers) + // on first attempt use the best peer + if attempts == 0 { + self.peer.requestBlocks(hashes) + return + } + repetitions := int(math.Min(float64(peerCount), float64(blocksRequestRepetition))) + poolLogger.Debugf("request %v missing blocks from %v/%v peers", len(hashes), repetitions, peerCount) + i := 0 + indexes := rand.Perm(peerCount)[0:(repetitions - 1)] + sort.Ints(indexes) + for _, peer := range self.peers { + if i == indexes[0] { + peer.requestBlocks(hashes) + indexes = indexes[1:] + if len(indexes) == 0 { + break + } + } + i++ + } +} + +func (self *BlockPool) getPeer(peerId string) (*peerInfo, bool) { + self.peersLock.RLock() + defer self.peersLock.RUnlock() + if self.peer != nil && self.peer.id == peerId { return self.peer, true } info, ok := self.peers[peerId] @@ -414,101 +683,332 @@ func (self *BlockPool) getPeer(peerId string) (*peerInfo, bool) { return info, false } -// if same peer gave different chain before, this will overwrite it -// if currentPoolNode existed as a non-leaf node the earlier fork is delinked -// if same parent hash is found, we can abort, we do not allow the same peer to change minds about parent of same hash, if errored first time round, will get penalized. -// if lastPoolNode had a different parent the earlier parent (with entire subtree) is delinked, this situation cannot normally arise though -// just in case reset lastPoolNode as non-root (unlikely) +func (self *peerInfo) addSection(hash []byte, section *section) { + self.lock.Lock() + defer self.lock.Unlock() + self.sections[string(hash)] = section +} + +func (self *peerInfo) addRoot(node *poolNode) { + self.lock.Lock() + defer self.lock.Unlock() + self.roots = append(self.roots, node) +} +// (re)starts processes registered for this peer (self) +func (self *peerInfo) start(peer *peerInfo) { + self.lock.Lock() + defer self.lock.Unlock() + self.quitC = make(chan bool) + for _, root := range self.roots { + root.sectionRLock() + if root.section.bottom != nil { + if root.parent == nil { + self.requestBlockHashes(root.hash) + } + } + root.sectionRUnlock() + } + self.roots = nil + self.controlSections(peer, true) +} + +// (re)starts process without requests, only suicide timer +func (self *peerInfo) stop(peer *peerInfo) { + self.lock.RLock() + defer self.lock.RUnlock() + close(self.quitC) + self.controlSections(peer, false) +} + +func (self *peerInfo) controlSections(peer *peerInfo, on bool) { + if peer != nil { + peer.lock.RLock() + defer peer.lock.RUnlock() + } + for hash, section := range peer.sections { + if section.done() { + delete(self.sections, hash) + } + _, exists := peer.sections[hash] + if on || peer == nil || exists { + if on { + // self is best peer + section.start() + } else { + // (re)starts process without requests, only suicide timer + section.stop() + } + } + } +} + +// called when parent is found in pool +// parent and child are guaranteed to be on different sections func (self *BlockPool) link(parent, child *poolNode) { - // reactivate node scheduled for suicide - if parent.suicide != nil { - close(parent.suicide) - parent.suicide = nil + var top bool + parent.sectionLock() + if child != nil { + child.sectionLock() + } + if parent == parent.section.top && parent.section.top != nil { + top = true + } + var bottom bool + + if child == child.section.bottom { + bottom = true } if parent.child != child { orphan := parent.child - orphan.parent = nil - go self.killChain(orphan) + if orphan != nil { + // got a fork in the chain + if top { + orphan.lock.Lock() + // make old child orphan + orphan.parent = nil + orphan.lock.Unlock() + } else { // we are under section lock + // make old child orphan + orphan.parent = nil + // reset section objects above the fork + nchild := orphan.child + node := orphan + section := §ion{bottom: orphan} + for node.section == nchild.section { + node = nchild + node.section = section + nchild = node.child + } + section.top = node + // set up a suicide + self.processSection(orphan).stop() + } + } else { + // child is on top of a chain need to close section + child.section.bottom = child + } + // adopt new child parent.child = child + if !top { + parent.section.top = parent + // restart section process so that shorter section is scanned for blocks + parent.section.reset() + } } + if child != nil { if child.parent != parent { - orphan := child.parent - orphan.child = nil - go func() { - // if it is a aberrant reverse fork, zip down to bottom - for orphan.parent != nil { - orphan = orphan.parent + stepParent := child.parent + if stepParent != nil { + if bottom { + stepParent.Lock() + stepParent.child = nil + stepParent.Unlock() + } else { + // we are on the same section + // if it is a aberrant reverse fork, + stepParent.child = nil + node := stepParent + nparent := stepParent.child + section := §ion{top: stepParent} + for node.section == nparent.section { + node = nparent + node.section = section + node = node.parent + } } - self.killChain(orphan) - }() - child.parent = parent + } else { + // linking to a root node, ie. parent is under the root of a chain + parent.section.top = parent + } } - child.knownParent = false + child.parent = parent + child.section.bottom = child } -} + // this needed if someone lied about the parent before + child.knownParent = false -func (self *BlockPool) killChain(node *poolNode) { - if node == nil { - return + parent.sectionUnlock() + if child != nil { + child.sectionUnlock() } - poolLogger.Debugf("suicide scheduled on node %v", node) - suicide := make(chan bool) - self.lock.Lock() - node.suicide = suicide - self.lock.Unlock() - timer := time.After(cacheTimeout * time.Minute) +} + +// this immediately kills the chain from node to end (inclusive) section by section +func (self *BlockPool) killChain(node *poolNode, end *poolNode) { + poolLogger.Debugf("kill chain section with root node %v", node) + + node.sectionLock() + node.section.abort() + self.set(node.hash, nil) + child := node.child + top := node.section.top + i := 1 self.wg.Add(1) - select { - case <-self.quit: - case <-suicide: - // cancel suicide = close node.suicide to reactivate node - case <-timer: - poolLogger.Debugf("suicide on node %v", node) - self.lock.Lock() - defer self.lock.Unlock() - // proceed up via child links until another suicide root found or chain ends - // abort request blocks loops that start above - // and delete nodes from pool then quit the suicide process - okToAbort := node.blockRequestRoot - for node != nil && (node.suicide == suicide || node.suicide == nil) { - self.pool[string(node.hash)] = nil - if okToAbort && node.blockRequestQuit != nil { - quit := *(node.blockRequestQuit) - if quit != nil { // not yet closed - *(node.blockRequestQuit) = nil - close(quit) + go func() { + var quit bool + for node != top && node != end && child != nil { + node = child + select { + case <-self.quit: + quit = true + break + default: + } + self.set(node.hash, nil) + child = node.child + } + poolLogger.Debugf("killed chain section of %v blocks with root node %v", i, node) + if !quit { + if node == top { + if node != end && child != nil && end != nil { + // + self.killChain(child, end) } } else { - okToAbort = true + if child != nil { + // delink rest of this section if ended midsection + child.section.bottom = child + child.parent = nil + } } - node = node.child } + node.section.bottom = nil + node.sectionUnlock() + self.wg.Done() + }() +} + +// structure to store long range links on chain to skip along +type section struct { + lock sync.RWMutex + bottom *poolNode + top *poolNode + controlC chan bool + resetC chan bool +} + +func (self *section) start() { + self.lock.RLock() + defer self.lock.RUnlock() + if self.controlC != nil { + self.controlC <- true } - self.wg.Done() } -// AddBlock is the entry point for the eth protocol when blockmsg is received upon requests -// It has a strict interpretation of the protocol in that if the block received has not been requested, it results in an error (which can be ignored) -// block is checked for PoW -// only the first PoW-valid block for a hash is considered legit -func (self *BlockPool) AddBlock(block *types.Block, peerId string) (err error) { - hash := block.Hash() +func (self *section) stop() { + self.lock.RLock() + defer self.lock.RUnlock() + if self.controlC != nil { + self.controlC <- false + } +} + +func (self *section) reset() { + self.lock.RLock() + defer self.lock.RUnlock() + if self.controlC != nil { + self.resetC <- true + self.controlC <- false + } +} + +func (self *section) abort() { self.lock.Lock() defer self.lock.Unlock() - node, ok := self.pool[string(hash)] - if !ok && !self.chainManager.KnownBlock(hash) { - return fmt.Errorf("unrequested block %x", hash) + if self.controlC != nil { + close(self.controlC) + self.controlC = nil } - if node.block != nil { - return - } - // validate block for PoW - if !self.chainManager.CheckPoW(block) { - return fmt.Errorf("invalid pow on block %x", hash) +} + +func (self *section) done() bool { + self.lock.Lock() + defer self.lock.Unlock() + if self.controlC != nil { + return true } - node.block = block - node.source = peerId - return nil + return false +} + +func (self *BlockPool) get(hash []byte) (node *poolNode) { + self.lock.Lock() + defer self.lock.Unlock() + return self.pool[string(hash)] +} + +func (self *BlockPool) set(hash []byte, node *poolNode) { + self.lock.Lock() + defer self.lock.Unlock() + self.pool[string(hash)] = node +} + +// first time for block request, this iteration retrieves nodes of the chain +// from node up to top (all the way if nil) via child links +// copies the controller +// and feeds nodeC channel +// this is performed under section readlock to prevent top from going away +// when +func (self *BlockPool) foldUp(node *poolNode, nodeC chan *poolNode) { + self.wg.Add(1) + go func() { + node.sectionRLock() + defer node.sectionRUnlock() + for node != nil { + select { + case <-self.quit: + break + case nodeC <- node: + if node == node.section.top { + break + } + node = node.child + } + } + close(nodeC) + self.wg.Done() + }() +} + +func (self *poolNode) Lock() { + self.sectionLock() + self.lock.Lock() +} + +func (self *poolNode) Unlock() { + self.lock.Unlock() + self.sectionUnlock() +} + +func (self *poolNode) RLock() { + self.lock.RLock() +} + +func (self *poolNode) RUnlock() { + self.lock.RUnlock() +} + +func (self *poolNode) sectionLock() { + self.lock.RLock() + defer self.lock.RUnlock() + self.section.lock.Lock() +} + +func (self *poolNode) sectionUnlock() { + self.lock.RLock() + defer self.lock.RUnlock() + self.section.lock.Unlock() +} + +func (self *poolNode) sectionRLock() { + self.lock.RLock() + defer self.lock.RUnlock() + self.section.lock.RLock() +} + +func (self *poolNode) sectionRUnlock() { + self.lock.RLock() + defer self.lock.RUnlock() + self.section.lock.RUnlock() } -- cgit v1.2.3 From 148de1c8757413f171dbf2fd3e8e5a5976eb7dc9 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:09:33 +0000 Subject: adapt xeth pkg to new backend. FIXME JSPeer peer info --- xeth/hexface.go | 9 ++------ xeth/js_types.go | 65 +++++++++++++++++++++++++++----------------------------- xeth/world.go | 5 ++--- 3 files changed, 35 insertions(+), 44 deletions(-) diff --git a/xeth/hexface.go b/xeth/hexface.go index c1f49453d..524b68210 100644 --- a/xeth/hexface.go +++ b/xeth/hexface.go @@ -3,7 +3,6 @@ package xeth import ( "bytes" "encoding/json" - "sync/atomic" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" @@ -63,12 +62,8 @@ func (self *JSXEth) PeerCount() int { func (self *JSXEth) Peers() []JSPeer { var peers []JSPeer - for peer := self.obj.Peers().Front(); peer != nil; peer = peer.Next() { - p := peer.Value.(core.Peer) - // we only want connected peers - if atomic.LoadInt32(p.Connected()) != 0 { - peers = append(peers, *NewJSPeer(p)) - } + for _, peer := range self.obj.Peers() { + peers = append(peers, *NewJSPeer(peer)) } return peers diff --git a/xeth/js_types.go b/xeth/js_types.go index da26439cf..1d9faa190 100644 --- a/xeth/js_types.go +++ b/xeth/js_types.go @@ -1,14 +1,13 @@ package xeth import ( - "fmt" - "strconv" "strings" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/state" ) @@ -155,38 +154,36 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) * // Peer interface exposed to QML type JSPeer struct { - ref *core.Peer - Inbound bool `json:"isInbound"` - LastSend int64 `json:"lastSend"` - LastPong int64 `json:"lastPong"` - Ip string `json:"ip"` - Port int `json:"port"` - Version string `json:"version"` - LastResponse string `json:"lastResponse"` - Latency string `json:"latency"` - Caps string `json:"caps"` -} - -func NewJSPeer(peer core.Peer) *JSPeer { - if peer == nil { - return nil - } - - var ip []string - for _, i := range peer.Host() { - ip = append(ip, strconv.Itoa(int(i))) - } - ipAddress := strings.Join(ip, ".") - - var caps []string - capsIt := peer.Caps().NewIterator() - for capsIt.Next() { - cap := capsIt.Value().Get(0).Str() - ver := capsIt.Value().Get(1).Uint() - caps = append(caps, fmt.Sprintf("%s/%d", cap, ver)) - } - - return &JSPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime(), Caps: "[" + strings.Join(caps, ", ") + "]"} + ref *p2p.Peer + // Inbound bool `json:"isInbound"` + // LastSend int64 `json:"lastSend"` + // LastPong int64 `json:"lastPong"` + // Ip string `json:"ip"` + // Port int `json:"port"` + // Version string `json:"version"` + // LastResponse string `json:"lastResponse"` + // Latency string `json:"latency"` + // Caps string `json:"caps"` +} + +func NewJSPeer(peer *p2p.Peer) *JSPeer { + + // var ip []string + // for _, i := range peer.Host() { + // ip = append(ip, strconv.Itoa(int(i))) + // } + // ipAddress := strings.Join(ip, ".") + + // var caps []string + // capsIt := peer.Caps().NewIterator() + // for capsIt.Next() { + // cap := capsIt.Value().Get(0).Str() + // ver := capsIt.Value().Get(1).Uint() + // caps = append(caps, fmt.Sprintf("%s/%d", cap, ver)) + // } + + return &JSPeer{ref: peer} + // return &JSPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime(), Caps: "[" + strings.Join(caps, ", ") + "]"} } type JSReceipt struct { diff --git a/xeth/world.go b/xeth/world.go index 956ef1e15..008a08423 100644 --- a/xeth/world.go +++ b/xeth/world.go @@ -1,8 +1,7 @@ package xeth import ( - "container/list" - + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/state" ) @@ -55,7 +54,7 @@ func (self *World) IsListening() bool { return self.pipe.obj.IsListening() } -func (self *World) Peers() *list.List { +func (self *World) Peers() []*p2p.Peer { return self.pipe.obj.Peers() } -- cgit v1.2.3 From 118862f1ba058fa90414ab9ec6deb1ab5aac6590 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:10:48 +0000 Subject: adapt miner to new backend. use events to broadcast new mined blocks --- miner/miner.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/miner/miner.go b/miner/miner.go index dc69dddc0..6ba3b1eba 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -27,7 +27,7 @@ import ( "math/big" "sort" - "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/pow" "github.com/ethereum/go-ethereum/pow/ezp" @@ -36,7 +36,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/wire" ) type LocalTx struct { @@ -217,7 +216,7 @@ func (self *Miner) mine() { if err != nil { minerlogger.Infoln(err) } else { - self.eth.Broadcast(wire.MsgBlockTy, []interface{}{block.Value().Val}) + self.eth.EventMux().Post(core.NewMinedBlockEvent{block}) minerlogger.Infof("🔨 Mined block %x\n", block.Hash()) minerlogger.Infoln(block) @@ -246,7 +245,7 @@ func (self *Miner) finiliseTxs() types.Transactions { } // Faster than append - for _, tx := range self.eth.TxPool().CurrentTransactions() { + for _, tx := range self.eth.TxPool().GetTransactions() { if tx.GasPrice.Cmp(self.MinAcceptedGasPrice) >= 0 { txs[actualSize] = tx actualSize++ -- cgit v1.2.3 From b89ed8eb7bc9ced4a7daa33cc81e1579a6d2ddfc Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:12:27 +0000 Subject: adapt javascript pkg to new backend, use SuggestPeer --- javascript/javascript_runtime.go | 4 ++-- javascript/types.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/javascript_runtime.go b/javascript/javascript_runtime.go index 84d61d405..169ed509e 100644 --- a/javascript/javascript_runtime.go +++ b/javascript/javascript_runtime.go @@ -7,10 +7,10 @@ import ( "path" "path/filepath" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" @@ -202,7 +202,7 @@ func (self *JSRE) addPeer(call otto.FunctionCall) otto.Value { if err != nil { return otto.FalseValue() } - self.ethereum.ConnectToPeer(host) + self.ethereum.SuggestPeer(host) return otto.TrueValue() } diff --git a/javascript/types.go b/javascript/types.go index d5acaecce..cf5a6677b 100644 --- a/javascript/types.go +++ b/javascript/types.go @@ -3,7 +3,7 @@ package javascript import ( "fmt" - "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/ui" -- cgit v1.2.3 From c2af10d256f9fb29f86fc0c33abafeb62ebbe570 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:15:48 +0000 Subject: transaction pool changes - use eventer events to broadcast transactions - CurrentTransactions -> GetTransactions - add AddTransactions --- core/transaction_pool.go | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 7166d35e8..2eb0b55df 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -10,7 +10,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/wire" ) var txplogger = logger.NewLogger("TXP") @@ -18,7 +17,9 @@ var txplogger = logger.NewLogger("TXP") const txPoolQueueSize = 50 type TxPoolHook chan *types.Transaction -type TxMsgTy byte +type TxMsg struct { + Tx *types.Transaction +} const ( minGasPrice = 1000000 @@ -26,11 +27,6 @@ const ( var MinGasPrice = big.NewInt(10000000000000) -type TxMsg struct { - Tx *types.Transaction - Type TxMsgTy -} - func EachTx(pool *list.List, it func(*types.Transaction, *list.Element) bool) { for e := pool.Front(); e != nil; e = e.Next() { if it(e.Value.(*types.Transaction), e) { @@ -94,7 +90,7 @@ func (pool *TxPool) addTransaction(tx *types.Transaction) { pool.pool.PushBack(tx) // Broadcast the transaction to the rest of the peers - pool.Ethereum.Broadcast(wire.MsgTxTy, []interface{}{tx.RlpData()}) + pool.Ethereum.EventMux().Post(TxPreEvent{tx}) } func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { @@ -169,7 +165,17 @@ func (self *TxPool) Size() int { return self.pool.Len() } -func (pool *TxPool) CurrentTransactions() []*types.Transaction { +func (self *TxPool) AddTransactions(txs []*types.Transaction) { + for _, tx := range txs { + if err := self.Add(tx); err != nil { + txplogger.Infoln(err) + } else { + txplogger.Infof("tx %x\n", tx.Hash()[0:4]) + } + } +} + +func (pool *TxPool) GetTransactions() []*types.Transaction { pool.mutex.Lock() defer pool.mutex.Unlock() @@ -216,7 +222,7 @@ func (self *TxPool) RemoveSet(txs types.Transactions) { } func (pool *TxPool) Flush() []*types.Transaction { - txList := pool.CurrentTransactions() + txList := pool.GetTransactions() // Recreate a new list all together // XXX Is this the fastest way? -- cgit v1.2.3 From 5022a31889f87b95dd664cac2b049d5081e4af61 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:18:24 +0000 Subject: add NewMinedBlockEvent --- core/events.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/events.go b/core/events.go index deeba3e98..fe106da49 100644 --- a/core/events.go +++ b/core/events.go @@ -10,3 +10,6 @@ type TxPostEvent struct{ Tx *types.Transaction } // NewBlockEvent is posted when a block has been imported. type NewBlockEvent struct{ Block *types.Block } + +// NewMinedBlockEvent is posted when a block has been imported. +type NewMinedBlockEvent struct{ Block *types.Block } -- cgit v1.2.3 From 39d86a28e7d27bf1f6a2e2e298b52614ee0b9be3 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:19:29 +0000 Subject: adapt to new eth pkg and p2p --- core/block_manager.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/block_manager.go b/core/block_manager.go index f6c73bc2c..cf47218ed 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -2,7 +2,6 @@ package core import ( "bytes" - "container/list" "errors" "fmt" "math/big" @@ -14,10 +13,10 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/pow" "github.com/ethereum/go-ethereum/pow/ezp" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/wire" ) var statelogger = logger.NewLogger("BLOCK") @@ -38,13 +37,12 @@ type EthManager interface { BlockManager() *BlockManager ChainManager() *ChainManager TxPool() *TxPool - Broadcast(msgType wire.MsgType, data []interface{}) PeerCount() int IsMining() bool IsListening() bool - Peers() *list.List + Peers() []*p2p.Peer KeyManager() *crypto.KeyManager - ClientIdentity() wire.ClientIdentity + ClientIdentity() p2p.ClientIdentity Db() ethutil.Database EventMux() *event.TypeMux } -- cgit v1.2.3 From d84810d89df128d9120a4562bb9e6334ba6a33d4 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:20:37 +0000 Subject: add Status to retrieve TD, currentBlock, genesis for easy interface with eth/protocol --- core/chain_manager.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/chain_manager.go b/core/chain_manager.go index edf50e715..f9fb3b3f8 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -72,6 +72,10 @@ func NewChainManager(mux *event.TypeMux) *ChainManager { return bc } +func (self *ChainManager) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { + return self.TD, self.CurrentBlock.Hash(), self.Genesis().Hash() +} + func (self *ChainManager) SetProcessor(proc types.BlockProcessor) { self.processor = proc } @@ -173,7 +177,7 @@ func (bc *ChainManager) HasBlock(hash []byte) bool { return len(data) != 0 } -func (self *ChainManager) GetChainHashesFromHash(hash []byte, max uint64) (chain [][]byte) { +func (self *ChainManager) GetBlockHashesFromHash(hash []byte, max uint64) (chain [][]byte) { block := self.GetBlock(hash) if block == nil { return -- cgit v1.2.3 From 50e1dcc43a3eb4d32147d10c29c0edeadeca6f78 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:23:48 +0000 Subject: import eth pkg --- cmd/ethereum/cmd.go | 2 +- cmd/ethereum/repl/repl.go | 2 +- cmd/utils/websockets.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/ethereum/cmd.go b/cmd/ethereum/cmd.go index 8710d6136..d8b9ea487 100644 --- a/cmd/ethereum/cmd.go +++ b/cmd/ethereum/cmd.go @@ -21,9 +21,9 @@ import ( "io/ioutil" "os" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/cmd/ethereum/repl" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/javascript" ) diff --git a/cmd/ethereum/repl/repl.go b/cmd/ethereum/repl/repl.go index a5146fecd..4a7880ff4 100644 --- a/cmd/ethereum/repl/repl.go +++ b/cmd/ethereum/repl/repl.go @@ -24,7 +24,7 @@ import ( "os" "path" - "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/logger" diff --git a/cmd/utils/websockets.go b/cmd/utils/websockets.go index d3ba50e78..29f9b8aeb 100644 --- a/cmd/utils/websockets.go +++ b/cmd/utils/websockets.go @@ -1,7 +1,7 @@ package utils import ( - "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/websocket" "github.com/ethereum/go-ethereum/xeth" -- cgit v1.2.3 From ae7c1e3e55610cc28bb4f79ede5660dd89c019c5 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:26:13 +0000 Subject: adapt to new backend - eth p2p pkgs - new Ethereum initialiser - no caps param - use nat type - add NatType func to map nat type string to p2p.NAT - add pubkey to client identity --- cmd/utils/cmd.go | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index db7bcd35e..24d5970bd 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -4,23 +4,23 @@ import ( "fmt" "io" "log" + "net" "os" "os/signal" "path" "path/filepath" "regexp" "runtime" - "time" "bitbucket.org/kardianos/osext" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/wire" "github.com/ethereum/go-ethereum/xeth" ) @@ -144,17 +144,32 @@ func NewDatabase() ethutil.Database { return db } -func NewClientIdentity(clientIdentifier, version, customIdentifier string) *wire.SimpleClientIdentity { - return wire.NewSimpleClientIdentity(clientIdentifier, version, customIdentifier) +func NewClientIdentity(clientIdentifier, version, customIdentifier string, pubkey string) *p2p.SimpleClientIdentity { + return p2p.NewSimpleClientIdentity(clientIdentifier, version, customIdentifier, pubkey) } -func NewEthereum(db ethutil.Database, clientIdentity wire.ClientIdentity, keyManager *crypto.KeyManager, usePnp bool, OutboundPort string, MaxPeer int) *eth.Ethereum { - ethereum, err := eth.New(db, clientIdentity, keyManager, eth.CapDefault, usePnp) +func NatType(natType string, gateway string) (nat p2p.NAT) { + switch natType { + case "UPNP": + nat = p2p.UPNP() + case "PMP": + ip := net.ParseIP(gateway) + if ip != nil { + clilogger.Fatalf("bad PMP gateway '%s'", gateway) + } + nat = p2p.PMP(ip) + case "": + default: + clilogger.Fatalf("unrecognised NAT type '%s'", natType) + } + return +} + +func NewEthereum(db ethutil.Database, clientIdentity p2p.ClientIdentity, keyManager *crypto.KeyManager, nat p2p.NAT, OutboundPort string, MaxPeer int) *eth.Ethereum { + ethereum, err := eth.New(db, clientIdentity, keyManager, nat, OutboundPort, MaxPeer) if err != nil { clilogger.Fatalln("eth start err:", err) } - ethereum.Port = OutboundPort - ethereum.MaxPeers = MaxPeer return ethereum } @@ -268,11 +283,6 @@ func StartMining(ethereum *eth.Ethereum) bool { if gminer == nil { gminer = miner.New(addr, ethereum) } - // Give it some time to connect with peers - time.Sleep(3 * time.Second) - for !ethereum.IsUpToDate() { - time.Sleep(5 * time.Second) - } gminer.Start() }() RegisterInterrupt(func(os.Signal) { -- cgit v1.2.3 From d9b16c1197f607a52ad62c71425b690bee973c3f Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:29:05 +0000 Subject: new cli options - nat UPNP|PMP - gateway for PMP NAT - obsolete usepnp - add pubkey to client identity --- cmd/ethereum/flags.go | 6 ++++-- cmd/ethereum/main.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 783944cf2..0bea73794 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -38,7 +38,8 @@ var ( StartRpc bool StartWebSockets bool RpcPort int - UseUPnP bool + NatType string + PMPGateway string OutboundPort string ShowGenesis bool AddPeer string @@ -84,7 +85,8 @@ func Init() { flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use") flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") flag.StringVar(&OutboundPort, "port", "30303", "listening port") - flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") + flag.StringVar(&NatType, "nat", "", "nat support (UPNP|PMP)") + flag.StringVar(&PMPGateway, "gateway", "", "PMP gateway IP") flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 43551fb3a..4f87ef17b 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -69,9 +69,9 @@ func main() { // create, import, export keys utils.KeyTasks(keyManager, KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive) - clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier) + clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier, string(keyManager.PublicKey())) - ethereum := utils.NewEthereum(db, clientIdentity, keyManager, UseUPnP, OutboundPort, MaxPeer) + ethereum := utils.NewEthereum(db, clientIdentity, keyManager, utils.NatType(NatType, PMPGateway), OutboundPort, MaxPeer) if Dump { var block *types.Block -- cgit v1.2.3 From 7d02c4fdb7abc6c35f9b9c593cbbfc524d92f6e0 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:37:03 +0000 Subject: remove old ethereum/p2p related top level files --- block_pool.go | 351 ----------------------- ethereum | Bin 0 -> 16025932 bytes ethereum.go | 659 ------------------------------------------- events.go | 11 - nat.go | 12 - natpmp.go | 55 ---- natupnp.go | 338 ---------------------- peer.go | 881 ---------------------------------------------------------- 8 files changed, 2307 deletions(-) delete mode 100644 block_pool.go create mode 100755 ethereum delete mode 100644 ethereum.go delete mode 100644 events.go delete mode 100644 nat.go delete mode 100644 natpmp.go delete mode 100644 natupnp.go delete mode 100644 peer.go diff --git a/block_pool.go b/block_pool.go deleted file mode 100644 index 803927f21..000000000 --- a/block_pool.go +++ /dev/null @@ -1,351 +0,0 @@ -package eth - -import ( - "bytes" - "container/list" - "fmt" - "math" - "math/big" - "sync" - "time" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/wire" -) - -var poollogger = logger.NewLogger("BPOOL") - -type block struct { - from *Peer - peer *Peer - block *types.Block - reqAt time.Time - requested int -} - -type BlockPool struct { - mut sync.Mutex - - eth *Ethereum - - hashes [][]byte - pool map[string]*block - - td *big.Int - quit chan bool - - fetchingHashes bool - downloadStartedAt time.Time - - ChainLength, BlocksProcessed int - - peer *Peer -} - -func NewBlockPool(eth *Ethereum) *BlockPool { - return &BlockPool{ - eth: eth, - pool: make(map[string]*block), - td: ethutil.Big0, - quit: make(chan bool), - } -} - -func (self *BlockPool) Len() int { - return len(self.hashes) -} - -func (self *BlockPool) Reset() { - self.pool = make(map[string]*block) - self.hashes = nil -} - -func (self *BlockPool) HasLatestHash() bool { - self.mut.Lock() - defer self.mut.Unlock() - - return self.pool[string(self.eth.ChainManager().CurrentBlock.Hash())] != nil -} - -func (self *BlockPool) HasCommonHash(hash []byte) bool { - return self.eth.ChainManager().GetBlock(hash) != nil -} - -func (self *BlockPool) Blocks() (blocks types.Blocks) { - for _, item := range self.pool { - if item.block != nil { - blocks = append(blocks, item.block) - } - } - - return -} - -func (self *BlockPool) FetchHashes(peer *Peer) bool { - highestTd := self.eth.HighestTDPeer() - - if (self.peer == nil && peer.td.Cmp(highestTd) >= 0) || (self.peer != nil && peer.td.Cmp(self.peer.td) > 0) || self.peer == peer { - if self.peer != peer { - poollogger.Infof("Found better suitable peer (%v vs %v)\n", self.td, peer.td) - - if self.peer != nil { - self.peer.doneFetchingHashes = true - } - } - - self.peer = peer - self.td = peer.td - - if !self.HasLatestHash() { - self.fetchHashes() - } - - return true - } - - return false -} - -func (self *BlockPool) fetchHashes() { - peer := self.peer - - peer.doneFetchingHashes = false - - const amount = 256 - peerlogger.Debugf("Fetching hashes (%d) %x...\n", amount, peer.lastReceivedHash[0:4]) - peer.QueueMessage(wire.NewMessage(wire.MsgGetBlockHashesTy, []interface{}{peer.lastReceivedHash, uint32(amount)})) -} - -func (self *BlockPool) AddHash(hash []byte, peer *Peer) { - self.mut.Lock() - defer self.mut.Unlock() - - if self.pool[string(hash)] == nil { - self.pool[string(hash)] = &block{peer, nil, nil, time.Now(), 0} - - self.hashes = append([][]byte{hash}, self.hashes...) - } -} - -func (self *BlockPool) Add(b *types.Block, peer *Peer) { - self.addBlock(b, peer, false) -} - -func (self *BlockPool) AddNew(b *types.Block, peer *Peer) { - self.addBlock(b, peer, true) -} - -func (self *BlockPool) addBlock(b *types.Block, peer *Peer, newBlock bool) { - self.mut.Lock() - defer self.mut.Unlock() - - hash := string(b.Hash()) - - if self.pool[hash] == nil && !self.eth.ChainManager().HasBlock(b.Hash()) { - poollogger.Infof("Got unrequested block (%x...)\n", hash[0:4]) - - self.hashes = append(self.hashes, b.Hash()) - self.pool[hash] = &block{peer, peer, b, time.Now(), 0} - - // The following is only performed on an unrequested new block - if newBlock { - fmt.Println("1.", !self.eth.ChainManager().HasBlock(b.PrevHash), ethutil.Bytes2Hex(b.Hash()[0:4]), ethutil.Bytes2Hex(b.PrevHash[0:4])) - fmt.Println("2.", self.pool[string(b.PrevHash)] == nil) - fmt.Println("3.", !self.fetchingHashes) - if !self.eth.ChainManager().HasBlock(b.PrevHash) /*&& self.pool[string(b.PrevHash)] == nil*/ && !self.fetchingHashes { - poollogger.Infof("Unknown chain, requesting (%x...)\n", b.PrevHash[0:4]) - peer.QueueMessage(wire.NewMessage(wire.MsgGetBlockHashesTy, []interface{}{b.Hash(), uint32(256)})) - } - } - } else if self.pool[hash] != nil { - self.pool[hash].block = b - } - - self.BlocksProcessed++ -} - -func (self *BlockPool) Remove(hash []byte) { - self.mut.Lock() - defer self.mut.Unlock() - - self.hashes = ethutil.DeleteFromByteSlice(self.hashes, hash) - delete(self.pool, string(hash)) -} - -func (self *BlockPool) DistributeHashes() { - self.mut.Lock() - defer self.mut.Unlock() - - var ( - peerLen = self.eth.peers.Len() - amount = 256 * peerLen - dist = make(map[*Peer][][]byte) - ) - - num := int(math.Min(float64(amount), float64(len(self.pool)))) - for i, j := 0, 0; i < len(self.hashes) && j < num; i++ { - hash := self.hashes[i] - item := self.pool[string(hash)] - - if item != nil && item.block == nil { - var peer *Peer - lastFetchFailed := time.Since(item.reqAt) > 5*time.Second - - // Handle failed requests - if lastFetchFailed && item.requested > 5 && item.peer != nil { - if item.requested < 100 { - // Select peer the hash was retrieved off - peer = item.from - } else { - // Remove it - self.hashes = ethutil.DeleteFromByteSlice(self.hashes, hash) - delete(self.pool, string(hash)) - } - } else if lastFetchFailed || item.peer == nil { - // Find a suitable, available peer - eachPeer(self.eth.peers, func(p *Peer, v *list.Element) { - if peer == nil && len(dist[p]) < amount/peerLen && p.statusKnown { - peer = p - } - }) - } - - if peer != nil { - item.reqAt = time.Now() - item.peer = peer - item.requested++ - - dist[peer] = append(dist[peer], hash) - } - } - } - - for peer, hashes := range dist { - peer.FetchBlocks(hashes) - } - - if len(dist) > 0 { - self.downloadStartedAt = time.Now() - } -} - -func (self *BlockPool) Start() { - go self.downloadThread() - go self.chainThread() -} - -func (self *BlockPool) Stop() { - close(self.quit) -} - -func (self *BlockPool) downloadThread() { - serviceTimer := time.NewTicker(100 * time.Millisecond) -out: - for { - select { - case <-self.quit: - break out - case <-serviceTimer.C: - // Check if we're catching up. If not distribute the hashes to - // the peers and download the blockchain - self.fetchingHashes = false - eachPeer(self.eth.peers, func(p *Peer, v *list.Element) { - if p.statusKnown && p.FetchingHashes() { - self.fetchingHashes = true - } - }) - - if len(self.hashes) > 0 { - self.DistributeHashes() - } - - if self.ChainLength < len(self.hashes) { - self.ChainLength = len(self.hashes) - } - - if self.peer != nil && - !self.peer.doneFetchingHashes && - time.Since(self.peer.lastHashAt) > 10*time.Second && - time.Since(self.peer.lastHashRequestedAt) > 5*time.Second { - self.fetchHashes() - } - - /* - if !self.fetchingHashes { - blocks := self.Blocks() - chain.BlockBy(chain.Number).Sort(blocks) - - if len(blocks) > 0 { - if !self.eth.ChainManager().HasBlock(b.PrevHash) && self.pool[string(b.PrevHash)] == nil && !self.fetchingHashes { - } - } - } - */ - } - } -} - -func (self *BlockPool) chainThread() { - procTimer := time.NewTicker(500 * time.Millisecond) -out: - for { - select { - case <-self.quit: - break out - case <-procTimer.C: - blocks := self.Blocks() - types.BlockBy(types.Number).Sort(blocks) - - // Find common block - for i, block := range blocks { - if self.eth.ChainManager().HasBlock(block.PrevHash) { - blocks = blocks[i:] - break - } - } - - if len(blocks) > 0 { - if self.eth.ChainManager().HasBlock(blocks[0].PrevHash) { - for i, block := range blocks[1:] { - // NOTE: The Ith element in this loop refers to the previous block in - // outer "blocks" - if bytes.Compare(block.PrevHash, blocks[i].Hash()) != 0 { - blocks = blocks[:i] - - break - } - } - } else { - blocks = nil - } - } - - if len(blocks) > 0 { - chainman := self.eth.ChainManager() - - err := chainman.InsertChain(blocks) - if err != nil { - poollogger.Debugln(err) - - self.Reset() - - if self.peer != nil && self.peer.conn != nil { - poollogger.Debugf("Punishing peer for supplying bad chain (%v)\n", self.peer.conn.RemoteAddr()) - } - - // This peer gave us bad hashes and made us fetch a bad chain, therefor he shall be punished. - self.eth.BlacklistPeer(self.peer) - self.peer.StopWithReason(DiscBadPeer) - self.td = ethutil.Big0 - self.peer = nil - } - - for _, block := range blocks { - self.Remove(block.Hash()) - } - } - } - } -} diff --git a/ethereum b/ethereum new file mode 100755 index 000000000..7e17d95a4 Binary files /dev/null and b/ethereum differ diff --git a/ethereum.go b/ethereum.go deleted file mode 100644 index e8b1a9500..000000000 --- a/ethereum.go +++ /dev/null @@ -1,659 +0,0 @@ -package eth - -import ( - "container/list" - "encoding/json" - "fmt" - "math/big" - "math/rand" - "net" - "path" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/wire" -) - -const ( - seedTextFileUri string = "http://www.ethereum.org/servers.poc3.txt" - seedNodeAddress = "poc-7.ethdev.com:30303" -) - -var loggerger = logger.NewLogger("SERV") - -func eachPeer(peers *list.List, callback func(*Peer, *list.Element)) { - // Loop thru the peers and close them (if we had them) - for e := peers.Front(); e != nil; e = e.Next() { - callback(e.Value.(*Peer), e) - } -} - -const ( - processReapingTimeout = 60 // TODO increase -) - -type Ethereum struct { - // Channel for shutting down the ethereum - shutdownChan chan bool - quit chan bool - - // DB interface - db ethutil.Database - // State manager for processing new blocks and managing the over all states - blockManager *core.BlockManager - // The transaction pool. Transaction can be pushed on this pool - // for later including in the blocks - txPool *core.TxPool - // The canonical chain - blockChain *core.ChainManager - // The block pool - blockPool *BlockPool - // Eventer - eventMux event.TypeMux - // Peers - peers *list.List - // Nonce - Nonce uint64 - - Addr net.Addr - Port string - - blacklist [][]byte - - peerMut sync.Mutex - - // Capabilities for outgoing peers - serverCaps Caps - - nat NAT - - // Specifies the desired amount of maximum peers - MaxPeers int - - Mining bool - - listening bool - - RpcServer *rpc.JsonRpcServer - - keyManager *crypto.KeyManager - - clientIdentity wire.ClientIdentity - - isUpToDate bool - - filterMu sync.RWMutex - filterId int - filters map[int]*core.Filter -} - -func New(db ethutil.Database, clientIdentity wire.ClientIdentity, keyManager *crypto.KeyManager, caps Caps, usePnp bool) (*Ethereum, error) { - var err error - var nat NAT - - if usePnp { - nat, err = Discover() - if err != nil { - loggerger.Debugln("UPnP failed", err) - } - } - - bootstrapDb(db) - - ethutil.Config.Db = db - - nonce, _ := ethutil.RandomUint64() - ethereum := &Ethereum{ - shutdownChan: make(chan bool), - quit: make(chan bool), - db: db, - peers: list.New(), - Nonce: nonce, - serverCaps: caps, - nat: nat, - keyManager: keyManager, - clientIdentity: clientIdentity, - isUpToDate: true, - filters: make(map[int]*core.Filter), - } - - ethereum.blockPool = NewBlockPool(ethereum) - ethereum.txPool = core.NewTxPool(ethereum) - ethereum.blockChain = core.NewChainManager(ethereum.EventMux()) - ethereum.blockManager = core.NewBlockManager(ethereum) - ethereum.blockChain.SetProcessor(ethereum.blockManager) - - // Start the tx pool - ethereum.txPool.Start() - - return ethereum, nil -} - -func (s *Ethereum) KeyManager() *crypto.KeyManager { - return s.keyManager -} - -func (s *Ethereum) ClientIdentity() wire.ClientIdentity { - return s.clientIdentity -} - -func (s *Ethereum) ChainManager() *core.ChainManager { - return s.blockChain -} - -func (s *Ethereum) BlockManager() *core.BlockManager { - return s.blockManager -} - -func (s *Ethereum) TxPool() *core.TxPool { - return s.txPool -} -func (s *Ethereum) BlockPool() *BlockPool { - return s.blockPool -} -func (s *Ethereum) EventMux() *event.TypeMux { - return &s.eventMux -} -func (self *Ethereum) Db() ethutil.Database { - return self.db -} - -func (s *Ethereum) ServerCaps() Caps { - return s.serverCaps -} -func (s *Ethereum) IsMining() bool { - return s.Mining -} -func (s *Ethereum) PeerCount() int { - return s.peers.Len() -} -func (s *Ethereum) IsUpToDate() bool { - upToDate := true - eachPeer(s.peers, func(peer *Peer, e *list.Element) { - if atomic.LoadInt32(&peer.connected) == 1 { - if peer.catchingUp == true && peer.versionKnown { - upToDate = false - } - } - }) - return upToDate -} -func (s *Ethereum) PushPeer(peer *Peer) { - s.peers.PushBack(peer) -} -func (s *Ethereum) IsListening() bool { - return s.listening -} - -func (s *Ethereum) HighestTDPeer() (td *big.Int) { - td = big.NewInt(0) - - eachPeer(s.peers, func(p *Peer, v *list.Element) { - if p.td.Cmp(td) > 0 { - td = p.td - } - }) - - return -} - -func (self *Ethereum) BlacklistPeer(peer *Peer) { - self.blacklist = append(self.blacklist, peer.pubkey) -} - -func (s *Ethereum) AddPeer(conn net.Conn) { - peer := NewPeer(conn, s, true) - - if peer != nil { - if s.peers.Len() < s.MaxPeers { - peer.Start() - } else { - loggerger.Debugf("Max connected peers reached. Not adding incoming peer.") - } - } -} - -func (s *Ethereum) ProcessPeerList(addrs []string) { - for _, addr := range addrs { - // TODO Probably requires some sanity checks - s.ConnectToPeer(addr) - } -} - -func (s *Ethereum) ConnectToPeer(addr string) error { - if s.peers.Len() < s.MaxPeers { - var alreadyConnected bool - - ahost, aport, _ := net.SplitHostPort(addr) - var chost string - - ips, err := net.LookupIP(ahost) - - if err != nil { - return err - } else { - // If more then one ip is available try stripping away the ipv6 ones - if len(ips) > 1 { - var ipsv4 []net.IP - // For now remove the ipv6 addresses - for _, ip := range ips { - if strings.Contains(ip.String(), "::") { - continue - } else { - ipsv4 = append(ipsv4, ip) - } - } - if len(ipsv4) == 0 { - return fmt.Errorf("[SERV] No IPV4 addresses available for hostname") - } - - // Pick a random ipv4 address, simulating round-robin DNS. - rand.Seed(time.Now().UTC().UnixNano()) - i := rand.Intn(len(ipsv4)) - chost = ipsv4[i].String() - } else { - if len(ips) == 0 { - return fmt.Errorf("[SERV] No IPs resolved for the given hostname") - return nil - } - chost = ips[0].String() - } - } - - eachPeer(s.peers, func(p *Peer, v *list.Element) { - if p.conn == nil { - return - } - phost, pport, _ := net.SplitHostPort(p.conn.RemoteAddr().String()) - - if phost == chost && pport == aport { - alreadyConnected = true - //loggerger.Debugf("Peer %s already added.\n", chost) - return - } - }) - - if alreadyConnected { - return nil - } - - NewOutboundPeer(addr, s, s.serverCaps) - } - - return nil -} - -func (s *Ethereum) OutboundPeers() []*Peer { - // Create a new peer slice with at least the length of the total peers - outboundPeers := make([]*Peer, s.peers.Len()) - length := 0 - eachPeer(s.peers, func(p *Peer, e *list.Element) { - if !p.inbound && p.conn != nil { - outboundPeers[length] = p - length++ - } - }) - - return outboundPeers[:length] -} - -func (s *Ethereum) InboundPeers() []*Peer { - // Create a new peer slice with at least the length of the total peers - inboundPeers := make([]*Peer, s.peers.Len()) - length := 0 - eachPeer(s.peers, func(p *Peer, e *list.Element) { - if p.inbound { - inboundPeers[length] = p - length++ - } - }) - - return inboundPeers[:length] -} - -func (s *Ethereum) InOutPeers() []*Peer { - // Reap the dead peers first - s.reapPeers() - - // Create a new peer slice with at least the length of the total peers - inboundPeers := make([]*Peer, s.peers.Len()) - length := 0 - eachPeer(s.peers, func(p *Peer, e *list.Element) { - // Only return peers with an actual ip - if len(p.host) > 0 { - inboundPeers[length] = p - length++ - } - }) - - return inboundPeers[:length] -} - -func (s *Ethereum) Broadcast(msgType wire.MsgType, data []interface{}) { - msg := wire.NewMessage(msgType, data) - s.BroadcastMsg(msg) -} - -func (s *Ethereum) BroadcastMsg(msg *wire.Msg) { - eachPeer(s.peers, func(p *Peer, e *list.Element) { - p.QueueMessage(msg) - }) -} - -func (s *Ethereum) Peers() *list.List { - return s.peers -} - -func (s *Ethereum) reapPeers() { - eachPeer(s.peers, func(p *Peer, e *list.Element) { - if atomic.LoadInt32(&p.disconnect) == 1 || (p.inbound && (time.Now().Unix()-p.lastPong) > int64(5*time.Minute)) { - s.removePeerElement(e) - } - }) -} - -func (s *Ethereum) removePeerElement(e *list.Element) { - s.peerMut.Lock() - defer s.peerMut.Unlock() - - s.peers.Remove(e) - - s.eventMux.Post(PeerListEvent{s.peers}) -} - -func (s *Ethereum) RemovePeer(p *Peer) { - eachPeer(s.peers, func(peer *Peer, e *list.Element) { - if peer == p { - s.removePeerElement(e) - } - }) -} - -func (s *Ethereum) reapDeadPeerHandler() { - reapTimer := time.NewTicker(processReapingTimeout * time.Second) - - for { - select { - case <-reapTimer.C: - s.reapPeers() - } - } -} - -// Start the ethereum -func (s *Ethereum) Start(seed bool) { - s.blockPool.Start() - - // Bind to addr and port - ln, err := net.Listen("tcp", ":"+s.Port) - if err != nil { - loggerger.Warnf("Port %s in use. Connection listening disabled. Acting as client", s.Port) - s.listening = false - } else { - s.listening = true - // Starting accepting connections - loggerger.Infoln("Ready and accepting connections") - // Start the peer handler - go s.peerHandler(ln) - } - - if s.nat != nil { - go s.upnpUpdateThread() - } - - // Start the reaping processes - go s.reapDeadPeerHandler() - go s.update() - go s.filterLoop() - - if seed { - s.Seed() - } - s.ConnectToPeer("localhost:40404") - loggerger.Infoln("Server started") -} - -func (s *Ethereum) Seed() { - // Sorry Py person. I must blacklist. you perform badly - s.blacklist = append(s.blacklist, ethutil.Hex2Bytes("64656330303561383532336435376331616537643864663236623336313863373537353163636634333530626263396330346237336262623931383064393031")) - ips := PastPeers() - if len(ips) > 0 { - for _, ip := range ips { - loggerger.Infoln("Connecting to previous peer ", ip) - s.ConnectToPeer(ip) - } - } else { - loggerger.Debugln("Retrieving seed nodes") - - // Eth-Go Bootstrapping - ips, er := net.LookupIP("seed.bysh.me") - if er == nil { - peers := []string{} - for _, ip := range ips { - node := fmt.Sprintf("%s:%d", ip.String(), 30303) - loggerger.Debugln("Found DNS Go Peer:", node) - peers = append(peers, node) - } - s.ProcessPeerList(peers) - } - - // Official DNS Bootstrapping - _, nodes, err := net.LookupSRV("eth", "tcp", "ethereum.org") - if err == nil { - peers := []string{} - // Iterate SRV nodes - for _, n := range nodes { - target := n.Target - port := strconv.Itoa(int(n.Port)) - // Resolve target to ip (Go returns list, so may resolve to multiple ips?) - addr, err := net.LookupHost(target) - if err == nil { - for _, a := range addr { - // Build string out of SRV port and Resolved IP - peer := net.JoinHostPort(a, port) - loggerger.Debugln("Found DNS Bootstrap Peer:", peer) - peers = append(peers, peer) - } - } else { - loggerger.Debugln("Couldn't resolve :", target) - } - } - // Connect to Peer list - s.ProcessPeerList(peers) - } - - s.ConnectToPeer(seedNodeAddress) - } -} - -func (s *Ethereum) peerHandler(listener net.Listener) { - for { - conn, err := listener.Accept() - if err != nil { - loggerger.Debugln(err) - - continue - } - - go s.AddPeer(conn) - } -} - -func (s *Ethereum) Stop() { - // Stop eventMux first, it will close all subscriptions. - s.eventMux.Stop() - - // Close the database - defer s.db.Close() - - var ips []string - eachPeer(s.peers, func(p *Peer, e *list.Element) { - ips = append(ips, p.conn.RemoteAddr().String()) - }) - - if len(ips) > 0 { - d, _ := json.MarshalIndent(ips, "", " ") - ethutil.WriteFile(path.Join(ethutil.Config.ExecPath, "known_peers.json"), d) - } - - eachPeer(s.peers, func(p *Peer, e *list.Element) { - p.Stop() - }) - - close(s.quit) - - if s.RpcServer != nil { - s.RpcServer.Stop() - } - s.txPool.Stop() - s.blockPool.Stop() - - loggerger.Infoln("Server stopped") - close(s.shutdownChan) -} - -// This function will wait for a shutdown and resumes main thread execution -func (s *Ethereum) WaitForShutdown() { - <-s.shutdownChan -} - -func (s *Ethereum) upnpUpdateThread() { - // Go off immediately to prevent code duplication, thereafter we renew - // lease every 15 minutes. - timer := time.NewTimer(5 * time.Minute) - lport, _ := strconv.ParseInt(s.Port, 10, 16) - first := true -out: - for { - select { - case <-timer.C: - var err error - _, err = s.nat.AddPortMapping("TCP", int(lport), int(lport), "eth listen port", 20*60) - if err != nil { - loggerger.Debugln("can't add UPnP port mapping:", err) - break out - } - if first && err == nil { - _, err = s.nat.GetExternalAddress() - if err != nil { - loggerger.Debugln("UPnP can't get external address:", err) - continue out - } - first = false - } - timer.Reset(time.Minute * 15) - case <-s.quit: - break out - } - } - - timer.Stop() - - if err := s.nat.DeletePortMapping("TCP", int(lport), int(lport)); err != nil { - loggerger.Debugln("unable to remove UPnP port mapping:", err) - } else { - loggerger.Debugln("succesfully disestablished UPnP port mapping") - } -} - -func (self *Ethereum) update() { - upToDateTimer := time.NewTicker(1 * time.Second) - -out: - for { - select { - case <-upToDateTimer.C: - if self.IsUpToDate() && !self.isUpToDate { - self.eventMux.Post(ChainSyncEvent{false}) - self.isUpToDate = true - } else if !self.IsUpToDate() && self.isUpToDate { - self.eventMux.Post(ChainSyncEvent{true}) - self.isUpToDate = false - } - case <-self.quit: - break out - } - } -} - -// InstallFilter adds filter for blockchain events. -// The filter's callbacks will run for matching blocks and messages. -// The filter should not be modified after it has been installed. -func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { - self.filterMu.Lock() - id = self.filterId - self.filters[id] = filter - self.filterId++ - self.filterMu.Unlock() - return id -} - -func (self *Ethereum) UninstallFilter(id int) { - self.filterMu.Lock() - delete(self.filters, id) - self.filterMu.Unlock() -} - -// GetFilter retrieves a filter installed using InstallFilter. -// The filter may not be modified. -func (self *Ethereum) GetFilter(id int) *core.Filter { - self.filterMu.RLock() - defer self.filterMu.RUnlock() - return self.filters[id] -} - -func (self *Ethereum) filterLoop() { - // Subscribe to events - events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Messages(nil)) - for event := range events.Chan() { - switch event := event.(type) { - case core.NewBlockEvent: - self.filterMu.RLock() - for _, filter := range self.filters { - if filter.BlockCallback != nil { - filter.BlockCallback(event.Block) - } - } - self.filterMu.RUnlock() - - case state.Messages: - self.filterMu.RLock() - for _, filter := range self.filters { - if filter.MessageCallback != nil { - msgs := filter.FilterMessages(event) - if len(msgs) > 0 { - filter.MessageCallback(msgs) - } - } - } - self.filterMu.RUnlock() - } - } -} - -func bootstrapDb(db ethutil.Database) { - d, _ := db.Get([]byte("ProtocolVersion")) - protov := ethutil.NewValue(d).Uint() - - if protov == 0 { - db.Put([]byte("ProtocolVersion"), ethutil.NewValue(ProtocolVersion).Bytes()) - } -} - -func PastPeers() []string { - var ips []string - data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "known_peers.json")) - json.Unmarshal([]byte(data), &ips) - - return ips -} diff --git a/events.go b/events.go deleted file mode 100644 index 5fff1d831..000000000 --- a/events.go +++ /dev/null @@ -1,11 +0,0 @@ -package eth - -import "container/list" - -type PeerListEvent struct { - Peers *list.List -} - -type ChainSyncEvent struct { - InSync bool -} diff --git a/nat.go b/nat.go deleted file mode 100644 index 999308eb2..000000000 --- a/nat.go +++ /dev/null @@ -1,12 +0,0 @@ -package eth - -import ( - "net" -) - -// protocol is either "udp" or "tcp" -type NAT interface { - GetExternalAddress() (addr net.IP, err error) - AddPortMapping(protocol string, externalPort, internalPort int, description string, timeout int) (mappedExternalPort int, err error) - DeletePortMapping(protocol string, externalPort, internalPort int) (err error) -} diff --git a/natpmp.go b/natpmp.go deleted file mode 100644 index 489342a4b..000000000 --- a/natpmp.go +++ /dev/null @@ -1,55 +0,0 @@ -package eth - -import ( - "fmt" - "net" - - natpmp "github.com/jackpal/go-nat-pmp" -) - -// Adapt the NAT-PMP protocol to the NAT interface - -// TODO: -// + Register for changes to the external address. -// + Re-register port mapping when router reboots. -// + A mechanism for keeping a port mapping registered. - -type natPMPClient struct { - client *natpmp.Client -} - -func NewNatPMP(gateway net.IP) (nat NAT) { - return &natPMPClient{natpmp.NewClient(gateway)} -} - -func (n *natPMPClient) GetExternalAddress() (addr net.IP, err error) { - response, err := n.client.GetExternalAddress() - if err != nil { - return - } - ip := response.ExternalIPAddress - addr = net.IPv4(ip[0], ip[1], ip[2], ip[3]) - return -} - -func (n *natPMPClient) AddPortMapping(protocol string, externalPort, internalPort int, - description string, timeout int) (mappedExternalPort int, err error) { - if timeout <= 0 { - err = fmt.Errorf("timeout must not be <= 0") - return - } - // Note order of port arguments is switched between our AddPortMapping and the client's AddPortMapping. - response, err := n.client.AddPortMapping(protocol, internalPort, externalPort, timeout) - if err != nil { - return - } - mappedExternalPort = int(response.MappedExternalPort) - return -} - -func (n *natPMPClient) DeletePortMapping(protocol string, externalPort, internalPort int) (err error) { - // To destroy a mapping, send an add-port with - // an internalPort of the internal port to destroy, an external port of zero and a time of zero. - _, err = n.client.AddPortMapping(protocol, internalPort, 0, 0) - return -} diff --git a/natupnp.go b/natupnp.go deleted file mode 100644 index c7f9eeb62..000000000 --- a/natupnp.go +++ /dev/null @@ -1,338 +0,0 @@ -package eth - -// Just enough UPnP to be able to forward ports -// - -import ( - "bytes" - "encoding/xml" - "errors" - "net" - "net/http" - "os" - "strconv" - "strings" - "time" -) - -type upnpNAT struct { - serviceURL string - ourIP string -} - -func Discover() (nat NAT, err error) { - ssdp, err := net.ResolveUDPAddr("udp4", "239.255.255.250:1900") - if err != nil { - return - } - conn, err := net.ListenPacket("udp4", ":0") - if err != nil { - return - } - socket := conn.(*net.UDPConn) - defer socket.Close() - - err = socket.SetDeadline(time.Now().Add(10 * time.Second)) - if err != nil { - return - } - - st := "ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n" - buf := bytes.NewBufferString( - "M-SEARCH * HTTP/1.1\r\n" + - "HOST: 239.255.255.250:1900\r\n" + - st + - "MAN: \"ssdp:discover\"\r\n" + - "MX: 2\r\n\r\n") - message := buf.Bytes() - answerBytes := make([]byte, 1024) - for i := 0; i < 3; i++ { - _, err = socket.WriteToUDP(message, ssdp) - if err != nil { - return - } - var n int - n, _, err = socket.ReadFromUDP(answerBytes) - if err != nil { - continue - // socket.Close() - // return - } - answer := string(answerBytes[0:n]) - if strings.Index(answer, "\r\n"+st) < 0 { - continue - } - // HTTP header field names are case-insensitive. - // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 - locString := "\r\nlocation: " - answer = strings.ToLower(answer) - locIndex := strings.Index(answer, locString) - if locIndex < 0 { - continue - } - loc := answer[locIndex+len(locString):] - endIndex := strings.Index(loc, "\r\n") - if endIndex < 0 { - continue - } - locURL := loc[0:endIndex] - var serviceURL string - serviceURL, err = getServiceURL(locURL) - if err != nil { - return - } - var ourIP string - ourIP, err = getOurIP() - if err != nil { - return - } - nat = &upnpNAT{serviceURL: serviceURL, ourIP: ourIP} - return - } - err = errors.New("UPnP port discovery failed.") - return -} - -// service represents the Service type in an UPnP xml description. -// Only the parts we care about are present and thus the xml may have more -// fields than present in the structure. -type service struct { - ServiceType string `xml:"serviceType"` - ControlURL string `xml:"controlURL"` -} - -// deviceList represents the deviceList type in an UPnP xml description. -// Only the parts we care about are present and thus the xml may have more -// fields than present in the structure. -type deviceList struct { - XMLName xml.Name `xml:"deviceList"` - Device []device `xml:"device"` -} - -// serviceList represents the serviceList type in an UPnP xml description. -// Only the parts we care about are present and thus the xml may have more -// fields than present in the structure. -type serviceList struct { - XMLName xml.Name `xml:"serviceList"` - Service []service `xml:"service"` -} - -// device represents the device type in an UPnP xml description. -// Only the parts we care about are present and thus the xml may have more -// fields than present in the structure. -type device struct { - XMLName xml.Name `xml:"device"` - DeviceType string `xml:"deviceType"` - DeviceList deviceList `xml:"deviceList"` - ServiceList serviceList `xml:"serviceList"` -} - -// specVersion represents the specVersion in a UPnP xml description. -// Only the parts we care about are present and thus the xml may have more -// fields than present in the structure. -type specVersion struct { - XMLName xml.Name `xml:"specVersion"` - Major int `xml:"major"` - Minor int `xml:"minor"` -} - -// root represents the Root document for a UPnP xml description. -// Only the parts we care about are present and thus the xml may have more -// fields than present in the structure. -type root struct { - XMLName xml.Name `xml:"root"` - SpecVersion specVersion - Device device -} - -func getChildDevice(d *device, deviceType string) *device { - dl := d.DeviceList.Device - for i := 0; i < len(dl); i++ { - if dl[i].DeviceType == deviceType { - return &dl[i] - } - } - return nil -} - -func getChildService(d *device, serviceType string) *service { - sl := d.ServiceList.Service - for i := 0; i < len(sl); i++ { - if sl[i].ServiceType == serviceType { - return &sl[i] - } - } - return nil -} - -func getOurIP() (ip string, err error) { - hostname, err := os.Hostname() - if err != nil { - return - } - p, err := net.LookupIP(hostname) - if err != nil && len(p) > 0 { - return - } - return p[0].String(), nil -} - -func getServiceURL(rootURL string) (url string, err error) { - r, err := http.Get(rootURL) - if err != nil { - return - } - defer r.Body.Close() - if r.StatusCode >= 400 { - err = errors.New(string(r.StatusCode)) - return - } - var root root - err = xml.NewDecoder(r.Body).Decode(&root) - - if err != nil { - return - } - a := &root.Device - if a.DeviceType != "urn:schemas-upnp-org:device:InternetGatewayDevice:1" { - err = errors.New("No InternetGatewayDevice") - return - } - b := getChildDevice(a, "urn:schemas-upnp-org:device:WANDevice:1") - if b == nil { - err = errors.New("No WANDevice") - return - } - c := getChildDevice(b, "urn:schemas-upnp-org:device:WANConnectionDevice:1") - if c == nil { - err = errors.New("No WANConnectionDevice") - return - } - d := getChildService(c, "urn:schemas-upnp-org:service:WANIPConnection:1") - if d == nil { - err = errors.New("No WANIPConnection") - return - } - url = combineURL(rootURL, d.ControlURL) - return -} - -func combineURL(rootURL, subURL string) string { - protocolEnd := "://" - protoEndIndex := strings.Index(rootURL, protocolEnd) - a := rootURL[protoEndIndex+len(protocolEnd):] - rootIndex := strings.Index(a, "/") - return rootURL[0:protoEndIndex+len(protocolEnd)+rootIndex] + subURL -} - -func soapRequest(url, function, message string) (r *http.Response, err error) { - fullMessage := "" + - "\r\n" + - "" + message + "" - - req, err := http.NewRequest("POST", url, strings.NewReader(fullMessage)) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", "text/xml ; charset=\"utf-8\"") - req.Header.Set("User-Agent", "Darwin/10.0.0, UPnP/1.0, MiniUPnPc/1.3") - //req.Header.Set("Transfer-Encoding", "chunked") - req.Header.Set("SOAPAction", "\"urn:schemas-upnp-org:service:WANIPConnection:1#"+function+"\"") - req.Header.Set("Connection", "Close") - req.Header.Set("Cache-Control", "no-cache") - req.Header.Set("Pragma", "no-cache") - - // log.Stderr("soapRequest ", req) - //fmt.Println(fullMessage) - - r, err = http.DefaultClient.Do(req) - if err != nil { - return - } - - if r.Body != nil { - defer r.Body.Close() - } - - if r.StatusCode >= 400 { - // log.Stderr(function, r.StatusCode) - err = errors.New("Error " + strconv.Itoa(r.StatusCode) + " for " + function) - r = nil - return - } - return -} - -type statusInfo struct { - externalIpAddress string -} - -func (n *upnpNAT) getStatusInfo() (info statusInfo, err error) { - - message := "\r\n" + - "" - - var response *http.Response - response, err = soapRequest(n.serviceURL, "GetStatusInfo", message) - if err != nil { - return - } - - // TODO: Write a soap reply parser. It has to eat the Body and envelope tags... - - response.Body.Close() - return -} - -func (n *upnpNAT) GetExternalAddress() (addr net.IP, err error) { - info, err := n.getStatusInfo() - if err != nil { - return - } - addr = net.ParseIP(info.externalIpAddress) - return -} - -func (n *upnpNAT) AddPortMapping(protocol string, externalPort, internalPort int, description string, timeout int) (mappedExternalPort int, err error) { - // A single concatenation would break ARM compilation. - message := "\r\n" + - "" + strconv.Itoa(externalPort) - message += "" + protocol + "" - message += "" + strconv.Itoa(internalPort) + "" + - "" + n.ourIP + "" + - "1" - message += description + - "" + strconv.Itoa(timeout) + - "" - - var response *http.Response - response, err = soapRequest(n.serviceURL, "AddPortMapping", message) - if err != nil { - return - } - - // TODO: check response to see if the port was forwarded - // log.Println(message, response) - mappedExternalPort = externalPort - _ = response - return -} - -func (n *upnpNAT) DeletePortMapping(protocol string, externalPort, internalPort int) (err error) { - - message := "\r\n" + - "" + strconv.Itoa(externalPort) + - "" + protocol + "" + - "" - - var response *http.Response - response, err = soapRequest(n.serviceURL, "DeletePortMapping", message) - if err != nil { - return - } - - // TODO: check response to see if the port was deleted - // log.Println(message, response) - _ = response - return -} diff --git a/peer.go b/peer.go deleted file mode 100644 index 331e9de37..000000000 --- a/peer.go +++ /dev/null @@ -1,881 +0,0 @@ -package eth - -import ( - "bytes" - "container/list" - "fmt" - "math" - "math/big" - "net" - "strconv" - "strings" - "sync/atomic" - "time" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/wire" -) - -var peerlogger = logger.NewLogger("PEER") - -const ( - // The size of the output buffer for writing messages - outputBufferSize = 50 - // Current protocol version - ProtocolVersion = 49 - // Current P2P version - P2PVersion = 2 - // Ethereum network version - NetVersion = 0 - // Interval for ping/pong message - pingPongTimer = 2 * time.Second -) - -type DiscReason byte - -const ( - // Values are given explicitly instead of by iota because these values are - // defined by the wire protocol spec; it is easier for humans to ensure - // correctness when values are explicit. - DiscRequested DiscReason = iota - DiscReTcpSysErr - DiscBadProto - DiscBadPeer - DiscTooManyPeers - DiscConnDup - DiscGenesisErr - DiscProtoErr - DiscQuitting -) - -var discReasonToString = []string{ - "requested", - "TCP sys error", - "bad protocol", - "useless peer", - "too many peers", - "already connected", - "wrong genesis block", - "incompatible network", - "quitting", -} - -func (d DiscReason) String() string { - if len(discReasonToString) < int(d) { - return "Unknown" - } - - return discReasonToString[d] -} - -// Peer capabilities -type Caps byte - -const ( - CapPeerDiscTy Caps = 1 << iota - CapTxTy - CapChainTy - - CapDefault = CapChainTy | CapTxTy | CapPeerDiscTy -) - -var capsToString = map[Caps]string{ - CapPeerDiscTy: "Peer discovery", - CapTxTy: "Transaction relaying", - CapChainTy: "Block chain relaying", -} - -func (c Caps) IsCap(cap Caps) bool { - return c&cap > 0 -} - -func (c Caps) String() string { - var caps []string - if c.IsCap(CapPeerDiscTy) { - caps = append(caps, capsToString[CapPeerDiscTy]) - } - if c.IsCap(CapChainTy) { - caps = append(caps, capsToString[CapChainTy]) - } - if c.IsCap(CapTxTy) { - caps = append(caps, capsToString[CapTxTy]) - } - - return strings.Join(caps, " | ") -} - -type Peer struct { - // Ethereum interface - ethereum *Ethereum - // Net connection - conn net.Conn - // Output queue which is used to communicate and handle messages - outputQueue chan *wire.Msg - // Quit channel - quit chan bool - // Determines whether it's an inbound or outbound peer - inbound bool - // Flag for checking the peer's connectivity state - connected int32 - disconnect int32 - // Last known message send - lastSend time.Time - // Indicated whether a verack has been send or not - // This flag is used by writeMessage to check if messages are allowed - // to be send or not. If no version is known all messages are ignored. - versionKnown bool - statusKnown bool - - // Last received pong message - lastPong int64 - lastBlockReceived time.Time - doneFetchingHashes bool - lastHashAt time.Time - lastHashRequestedAt time.Time - - host []byte - port uint16 - caps Caps - td *big.Int - bestHash []byte - lastReceivedHash []byte - requestedHashes [][]byte - - // This peer's public key - pubkey []byte - - // Indicated whether the node is catching up or not - catchingUp bool - diverted bool - blocksRequested int - - version string - - // We use this to give some kind of pingtime to a node, not very accurate, could be improved. - pingTime time.Duration - pingStartTime time.Time - - lastRequestedBlock *types.Block - - protocolCaps *ethutil.Value -} - -func NewPeer(conn net.Conn, ethereum *Ethereum, inbound bool) *Peer { - pubkey := ethereum.KeyManager().PublicKey()[1:] - - return &Peer{ - outputQueue: make(chan *wire.Msg, outputBufferSize), - quit: make(chan bool), - ethereum: ethereum, - conn: conn, - inbound: inbound, - disconnect: 0, - connected: 1, - port: 30303, - pubkey: pubkey, - blocksRequested: 10, - caps: ethereum.ServerCaps(), - version: ethereum.ClientIdentity().String(), - protocolCaps: ethutil.NewValue(nil), - td: big.NewInt(0), - doneFetchingHashes: true, - } -} - -func NewOutboundPeer(addr string, ethereum *Ethereum, caps Caps) *Peer { - p := &Peer{ - outputQueue: make(chan *wire.Msg, outputBufferSize), - quit: make(chan bool), - ethereum: ethereum, - inbound: false, - connected: 0, - disconnect: 0, - port: 30303, - caps: caps, - version: ethereum.ClientIdentity().String(), - protocolCaps: ethutil.NewValue(nil), - td: big.NewInt(0), - doneFetchingHashes: true, - } - - // Set up the connection in another goroutine so we don't block the main thread - go func() { - conn, err := p.Connect(addr) - if err != nil { - //peerlogger.Debugln("Connection to peer failed. Giving up.", err) - p.Stop() - return - } - p.conn = conn - - // Atomically set the connection state - atomic.StoreInt32(&p.connected, 1) - atomic.StoreInt32(&p.disconnect, 0) - - p.Start() - }() - - return p -} - -func (self *Peer) Connect(addr string) (conn net.Conn, err error) { - const maxTries = 3 - for attempts := 0; attempts < maxTries; attempts++ { - conn, err = net.DialTimeout("tcp", addr, 10*time.Second) - if err != nil { - time.Sleep(time.Duration(attempts*20) * time.Second) - continue - } - - // Success - return - } - - return -} - -// Getters -func (p *Peer) PingTime() string { - return p.pingTime.String() -} -func (p *Peer) Inbound() bool { - return p.inbound -} -func (p *Peer) LastSend() time.Time { - return p.lastSend -} -func (p *Peer) LastPong() int64 { - return p.lastPong -} -func (p *Peer) Host() []byte { - return p.host -} -func (p *Peer) Port() uint16 { - return p.port -} -func (p *Peer) Version() string { - return p.version -} -func (p *Peer) Connected() *int32 { - return &p.connected -} - -// Setters -func (p *Peer) SetVersion(version string) { - p.version = version -} - -// Outputs any RLP encoded data to the peer -func (p *Peer) QueueMessage(msg *wire.Msg) { - if atomic.LoadInt32(&p.connected) != 1 { - return - } - p.outputQueue <- msg -} - -func (p *Peer) writeMessage(msg *wire.Msg) { - // Ignore the write if we're not connected - if atomic.LoadInt32(&p.connected) != 1 { - return - } - - if !p.versionKnown { - switch msg.Type { - case wire.MsgHandshakeTy: // Ok - default: // Anything but ack is allowed - return - } - } else { - /* - if !p.statusKnown { - switch msg.Type { - case wire.MsgStatusTy: // Ok - default: // Anything but ack is allowed - return - } - } - */ - } - - peerlogger.DebugDetailf("(%v) <= %v\n", p.conn.RemoteAddr(), formatMessage(msg)) - - err := wire.WriteMessage(p.conn, msg) - if err != nil { - peerlogger.Debugln(" Can't send message:", err) - // Stop the client if there was an error writing to it - p.Stop() - return - } -} - -// Outbound message handler. Outbound messages are handled here -func (p *Peer) HandleOutbound() { - // The ping timer. Makes sure that every 2 minutes a ping is send to the peer - pingTimer := time.NewTicker(pingPongTimer) - serviceTimer := time.NewTicker(10 * time.Second) - -out: - for { - skip: - select { - // Main message queue. All outbound messages are processed through here - case msg := <-p.outputQueue: - if !p.statusKnown { - switch msg.Type { - case wire.MsgTxTy, wire.MsgGetBlockHashesTy, wire.MsgBlockHashesTy, wire.MsgGetBlocksTy, wire.MsgBlockTy: - break skip - } - } - - switch msg.Type { - case wire.MsgGetBlockHashesTy: - p.lastHashRequestedAt = time.Now() - } - - p.writeMessage(msg) - p.lastSend = time.Now() - - // Ping timer - case <-pingTimer.C: - p.writeMessage(wire.NewMessage(wire.MsgPingTy, "")) - p.pingStartTime = time.Now() - - // Service timer takes care of peer broadcasting, transaction - // posting or block posting - case <-serviceTimer.C: - p.QueueMessage(wire.NewMessage(wire.MsgGetPeersTy, "")) - - case <-p.quit: - // Break out of the for loop if a quit message is posted - break out - } - } - -clean: - // This loop is for draining the output queue and anybody waiting for us - for { - select { - case <-p.outputQueue: - // TODO - default: - break clean - } - } -} - -func formatMessage(msg *wire.Msg) (ret string) { - ret = fmt.Sprintf("%v %v", msg.Type, msg.Data) - - /* - XXX Commented out because I need the log level here to determine - if i should or shouldn't generate this message - */ - /* - switch msg.Type { - case wire.MsgPeersTy: - ret += fmt.Sprintf("(%d entries)", msg.Data.Len()) - case wire.MsgBlockTy: - b1, b2 := chain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1)) - ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), b1.Hash()[0:4], b2.Hash()[0:4]) - case wire.MsgBlockHashesTy: - h1, h2 := msg.Data.Get(0).Bytes(), msg.Data.Get(msg.Data.Len()-1).Bytes() - ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), h1, h2) - } - */ - - return -} - -// Inbound handler. Inbound messages are received here and passed to the appropriate methods -func (p *Peer) HandleInbound() { - for atomic.LoadInt32(&p.disconnect) == 0 { - - // HMM? - time.Sleep(50 * time.Millisecond) - // Wait for a message from the peer - msgs, err := wire.ReadMessages(p.conn) - if err != nil { - peerlogger.Debugln(err) - } - for _, msg := range msgs { - peerlogger.DebugDetailf("(%v) => %v\n", p.conn.RemoteAddr(), formatMessage(msg)) - - switch msg.Type { - case wire.MsgHandshakeTy: - // Version message - p.handleHandshake(msg) - - //if p.caps.IsCap(CapPeerDiscTy) { - p.QueueMessage(wire.NewMessage(wire.MsgGetPeersTy, "")) - //} - - case wire.MsgDiscTy: - p.Stop() - peerlogger.Infoln("Disconnect peer: ", DiscReason(msg.Data.Get(0).Uint())) - case wire.MsgPingTy: - // Respond back with pong - p.QueueMessage(wire.NewMessage(wire.MsgPongTy, "")) - case wire.MsgPongTy: - // If we received a pong back from a peer we set the - // last pong so the peer handler knows this peer is still - // active. - p.lastPong = time.Now().Unix() - p.pingTime = time.Since(p.pingStartTime) - case wire.MsgTxTy: - // If the message was a transaction queue the transaction - // in the TxPool where it will undergo validation and - // processing when a new block is found - for i := 0; i < msg.Data.Len(); i++ { - tx := types.NewTransactionFromValue(msg.Data.Get(i)) - err := p.ethereum.TxPool().Add(tx) - if err != nil { - peerlogger.Infoln(err) - } else { - peerlogger.Infof("tx OK (%x)\n", tx.Hash()[0:4]) - } - } - case wire.MsgGetPeersTy: - // Peer asked for list of connected peers - //p.pushPeers() - case wire.MsgPeersTy: - // Received a list of peers (probably because MsgGetPeersTy was send) - data := msg.Data - // Create new list of possible peers for the ethereum to process - peers := make([]string, data.Len()) - // Parse each possible peer - for i := 0; i < data.Len(); i++ { - value := data.Get(i) - peers[i] = unpackAddr(value.Get(0), value.Get(1).Uint()) - } - - // Connect to the list of peers - p.ethereum.ProcessPeerList(peers) - - case wire.MsgStatusTy: - // Handle peer's status msg - p.handleStatus(msg) - } - - // TMP - if p.statusKnown { - switch msg.Type { - - case wire.MsgGetBlockHashesTy: - if msg.Data.Len() < 2 { - peerlogger.Debugln("err: argument length invalid ", msg.Data.Len()) - } - - hash := msg.Data.Get(0).Bytes() - amount := msg.Data.Get(1).Uint() - - hashes := p.ethereum.ChainManager().GetChainHashesFromHash(hash, amount) - - p.QueueMessage(wire.NewMessage(wire.MsgBlockHashesTy, ethutil.ByteSliceToInterface(hashes))) - - case wire.MsgGetBlocksTy: - // Limit to max 300 blocks - max := int(math.Min(float64(msg.Data.Len()), 300.0)) - var blocks []interface{} - - for i := 0; i < max; i++ { - hash := msg.Data.Get(i).Bytes() - block := p.ethereum.ChainManager().GetBlock(hash) - if block != nil { - blocks = append(blocks, block.Value().Raw()) - } - } - - p.QueueMessage(wire.NewMessage(wire.MsgBlockTy, blocks)) - - case wire.MsgBlockHashesTy: - p.catchingUp = true - - blockPool := p.ethereum.blockPool - - foundCommonHash := false - p.lastHashAt = time.Now() - - it := msg.Data.NewIterator() - for it.Next() { - hash := it.Value().Bytes() - p.lastReceivedHash = hash - - if blockPool.HasCommonHash(hash) { - foundCommonHash = true - - break - } - - blockPool.AddHash(hash, p) - } - - if !foundCommonHash { - p.FetchHashes() - } else { - peerlogger.Infof("Found common hash (%x...)\n", p.lastReceivedHash[0:4]) - p.doneFetchingHashes = true - } - - case wire.MsgBlockTy: - p.catchingUp = true - - blockPool := p.ethereum.blockPool - - it := msg.Data.NewIterator() - for it.Next() { - block := types.NewBlockFromRlpValue(it.Value()) - blockPool.Add(block, p) - - p.lastBlockReceived = time.Now() - } - case wire.MsgNewBlockTy: - var ( - blockPool = p.ethereum.blockPool - block = types.NewBlockFromRlpValue(msg.Data.Get(0)) - td = msg.Data.Get(1).BigInt() - ) - - if td.Cmp(blockPool.td) > 0 { - p.ethereum.blockPool.AddNew(block, p) - } - } - - } - } - } - - p.Stop() -} - -func (self *Peer) FetchBlocks(hashes [][]byte) { - if len(hashes) > 0 { - peerlogger.Debugf("Fetching blocks (%d)\n", len(hashes)) - - self.QueueMessage(wire.NewMessage(wire.MsgGetBlocksTy, ethutil.ByteSliceToInterface(hashes))) - } -} - -func (self *Peer) FetchHashes() bool { - blockPool := self.ethereum.blockPool - - return blockPool.FetchHashes(self) -} - -func (self *Peer) FetchingHashes() bool { - return !self.doneFetchingHashes -} - -// General update method -func (self *Peer) update() { - serviceTimer := time.NewTicker(100 * time.Millisecond) - -out: - for { - select { - case <-serviceTimer.C: - if self.IsCap("eth") { - var ( - sinceBlock = time.Since(self.lastBlockReceived) - ) - - if sinceBlock > 5*time.Second { - self.catchingUp = false - } - } - case <-self.quit: - break out - } - } - - serviceTimer.Stop() -} - -func (p *Peer) Start() { - peerHost, peerPort, _ := net.SplitHostPort(p.conn.LocalAddr().String()) - servHost, servPort, _ := net.SplitHostPort(p.conn.RemoteAddr().String()) - - if p.inbound { - p.host, p.port = packAddr(peerHost, peerPort) - } else { - p.host, p.port = packAddr(servHost, servPort) - } - - err := p.pushHandshake() - if err != nil { - peerlogger.Debugln("Peer can't send outbound version ack", err) - - p.Stop() - - return - } - - go p.HandleOutbound() - // Run the inbound handler in a new goroutine - go p.HandleInbound() - // Run the general update handler - go p.update() - - // Wait a few seconds for startup and then ask for an initial ping - time.Sleep(2 * time.Second) - p.writeMessage(wire.NewMessage(wire.MsgPingTy, "")) - p.pingStartTime = time.Now() - -} - -func (p *Peer) Stop() { - p.StopWithReason(DiscRequested) -} - -func (p *Peer) StopWithReason(reason DiscReason) { - if atomic.AddInt32(&p.disconnect, 1) != 1 { - return - } - - // Pre-emptively remove the peer; don't wait for reaping. We already know it's dead if we are here - p.ethereum.RemovePeer(p) - - close(p.quit) - if atomic.LoadInt32(&p.connected) != 0 { - p.writeMessage(wire.NewMessage(wire.MsgDiscTy, reason)) - p.conn.Close() - } -} - -func (p *Peer) peersMessage() *wire.Msg { - outPeers := make([]interface{}, len(p.ethereum.InOutPeers())) - // Serialise each peer - for i, peer := range p.ethereum.InOutPeers() { - // Don't return localhost as valid peer - if !net.ParseIP(peer.conn.RemoteAddr().String()).IsLoopback() { - outPeers[i] = peer.RlpData() - } - } - - // Return the message to the peer with the known list of connected clients - return wire.NewMessage(wire.MsgPeersTy, outPeers) -} - -// Pushes the list of outbound peers to the client when requested -func (p *Peer) pushPeers() { - p.QueueMessage(p.peersMessage()) -} - -func (self *Peer) pushStatus() { - msg := wire.NewMessage(wire.MsgStatusTy, []interface{}{ - uint32(ProtocolVersion), - uint32(NetVersion), - self.ethereum.ChainManager().TD, - self.ethereum.ChainManager().CurrentBlock.Hash(), - self.ethereum.ChainManager().Genesis().Hash(), - }) - - self.QueueMessage(msg) -} - -func (self *Peer) handleStatus(msg *wire.Msg) { - c := msg.Data - - var ( - //protoVersion = c.Get(0).Uint() - netVersion = c.Get(1).Uint() - td = c.Get(2).BigInt() - bestHash = c.Get(3).Bytes() - genesis = c.Get(4).Bytes() - ) - - if bytes.Compare(self.ethereum.ChainManager().Genesis().Hash(), genesis) != 0 { - loggerger.Warnf("Invalid genisis hash %x. Disabling [eth]\n", genesis) - return - } - - if netVersion != NetVersion { - loggerger.Warnf("Invalid network version %d. Disabling [eth]\n", netVersion) - return - } - - /* - if protoVersion != ProtocolVersion { - loggerger.Warnf("Invalid protocol version %d. Disabling [eth]\n", protoVersion) - return - } - */ - - // Get the td and last hash - self.td = td - self.bestHash = bestHash - self.lastReceivedHash = bestHash - - self.statusKnown = true - - // Compare the total TD with the blockchain TD. If remote is higher - // fetch hashes from highest TD node. - self.FetchHashes() - - loggerger.Infof("Peer is [eth] capable. (TD = %v ~ %x)", self.td, self.bestHash) - -} - -func (p *Peer) pushHandshake() error { - pubkey := p.ethereum.KeyManager().PublicKey() - msg := wire.NewMessage(wire.MsgHandshakeTy, []interface{}{ - P2PVersion, []byte(p.version), []interface{}{[]interface{}{"eth", ProtocolVersion}}, p.port, pubkey[1:], - }) - - p.QueueMessage(msg) - - return nil -} - -func (p *Peer) handleHandshake(msg *wire.Msg) { - c := msg.Data - - var ( - p2pVersion = c.Get(0).Uint() - clientId = c.Get(1).Str() - caps = c.Get(2) - port = c.Get(3).Uint() - pub = c.Get(4).Bytes() - ) - - // Check correctness of p2p protocol version - if p2pVersion != P2PVersion { - peerlogger.Debugf("Invalid P2P version. Require protocol %d, received %d\n", P2PVersion, p2pVersion) - p.Stop() - return - } - - // Handle the pub key (validation, uniqueness) - if len(pub) == 0 { - peerlogger.Warnln("Pubkey required, not supplied in handshake.") - p.Stop() - return - } - - // Self connect detection - pubkey := p.ethereum.KeyManager().PublicKey() - if bytes.Compare(pubkey[1:], pub) == 0 { - p.Stop() - - return - } - - // Check for blacklisting - for _, pk := range p.ethereum.blacklist { - if bytes.Compare(pk, pub) == 0 { - peerlogger.Debugf("Blacklisted peer tried to connect (%x...)\n", pubkey[0:4]) - p.StopWithReason(DiscBadPeer) - - return - } - } - - usedPub := 0 - // This peer is already added to the peerlist so we expect to find a double pubkey at least once - eachPeer(p.ethereum.Peers(), func(peer *Peer, e *list.Element) { - if bytes.Compare(pub, peer.pubkey) == 0 { - usedPub++ - } - }) - - if usedPub > 0 { - peerlogger.Debugf("Pubkey %x found more then once. Already connected to client.", p.pubkey) - p.Stop() - return - } - p.pubkey = pub - - // If this is an inbound connection send an ack back - if p.inbound { - p.port = uint16(port) - } - - p.SetVersion(clientId) - - p.versionKnown = true - - p.ethereum.PushPeer(p) - p.ethereum.eventMux.Post(PeerListEvent{p.ethereum.Peers()}) - - p.protocolCaps = caps - - it := caps.NewIterator() - var capsStrs []string - for it.Next() { - cap := it.Value().Get(0).Str() - ver := it.Value().Get(1).Uint() - switch cap { - case "eth": - if ver != ProtocolVersion { - loggerger.Warnf("Invalid protocol version %d. Disabling [eth]\n", ver) - continue - } - p.pushStatus() - } - - capsStrs = append(capsStrs, fmt.Sprintf("%s/%d", cap, ver)) - } - - peerlogger.Infof("Added peer (%s) %d / %d (%v)\n", p.conn.RemoteAddr(), p.ethereum.Peers().Len(), p.ethereum.MaxPeers, capsStrs) - - peerlogger.Debugln(p) -} - -func (self *Peer) IsCap(cap string) bool { - capsIt := self.protocolCaps.NewIterator() - for capsIt.Next() { - if capsIt.Value().Str() == cap { - return true - } - } - - return false -} - -func (self *Peer) Caps() *ethutil.Value { - return self.protocolCaps -} - -func (p *Peer) String() string { - var strBoundType string - if p.inbound { - strBoundType = "inbound" - } else { - strBoundType = "outbound" - } - var strConnectType string - if atomic.LoadInt32(&p.disconnect) == 0 { - strConnectType = "connected" - } else { - strConnectType = "disconnected" - } - - return fmt.Sprintf("[%s] (%s) %v %s", strConnectType, strBoundType, p.conn.RemoteAddr(), p.version) - -} - -func (p *Peer) RlpData() []interface{} { - return []interface{}{p.host, p.port, p.pubkey} -} - -func packAddr(address, _port string) (host []byte, port uint16) { - p, _ := strconv.Atoi(_port) - port = uint16(p) - - h := net.ParseIP(address) - if ip := h.To4(); ip != nil { - host = []byte(ip) - } else { - host = []byte(h) - } - - return -} - -func unpackAddr(value *ethutil.Value, p uint64) string { - host, _ := net.IP(value.Bytes()).MarshalText() - prt := strconv.Itoa(int(p)) - - return net.JoinHostPort(string(host), prt) -} -- cgit v1.2.3 From e847aaca3eff9f7ecd45426ad335d55bcdf4c4ae Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:38:46 +0000 Subject: remove wire package --- wire/.gitignore | 12 --- wire/README.md | 36 -------- wire/client_identity.go | 56 ------------ wire/client_identity_test.go | 30 ------- wire/messages2.go | 199 ------------------------------------------- wire/messaging.go | 178 -------------------------------------- 6 files changed, 511 deletions(-) delete mode 100644 wire/.gitignore delete mode 100644 wire/README.md delete mode 100644 wire/client_identity.go delete mode 100644 wire/client_identity_test.go delete mode 100644 wire/messages2.go delete mode 100644 wire/messaging.go diff --git a/wire/.gitignore b/wire/.gitignore deleted file mode 100644 index f725d58d1..000000000 --- a/wire/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile ~/.gitignore_global - -/tmp -*/**/*un~ -*un~ -.DS_Store -*/**/.DS_Store - diff --git a/wire/README.md b/wire/README.md deleted file mode 100644 index 7f63688b3..000000000 --- a/wire/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# ethwire - -The ethwire package contains the ethereum wire protocol. The ethwire -package is required to write and read from the ethereum network. - -# Installation - -`go get github.com/ethereum/ethwire-go` - -# Messaging overview - -The Ethereum Wire protocol defines the communication between the nodes -running Ethereum. Further reader reading can be done on the -[Wiki](http://wiki.ethereum.org/index.php/Wire_Protocol). - -# Reading Messages - -```go -// Read and validate the next eth message from the provided connection. -// returns a error message with the details. -msg, err := ethwire.ReadMessage(conn) -if err != nil { - // Handle error -} -``` - -# Writing Messages - -```go -// Constructs a message which can be interpreted by the eth network. -// Write the inventory to network -err := ethwire.WriteMessage(conn, &Msg{ - Type: ethwire.MsgInvTy, - Data : []interface{}{...}, -}) -``` diff --git a/wire/client_identity.go b/wire/client_identity.go deleted file mode 100644 index 0a268024a..000000000 --- a/wire/client_identity.go +++ /dev/null @@ -1,56 +0,0 @@ -package wire - -import ( - "fmt" - "runtime" -) - -// should be used in Peer handleHandshake, incorporate Caps, ProtocolVersion, Pubkey etc. -type ClientIdentity interface { - String() string -} - -type SimpleClientIdentity struct { - clientIdentifier string - version string - customIdentifier string - os string - implementation string -} - -func NewSimpleClientIdentity(clientIdentifier string, version string, customIdentifier string) *SimpleClientIdentity { - clientIdentity := &SimpleClientIdentity{ - clientIdentifier: clientIdentifier, - version: version, - customIdentifier: customIdentifier, - os: runtime.GOOS, - implementation: runtime.Version(), - } - - return clientIdentity -} - -func (c *SimpleClientIdentity) init() { -} - -func (c *SimpleClientIdentity) String() string { - var id string - if len(c.customIdentifier) > 0 { - id = "/" + c.customIdentifier - } - - return fmt.Sprintf("%s/v%s%s/%s/%s", - c.clientIdentifier, - c.version, - id, - c.os, - c.implementation) -} - -func (c *SimpleClientIdentity) SetCustomIdentifier(customIdentifier string) { - c.customIdentifier = customIdentifier -} - -func (c *SimpleClientIdentity) GetCustomIdentifier() string { - return c.customIdentifier -} diff --git a/wire/client_identity_test.go b/wire/client_identity_test.go deleted file mode 100644 index c0e7a0159..000000000 --- a/wire/client_identity_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package wire - -import ( - "fmt" - "runtime" - "testing" -) - -func TestClientIdentity(t *testing.T) { - clientIdentity := NewSimpleClientIdentity("Ethereum(G)", "0.5.16", "test") - clientString := clientIdentity.String() - expected := fmt.Sprintf("Ethereum(G)/v0.5.16/test/%s/%s", runtime.GOOS, runtime.Version()) - if clientString != expected { - t.Errorf("Expected clientIdentity to be %q, got %q", expected, clientString) - } - customIdentifier := clientIdentity.GetCustomIdentifier() - if customIdentifier != "test" { - t.Errorf("Expected clientIdentity.GetCustomIdentifier() to be 'test', got %q", customIdentifier) - } - clientIdentity.SetCustomIdentifier("test2") - customIdentifier = clientIdentity.GetCustomIdentifier() - if customIdentifier != "test2" { - t.Errorf("Expected clientIdentity.GetCustomIdentifier() to be 'test2', got %q", customIdentifier) - } - clientString = clientIdentity.String() - expected = fmt.Sprintf("Ethereum(G)/v0.5.16/test2/%s/%s", runtime.GOOS, runtime.Version()) - if clientString != expected { - t.Errorf("Expected clientIdentity to be %q, got %q", expected, clientString) - } -} diff --git a/wire/messages2.go b/wire/messages2.go deleted file mode 100644 index acbd9e0d5..000000000 --- a/wire/messages2.go +++ /dev/null @@ -1,199 +0,0 @@ -package wire - -import ( - "bytes" - "errors" - "fmt" - "net" - "time" - - "github.com/ethereum/go-ethereum/ethutil" -) - -// The connection object allows you to set up a connection to the Ethereum network. -// The Connection object takes care of all encoding and sending objects properly over -// the network. -type Connection struct { - conn net.Conn - nTimeout time.Duration - pendingMessages Messages -} - -// Create a new connection to the Ethereum network -func New(conn net.Conn) *Connection { - return &Connection{conn: conn, nTimeout: 500} -} - -// Read, reads from the network. It will block until the next message is received. -func (self *Connection) Read() *Msg { - if len(self.pendingMessages) == 0 { - self.readMessages() - } - - ret := self.pendingMessages[0] - self.pendingMessages = self.pendingMessages[1:] - - return ret - -} - -// Write to the Ethereum network specifying the type of the message and -// the data. Data can be of type RlpEncodable or []interface{}. Returns -// nil or if something went wrong an error. -func (self *Connection) Write(typ MsgType, v ...interface{}) error { - var pack []byte - - slice := [][]interface{}{[]interface{}{byte(typ)}} - for _, value := range v { - if encodable, ok := value.(ethutil.RlpEncodeDecode); ok { - slice = append(slice, encodable.RlpValue()) - } else if raw, ok := value.([]interface{}); ok { - slice = append(slice, raw) - } else { - panic(fmt.Sprintf("Unable to 'write' object of type %T", value)) - } - } - - // Encode the type and the (RLP encoded) data for sending over the wire - encoded := ethutil.NewValue(slice).Encode() - payloadLength := ethutil.NumberToBytes(uint32(len(encoded)), 32) - - // Write magic token and payload length (first 8 bytes) - pack = append(MagicToken, payloadLength...) - pack = append(pack, encoded...) - - // Write to the connection - _, err := self.conn.Write(pack) - if err != nil { - return err - } - - return nil -} - -func (self *Connection) readMessage(data []byte) (msg *Msg, remaining []byte, done bool, err error) { - if len(data) == 0 { - return nil, nil, true, nil - } - - if len(data) <= 8 { - return nil, remaining, false, errors.New("Invalid message") - } - - // Check if the received 4 first bytes are the magic token - if bytes.Compare(MagicToken, data[:4]) != 0 { - return nil, nil, false, fmt.Errorf("MagicToken mismatch. Received %v", data[:4]) - } - - messageLength := ethutil.BytesToNumber(data[4:8]) - remaining = data[8+messageLength:] - if int(messageLength) > len(data[8:]) { - return nil, nil, false, fmt.Errorf("message length %d, expected %d", len(data[8:]), messageLength) - } - - message := data[8 : 8+messageLength] - decoder := ethutil.NewValueFromBytes(message) - // Type of message - t := decoder.Get(0).Uint() - // Actual data - d := decoder.SliceFrom(1) - - msg = &Msg{ - Type: MsgType(t), - Data: d, - } - - return -} - -// The basic message reader waits for data on the given connection, decoding -// and doing a few sanity checks such as if there's a data type and -// unmarhals the given data -func (self *Connection) readMessages() (err error) { - // The recovering function in case anything goes horribly wrong - defer func() { - if r := recover(); r != nil { - err = fmt.Errorf("wire.ReadMessage error: %v", r) - } - }() - - // Buff for writing network message to - //buff := make([]byte, 1440) - var buff []byte - var totalBytes int - for { - // Give buffering some time - self.conn.SetReadDeadline(time.Now().Add(self.nTimeout * time.Millisecond)) - // Create a new temporarily buffer - b := make([]byte, 1440) - // Wait for a message from this peer - n, _ := self.conn.Read(b) - if err != nil && n == 0 { - if err.Error() != "EOF" { - fmt.Println("err now", err) - return err - } else { - break - } - - // Messages can't be empty - } else if n == 0 { - break - } - - buff = append(buff, b[:n]...) - totalBytes += n - } - - // Reslice buffer - buff = buff[:totalBytes] - msg, remaining, done, err := self.readMessage(buff) - for ; done != true; msg, remaining, done, err = self.readMessage(remaining) { - //log.Println("rx", msg) - - if msg != nil { - self.pendingMessages = append(self.pendingMessages, msg) - } - } - - return -} - -func ReadMessage(data []byte) (msg *Msg, remaining []byte, done bool, err error) { - if len(data) == 0 { - return nil, nil, true, nil - } - - if len(data) <= 8 { - return nil, remaining, false, errors.New("Invalid message") - } - - // Check if the received 4 first bytes are the magic token - if bytes.Compare(MagicToken, data[:4]) != 0 { - return nil, nil, false, fmt.Errorf("MagicToken mismatch. Received %v", data[:4]) - } - - messageLength := ethutil.BytesToNumber(data[4:8]) - remaining = data[8+messageLength:] - if int(messageLength) > len(data[8:]) { - return nil, nil, false, fmt.Errorf("message length %d, expected %d", len(data[8:]), messageLength) - } - - message := data[8 : 8+messageLength] - decoder := ethutil.NewValueFromBytes(message) - // Type of message - t := decoder.Get(0).Uint() - // Actual data - d := decoder.SliceFrom(1) - - msg = &Msg{ - Type: MsgType(t), - Data: d, - } - - return -} - -func bufferedRead(conn net.Conn) ([]byte, error) { - return nil, nil -} diff --git a/wire/messaging.go b/wire/messaging.go deleted file mode 100644 index 9c6cb5944..000000000 --- a/wire/messaging.go +++ /dev/null @@ -1,178 +0,0 @@ -// Package wire provides low level access to the Ethereum network and allows -// you to broadcast data over the network. -package wire - -import ( - "bytes" - "fmt" - "net" - "time" - - "github.com/ethereum/go-ethereum/ethutil" -) - -// Connection interface describing the methods required to implement the wire protocol. -type Conn interface { - Write(typ MsgType, v ...interface{}) error - Read() *Msg -} - -// The magic token which should be the first 4 bytes of every message and can be used as separator between messages. -var MagicToken = []byte{34, 64, 8, 145} - -type MsgType byte - -const ( - // Values are given explicitly instead of by iota because these values are - // defined by the wire protocol spec; it is easier for humans to ensure - // correctness when values are explicit. - MsgHandshakeTy = 0x00 - MsgDiscTy = 0x01 - MsgPingTy = 0x02 - MsgPongTy = 0x03 - MsgGetPeersTy = 0x04 - MsgPeersTy = 0x05 - - MsgStatusTy = 0x10 - MsgTxTy = 0x12 - MsgGetBlockHashesTy = 0x13 - MsgBlockHashesTy = 0x14 - MsgGetBlocksTy = 0x15 - MsgBlockTy = 0x16 - MsgNewBlockTy = 0x17 -) - -var msgTypeToString = map[MsgType]string{ - MsgHandshakeTy: "Handshake", - MsgDiscTy: "Disconnect", - MsgPingTy: "Ping", - MsgPongTy: "Pong", - MsgGetPeersTy: "Get peers", - MsgStatusTy: "Status", - MsgPeersTy: "Peers", - MsgTxTy: "Transactions", - MsgBlockTy: "Blocks", - //MsgGetTxsTy: "Get Txs", - MsgGetBlockHashesTy: "Get block hashes", - MsgBlockHashesTy: "Block hashes", - MsgGetBlocksTy: "Get blocks", -} - -func (mt MsgType) String() string { - return msgTypeToString[mt] -} - -type Msg struct { - Type MsgType // Specifies how the encoded data should be interpreted - //Data []byte - Data *ethutil.Value -} - -func NewMessage(msgType MsgType, data interface{}) *Msg { - return &Msg{ - Type: msgType, - Data: ethutil.NewValue(data), - } -} - -type Messages []*Msg - -// The basic message reader waits for data on the given connection, decoding -// and doing a few sanity checks such as if there's a data type and -// unmarhals the given data -func ReadMessages(conn net.Conn) (msgs []*Msg, err error) { - // The recovering function in case anything goes horribly wrong - defer func() { - if r := recover(); r != nil { - err = fmt.Errorf("wire.ReadMessage error: %v", r) - } - }() - - var ( - buff []byte - messages [][]byte - msgLength int - ) - - for { - // Give buffering some time - conn.SetReadDeadline(time.Now().Add(5 * time.Millisecond)) - // Create a new temporarily buffer - b := make([]byte, 1440) - n, _ := conn.Read(b) - if err != nil && n == 0 { - if err.Error() != "EOF" { - fmt.Println("err now", err) - return nil, err - } else { - break - } - } - - if n == 0 && len(buff) == 0 { - // If there's nothing on the wire wait for a bit - time.Sleep(200 * time.Millisecond) - - continue - } - - buff = append(buff, b[:n]...) - if msgLength == 0 { - // Check if the received 4 first bytes are the magic token - if bytes.Compare(MagicToken, buff[:4]) != 0 { - return nil, fmt.Errorf("MagicToken mismatch. Received %v", buff[:4]) - } - - // Read the length of the message - msgLength = int(ethutil.BytesToNumber(buff[4:8])) - - // Remove the token and length - buff = buff[8:] - } - - if len(buff) >= msgLength { - messages = append(messages, buff[:msgLength]) - buff = buff[msgLength:] - msgLength = 0 - - if len(buff) == 0 { - break - } - } - } - - for _, m := range messages { - decoder := ethutil.NewValueFromBytes(m) - // Type of message - t := decoder.Get(0).Uint() - // Actual data - d := decoder.SliceFrom(1) - - msgs = append(msgs, &Msg{Type: MsgType(t), Data: d}) - } - - return -} - -// The basic message writer takes care of writing data over the given -// connection and does some basic error checking -func WriteMessage(conn net.Conn, msg *Msg) error { - var pack []byte - - // Encode the type and the (RLP encoded) data for sending over the wire - encoded := ethutil.NewValue(append([]interface{}{byte(msg.Type)}, msg.Data.Slice()...)).Encode() - payloadLength := ethutil.NumberToBytes(uint32(len(encoded)), 32) - - // Write magic token and payload length (first 8 bytes) - pack = append(MagicToken, payloadLength...) - pack = append(pack, encoded...) - //fmt.Printf("payload %v (%v) %q\n", msg.Type, conn.RemoteAddr(), encoded) - - // Write to the connection - _, err := conn.Write(pack) - if err != nil { - return err - } - - return nil -} -- cgit v1.2.3 From 0add0c400f0dda50c443352a255af704e71bdd3c Mon Sep 17 00:00:00 2001 From: zelig Date: Fri, 5 Dec 2014 21:14:55 +0000 Subject: initial commit for eth-p2p integration --- eth/protocol.go | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++- eth/protocol_test.go | 39 ++++++++++++++++ 2 files changed, 165 insertions(+), 1 deletion(-) diff --git a/eth/protocol.go b/eth/protocol.go index 3b5b49696..985b42901 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -20,7 +20,7 @@ type ethProtocol struct { peer *p2p.Peer id string rw p2p.MsgReadWriter -} + } // backend is the interface the ethereum protocol backend should implement // used as an argument to EthProtocol @@ -68,6 +68,7 @@ type newBlockMsgData struct { type getBlockHashesMsgData struct { Hash []byte +<<<<<<< HEAD Amount uint64 } @@ -76,15 +77,29 @@ type getBlockHashesMsgData struct { // the Dev p2p layer then runs the protocol instance on each peer func EthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool) p2p.Protocol { return p2p.Protocol{ +======= + Amount uint32 +} + +// main entrypoint, wrappers starting a server running the eth protocol +// use this constructor to attach the protocol (class) to server caps +func EthProtocol(eth backend) *p2p.Protocol { + return &p2p.Protocol{ +>>>>>>> initial commit for eth-p2p integration Name: "eth", Version: ProtocolVersion, Length: ProtocolLength, Run: func(peer *p2p.Peer, rw p2p.MsgReadWriter) error { +<<<<<<< HEAD return runEthProtocol(txPool, chainManager, blockPool, peer, rw) +======= + return runEthProtocol(eth, peer, rw) +>>>>>>> initial commit for eth-p2p integration }, } } +<<<<<<< HEAD // the main loop that handles incoming messages // note RemovePeer in the post-disconnect hook func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { @@ -95,6 +110,13 @@ func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPoo rw: rw, peer: peer, id: (string)(peer.Identity().Pubkey()), +======= +func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { + self := ðProtocol{ + eth: eth, + rw: rw, + peer: peer, +>>>>>>> initial commit for eth-p2p integration } err = self.handleStatus() if err == nil { @@ -102,7 +124,10 @@ func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPoo for { err = self.handle() if err != nil { +<<<<<<< HEAD self.blockPool.RemovePeer(self.id) +======= +>>>>>>> initial commit for eth-p2p integration break } } @@ -127,24 +152,46 @@ func (self *ethProtocol) handle() error { case StatusMsg: return ProtocolError(ErrExtraStatusMsg, "") +<<<<<<< HEAD case TxMsg: // TODO: rework using lazy RLP stream +======= + case GetTxMsg: + txs := self.eth.GetTransactions() + // TODO: rewrite using rlp flat + txsInterface := make([]interface{}, len(txs)) + for i, tx := range txs { + txsInterface[i] = tx.RlpData() + } + return self.rw.EncodeMsg(TxMsg, txsInterface...) + + case TxMsg: +>>>>>>> initial commit for eth-p2p integration var txs []*types.Transaction if err := msg.Decode(&txs); err != nil { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD self.txPool.AddTransactions(txs) +======= + self.eth.AddTransactions(txs) +>>>>>>> initial commit for eth-p2p integration case GetBlockHashesMsg: var request getBlockHashesMsgData if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount) +======= + hashes := self.eth.GetBlockHashes(request.Hash, request.Amount) +>>>>>>> initial commit for eth-p2p integration return self.rw.EncodeMsg(BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...) case BlockHashesMsg: // TODO: redo using lazy decode , this way very inefficient on known chains +<<<<<<< HEAD msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) var err error iter := func() (hash []byte, ok bool) { @@ -160,17 +207,45 @@ func (self *ethProtocol) handle() error { } case GetBlocksMsg: +======= + // s := rlp.NewListStream(msg.Payload, uint64(msg.Size)) var blockHashes [][]byte if err := msg.Decode(&blockHashes); err != nil { return ProtocolError(ErrDecode, "%v", err) } + fetchMore := true + for _, hash := range blockHashes { + fetchMore = self.eth.AddHash(hash, self.peer) + if !fetchMore { + break + } + } + if fetchMore { + return self.FetchHashes(blockHashes[len(blockHashes)-1]) + } + + case GetBlocksMsg: + // Limit to max 300 blocks +>>>>>>> initial commit for eth-p2p integration + var blockHashes [][]byte + if err := msg.Decode(&blockHashes); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } +<<<<<<< HEAD max := int(math.Min(float64(len(blockHashes)), blockHashesBatchSize)) +======= + max := int(math.Min(float64(len(blockHashes)), 300.0)) +>>>>>>> initial commit for eth-p2p integration var blocks []interface{} for i, hash := range blockHashes { if i >= max { break } +<<<<<<< HEAD block := self.chainManager.GetBlock(hash) +======= + block := self.eth.GetBlock(hash) +>>>>>>> initial commit for eth-p2p integration if block != nil { blocks = append(blocks, block.Value().Raw()) } @@ -178,6 +253,7 @@ func (self *ethProtocol) handle() error { return self.rw.EncodeMsg(BlocksMsg, blocks...) case BlocksMsg: +<<<<<<< HEAD msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) for { var block *types.Block @@ -189,6 +265,22 @@ func (self *ethProtocol) handle() error { } } self.blockPool.AddBlock(block, self.id) +======= + var blocks []*types.Block + if err := msg.Decode(&blocks); err != nil { + return ProtocolError(ErrDecode, "%v", err) + } + for _, block := range blocks { + fetchHashes, err := self.eth.AddBlock(nil, block, self.peer) + if err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } + if fetchHashes { + if err := self.FetchHashes(block.Hash()); err != nil { + return err + } + } +>>>>>>> initial commit for eth-p2p integration } case NewBlockMsg: @@ -196,6 +288,7 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD hash := request.Block.Hash() // to simplify backend interface adding a new block // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer @@ -212,6 +305,15 @@ func (self *ethProtocol) handle() error { } self.blockPool.AddBlockHashes(iter, self.id) self.blockPool.AddBlock(request.Block, self.id) +======= + var fetchHashes bool + // this should reset td and offer blockpool as candidate new peer? + if fetchHashes, err = self.eth.AddBlock(request.TD, request.Block, self.peer); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } + if fetchHashes { + return self.FetchHashes(request.Block.Hash()) +>>>>>>> initial commit for eth-p2p integration } default: @@ -229,7 +331,11 @@ type statusMsgData struct { } func (self *ethProtocol) statusMsg() p2p.Msg { +<<<<<<< HEAD td, currentBlock, genesisBlock := self.chainManager.Status() +======= + td, currentBlock, genesisBlock := self.eth.Status() +>>>>>>> initial commit for eth-p2p integration return p2p.NewMsg(StatusMsg, uint32(ProtocolVersion), @@ -265,7 +371,11 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD _, _, genesisBlock := self.chainManager.Status() +======= + _, _, genesisBlock := self.eth.Status() +>>>>>>> initial commit for eth-p2p integration if bytes.Compare(status.GenesisBlock, genesisBlock) != 0 { return ProtocolError(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock, genesisBlock) @@ -279,13 +389,22 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) } +<<<<<<< HEAD self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) +======= + logger.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + + if self.eth.AddPeer(status.TD, status.CurrentBlock, self.peer) { + return self.FetchHashes(status.CurrentBlock) + } +>>>>>>> initial commit for eth-p2p integration return nil } +<<<<<<< HEAD func (self *ethProtocol) requestBlockHashes(from []byte) error { self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) @@ -316,3 +435,9 @@ func (self *ethProtocol) protoErrorDisconnect(code int, format string, params .. } } +======= +func (self *ethProtocol) FetchHashes(from []byte) error { + logger.Debugf("Fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) + return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) +} +>>>>>>> initial commit for eth-p2p integration diff --git a/eth/protocol_test.go b/eth/protocol_test.go index a166ea6cd..93696213a 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -56,11 +56,18 @@ type TestBackend struct { getTransactions func() []*types.Transaction addTransactions func(txs []*types.Transaction) getBlockHashes func(hash []byte, amount uint32) (hashes [][]byte) +<<<<<<< HEAD addBlockHashes func(next func() ([]byte, bool), peerId string) getBlock func(hash []byte) *types.Block addBlock func(block *types.Block, peerId string) (err error) addPeer func(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) removePeer func(peerId string) +======= + addHash func(hash []byte, peer *p2p.Peer) (more bool) + getBlock func(hash []byte) *types.Block + addBlock func(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) + addPeer func(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) +>>>>>>> initial commit for eth-p2p integration status func() (td *big.Int, currentBlock []byte, genesisBlock []byte) } @@ -84,12 +91,21 @@ func (self *TestBackend) GetBlockHashes(hash []byte, amount uint32) (hashes [][] return } +<<<<<<< HEAD func (self *TestBackend) AddBlockHashes(next func() ([]byte, bool), peerId string) { if self.addBlockHashes != nil { self.addBlockHashes(next, peerId) } } +======= +func (self *TestBackend) AddHash(hash []byte, peer *p2p.Peer) (more bool) { + if self.addHash != nil { + more = self.addHash(hash, peer) + } + return +} +>>>>>>> initial commit for eth-p2p integration func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { if self.getBlock != nil { block = self.getBlock(hash) @@ -97,26 +113,41 @@ func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { return } +<<<<<<< HEAD func (self *TestBackend) AddBlock(block *types.Block, peerId string) (err error) { if self.addBlock != nil { err = self.addBlock(block, peerId) +======= +func (self *TestBackend) AddBlock(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) { + if self.addBlock != nil { + fetchHashes, err = self.addBlock(td, block, peer) +>>>>>>> initial commit for eth-p2p integration } return } +<<<<<<< HEAD func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) { if self.addPeer != nil { best = self.addPeer(td, currentBlock, peerId, requestBlockHashes, requestBlocks, invalidBlock) +======= +func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) { + if self.addPeer != nil { + fetchHashes = self.addPeer(td, currentBlock, peer) +>>>>>>> initial commit for eth-p2p integration } return } +<<<<<<< HEAD func (self *TestBackend) RemovePeer(peerId string) { if self.removePeer != nil { self.removePeer(peerId) } } +======= +>>>>>>> initial commit for eth-p2p integration func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { if self.status != nil { td, currentBlock, genesisBlock = self.status() @@ -124,6 +155,7 @@ func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBloc return } +<<<<<<< HEAD // TODO: refactor this into p2p/client_identity type peerId struct { pubkey []byte @@ -147,12 +179,19 @@ func testPeer() *p2p.Peer { } func TestErrNoStatusMsg(t *testing.T) { +======= +func TestEth(t *testing.T) { +>>>>>>> initial commit for eth-p2p integration quit := make(chan bool) rw := &testMsgReadWriter{make(chan p2p.Msg, 10), make(chan p2p.Msg, 10)} testBackend := &TestBackend{} var err error go func() { +<<<<<<< HEAD err = runEthProtocol(testBackend, testPeer(), rw) +======= + err = runEthProtocol(testBackend, nil, rw) +>>>>>>> initial commit for eth-p2p integration close(quit) }() statusMsg := p2p.NewMsg(4) -- cgit v1.2.3 From 2dd8f411473f23e61983506aaa1c37efec043ac0 Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 9 Dec 2014 23:55:50 +0000 Subject: eth protocol changes - changed backend interface - using callbacks for blockPool - use rlp stream for lazy decoding - use peer as logger - add id (peer pubkey) to ethProtocol fields - add testPeer to protocol test (temporary) --- eth/protocol.go | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++-- eth/protocol_test.go | 46 ++++++++++++++++++++----- 2 files changed, 132 insertions(+), 11 deletions(-) diff --git a/eth/protocol.go b/eth/protocol.go index 985b42901..fbc4610ec 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -82,7 +82,8 @@ func EthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool) } // main entrypoint, wrappers starting a server running the eth protocol -// use this constructor to attach the protocol (class) to server caps +// use this constructor to attach the protocol ("class") to server caps +// the Dev p2p layer then runs the protocol instance on each peer func EthProtocol(eth backend) *p2p.Protocol { return &p2p.Protocol{ >>>>>>> initial commit for eth-p2p integration @@ -99,6 +100,7 @@ func EthProtocol(eth backend) *p2p.Protocol { } } +<<<<<<< HEAD <<<<<<< HEAD // the main loop that handles incoming messages // note RemovePeer in the post-disconnect hook @@ -111,12 +113,20 @@ func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPoo peer: peer, id: (string)(peer.Identity().Pubkey()), ======= +======= +// the main loop that handles incoming messages +// note RemovePeer in the post-disconnect hook +>>>>>>> eth protocol changes func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { self := ðProtocol{ eth: eth, rw: rw, peer: peer, +<<<<<<< HEAD >>>>>>> initial commit for eth-p2p integration +======= + id: (string)(peer.Identity().Pubkey()), +>>>>>>> eth protocol changes } err = self.handleStatus() if err == nil { @@ -124,10 +134,14 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro for { err = self.handle() if err != nil { +<<<<<<< HEAD <<<<<<< HEAD self.blockPool.RemovePeer(self.id) ======= >>>>>>> initial commit for eth-p2p integration +======= + self.eth.RemovePeer(self.id) +>>>>>>> eth protocol changes break } } @@ -166,7 +180,11 @@ func (self *ethProtocol) handle() error { return self.rw.EncodeMsg(TxMsg, txsInterface...) case TxMsg: +<<<<<<< HEAD >>>>>>> initial commit for eth-p2p integration +======= + // TODO: rework using lazy RLP stream +>>>>>>> eth protocol changes var txs []*types.Transaction if err := msg.Decode(&txs); err != nil { return ProtocolError(ErrDecode, "%v", err) @@ -192,12 +210,16 @@ func (self *ethProtocol) handle() error { case BlockHashesMsg: // TODO: redo using lazy decode , this way very inefficient on known chains <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> eth protocol changes msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) var err error iter := func() (hash []byte, ok bool) { hash, err = msgStream.Bytes() if err == nil { ok = true +<<<<<<< HEAD } return } @@ -218,24 +240,35 @@ func (self *ethProtocol) handle() error { fetchMore = self.eth.AddHash(hash, self.peer) if !fetchMore { break +======= +>>>>>>> eth protocol changes } + return } - if fetchMore { - return self.FetchHashes(blockHashes[len(blockHashes)-1]) + self.eth.AddBlockHashes(iter, self.id) + if err != nil && err != rlp.EOL { + return ProtocolError(ErrDecode, "%v", err) } case GetBlocksMsg: +<<<<<<< HEAD // Limit to max 300 blocks >>>>>>> initial commit for eth-p2p integration +======= +>>>>>>> eth protocol changes var blockHashes [][]byte if err := msg.Decode(&blockHashes); err != nil { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD <<<<<<< HEAD max := int(math.Min(float64(len(blockHashes)), blockHashesBatchSize)) ======= max := int(math.Min(float64(len(blockHashes)), 300.0)) >>>>>>> initial commit for eth-p2p integration +======= + max := int(math.Min(float64(len(blockHashes)), blockHashesBatchSize)) +>>>>>>> eth protocol changes var blocks []interface{} for i, hash := range blockHashes { if i >= max { @@ -254,6 +287,9 @@ func (self *ethProtocol) handle() error { case BlocksMsg: <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> eth protocol changes msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) for { var block *types.Block @@ -262,6 +298,7 @@ func (self *ethProtocol) handle() error { break } else { return ProtocolError(ErrDecode, "%v", err) +<<<<<<< HEAD } } self.blockPool.AddBlock(block, self.id) @@ -281,6 +318,13 @@ func (self *ethProtocol) handle() error { } } >>>>>>> initial commit for eth-p2p integration +======= + } + } + if err := self.eth.AddBlock(block, self.id); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } +>>>>>>> eth protocol changes } case NewBlockMsg: @@ -289,11 +333,18 @@ func (self *ethProtocol) handle() error { return ProtocolError(ErrDecode, "%v", err) } <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> eth protocol changes hash := request.Block.Hash() // to simplify backend interface adding a new block // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer // (or selected as new best peer) +<<<<<<< HEAD if self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) { +======= + if self.eth.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) { +>>>>>>> eth protocol changes called := true iter := func() (hash []byte, ok bool) { if called { @@ -303,6 +354,7 @@ func (self *ethProtocol) handle() error { return } } +<<<<<<< HEAD self.blockPool.AddBlockHashes(iter, self.id) self.blockPool.AddBlock(request.Block, self.id) ======= @@ -314,6 +366,12 @@ func (self *ethProtocol) handle() error { if fetchHashes { return self.FetchHashes(request.Block.Hash()) >>>>>>> initial commit for eth-p2p integration +======= + self.eth.AddBlockHashes(iter, self.id) + if err := self.eth.AddBlock(request.Block, self.id); err != nil { + return ProtocolError(ErrInvalidBlock, "%v", err) + } +>>>>>>> eth protocol changes } default: @@ -389,6 +447,7 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) } +<<<<<<< HEAD <<<<<<< HEAD self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) @@ -400,10 +459,16 @@ func (self *ethProtocol) handleStatus() error { return self.FetchHashes(status.CurrentBlock) } >>>>>>> initial commit for eth-p2p integration +======= + self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + + self.eth.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) +>>>>>>> eth protocol changes return nil } +<<<<<<< HEAD <<<<<<< HEAD func (self *ethProtocol) requestBlockHashes(from []byte) error { self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) @@ -441,3 +506,29 @@ func (self *ethProtocol) FetchHashes(from []byte) error { return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) } >>>>>>> initial commit for eth-p2p integration +======= +func (self *ethProtocol) requestBlockHashes(from []byte) error { + self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) + return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) +} + +func (self *ethProtocol) requestBlocks(hashes [][]byte) error { + self.peer.Debugf("fetching %v blocks", len(hashes)) + return self.rw.EncodeMsg(GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)) +} + +func (self *ethProtocol) invalidBlock(err error) { + ProtocolError(ErrInvalidBlock, "%v", err) + self.peer.Disconnect(p2p.DiscSubprotocolError) +} + +func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *protocolError) { + err = ProtocolError(code, format, params...) + if err.Fatal() { + self.peer.Errorln(err) + } else { + self.peer.Debugln(err) + } + return +} +>>>>>>> eth protocol changes diff --git a/eth/protocol_test.go b/eth/protocol_test.go index 93696213a..322aec7b7 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -56,18 +56,11 @@ type TestBackend struct { getTransactions func() []*types.Transaction addTransactions func(txs []*types.Transaction) getBlockHashes func(hash []byte, amount uint32) (hashes [][]byte) -<<<<<<< HEAD addBlockHashes func(next func() ([]byte, bool), peerId string) getBlock func(hash []byte) *types.Block addBlock func(block *types.Block, peerId string) (err error) addPeer func(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) removePeer func(peerId string) -======= - addHash func(hash []byte, peer *p2p.Peer) (more bool) - getBlock func(hash []byte) *types.Block - addBlock func(td *big.Int, block *types.Block, peer *p2p.Peer) (fetchHashes bool, err error) - addPeer func(td *big.Int, currentBlock []byte, peer *p2p.Peer) (fetchHashes bool) ->>>>>>> initial commit for eth-p2p integration status func() (td *big.Int, currentBlock []byte, genesisBlock []byte) } @@ -91,6 +84,7 @@ func (self *TestBackend) GetBlockHashes(hash []byte, amount uint32) (hashes [][] return } +<<<<<<< HEAD <<<<<<< HEAD func (self *TestBackend) AddBlockHashes(next func() ([]byte, bool), peerId string) { if self.addBlockHashes != nil { @@ -102,10 +96,18 @@ func (self *TestBackend) AddBlockHashes(next func() ([]byte, bool), peerId strin func (self *TestBackend) AddHash(hash []byte, peer *p2p.Peer) (more bool) { if self.addHash != nil { more = self.addHash(hash, peer) +======= +func (self *TestBackend) AddBlockHashes(next func() ([]byte, bool), peerId string) { + if self.addBlockHashes != nil { + self.addBlockHashes(next, peerId) +>>>>>>> eth protocol changes } - return } +<<<<<<< HEAD >>>>>>> initial commit for eth-p2p integration +======= + +>>>>>>> eth protocol changes func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { if self.getBlock != nil { block = self.getBlock(hash) @@ -113,6 +115,7 @@ func (self *TestBackend) GetBlock(hash []byte) (block *types.Block) { return } +<<<<<<< HEAD <<<<<<< HEAD func (self *TestBackend) AddBlock(block *types.Block, peerId string) (err error) { if self.addBlock != nil { @@ -122,10 +125,16 @@ func (self *TestBackend) AddBlock(td *big.Int, block *types.Block, peer *p2p.Pee if self.addBlock != nil { fetchHashes, err = self.addBlock(td, block, peer) >>>>>>> initial commit for eth-p2p integration +======= +func (self *TestBackend) AddBlock(block *types.Block, peerId string) (err error) { + if self.addBlock != nil { + err = self.addBlock(block, peerId) +>>>>>>> eth protocol changes } return } +<<<<<<< HEAD <<<<<<< HEAD func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) { if self.addPeer != nil { @@ -135,19 +144,30 @@ func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peer *p2p.Pee if self.addPeer != nil { fetchHashes = self.addPeer(td, currentBlock, peer) >>>>>>> initial commit for eth-p2p integration +======= +func (self *TestBackend) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, invalidBlock func(error)) (best bool) { + if self.addPeer != nil { + best = self.addPeer(td, currentBlock, peerId, requestBlockHashes, requestBlocks, invalidBlock) +>>>>>>> eth protocol changes } return } <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> eth protocol changes func (self *TestBackend) RemovePeer(peerId string) { if self.removePeer != nil { self.removePeer(peerId) } } +<<<<<<< HEAD ======= >>>>>>> initial commit for eth-p2p integration +======= +>>>>>>> eth protocol changes func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { if self.status != nil { td, currentBlock, genesisBlock = self.status() @@ -156,6 +176,9 @@ func (self *TestBackend) Status() (td *big.Int, currentBlock []byte, genesisBloc } <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> eth protocol changes // TODO: refactor this into p2p/client_identity type peerId struct { pubkey []byte @@ -179,19 +202,26 @@ func testPeer() *p2p.Peer { } func TestErrNoStatusMsg(t *testing.T) { +<<<<<<< HEAD ======= func TestEth(t *testing.T) { >>>>>>> initial commit for eth-p2p integration +======= +>>>>>>> eth protocol changes quit := make(chan bool) rw := &testMsgReadWriter{make(chan p2p.Msg, 10), make(chan p2p.Msg, 10)} testBackend := &TestBackend{} var err error go func() { +<<<<<<< HEAD <<<<<<< HEAD err = runEthProtocol(testBackend, testPeer(), rw) ======= err = runEthProtocol(testBackend, nil, rw) >>>>>>> initial commit for eth-p2p integration +======= + err = runEthProtocol(testBackend, testPeer(), rw) +>>>>>>> eth protocol changes close(quit) }() statusMsg := p2p.NewMsg(4) -- cgit v1.2.3 From 5e4d77b2b8020a106a13762c49ef40acac619a9c Mon Sep 17 00:00:00 2001 From: zelig Date: Wed, 10 Dec 2014 04:12:25 +0000 Subject: initial commit for eth blockpool + test --- eth/block_pool.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eth/block_pool.go b/eth/block_pool.go index 64d1e73fa..7cfbc63f8 100644 --- a/eth/block_pool.go +++ b/eth/block_pool.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" ethlogger "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/pow" ) var poolLogger = ethlogger.NewLogger("Blockpool") @@ -54,7 +55,7 @@ type BlockPool struct { // the minimal interface with blockchain hasBlock func(hash []byte) bool insertChain func(types.Blocks) error - verifyPoW func(*types.Block) bool + verifyPoW func(pow.Block) bool } type peerInfo struct { @@ -73,7 +74,7 @@ type peerInfo struct { quitC chan bool } -func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(*types.Block) bool, +func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(pow.Block) bool, ) *BlockPool { return &BlockPool{ hasBlock: hasBlock, -- cgit v1.2.3 From 4dfce4624dcc89302ec0b1f22cf853a8382fb7c7 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:04:50 +0000 Subject: protocol - new interface explicit backend components txPool, chainManager, blockPool - added protoErrorDisconnect for blockpool callback (FIXME: handling peer disconnects) --- eth/protocol.go | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/eth/protocol.go b/eth/protocol.go index fbc4610ec..37e642fd0 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -20,7 +20,7 @@ type ethProtocol struct { peer *p2p.Peer id string rw p2p.MsgReadWriter - } +} // backend is the interface the ethereum protocol backend should implement // used as an argument to EthProtocol @@ -68,6 +68,7 @@ type newBlockMsgData struct { type getBlockHashesMsgData struct { Hash []byte +<<<<<<< HEAD <<<<<<< HEAD Amount uint64 } @@ -79,23 +80,35 @@ func EthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool) return p2p.Protocol{ ======= Amount uint32 +======= + Amount uint64 +>>>>>>> protocol } // main entrypoint, wrappers starting a server running the eth protocol // use this constructor to attach the protocol ("class") to server caps // the Dev p2p layer then runs the protocol instance on each peer +<<<<<<< HEAD func EthProtocol(eth backend) *p2p.Protocol { return &p2p.Protocol{ >>>>>>> initial commit for eth-p2p integration +======= +func EthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool) p2p.Protocol { + return p2p.Protocol{ +>>>>>>> protocol Name: "eth", Version: ProtocolVersion, Length: ProtocolLength, Run: func(peer *p2p.Peer, rw p2p.MsgReadWriter) error { +<<<<<<< HEAD <<<<<<< HEAD return runEthProtocol(txPool, chainManager, blockPool, peer, rw) ======= return runEthProtocol(eth, peer, rw) >>>>>>> initial commit for eth-p2p integration +======= + return runEthProtocol(txPool, chainManager, blockPool, peer, rw) +>>>>>>> protocol }, } } @@ -105,6 +118,7 @@ func EthProtocol(eth backend) *p2p.Protocol { // the main loop that handles incoming messages // note RemovePeer in the post-disconnect hook func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { +<<<<<<< HEAD self := ðProtocol{ txPool: txPool, chainManager: chainManager, @@ -127,6 +141,15 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro ======= id: (string)(peer.Identity().Pubkey()), >>>>>>> eth protocol changes +======= + self := ðProtocol{ + txPool: txPool, + chainManager: chainManager, + blockPool: blockPool, + rw: rw, + peer: peer, + id: (string)(peer.Identity().Pubkey()), +>>>>>>> protocol } err = self.handleStatus() if err == nil { @@ -135,6 +158,7 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro err = self.handle() if err != nil { <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD self.blockPool.RemovePeer(self.id) ======= @@ -142,6 +166,9 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro ======= self.eth.RemovePeer(self.id) >>>>>>> eth protocol changes +======= + self.blockPool.RemovePeer(self.id) +>>>>>>> protocol break } } @@ -166,6 +193,7 @@ func (self *ethProtocol) handle() error { case StatusMsg: return ProtocolError(ErrExtraStatusMsg, "") +<<<<<<< HEAD <<<<<<< HEAD case TxMsg: // TODO: rework using lazy RLP stream @@ -179,6 +207,8 @@ func (self *ethProtocol) handle() error { } return self.rw.EncodeMsg(TxMsg, txsInterface...) +======= +>>>>>>> protocol case TxMsg: <<<<<<< HEAD >>>>>>> initial commit for eth-p2p integration @@ -189,22 +219,30 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&txs); err != nil { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD <<<<<<< HEAD self.txPool.AddTransactions(txs) ======= self.eth.AddTransactions(txs) >>>>>>> initial commit for eth-p2p integration +======= + self.txPool.AddTransactions(txs) +>>>>>>> protocol case GetBlockHashesMsg: var request getBlockHashesMsgData if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD <<<<<<< HEAD hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount) ======= hashes := self.eth.GetBlockHashes(request.Hash, request.Amount) >>>>>>> initial commit for eth-p2p integration +======= + hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount) +>>>>>>> protocol return self.rw.EncodeMsg(BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...) case BlockHashesMsg: @@ -245,7 +283,7 @@ func (self *ethProtocol) handle() error { } return } - self.eth.AddBlockHashes(iter, self.id) + self.blockPool.AddBlockHashes(iter, self.id) if err != nil && err != rlp.EOL { return ProtocolError(ErrDecode, "%v", err) } @@ -274,11 +312,15 @@ func (self *ethProtocol) handle() error { if i >= max { break } +<<<<<<< HEAD <<<<<<< HEAD block := self.chainManager.GetBlock(hash) ======= block := self.eth.GetBlock(hash) >>>>>>> initial commit for eth-p2p integration +======= + block := self.chainManager.GetBlock(hash) +>>>>>>> protocol if block != nil { blocks = append(blocks, block.Value().Raw()) } @@ -321,10 +363,14 @@ func (self *ethProtocol) handle() error { ======= } } +<<<<<<< HEAD if err := self.eth.AddBlock(block, self.id); err != nil { return ProtocolError(ErrInvalidBlock, "%v", err) } >>>>>>> eth protocol changes +======= + self.blockPool.AddBlock(block, self.id) +>>>>>>> protocol } case NewBlockMsg: @@ -340,11 +386,15 @@ func (self *ethProtocol) handle() error { // to simplify backend interface adding a new block // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer // (or selected as new best peer) +<<<<<<< HEAD <<<<<<< HEAD if self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) { ======= if self.eth.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) { >>>>>>> eth protocol changes +======= + if self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) { +>>>>>>> protocol called := true iter := func() (hash []byte, ok bool) { if called { @@ -354,6 +404,7 @@ func (self *ethProtocol) handle() error { return } } +<<<<<<< HEAD <<<<<<< HEAD self.blockPool.AddBlockHashes(iter, self.id) self.blockPool.AddBlock(request.Block, self.id) @@ -372,6 +423,10 @@ func (self *ethProtocol) handle() error { return ProtocolError(ErrInvalidBlock, "%v", err) } >>>>>>> eth protocol changes +======= + self.blockPool.AddBlockHashes(iter, self.id) + self.blockPool.AddBlock(request.Block, self.id) +>>>>>>> protocol } default: @@ -389,11 +444,15 @@ type statusMsgData struct { } func (self *ethProtocol) statusMsg() p2p.Msg { +<<<<<<< HEAD <<<<<<< HEAD td, currentBlock, genesisBlock := self.chainManager.Status() ======= td, currentBlock, genesisBlock := self.eth.Status() >>>>>>> initial commit for eth-p2p integration +======= + td, currentBlock, genesisBlock := self.chainManager.Status() +>>>>>>> protocol return p2p.NewMsg(StatusMsg, uint32(ProtocolVersion), @@ -429,11 +488,15 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrDecode, "%v", err) } +<<<<<<< HEAD <<<<<<< HEAD _, _, genesisBlock := self.chainManager.Status() ======= _, _, genesisBlock := self.eth.Status() >>>>>>> initial commit for eth-p2p integration +======= + _, _, genesisBlock := self.chainManager.Status() +>>>>>>> protocol if bytes.Compare(status.GenesisBlock, genesisBlock) != 0 { return ProtocolError(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock, genesisBlock) @@ -462,8 +525,12 @@ func (self *ethProtocol) handleStatus() error { ======= self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) +<<<<<<< HEAD self.eth.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) >>>>>>> eth protocol changes +======= + self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) +>>>>>>> protocol return nil } @@ -517,11 +584,6 @@ func (self *ethProtocol) requestBlocks(hashes [][]byte) error { return self.rw.EncodeMsg(GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)) } -func (self *ethProtocol) invalidBlock(err error) { - ProtocolError(ErrInvalidBlock, "%v", err) - self.peer.Disconnect(p2p.DiscSubprotocolError) -} - func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *protocolError) { err = ProtocolError(code, format, params...) if err.Fatal() { @@ -531,4 +593,18 @@ func (self *ethProtocol) protoError(code int, format string, params ...interface } return } +<<<<<<< HEAD >>>>>>> eth protocol changes +======= + +func (self *ethProtocol) protoErrorDisconnect(code int, format string, params ...interface{}) { + err := ProtocolError(code, format, params...) + if err.Fatal() { + self.peer.Errorln(err) + // disconnect + } else { + self.peer.Debugln(err) + } + +} +>>>>>>> protocol -- cgit v1.2.3 From 01dc1c13942867d0579f5010a560da4073ece05e Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:08:18 +0000 Subject: blockpool rewritten , tests broken FIXME --- eth/block_pool.go | 8 ++ eth/protocol.go | 292 ------------------------------------------------------ 2 files changed, 8 insertions(+), 292 deletions(-) diff --git a/eth/block_pool.go b/eth/block_pool.go index 7cfbc63f8..a5cda7b58 100644 --- a/eth/block_pool.go +++ b/eth/block_pool.go @@ -55,7 +55,11 @@ type BlockPool struct { // the minimal interface with blockchain hasBlock func(hash []byte) bool insertChain func(types.Blocks) error +<<<<<<< HEAD verifyPoW func(pow.Block) bool +======= + verifyPoW func(*types.Block) bool +>>>>>>> blockpool rewritten , tests broken FIXME } type peerInfo struct { @@ -74,7 +78,11 @@ type peerInfo struct { quitC chan bool } +<<<<<<< HEAD func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(pow.Block) bool, +======= +func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(*types.Block) bool, +>>>>>>> blockpool rewritten , tests broken FIXME ) *BlockPool { return &BlockPool{ hasBlock: hasBlock, diff --git a/eth/protocol.go b/eth/protocol.go index 37e642fd0..3b5b49696 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -68,8 +68,6 @@ type newBlockMsgData struct { type getBlockHashesMsgData struct { Hash []byte -<<<<<<< HEAD -<<<<<<< HEAD Amount uint64 } @@ -78,70 +76,18 @@ type getBlockHashesMsgData struct { // the Dev p2p layer then runs the protocol instance on each peer func EthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool) p2p.Protocol { return p2p.Protocol{ -======= - Amount uint32 -======= - Amount uint64 ->>>>>>> protocol -} - -// main entrypoint, wrappers starting a server running the eth protocol -// use this constructor to attach the protocol ("class") to server caps -// the Dev p2p layer then runs the protocol instance on each peer -<<<<<<< HEAD -func EthProtocol(eth backend) *p2p.Protocol { - return &p2p.Protocol{ ->>>>>>> initial commit for eth-p2p integration -======= -func EthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool) p2p.Protocol { - return p2p.Protocol{ ->>>>>>> protocol Name: "eth", Version: ProtocolVersion, Length: ProtocolLength, Run: func(peer *p2p.Peer, rw p2p.MsgReadWriter) error { -<<<<<<< HEAD -<<<<<<< HEAD - return runEthProtocol(txPool, chainManager, blockPool, peer, rw) -======= - return runEthProtocol(eth, peer, rw) ->>>>>>> initial commit for eth-p2p integration -======= return runEthProtocol(txPool, chainManager, blockPool, peer, rw) ->>>>>>> protocol }, } } -<<<<<<< HEAD -<<<<<<< HEAD // the main loop that handles incoming messages // note RemovePeer in the post-disconnect hook func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPool, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { -<<<<<<< HEAD - self := ðProtocol{ - txPool: txPool, - chainManager: chainManager, - blockPool: blockPool, - rw: rw, - peer: peer, - id: (string)(peer.Identity().Pubkey()), -======= -======= -// the main loop that handles incoming messages -// note RemovePeer in the post-disconnect hook ->>>>>>> eth protocol changes -func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err error) { - self := ðProtocol{ - eth: eth, - rw: rw, - peer: peer, -<<<<<<< HEAD ->>>>>>> initial commit for eth-p2p integration -======= - id: (string)(peer.Identity().Pubkey()), ->>>>>>> eth protocol changes -======= self := ðProtocol{ txPool: txPool, chainManager: chainManager, @@ -149,7 +95,6 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro rw: rw, peer: peer, id: (string)(peer.Identity().Pubkey()), ->>>>>>> protocol } err = self.handleStatus() if err == nil { @@ -157,18 +102,7 @@ func runEthProtocol(eth backend, peer *p2p.Peer, rw p2p.MsgReadWriter) (err erro for { err = self.handle() if err != nil { -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - self.blockPool.RemovePeer(self.id) -======= ->>>>>>> initial commit for eth-p2p integration -======= - self.eth.RemovePeer(self.id) ->>>>>>> eth protocol changes -======= self.blockPool.RemovePeer(self.id) ->>>>>>> protocol break } } @@ -193,93 +127,30 @@ func (self *ethProtocol) handle() error { case StatusMsg: return ProtocolError(ErrExtraStatusMsg, "") -<<<<<<< HEAD -<<<<<<< HEAD - case TxMsg: - // TODO: rework using lazy RLP stream -======= - case GetTxMsg: - txs := self.eth.GetTransactions() - // TODO: rewrite using rlp flat - txsInterface := make([]interface{}, len(txs)) - for i, tx := range txs { - txsInterface[i] = tx.RlpData() - } - return self.rw.EncodeMsg(TxMsg, txsInterface...) - -======= ->>>>>>> protocol case TxMsg: -<<<<<<< HEAD ->>>>>>> initial commit for eth-p2p integration -======= // TODO: rework using lazy RLP stream ->>>>>>> eth protocol changes var txs []*types.Transaction if err := msg.Decode(&txs); err != nil { return ProtocolError(ErrDecode, "%v", err) } -<<<<<<< HEAD -<<<<<<< HEAD self.txPool.AddTransactions(txs) -======= - self.eth.AddTransactions(txs) ->>>>>>> initial commit for eth-p2p integration -======= - self.txPool.AddTransactions(txs) ->>>>>>> protocol case GetBlockHashesMsg: var request getBlockHashesMsgData if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } -<<<<<<< HEAD -<<<<<<< HEAD - hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount) -======= - hashes := self.eth.GetBlockHashes(request.Hash, request.Amount) ->>>>>>> initial commit for eth-p2p integration -======= hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount) ->>>>>>> protocol return self.rw.EncodeMsg(BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...) case BlockHashesMsg: // TODO: redo using lazy decode , this way very inefficient on known chains -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> eth protocol changes msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) var err error iter := func() (hash []byte, ok bool) { hash, err = msgStream.Bytes() if err == nil { ok = true -<<<<<<< HEAD - } - return - } - self.blockPool.AddBlockHashes(iter, self.id) - if err != nil && err != rlp.EOL { - return ProtocolError(ErrDecode, "%v", err) - } - - case GetBlocksMsg: -======= - // s := rlp.NewListStream(msg.Payload, uint64(msg.Size)) - var blockHashes [][]byte - if err := msg.Decode(&blockHashes); err != nil { - return ProtocolError(ErrDecode, "%v", err) - } - fetchMore := true - for _, hash := range blockHashes { - fetchMore = self.eth.AddHash(hash, self.peer) - if !fetchMore { - break -======= ->>>>>>> eth protocol changes } return } @@ -289,38 +160,17 @@ func (self *ethProtocol) handle() error { } case GetBlocksMsg: -<<<<<<< HEAD - // Limit to max 300 blocks ->>>>>>> initial commit for eth-p2p integration -======= ->>>>>>> eth protocol changes var blockHashes [][]byte if err := msg.Decode(&blockHashes); err != nil { return ProtocolError(ErrDecode, "%v", err) } -<<<<<<< HEAD -<<<<<<< HEAD - max := int(math.Min(float64(len(blockHashes)), blockHashesBatchSize)) -======= - max := int(math.Min(float64(len(blockHashes)), 300.0)) ->>>>>>> initial commit for eth-p2p integration -======= max := int(math.Min(float64(len(blockHashes)), blockHashesBatchSize)) ->>>>>>> eth protocol changes var blocks []interface{} for i, hash := range blockHashes { if i >= max { break } -<<<<<<< HEAD -<<<<<<< HEAD - block := self.chainManager.GetBlock(hash) -======= - block := self.eth.GetBlock(hash) ->>>>>>> initial commit for eth-p2p integration -======= block := self.chainManager.GetBlock(hash) ->>>>>>> protocol if block != nil { blocks = append(blocks, block.Value().Raw()) } @@ -328,10 +178,6 @@ func (self *ethProtocol) handle() error { return self.rw.EncodeMsg(BlocksMsg, blocks...) case BlocksMsg: -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> eth protocol changes msgStream := rlp.NewListStream(msg.Payload, uint64(msg.Size)) for { var block *types.Block @@ -340,37 +186,9 @@ func (self *ethProtocol) handle() error { break } else { return ProtocolError(ErrDecode, "%v", err) -<<<<<<< HEAD } } self.blockPool.AddBlock(block, self.id) -======= - var blocks []*types.Block - if err := msg.Decode(&blocks); err != nil { - return ProtocolError(ErrDecode, "%v", err) - } - for _, block := range blocks { - fetchHashes, err := self.eth.AddBlock(nil, block, self.peer) - if err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } - if fetchHashes { - if err := self.FetchHashes(block.Hash()); err != nil { - return err - } - } ->>>>>>> initial commit for eth-p2p integration -======= - } - } -<<<<<<< HEAD - if err := self.eth.AddBlock(block, self.id); err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } ->>>>>>> eth protocol changes -======= - self.blockPool.AddBlock(block, self.id) ->>>>>>> protocol } case NewBlockMsg: @@ -378,23 +196,11 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&request); err != nil { return ProtocolError(ErrDecode, "%v", err) } -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> eth protocol changes hash := request.Block.Hash() // to simplify backend interface adding a new block // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer // (or selected as new best peer) -<<<<<<< HEAD -<<<<<<< HEAD if self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) { -======= - if self.eth.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) { ->>>>>>> eth protocol changes -======= - if self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) { ->>>>>>> protocol called := true iter := func() (hash []byte, ok bool) { if called { @@ -404,29 +210,8 @@ func (self *ethProtocol) handle() error { return } } -<<<<<<< HEAD -<<<<<<< HEAD - self.blockPool.AddBlockHashes(iter, self.id) - self.blockPool.AddBlock(request.Block, self.id) -======= - var fetchHashes bool - // this should reset td and offer blockpool as candidate new peer? - if fetchHashes, err = self.eth.AddBlock(request.TD, request.Block, self.peer); err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } - if fetchHashes { - return self.FetchHashes(request.Block.Hash()) ->>>>>>> initial commit for eth-p2p integration -======= - self.eth.AddBlockHashes(iter, self.id) - if err := self.eth.AddBlock(request.Block, self.id); err != nil { - return ProtocolError(ErrInvalidBlock, "%v", err) - } ->>>>>>> eth protocol changes -======= self.blockPool.AddBlockHashes(iter, self.id) self.blockPool.AddBlock(request.Block, self.id) ->>>>>>> protocol } default: @@ -444,15 +229,7 @@ type statusMsgData struct { } func (self *ethProtocol) statusMsg() p2p.Msg { -<<<<<<< HEAD -<<<<<<< HEAD - td, currentBlock, genesisBlock := self.chainManager.Status() -======= - td, currentBlock, genesisBlock := self.eth.Status() ->>>>>>> initial commit for eth-p2p integration -======= td, currentBlock, genesisBlock := self.chainManager.Status() ->>>>>>> protocol return p2p.NewMsg(StatusMsg, uint32(ProtocolVersion), @@ -488,15 +265,7 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrDecode, "%v", err) } -<<<<<<< HEAD -<<<<<<< HEAD _, _, genesisBlock := self.chainManager.Status() -======= - _, _, genesisBlock := self.eth.Status() ->>>>>>> initial commit for eth-p2p integration -======= - _, _, genesisBlock := self.chainManager.Status() ->>>>>>> protocol if bytes.Compare(status.GenesisBlock, genesisBlock) != 0 { return ProtocolError(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock, genesisBlock) @@ -510,70 +279,13 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) } -<<<<<<< HEAD -<<<<<<< HEAD - self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) - - self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) -======= - logger.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) - - if self.eth.AddPeer(status.TD, status.CurrentBlock, self.peer) { - return self.FetchHashes(status.CurrentBlock) - } ->>>>>>> initial commit for eth-p2p integration -======= self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) -<<<<<<< HEAD - self.eth.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.invalidBlock) ->>>>>>> eth protocol changes -======= self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) ->>>>>>> protocol return nil } -<<<<<<< HEAD -<<<<<<< HEAD -func (self *ethProtocol) requestBlockHashes(from []byte) error { - self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) - return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) -} - -func (self *ethProtocol) requestBlocks(hashes [][]byte) error { - self.peer.Debugf("fetching %v blocks", len(hashes)) - return self.rw.EncodeMsg(GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)) -} - -func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *protocolError) { - err = ProtocolError(code, format, params...) - if err.Fatal() { - self.peer.Errorln(err) - } else { - self.peer.Debugln(err) - } - return -} - -func (self *ethProtocol) protoErrorDisconnect(code int, format string, params ...interface{}) { - err := ProtocolError(code, format, params...) - if err.Fatal() { - self.peer.Errorln(err) - // disconnect - } else { - self.peer.Debugln(err) - } - -} -======= -func (self *ethProtocol) FetchHashes(from []byte) error { - logger.Debugf("Fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) - return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) -} ->>>>>>> initial commit for eth-p2p integration -======= func (self *ethProtocol) requestBlockHashes(from []byte) error { self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4]) return self.rw.EncodeMsg(GetBlockHashesMsg, from, blockHashesBatchSize) @@ -593,9 +305,6 @@ func (self *ethProtocol) protoError(code int, format string, params ...interface } return } -<<<<<<< HEAD ->>>>>>> eth protocol changes -======= func (self *ethProtocol) protoErrorDisconnect(code int, format string, params ...interface{}) { err := ProtocolError(code, format, params...) @@ -607,4 +316,3 @@ func (self *ethProtocol) protoErrorDisconnect(code int, format string, params .. } } ->>>>>>> protocol -- cgit v1.2.3 From 7b39cc83cc5dcbcab6b2c35b81ea593628bbdb1f Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 19:30:32 +0000 Subject: adapt chain_manager to eth protocol interface - add Status() to return td, currentblock hash, genesis hash - GetChainHashesFromHash -> GetBlockHashesFromHash --- core/chain_manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/chain_manager.go b/core/chain_manager.go index f9fb3b3f8..9ed2c1c42 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -137,6 +137,10 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block { return block } +func (self *ChainManager) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { + return self.TD, self.CurrentBlock.Hash(), self.Genesis().Hash() +} + func (bc *ChainManager) Reset() { AddTestNetFunds(bc.genesisBlock) -- cgit v1.2.3 From e77b720ead2e8f91f6f98664a66953c3826269c6 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 19:35:54 +0000 Subject: blockmanager start/stop obsolete --- eth/backend.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 9154ca0f5..a7824e5d7 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -194,7 +194,6 @@ func (s *Ethereum) Start(seed bool) error { return err } s.blockPool.Start() - s.blockManager.Start() go s.filterLoop() @@ -244,7 +243,6 @@ func (s *Ethereum) Stop() { s.RpcServer.Stop() } s.txPool.Stop() - s.blockManager.Stop() s.eventMux.Stop() s.blockPool.Stop() -- cgit v1.2.3 From 61940b2275a8f3c77d906947b2d1126bb6c3b21d Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 19:55:52 +0000 Subject: adapt cmd/cli to new backend - new flag nat for nat support UPNP|PMP - new flag pmp for PMP gateway IP - add NatType to utils/cmd to get p2p.NAT from nat type string - obsolete usepnp flag - get rid of IsUpToDate and sleep in miner start - ethereum constructor takes nat type, port, maxpeer - add pubkey arg to client identity --- cmd/ethereum/flags.go | 5 +++++ cmd/utils/cmd.go | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 0bea73794..e709ecf50 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -85,8 +85,13 @@ func Init() { flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use") flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") flag.StringVar(&OutboundPort, "port", "30303", "listening port") +<<<<<<< HEAD flag.StringVar(&NatType, "nat", "", "nat support (UPNP|PMP)") flag.StringVar(&PMPGateway, "gateway", "", "PMP gateway IP") +======= + flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)") + flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for PMP") +>>>>>>> adapt cmd/cli to new backend flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 24d5970bd..867ef5e37 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -154,13 +154,22 @@ func NatType(natType string, gateway string) (nat p2p.NAT) { nat = p2p.UPNP() case "PMP": ip := net.ParseIP(gateway) +<<<<<<< HEAD if ip != nil { clilogger.Fatalf("bad PMP gateway '%s'", gateway) +======= + if ip == nil { + clilogger.Fatalln("cannot resolve PMP gateway IP %s", gateway) +>>>>>>> adapt cmd/cli to new backend } nat = p2p.PMP(ip) case "": default: +<<<<<<< HEAD clilogger.Fatalf("unrecognised NAT type '%s'", natType) +======= + clilogger.Fatalln("unrecognised NAT type %s", natType) +>>>>>>> adapt cmd/cli to new backend } return } -- cgit v1.2.3 From 4c89d5331f41fa93e6840893c6727b05eabe5f99 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 20:08:24 +0000 Subject: adapt blockpool/backend to use pow/ezp with pow.Block for VerifyPoW func --- eth/backend.go | 7 +++---- eth/block_pool.go | 8 -------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index a7824e5d7..6235fc824 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -7,12 +7,12 @@ import ( "sync" "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" ethlogger "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/pow/ezp" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/state" ) @@ -111,9 +111,8 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke hasBlock := eth.chainManager.HasBlock insertChain := eth.chainManager.InsertChain - // pow := ezp.New() - // verifyPoW := pow.Verify - verifyPoW := func(*types.Block) bool { return true } + pow := ezp.New() + verifyPoW := pow.Verify eth.blockPool = NewBlockPool(hasBlock, insertChain, verifyPoW) // Start the tx pool diff --git a/eth/block_pool.go b/eth/block_pool.go index a5cda7b58..7cfbc63f8 100644 --- a/eth/block_pool.go +++ b/eth/block_pool.go @@ -55,11 +55,7 @@ type BlockPool struct { // the minimal interface with blockchain hasBlock func(hash []byte) bool insertChain func(types.Blocks) error -<<<<<<< HEAD verifyPoW func(pow.Block) bool -======= - verifyPoW func(*types.Block) bool ->>>>>>> blockpool rewritten , tests broken FIXME } type peerInfo struct { @@ -78,11 +74,7 @@ type peerInfo struct { quitC chan bool } -<<<<<<< HEAD func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(pow.Block) bool, -======= -func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(*types.Block) bool, ->>>>>>> blockpool rewritten , tests broken FIXME ) *BlockPool { return &BlockPool{ hasBlock: hasBlock, -- cgit v1.2.3 From 72290f67fee2be183981c9672d830040466187bd Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 20:57:29 +0000 Subject: resolve merge conflict hell --- cmd/ethereum/flags.go | 5 ----- cmd/utils/cmd.go | 11 +---------- core/chain_manager.go | 4 ---- ethereum | Bin 16025932 -> 0 bytes 4 files changed, 1 insertion(+), 19 deletions(-) delete mode 100755 ethereum diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index e709ecf50..556735491 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -85,13 +85,8 @@ func Init() { flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use") flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") flag.StringVar(&OutboundPort, "port", "30303", "listening port") -<<<<<<< HEAD - flag.StringVar(&NatType, "nat", "", "nat support (UPNP|PMP)") - flag.StringVar(&PMPGateway, "gateway", "", "PMP gateway IP") -======= flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)") flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for PMP") ->>>>>>> adapt cmd/cli to new backend flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 867ef5e37..3e3ac617a 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -154,22 +154,13 @@ func NatType(natType string, gateway string) (nat p2p.NAT) { nat = p2p.UPNP() case "PMP": ip := net.ParseIP(gateway) -<<<<<<< HEAD - if ip != nil { - clilogger.Fatalf("bad PMP gateway '%s'", gateway) -======= if ip == nil { - clilogger.Fatalln("cannot resolve PMP gateway IP %s", gateway) ->>>>>>> adapt cmd/cli to new backend + clilogger.Fatalf("cannot resolve PMP gateway IP %s", gateway) } nat = p2p.PMP(ip) case "": default: -<<<<<<< HEAD clilogger.Fatalf("unrecognised NAT type '%s'", natType) -======= - clilogger.Fatalln("unrecognised NAT type %s", natType) ->>>>>>> adapt cmd/cli to new backend } return } diff --git a/core/chain_manager.go b/core/chain_manager.go index 9ed2c1c42..f9fb3b3f8 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -137,10 +137,6 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block { return block } -func (self *ChainManager) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { - return self.TD, self.CurrentBlock.Hash(), self.Genesis().Hash() -} - func (bc *ChainManager) Reset() { AddTestNetFunds(bc.genesisBlock) diff --git a/ethereum b/ethereum deleted file mode 100755 index 7e17d95a4..000000000 Binary files a/ethereum and /dev/null differ -- cgit v1.2.3 From f111fc060884d69fbe46066b9ccae4c9aa5da890 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 11:37:23 +0100 Subject: WIP --- eth/backend.go | 53 ++++++++++------------------------------------------- pow/ezp/pow.go | 12 ++++++++---- 2 files changed, 18 insertions(+), 47 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 6235fc824..bdd5956a3 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -3,7 +3,6 @@ package eth import ( "encoding/json" "net" - "path" "sync" "github.com/ethereum/go-ethereum/core" @@ -32,7 +31,6 @@ type Ethereum struct { db ethutil.Database // State manager for processing new blocks and managing the over all states blockManager *core.BlockManager - // The transaction pool. Transaction can be pushed on this pool // for later including in the blocks txPool *core.TxPool @@ -43,22 +41,11 @@ type Ethereum struct { // Event eventMux *event.TypeMux - // Nonce - Nonce uint64 - - ListenAddr string - blacklist p2p.Blacklist server *p2p.Server txSub event.Subscription blockSub event.Subscription - // Capabilities for outgoing peers - // serverCaps Caps - peersFile string - - Mining bool - RpcServer *rpc.JsonRpcServer keyManager *crypto.KeyManager @@ -71,6 +58,8 @@ type Ethereum struct { filterMu sync.RWMutex filterId int filters map[int]*core.Filter + + Mining bool } func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.KeyManager, nat p2p.NAT, port string, maxPeers int) (*Ethereum, error) { @@ -78,28 +67,13 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke saveProtocolVersion(db) ethutil.Config.Db = db - // FIXME: - blacklist := p2p.NewBlacklist() - // Sorry Py person. I must blacklist. you perform badly - blacklist.Put(ethutil.Hex2Bytes("64656330303561383532336435376331616537643864663236623336313863373537353163636634333530626263396330346237336262623931383064393031")) - - peersFile := path.Join(ethutil.Config.ExecPath, "known_peers.json") - - nonce, _ := ethutil.RandomUint64() - - listenAddr := ":" + port - eth := &Ethereum{ - shutdownChan: make(chan bool), - quit: make(chan bool), - db: db, - Nonce: nonce, - // serverCaps: caps, - peersFile: peersFile, - ListenAddr: listenAddr, + shutdownChan: make(chan bool), + quit: make(chan bool), + db: db, keyManager: keyManager, clientIdentity: identity, - blacklist: blacklist, + blacklist: p2p.NewBlocklist(), eventMux: &event.TypeMux{}, filters: make(map[int]*core.Filter), } @@ -111,9 +85,7 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke hasBlock := eth.chainManager.HasBlock insertChain := eth.chainManager.InsertChain - pow := ezp.New() - verifyPoW := pow.Verify - eth.blockPool = NewBlockPool(hasBlock, insertChain, verifyPoW) + eth.blockPool = NewBlockPool(hasBlock, insertChain, ezp.Verify) // Start the tx pool eth.txPool.Start() @@ -125,7 +97,7 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke Identity: identity, MaxPeers: maxPeers, Protocols: protocols, - ListenAddr: listenAddr, + ListenAddr: ":" + port, Blacklist: blacklist, NAT: nat, } @@ -171,11 +143,8 @@ func (s *Ethereum) IsMining() bool { } func (s *Ethereum) IsListening() bool { - if s.ListenAddr == "" { - return false - } else { - return true - } + // XXX TODO + return false } func (s *Ethereum) PeerCount() int { @@ -231,8 +200,6 @@ func (s *Ethereum) Stop() { // Close the database defer s.db.Close() - // - // WritePeers(s.peersFile, s.server.PeerAddresses()) close(s.quit) s.txSub.Unsubscribe() // quits txBroadcastLoop diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go index cdf89950f..b4f863cb6 100644 --- a/pow/ezp/pow.go +++ b/pow/ezp/pow.go @@ -59,7 +59,7 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte { } sha := crypto.Sha3(big.NewInt(r.Int63()).Bytes()) - if pow.verify(hash, diff, sha) { + if verify(hash, diff, sha) { return sha } } @@ -72,7 +72,11 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte { return nil } -func (pow *EasyPow) verify(hash []byte, diff *big.Int, nonce []byte) bool { +func (pow *EasyPow) Verify(block pow.Block) bool { + return Verify(block) +} + +func verify(hash []byte, diff *big.Int, nonce []byte) bool { sha := sha3.NewKeccak256() d := append(hash, nonce...) @@ -84,6 +88,6 @@ func (pow *EasyPow) verify(hash []byte, diff *big.Int, nonce []byte) bool { return res.Cmp(verification) <= 0 } -func (pow *EasyPow) Verify(block pow.Block) bool { - return pow.verify(block.HashNoNonce(), block.Diff(), block.N()) +func Verify(block pow.Block) bool { + return verify(block.HashNoNonce(), block.Diff(), block.N()) } -- cgit v1.2.3 From afc8b887abfbfeaec5040a39f0f20d3071902abe Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 12:01:55 +0100 Subject: added whisper --- eth/backend.go | 37 +++++++++++++++++++------------------ whisper/whisper.go | 26 ++++++++++++++++---------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index bdd5956a3..0bdeeea2a 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/pow/ezp" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/state" + "github.com/ethereum/go-ethereum/whisper" ) const ( @@ -28,26 +29,23 @@ type Ethereum struct { quit chan bool // DB interface - db ethutil.Database + db ethutil.Database + blacklist p2p.Blacklist + + //*** SERVICES *** // State manager for processing new blocks and managing the over all states blockManager *core.BlockManager - // The transaction pool. Transaction can be pushed on this pool - // for later including in the blocks - txPool *core.TxPool - // The canonical chain + txPool *core.TxPool chainManager *core.ChainManager - // The block pool - blockPool *BlockPool - // Event - eventMux *event.TypeMux + blockPool *BlockPool + whisper *whisper.Whisper - blacklist p2p.Blacklist - server *p2p.Server - txSub event.Subscription - blockSub event.Subscription - - RpcServer *rpc.JsonRpcServer + server *p2p.Server + eventMux *event.TypeMux + txSub event.Subscription + blockSub event.Subscription + RpcServer *rpc.JsonRpcServer keyManager *crypto.KeyManager clientIdentity p2p.ClientIdentity @@ -73,7 +71,7 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke db: db, keyManager: keyManager, clientIdentity: identity, - blacklist: p2p.NewBlocklist(), + blacklist: p2p.NewBlacklist(), eventMux: &event.TypeMux{}, filters: make(map[int]*core.Filter), } @@ -82,12 +80,13 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke eth.chainManager = core.NewChainManager(eth.EventMux()) eth.blockManager = core.NewBlockManager(eth) eth.chainManager.SetProcessor(eth.blockManager) + eth.whisper = whisper.New() hasBlock := eth.chainManager.HasBlock insertChain := eth.chainManager.InsertChain eth.blockPool = NewBlockPool(hasBlock, insertChain, ezp.Verify) - // Start the tx pool + // Start services eth.txPool.Start() ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool) @@ -98,7 +97,7 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke MaxPeers: maxPeers, Protocols: protocols, ListenAddr: ":" + port, - Blacklist: blacklist, + Blacklist: eth.blacklist, NAT: nat, } @@ -162,6 +161,7 @@ func (s *Ethereum) Start(seed bool) error { return err } s.blockPool.Start() + s.whisper.Start() go s.filterLoop() @@ -211,6 +211,7 @@ func (s *Ethereum) Stop() { s.txPool.Stop() s.eventMux.Stop() s.blockPool.Stop() + s.whisper.Stop() logger.Infoln("Server stopped") close(s.shutdownChan) diff --git a/whisper/whisper.go b/whisper/whisper.go index 356debd1c..1b3f54b67 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -4,12 +4,12 @@ import ( "bytes" "crypto/ecdsa" "errors" - "fmt" "sync" "time" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/event/filter" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" "gopkg.in/fatih/set.v0" ) @@ -47,6 +47,8 @@ type MessageEvent struct { const DefaultTtl = 50 * time.Second +var wlogger = logger.NewLogger("SHH") + type Whisper struct { protocol p2p.Protocol filters *filter.Filters @@ -68,16 +70,15 @@ func New() *Whisper { quit: make(chan struct{}), } whisper.filters.Start() - go whisper.update() // XXX TODO REMOVE TESTING CODE - msg := NewMessage([]byte(fmt.Sprintf("Hello world. This is whisper-go. Incase you're wondering; the time is %v", time.Now()))) - envelope, _ := msg.Seal(DefaultPow, Opts{ - Ttl: DefaultTtl, - }) - if err := whisper.Send(envelope); err != nil { - fmt.Println(err) - } + //msg := NewMessage([]byte(fmt.Sprintf("Hello world. This is whisper-go. Incase you're wondering; the time is %v", time.Now()))) + //envelope, _ := msg.Seal(DefaultPow, Opts{ + // Ttl: DefaultTtl, + //}) + //if err := whisper.Send(envelope); err != nil { + // fmt.Println(err) + //} // XXX TODO REMOVE TESTING CODE // p2p whisper sub protocol handler @@ -91,6 +92,11 @@ func New() *Whisper { return whisper } +func (self *Whisper) Start() { + wlogger.Infoln("Whisper started") + go self.update() +} + func (self *Whisper) Stop() { close(self.quit) } @@ -236,7 +242,7 @@ func (self *Whisper) postEvent(envelope *Envelope) { Str1: string(crypto.FromECDSA(key)), Str2: string(crypto.FromECDSAPub(message.Recover())), }, message) } else { - fmt.Println(err) + wlogger.Infoln(err) } } } -- cgit v1.2.3 From 6c168c8f2220df0cfd9f9e97ba5cfd6e351bf44e Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 12:02:24 +0100 Subject: added protocol handler --- eth/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/backend.go b/eth/backend.go index 0bdeeea2a..f3f25d7b5 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -90,7 +90,7 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke eth.txPool.Start() ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool) - protocols := []p2p.Protocol{ethProto} + protocols := []p2p.Protocol{ethProto, eth.whisper.Protocol()} server := &p2p.Server{ Identity: identity, -- cgit v1.2.3 From 4b5ad31b3ab8e1370233be6479e7476bc0019080 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 12:07:46 +0100 Subject: WIP --- eth/backend.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index f3f25d7b5..5b7dc6435 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/event/filter" ethlogger "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/pow/ezp" @@ -53,9 +54,10 @@ type Ethereum struct { synclock sync.Mutex syncGroup sync.WaitGroup - filterMu sync.RWMutex - filterId int - filters map[int]*core.Filter + filterManager *filter.FilterManager + //filterMu sync.RWMutex + //filterId int + //filters map[int]*core.Filter Mining bool } -- cgit v1.2.3 From cdb2ebbdfa510294b8443e33c32f9e0ec414f78e Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 12:08:10 +0100 Subject: Added old filter. Needs some refactoring --- eth/backend.go | 63 +++---------------------------- event/filter/old_filter.go | 94 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 57 deletions(-) create mode 100644 event/filter/old_filter.go diff --git a/eth/backend.go b/eth/backend.go index 5b7dc6435..fb401a68d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -14,7 +14,6 @@ import ( "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/pow/ezp" "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/whisper" ) @@ -75,7 +74,6 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke clientIdentity: identity, blacklist: p2p.NewBlacklist(), eventMux: &event.TypeMux{}, - filters: make(map[int]*core.Filter), } eth.txPool = core.NewTxPool(eth) @@ -83,6 +81,7 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke eth.blockManager = core.NewBlockManager(eth) eth.chainManager.SetProcessor(eth.blockManager) eth.whisper = whisper.New() + eth.filterManager = filter.NewFilterManager(eth.EventMux()) hasBlock := eth.chainManager.HasBlock insertChain := eth.chainManager.InsertChain @@ -164,8 +163,7 @@ func (s *Ethereum) Start(seed bool) error { } s.blockPool.Start() s.whisper.Start() - - go s.filterLoop() + s.filterManager.Start() // broadcast transactions s.txSub = s.eventMux.Subscribe(core.TxPreEvent{}) @@ -267,58 +265,9 @@ func saveProtocolVersion(db ethutil.Database) { } } -// InstallFilter adds filter for blockchain events. -// The filter's callbacks will run for matching blocks and messages. -// The filter should not be modified after it has been installed. +// XXX Refactor me & MOVE func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { - self.filterMu.Lock() - id = self.filterId - self.filters[id] = filter - self.filterId++ - self.filterMu.Unlock() - return id -} - -func (self *Ethereum) UninstallFilter(id int) { - self.filterMu.Lock() - delete(self.filters, id) - self.filterMu.Unlock() -} - -// GetFilter retrieves a filter installed using InstallFilter. -// The filter may not be modified. -func (self *Ethereum) GetFilter(id int) *core.Filter { - self.filterMu.RLock() - defer self.filterMu.RUnlock() - return self.filters[id] -} - -func (self *Ethereum) filterLoop() { - // Subscribe to events - events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Messages(nil)) - for event := range events.Chan() { - switch event.(type) { - case core.NewBlockEvent: - self.filterMu.RLock() - for _, filter := range self.filters { - if filter.BlockCallback != nil { - e := event.(core.NewBlockEvent) - filter.BlockCallback(e.Block) - } - } - self.filterMu.RUnlock() - case state.Messages: - self.filterMu.RLock() - for _, filter := range self.filters { - if filter.MessageCallback != nil { - e := event.(state.Messages) - msgs := filter.FilterMessages(e) - if len(msgs) > 0 { - filter.MessageCallback(msgs) - } - } - } - self.filterMu.RUnlock() - } - } + return self.filterManager.InstallFilter(filter) } +func (self *Ethereum) UninstallFilter(id int) { self.filterManager.UninstallFilter(id) } +func (self *Ethereum) GetFilter(id int) *core.Filter { return self.filterManager.GetFilter(id) } diff --git a/event/filter/old_filter.go b/event/filter/old_filter.go new file mode 100644 index 000000000..1a9a88173 --- /dev/null +++ b/event/filter/old_filter.go @@ -0,0 +1,94 @@ +// XXX This is the old filter system specifically for messages. This is till in used and could use some refactoring +package filter + +import ( + "sync" + + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/state" +) + +type FilterManager struct { + eventMux *event.TypeMux + + filterMu sync.RWMutex + filterId int + filters map[int]*core.Filter + + quit chan struct{} +} + +func NewFilterManager(mux *event.TypeMux) *FilterManager { + return &FilterManager{ + eventMux: mux, + filters: make(map[int]*core.Filter), + } +} + +func (self *FilterManager) Start() { + go self.filterLoop() +} + +func (self *FilterManager) Stop() { + close(self.quit) +} + +func (self *FilterManager) InstallFilter(filter *core.Filter) (id int) { + self.filterMu.Lock() + id = self.filterId + self.filters[id] = filter + self.filterId++ + self.filterMu.Unlock() + return id +} + +func (self *FilterManager) UninstallFilter(id int) { + self.filterMu.Lock() + delete(self.filters, id) + self.filterMu.Unlock() +} + +// GetFilter retrieves a filter installed using InstallFilter. +// The filter may not be modified. +func (self *FilterManager) GetFilter(id int) *core.Filter { + self.filterMu.RLock() + defer self.filterMu.RUnlock() + return self.filters[id] +} + +func (self *FilterManager) filterLoop() { + // Subscribe to events + events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Messages(nil)) + +out: + for { + select { + case <-self.quit: + break out + case event := <-events.Chan(): + switch event := event.(type) { + case core.NewBlockEvent: + self.filterMu.RLock() + for _, filter := range self.filters { + if filter.BlockCallback != nil { + filter.BlockCallback(event.Block) + } + } + self.filterMu.RUnlock() + + case state.Messages: + self.filterMu.RLock() + for _, filter := range self.filters { + if filter.MessageCallback != nil { + msgs := filter.FilterMessages(event) + if len(msgs) > 0 { + filter.MessageCallback(msgs) + } + } + } + self.filterMu.RUnlock() + } + } + } +} -- cgit v1.2.3 From 96272e19a6b7a3163ec53f45e04407e9d2ff8414 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 12:34:06 +0100 Subject: removed filter manager from base --- cmd/mist/ui_lib.go | 11 ++++++++++- eth/backend.go | 15 --------------- eth/protocol.go | 43 ++++++++++++++++++++++--------------------- 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index fdbde50fd..d5578645f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -24,7 +24,6 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" @@ -64,6 +63,7 @@ type UiLib struct { func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { lib := &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} lib.miner = miner.New(eth.KeyManager().Address(), eth) + //eth.filterManager = filter.NewFilterManager(eth.EventMux()) return lib } @@ -372,3 +372,12 @@ func (self *UiLib) ToggleMining() bool { return false } } + +/* +// XXX Refactor me & MOVE +func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { + return self.filterManager.InstallFilter(filter) +} +func (self *Ethereum) UninstallFilter(id int) { self.filterManager.UninstallFilter(id) } +func (self *Ethereum) GetFilter(id int) *core.Filter { return self.filterManager.GetFilter(id) } +*/ diff --git a/eth/backend.go b/eth/backend.go index fb401a68d..3ec36d3fc 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -9,7 +9,6 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/event/filter" ethlogger "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/pow/ezp" @@ -53,11 +52,6 @@ type Ethereum struct { synclock sync.Mutex syncGroup sync.WaitGroup - filterManager *filter.FilterManager - //filterMu sync.RWMutex - //filterId int - //filters map[int]*core.Filter - Mining bool } @@ -81,7 +75,6 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke eth.blockManager = core.NewBlockManager(eth) eth.chainManager.SetProcessor(eth.blockManager) eth.whisper = whisper.New() - eth.filterManager = filter.NewFilterManager(eth.EventMux()) hasBlock := eth.chainManager.HasBlock insertChain := eth.chainManager.InsertChain @@ -163,7 +156,6 @@ func (s *Ethereum) Start(seed bool) error { } s.blockPool.Start() s.whisper.Start() - s.filterManager.Start() // broadcast transactions s.txSub = s.eventMux.Subscribe(core.TxPreEvent{}) @@ -264,10 +256,3 @@ func saveProtocolVersion(db ethutil.Database) { db.Put([]byte("ProtocolVersion"), ethutil.NewValue(ProtocolVersion).Bytes()) } } - -// XXX Refactor me & MOVE -func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { - return self.filterManager.InstallFilter(filter) -} -func (self *Ethereum) UninstallFilter(id int) { self.filterManager.UninstallFilter(id) } -func (self *Ethereum) GetFilter(id int) *core.Filter { return self.filterManager.GetFilter(id) } diff --git a/eth/protocol.go b/eth/protocol.go index 3b5b49696..8cbf6d309 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -11,6 +11,25 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) +const ( + ProtocolVersion = 49 + NetworkId = 0 + ProtocolLength = uint64(8) + ProtocolMaxMsgSize = 10 * 1024 * 1024 +) + +// eth protocol message codes +const ( + StatusMsg = iota + GetTxMsg // unused + TxMsg + GetBlockHashesMsg + BlockHashesMsg + GetBlocksMsg + BlocksMsg + NewBlockMsg +) + // ethProtocol represents the ethereum wire protocol // instance is running on each peer type ethProtocol struct { @@ -41,25 +60,6 @@ type blockPool interface { RemovePeer(peerId string) } -const ( - ProtocolVersion = 43 - NetworkId = 0 - ProtocolLength = uint64(8) - ProtocolMaxMsgSize = 10 * 1024 * 1024 -) - -// eth protocol message codes -const ( - StatusMsg = iota - GetTxMsg // unused - TxMsg - GetBlockHashesMsg - BlockHashesMsg - GetBlocksMsg - BlocksMsg - NewBlockMsg -) - // message structs used for rlp decoding type newBlockMsgData struct { Block *types.Block @@ -279,9 +279,10 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) } - self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + self.peer.Infof("Peer is [eth] capable (%d/%d). TD=%v H=%x\n", status.ProtocolVersion, status.NetworkId, status.TD, status.CurrentBlock[:4]) - self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) + //self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) + self.peer.Infoln("AddPeer(IGNORED)") return nil } -- cgit v1.2.3 From c7bc684909ab3d135d25a718d5ff2c725816e0fc Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 12:35:21 +0100 Subject: Moved peer helper metheds --- eth/backend.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 3ec36d3fc..1d991b9ef 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -1,7 +1,6 @@ package eth import ( - "encoding/json" "net" "sync" @@ -214,22 +213,6 @@ func (s *Ethereum) WaitForShutdown() { <-s.shutdownChan } -func WritePeers(path string, addresses []string) { - if len(addresses) > 0 { - data, _ := json.MarshalIndent(addresses, "", " ") - ethutil.WriteFile(path, data) - } -} - -func ReadPeers(path string) (ips []string, err error) { - var data string - data, err = ethutil.ReadAllFile(path) - if err != nil { - json.Unmarshal([]byte(data), &ips) - } - return -} - // now tx broadcasting is taken out of txPool // handled here via subscription, efficiency? func (self *Ethereum) txBroadcastLoop() { -- cgit v1.2.3 From 56dac74f71d4d1fffa3e240c7d3cee803dec788d Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 13:00:09 +0100 Subject: made mist in a compilable, workable state using the new refactored packages --- cmd/mist/flags.go | 4 ++++ cmd/mist/gui.go | 36 +++++++++++++++++------------------- cmd/mist/main.go | 6 +++--- cmd/mist/ui_lib.go | 18 +++++++++++------- eth/backend.go | 4 ++++ eth/peer_util.go | 23 +++++++++++++++++++++++ p2p/server.go | 1 + 7 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 eth/peer_util.go diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 2ae0a0487..1d77532d9 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -36,10 +36,12 @@ var ( Identifier string KeyRing string KeyStore string + PMPGateway string StartRpc bool StartWebSockets bool RpcPort int UseUPnP bool + NatType string OutboundPort string ShowGenesis bool AddPeer string @@ -111,10 +113,12 @@ func Init() { flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") flag.BoolVar(&UseSeed, "seed", true, "seed peers") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") + flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)") flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)") flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given") flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)") flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use") + flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for PMP") flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index fe066e994..40499ad7f 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -30,14 +30,14 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/wire" + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -97,7 +97,7 @@ type Gui struct { pipe *xeth.JSXEth Session string - clientIdentity *wire.SimpleClientIdentity + clientIdentity *p2p.SimpleClientIdentity config *ethutil.ConfigManager plugins map[string]plugin @@ -107,7 +107,7 @@ type Gui struct { } // Create GUI, but doesn't start it -func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIdentity *wire.SimpleClientIdentity, session string, logLevel int) *Gui { +func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIdentity *p2p.SimpleClientIdentity, session string, logLevel int) *Gui { db, err := ethdb.NewLDBDatabase("tx_database") if err != nil { panic(err) @@ -409,8 +409,7 @@ func (gui *Gui) update() { miningLabel := gui.getObjectByName("miningLabel") events := gui.eth.EventMux().Subscribe( - eth.ChainSyncEvent{}, - eth.PeerListEvent{}, + //eth.PeerListEvent{}, core.NewBlockEvent{}, core.TxPreEvent{}, core.TxPostEvent{}, @@ -460,9 +459,6 @@ func (gui *Gui) update() { gui.setWalletValue(object.Balance(), nil) state.UpdateStateObject(object) - - case eth.PeerListEvent: - gui.setPeerInfo() } case <-peerUpdateTicker.C: @@ -472,16 +468,18 @@ func (gui *Gui) update() { lastBlockLabel.Set("text", statusText) miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") - blockLength := gui.eth.BlockPool().BlocksProcessed - chainLength := gui.eth.BlockPool().ChainLength + /* + blockLength := gui.eth.BlockPool().BlocksProcessed + chainLength := gui.eth.BlockPool().ChainLength - var ( - pct float64 = 1.0 / float64(chainLength) * float64(blockLength) - dlWidget = gui.win.Root().ObjectByName("downloadIndicator") - dlLabel = gui.win.Root().ObjectByName("downloadLabel") - ) - dlWidget.Set("value", pct) - dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength)) + var ( + pct float64 = 1.0 / float64(chainLength) * float64(blockLength) + dlWidget = gui.win.Root().ObjectByName("downloadIndicator") + dlLabel = gui.win.Root().ObjectByName("downloadLabel") + ) + dlWidget.Set("value", pct) + dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength)) + */ case <-statsUpdateTicker.C: gui.setStatsPane() @@ -509,7 +507,7 @@ Heap Alloc: %d CGNext: %x NumGC: %d `, Version, runtime.Version(), - eth.ProtocolVersion, eth.P2PVersion, + eth.ProtocolVersion, 2, runtime.NumCPU, runtime.NumGoroutine(), runtime.NumCgoCall(), memStats.Alloc, memStats.HeapAlloc, memStats.NextGC, memStats.NumGC, diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 14336b4e8..1c0af5d8c 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -23,8 +23,8 @@ import ( "runtime" "time" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/logger" "gopkg.in/qml.v1" ) @@ -58,8 +58,8 @@ func run() error { // create, import, export keys utils.KeyTasks(keyManager, KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive) - clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier) - ethereum = utils.NewEthereum(db, clientIdentity, keyManager, UseUPnP, OutboundPort, MaxPeer) + clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier, string(keyManager.PublicKey())) + ethereum := utils.NewEthereum(db, clientIdentity, keyManager, utils.NatType(NatType, PMPGateway), OutboundPort, MaxPeer) if ShowGenesis { utils.ShowGenesis(ethereum) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index d5578645f..d34b527ce 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -27,7 +27,9 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/state" @@ -56,6 +58,7 @@ type UiLib struct { jsEngine *javascript.JSRE filterCallbacks map[int][]int + filterManager *filter.FilterManager miner *miner.Miner } @@ -63,7 +66,7 @@ type UiLib struct { func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { lib := &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} lib.miner = miner.New(eth.KeyManager().Address(), eth) - //eth.filterManager = filter.NewFilterManager(eth.EventMux()) + lib.filterManager = filter.NewFilterManager(eth.EventMux()) return lib } @@ -123,7 +126,8 @@ func (self *UiLib) LookupAddress(name string) string { } func (self *UiLib) PastPeers() *ethutil.List { - return ethutil.NewList(eth.PastPeers()) + return ethutil.NewList([]string{}) + //return ethutil.NewList(eth.PastPeers()) } func (self *UiLib) ImportTx(rlpTx string) { @@ -191,7 +195,7 @@ func (ui *UiLib) Connect(button qml.Object) { } func (ui *UiLib) ConnectToPeer(addr string) { - ui.eth.ConnectToPeer(addr) + ui.eth.SuggestPeer(addr) } func (ui *UiLib) AssetPath(p string) string { @@ -226,7 +230,7 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { filter.MessageCallback = func(messages state.Messages) { self.win.Root().Call("invokeFilterCallback", xeth.ToJSMessages(messages), id) } - id = self.eth.InstallFilter(filter) + id = self.filterManager.InstallFilter(filter) return id } @@ -239,12 +243,12 @@ func (self *UiLib) NewFilterString(typ string) (id int) { fmt.Println("QML is lagging") } } - id = self.eth.InstallFilter(filter) + id = self.filterManager.InstallFilter(filter) return id } func (self *UiLib) Messages(id int) *ethutil.List { - filter := self.eth.GetFilter(id) + filter := self.filterManager.GetFilter(id) if filter != nil { messages := xeth.ToJSMessages(filter.Find()) @@ -255,7 +259,7 @@ func (self *UiLib) Messages(id int) *ethutil.List { } func (self *UiLib) UninstallFilter(id int) { - self.eth.UninstallFilter(id) + self.filterManager.UninstallFilter(id) } func mapToTxParams(object map[string]interface{}) map[string]string { diff --git a/eth/backend.go b/eth/backend.go index 1d991b9ef..e275238bd 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -147,6 +147,10 @@ func (s *Ethereum) Peers() []*p2p.Peer { return s.server.Peers() } +func (s *Ethereum) MaxPeers() int { + return s.server.MaxPeers +} + // Start the ethereum func (s *Ethereum) Start(seed bool) error { err := s.server.Start() diff --git a/eth/peer_util.go b/eth/peer_util.go new file mode 100644 index 000000000..6cf80cde2 --- /dev/null +++ b/eth/peer_util.go @@ -0,0 +1,23 @@ +package eth + +import ( + "encoding/json" + + "github.com/ethereum/go-ethereum/ethutil" +) + +func WritePeers(path string, addresses []string) { + if len(addresses) > 0 { + data, _ := json.MarshalIndent(addresses, "", " ") + ethutil.WriteFile(path, data) + } +} + +func ReadPeers(path string) (ips []string, err error) { + var data string + data, err = ethutil.ReadAllFile(path) + if err != nil { + json.Unmarshal([]byte(data), &ips) + } + return +} diff --git a/p2p/server.go b/p2p/server.go index 8a6087566..9353e12ea 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -416,6 +416,7 @@ func (srv *Server) verifyPeer(addr *peerAddr) error { return nil } +// TODO replace with "Set" type Blacklist interface { Get([]byte) (bool, error) Put([]byte) error -- cgit v1.2.3 From 455241debb6fa11053bd3a5429cdd9890bb607dc Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 17:09:06 +0100 Subject: Removed goroutine from "Run" --- eth/protocol.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eth/protocol.go b/eth/protocol.go index 8cbf6d309..3b6f95d44 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -2,6 +2,7 @@ package eth import ( "bytes" + "fmt" "math" "math/big" @@ -98,15 +99,14 @@ func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPoo } err = self.handleStatus() if err == nil { - go func() { - for { - err = self.handle() - if err != nil { - self.blockPool.RemovePeer(self.id) - break - } + for { + err = self.handle() + if err != nil { + fmt.Println(err) + self.blockPool.RemovePeer(self.id) + break } - }() + } } return } -- cgit v1.2.3 From 6ff9d5770b332da6d767bc315a54c5a815143aff Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 17:09:14 +0100 Subject: Added whisper handler --- eth/backend.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eth/backend.go b/eth/backend.go index e275238bd..ef82a5bfc 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -123,6 +123,10 @@ func (s *Ethereum) BlockPool() *BlockPool { return s.blockPool } +func (s *Ethereum) Whisper() *whisper.Whisper { + return s.whisper +} + func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux } -- cgit v1.2.3 From 993280ec03a8bd8e108da7e222c98efa8482084b Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 17:09:27 +0100 Subject: Added whisper test --- cmd/mist/assets/qml/views/whisper.qml | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cmd/mist/assets/qml/views/whisper.qml diff --git a/cmd/mist/assets/qml/views/whisper.qml b/cmd/mist/assets/qml/views/whisper.qml new file mode 100644 index 000000000..631f1981e --- /dev/null +++ b/cmd/mist/assets/qml/views/whisper.qml @@ -0,0 +1,46 @@ + +import QtQuick 2.0 +import QtQuick.Controls 1.0; +import QtQuick.Layouts 1.0; +import QtQuick.Dialogs 1.0; +import QtQuick.Window 2.1; +import QtQuick.Controls.Styles 1.1 +import Ethereum 1.0 + +Rectangle { + id: root + property var title: "Whisper" + property var iconSource: "../facet.png" + property var menuItem + + objectName: "whisperView" + anchors.fill: parent + + property var identity: "" + Component.onCompleted: { + identity = shh.newIdentity() + console.log("New identity:", identity) + } + + RowLayout { + TextField { + id: to + placeholderText: "To" + } + TextField { + id: data + placeholderText: "Data" + } + TextField { + id: topics + placeholderText: "topic1, topic2, topic3, ..." + } + + Button { + text: "Send" + onClicked: { + shh.post(eth.toHex(data.text), "", identity, topics.text.split(","), 500, 50) + } + } + } +} -- cgit v1.2.3 From 01a6db93241a01e98a0467b628423c9b5b1361cb Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 17:14:02 +0100 Subject: Added whisper debug interface + whisper fixes --- cmd/mist/assets/qml/main.qml | 1 + cmd/mist/gui.go | 8 +++++++- cmd/mist/ui_lib.go | 4 ++++ ui/qt/qwhisper/whisper.go | 20 +++++++++++++++----- whisper/main.go | 14 ++------------ whisper/whisper.go | 13 +++---------- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 9f1f214a6..285757080 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -50,6 +50,7 @@ ApplicationWindow { addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); + addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"}); diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 40499ad7f..ba031e6c3 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -38,6 +38,7 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/ui/qt/qwhisper" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -87,7 +88,8 @@ type Gui struct { eth *eth.Ethereum // The public Ethereum library - uiLib *UiLib + uiLib *UiLib + whisper *qwhisper.Whisper txDb *ethdb.LDBDatabase @@ -138,10 +140,12 @@ func (gui *Gui) Start(assetPath string) { gui.engine = qml.NewEngine() context := gui.engine.Context() gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath) + gui.whisper = qwhisper.New(gui.eth.Whisper()) // Expose the eth library and the ui library to QML context.SetVar("gui", gui) context.SetVar("eth", gui.uiLib) + context.SetVar("shh", gui.whisper) // Load the main QML interface data, _ := ethutil.Config.Db.Get([]byte("KeyRing")) @@ -391,6 +395,8 @@ func (gui *Gui) update() { gui.setPeerInfo() }() + gui.whisper.SetView(gui.win.Root().ObjectByName("whisperView")) + for _, plugin := range gui.plugins { guilogger.Infoln("Loading plugin ", plugin.Name) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index d34b527ce..68f333563 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -377,6 +377,10 @@ func (self *UiLib) ToggleMining() bool { } } +func (self *UiLib) ToHex(data string) string { + return "0x" + ethutil.Bytes2Hex([]byte(data)) +} + /* // XXX Refactor me & MOVE func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index bed23c8a7..3e1ca7ab9 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -1,11 +1,13 @@ package qwhisper import ( + "fmt" "time" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/whisper" + "gopkg.in/qml.v1" ) func fromHex(s string) []byte { @@ -18,25 +20,33 @@ func toHex(b []byte) string { return "0x" + ethutil.Bytes2Hex(b) } type Whisper struct { *whisper.Whisper + view qml.Object } func New(w *whisper.Whisper) *Whisper { - return &Whisper{w} + return &Whisper{w, nil} } -func (self *Whisper) Post(data string, pow, ttl uint32, to, from string) { +func (self *Whisper) SetView(view qml.Object) { + self.view = view +} + +func (self *Whisper) Post(data string, to, from string, topics []string, pow, ttl uint32) { msg := whisper.NewMessage(fromHex(data)) envelope, err := msg.Seal(time.Duration(pow), whisper.Opts{ - Ttl: time.Duration(ttl), - To: crypto.ToECDSAPub(fromHex(to)), - From: crypto.ToECDSA(fromHex(from)), + Ttl: time.Duration(ttl), + To: crypto.ToECDSAPub(fromHex(to)), + From: crypto.ToECDSA(fromHex(from)), + Topics: whisper.TopicsFromString(topics), }) if err != nil { + fmt.Println(err) // handle error return } if err := self.Whisper.Send(envelope); err != nil { + fmt.Println(err) // handle error return } diff --git a/whisper/main.go b/whisper/main.go index 2ee2f3ff1..edd5f7004 100644 --- a/whisper/main.go +++ b/whisper/main.go @@ -5,10 +5,8 @@ package main import ( "fmt" "log" - "net" "os" - "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/whisper" @@ -20,12 +18,12 @@ func main() { pub, _ := secp256k1.GenerateKeyPair() - whisper := whisper.New(&event.TypeMux{}) + whisper := whisper.New() srv := p2p.Server{ MaxPeers: 10, Identity: p2p.NewSimpleClientIdentity("whisper-go", "1.0", "", string(pub)), - ListenAddr: ":30303", + ListenAddr: ":30300", NAT: p2p.UPNP(), Protocols: []p2p.Protocol{whisper.Protocol()}, @@ -35,13 +33,5 @@ func main() { os.Exit(1) } - // add seed peers - seed, err := net.ResolveTCPAddr("tcp", "poc-7.ethdev.com:30300") - if err != nil { - fmt.Println("couldn't resolve:", err) - os.Exit(1) - } - srv.SuggestPeer(seed.IP, seed.Port, nil) - select {} } diff --git a/whisper/whisper.go b/whisper/whisper.go index 1b3f54b67..f91b61d9a 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -4,6 +4,7 @@ import ( "bytes" "crypto/ecdsa" "errors" + "fmt" "sync" "time" @@ -71,16 +72,6 @@ func New() *Whisper { } whisper.filters.Start() - // XXX TODO REMOVE TESTING CODE - //msg := NewMessage([]byte(fmt.Sprintf("Hello world. This is whisper-go. Incase you're wondering; the time is %v", time.Now()))) - //envelope, _ := msg.Seal(DefaultPow, Opts{ - // Ttl: DefaultTtl, - //}) - //if err := whisper.Send(envelope); err != nil { - // fmt.Println(err) - //} - // XXX TODO REMOVE TESTING CODE - // p2p whisper sub protocol handler whisper.protocol = p2p.Protocol{ Name: "shh", @@ -158,6 +149,7 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error { continue } + fmt.Println("recv") if err := self.add(envelope); err != nil { // TODO Punish peer here. Invalid envelope. peer.Infoln(err) @@ -184,6 +176,7 @@ func (self *Whisper) add(envelope *Envelope) error { if !self.expiry[envelope.Expiry].Has(hash) { self.expiry[envelope.Expiry].Add(hash) self.postEvent(envelope) + fmt.Println("envelope added", envelope) } return nil -- cgit v1.2.3 From c96e504adb4a547b5e293d6930626cf2f9401ac2 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 17:28:51 +0100 Subject: Typo --- ui/qt/qwhisper/whisper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index 3e1ca7ab9..62c4c743b 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -56,7 +56,7 @@ func (self *Whisper) NewIdentity() string { return toHex(self.Whisper.NewIdentity().D.Bytes()) } -func (self *Whisper) HasIdentify(key string) bool { +func (self *Whisper) HasIdentity(key string) bool { return self.Whisper.HasIdentity(crypto.ToECDSA(fromHex(key))) } -- cgit v1.2.3 From 0291eff99a79fa1c844a4214c326c4f2b5f913ff Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 21:52:50 +0100 Subject: Identity test --- ui/qt/qwhisper/whisper_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ui/qt/qwhisper/whisper_test.go diff --git a/ui/qt/qwhisper/whisper_test.go b/ui/qt/qwhisper/whisper_test.go new file mode 100644 index 000000000..efa4e6238 --- /dev/null +++ b/ui/qt/qwhisper/whisper_test.go @@ -0,0 +1,15 @@ +package qwhisper + +import ( + "testing" + + "github.com/ethereum/go-ethereum/whisper" +) + +func TestHasIdentity(t *testing.T) { + qw := New(whisper.New()) + id := qw.NewIdentity() + if !qw.HasIdentity(id) { + t.Error("expected to have identity") + } +} -- cgit v1.2.3 From 52ca80bdd22004525dd1decbf7f9698380bff2be Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 21:53:50 +0100 Subject: Fixed deref ptr The gui already waits and shuts down ethereum. There was no need to wait for an additional shutdown. --- cmd/mist/main.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 1c0af5d8c..3ea6e8e91 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -69,6 +69,10 @@ func run() error { utils.StartRpc(ethereum, RpcPort) } + if StartWebSockets { + utils.StartWebSockets(ethereum) + } + gui := NewWindow(ethereum, config, clientIdentity, KeyRing, LogLevel) gui.stdLog = stdLog @@ -100,16 +104,10 @@ func main() { utils.HandleInterrupt() - if StartWebSockets { - utils.StartWebSockets(ethereum) - } - // we need to run the interrupt callbacks in case gui is closed // this skips if we got here by actual interrupt stopping the GUI if !interrupted { utils.RunInterruptCallbacks(os.Interrupt) } - // this blocks the thread - ethereum.WaitForShutdown() logger.Flush() } -- cgit v1.2.3 From 54605d8c8e2c6c4b2619cf392ac430fecd7a4282 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 21:54:34 +0100 Subject: During env open check for pub error which indicated unencrypted payload. --- whisper/envelope.go | 6 +++++- whisper/whisper.go | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/whisper/envelope.go b/whisper/envelope.go index 683e88128..dc8d3cda4 100644 --- a/whisper/envelope.go +++ b/whisper/envelope.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/rlp" + "github.com/obscuren/ecies" ) const ( @@ -76,7 +77,10 @@ func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error) { message.Payload = data[dataStart:] if prv != nil { message.Payload, err = crypto.Decrypt(prv, message.Payload) - if err != nil { + switch err { + case ecies.ErrInvalidPublicKey: // Payload isn't encrypted + return &message, err + default: return nil, fmt.Errorf("unable to open envelope. Decrypt failed: %v", err) } } diff --git a/whisper/whisper.go b/whisper/whisper.go index f91b61d9a..b16ccd1e9 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" + "github.com/obscuren/ecies" "gopkg.in/fatih/set.v0" ) @@ -229,7 +230,7 @@ func (self *Whisper) envelopes() (envelopes []*Envelope) { func (self *Whisper) postEvent(envelope *Envelope) { for _, key := range self.keys { - if message, err := envelope.Open(key); err == nil { + if message, err := envelope.Open(key); err == nil || (err != nil && err == ecies.ErrInvalidPublicKey) { // Create a custom filter? self.filters.Notify(filter.Generic{ Str1: string(crypto.FromECDSA(key)), Str2: string(crypto.FromECDSAPub(message.Recover())), -- cgit v1.2.3 From b55fabc7be4debff147b0598eea39f9d16cfa108 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 22:18:58 +0100 Subject: Removed debug message --- whisper/whisper.go | 1 - 1 file changed, 1 deletion(-) diff --git a/whisper/whisper.go b/whisper/whisper.go index b16ccd1e9..32e951385 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -177,7 +177,6 @@ func (self *Whisper) add(envelope *Envelope) error { if !self.expiry[envelope.Expiry].Has(hash) { self.expiry[envelope.Expiry].Add(hash) self.postEvent(envelope) - fmt.Println("envelope added", envelope) } return nil -- cgit v1.2.3 From aa3b91b8026c665ee53f768f8b94c3abe1713bf6 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 15 Dec 2014 22:33:18 +0100 Subject: p2p: fix call to Server.removePeer (might help with #209) --- p2p/server.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/p2p/server.go b/p2p/server.go index 9353e12ea..326781234 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -246,12 +246,7 @@ func (srv *Server) Stop() { func (srv *Server) discLoop() { for peer := range srv.peerDisconnect { - // peer has just disconnected. free up its slot. - srvlog.Infof("%v is gone", peer) - srv.peerSlots <- peer.slot - srv.lock.Lock() - srv.peers[peer.slot] = nil - srv.lock.Unlock() + srv.removePeer(peer) } } @@ -384,7 +379,7 @@ func (srv *Server) addPeer(conn net.Conn, desc *peerAddr, slot int) *Peer { func (srv *Server) removePeer(peer *Peer) { srv.lock.Lock() defer srv.lock.Unlock() - srvlog.Debugf("Removing peer %v %v (slot %v)\n", peer, peer.slot) + srvlog.Debugf("Removing %v (slot %v)\n", peer, peer.slot) if srv.peers[peer.slot] != peer { srvlog.Warnln("Invalid peer to remove:", peer) return -- cgit v1.2.3 From 93edae280d60d217084430a0c6c16f648c82732e Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 15 Dec 2014 22:50:38 +0100 Subject: doc desc --- whisper/doc.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 whisper/doc.go diff --git a/whisper/doc.go b/whisper/doc.go new file mode 100644 index 000000000..986df8fb9 --- /dev/null +++ b/whisper/doc.go @@ -0,0 +1,16 @@ +/* +Package whisper implements the Whisper PoC-1. + +(https://github.com/ethereum/wiki/wiki/Whisper-PoC-1-Protocol-Spec) + +Whisper combines aspects of both DHTs and datagram messaging systems (e.g. UDP). +As such it may be likened and compared to both, not dissimilar to the +matter/energy duality (apologies to physicists for the blatant abuse of a +fundamental and beautiful natural principle). + +Whisper is a pure identity-based messaging system. Whisper provides a low-level +(non-application-specific) but easily-accessible API without being based upon +or prejudiced by the low-level hardware attributes and characteristics, +particularly the notion of singular endpoints. +*/ +package whisper -- cgit v1.2.3 From 52b54631a47dfa46742635be178f2f8d33dd9f41 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 16 Dec 2014 19:55:57 +0100 Subject: Whisper watches fixes --- cmd/mist/assets/qml/views/whisper.qml | 3 ++- event/filter/generic_filter.go | 20 +++++++++++++++----- ui/qt/qwhisper/whisper.go | 28 +++++++++++++++++++++++----- whisper/envelope.go | 6 ++++-- whisper/util.go | 11 ++++++++++- whisper/whisper.go | 4 ++-- 6 files changed, 56 insertions(+), 16 deletions(-) diff --git a/cmd/mist/assets/qml/views/whisper.qml b/cmd/mist/assets/qml/views/whisper.qml index 631f1981e..b50841ba5 100644 --- a/cmd/mist/assets/qml/views/whisper.qml +++ b/cmd/mist/assets/qml/views/whisper.qml @@ -20,6 +20,8 @@ Rectangle { Component.onCompleted: { identity = shh.newIdentity() console.log("New identity:", identity) + + var t = shh.watch({topics: ["chat"]}) } RowLayout { @@ -35,7 +37,6 @@ Rectangle { id: topics placeholderText: "topic1, topic2, topic3, ..." } - Button { text: "Send" onClicked: { diff --git a/event/filter/generic_filter.go b/event/filter/generic_filter.go index b04b4801e..2ce0f0642 100644 --- a/event/filter/generic_filter.go +++ b/event/filter/generic_filter.go @@ -2,19 +2,29 @@ package filter type Generic struct { Str1, Str2, Str3 string + Data map[string]struct{} Fn func(data interface{}) } +// self = registered, f = incoming func (self Generic) Compare(f Filter) bool { + var strMatch, dataMatch = true, true + filter := f.(Generic) - if (len(self.Str1) == 0 || filter.Str1 == self.Str1) && - (len(self.Str2) == 0 || filter.Str2 == self.Str2) && - (len(self.Str3) == 0 || filter.Str3 == self.Str3) { - return true + if (len(self.Str1) > 0 && filter.Str1 != self.Str1) || + (len(self.Str2) > 0 && filter.Str2 != self.Str2) || + (len(self.Str3) > 0 && filter.Str3 != self.Str3) { + strMatch = false + } + + for k, _ := range self.Data { + if _, ok := filter.Data[k]; !ok { + return false + } } - return false + return strMatch && dataMatch } func (self Generic) Trigger(data interface{}) { diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index 62c4c743b..8f05c0695 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -3,6 +3,7 @@ package qwhisper import ( "fmt" "time" + "unsafe" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" @@ -18,13 +19,22 @@ func fromHex(s string) []byte { } func toHex(b []byte) string { return "0x" + ethutil.Bytes2Hex(b) } +type Watch struct { +} + +func (self *Watch) Arrived(v unsafe.Pointer) { + fmt.Println(v) +} + type Whisper struct { *whisper.Whisper view qml.Object + + watches map[int]*Watch } func New(w *whisper.Whisper) *Whisper { - return &Whisper{w, nil} + return &Whisper{w, nil, make(map[int]*Watch)} } func (self *Whisper) SetView(view qml.Object) { @@ -37,7 +47,7 @@ func (self *Whisper) Post(data string, to, from string, topics []string, pow, tt Ttl: time.Duration(ttl), To: crypto.ToECDSAPub(fromHex(to)), From: crypto.ToECDSA(fromHex(from)), - Topics: whisper.TopicsFromString(topics), + Topics: whisper.TopicsFromString(topics...), }) if err != nil { fmt.Println(err) @@ -60,12 +70,15 @@ func (self *Whisper) HasIdentity(key string) bool { return self.Whisper.HasIdentity(crypto.ToECDSA(fromHex(key))) } -func (self *Whisper) Watch(opts map[string]interface{}) { +func (self *Whisper) Watch(opts map[string]interface{}) *Watch { filter := filterFromMap(opts) filter.Fn = func(msg *whisper.Message) { - // TODO POST TO QT WINDOW + fmt.Println(msg) } - self.Whisper.Watch(filter) + i := self.Whisper.Watch(filter) + self.watches[i] = &Watch{} + + return self.watches[i] } func filterFromMap(opts map[string]interface{}) (f whisper.Filter) { @@ -75,6 +88,11 @@ func filterFromMap(opts map[string]interface{}) (f whisper.Filter) { if from, ok := opts["from"].(string); ok { f.From = crypto.ToECDSAPub(fromHex(from)) } + if topicList, ok := opts["topics"].(*qml.List); ok { + var topics []string + topicList.Convert(&topics) + f.Topics = whisper.TopicsFromString(topics...) + } return } diff --git a/whisper/envelope.go b/whisper/envelope.go index dc8d3cda4..066e20f6a 100644 --- a/whisper/envelope.go +++ b/whisper/envelope.go @@ -74,11 +74,13 @@ func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error) { message.Flags = data[0] message.Signature = data[1:66] } - message.Payload = data[dataStart:] + + payload := data[dataStart:] if prv != nil { - message.Payload, err = crypto.Decrypt(prv, message.Payload) + message.Payload, err = crypto.Decrypt(prv, payload) switch err { case ecies.ErrInvalidPublicKey: // Payload isn't encrypted + message.Payload = payload return &message, err default: return nil, fmt.Errorf("unable to open envelope. Decrypt failed: %v", err) diff --git a/whisper/util.go b/whisper/util.go index abef1d667..7a222395f 100644 --- a/whisper/util.go +++ b/whisper/util.go @@ -18,10 +18,19 @@ func Topics(data [][]byte) [][]byte { return d } -func TopicsFromString(data []string) [][]byte { +func TopicsFromString(data ...string) [][]byte { d := make([][]byte, len(data)) for i, str := range data { d[i] = hashTopic([]byte(str)) } return d } + +func bytesToMap(s [][]byte) map[string]struct{} { + m := make(map[string]struct{}) + for _, topic := range s { + m[string(topic)] = struct{}{} + } + + return m +} diff --git a/whisper/whisper.go b/whisper/whisper.go index 32e951385..9721ca9f9 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -4,7 +4,6 @@ import ( "bytes" "crypto/ecdsa" "errors" - "fmt" "sync" "time" @@ -120,6 +119,7 @@ func (self *Whisper) Watch(opts Filter) int { return self.filters.Install(filter.Generic{ Str1: string(crypto.FromECDSA(opts.To)), Str2: string(crypto.FromECDSAPub(opts.From)), + Data: bytesToMap(opts.Topics), Fn: func(data interface{}) { opts.Fn(data.(*Message)) }, @@ -150,7 +150,6 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error { continue } - fmt.Println("recv") if err := self.add(envelope); err != nil { // TODO Punish peer here. Invalid envelope. peer.Infoln(err) @@ -233,6 +232,7 @@ func (self *Whisper) postEvent(envelope *Envelope) { // Create a custom filter? self.filters.Notify(filter.Generic{ Str1: string(crypto.FromECDSA(key)), Str2: string(crypto.FromECDSAPub(message.Recover())), + Data: bytesToMap(envelope.Topics), }, message) } else { wlogger.Infoln(err) -- cgit v1.2.3 From 4dbdcaecb117d7e1fcaf0869f5d4602312552991 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 17 Dec 2014 23:58:52 +0100 Subject: Moved pre-compiled, moved depth check * Depth check has been moved to the execution * Pre compiled execution has been moved to the VM * PrecompiledAddress has been renamed to PrecompiledAccount --- core/execution.go | 20 +++++++------------- vm/address.go | 12 ++++++------ vm/common.go | 2 +- vm/vm_debug.go | 24 +++++++++++++++++++++--- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/core/execution.go b/core/execution.go index 58d46c509..827e1ee0e 100644 --- a/core/execution.go +++ b/core/execution.go @@ -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" ) @@ -36,6 +35,11 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret env := self.vm.Env() chainlogger.Debugf("pre state %x\n", env.State().Root()) + if self.vm.Env().Depth() == vm.MaxCallDepth { + // Consume all gas (by not returning it) and return a depth error + return nil, vm.DepthError{} + } + from, to := env.State().GetStateObject(caller.Address()), env.State().GetOrNewStateObject(self.address) // Skipping transfer is used on testing for the initial call if !self.SkipTransfer { @@ -50,24 +54,14 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret snapshot := env.State().Copy() defer func() { - if vm.IsDepthErr(err) || vm.IsOOGErr(err) { + if /*vm.IsDepthErr(err) ||*/ vm.IsOOGErr(err) { env.State().Set(snapshot) } chainlogger.Debugf("post state %x\n", env.State().Root()) }() self.object = to - // Pre-compiled contracts (address.go) 1, 2 & 3. - naddr := ethutil.BigD(contextAddr).Uint64() - if p := vm.Precompiled[naddr]; p != nil { - if self.Gas.Cmp(p.Gas(len(self.input))) >= 0 { - ret = p.Call(self.input) - self.vm.Printf("NATIVE_FUNC(%x) => %x", naddr, ret) - self.vm.Endl() - } - } else { - ret, err = self.vm.Run(to, caller, code, self.value, self.Gas, self.price, self.input) - } + ret, err = self.vm.Run(to, caller, code, self.value, self.Gas, self.price, self.input) return } diff --git a/vm/address.go b/vm/address.go index be8921a3b..611979c94 100644 --- a/vm/address.go +++ b/vm/address.go @@ -11,25 +11,25 @@ type Address interface { Call(in []byte) []byte } -type PrecompiledAddress struct { +type PrecompiledAccount struct { Gas func(l int) *big.Int fn func(in []byte) []byte } -func (self PrecompiledAddress) Call(in []byte) []byte { +func (self PrecompiledAccount) Call(in []byte) []byte { return self.fn(in) } -var Precompiled = map[uint64]*PrecompiledAddress{ - 1: &PrecompiledAddress{func(l int) *big.Int { +var Precompiled = map[string]*PrecompiledAccount{ + string(ethutil.LeftPadBytes([]byte{1}, 20)): &PrecompiledAccount{func(l int) *big.Int { return GasEcrecover }, ecrecoverFunc}, - 2: &PrecompiledAddress{func(l int) *big.Int { + string(ethutil.LeftPadBytes([]byte{2}, 20)): &PrecompiledAccount{func(l int) *big.Int { n := big.NewInt(int64(l+31)/32 + 1) n.Mul(n, GasSha256) return n }, sha256Func}, - 3: &PrecompiledAddress{func(l int) *big.Int { + string(ethutil.LeftPadBytes([]byte{3}, 20)): &PrecompiledAccount{func(l int) *big.Int { n := big.NewInt(int64(l+31)/32 + 1) n.Mul(n, GasRipemd) return n diff --git a/vm/common.go b/vm/common.go index 592d44ccd..3d6d377ca 100644 --- a/vm/common.go +++ b/vm/common.go @@ -48,7 +48,7 @@ var ( S256 = ethutil.S256 ) -const MaxCallDepth = 1025 +const MaxCallDepth = 1024 func calcMemSize(off, l *big.Int) *big.Int { if l.Cmp(ethutil.Big0) == 0 { diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 8af1979b1..9da832a79 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -48,9 +48,8 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * }) closure := NewClosure(msg, caller, me, code, gas, price) - if self.env.Depth() == MaxCallDepth { - //closure.UseGas(gas) - return closure.Return(nil), DepthError{} + if p := Precompiled[string(me.Address())]; p != nil { + return self.RunPrecompiled(p, callData, closure) } if self.Recoverable { @@ -941,6 +940,25 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * } } +func (self *DebugVm) RunPrecompiled(p *PrecompiledAccount, callData []byte, closure *Closure) (ret []byte, err error) { + gas := p.Gas(len(callData)) + if closure.UseGas(gas) { + ret = p.Call(callData) + self.Printf("NATIVE_FUNC => %x", ret) + self.Endl() + + return closure.Return(ret), nil + } else { + self.Endl() + + tmp := new(big.Int).Set(closure.Gas) + + closure.UseGas(closure.Gas) + + return closure.Return(nil), OOG(gas, tmp) + } +} + func (self *DebugVm) Printf(format string, v ...interface{}) VirtualMachine { if self.logTy == LogTyPretty { self.logStr += fmt.Sprintf(format, v...) -- cgit v1.2.3 From df3366d910c2b1ddab986264bc186ca79ba65c4e Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 11:39:24 +0100 Subject: Rlp shouldn't write null bytes --- ethutil/rlp.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ethutil/rlp.go b/ethutil/rlp.go index 157dd4dd9..1bc1a58a7 100644 --- a/ethutil/rlp.go +++ b/ethutil/rlp.go @@ -2,7 +2,6 @@ package ethutil import ( "bytes" - "encoding/binary" "fmt" "math/big" "reflect" @@ -193,8 +192,13 @@ func Encode(object interface{}) []byte { if blen < 56 { buff.WriteByte(byte(blen) + 0xc0) } else { - buff.WriteByte(byte(intlen(int64(blen))) + 0xf7) - binary.Write(&buff, binary.BigEndian, int64(blen)) + ilen := byte(intlen(int64(blen))) + buff.WriteByte(ilen + 0xf7) + t := make([]byte, ilen) + for i := byte(0); i < ilen; i++ { + t[ilen-i-1] = byte(blen >> (i * 8)) + } + buff.Write(t) } buff.ReadFrom(&b) } -- cgit v1.2.3 From 4b2f1f76282069007f2bc6d91a90924ac29fd238 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 11:55:46 +0100 Subject: idx should return -1 --- ethutil/value.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethutil/value.go b/ethutil/value.go index 6417b0008..7d4a7d98c 100644 --- a/ethutil/value.go +++ b/ethutil/value.go @@ -397,5 +397,5 @@ func (it *ValueIterator) Value() *Value { } func (it *ValueIterator) Idx() int { - return it.idx + return it.idx - 1 } -- cgit v1.2.3 From 590aace88dce9922d40fca71e87905383a71d12b Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 12:18:19 +0100 Subject: Removed ethereum as dependency --- core/block_manager.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/block_manager.go b/core/block_manager.go index f6c73bc2c..98c6d006d 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -58,8 +58,8 @@ type BlockManager struct { mem map[string]*big.Int // Proof of work used for validating Pow pow.PoW - // The ethereum manager interface - eth EthManager + + txpool *TxPool // The last attempted block is mainly used for debugging purposes // This does not have to be a valid block and will be set during @@ -71,13 +71,13 @@ type BlockManager struct { eventMux *event.TypeMux } -func NewBlockManager(ethereum EthManager) *BlockManager { +func NewBlockManager(txpool *TxPool, chainManager *ChainManager, eventMux *event.TypeMux) *BlockManager { sm := &BlockManager{ mem: make(map[string]*big.Int), Pow: ezp.New(), - eth: ethereum, - bc: ethereum.ChainManager(), - eventMux: ethereum.EventMux(), + bc: chainManager, + eventMux: eventMux, + txpool: txpool, } return sm @@ -240,7 +240,7 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I chainlogger.Infof("Processed block #%d (%x...)\n", block.Number, block.Hash()[0:4]) - sm.eth.TxPool().RemoveSet(block.Transactions()) + sm.txpool.RemoveSet(block.Transactions()) return td, messages, nil } else { -- cgit v1.2.3 From 49e0267fe76cfd13eaf3e5e26caa637b93dbdd29 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 13:12:54 +0100 Subject: Locks, refactor, tests * Added additional chain tests * Added proper mutex' on chain * Removed ethereum dependencies --- _data/chain1 | Bin 0 -> 175331 bytes _data/chain2 | Bin 0 -> 28118 bytes core/block_manager.go | 6 +-- core/chain_manager.go | 113 ++++++++++++++++++++++++++++++--------------- core/chain_manager_test.go | 66 ++++++++++++++++++++++++-- core/filter.go | 4 +- core/filter_test.go | 6 --- core/transaction_pool.go | 26 +++++++---- core/types/block.go | 2 +- core/types/common.go | 5 ++ ethereum.go | 4 +- pow/ezp/pow.go | 2 +- 12 files changed, 168 insertions(+), 66 deletions(-) create mode 100755 _data/chain1 create mode 100755 _data/chain2 diff --git a/_data/chain1 b/_data/chain1 new file mode 100755 index 000000000..ef392e001 Binary files /dev/null and b/_data/chain1 differ diff --git a/_data/chain2 b/_data/chain2 new file mode 100755 index 000000000..48ed4d5ea Binary files /dev/null and b/_data/chain2 differ diff --git a/core/block_manager.go b/core/block_manager.go index 98c6d006d..794c87f52 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -256,12 +256,12 @@ func (sm *BlockManager) CalculateTD(block *types.Block) (*big.Int, bool) { // TD(genesis_block) = 0 and TD(B) = TD(B.parent) + sum(u.difficulty for u in B.uncles) + B.difficulty td := new(big.Int) - td = td.Add(sm.bc.TD, uncleDiff) + td = td.Add(sm.bc.Td(), uncleDiff) td = td.Add(td, block.Difficulty) // The new TD will only be accepted if the new difficulty is // is greater than the previous. - if td.Cmp(sm.bc.TD) > 0 { + if td.Cmp(sm.bc.Td()) > 0 { return td, true } @@ -279,7 +279,7 @@ func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error { diff := block.Time - parent.Time if diff < 0 { - return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Time, sm.bc.CurrentBlock.Time) + return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Time, sm.bc.CurrentBlock().Time) } /* XXX diff --git a/core/chain_manager.go b/core/chain_manager.go index 3e48579b9..c81552b5d 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -3,6 +3,7 @@ package core import ( "fmt" "math/big" + "sync" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" @@ -50,14 +51,34 @@ type ChainManager struct { eventMux *event.TypeMux genesisBlock *types.Block // Last known total difficulty - TD *big.Int + mu sync.RWMutex + td *big.Int + lastBlockNumber uint64 + currentBlock *types.Block + lastBlockHash []byte - LastBlockNumber uint64 + transState *state.StateDB +} - CurrentBlock *types.Block - LastBlockHash []byte +func (self *ChainManager) Td() *big.Int { + self.mu.RLock() + defer self.mu.RUnlock() - transState *state.StateDB + return self.td +} + +func (self *ChainManager) LastBlockNumber() uint64 { + self.mu.RLock() + defer self.mu.RUnlock() + + return self.lastBlockNumber +} + +func (self *ChainManager) CurrentBlock() *types.Block { + self.mu.RLock() + defer self.mu.RUnlock() + + return self.currentBlock } func NewChainManager(mux *event.TypeMux) *ChainManager { @@ -77,7 +98,7 @@ func (self *ChainManager) SetProcessor(proc types.BlockProcessor) { } func (self *ChainManager) State() *state.StateDB { - return self.CurrentBlock.State() + return self.CurrentBlock().State() } func (self *ChainManager) TransState() *state.StateDB { @@ -91,27 +112,30 @@ func (bc *ChainManager) setLastBlock() { AddTestNetFunds(bc.genesisBlock) block := types.NewBlockFromBytes(data) - bc.CurrentBlock = block - bc.LastBlockHash = block.Hash() - bc.LastBlockNumber = block.Number.Uint64() + bc.currentBlock = block + bc.lastBlockHash = block.Hash() + bc.lastBlockNumber = block.Number.Uint64() // Set the last know difficulty (might be 0x0 as initial value, Genesis) - bc.TD = ethutil.BigD(ethutil.Config.Db.LastKnownTD()) + bc.td = ethutil.BigD(ethutil.Config.Db.LastKnownTD()) } else { bc.Reset() } - chainlogger.Infof("Last block (#%d) %x\n", bc.LastBlockNumber, bc.CurrentBlock.Hash()) + chainlogger.Infof("Last block (#%d) %x\n", bc.lastBlockNumber, bc.currentBlock.Hash()) } // Block creation & chain handling func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block { + bc.mu.RLock() + defer bc.mu.RUnlock() + var root interface{} hash := ZeroHash256 if bc.CurrentBlock != nil { - root = bc.CurrentBlock.Root() - hash = bc.LastBlockHash + root = bc.currentBlock.Root() + hash = bc.lastBlockHash } block := types.CreateBlock( @@ -122,11 +146,11 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block { nil, "") - parent := bc.CurrentBlock + parent := bc.currentBlock if parent != nil { block.Difficulty = CalcDifficulty(block, parent) - block.Number = new(big.Int).Add(bc.CurrentBlock.Number, ethutil.Big1) - block.GasLimit = block.CalcGasLimit(bc.CurrentBlock) + block.Number = new(big.Int).Add(bc.currentBlock.Number, ethutil.Big1) + block.GasLimit = block.CalcGasLimit(bc.currentBlock) } @@ -134,35 +158,42 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block { } func (bc *ChainManager) Reset() { + bc.mu.Lock() + defer bc.mu.Unlock() + AddTestNetFunds(bc.genesisBlock) bc.genesisBlock.Trie().Sync() // Prepare the genesis block bc.write(bc.genesisBlock) bc.insert(bc.genesisBlock) - bc.CurrentBlock = bc.genesisBlock + bc.currentBlock = bc.genesisBlock - bc.SetTotalDifficulty(ethutil.Big("0")) + bc.setTotalDifficulty(ethutil.Big("0")) // Set the last know difficulty (might be 0x0 as initial value, Genesis) - bc.TD = ethutil.BigD(ethutil.Config.Db.LastKnownTD()) + bc.td = ethutil.BigD(ethutil.Config.Db.LastKnownTD()) } func (self *ChainManager) Export() []byte { - chainlogger.Infoln("exporting", self.CurrentBlock.Number, "blocks") + self.mu.RLock() + defer self.mu.RUnlock() + + chainlogger.Infof("exporting %v blocks...\n", self.currentBlock.Number) - blocks := make(types.Blocks, int(self.CurrentBlock.Number.Int64())+1) - for block := self.CurrentBlock; block != nil; block = self.GetBlock(block.PrevHash) { + blocks := make([]*types.Block, int(self.currentBlock.Number.Int64())+1) + for block := self.currentBlock; block != nil; block = self.GetBlock(block.PrevHash) { blocks[block.Number.Int64()] = block } + return ethutil.Encode(blocks) } func (bc *ChainManager) insert(block *types.Block) { encodedBlock := block.RlpEncode() ethutil.Config.Db.Put([]byte("LastBlock"), encodedBlock) - bc.CurrentBlock = block - bc.LastBlockHash = block.Hash() + bc.currentBlock = block + bc.lastBlockHash = block.Hash() } func (bc *ChainManager) write(block *types.Block) { @@ -213,7 +244,10 @@ func (self *ChainManager) GetBlock(hash []byte) *types.Block { } func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block { - block := self.CurrentBlock + self.mu.RLock() + defer self.mu.RUnlock() + + block := self.currentBlock for ; block != nil; block = self.GetBlock(block.PrevHash) { if block.Number.Uint64() == num { break @@ -227,9 +261,9 @@ func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block { return block } -func (bc *ChainManager) SetTotalDifficulty(td *big.Int) { +func (bc *ChainManager) setTotalDifficulty(td *big.Int) { ethutil.Config.Db.Put([]byte("LTD"), td.Bytes()) - bc.TD = td + bc.td = td } func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) { @@ -262,8 +296,8 @@ func (bc *ChainManager) BlockInfo(block *types.Block) types.BlockInfo { // Unexported method for writing extra non-essential block info to the db func (bc *ChainManager) writeBlockInfo(block *types.Block) { - bc.LastBlockNumber++ - bi := types.BlockInfo{Number: bc.LastBlockNumber, Hash: block.Hash(), Parent: block.PrevHash, TD: bc.TD} + bc.lastBlockNumber++ + bi := types.BlockInfo{Number: bc.lastBlockNumber, Hash: block.Hash(), Parent: block.PrevHash, TD: bc.td} // For now we use the block hash with the words "info" appended as key ethutil.Config.Db.Put(append(block.Hash(), []byte("Info")...), bi.RlpEncode()) @@ -289,17 +323,22 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error { return err } - self.write(block) - if td.Cmp(self.TD) > 0 { - if block.Number.Cmp(new(big.Int).Add(self.CurrentBlock.Number, ethutil.Big1)) < 0 { - chainlogger.Infof("Split detected. New head #%v (%x), was #%v (%x)\n", block.Number, block.Hash()[:4], self.CurrentBlock.Number, self.CurrentBlock.Hash()[:4]) + self.mu.Lock() + { + + self.write(block) + if td.Cmp(self.td) > 0 { + if block.Number.Cmp(new(big.Int).Add(self.currentBlock.Number, ethutil.Big1)) < 0 { + chainlogger.Infof("Split detected. New head #%v (%x), was #%v (%x)\n", block.Number, block.Hash()[:4], self.currentBlock.Number, self.currentBlock.Hash()[:4]) + } + + self.setTotalDifficulty(td) + self.insert(block) + self.transState = self.currentBlock.State().Copy() } - self.SetTotalDifficulty(td) - self.insert(block) - self.transState = self.State().Copy() - //sm.eth.TxPool().RemoveSet(block.Transactions()) } + self.mu.Unlock() self.eventMux.Post(NewBlockEvent{block}) self.eventMux.Post(messages) diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index a84e3ff3b..52be8b0ea 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -3,17 +3,75 @@ package core import ( "fmt" "path" + "runtime" "testing" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/event" + //logpkg "github.com/ethereum/go-ethereum/logger" ) -func TestChainInsertions(t *testing.T) { - c1, err := ethutil.ReadAllFile(path.Join("..", "_data", "chain1")) +//var Logger logpkg.LogSystem +//var Log = logpkg.NewLogger("TEST") + +func init() { + runtime.GOMAXPROCS(runtime.NumCPU()) + //Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.InfoLevel) + //logpkg.AddLogSystem(Logger) + + ethutil.ReadConfig("/tmp/ethtest", "/tmp/ethtest", "ETH") + + db, err := ethdb.NewMemDatabase() + if err != nil { + panic("Could not create mem-db, failing") + } + ethutil.Config.Db = db +} + +func loadChain(fn string, t *testing.T) types.Blocks { + c1, err := ethutil.ReadAllFile(path.Join("..", "_data", fn)) if err != nil { fmt.Println(err) t.FailNow() } - data1, _ := ethutil.Decode([]byte(c1), 0) - fmt.Println(data1) + value := ethutil.NewValueFromBytes([]byte(c1)) + blocks := make(types.Blocks, value.Len()) + it := value.NewIterator() + for it.Next() { + blocks[it.Idx()] = types.NewBlockFromRlpValue(it.Value()) + } + + return blocks +} + +func insertChain(done chan bool, chainMan *ChainManager, chain types.Blocks, t *testing.T) { + err := chainMan.InsertChain(chain) + if err != nil { + fmt.Println(err) + t.FailNow() + } + done <- true +} + +func TestChainInsertions(t *testing.T) { + chain1 := loadChain("chain1", t) + chain2 := loadChain("chain2", t) + var eventMux event.TypeMux + chainMan := NewChainManager(&eventMux) + txPool := NewTxPool(chainMan, nil, &eventMux) + blockMan := NewBlockManager(txPool, chainMan, &eventMux) + chainMan.SetProcessor(blockMan) + + const max = 2 + done := make(chan bool, max) + + go insertChain(done, chainMan, chain1, t) + go insertChain(done, chainMan, chain2, t) + + for i := 0; i < max; i++ { + <-done + } + fmt.Println(chainMan.CurrentBlock()) } diff --git a/core/filter.go b/core/filter.go index fe3665bf3..fb992782d 100644 --- a/core/filter.go +++ b/core/filter.go @@ -78,11 +78,11 @@ func (self *Filter) SetSkip(skip int) { func (self *Filter) Find() []*state.Message { var earliestBlockNo uint64 = uint64(self.earliest) if self.earliest == -1 { - earliestBlockNo = self.eth.ChainManager().CurrentBlock.Number.Uint64() + earliestBlockNo = self.eth.ChainManager().CurrentBlock().Number.Uint64() } var latestBlockNo uint64 = uint64(self.latest) if self.latest == -1 { - latestBlockNo = self.eth.ChainManager().CurrentBlock.Number.Uint64() + latestBlockNo = self.eth.ChainManager().CurrentBlock().Number.Uint64() } var ( diff --git a/core/filter_test.go b/core/filter_test.go index d53b835b7..9a8bc9592 100644 --- a/core/filter_test.go +++ b/core/filter_test.go @@ -1,7 +1 @@ package core - -// import "testing" - -// func TestFilter(t *testing.T) { -// NewFilter(NewTestManager()) -// } diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 7166d35e8..36b0beb28 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -8,6 +8,7 @@ import ( "sync" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/wire" @@ -61,7 +62,6 @@ type TxProcessor interface { // pool is being drained or synced for whatever reason the transactions // will simple queue up and handled when the mutex is freed. type TxPool struct { - Ethereum EthManager // The mutex for accessing the Tx pool. mutex sync.Mutex // Queueing channel for reading and writing incoming @@ -75,14 +75,20 @@ type TxPool struct { SecondaryProcessor TxProcessor subscribers []chan TxMsg + + broadcaster types.Broadcaster + chainManager *ChainManager + eventMux *event.TypeMux } -func NewTxPool(ethereum EthManager) *TxPool { +func NewTxPool(chainManager *ChainManager, broadcaster types.Broadcaster, eventMux *event.TypeMux) *TxPool { return &TxPool{ - pool: list.New(), - queueChan: make(chan *types.Transaction, txPoolQueueSize), - quit: make(chan bool), - Ethereum: ethereum, + pool: list.New(), + queueChan: make(chan *types.Transaction, txPoolQueueSize), + quit: make(chan bool), + chainManager: chainManager, + eventMux: eventMux, + broadcaster: broadcaster, } } @@ -94,13 +100,13 @@ func (pool *TxPool) addTransaction(tx *types.Transaction) { pool.pool.PushBack(tx) // Broadcast the transaction to the rest of the peers - pool.Ethereum.Broadcast(wire.MsgTxTy, []interface{}{tx.RlpData()}) + pool.broadcaster.Broadcast(wire.MsgTxTy, []interface{}{tx.RlpData()}) } func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { // Get the last block so we can retrieve the sender and receiver from // the merkle trie - block := pool.Ethereum.ChainManager().CurrentBlock + block := pool.chainManager.CurrentBlock // Something has gone horribly wrong if this happens if block == nil { return fmt.Errorf("No last block on the block chain") @@ -116,7 +122,7 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { } // Get the sender - sender := pool.Ethereum.ChainManager().State().GetAccount(tx.Sender()) + sender := pool.chainManager.State().GetAccount(tx.Sender()) totAmount := new(big.Int).Set(tx.Value) // Make sure there's enough in the sender's account. Having insufficient @@ -160,7 +166,7 @@ func (self *TxPool) Add(tx *types.Transaction) error { txplogger.Debugf("(t) %x => %x (%v) %x\n", tx.Sender()[:4], tmp, tx.Value, tx.Hash()) // Notify the subscribers - go self.Ethereum.EventMux().Post(TxPreEvent{tx}) + go self.eventMux.Post(TxPreEvent{tx}) return nil } diff --git a/core/types/block.go b/core/types/block.go index 0108bd586..2d889f35f 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -409,7 +409,7 @@ func (self *Block) Size() ethutil.StorageSize { // Implement RlpEncodable func (self *Block) RlpData() interface{} { - return self.Value().Val + return []interface{}{self.header(), self.transactions, self.rlpUncles()} } // Implement pow.Block diff --git a/core/types/common.go b/core/types/common.go index ba88b77e1..89cb5f498 100644 --- a/core/types/common.go +++ b/core/types/common.go @@ -4,8 +4,13 @@ import ( "math/big" "github.com/ethereum/go-ethereum/state" + "github.com/ethereum/go-ethereum/wire" ) type BlockProcessor interface { Process(*Block) (*big.Int, state.Messages, error) } + +type Broadcaster interface { + Broadcast(wire.MsgType, []interface{}) +} diff --git a/ethereum.go b/ethereum.go index e8b1a9500..5d74e28e9 100644 --- a/ethereum.go +++ b/ethereum.go @@ -128,9 +128,9 @@ func New(db ethutil.Database, clientIdentity wire.ClientIdentity, keyManager *cr } ethereum.blockPool = NewBlockPool(ethereum) - ethereum.txPool = core.NewTxPool(ethereum) ethereum.blockChain = core.NewChainManager(ethereum.EventMux()) - ethereum.blockManager = core.NewBlockManager(ethereum) + ethereum.txPool = core.NewTxPool(ethereum.blockChain, ethereum, ethereum.EventMux()) + ethereum.blockManager = core.NewBlockManager(ethereum.txPool, ethereum.blockChain, ethereum.EventMux()) ethereum.blockChain.SetProcessor(ethereum.blockManager) // Start the tx pool diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go index cdf89950f..bfe3ea098 100644 --- a/pow/ezp/pow.go +++ b/pow/ezp/pow.go @@ -21,7 +21,7 @@ type EasyPow struct { } func New() *EasyPow { - return &EasyPow{} + return &EasyPow{turbo: true} } func (pow *EasyPow) GetHashrate() int64 { -- cgit v1.2.3 From 2d09e67713757e2a80eb614562c97f962af36cf7 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 13:17:24 +0100 Subject: Updated to new methods --- block_pool.go | 2 +- cmd/ethereum/main.go | 2 +- cmd/mist/debugger.go | 2 +- cmd/mist/gui.go | 4 ++-- core/chain_manager.go | 7 +++++++ peer.go | 4 ++-- xeth/hexface.go | 2 +- xeth/pipe.go | 2 +- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/block_pool.go b/block_pool.go index 803927f21..c618f6993 100644 --- a/block_pool.go +++ b/block_pool.go @@ -66,7 +66,7 @@ func (self *BlockPool) HasLatestHash() bool { self.mut.Lock() defer self.mut.Unlock() - return self.pool[string(self.eth.ChainManager().CurrentBlock.Hash())] != nil + return self.pool[string(self.eth.ChainManager().CurrentBlock().Hash())] != nil } func (self *BlockPool) HasCommonHash(hash []byte) bool { diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 43551fb3a..9efc8e9dc 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -77,7 +77,7 @@ func main() { var block *types.Block if len(DumpHash) == 0 && DumpNumber == -1 { - block = ethereum.ChainManager().CurrentBlock + block = ethereum.ChainManager().CurrentBlock() } else if len(DumpHash) > 0 { block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash)) } else { diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index d7c584eab..a7a286e23 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -149,7 +149,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data self.SetAsm(script) - block := self.lib.eth.ChainManager().CurrentBlock + block := self.lib.eth.ChainManager().CurrentBlock() env := utils.NewEnv(statedb, block, account.Address(), value) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index fe066e994..773688ffc 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -246,7 +246,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { } func (gui *Gui) setInitialChain(ancientBlocks bool) { - sBlk := gui.eth.ChainManager().LastBlockHash + sBlk := gui.eth.ChainManager().LastBlockHash() blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { sBlk = blk.PrevHash @@ -468,7 +468,7 @@ func (gui *Gui) update() { case <-peerUpdateTicker.C: gui.setPeerInfo() case <-generalUpdateTicker.C: - statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() + statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number.String() lastBlockLabel.Set("text", statusText) miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") diff --git a/core/chain_manager.go b/core/chain_manager.go index c81552b5d..794ae0011 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -74,6 +74,13 @@ func (self *ChainManager) LastBlockNumber() uint64 { return self.lastBlockNumber } +func (self *ChainManager) LastBlockHash() []byte { + self.mu.RLock() + defer self.mu.RUnlock() + + return self.lastBlockHash +} + func (self *ChainManager) CurrentBlock() *types.Block { self.mu.RLock() defer self.mu.RUnlock() diff --git a/peer.go b/peer.go index 331e9de37..13f0239d4 100644 --- a/peer.go +++ b/peer.go @@ -666,8 +666,8 @@ func (self *Peer) pushStatus() { msg := wire.NewMessage(wire.MsgStatusTy, []interface{}{ uint32(ProtocolVersion), uint32(NetVersion), - self.ethereum.ChainManager().TD, - self.ethereum.ChainManager().CurrentBlock.Hash(), + self.ethereum.ChainManager().Td(), + self.ethereum.ChainManager().CurrentBlock().Hash(), self.ethereum.ChainManager().Genesis().Hash(), }) diff --git a/xeth/hexface.go b/xeth/hexface.go index c1f49453d..75ec5f43d 100644 --- a/xeth/hexface.go +++ b/xeth/hexface.go @@ -29,7 +29,7 @@ func (self *JSXEth) BlockByHash(strHash string) *JSBlock { func (self *JSXEth) BlockByNumber(num int32) *JSBlock { if num == -1 { - return NewJSBlock(self.obj.ChainManager().CurrentBlock) + return NewJSBlock(self.obj.ChainManager().CurrentBlock()) } return NewJSBlock(self.obj.ChainManager().GetBlockByNumber(uint64(num))) diff --git a/xeth/pipe.go b/xeth/pipe.go index a8d8ed999..1e4d0ec60 100644 --- a/xeth/pipe.go +++ b/xeth/pipe.go @@ -82,7 +82,7 @@ func (self *XEth) Execute(addr []byte, data []byte, value, gas, price *ethutil.V func (self *XEth) ExecuteObject(object *Object, data []byte, value, gas, price *ethutil.Value) ([]byte, error) { var ( initiator = state.NewStateObject(self.obj.KeyManager().KeyPair().Address()) - block = self.chainManager.CurrentBlock + block = self.chainManager.CurrentBlock() ) self.Vm.State = self.World().State().Copy() -- cgit v1.2.3 From 0dc566124aee24cf3f01b4e586bde7752da89824 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 13:22:59 +0100 Subject: Merge fixes --- core/chain_manager.go | 5 ++++- core/transaction_pool.go | 6 ++---- core/types/common.go | 5 ----- eth/backend.go | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/core/chain_manager.go b/core/chain_manager.go index 4bbecd109..e6268c01e 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -101,7 +101,10 @@ func NewChainManager(mux *event.TypeMux) *ChainManager { } func (self *ChainManager) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { - return self.TD, self.CurrentBlock.Hash(), self.Genesis().Hash() + self.mu.RLock() + defer self.mu.RUnlock() + + return self.td, self.currentBlock.Hash(), self.Genesis().Hash() } func (self *ChainManager) SetProcessor(proc types.BlockProcessor) { diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 86286f23d..2bbda7d90 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -72,19 +72,17 @@ type TxPool struct { subscribers []chan TxMsg - broadcaster types.Broadcaster chainManager *ChainManager eventMux *event.TypeMux } -func NewTxPool(chainManager *ChainManager, broadcaster types.Broadcaster, eventMux *event.TypeMux) *TxPool { +func NewTxPool(chainManager *ChainManager, eventMux *event.TypeMux) *TxPool { return &TxPool{ pool: list.New(), queueChan: make(chan *types.Transaction, txPoolQueueSize), quit: make(chan bool), chainManager: chainManager, eventMux: eventMux, - broadcaster: broadcaster, } } @@ -96,7 +94,7 @@ func (pool *TxPool) addTransaction(tx *types.Transaction) { pool.pool.PushBack(tx) // Broadcast the transaction to the rest of the peers - pool.Ethereum.EventMux().Post(TxPreEvent{tx}) + pool.eventMux.Post(TxPreEvent{tx}) } func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { diff --git a/core/types/common.go b/core/types/common.go index 89cb5f498..ba88b77e1 100644 --- a/core/types/common.go +++ b/core/types/common.go @@ -4,13 +4,8 @@ import ( "math/big" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/wire" ) type BlockProcessor interface { Process(*Block) (*big.Int, state.Messages, error) } - -type Broadcaster interface { - Broadcast(wire.MsgType, []interface{}) -} diff --git a/eth/backend.go b/eth/backend.go index ef82a5bfc..0aad6a514 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -69,9 +69,9 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke eventMux: &event.TypeMux{}, } - eth.txPool = core.NewTxPool(eth) eth.chainManager = core.NewChainManager(eth.EventMux()) - eth.blockManager = core.NewBlockManager(eth) + eth.txPool = core.NewTxPool(eth.chainManager, eth.EventMux()) + eth.blockManager = core.NewBlockManager(eth.txPool, eth.chainManager, eth.EventMux()) eth.chainManager.SetProcessor(eth.blockManager) eth.whisper = whisper.New() -- cgit v1.2.3 From 9e286e1c337319f47b2b04e9e1022ac05470a296 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 13:32:47 +0100 Subject: updated tests --- tests/files/StateTests/stInitCodeTest.json | 870 +++++++++++++++++++++ tests/files/StateTests/stRefundTest.json | 252 ++++++ tests/files/StateTests/stSystemOperationsTest.json | 2 +- tests/files/StateTests/stTransactionTest.json | 277 +++++++ tests/files/VMTests/vmArithmeticTest.json | 294 +++---- 5 files changed, 1547 insertions(+), 148 deletions(-) create mode 100644 tests/files/StateTests/stInitCodeTest.json create mode 100644 tests/files/StateTests/stRefundTest.json create mode 100644 tests/files/StateTests/stTransactionTest.json diff --git a/tests/files/StateTests/stInitCodeTest.json b/tests/files/StateTests/stInitCodeTest.json new file mode 100644 index 000000000..67aa42853 --- /dev/null +++ b/tests/files/StateTests/stInitCodeTest.json @@ -0,0 +1,870 @@ +{ + "CallRecursiveContract" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "04110d816c380812a427968ece99b1c963dfbce6" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x04110d816c380812a427968ece99b1c963dfbce6" + } + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1", + "code" : "0x3060025560206000600039602060006000f0", + "nonce" : "1", + "storage" : { + "0x02" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" + } + }, + "0a517d755cebbf66312b30fff713666a9cb917e0" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x0a517d755cebbf66312b30fff713666a9cb917e0" + } + }, + "24dd378f51adc67a50e339e8031fe9bd4aafab36" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x24dd378f51adc67a50e339e8031fe9bd4aafab36" + } + }, + "293f982d000532a7861ab122bdc4bbfd26bf9030" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x293f982d000532a7861ab122bdc4bbfd26bf9030" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "2cf5732f017b0cf1b1f13a1478e10239716bf6b5" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5" + } + }, + "31c640b92c21a1f1465c91070b4b3b4d6854195f" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "37f998764813b136ddf5a754f34063fd03065e36" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x37f998764813b136ddf5a754f34063fd03065e36" + } + }, + "37fa399a749c121f8a15ce77e3d9f9bec8020d7a" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a" + } + }, + "4f36659fa632310b6ec438dea4085b522a2dd077" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x4f36659fa632310b6ec438dea4085b522a2dd077" + } + }, + "62c01474f089b07dae603491675dc5b5748f7049" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x62c01474f089b07dae603491675dc5b5748f7049" + } + }, + "729af7294be595a0efd7d891c9e51f89c07950c7" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x729af7294be595a0efd7d891c9e51f89c07950c7" + } + }, + "83e3e5a16d3b696a0314b30b2534804dd5e11197" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x83e3e5a16d3b696a0314b30b2534804dd5e11197" + } + }, + "8703df2417e0d7c59d063caa9583cb10a4d20532" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x8703df2417e0d7c59d063caa9583cb10a4d20532" + } + }, + "8dffcd74e5b5923512916c6a64b502689cfa65e1" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x8dffcd74e5b5923512916c6a64b502689cfa65e1" + } + }, + "95a4d7cccb5204733874fa87285a176fe1e9e240" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x95a4d7cccb5204733874fa87285a176fe1e9e240" + } + }, + "99b2fcba8120bedd048fe79f5262a6690ed38c39" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x99b2fcba8120bedd048fe79f5262a6690ed38c39" + } + }, + "a4202b8b8afd5354e3e40a219bdc17f6001bf2cf" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "89999", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + }, + "a9647f4a0a14042d91dc33c0328030a7157c93ae" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xa9647f4a0a14042d91dc33c0328030a7157c93ae" + } + }, + "aa6cffe5185732689c18f37a7f86170cb7304c2a" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xaa6cffe5185732689c18f37a7f86170cb7304c2a" + } + }, + "aae4a2e3c51c04606dcb3723456e58f3ed214f45" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xaae4a2e3c51c04606dcb3723456e58f3ed214f45" + } + }, + "c37a43e940dfb5baf581a0b82b351d48305fc885" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xc37a43e940dfb5baf581a0b82b351d48305fc885" + } + }, + "d2571607e241ecf590ed94b12d87c94babe36db6" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xd2571607e241ecf590ed94b12d87c94babe36db6" + } + }, + "f735071cbee190d76b704ce68384fc21e389fbe7" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xf735071cbee190d76b704ce68384fc21e389fbe7" + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0", + "code" : "0x3060025560206000600039602060006000f0", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x00", + "gasLimit" : "10000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "1" + } + }, + "CallTheContractToCreateContractWithInitCode" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "04110d816c380812a427968ece99b1c963dfbce6" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x04110d816c380812a427968ece99b1c963dfbce6" + } + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "10001", + "code" : "0x3060025560206000600039602060006000f0", + "nonce" : "1", + "storage" : { + "0x02" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" + } + }, + "0a517d755cebbf66312b30fff713666a9cb917e0" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x0a517d755cebbf66312b30fff713666a9cb917e0" + } + }, + "24dd378f51adc67a50e339e8031fe9bd4aafab36" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x24dd378f51adc67a50e339e8031fe9bd4aafab36" + } + }, + "293f982d000532a7861ab122bdc4bbfd26bf9030" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x293f982d000532a7861ab122bdc4bbfd26bf9030" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "2cf5732f017b0cf1b1f13a1478e10239716bf6b5" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5" + } + }, + "31c640b92c21a1f1465c91070b4b3b4d6854195f" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "37f998764813b136ddf5a754f34063fd03065e36" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x37f998764813b136ddf5a754f34063fd03065e36" + } + }, + "37fa399a749c121f8a15ce77e3d9f9bec8020d7a" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a" + } + }, + "4f36659fa632310b6ec438dea4085b522a2dd077" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x4f36659fa632310b6ec438dea4085b522a2dd077" + } + }, + "62c01474f089b07dae603491675dc5b5748f7049" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x62c01474f089b07dae603491675dc5b5748f7049" + } + }, + "729af7294be595a0efd7d891c9e51f89c07950c7" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x729af7294be595a0efd7d891c9e51f89c07950c7" + } + }, + "83e3e5a16d3b696a0314b30b2534804dd5e11197" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x83e3e5a16d3b696a0314b30b2534804dd5e11197" + } + }, + "8703df2417e0d7c59d063caa9583cb10a4d20532" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x8703df2417e0d7c59d063caa9583cb10a4d20532" + } + }, + "8dffcd74e5b5923512916c6a64b502689cfa65e1" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x8dffcd74e5b5923512916c6a64b502689cfa65e1" + } + }, + "95a4d7cccb5204733874fa87285a176fe1e9e240" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x95a4d7cccb5204733874fa87285a176fe1e9e240" + } + }, + "99b2fcba8120bedd048fe79f5262a6690ed38c39" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0x99b2fcba8120bedd048fe79f5262a6690ed38c39" + } + }, + "a4202b8b8afd5354e3e40a219bdc17f6001bf2cf" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "89999", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + }, + "a9647f4a0a14042d91dc33c0328030a7157c93ae" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xa9647f4a0a14042d91dc33c0328030a7157c93ae" + } + }, + "aa6cffe5185732689c18f37a7f86170cb7304c2a" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xaa6cffe5185732689c18f37a7f86170cb7304c2a" + } + }, + "aae4a2e3c51c04606dcb3723456e58f3ed214f45" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xaae4a2e3c51c04606dcb3723456e58f3ed214f45" + } + }, + "c37a43e940dfb5baf581a0b82b351d48305fc885" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xc37a43e940dfb5baf581a0b82b351d48305fc885" + } + }, + "d2571607e241ecf590ed94b12d87c94babe36db6" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xd2571607e241ecf590ed94b12d87c94babe36db6" + } + }, + "f735071cbee190d76b704ce68384fc21e389fbe7" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + "0x02" : "0xf735071cbee190d76b704ce68384fc21e389fbe7" + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "10000", + "code" : "0x3060025560206000600039602060006000f0", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x00", + "gasLimit" : "10000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "1" + } + }, + "CallTheContractToCreateEmptyContract" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1", + "code" : "0x602060006000f0", + "nonce" : "1", + "storage" : { + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "605", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "99394", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + }, + "d2571607e241ecf590ed94b12d87c94babe36db6" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0", + "code" : "0x602060006000f0", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x00", + "gasLimit" : "10000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "1" + } + }, + "NotEnoughCashContractCreation" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "2", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "2", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x600a80600c6000396000f200600160008035811a8100", + "gasLimit" : "599", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "1" + } + }, + "OutOfGasContractCreation" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "1770", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "1", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "8229", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x600a80600c6000396000f200600160008035811a8100", + "gasLimit" : "590", + "gasPrice" : "3", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "1" + } + }, + "TransactionContractCreation" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "599", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "1", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "99400", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x600a80600c6000396000f200600160008035811a8100", + "gasLimit" : "599", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "1" + } + }, + "TransactionCreateSuicideContract" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "1000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "1", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "8999", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x600a80600c6000396000f200ff600160008035811a81", + "gasLimit" : "1000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "1" + } + }, + "TransactionStopInitCode" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "599", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "1", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "9400", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x600a80600c600039600000f20000600160008035811a81", + "gasLimit" : "1000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "1" + } + }, + "TransactionSuicideInitCode" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "0000000000000000000000000000000000000000" : { + "balance" : "1", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "611", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "9388", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x600a80600c6000396000fff2ffff600160008035811a81", + "gasLimit" : "1000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "1" + } + } +} \ No newline at end of file diff --git a/tests/files/StateTests/stRefundTest.json b/tests/files/StateTests/stRefundTest.json new file mode 100644 index 000000000..c558a2292 --- /dev/null +++ b/tests/files/StateTests/stRefundTest.json @@ -0,0 +1,252 @@ +{ + "refund_NoOOG_1" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6000600155", + "nonce" : "0", + "storage" : { + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "402", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6000600155", + "nonce" : "0", + "storage" : { + "0x01" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "502", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "502", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0" + } + }, + "refund_OOG" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6000600155", + "nonce" : "0", + "storage" : { + "0x01" : "0x01" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "500", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6000600155", + "nonce" : "0", + "storage" : { + "0x01" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "500", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "500", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0" + } + }, + "refund_changeNonZeroStorage" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000010", + "code" : "0x6017600155", + "nonce" : "0", + "storage" : { + "0x01" : "0x17" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "602", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "388", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6017600155", + "nonce" : "0", + "storage" : { + "0x01" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "850", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + }, + "refund_getEtherBack" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000010", + "code" : "0x6000600155", + "nonce" : "0", + "storage" : { + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "402", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "588", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6000600155", + "nonce" : "0", + "storage" : { + "0x01" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "850", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + } +} \ No newline at end of file diff --git a/tests/files/StateTests/stSystemOperationsTest.json b/tests/files/StateTests/stSystemOperationsTest.json index a74d32ae5..612331ae3 100644 --- a/tests/files/StateTests/stSystemOperationsTest.json +++ b/tests/files/StateTests/stSystemOperationsTest.json @@ -5827,4 +5827,4 @@ "value" : "100000" } } -} +} \ No newline at end of file diff --git a/tests/files/StateTests/stTransactionTest.json b/tests/files/StateTests/stTransactionTest.json new file mode 100644 index 000000000..0de850797 --- /dev/null +++ b/tests/files/StateTests/stTransactionTest.json @@ -0,0 +1,277 @@ +{ + "EmptyTransaction" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "", + "gasPrice" : "", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "" + } + }, + "TransactionFromCoinbaseNotEnoughFounds" : { + "env" : { + "currentCoinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1100", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "600", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "502" + } + }, + "TransactionSendingToEmpty" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "500", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "99500", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "500", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "" + } + }, + "TransactionSendingToZero" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "0000000000000000000000000000000000000000" : { + "balance" : "1", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "500", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "99499", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "5000", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0000000000000000000000000000000000000000", + "value" : "1" + } + }, + "TransactionToItself" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "500", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "99500", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "5000", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "1" + } + }, + "TransactionToItselfNotEnoughFounds" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1101", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1101", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "600", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "502" + } + } +} \ No newline at end of file diff --git a/tests/files/VMTests/vmArithmeticTest.json b/tests/files/VMTests/vmArithmeticTest.json index 2cc165f5d..88d209dfa 100644 --- a/tests/files/VMTests/vmArithmeticTest.json +++ b/tests/files/VMTests/vmArithmeticTest.json @@ -12,12 +12,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -57,12 +57,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60047fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -102,12 +102,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "10000", @@ -146,12 +146,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6000600001600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -190,12 +190,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600101600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -234,12 +234,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60026002600108600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9695", @@ -279,12 +279,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60026002600003600160000308600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9691", @@ -324,12 +324,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036001600660000308600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9693", @@ -369,12 +369,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036001600660000308600360056000030714600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9887", @@ -413,12 +413,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036001600660000308600360056000030614600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9687", @@ -458,12 +458,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036000036001600408600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9693", @@ -503,12 +503,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60026003600003600160040814600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9891", @@ -547,12 +547,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6002600504600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -592,12 +592,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6018601704600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -636,12 +636,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6018600004600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -680,12 +680,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6001600104600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -725,12 +725,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6000600204600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -769,12 +769,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x600260020a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9695", @@ -814,12 +814,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9664", @@ -859,12 +859,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x637fffffff637fffffff0a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9692", @@ -904,12 +904,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x637fffffff60000a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9892", @@ -948,12 +948,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6000637fffffff0a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -993,12 +993,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60016101010a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9695", @@ -1038,12 +1038,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x61010160010a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9694", @@ -1083,12 +1083,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x61010160020a600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9894", @@ -1127,12 +1127,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6003600206600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -1172,12 +1172,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff06600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -1217,12 +1217,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600006600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -1261,12 +1261,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6000600306600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -1305,12 +1305,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6003600260000306600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9694", @@ -1350,12 +1350,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6003600202600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -1395,12 +1395,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -1440,12 +1440,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6017600002600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -1484,12 +1484,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6001601702600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -1529,12 +1529,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f800000000000000000000000000000000000000000000000000000000000000002600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -1574,12 +1574,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7f80000000000000000000000000000000000000000000000000000000000000007f800000000000000000000000000000000000000000000000000000000000000002600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -1618,12 +1618,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -1663,12 +1663,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60026002600109600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9895", @@ -1707,12 +1707,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036002600003600160000309600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9891", @@ -1751,12 +1751,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036001600560000309600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9693", @@ -1796,12 +1796,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036001600560000309600360056000030714600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9887", @@ -1840,12 +1840,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036001600560000309600360056000030614600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9687", @@ -1885,12 +1885,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60036000036001600509600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9693", @@ -1930,12 +1930,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60026003600003600160050914600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9891", @@ -1974,12 +1974,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60000305600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9694", @@ -2019,12 +2019,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff05600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9694", @@ -2064,12 +2064,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6004600003600260000305600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9892", @@ -2108,12 +2108,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6002600003600405600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9694", @@ -2153,12 +2153,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6000600003600360000305600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9892", @@ -2197,12 +2197,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60000305600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9894", @@ -2241,12 +2241,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x62126af460500b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2286,12 +2286,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x600060000b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -2330,12 +2330,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60000b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2375,12 +2375,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2420,12 +2420,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2465,12 +2465,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60ff68f000000000000000010b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2510,12 +2510,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9896", @@ -2554,12 +2554,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x62122f6a60000b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2599,12 +2599,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x62126af460010b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2644,12 +2644,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6212faf460010b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2689,12 +2689,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x66f000000000000161ffff0b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2734,12 +2734,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x62122ff460000b600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -2779,12 +2779,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6003600003600560000307600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9692", @@ -2824,12 +2824,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6003600003600507600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9694", @@ -2869,12 +2869,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6003600560000307600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9694", @@ -2914,12 +2914,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600260000307600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9894", @@ -2958,12 +2958,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6000600260000307600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9894", @@ -3002,12 +3002,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x00", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "10000", @@ -3046,12 +3046,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6001601703600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -3091,12 +3091,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6003600203600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -3136,12 +3136,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x6017600003600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -3181,12 +3181,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600003600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -3226,12 +3226,12 @@ }, "exec" : { "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", "code" : "0x60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03600055", "data" : "0x", "gas" : "10000", "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "gas" : "9696", @@ -3258,4 +3258,4 @@ } } } -} \ No newline at end of file +} -- cgit v1.2.3 From db494170dc819b1eb0d267b6e1ab36c6cfb63569 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 15:18:13 +0100 Subject: Created generic message (easy for testing) --- cmd/mist/gui.go | 16 ++++---- core/block_manager.go | 4 +- core/state_transition.go | 98 +++++++++++++++++++++++++++++++---------------- core/transaction_pool.go | 17 ++++---- core/types/transaction.go | 88 +++++++++++++++++++++++++++--------------- core/vm_env.go | 10 ++--- miner/miner.go | 6 +-- xeth/hexface.go | 4 +- xeth/js_types.go | 10 ++--- xeth/pipe.go | 8 ++-- 10 files changed, 159 insertions(+), 102 deletions(-) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 773688ffc..46f264f35 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -305,13 +305,13 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { var ( ptx = xeth.NewJSTx(tx, pipe.World().State()) - send = nameReg.Storage(tx.Sender()) - rec = nameReg.Storage(tx.Recipient) + send = nameReg.Storage(tx.From()) + rec = nameReg.Storage(tx.To()) s, r string ) if tx.CreatesContract() { - rec = nameReg.Storage(tx.CreationAddress(pipe.World().State())) + rec = nameReg.Storage(core.AddressFromMessage(tx)) } if send.Len() != 0 { @@ -323,9 +323,9 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { r = strings.Trim(rec.Str(), "\x00") } else { if tx.CreatesContract() { - r = ethutil.Bytes2Hex(tx.CreationAddress(pipe.World().State())) + r = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } else { - r = ethutil.Bytes2Hex(tx.Recipient) + r = ethutil.Bytes2Hex(tx.To()) } } ptx.Sender = s @@ -449,11 +449,11 @@ func (gui *Gui) update() { object := state.GetAccount(gui.address()) if bytes.Compare(tx.Sender(), gui.address()) == 0 { - object.SubAmount(tx.Value) + object.SubAmount(tx.Value()) gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - object.AddAmount(tx.Value) + } else if bytes.Compare(tx.To(), gui.address()) == 0 { + object.AddAmount(tx.Value()) gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } diff --git a/core/block_manager.go b/core/block_manager.go index 794c87f52..aa845a007 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -111,7 +111,7 @@ done: // If we are mining this block and validating we want to set the logs back to 0 state.EmptyLogs() - txGas := new(big.Int).Set(tx.Gas) + txGas := new(big.Int).Set(tx.Gas()) cb := state.GetStateObject(coinbase.Address()) st := NewStateTransition(cb, tx, state, block) @@ -134,7 +134,7 @@ done: } txGas.Sub(txGas, st.gas) - cumulativeSum.Add(cumulativeSum, new(big.Int).Mul(txGas, tx.GasPrice)) + cumulativeSum.Add(cumulativeSum, new(big.Int).Mul(txGas, tx.GasPrice())) // Update the state with pending changes state.Update(txGas) diff --git a/core/state_transition.go b/core/state_transition.go index 820ba66e6..a6b654842 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -5,6 +5,8 @@ import ( "math/big" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" ) @@ -27,7 +29,7 @@ import ( */ type StateTransition struct { coinbase, receiver []byte - tx *types.Transaction + msg Message gas, gasPrice *big.Int value *big.Int data []byte @@ -35,10 +37,42 @@ type StateTransition struct { block *types.Block cb, rec, sen *state.StateObject + + Env vm.Environment +} + +type Message interface { + Hash() []byte + + CreatesContract() bool + + From() []byte + To() []byte + + GasValue() *big.Int + GasPrice() *big.Int + Gas() *big.Int + Value() *big.Int + + Nonce() uint64 + Data() []byte } -func NewStateTransition(coinbase *state.StateObject, tx *types.Transaction, state *state.StateDB, block *types.Block) *StateTransition { - return &StateTransition{coinbase.Address(), tx.Recipient, tx, new(big.Int), new(big.Int).Set(tx.GasPrice), tx.Value, tx.Data, state, block, coinbase, nil, nil} +func AddressFromMessage(msg Message) []byte { + // Generate a new address + return crypto.Sha3(ethutil.NewValue([]interface{}{msg.From(), msg.Nonce()}).Encode())[12:] +} + +func NewStateTransition(coinbase *state.StateObject, msg Message, state *state.StateDB, block *types.Block) *StateTransition { + return &StateTransition{coinbase.Address(), msg.To(), msg, new(big.Int), new(big.Int).Set(msg.GasPrice()), msg.Value(), msg.Data(), state, block, coinbase, nil, nil, nil} +} + +func (self *StateTransition) VmEnv() vm.Environment { + if self.Env == nil { + self.Env = NewEnv(self.state, self.msg, self.block) + } + + return self.Env } func (self *StateTransition) Coinbase() *state.StateObject { @@ -49,17 +83,17 @@ func (self *StateTransition) Coinbase() *state.StateObject { self.cb = self.state.GetOrNewStateObject(self.coinbase) return self.cb } -func (self *StateTransition) Sender() *state.StateObject { +func (self *StateTransition) From() *state.StateObject { if self.sen != nil { return self.sen } - self.sen = self.state.GetOrNewStateObject(self.tx.Sender()) + self.sen = self.state.GetOrNewStateObject(self.msg.From()) return self.sen } -func (self *StateTransition) Receiver() *state.StateObject { - if self.tx != nil && self.tx.CreatesContract() { +func (self *StateTransition) To() *state.StateObject { + if self.msg != nil && self.msg.CreatesContract() { return nil } @@ -67,7 +101,7 @@ func (self *StateTransition) Receiver() *state.StateObject { return self.rec } - self.rec = self.state.GetOrNewStateObject(self.tx.Recipient) + self.rec = self.state.GetOrNewStateObject(self.msg.To()) return self.rec } @@ -87,41 +121,41 @@ func (self *StateTransition) AddGas(amount *big.Int) { func (self *StateTransition) BuyGas() error { var err error - sender := self.Sender() - if sender.Balance().Cmp(self.tx.GasValue()) < 0 { - return fmt.Errorf("Insufficient funds to pre-pay gas. Req %v, has %v", self.tx.GasValue(), sender.Balance()) + sender := self.From() + if sender.Balance().Cmp(self.msg.GasValue()) < 0 { + return fmt.Errorf("Insufficient funds to pre-pay gas. Req %v, has %v", self.msg.GasValue(), sender.Balance()) } coinbase := self.Coinbase() - err = coinbase.BuyGas(self.tx.Gas, self.tx.GasPrice) + err = coinbase.BuyGas(self.msg.Gas(), self.msg.GasPrice()) if err != nil { return err } - self.AddGas(self.tx.Gas) - sender.SubAmount(self.tx.GasValue()) + self.AddGas(self.msg.Gas()) + sender.SubAmount(self.msg.GasValue()) return nil } func (self *StateTransition) RefundGas() { - coinbase, sender := self.Coinbase(), self.Sender() - coinbase.RefundGas(self.gas, self.tx.GasPrice) + coinbase, sender := self.Coinbase(), self.From() + coinbase.RefundGas(self.gas, self.msg.GasPrice()) // Return remaining gas - remaining := new(big.Int).Mul(self.gas, self.tx.GasPrice) + remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice()) sender.AddAmount(remaining) } func (self *StateTransition) preCheck() (err error) { var ( - tx = self.tx - sender = self.Sender() + msg = self.msg + sender = self.From() ) // Make sure this transaction's nonce is correct - if sender.Nonce != tx.Nonce { - return NonceError(tx.Nonce, sender.Nonce) + if sender.Nonce != msg.Nonce() { + return NonceError(msg.Nonce(), sender.Nonce) } // Pre-pay gas / Buy gas of the coinbase account @@ -133,7 +167,7 @@ func (self *StateTransition) preCheck() (err error) { } func (self *StateTransition) TransitionState() (err error) { - statelogger.Debugf("(~) %x\n", self.tx.Hash()) + statelogger.Debugf("(~) %x\n", self.msg.Hash()) // XXX Transactions after this point are considered valid. if err = self.preCheck(); err != nil { @@ -141,8 +175,8 @@ func (self *StateTransition) TransitionState() (err error) { } var ( - tx = self.tx - sender = self.Sender() + msg = self.msg + sender = self.From() ) defer self.RefundGas() @@ -169,15 +203,15 @@ func (self *StateTransition) TransitionState() (err error) { } var ret []byte - vmenv := NewEnv(self.state, self.tx, self.block) + vmenv := self.VmEnv() var ref vm.ClosureRef - if tx.CreatesContract() { - self.rec = MakeContract(tx, self.state) + if msg.CreatesContract() { + self.rec = MakeContract(msg, self.state) - ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.tx.Data, self.gas, self.gasPrice, self.value) + ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) ref.SetCode(ret) } else { - ret, err = vmenv.Call(self.Sender(), self.Receiver().Address(), self.tx.Data, self.gas, self.gasPrice, self.value) + ret, err = vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) } if err != nil { statelogger.Debugln(err) @@ -187,11 +221,11 @@ func (self *StateTransition) TransitionState() (err error) { } // Converts an transaction in to a state object -func MakeContract(tx *types.Transaction, state *state.StateDB) *state.StateObject { - addr := tx.CreationAddress(state) +func MakeContract(msg Message, state *state.StateDB) *state.StateObject { + addr := AddressFromMessage(msg) contract := state.GetOrNewStateObject(addr) - contract.InitCode = tx.Data + contract.InitCode = msg.Data() return contract } diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 36b0beb28..da91ec568 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -112,8 +112,8 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { return fmt.Errorf("No last block on the block chain") } - if len(tx.Recipient) != 0 && len(tx.Recipient) != 20 { - return fmt.Errorf("Invalid recipient. len = %d", len(tx.Recipient)) + if len(tx.To()) != 0 && len(tx.To()) != 20 { + return fmt.Errorf("Invalid recipient. len = %d", len(tx.To())) } v, _, _ := tx.Curve() @@ -124,15 +124,15 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { // Get the sender sender := pool.chainManager.State().GetAccount(tx.Sender()) - totAmount := new(big.Int).Set(tx.Value) + totAmount := new(big.Int).Set(tx.Value()) // Make sure there's enough in the sender's account. Having insufficient // funds won't invalidate this transaction but simple ignores it. if sender.Balance().Cmp(totAmount) < 0 { - return fmt.Errorf("Insufficient amount in sender's (%x) account", tx.Sender()) + return fmt.Errorf("Insufficient amount in sender's (%x) account", tx.From()) } if tx.IsContract() { - if tx.GasPrice.Cmp(big.NewInt(minGasPrice)) < 0 { + if tx.GasPrice().Cmp(big.NewInt(minGasPrice)) < 0 { return fmt.Errorf("Gasprice too low, %s given should be at least %d.", tx.GasPrice, minGasPrice) } } @@ -160,10 +160,7 @@ func (self *TxPool) Add(tx *types.Transaction) error { self.addTransaction(tx) - tmp := make([]byte, 4) - copy(tmp, tx.Recipient) - - txplogger.Debugf("(t) %x => %x (%v) %x\n", tx.Sender()[:4], tmp, tx.Value, tx.Hash()) + txplogger.Debugf("(t) %x => %x (%v) %x\n", tx.From()[:4], tx.To()[:4], tx.Value, tx.Hash()) // Notify the subscribers go self.eventMux.Post(TxPreEvent{tx}) @@ -200,7 +197,7 @@ func (pool *TxPool) RemoveInvalid(state *state.StateDB) { tx := e.Value.(*types.Transaction) sender := state.GetAccount(tx.Sender()) err := pool.ValidateTransaction(tx) - if err != nil || sender.Nonce >= tx.Nonce { + if err != nil || sender.Nonce >= tx.Nonce() { pool.pool.Remove(e) } } diff --git a/core/types/transaction.go b/core/types/transaction.go index 63edef756..4b75d3abd 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -6,7 +6,6 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/state" "github.com/obscuren/secp256k1-go" ) @@ -18,12 +17,12 @@ func IsContractAddr(addr []byte) bool { } type Transaction struct { - Nonce uint64 - Recipient []byte - Value *big.Int - Gas *big.Int - GasPrice *big.Int - Data []byte + nonce uint64 + recipient []byte + value *big.Int + gas *big.Int + gasPrice *big.Int + data []byte v byte r, s []byte @@ -32,11 +31,11 @@ type Transaction struct { } func NewContractCreationTx(value, gas, gasPrice *big.Int, script []byte) *Transaction { - return &Transaction{Recipient: nil, Value: value, Gas: gas, GasPrice: gasPrice, Data: script, contractCreation: true} + return &Transaction{recipient: nil, value: value, gas: gas, gasPrice: gasPrice, data: script, contractCreation: true} } func NewTransactionMessage(to []byte, value, gas, gasPrice *big.Int, data []byte) *Transaction { - return &Transaction{Recipient: to, Value: value, GasPrice: gasPrice, Gas: gas, Data: data, contractCreation: IsContractAddr(to)} + return &Transaction{recipient: to, value: value, gasPrice: gasPrice, gas: gas, data: data, contractCreation: IsContractAddr(to)} } func NewTransactionFromBytes(data []byte) *Transaction { @@ -54,20 +53,52 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction { } func (self *Transaction) GasValue() *big.Int { - return new(big.Int).Mul(self.Gas, self.GasPrice) + return new(big.Int).Mul(self.gas, self.gasPrice) } func (self *Transaction) TotalValue() *big.Int { v := self.GasValue() - return v.Add(v, self.Value) + return v.Add(v, self.value) } func (tx *Transaction) Hash() []byte { - data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.Recipient, tx.Value, tx.Data} + data := []interface{}{tx.Nonce, tx.gasPrice, tx.gas, tx.recipient, tx.Value, tx.Data} return crypto.Sha3(ethutil.NewValue(data).Encode()) } +func (self *Transaction) Data() []byte { + return self.data +} + +func (self *Transaction) Gas() *big.Int { + return self.gas +} + +func (self *Transaction) GasPrice() *big.Int { + return self.gasPrice +} + +func (self *Transaction) Value() *big.Int { + return self.value +} + +func (self *Transaction) Nonce() uint64 { + return self.nonce +} + +func (self *Transaction) SetNonce(nonce uint64) { + self.nonce = nonce +} + +func (self *Transaction) From() []byte { + return self.Sender() +} + +func (self *Transaction) To() []byte { + return self.recipient +} + func (tx *Transaction) CreatesContract() bool { return tx.contractCreation } @@ -77,11 +108,6 @@ func (tx *Transaction) IsContract() bool { return tx.CreatesContract() } -func (tx *Transaction) CreationAddress(state *state.StateDB) []byte { - // Generate a new address - return crypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:] -} - func (tx *Transaction) Curve() (v byte, r []byte, s []byte) { v = tx.v r = ethutil.LeftPadBytes(tx.r, 32) @@ -136,7 +162,7 @@ func (tx *Transaction) Sign(privk []byte) error { } func (tx *Transaction) RlpData() interface{} { - data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.Recipient, tx.Value, tx.Data} + data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.recipient, tx.Value, tx.Data} // TODO Remove prefixing zero's @@ -156,18 +182,18 @@ func (tx *Transaction) RlpDecode(data []byte) { } func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) { - tx.Nonce = decoder.Get(0).Uint() - tx.GasPrice = decoder.Get(1).BigInt() - tx.Gas = decoder.Get(2).BigInt() - tx.Recipient = decoder.Get(3).Bytes() - tx.Value = decoder.Get(4).BigInt() - tx.Data = decoder.Get(5).Bytes() + tx.nonce = decoder.Get(0).Uint() + tx.gasPrice = decoder.Get(1).BigInt() + tx.gas = decoder.Get(2).BigInt() + tx.recipient = decoder.Get(3).Bytes() + tx.value = decoder.Get(4).BigInt() + tx.data = decoder.Get(5).Bytes() tx.v = byte(decoder.Get(6).Uint()) tx.r = decoder.Get(7).Bytes() tx.s = decoder.Get(8).Bytes() - if IsContractAddr(tx.Recipient) { + if IsContractAddr(tx.recipient) { tx.contractCreation = true } } @@ -188,12 +214,12 @@ func (tx *Transaction) String() string { S: 0x%x `, tx.Hash(), - len(tx.Recipient) == 0, + len(tx.recipient) == 0, tx.Sender(), - tx.Recipient, - tx.Nonce, - tx.GasPrice, - tx.Gas, + tx.recipient, + tx.nonce, + tx.gasPrice, + tx.gas, tx.Value, tx.Data, tx.v, @@ -221,5 +247,5 @@ func (s Transactions) GetRlp(i int) []byte { return ethutil.Rlp(s[i]) } type TxByNonce struct{ Transactions } func (s TxByNonce) Less(i, j int) bool { - return s.Transactions[i].Nonce < s.Transactions[j].Nonce + return s.Transactions[i].nonce < s.Transactions[j].nonce } diff --git a/core/vm_env.go b/core/vm_env.go index 9e1815188..0b6744972 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -11,26 +11,26 @@ import ( type VMEnv struct { state *state.StateDB block *types.Block - tx *types.Transaction + msg Message depth int } -func NewEnv(state *state.StateDB, tx *types.Transaction, block *types.Block) *VMEnv { +func NewEnv(state *state.StateDB, msg Message, block *types.Block) *VMEnv { return &VMEnv{ state: state, block: block, - tx: tx, + msg: msg, } } -func (self *VMEnv) Origin() []byte { return self.tx.Sender() } +func (self *VMEnv) Origin() []byte { return self.msg.From() } 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.tx.Value } +func (self *VMEnv) Value() *big.Int { return self.msg.Value() } func (self *VMEnv) State() *state.StateDB { return self.state } func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit } func (self *VMEnv) Depth() int { return self.depth } diff --git a/miner/miner.go b/miner/miner.go index dc69dddc0..f63096b63 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -237,8 +237,8 @@ func (self *Miner) finiliseTxs() types.Transactions { key := self.eth.KeyManager() for i, ltx := range self.localTxs { tx := types.NewTransactionMessage(ltx.To, ethutil.Big(ltx.Value), ethutil.Big(ltx.Gas), ethutil.Big(ltx.GasPrice), ltx.Data) - tx.Nonce = state.GetNonce(self.Coinbase) - state.SetNonce(self.Coinbase, tx.Nonce+1) + tx.SetNonce(state.GetNonce(self.Coinbase)) + state.SetNonce(self.Coinbase, tx.Nonce()+1) tx.Sign(key.PrivateKey()) @@ -247,7 +247,7 @@ func (self *Miner) finiliseTxs() types.Transactions { // Faster than append for _, tx := range self.eth.TxPool().CurrentTransactions() { - if tx.GasPrice.Cmp(self.MinAcceptedGasPrice) >= 0 { + if tx.GasPrice().Cmp(self.MinAcceptedGasPrice) >= 0 { txs[actualSize] = tx actualSize++ } diff --git a/xeth/hexface.go b/xeth/hexface.go index 75ec5f43d..8fb42b4db 100644 --- a/xeth/hexface.go +++ b/xeth/hexface.go @@ -216,7 +216,7 @@ func (self *JSXEth) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr return "", err } if types.IsContractAddr(to) { - return ethutil.Bytes2Hex(tx.CreationAddress(nil)), nil + return ethutil.Bytes2Hex(core.AddressFromMessage(tx)), nil } return ethutil.Bytes2Hex(tx.Hash()), nil @@ -229,7 +229,7 @@ func (self *JSXEth) PushTx(txStr string) (*JSReceipt, error) { return nil, err } - return NewJSReciept(tx.CreatesContract(), tx.CreationAddress(self.World().State()), tx.Hash(), tx.Sender()), nil + return NewJSReciept(tx.CreatesContract(), core.AddressFromMessage(tx), tx.Hash(), tx.From()), nil } func (self *JSXEth) CompileMutan(code string) string { diff --git a/xeth/js_types.go b/xeth/js_types.go index da26439cf..2d6ee91bc 100644 --- a/xeth/js_types.go +++ b/xeth/js_types.go @@ -97,21 +97,21 @@ type JSTransaction struct { func NewJSTx(tx *types.Transaction, state *state.StateDB) *JSTransaction { hash := ethutil.Bytes2Hex(tx.Hash()) - receiver := ethutil.Bytes2Hex(tx.Recipient) + receiver := ethutil.Bytes2Hex(tx.To()) if receiver == "0000000000000000000000000000000000000000" { - receiver = ethutil.Bytes2Hex(tx.CreationAddress(state)) + receiver = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } sender := ethutil.Bytes2Hex(tx.Sender()) createsContract := tx.CreatesContract() var data string if tx.CreatesContract() { - data = strings.Join(core.Disassemble(tx.Data), "\n") + data = strings.Join(core.Disassemble(tx.Data()), "\n") } else { - data = ethutil.Bytes2Hex(tx.Data) + data = ethutil.Bytes2Hex(tx.Data()) } - return &JSTransaction{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: receiver, Contract: tx.CreatesContract(), Gas: tx.Gas.String(), GasPrice: tx.GasPrice.String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: ethutil.Bytes2Hex(tx.Data)} + return &JSTransaction{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value()), Address: receiver, Contract: tx.CreatesContract(), Gas: tx.Gas().String(), GasPrice: tx.GasPrice().String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: ethutil.Bytes2Hex(tx.Data())} } func (self *JSTransaction) ToString() string { diff --git a/xeth/pipe.go b/xeth/pipe.go index 1e4d0ec60..06820cc86 100644 --- a/xeth/pipe.go +++ b/xeth/pipe.go @@ -134,7 +134,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, to []byte, value, gas, price *et state := self.chainManager.TransState() nonce := state.GetNonce(key.Address()) - tx.Nonce = nonce + tx.SetNonce(nonce) tx.Sign(key.PrivateKey) // Do some pre processing for our "pre" events and hooks @@ -150,7 +150,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, to []byte, value, gas, price *et state.SetNonce(key.Address(), nonce+1) if contractCreation { - addr := tx.CreationAddress(self.World().State()) + addr := core.AddressFromMessage(tx) pipelogger.Infof("Contract addr %x\n", addr) } @@ -163,8 +163,8 @@ func (self *XEth) PushTx(tx *types.Transaction) ([]byte, error) { return nil, err } - if tx.Recipient == nil { - addr := tx.CreationAddress(self.World().State()) + if tx.To() == nil { + addr := core.AddressFromMessage(tx) pipelogger.Infof("Contract addr %x\n", addr) return addr, nil } -- cgit v1.2.3 From 5ad473d7581b92811c3a3e035274a82fc5568f57 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 15:33:22 +0100 Subject: Moved methods to messages --- cmd/mist/gui.go | 4 ++-- core/state_transition.go | 10 ++++++---- core/transaction_pool.go | 6 ------ core/types/transaction.go | 23 ++--------------------- xeth/hexface.go | 2 +- xeth/js_types.go | 6 +++--- 6 files changed, 14 insertions(+), 37 deletions(-) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 46f264f35..7775889cc 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -310,7 +310,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { s, r string ) - if tx.CreatesContract() { + if core.MessageCreatesContract(tx) { rec = nameReg.Storage(core.AddressFromMessage(tx)) } @@ -322,7 +322,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { if rec.Len() != 0 { r = strings.Trim(rec.Str(), "\x00") } else { - if tx.CreatesContract() { + if core.MessageCreatesContract(tx) { r = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } else { r = ethutil.Bytes2Hex(tx.To()) diff --git a/core/state_transition.go b/core/state_transition.go index a6b654842..61c9558e3 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -44,8 +44,6 @@ type StateTransition struct { type Message interface { Hash() []byte - CreatesContract() bool - From() []byte To() []byte @@ -63,6 +61,10 @@ func AddressFromMessage(msg Message) []byte { return crypto.Sha3(ethutil.NewValue([]interface{}{msg.From(), msg.Nonce()}).Encode())[12:] } +func MessageCreatesContract(msg Message) bool { + return len(msg.To()) == 0 +} + func NewStateTransition(coinbase *state.StateObject, msg Message, state *state.StateDB, block *types.Block) *StateTransition { return &StateTransition{coinbase.Address(), msg.To(), msg, new(big.Int), new(big.Int).Set(msg.GasPrice()), msg.Value(), msg.Data(), state, block, coinbase, nil, nil, nil} } @@ -93,7 +95,7 @@ func (self *StateTransition) From() *state.StateObject { return self.sen } func (self *StateTransition) To() *state.StateObject { - if self.msg != nil && self.msg.CreatesContract() { + if self.msg != nil && MessageCreatesContract(self.msg) { return nil } @@ -205,7 +207,7 @@ func (self *StateTransition) TransitionState() (err error) { var ret []byte vmenv := self.VmEnv() var ref vm.ClosureRef - if msg.CreatesContract() { + if MessageCreatesContract(msg) { self.rec = MakeContract(msg, self.state) ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) diff --git a/core/transaction_pool.go b/core/transaction_pool.go index da91ec568..58c2255a4 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -131,12 +131,6 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { return fmt.Errorf("Insufficient amount in sender's (%x) account", tx.From()) } - if tx.IsContract() { - if tx.GasPrice().Cmp(big.NewInt(minGasPrice)) < 0 { - return fmt.Errorf("Gasprice too low, %s given should be at least %d.", tx.GasPrice, minGasPrice) - } - } - // Increment the nonce making each tx valid only once to prevent replay // attacks diff --git a/core/types/transaction.go b/core/types/transaction.go index 4b75d3abd..21d455f2e 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -9,11 +9,8 @@ import ( "github.com/obscuren/secp256k1-go" ) -var ContractAddr = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - func IsContractAddr(addr []byte) bool { return len(addr) == 0 - //return bytes.Compare(addr, ContractAddr) == 0 } type Transaction struct { @@ -25,17 +22,14 @@ type Transaction struct { data []byte v byte r, s []byte - - // Indicates whether this tx is a contract creation transaction - contractCreation bool } func NewContractCreationTx(value, gas, gasPrice *big.Int, script []byte) *Transaction { - return &Transaction{recipient: nil, value: value, gas: gas, gasPrice: gasPrice, data: script, contractCreation: true} + return &Transaction{recipient: nil, value: value, gas: gas, gasPrice: gasPrice, data: script} } func NewTransactionMessage(to []byte, value, gas, gasPrice *big.Int, data []byte) *Transaction { - return &Transaction{recipient: to, value: value, gasPrice: gasPrice, gas: gas, data: data, contractCreation: IsContractAddr(to)} + return &Transaction{recipient: to, value: value, gasPrice: gasPrice, gas: gas, data: data} } func NewTransactionFromBytes(data []byte) *Transaction { @@ -99,15 +93,6 @@ func (self *Transaction) To() []byte { return self.recipient } -func (tx *Transaction) CreatesContract() bool { - return tx.contractCreation -} - -/* Deprecated */ -func (tx *Transaction) IsContract() bool { - return tx.CreatesContract() -} - func (tx *Transaction) Curve() (v byte, r []byte, s []byte) { v = tx.v r = ethutil.LeftPadBytes(tx.r, 32) @@ -192,10 +177,6 @@ func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) { tx.r = decoder.Get(7).Bytes() tx.s = decoder.Get(8).Bytes() - - if IsContractAddr(tx.recipient) { - tx.contractCreation = true - } } func (tx *Transaction) String() string { diff --git a/xeth/hexface.go b/xeth/hexface.go index 8fb42b4db..bfd2dddd9 100644 --- a/xeth/hexface.go +++ b/xeth/hexface.go @@ -229,7 +229,7 @@ func (self *JSXEth) PushTx(txStr string) (*JSReceipt, error) { return nil, err } - return NewJSReciept(tx.CreatesContract(), core.AddressFromMessage(tx), tx.Hash(), tx.From()), nil + return NewJSReciept(core.MessageCreatesContract(tx), core.AddressFromMessage(tx), tx.Hash(), tx.From()), nil } func (self *JSXEth) CompileMutan(code string) string { diff --git a/xeth/js_types.go b/xeth/js_types.go index 2d6ee91bc..62867d6a9 100644 --- a/xeth/js_types.go +++ b/xeth/js_types.go @@ -102,16 +102,16 @@ func NewJSTx(tx *types.Transaction, state *state.StateDB) *JSTransaction { receiver = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } sender := ethutil.Bytes2Hex(tx.Sender()) - createsContract := tx.CreatesContract() + createsContract := core.MessageCreatesContract(tx) var data string - if tx.CreatesContract() { + if createsContract { data = strings.Join(core.Disassemble(tx.Data()), "\n") } else { data = ethutil.Bytes2Hex(tx.Data()) } - return &JSTransaction{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value()), Address: receiver, Contract: tx.CreatesContract(), Gas: tx.Gas().String(), GasPrice: tx.GasPrice().String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: ethutil.Bytes2Hex(tx.Data())} + return &JSTransaction{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value()), Address: receiver, Contract: createsContract, Gas: tx.Gas().String(), GasPrice: tx.GasPrice().String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: ethutil.Bytes2Hex(tx.Data())} } func (self *JSTransaction) ToString() string { -- cgit v1.2.3 From 198cc69357a0f25ae486a041786e1239c6f5ab0f Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 21:58:26 +0100 Subject: Gas corrections and vm fixes --- core/block_manager.go | 2 +- core/state_transition.go | 73 ++++++++++++++++++++++++----------------------- core/types/transaction.go | 9 ------ state/state.go | 30 +++++++------------ tests/helper/vm.go | 37 ++++++++++++++++++++---- tests/vm/gh_test.go | 26 ++++++++++++++++- vm/common.go | 2 +- vm/vm_debug.go | 20 ++++++------- 8 files changed, 116 insertions(+), 83 deletions(-) diff --git a/core/block_manager.go b/core/block_manager.go index aa845a007..8d319f84e 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -115,7 +115,7 @@ done: cb := state.GetStateObject(coinbase.Address()) st := NewStateTransition(cb, tx, state, block) - err = st.TransitionState() + _, err = st.TransitionState() if err != nil { switch { case IsNonceErr(err): diff --git a/core/state_transition.go b/core/state_transition.go index 61c9558e3..34d8cca74 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -31,6 +31,7 @@ type StateTransition struct { coinbase, receiver []byte msg Message gas, gasPrice *big.Int + initialGas *big.Int value *big.Int data []byte state *state.StateDB @@ -47,7 +48,6 @@ type Message interface { From() []byte To() []byte - GasValue() *big.Int GasPrice() *big.Int Gas() *big.Int Value() *big.Int @@ -65,8 +65,12 @@ func MessageCreatesContract(msg Message) bool { return len(msg.To()) == 0 } +func MessageGasValue(msg Message) *big.Int { + return new(big.Int).Mul(msg.Gas(), msg.GasPrice()) +} + func NewStateTransition(coinbase *state.StateObject, msg Message, state *state.StateDB, block *types.Block) *StateTransition { - return &StateTransition{coinbase.Address(), msg.To(), msg, new(big.Int), new(big.Int).Set(msg.GasPrice()), msg.Value(), msg.Data(), state, block, coinbase, nil, nil, nil} + return &StateTransition{coinbase.Address(), msg.To(), msg, new(big.Int), new(big.Int).Set(msg.GasPrice()), new(big.Int), msg.Value(), msg.Data(), state, block, coinbase, nil, nil, nil} } func (self *StateTransition) VmEnv() vm.Environment { @@ -78,33 +82,16 @@ func (self *StateTransition) VmEnv() vm.Environment { } func (self *StateTransition) Coinbase() *state.StateObject { - if self.cb != nil { - return self.cb - } - - self.cb = self.state.GetOrNewStateObject(self.coinbase) - return self.cb + return self.state.GetOrNewStateObject(self.coinbase) } func (self *StateTransition) From() *state.StateObject { - if self.sen != nil { - return self.sen - } - - self.sen = self.state.GetOrNewStateObject(self.msg.From()) - - return self.sen + return self.state.GetOrNewStateObject(self.msg.From()) } func (self *StateTransition) To() *state.StateObject { if self.msg != nil && MessageCreatesContract(self.msg) { return nil } - - if self.rec != nil { - return self.rec - } - - self.rec = self.state.GetOrNewStateObject(self.msg.To()) - return self.rec + return self.state.GetOrNewStateObject(self.msg.To()) } func (self *StateTransition) UseGas(amount *big.Int) error { @@ -124,8 +111,8 @@ func (self *StateTransition) BuyGas() error { var err error sender := self.From() - if sender.Balance().Cmp(self.msg.GasValue()) < 0 { - return fmt.Errorf("Insufficient funds to pre-pay gas. Req %v, has %v", self.msg.GasValue(), sender.Balance()) + if sender.Balance().Cmp(MessageGasValue(self.msg)) < 0 { + return fmt.Errorf("Insufficient funds to pre-pay gas. Req %v, has %v", MessageGasValue(self.msg), sender.Balance()) } coinbase := self.Coinbase() @@ -135,20 +122,12 @@ func (self *StateTransition) BuyGas() error { } self.AddGas(self.msg.Gas()) - sender.SubAmount(self.msg.GasValue()) + self.initialGas.Set(self.msg.Gas()) + sender.SubAmount(MessageGasValue(self.msg)) return nil } -func (self *StateTransition) RefundGas() { - coinbase, sender := self.Coinbase(), self.From() - coinbase.RefundGas(self.gas, self.msg.GasPrice()) - - // Return remaining gas - remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice()) - sender.AddAmount(remaining) -} - func (self *StateTransition) preCheck() (err error) { var ( msg = self.msg @@ -168,7 +147,7 @@ func (self *StateTransition) preCheck() (err error) { return nil } -func (self *StateTransition) TransitionState() (err error) { +func (self *StateTransition) TransitionState() (ret []byte, err error) { statelogger.Debugf("(~) %x\n", self.msg.Hash()) // XXX Transactions after this point are considered valid. @@ -204,7 +183,6 @@ func (self *StateTransition) TransitionState() (err error) { return } - var ret []byte vmenv := self.VmEnv() var ref vm.ClosureRef if MessageCreatesContract(msg) { @@ -231,3 +209,26 @@ func MakeContract(msg Message, state *state.StateDB) *state.StateObject { return contract } + +func (self *StateTransition) RefundGas() { + coinbaseSub := new(big.Int).Set(self.gas) + uhalf := new(big.Int).Div(self.GasUsed(), ethutil.Big2) + for addr, refs := range self.state.Refunds() { + for _, ref := range refs { + coinbaseSub.Add(self.gas, ref) + refund := ethutil.BigMin(uhalf, ref) + self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice())) + } + } + + coinbase, sender := self.Coinbase(), self.From() + coinbase.RefundGas(coinbaseSub, self.msg.GasPrice()) + + // Return remaining gas + remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice()) + sender.AddAmount(remaining) +} + +func (self *StateTransition) GasUsed() *big.Int { + return new(big.Int).Sub(self.initialGas, self.gas) +} diff --git a/core/types/transaction.go b/core/types/transaction.go index 21d455f2e..c64fb69f0 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -46,15 +46,6 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction { return tx } -func (self *Transaction) GasValue() *big.Int { - return new(big.Int).Mul(self.gas, self.gasPrice) -} - -func (self *Transaction) TotalValue() *big.Int { - v := self.GasValue() - return v.Add(v, self.value) -} - func (tx *Transaction) Hash() []byte { data := []interface{}{tx.Nonce, tx.gasPrice, tx.gas, tx.recipient, tx.Value, tx.Data} diff --git a/state/state.go b/state/state.go index ca3f2af9c..682e233c1 100644 --- a/state/state.go +++ b/state/state.go @@ -23,14 +23,14 @@ type StateDB struct { manifest *Manifest - refund map[string][]refund + refund map[string][]*big.Int logs Logs } // Create a new state from a given trie func New(trie *trie.Trie) *StateDB { - return &StateDB{Trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string][]refund)} + return &StateDB{Trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string][]*big.Int)} } func (self *StateDB) EmptyLogs() { @@ -55,12 +55,8 @@ func (self *StateDB) GetBalance(addr []byte) *big.Int { return ethutil.Big0 } -type refund struct { - gas, price *big.Int -} - -func (self *StateDB) Refund(addr []byte, gas, price *big.Int) { - self.refund[string(addr)] = append(self.refund[string(addr)], refund{gas, price}) +func (self *StateDB) Refund(addr []byte, gas *big.Int) { + self.refund[string(addr)] = append(self.refund[string(addr)], gas) } func (self *StateDB) AddBalance(addr []byte, amount *big.Int) { @@ -273,23 +269,17 @@ func (s *StateDB) Sync() { func (self *StateDB) Empty() { self.stateObjects = make(map[string]*StateObject) - self.refund = make(map[string][]refund) + self.refund = make(map[string][]*big.Int) +} + +func (self *StateDB) Refunds() map[string][]*big.Int { + return self.refund } func (self *StateDB) Update(gasUsed *big.Int) { var deleted bool - // Refund any gas that's left - // XXX THIS WILL CHANGE IN POC8 - uhalf := new(big.Int).Div(gasUsed, ethutil.Big2) - for addr, refs := range self.refund { - for _, ref := range refs { - refund := ethutil.BigMin(uhalf, ref.gas) - - self.GetStateObject([]byte(addr)).AddBalance(refund.Mul(refund, ref.price)) - } - } - self.refund = make(map[string][]refund) + self.refund = make(map[string][]*big.Int) for _, stateObject := range self.stateObjects { if stateObject.remove { diff --git a/tests/helper/vm.go b/tests/helper/vm.go index 0c77e87fb..11bcedc49 100644 --- a/tests/helper/vm.go +++ b/tests/helper/vm.go @@ -44,6 +44,7 @@ func NewEnvFromMap(state *state.StateDB, envValues map[string]string, exeValues env.time = ethutil.Big(envValues["currentTimestamp"]).Int64() env.difficulty = ethutil.Big(envValues["currentDifficulty"]) env.gasLimit = ethutil.Big(envValues["currentGasLimit"]) + env.Gas = new(big.Int) return env } @@ -110,7 +111,7 @@ func RunVm(state *state.StateDB, env, exec map[string]string) ([]byte, state.Log return ret, vmenv.logs, vmenv.Gas, err } -func RunState(state *state.StateDB, env, tx map[string]string) ([]byte, state.Logs, *big.Int, error) { +func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.Logs, *big.Int, error) { var ( keyPair, _ = crypto.NewKeyPairFromSec([]byte(ethutil.Hex2Bytes(tx["secretKey"]))) to = FromHex(tx["to"]) @@ -118,13 +119,39 @@ func RunState(state *state.StateDB, env, tx map[string]string) ([]byte, state.Lo gas = ethutil.Big(tx["gasLimit"]) price = ethutil.Big(tx["gasPrice"]) value = ethutil.Big(tx["value"]) + caddr = FromHex(env["currentCoinbase"]) ) - caller := state.GetOrNewStateObject(keyPair.Address()) + coinbase := statedb.GetOrNewStateObject(caddr) + coinbase.SetGasPool(ethutil.Big(env["currentGasLimit"])) - vmenv := NewEnvFromMap(state, env, tx) - vmenv.origin = caller.Address() - ret, err := vmenv.Call(caller, to, data, gas, price, value) + message := NewMessage(keyPair.Address(), to, data, value, gas, price) + Log.DebugDetailf("message{ to: %x, from %x, value: %v, gas: %v, price: %v }\n", message.to[:4], message.from[:4], message.value, message.gas, message.price) + st := core.NewStateTransition(coinbase, message, statedb, nil) + vmenv := NewEnvFromMap(statedb, env, tx) + vmenv.origin = keyPair.Address() + st.Env = vmenv + ret, err := st.TransitionState() + statedb.Update(vmenv.Gas) return ret, vmenv.logs, vmenv.Gas, err } + +type Message struct { + from, to []byte + value, gas, price *big.Int + data []byte +} + +func NewMessage(from, to, data []byte, value, gas, price *big.Int) Message { + return Message{from, to, value, gas, price, data} +} + +func (self Message) Hash() []byte { return nil } +func (self Message) From() []byte { return self.from } +func (self Message) To() []byte { return self.to } +func (self Message) GasPrice() *big.Int { return self.price } +func (self Message) Gas() *big.Int { return self.gas } +func (self Message) Value() *big.Int { return self.value } +func (self Message) Nonce() uint64 { return 0 } +func (self Message) Data() []byte { return self.data } diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index da5a41251..42dcc0ae1 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/tests/helper" ) @@ -76,11 +77,18 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) + helper.Logger.SetLogLevel(5) for name, test := range tests { + if name != "ABAcalls1" { + continue + } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) statedb.SetStateObject(obj) + for a, v := range account.Storage { + obj.SetState(helper.FromHex(a), ethutil.NewValue(helper.FromHex(v))) + } } // XXX Yeah, yeah... @@ -129,6 +137,16 @@ func RunVmTest(p string, t *testing.T) { for addr, account := range test.Post { obj := statedb.GetStateObject(helper.FromHex(addr)) + if obj == nil { + continue + } + + if len(test.Exec) == 0 { + if obj.Balance().Cmp(ethutil.Big(account.Balance)) != 0 { + t.Errorf("%s's : (%x) balance failed. Expected %v, got %v => %v\n", name, obj.Address()[:4], account.Balance, obj.Balance(), new(big.Int).Sub(ethutil.Big(account.Balance), obj.Balance())) + } + } + for addr, value := range account.Storage { v := obj.GetState(helper.FromHex(addr)).Bytes() vexp := helper.FromHex(value) @@ -149,6 +167,7 @@ func RunVmTest(p string, t *testing.T) { } } } + logger.Flush() } // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. @@ -212,7 +231,12 @@ func TestStateRecursiveCreate(t *testing.T) { RunVmTest(fn, t) } -func TestStateSpecialTest(t *testing.T) { +func TestStateSpecial(t *testing.T) { const fn = "../files/StateTests/stSpecialTest.json" RunVmTest(fn, t) } + +func TestStateRefund(t *testing.T) { + const fn = "../files/StateTests/stRefundTest.json" + RunVmTest(fn, t) +} diff --git a/vm/common.go b/vm/common.go index 3d6d377ca..529bbdeb1 100644 --- a/vm/common.go +++ b/vm/common.go @@ -37,7 +37,7 @@ var ( GasLog = big.NewInt(32) GasSha256 = big.NewInt(50) GasRipemd = big.NewInt(50) - GasEcrecover = big.NewInt(100) + GasEcrecover = big.NewInt(500) Pow256 = ethutil.BigPow(2, 256) diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 9da832a79..d78aff4ce 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -2,6 +2,7 @@ package vm import ( "fmt" + "math" "math/big" "github.com/ethereum/go-ethereum/crypto" @@ -112,7 +113,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * return closure.Return(nil), nil } - vmlogger.Debugf("(%d) %x gas: %v (d) %x\n", self.env.Depth(), closure.Address(), closure.Gas, callData) + vmlogger.Debugf("(%d) (%x) %x gas: %v (d) %x\n", self.env.Depth(), caller.Address()[:4], closure.Address(), closure.Gas, callData) for { prevStep = step @@ -185,11 +186,11 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * // 0 => non 0 mult = ethutil.Big3 } else if val.BigInt().Cmp(ethutil.Big0) != 0 && len(y.Bytes()) == 0 { - statedb.Refund(closure.caller.Address(), GasSStoreRefund, closure.Price) + statedb.Refund(caller.Address(), GasSStoreRefund) mult = ethutil.Big0 } else { - // non 0 => non 0 + // non 0 => non 0 (or 0 => 0) mult = ethutil.Big1 } gas.Set(new(big.Int).Mul(mult, GasSStore)) @@ -660,7 +661,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * cOff = 0 l = 0 } else if cOff+l > size { - l = 0 + l = uint64(math.Min(float64(cOff+l), float64(size))) } codeCopy := code[cOff : cOff+l] @@ -776,10 +777,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * val, loc := stack.Popn() statedb.SetState(closure.Address(), loc.Bytes(), val) - // Debug sessions are allowed to run without message - if closure.message != nil { - closure.message.AddStorageChange(loc.Bytes()) - } + closure.message.AddStorageChange(loc.Bytes()) self.Printf(" {0x%x : 0x%x}", loc.Bytes(), val.Bytes()) case JUMP: @@ -898,10 +896,12 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * return closure.Return(ret), nil case SUICIDE: - receiver := statedb.GetOrNewStateObject(stack.Pop().Bytes()) + balance := statedb.GetBalance(closure.Address()) + + self.Printf(" => (%x) %v", receiver.Address()[:4], balance) - receiver.AddAmount(statedb.GetBalance(closure.Address())) + receiver.AddAmount(balance) statedb.Delete(closure.Address()) fallthrough -- cgit v1.2.3 From f7287c626e31e980d5b164935ae913db3855eb81 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 21:58:53 +0100 Subject: updated tests --- tests/files/StateTests/stRefundTest.json | 271 +++++++++++++++++++++++++++++++ tests/files/index.js | 7 +- 2 files changed, 277 insertions(+), 1 deletion(-) diff --git a/tests/files/StateTests/stRefundTest.json b/tests/files/StateTests/stRefundTest.json index c558a2292..08ae1fac8 100644 --- a/tests/files/StateTests/stRefundTest.json +++ b/tests/files/StateTests/stRefundTest.json @@ -1,4 +1,275 @@ { + "refund500" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x600154506002545060ff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", + "nonce" : "0", + "storage" : { + "0x0a" : "0x8000000000000000000000000000000000000000000000000000000000000000", + "0x0b" : "0x0de0b6b3a7640000" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "592", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "9408", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x600154506002545060ff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", + "nonce" : "0", + "storage" : { + "0x01" : "0x01", + "0x02" : "0x01", + "0x03" : "0x01", + "0x04" : "0x01", + "0x05" : "0x01", + "0x06" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "10000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0" + } + }, + "refund50_1" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x60006001556000600255600060035560006004556000600555", + "nonce" : "0", + "storage" : { + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "255", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "9745", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x60006001556000600255600060035560006004556000600555", + "nonce" : "0", + "storage" : { + "0x01" : "0x01", + "0x02" : "0x01", + "0x03" : "0x01", + "0x04" : "0x01", + "0x05" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "10000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0" + } + }, + "refund50_2" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6001600a556001600b5560006001556000600255600060035560006004556000600555", + "nonce" : "0", + "storage" : { + "0x0a" : "0x01", + "0x0b" : "0x01" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "614", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "9386", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x6001600a556001600b5560006001556000600255600060035560006004556000600555", + "nonce" : "0", + "storage" : { + "0x01" : "0x01", + "0x02" : "0x01", + "0x03" : "0x01", + "0x04" : "0x01", + "0x05" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "10000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0" + } + }, + "refund600" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x600154506002545061ffff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", + "nonce" : "0", + "storage" : { + "0x0b" : "0x0de0b6b3a7640000" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "492", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "9508", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x600154506002545061ffff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", + "nonce" : "0", + "storage" : { + "0x01" : "0x01", + "0x02" : "0x01", + "0x03" : "0x01", + "0x04" : "0x01", + "0x05" : "0x01", + "0x06" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "10000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0" + } + }, "refund_NoOOG_1" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", diff --git a/tests/files/index.js b/tests/files/index.js index 730107a27..34a03d8b2 100644 --- a/tests/files/index.js +++ b/tests/files/index.js @@ -8,12 +8,17 @@ module.exports = { trietestnextprev: require('./TrieTests/trietestnextprev'), txtest: require('./BasicTests/txtest'), StateTests: { + stExample: require('./StateTests/stExample.json'), + stInitCodeTest: require('./StateTests/stInitCodeTest.json'), + stLogTests: require('./StateTests/stLogTests.json'), stPreCompiledContracts: require('./StateTests/stPreCompiledContracts'), stRecursiveCreate: require('./StateTests/stRecursiveCreate'), stSpecial: require('./StateTests/stSpecialTest'), stSystemOperationsTest: require('./StateTests/stSystemOperationsTest'), + stTransactionTest: require('./StateTests/stTransactionTest') }, VMTests: { + vmRandom: require('./VMTests/RandomTests/randomTest'), vmArithmeticTest: require('./VMTests/vmArithmeticTest'), vmBitwiseLogicOperationTest: require('./VMTests/vmBitwiseLogicOperationTest'), vmBlockInfoTest: require('./VMTests/vmBlockInfoTest'), @@ -22,6 +27,6 @@ module.exports = { vmLogTest: require('./VMTests/vmLogTest'), vmPushDupSwapTest: require('./VMTests/vmPushDupSwapTest'), vmSha3Test: require('./VMTests/vmSha3Test'), - vmtests: require('./VMTests/vmtests'), + vmtests: require('./VMTests/vmtests') } }; -- cgit v1.2.3 From 332568379454dce6b1fb3c3e023a53d0c52cded0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 22:38:51 +0100 Subject: Fixed refund model --- core/state_transition.go | 10 ++++------ state/state.go | 17 ++++++++++------- tests/vm/gh_test.go | 8 ++++---- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index 34d8cca74..9e81ddf28 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -213,12 +213,10 @@ func MakeContract(msg Message, state *state.StateDB) *state.StateObject { func (self *StateTransition) RefundGas() { coinbaseSub := new(big.Int).Set(self.gas) uhalf := new(big.Int).Div(self.GasUsed(), ethutil.Big2) - for addr, refs := range self.state.Refunds() { - for _, ref := range refs { - coinbaseSub.Add(self.gas, ref) - refund := ethutil.BigMin(uhalf, ref) - self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice())) - } + for addr, ref := range self.state.Refunds() { + refund := ethutil.BigMin(uhalf, ref) + coinbaseSub.Add(self.gas, refund) + self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice())) } coinbase, sender := self.Coinbase(), self.From() diff --git a/state/state.go b/state/state.go index 682e233c1..a8d611668 100644 --- a/state/state.go +++ b/state/state.go @@ -23,14 +23,14 @@ type StateDB struct { manifest *Manifest - refund map[string][]*big.Int + refund map[string]*big.Int logs Logs } // Create a new state from a given trie func New(trie *trie.Trie) *StateDB { - return &StateDB{Trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string][]*big.Int)} + return &StateDB{Trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string]*big.Int)} } func (self *StateDB) EmptyLogs() { @@ -56,7 +56,10 @@ func (self *StateDB) GetBalance(addr []byte) *big.Int { } func (self *StateDB) Refund(addr []byte, gas *big.Int) { - self.refund[string(addr)] = append(self.refund[string(addr)], gas) + if self.refund[string(addr)] == nil { + self.refund[string(addr)] = new(big.Int) + } + self.refund[string(addr)].Add(self.refund[string(addr)], gas) } func (self *StateDB) AddBalance(addr []byte, amount *big.Int) { @@ -207,7 +210,7 @@ func (self *StateDB) Copy() *StateDB { } for addr, refund := range self.refund { - state.refund[addr] = refund + state.refund[addr] = new(big.Int).Set(refund) } logs := make(Logs, len(self.logs)) @@ -269,17 +272,17 @@ func (s *StateDB) Sync() { func (self *StateDB) Empty() { self.stateObjects = make(map[string]*StateObject) - self.refund = make(map[string][]*big.Int) + self.refund = make(map[string]*big.Int) } -func (self *StateDB) Refunds() map[string][]*big.Int { +func (self *StateDB) Refunds() map[string]*big.Int { return self.refund } func (self *StateDB) Update(gasUsed *big.Int) { var deleted bool - self.refund = make(map[string][]*big.Int) + self.refund = make(map[string]*big.Int) for _, stateObject := range self.stateObjects { if stateObject.remove { diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 42dcc0ae1..ca63b90d3 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -77,11 +77,11 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) - helper.Logger.SetLogLevel(5) + //helper.Logger.SetLogLevel(5) for name, test := range tests { - if name != "ABAcalls1" { - continue - } + // if name != "refund50_1" { + // continue + // } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) -- cgit v1.2.3 From 4789084998553befa5db1bfe5a14881aa567cb9e Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 23:32:58 +0100 Subject: updated tests --- tests/vm/gh_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index ca63b90d3..10d63897d 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -77,11 +77,11 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) - //helper.Logger.SetLogLevel(5) + helper.Logger.SetLogLevel(5) for name, test := range tests { - // if name != "refund50_1" { - // continue - // } + if name != "CallRecursiveBomb0" { + continue + } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) -- cgit v1.2.3 From 1e985f986569a68601b052c8949fc6f360e139d9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 23:59:40 +0100 Subject: Fixed casting error * big(bytes) == 0 when len(bytes) > 0 --- vm/vm_debug.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vm/vm_debug.go b/vm/vm_debug.go index d78aff4ce..708aada5b 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -181,11 +181,12 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * var mult *big.Int y, x := stack.Peekn() - val := closure.GetStorage(x) - if val.BigInt().Cmp(ethutil.Big0) == 0 && len(y.Bytes()) > 0 { + //val := closure.GetStorage(x) + val := statedb.GetState(closure.Address(), x.Bytes()) + if len(val) == 0 && len(y.Bytes()) > 0 { // 0 => non 0 mult = ethutil.Big3 - } else if val.BigInt().Cmp(ethutil.Big0) != 0 && len(y.Bytes()) == 0 { + } else if len(val) > 0 && len(y.Bytes()) == 0 { statedb.Refund(caller.Address(), GasSStoreRefund) mult = ethutil.Big0 -- cgit v1.2.3 From a7f4ade7114ee962110cb7c140e7ce7bd3f6664f Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 23:59:53 +0100 Subject: Fixed tests --- tests/vm/gh_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 10d63897d..1efda7fe0 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -77,11 +77,7 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) - helper.Logger.SetLogLevel(5) for name, test := range tests { - if name != "CallRecursiveBomb0" { - continue - } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) -- cgit v1.2.3 From 59ef6e36931c980ba15babfb3680514635faebf6 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 00:18:52 +0100 Subject: Cleaned up objects --- cmd/utils/vm_env.go | 4 +--- core/execution.go | 6 ++++-- core/vm_env.go | 4 +--- tests/helper/vm.go | 3 +-- vm/closure.go | 35 +++-------------------------------- vm/vm_debug.go | 6 ++---- xeth/vm_env.go | 4 +--- 7 files changed, 13 insertions(+), 49 deletions(-) diff --git a/cmd/utils/vm_env.go b/cmd/utils/vm_env.go index eb52602c4..461a797c2 100644 --- a/cmd/utils/vm_env.go +++ b/cmd/utils/vm_env.go @@ -49,9 +49,7 @@ func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { } func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution { - evm := vm.New(self, vm.DebugVmTy) - - return core.NewExecution(evm, addr, data, gas, price, value) + return core.NewExecution(self, addr, data, gas, price, value) } func (self *VMEnv) Call(caller vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { diff --git a/core/execution.go b/core/execution.go index 827e1ee0e..cd98746c4 100644 --- a/core/execution.go +++ b/core/execution.go @@ -16,8 +16,10 @@ type Execution struct { SkipTransfer bool } -func NewExecution(vm vm.VirtualMachine, address, input []byte, gas, gasPrice, value *big.Int) *Execution { - return &Execution{vm: vm, address: address, input: input, Gas: gas, price: gasPrice, value: value} +func NewExecution(env vm.Environment, address, input []byte, gas, gasPrice, value *big.Int) *Execution { + evm := vm.New(env, vm.DebugVmTy) + + return &Execution{vm: evm, address: address, input: input, Gas: gas, price: gasPrice, value: value} } func (self *Execution) Addr() []byte { diff --git a/core/vm_env.go b/core/vm_env.go index 0b6744972..ad63ecf9c 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -43,9 +43,7 @@ func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { } func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *Execution { - evm := vm.New(self, vm.DebugVmTy) - - return NewExecution(evm, addr, data, gas, price, value) + return NewExecution(self, addr, data, gas, price, value) } func (self *VMEnv) Call(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { diff --git a/tests/helper/vm.go b/tests/helper/vm.go index 11bcedc49..e174e0892 100644 --- a/tests/helper/vm.go +++ b/tests/helper/vm.go @@ -68,8 +68,7 @@ func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error { } func (self *Env) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution { - evm := vm.New(self, vm.DebugVmTy) - exec := core.NewExecution(evm, addr, data, gas, price, value) + exec := core.NewExecution(self, addr, data, gas, price, value) exec.SkipTransfer = self.skipTransfer return exec diff --git a/vm/closure.go b/vm/closure.go index bd5268f96..97b31ada0 100644 --- a/vm/closure.go +++ b/vm/closure.go @@ -3,7 +3,6 @@ package vm import ( "math/big" - "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" ) @@ -11,8 +10,6 @@ type ClosureRef interface { ReturnGas(*big.Int, *big.Int) Address() []byte SetCode([]byte) - GetStorage(*big.Int) *ethutil.Value - SetStorage(*big.Int, *ethutil.Value) } type Closure struct { @@ -41,10 +38,6 @@ func NewClosure(msg *state.Message, caller ClosureRef, object ClosureRef, code [ return c } -func (c *Closure) GetValue(x uint64) *ethutil.Value { - return c.GetRangeValue(x, 1) -} - func (c *Closure) GetOp(x uint64) OpCode { return OpCode(c.GetByte(x)) } @@ -65,30 +58,12 @@ func (c *Closure) GetBytes(x, y int) []byte { return c.Code[x : x+y] } -func (c *Closure) GetRangeValue(x, y uint64) *ethutil.Value { +func (c *Closure) GetRangeValue(x, y uint64) []byte { if x >= uint64(len(c.Code)) || y >= uint64(len(c.Code)) { - return ethutil.NewValue(0) - } - - partial := c.Code[x : x+y] - - return ethutil.NewValue(partial) -} - -/* - * State storage functions - */ -func (c *Closure) SetStorage(x *big.Int, val *ethutil.Value) { - c.object.SetStorage(x, val) -} - -func (c *Closure) GetStorage(x *big.Int) *ethutil.Value { - m := c.object.GetStorage(x) - if m == nil { - return ethutil.EmptyValue() + return nil } - return m + return c.Code[x : x+y] } func (c *Closure) Return(ret []byte) []byte { @@ -123,10 +98,6 @@ func (c *Closure) ReturnGas(gas, price *big.Int) { /* * Set / Get */ -func (c *Closure) Caller() ClosureRef { - return c.caller -} - func (c *Closure) Address() []byte { return c.object.Address() } diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 708aada5b..fd16a3895 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -181,7 +181,6 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * var mult *big.Int y, x := stack.Peekn() - //val := closure.GetStorage(x) val := statedb.GetState(closure.Address(), x.Bytes()) if len(val) == 0 && len(y.Bytes()) > 0 { // 0 => non 0 @@ -714,8 +713,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * //a := big.NewInt(int64(op) - int64(PUSH1) + 1) a := uint64(op - PUSH1 + 1) //pc.Add(pc, ethutil.Big1) - data := closure.GetRangeValue(pc+1, a) - val := ethutil.BigD(data.Bytes()) + val := ethutil.BigD(closure.GetRangeValue(pc+1, a)) // Push value to stack stack.Push(val) pc += a @@ -723,7 +721,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * step += int(op) - int(PUSH1) + 1 - self.Printf(" => 0x%x", data.Bytes()) + self.Printf(" => 0x%x", val.Bytes()) case POP: stack.Pop() case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: diff --git a/xeth/vm_env.go b/xeth/vm_env.go index ce53e9a30..7fb674a94 100644 --- a/xeth/vm_env.go +++ b/xeth/vm_env.go @@ -47,9 +47,7 @@ func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { } func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution { - evm := vm.New(self, vm.DebugVmTy) - - return core.NewExecution(evm, addr, data, gas, price, value) + return core.NewExecution(self, addr, data, gas, price, value) } func (self *VMEnv) Call(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { -- cgit v1.2.3 From 12671c82eadc367a43502109e5e0237e228da998 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 00:23:00 +0100 Subject: Moved VM to execution --- core/execution.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/execution.go b/core/execution.go index cd98746c4..0b5e0558f 100644 --- a/core/execution.go +++ b/core/execution.go @@ -9,7 +9,7 @@ import ( ) type Execution struct { - vm vm.VirtualMachine + env vm.Environment address, input []byte Gas, price, value *big.Int object *state.StateObject @@ -17,9 +17,7 @@ type Execution struct { } func NewExecution(env vm.Environment, address, input []byte, gas, gasPrice, value *big.Int) *Execution { - evm := vm.New(env, vm.DebugVmTy) - - return &Execution{vm: evm, address: address, input: input, Gas: gas, price: gasPrice, value: value} + return &Execution{env: env, address: address, input: input, Gas: gas, price: gasPrice, value: value} } func (self *Execution) Addr() []byte { @@ -28,16 +26,18 @@ func (self *Execution) Addr() []byte { func (self *Execution) Call(codeAddr []byte, caller vm.ClosureRef) ([]byte, error) { // Retrieve the executing code - code := self.vm.Env().State().GetCode(codeAddr) + code := self.env.State().GetCode(codeAddr) return self.exec(code, codeAddr, caller) } func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret []byte, err error) { - env := self.vm.Env() + env := self.env + evm := vm.New(env, vm.DebugVmTy) + chainlogger.Debugf("pre state %x\n", env.State().Root()) - if self.vm.Env().Depth() == vm.MaxCallDepth { + if env.Depth() == vm.MaxCallDepth { // Consume all gas (by not returning it) and return a depth error return nil, vm.DepthError{} } @@ -56,21 +56,21 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret snapshot := env.State().Copy() defer func() { - if /*vm.IsDepthErr(err) ||*/ vm.IsOOGErr(err) { + if vm.IsOOGErr(err) { env.State().Set(snapshot) } chainlogger.Debugf("post state %x\n", env.State().Root()) }() self.object = to - ret, err = self.vm.Run(to, caller, code, self.value, self.Gas, self.price, self.input) + ret, err = evm.Run(to, caller, code, self.value, self.Gas, self.price, self.input) return } func (self *Execution) Create(caller vm.ClosureRef) (ret []byte, err error, account *state.StateObject) { ret, err = self.exec(self.input, nil, caller) - account = self.vm.Env().State().GetStateObject(self.address) + account = self.env.State().GetStateObject(self.address) return } -- cgit v1.2.3 From 88af879f7ae55249ff7a9669184b52a611e4fb20 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 01:18:22 +0100 Subject: version bump --- cmd/ethereum/main.go | 2 +- cmd/mist/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 9efc8e9dc..2a3c46054 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -30,7 +30,7 @@ import ( const ( ClientIdentifier = "Ethereum(G)" - Version = "0.7.9" + Version = "0.7.10" ) var clilogger = logger.NewLogger("CLI") diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 14336b4e8..eaf0af0c7 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -31,7 +31,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.9" + Version = "0.7.10" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 5da5db5a0a149235c742748aa4b3b94d13d6910f Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 13:34:21 +0100 Subject: Added authors --- cmd/mist/assets/qml/main.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 9f1f214a6..a08a8b4ef 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -786,8 +786,8 @@ ApplicationWindow { title: "About" minimumWidth: 350 maximumWidth: 350 - maximumHeight: 200 - minimumHeight: 200 + maximumHeight: 280 + minimumHeight: 280 Image { id: aboutIcon @@ -797,7 +797,7 @@ ApplicationWindow { smooth: true source: "../facet.png" x: 10 - y: 10 + y: 30 } Text { @@ -806,7 +806,7 @@ ApplicationWindow { anchors.top: parent.top anchors.topMargin: 30 font.pointSize: 12 - text: "

Mist (0.6.5)

Amalthea


Development

Jeffrey Wilcke
Viktor Trón

Building

Maran Hidskes" + text: "

Mist (0.7.10)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy

UX

Alex van de Sande
" } } -- cgit v1.2.3 From 0e93b98533968f4a0033ec6214391f5ca647a956 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 13:34:53 +0100 Subject: Transaction was generating incorrect hash because of var changes --- core/state_transition.go | 2 +- core/types/transaction.go | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index 9e81ddf28..a54246eba 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -112,7 +112,7 @@ func (self *StateTransition) BuyGas() error { sender := self.From() if sender.Balance().Cmp(MessageGasValue(self.msg)) < 0 { - return fmt.Errorf("Insufficient funds to pre-pay gas. Req %v, has %v", MessageGasValue(self.msg), sender.Balance()) + return fmt.Errorf("insufficient ETH for gas (%x). Req %v, has %v", sender.Address()[:4], MessageGasValue(self.msg), sender.Balance()) } coinbase := self.Coinbase() diff --git a/core/types/transaction.go b/core/types/transaction.go index c64fb69f0..f6ad0774b 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -47,7 +47,7 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction { } func (tx *Transaction) Hash() []byte { - data := []interface{}{tx.Nonce, tx.gasPrice, tx.gas, tx.recipient, tx.Value, tx.Data} + data := []interface{}{tx.nonce, tx.gasPrice, tx.gas, tx.recipient, tx.value, tx.data} return crypto.Sha3(ethutil.NewValue(data).Encode()) } @@ -108,8 +108,8 @@ func (tx *Transaction) PublicKey() []byte { sig := append(r, s...) sig = append(sig, v-27) - pubkey := crypto.Ecrecover(append(hash, sig...)) - //pubkey, _ := secp256k1.RecoverPubkey(hash, sig) + //pubkey := crypto.Ecrecover(append(hash, sig...)) + pubkey, _ := secp256k1.RecoverPubkey(hash, sig) return pubkey } @@ -138,9 +138,7 @@ func (tx *Transaction) Sign(privk []byte) error { } func (tx *Transaction) RlpData() interface{} { - data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.recipient, tx.Value, tx.Data} - - // TODO Remove prefixing zero's + data := []interface{}{tx.nonce, tx.gasPrice, tx.gas, tx.recipient, tx.value, tx.data} return append(data, tx.v, new(big.Int).SetBytes(tx.r).Bytes(), new(big.Int).SetBytes(tx.s).Bytes()) } @@ -184,6 +182,7 @@ func (tx *Transaction) String() string { V: 0x%x R: 0x%x S: 0x%x + Hex: %x `, tx.Hash(), len(tx.recipient) == 0, @@ -192,11 +191,13 @@ func (tx *Transaction) String() string { tx.nonce, tx.gasPrice, tx.gas, - tx.Value, - tx.Data, + tx.value, + tx.data, tx.v, tx.r, - tx.s) + tx.s, + ethutil.Encode(tx), + ) } // Transaction slice type for basic sorting -- cgit v1.2.3 From f5b8f3d41b533d51eb81e895ed9b6aa31d7aaaef Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 13:59:49 +0100 Subject: Removed OOG check. Revert should always happen. --- core/block_manager.go | 2 +- core/execution.go | 4 +--- core/state_transition.go | 11 +++++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/block_manager.go b/core/block_manager.go index 8d319f84e..20285f8f0 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -129,7 +129,6 @@ done: statelogger.Infoln(err) erroneous = append(erroneous, tx) err = nil - continue } } @@ -215,6 +214,7 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I receiptSha := types.DeriveSha(receipts) if bytes.Compare(receiptSha, block.ReceiptSha) != 0 { + chainlogger.Debugln(receipts) err = fmt.Errorf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha) return } diff --git a/core/execution.go b/core/execution.go index 0b5e0558f..44dbd3ace 100644 --- a/core/execution.go +++ b/core/execution.go @@ -56,9 +56,7 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret snapshot := env.State().Copy() defer func() { - if vm.IsOOGErr(err) { - env.State().Set(snapshot) - } + env.State().Set(snapshot) chainlogger.Debugf("post state %x\n", env.State().Root()) }() diff --git a/core/state_transition.go b/core/state_transition.go index a54246eba..a60f31e3e 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -189,12 +189,19 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) { self.rec = MakeContract(msg, self.state) ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) - ref.SetCode(ret) + if err == nil { + dataGas := big.NewInt(int64(len(ret))) + dataGas.Mul(dataGas, vm.GasCreateByte) + if err = self.UseGas(dataGas); err == nil { + ref.SetCode(ret) + } + } } else { ret, err = vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) } + if err != nil { - statelogger.Debugln(err) + self.UseGas(self.gas) } return -- cgit v1.2.3 From 1508a23a6fe3cc50f718bfd6c62caae056534c09 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 20 Dec 2014 02:21:13 +0100 Subject: Minor updates on gas and removed/refactored old code. --- core/block_manager.go | 4 +++- core/execution.go | 15 ++++++--------- core/state_transition.go | 21 ++++++++++----------- state/state.go | 7 +++++++ vm/environment.go | 5 +++++ vm/vm_debug.go | 41 ++++++++++++++++++++++------------------- 6 files changed, 53 insertions(+), 40 deletions(-) diff --git a/core/block_manager.go b/core/block_manager.go index 20285f8f0..2567e39c4 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -142,6 +142,7 @@ done: receipt := types.NewReceipt(state.Root(), cumulative) receipt.SetLogs(state.Logs()) receipt.Bloom = types.CreateBloom(types.Receipts{receipt}) + chainlogger.Debugln(receipt) // Notify all subscribers if !transientProcess { @@ -214,7 +215,8 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I receiptSha := types.DeriveSha(receipts) if bytes.Compare(receiptSha, block.ReceiptSha) != 0 { - chainlogger.Debugln(receipts) + //chainlogger.Debugf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha) + fmt.Printf("%x\n", ethutil.Encode(receipts)) err = fmt.Errorf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha) return } diff --git a/core/execution.go b/core/execution.go index 44dbd3ace..b7eead0dd 100644 --- a/core/execution.go +++ b/core/execution.go @@ -3,6 +3,7 @@ package core import ( "fmt" "math/big" + "time" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" @@ -12,7 +13,6 @@ type Execution struct { env vm.Environment address, input []byte Gas, price, value *big.Int - object *state.StateObject SkipTransfer bool } @@ -35,8 +35,6 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret env := self.env evm := vm.New(env, vm.DebugVmTy) - chainlogger.Debugf("pre state %x\n", env.State().Root()) - if env.Depth() == vm.MaxCallDepth { // Consume all gas (by not returning it) and return a depth error return nil, vm.DepthError{} @@ -55,13 +53,12 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret } snapshot := env.State().Copy() - defer func() { - env.State().Set(snapshot) - chainlogger.Debugf("post state %x\n", env.State().Root()) - }() - - self.object = to + start := time.Now() ret, err = evm.Run(to, caller, code, self.value, self.Gas, self.price, self.input) + if err != nil { + env.State().Set(snapshot) + } + chainlogger.Debugf("vm took %v\n", time.Since(start)) return } diff --git a/core/state_transition.go b/core/state_transition.go index a60f31e3e..7b7026c29 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -186,13 +186,13 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) { vmenv := self.VmEnv() var ref vm.ClosureRef if MessageCreatesContract(msg) { - self.rec = MakeContract(msg, self.state) - - ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) + contract := MakeContract(msg, self.state) + ret, err, ref = vmenv.Create(sender, contract.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) if err == nil { dataGas := big.NewInt(int64(len(ret))) dataGas.Mul(dataGas, vm.GasCreateByte) if err = self.UseGas(dataGas); err == nil { + //self.state.SetCode(ref.Address(), ret) ref.SetCode(ret) } } @@ -218,20 +218,19 @@ func MakeContract(msg Message, state *state.StateDB) *state.StateObject { } func (self *StateTransition) RefundGas() { - coinbaseSub := new(big.Int).Set(self.gas) + coinbase, sender := self.Coinbase(), self.From() + // Return remaining gas + remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice()) + sender.AddAmount(remaining) + uhalf := new(big.Int).Div(self.GasUsed(), ethutil.Big2) for addr, ref := range self.state.Refunds() { refund := ethutil.BigMin(uhalf, ref) - coinbaseSub.Add(self.gas, refund) + self.gas.Add(self.gas, refund) self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice())) } - coinbase, sender := self.Coinbase(), self.From() - coinbase.RefundGas(coinbaseSub, self.msg.GasPrice()) - - // Return remaining gas - remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice()) - sender.AddAmount(remaining) + coinbase.RefundGas(self.gas, self.msg.GasPrice()) } func (self *StateTransition) GasUsed() *big.Int { diff --git a/state/state.go b/state/state.go index a8d611668..f77da72f0 100644 --- a/state/state.go +++ b/state/state.go @@ -94,6 +94,13 @@ func (self *StateDB) GetCode(addr []byte) []byte { return nil } +func (self *StateDB) SetCode(addr, code []byte) { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + stateObject.SetCode(code) + } +} + func (self *StateDB) GetState(a, b []byte) []byte { stateObject := self.GetStateObject(a) if stateObject != nil { diff --git a/vm/environment.go b/vm/environment.go index d77fb1419..969bc5e43 100644 --- a/vm/environment.go +++ b/vm/environment.go @@ -2,6 +2,7 @@ package vm import ( "errors" + "fmt" "math/big" "github.com/ethereum/go-ethereum/ethutil" @@ -74,3 +75,7 @@ func (self *Log) Data() []byte { func (self *Log) RlpData() interface{} { return []interface{}{self.address, ethutil.ByteSliceToInterface(self.topics), self.data} } + +func (self *Log) String() string { + return fmt.Sprintf("[A=%x T=%x D=%x]", self.address, self.topics, self.data) +} diff --git a/vm/vm_debug.go b/vm/vm_debug.go index fd16a3895..aa3291e66 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -108,13 +108,13 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * } ) + vmlogger.Debugf("(%d) (%x) %x (code=%d) gas: %v (d) %x\n", self.env.Depth(), caller.Address()[:4], closure.Address(), len(code), closure.Gas, callData) + // Don't bother with the execution if there's no code. if len(code) == 0 { return closure.Return(nil), nil } - vmlogger.Debugf("(%d) (%x) %x gas: %v (d) %x\n", self.env.Depth(), caller.Address()[:4], closure.Address(), closure.Gas, callData) - for { prevStep = step // The base for all big integer arithmetic @@ -134,6 +134,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * addStepGasUsage(GasStep) var newMemSize *big.Int = ethutil.Big0 + var additionalGas *big.Int = new(big.Int) // Stack Check, memory resize & gas phase switch op { // Stack checks only @@ -213,22 +214,24 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2]) case SHA3: require(2) - gas.Set(GasSha) - newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2]) + additionalGas.Set(stack.data[stack.Len()-2]) case CALLDATACOPY: require(2) newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3]) + additionalGas.Set(stack.data[stack.Len()-3]) case CODECOPY: require(3) newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3]) + additionalGas.Set(stack.data[stack.Len()-3]) case EXTCODECOPY: require(4) newMemSize = calcMemSize(stack.data[stack.Len()-2], stack.data[stack.Len()-4]) + additionalGas.Set(stack.data[stack.Len()-4]) case CALL, CALLCODE: require(7) gas.Set(GasCall) @@ -245,20 +248,23 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * newMemSize = calcMemSize(stack.data[stack.Len()-2], stack.data[stack.Len()-3]) } + switch op { + case CALLDATACOPY, CODECOPY, EXTCODECOPY: + additionalGas.Add(additionalGas, u256(31)) + additionalGas.Div(additionalGas, u256(32)) + addStepGasUsage(additionalGas) + case SHA3: + additionalGas.Add(additionalGas, u256(31)) + additionalGas.Div(additionalGas, u256(32)) + additionalGas.Mul(additionalGas, GasSha3Byte) + addStepGasUsage(additionalGas) + } + if newMemSize.Cmp(ethutil.Big0) > 0 { newMemSize.Add(newMemSize, u256(31)) newMemSize.Div(newMemSize, u256(32)) newMemSize.Mul(newMemSize, u256(32)) - switch op { - case CALLDATACOPY, CODECOPY, EXTCODECOPY: - addStepGasUsage(new(big.Int).Div(newMemSize, u256(32))) - case SHA3: - g := new(big.Int).Div(newMemSize, u256(32)) - g.Mul(g, GasSha3Byte) - addStepGasUsage(g) - } - if newMemSize.Cmp(u256(int64(mem.Len()))) > 0 { memGasUsage := new(big.Int).Sub(newMemSize, u256(int64(mem.Len()))) memGasUsage.Mul(GasMemory, memGasUsage) @@ -643,9 +649,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * case CODECOPY, EXTCODECOPY: var code []byte if op == EXTCODECOPY { - addr := stack.Pop().Bytes() - - code = statedb.GetCode(addr) + code = statedb.GetCode(stack.Pop().Bytes()) } else { code = closure.Code } @@ -663,12 +667,11 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * } else if cOff+l > size { l = uint64(math.Min(float64(cOff+l), float64(size))) } - codeCopy := code[cOff : cOff+l] mem.Set(mOff, l, codeCopy) - self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, code[cOff:cOff+l]) + self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, codeCopy) case GASPRICE: stack.Push(closure.Price) @@ -891,7 +894,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * size, offset := stack.Popn() ret := mem.Get(offset.Int64(), size.Int64()) - self.Printf(" => (%d) 0x%x", len(ret), ret).Endl() + self.Printf(" => [%v, %v] (%d) 0x%x", offset, size, len(ret), ret).Endl() return closure.Return(ret), nil case SUICIDE: -- cgit v1.2.3 From 0a9dc1536c5d776844d6947a0090ff7e1a7c6ab4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 20 Dec 2014 02:33:45 +0100 Subject: Increased peer from 10 to 30 --- cmd/ethereum/flags.go | 2 +- cmd/mist/flags.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 783944cf2..85aca47c3 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -85,7 +85,7 @@ func Init() { flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") flag.StringVar(&OutboundPort, "port", "30303", "listening port") flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") - flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") + flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 2ae0a0487..e49408181 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -104,7 +104,7 @@ func Init() { flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") flag.StringVar(&OutboundPort, "port", "30303", "listening port") flag.BoolVar(&UseUPnP, "upnp", true, "enable UPnP support") - flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") + flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") -- cgit v1.2.3 From 0e5aed63ddbda716ba7373bed7cfc083ec35ced1 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 21 Dec 2014 15:06:35 +0100 Subject: Updated QWhisper * changed api * general whisper debug interface --- cmd/mist/assets/qml/views/whisper.qml | 32 ++++++++++++++++++++++++++++++-- cmd/mist/ui_lib.go | 8 ++++++++ ui/qt/qwhisper/message.go | 23 +++++++++++++++++++++++ ui/qt/qwhisper/watch.go | 13 +++++++++++++ ui/qt/qwhisper/whisper.go | 17 ++++++----------- 5 files changed, 80 insertions(+), 13 deletions(-) create mode 100644 ui/qt/qwhisper/message.go create mode 100644 ui/qt/qwhisper/watch.go diff --git a/cmd/mist/assets/qml/views/whisper.qml b/cmd/mist/assets/qml/views/whisper.qml index b50841ba5..b43ea4f8b 100644 --- a/cmd/mist/assets/qml/views/whisper.qml +++ b/cmd/mist/assets/qml/views/whisper.qml @@ -9,7 +9,7 @@ import Ethereum 1.0 Rectangle { id: root - property var title: "Whisper" + property var title: "Whisper Traffic" property var iconSource: "../facet.png" property var menuItem @@ -21,10 +21,22 @@ Rectangle { identity = shh.newIdentity() console.log("New identity:", identity) - var t = shh.watch({topics: ["chat"]}) + var t = shh.watch({}, root) + } + + function onMessage(message) { + whisperModel.insert(0, {data: JSON.stringify({from: message.from, payload: eth.toAscii(message.payload)})}) } RowLayout { + id: input + anchors { + left: parent.left + leftMargin: 20 + top: parent.top + topMargin: 20 + } + TextField { id: to placeholderText: "To" @@ -44,4 +56,20 @@ Rectangle { } } } + + TableView { + id: txTableView + anchors { + top: input.bottom + topMargin: 10 + bottom: parent.bottom + left: parent.left + right: parent.right + } + TableViewColumn{ role: "data" ; title: "Data" ; width: parent.width - 2 } + + model: ListModel { + id: whisperModel + } + } } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 68f333563..fd4ffcb84 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -381,6 +381,14 @@ func (self *UiLib) ToHex(data string) string { return "0x" + ethutil.Bytes2Hex([]byte(data)) } +func (self *UiLib) ToAscii(data string) string { + start := 0 + if len(data) > 1 && data[0:2] == "0x" { + start = 2 + } + return string(ethutil.Hex2Bytes(data[start:])) +} + /* // XXX Refactor me & MOVE func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { diff --git a/ui/qt/qwhisper/message.go b/ui/qt/qwhisper/message.go new file mode 100644 index 000000000..07505ba09 --- /dev/null +++ b/ui/qt/qwhisper/message.go @@ -0,0 +1,23 @@ +package qwhisper + +import ( + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/whisper" +) + +type Message struct { + ref *whisper.Message + Flags byte + Payload string + From string +} + +func ToQMessage(msg *whisper.Message) *Message { + return &Message{ + ref: msg, + Flags: msg.Flags, + Payload: ethutil.Bytes2Hex(msg.Payload), + From: ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())), + } +} diff --git a/ui/qt/qwhisper/watch.go b/ui/qt/qwhisper/watch.go new file mode 100644 index 000000000..0ccedc719 --- /dev/null +++ b/ui/qt/qwhisper/watch.go @@ -0,0 +1,13 @@ +package qwhisper + +import ( + "fmt" + "unsafe" +) + +type Watch struct { +} + +func (self *Watch) Arrived(v unsafe.Pointer) { + fmt.Println(v) +} diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index 8f05c0695..6fb00cdac 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -3,7 +3,6 @@ package qwhisper import ( "fmt" "time" - "unsafe" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" @@ -19,13 +18,6 @@ func fromHex(s string) []byte { } func toHex(b []byte) string { return "0x" + ethutil.Bytes2Hex(b) } -type Watch struct { -} - -func (self *Watch) Arrived(v unsafe.Pointer) { - fmt.Println(v) -} - type Whisper struct { *whisper.Whisper view qml.Object @@ -70,15 +62,18 @@ func (self *Whisper) HasIdentity(key string) bool { return self.Whisper.HasIdentity(crypto.ToECDSA(fromHex(key))) } -func (self *Whisper) Watch(opts map[string]interface{}) *Watch { +func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int { filter := filterFromMap(opts) filter.Fn = func(msg *whisper.Message) { - fmt.Println(msg) + if view != nil { + view.Call("onMessage", ToQMessage(msg)) + } } + i := self.Whisper.Watch(filter) self.watches[i] = &Watch{} - return self.watches[i] + return i } func filterFromMap(opts map[string]interface{}) (f whisper.Filter) { -- cgit v1.2.3 From 795b14330ad4399ef292835eac452d258dcd7464 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 21 Dec 2014 15:13:06 +0100 Subject: Fixed EVM environment. Closes #215 --- cmd/evm/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/evm/main.go b/cmd/evm/main.go index c6c986a04..2bdfdfa9f 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -141,9 +141,7 @@ func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { } func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution { - evm := vm.New(self, vm.DebugVmTy) - - return core.NewExecution(evm, addr, data, gas, price, value) + return core.NewExecution(self, addr, data, gas, price, value) } func (self *VMEnv) Call(caller vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { -- cgit v1.2.3 From 176c98eb66dcbd55c5944bac555d9172609c739f Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 11:18:43 -0600 Subject: Updated tool import paths --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d09cbcdb0..923827e7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ before_install: install: - go get code.google.com/p/go.tools/cmd/goimports - go get github.com/golang/lint/golint - # - go get code.google.com/p/go.tools/cmd/vet - - go get code.google.com/p/go.tools/cmd/cover + # - go get golang.org/x/tools/cmd/vet + - go get golang.org/x/tools/cmd/cover - go get github.com/mattn/goveralls - ./install_deps.sh before_script: -- cgit v1.2.3 From b3629c6f62bd3774eb8858819a8ee07dfb775b73 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 11:19:33 -0600 Subject: remove temp coverage file --- profile.cov | 3038 ----------------------------------------------------------- 1 file changed, 3038 deletions(-) delete mode 100644 profile.cov diff --git a/profile.cov b/profile.cov deleted file mode 100644 index e92cd379f..000000000 --- a/profile.cov +++ /dev/null @@ -1,3038 +0,0 @@ -mode: count -github.com/ethereum/go-ethereum/chain/state_transition.go:40.134,42.2 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:44.60,45.20 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:49.2,50.16 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:45.20,47.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:52.58,53.21 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:57.2,59.17 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:53.21,55.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:61.60,62.49 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:66.2,66.21 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:70.2,71.17 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:62.49,64.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:66.21,68.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:74.60,75.30 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:78.2,80.12 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:75.30,77.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:83.54,85.2 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:87.45,91.50 3 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:95.2,97.16 3 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:101.2,104.12 3 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:91.50,93.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:97.16,99.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:107.42,114.2 4 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:116.53,123.30 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:128.2,128.37 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:132.2,132.12 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:123.30,125.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:128.37,130.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:135.60,139.39 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:143.2,155.45 4 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:160.2,162.46 3 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:166.2,166.42 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:170.2,172.26 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:198.2,207.41 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:264.2,264.8 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:139.39,141.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:155.45,157.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:162.46,164.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:166.42,168.3 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:172.26,181.22 5 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:186.3,186.33 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:181.22,183.4 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:187.4,196.3 4 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:207.41,214.20 3 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:220.3,221.20 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:214.20,218.4 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:222.4,223.29 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:223.29,225.21 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:231.4,231.20 1 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:225.21,229.5 2 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:267.122,281.2 5 0 -github.com/ethereum/go-ethereum/chain/state_transition.go:284.81,291.2 4 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:34.79,35.48 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:35.48,36.42 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:36.42,37.9 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:42.102,43.48 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:51.2,51.12 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:43.48,44.49 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:44.49,45.21 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:45.21,47.5 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:80.45,87.2 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:90.59,98.2 4 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:100.70,105.18 2 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:109.2,109.55 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:113.2,113.38 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:119.2,124.41 3 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:128.2,128.21 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:137.2,137.12 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:105.18,107.3 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:109.55,111.3 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:113.38,115.3 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:124.41,126.3 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:128.21,129.51 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:129.51,131.4 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:140.36,142.6 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:142.6,143.10 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:144.3,146.83 2 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:150.4,150.22 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:155.4,156.18 2 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:170.3,171.13 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:146.83,148.5 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:150.22,151.10 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:156.18,158.5 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:158.6,169.5 5 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:176.61,178.2 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:180.64,186.53 5 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:194.2,194.15 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:186.53,192.3 3 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:197.55,201.53 3 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:201.53,205.45 4 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:205.45,207.4 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:211.55,215.25 3 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:215.25,216.76 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:216.76,217.15 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:221.4,221.16 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:217.15,220.5 2 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:226.50,234.2 3 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:236.29,238.2 1 0 -github.com/ethereum/go-ethereum/chain/transaction_pool.go:240.28,246.2 3 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:78.57,89.2 4 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:91.35,93.2 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:95.34,97.2 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:99.53,101.2 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:103.51,105.2 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:107.52,109.2 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:111.55,115.2 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:117.54,119.2 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:121.232,131.25 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:178.2,180.53 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:131.25,140.17 6 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:159.3,173.62 10 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:140.17,142.11 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:143.4,145.13 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:146.4,149.15 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:150.4,154.13 4 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:173.62,175.4 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:183.99,188.34 3 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:192.2,192.37 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:195.2,197.44 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:188.34,190.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:192.37,194.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:200.121,211.61 4 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:215.2,216.16 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:220.2,221.44 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:226.2,227.54 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:233.2,233.55 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:238.2,238.66 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:244.2,245.49 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:250.2,252.31 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:258.2,258.41 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:211.61,213.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:216.16,218.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:221.44,224.3 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:227.54,230.3 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:233.55,236.3 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:238.66,241.3 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:245.49,248.3 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:252.31,255.3 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:258.41,272.3 7 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:272.4,274.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:277.120,283.16 4 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:287.2,287.22 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:283.16,285.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:290.74,292.37 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:297.2,303.26 4 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:310.2,310.19 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:292.37,294.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:303.26,308.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:316.73,318.36 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:322.2,323.14 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:335.2,335.72 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:339.2,339.12 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:318.36,320.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:323.14,325.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:335.72,337.3 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:342.97,347.37 4 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:378.2,382.12 3 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:347.37,348.34 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:353.3,354.25 2 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:358.3,358.81 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:362.3,362.40 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:366.3,374.68 6 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:348.34,351.4 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:354.25,356.4 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:358.81,360.4 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:362.40,364.4 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:385.96,386.37 1 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:390.2,403.39 6 0 -github.com/ethereum/go-ethereum/chain/block_manager.go:386.37,388.3 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:34.40,36.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:38.62,40.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:45.54,47.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:49.50,51.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:53.44,55.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:57.42,59.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:61.42,63.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:65.40,67.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:69.37,71.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:73.39,75.2 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:78.45,80.25 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:83.2,84.23 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:88.2,93.41 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:119.2,121.24 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:80.25,82.3 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:84.23,86.3 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:93.41,95.10 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:104.3,104.30 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:116.3,116.59 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:96.3,97.15 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:98.3,99.9 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:104.30,107.18 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:113.4,113.61 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:107.18,110.10 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:124.58,125.33 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:131.2,131.8 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:125.33,126.34 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:126.34,128.4 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:134.76,138.31 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:172.2,172.17 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:138.31,139.57 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:143.3,143.63 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:147.3,148.29 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:152.3,152.46 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:165.3,165.13 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:169.3,169.39 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:139.57,140.12 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:143.63,144.12 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:148.29,150.4 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:152.46,153.95 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:157.4,157.110 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:161.4,162.9 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:153.95,154.13 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:157.110,158.13 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:165.13,166.12 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:175.58,177.24 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:188.2,188.22 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:199.2,199.35 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:177.24,178.34 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:178.34,179.48 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:179.48,181.10 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:184.4,186.3 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:188.22,189.30 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:189.30,190.114 1 0 -github.com/ethereum/go-ethereum/chain/filter.go:190.114,192.10 2 0 -github.com/ethereum/go-ethereum/chain/filter.go:195.4,197.3 1 0 -github.com/ethereum/go-ethereum/chain/error.go:14.38,16.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:18.37,20.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:22.34,26.2 2 0 -github.com/ethereum/go-ethereum/chain/error.go:32.37,34.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:36.35,38.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:40.33,44.2 2 0 -github.com/ethereum/go-ethereum/chain/error.go:51.42,53.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:55.70,57.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:59.38,63.2 2 0 -github.com/ethereum/go-ethereum/chain/error.go:70.36,74.2 2 0 -github.com/ethereum/go-ethereum/chain/error.go:75.40,77.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:78.51,80.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:87.37,89.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:91.43,93.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:95.33,99.2 2 0 -github.com/ethereum/go-ethereum/chain/error.go:105.35,107.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:108.41,110.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:112.36,116.2 2 0 -github.com/ethereum/go-ethereum/chain/error.go:122.37,124.2 1 0 -github.com/ethereum/go-ethereum/chain/error.go:125.30,128.2 2 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:17.83,23.2 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:25.43,25.70 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:26.43,26.71 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:27.43,27.73 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:28.43,28.73 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:29.43,29.69 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:30.43,30.75 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:31.43,31.71 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:32.43,32.67 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:33.43,33.64 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:34.43,34.73 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:35.43,37.2 1 0 -github.com/ethereum/go-ethereum/chain/vm_env.go:38.73,40.2 1 0 -github.com/ethereum/go-ethereum/chain/asm.go:11.48,13.6 2 0 -github.com/ethereum/go-ethereum/chain/asm.go:49.2,49.12 1 0 -github.com/ethereum/go-ethereum/chain/asm.go:13.6,14.50 1 0 -github.com/ethereum/go-ethereum/chain/asm.go:19.3,25.13 4 0 -github.com/ethereum/go-ethereum/chain/asm.go:46.3,46.27 1 0 -github.com/ethereum/go-ethereum/chain/asm.go:14.50,16.4 1 0 -github.com/ethereum/go-ethereum/chain/asm.go:26.3,33.39 3 0 -github.com/ethereum/go-ethereum/chain/asm.go:37.4,38.22 2 0 -github.com/ethereum/go-ethereum/chain/asm.go:41.4,43.31 2 0 -github.com/ethereum/go-ethereum/chain/asm.go:33.39,35.5 1 0 -github.com/ethereum/go-ethereum/chain/asm.go:38.22,40.5 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:17.42,27.4 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:27.4,32.3 4 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:35.58,39.33 3 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:45.2,45.13 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:39.33,41.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:41.4,43.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:63.38,71.2 4 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:73.67,75.2 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:77.40,79.20 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:94.2,94.88 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:79.20,90.3 6 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:90.4,92.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:98.64,102.28 3 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:107.2,118.19 4 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:125.2,125.14 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:102.28,105.3 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:118.19,123.3 3 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:128.33,140.2 6 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:143.49,154.2 6 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:157.48,159.2 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:162.52,165.2 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:167.92,169.18 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:174.2,174.35 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:185.2,185.8 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:169.18,171.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:174.35,178.42 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:182.3,182.40 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:178.42,179.9 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:188.62,190.20 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:203.2,203.38 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:190.20,191.31 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:200.3,200.13 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:191.31,193.63 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:193.63,194.63 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:194.63,196.6 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:206.69,208.60 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:214.2,214.60 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:218.2,218.14 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:208.60,209.35 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:209.35,210.9 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:214.60,216.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:221.57,224.2 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:226.79,228.19 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:232.2,235.37 3 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:239.2,243.16 4 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:228.19,230.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:235.37,237.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:246.71,252.2 4 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:255.60,261.2 3 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:263.32,264.28 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:264.28,266.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:269.72,271.2 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:274.99,275.49 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:284.2,285.26 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:275.49,282.3 4 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:285.26,288.3 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:291.81,293.15 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:295.2,295.49 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:321.2,321.26 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:326.2,328.8 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:293.15,293.42 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:295.49,302.20 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:307.3,309.17 3 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:317.3,318.24 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:302.20,305.4 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:309.17,316.4 5 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:321.26,324.3 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:341.48,344.31 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:348.2,348.14 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:344.31,346.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:351.44,353.48 2 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:357.2,357.28 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:353.48,355.3 1 0 -github.com/ethereum/go-ethereum/chain/chain_manager.go:365.48,368.2 2 0 -github.com/ethereum/go-ethereum/chain/dagger.go:31.41,33.2 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:35.36,37.2 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:39.77,47.6 7 0 -github.com/ethereum/go-ethereum/chain/dagger.go:76.2,76.12 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:47.6,48.10 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:71.3,71.17 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:49.3,52.14 3 0 -github.com/ethereum/go-ethereum/chain/dagger.go:53.3,56.41 2 0 -github.com/ethereum/go-ethereum/chain/dagger.go:65.4,66.35 2 0 -github.com/ethereum/go-ethereum/chain/dagger.go:56.41,63.5 5 0 -github.com/ethereum/go-ethereum/chain/dagger.go:66.35,68.5 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:71.17,73.4 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:79.75,92.2 8 0 -github.com/ethereum/go-ethereum/chain/dagger.go:94.44,95.2 0 0 -github.com/ethereum/go-ethereum/chain/dagger.go:104.59,107.28 2 0 -github.com/ethereum/go-ethereum/chain/dagger.go:125.2,125.14 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:107.28,112.23 4 0 -github.com/ethereum/go-ethereum/chain/dagger.go:120.3,120.12 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:112.23,117.4 2 0 -github.com/ethereum/go-ethereum/chain/dagger.go:120.12,121.9 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:128.57,141.40 8 0 -github.com/ethereum/go-ethereum/chain/dagger.go:146.2,146.40 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:153.2,153.24 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:141.40,145.3 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:146.40,148.29 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:148.29,150.4 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:156.60,163.2 4 0 -github.com/ethereum/go-ethereum/chain/dagger.go:165.52,173.2 5 0 -github.com/ethereum/go-ethereum/chain/dagger.go:175.54,176.12 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:180.2,181.12 2 0 -github.com/ethereum/go-ethereum/chain/dagger.go:187.2,193.39 6 0 -github.com/ethereum/go-ethereum/chain/dagger.go:206.2,208.12 2 0 -github.com/ethereum/go-ethereum/chain/dagger.go:176.12,178.3 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:181.12,183.3 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:183.4,185.3 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:193.39,204.3 9 0 -github.com/ethereum/go-ethereum/chain/dagger.go:211.32,214.2 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:216.46,224.25 6 0 -github.com/ethereum/go-ethereum/chain/dagger.go:240.2,240.31 1 0 -github.com/ethereum/go-ethereum/chain/dagger.go:224.25,238.3 10 0 -github.com/ethereum/go-ethereum/chain/types/block.go:23.45,30.2 5 0 -github.com/ethereum/go-ethereum/chain/types/block.go:32.41,34.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:38.46,40.29 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:44.2,44.12 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:40.29,42.3 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:49.41,55.2 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:62.35,62.62 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:63.40,65.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:66.45,66.95 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:68.33,68.72 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:104.43,109.2 3 0 -github.com/ethereum/go-ethereum/chain/types/block.go:112.59,117.2 3 0 -github.com/ethereum/go-ethereum/chain/types/block.go:124.23,143.2 4 0 -github.com/ethereum/go-ethereum/chain/types/block.go:146.42,149.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:151.42,153.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:155.42,157.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:159.49,161.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:163.58,164.42 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:170.2,179.36 7 0 -github.com/ethereum/go-ethereum/chain/types/block.go:164.42,166.3 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:182.43,188.2 4 0 -github.com/ethereum/go-ethereum/chain/types/block.go:190.61,191.39 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:197.2,197.12 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:191.39,192.42 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:192.42,194.4 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:201.28,203.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:205.28,208.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:211.47,214.35 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:219.2,219.13 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:214.35,217.3 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:222.45,225.37 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:230.2,230.15 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:225.37,228.3 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:233.48,236.2 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:238.51,242.2 3 0 -github.com/ethereum/go-ethereum/chain/types/block.go:244.54,247.2 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:249.44,251.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:253.40,257.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:259.44,262.2 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:264.60,269.37 2 0 -github.com/ethereum/go-ethereum/chain/types/block.go:283.2,283.37 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:269.37,274.34 3 0 -github.com/ethereum/go-ethereum/chain/types/block.go:274.34,279.4 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:283.37,286.37 3 0 -github.com/ethereum/go-ethereum/chain/types/block.go:286.37,288.4 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:293.53,309.2 15 0 -github.com/ethereum/go-ethereum/chain/types/block.go:311.59,316.2 3 0 -github.com/ethereum/go-ethereum/chain/types/block.go:318.39,320.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:322.40,324.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:326.37,328.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:330.42,332.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:334.50,365.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:367.44,369.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:371.37,410.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:412.47,414.2 1 0 -github.com/ethereum/go-ethereum/chain/types/block.go:417.42,419.2 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:11.44,13.35 2 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:17.2,17.46 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:13.35,15.3 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:20.42,22.27 2 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:37.2,37.12 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:22.27,24.36 2 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:28.3,28.26 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:24.36,26.4 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:28.26,30.4 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:40.32,42.35 2 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:48.2,48.10 1 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:42.35,46.3 3 0 -github.com/ethereum/go-ethereum/chain/types/bloom9.go:51.42,56.2 3 0 -github.com/ethereum/go-ethereum/chain/types/derive_sha.go:13.43,15.34 2 0 -github.com/ethereum/go-ethereum/chain/types/derive_sha.go:19.2,19.23 1 0 -github.com/ethereum/go-ethereum/chain/types/derive_sha.go:15.34,17.3 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:19.67,21.2 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:23.55,28.2 3 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:30.47,32.2 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:34.61,40.16 5 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:40.16,42.3 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:45.44,47.2 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:49.41,51.2 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:53.47,54.57 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:58.2,58.13 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:54.57,56.3 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:61.38,63.2 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:67.43,67.63 1 0 -github.com/ethereum/go-ethereum/chain/types/receipt.go:68.43,68.74 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:15.39,18.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:34.87,36.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:38.96,40.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:42.56,47.2 3 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:49.63,54.2 3 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:56.46,58.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:60.48,63.2 2 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:65.38,69.2 2 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:71.47,73.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:76.42,78.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:80.67,88.2 2 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:90.53,96.2 3 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:98.43,112.2 7 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:114.40,119.40 2 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:123.2,123.37 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:119.40,121.3 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:126.49,135.2 5 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:137.46,143.2 2 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:145.50,147.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:149.43,151.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:153.47,155.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:157.63,169.34 10 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:169.34,171.3 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:174.40,201.2 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:206.48,209.26 2 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:214.2,214.12 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:209.26,212.3 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:216.44,216.61 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:217.44,217.71 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:218.44,218.72 1 0 -github.com/ethereum/go-ethereum/chain/types/transaction.go:222.40,224.2 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:20.45,23.32 2 4 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:45.2,45.25 1 4 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:23.32,24.22 1 4 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:24.22,25.22 1 4 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:25.22,26.21 1 4 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:36.5,36.8 1 4 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:27.5,28.22 1 1 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:29.5,30.26 1 1 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:31.5,32.26 1 1 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:33.5,34.46 1 1 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:37.6,39.5 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:40.5,42.4 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:48.52,49.9 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:50.2,51.38 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:52.2,54.32 2 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:60.3,60.39 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:61.2,62.64 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:67.3,67.14 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:68.2,69.20 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:54.32,55.19 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:58.4,58.7 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:55.19,56.10 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:62.64,64.4 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:64.5,64.79 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:64.79,66.4 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:73.34,77.19 3 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:83.2,83.20 1 0 -github.com/ethereum/go-ethereum/compression/rle/read_write.go:77.19,81.3 3 0 -github.com/ethereum/go-ethereum/crypto/crypto.go:13.31,18.2 3 1 -github.com/ethereum/go-ethereum/crypto/crypto.go:21.51,23.2 1 0 -github.com/ethereum/go-ethereum/crypto/crypto.go:25.33,29.2 2 1 -github.com/ethereum/go-ethereum/crypto/crypto.go:31.36,36.2 3 1 -github.com/ethereum/go-ethereum/crypto/crypto.go:38.36,47.2 3 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:18.55,20.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:22.52,24.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:26.41,28.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:30.41,32.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:34.42,36.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:38.41,40.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:42.39,44.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:46.67,48.16 2 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:51.2,52.12 2 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:48.16,50.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:55.61,57.12 2 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:64.2,64.21 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:57.12,60.17 3 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:60.17,62.4 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:67.45,69.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:71.80,72.29 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:75.2,79.16 5 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:82.2,85.12 4 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:72.29,74.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:79.16,81.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:88.50,89.31 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:92.2,93.12 2 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:89.31,91.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:96.73,98.12 2 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:105.2,105.20 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:108.2,108.42 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:98.12,101.17 3 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:101.17,103.4 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:105.20,107.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:111.96,113.16 2 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:116.2,116.42 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:113.16,115.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:119.87,121.16 2 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:124.2,124.42 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:121.16,123.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_manager.go:127.47,130.2 2 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:24.51,26.2 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:28.67,31.2 2 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:33.61,35.16 2 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:38.2,40.16 3 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:44.2,44.24 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:47.2,47.21 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:35.16,37.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:40.16,42.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:44.24,46.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:54.69,61.38 7 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:68.2,69.19 2 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:73.2,76.16 4 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:80.2,82.16 3 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:86.2,88.16 3 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:92.2,94.16 3 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:98.2,98.12 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:61.38,66.3 4 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:69.19,71.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:76.16,78.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:82.16,84.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:88.16,90.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:94.16,96.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:101.63,103.19 2 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:106.2,109.16 3 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:112.2,112.36 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:103.19,105.3 1 0 -github.com/ethereum/go-ethereum/crypto/key_store.go:109.16,111.3 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:19.36,23.2 3 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:25.57,27.16 2 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:31.2,31.61 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:27.16,29.3 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:34.36,35.22 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:38.2,38.18 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:35.22,37.3 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:41.37,42.22 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:45.2,45.19 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:42.22,44.3 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:48.64,50.2 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:52.38,54.2 1 0 -github.com/ethereum/go-ethereum/crypto/keypair.go:56.45,58.2 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:15.28,17.2 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:19.48,21.2 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:23.46,24.21 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:28.2,28.12 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:24.21,26.3 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:31.32,33.2 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:35.29,37.2 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:39.42,40.33 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:40.33,42.3 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:45.44,47.27 2 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:50.2,50.16 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:47.27,49.3 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:53.59,57.16 4 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:60.2,61.16 2 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:64.2,64.21 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:57.16,59.3 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:61.16,63.3 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:67.61,70.45 3 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:84.2,84.39 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:70.45,73.23 3 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:79.3,79.23 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:73.23,75.4 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:75.5,75.29 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:75.29,77.4 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:79.23,81.4 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:87.61,89.27 2 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:96.2,96.21 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:89.27,91.17 2 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:94.3,94.30 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:91.17,93.4 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:99.57,102.16 3 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:106.2,107.16 2 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:110.2,110.21 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:102.16,105.3 2 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:107.16,109.3 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:113.38,115.2 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:117.45,119.32 2 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:122.2,122.10 1 0 -github.com/ethereum/go-ethereum/crypto/keyring.go:119.32,121.3 1 0 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:9.50,10.26 1 24 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:15.2,15.11 1 0 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:10.26,11.17 1 18817 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:11.17,13.4 1 24 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:18.46,22.56 3 1 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:30.2,30.12 1 1 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:22.56,29.3 6 8 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:33.46,37.39 3 1 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:59.2,59.12 1 1 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:37.39,50.12 9 8 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:53.3,53.12 1 8 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:56.3,57.32 2 8 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:50.12,52.4 1 4 -github.com/ethereum/go-ethereum/crypto/mnemonic.go:53.12,55.4 1 2 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:16.45,20.2 2 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:22.54,24.2 1 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:26.56,28.2 1 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:38.49,42.2 2 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:44.32,45.30 1 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:45.30,49.3 3 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:52.32,53.2 0 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:55.45,58.35 2 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:62.2,62.13 1 0 -github.com/ethereum/go-ethereum/ethdb/memory_database.go:58.35,60.3 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:18.56,23.16 3 0 -github.com/ethereum/go-ethereum/ethdb/database.go:27.2,29.22 2 0 -github.com/ethereum/go-ethereum/ethdb/database.go:23.16,25.3 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:32.56,33.15 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:37.2,38.16 2 0 -github.com/ethereum/go-ethereum/ethdb/database.go:33.15,35.3 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:38.16,40.3 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:43.58,45.16 2 0 -github.com/ethereum/go-ethereum/ethdb/database.go:49.2,49.15 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:53.2,53.17 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:45.16,47.3 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:49.15,51.3 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:56.51,58.2 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:60.47,63.20 2 0 -github.com/ethereum/go-ethereum/ethdb/database.go:67.2,67.13 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:63.20,65.3 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:70.58,72.2 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:74.34,77.2 1 0 -github.com/ethereum/go-ethereum/ethdb/database.go:79.34,81.18 2 0 -github.com/ethereum/go-ethereum/ethdb/database.go:81.18,88.3 5 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:14.35,16.2 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:18.60,19.22 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:25.2,25.10 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:19.22,20.34 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:20.34,22.4 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:31.54,34.16 3 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:38.2,38.41 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:34.16,36.3 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:44.37,53.16 6 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:57.2,57.15 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:53.16,55.3 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:63.43,64.25 1 5 -github.com/ethereum/go-ethereum/ethutil/bytes.go:84.2,84.8 1 5 -github.com/ethereum/go-ethereum/ethutil/bytes.go:65.2,67.58 2 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:68.2,72.20 4 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:73.2,77.20 4 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:78.2,81.20 3 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:90.32,91.14 1 7 -github.com/ethereum/go-ethereum/ethutil/bytes.go:95.2,95.33 1 5 -github.com/ethereum/go-ethereum/ethutil/bytes.go:91.14,93.3 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:101.47,106.2 3 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:108.29,111.2 2 5 -github.com/ethereum/go-ethereum/ethutil/bytes.go:113.33,115.2 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:117.35,121.2 2 3 -github.com/ethereum/go-ethereum/ethutil/bytes.go:123.76,124.70 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:130.2,130.8 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:124.70,126.3 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:126.4,128.3 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:133.37,134.20 1 4 -github.com/ethereum/go-ethereum/ethutil/bytes.go:138.2,139.53 2 3 -github.com/ethereum/go-ethereum/ethutil/bytes.go:147.2,147.27 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:134.20,136.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:139.53,141.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:141.4,141.46 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:141.46,143.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:143.4,145.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:150.50,151.28 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:167.2,167.8 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:151.28,152.27 1 4 -github.com/ethereum/go-ethereum/ethutil/bytes.go:153.3,155.16 2 3 -github.com/ethereum/go-ethereum/ethutil/bytes.go:161.4,161.48 1 3 -github.com/ethereum/go-ethereum/ethutil/bytes.go:162.3,163.45 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:155.16,157.5 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:157.6,159.5 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:170.48,171.20 1 6 -github.com/ethereum/go-ethereum/ethutil/bytes.go:175.2,178.15 3 5 -github.com/ethereum/go-ethereum/ethutil/bytes.go:171.20,173.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:181.47,182.20 1 7 -github.com/ethereum/go-ethereum/ethutil/bytes.go:186.2,189.15 3 6 -github.com/ethereum/go-ethereum/ethutil/bytes.go:182.20,184.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:192.46,193.18 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:197.2,199.20 2 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:193.18,195.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:203.47,204.18 1 2 -github.com/ethereum/go-ethereum/ethutil/bytes.go:208.2,210.20 2 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:204.18,206.3 1 1 -github.com/ethereum/go-ethereum/ethutil/bytes.go:214.42,215.21 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:223.2,225.8 2 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:215.21,217.3 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:217.4,217.28 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:217.28,219.3 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:219.4,221.3 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:228.63,229.26 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:233.2,233.8 1 0 -github.com/ethereum/go-ethereum/ethutil/bytes.go:229.26,231.3 1 0 -github.com/ethereum/go-ethereum/ethutil/path.go:10.45,14.22 2 2 -github.com/ethereum/go-ethereum/ethutil/path.go:21.2,21.8 1 2 -github.com/ethereum/go-ethereum/ethutil/path.go:14.22,19.3 3 1 -github.com/ethereum/go-ethereum/ethutil/path.go:24.38,26.38 2 2 -github.com/ethereum/go-ethereum/ethutil/path.go:30.2,30.13 1 1 -github.com/ethereum/go-ethereum/ethutil/path.go:26.38,28.3 1 1 -github.com/ethereum/go-ethereum/ethutil/path.go:33.51,35.16 2 2 -github.com/ethereum/go-ethereum/ethutil/path.go:39.2,40.16 2 1 -github.com/ethereum/go-ethereum/ethutil/path.go:44.2,44.26 1 1 -github.com/ethereum/go-ethereum/ethutil/path.go:35.16,37.3 1 1 -github.com/ethereum/go-ethereum/ethutil/path.go:40.16,42.3 1 0 -github.com/ethereum/go-ethereum/ethutil/path.go:47.55,49.16 2 2 -github.com/ethereum/go-ethereum/ethutil/path.go:52.2,55.16 3 1 -github.com/ethereum/go-ethereum/ethutil/path.go:59.2,59.12 1 1 -github.com/ethereum/go-ethereum/ethutil/path.go:49.16,51.3 1 1 -github.com/ethereum/go-ethereum/ethutil/path.go:55.16,57.3 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:15.66,16.21 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:48.2,48.17 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:16.21,19.41 2 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:19.41,20.16 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:21.4,23.19 2 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:27.5,27.25 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:23.19,25.6 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:29.5,34.23 4 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:44.4,44.24 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:34.23,36.31 2 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:41.5,41.39 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:36.31,37.19 1 0 -github.com/ethereum/go-ethereum/ethutil/script_unix.go:37.19,39.7 1 0 -github.com/ethereum/go-ethereum/ethutil/size.go:7.41,8.20 1 3 -github.com/ethereum/go-ethereum/ethutil/size.go:8.20,10.3 1 1 -github.com/ethereum/go-ethereum/ethutil/size.go:10.4,10.24 1 2 -github.com/ethereum/go-ethereum/ethutil/size.go:10.24,12.3 1 1 -github.com/ethereum/go-ethereum/ethutil/size.go:12.4,14.3 1 1 -github.com/ethereum/go-ethereum/ethutil/rlp.go:22.36,24.2 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:30.34,34.2 2 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:35.65,37.2 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:46.25,47.16 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:51.2,51.15 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:47.16,49.3 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:54.57,59.9 3 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:91.2,91.14 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:60.2,61.14 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:63.2,64.39 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:66.2,69.34 2 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:71.2,73.31 2 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:78.3,78.15 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:79.2,81.39 2 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:86.3,86.15 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:87.2,88.53 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:73.31,76.4 2 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:81.39,84.4 2 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:100.40,103.19 2 59 -github.com/ethereum/go-ethereum/ethutil/rlp.go:177.2,177.21 1 59 -github.com/ethereum/go-ethereum/ethutil/rlp.go:103.19,104.29 1 59 -github.com/ethereum/go-ethereum/ethutil/rlp.go:105.3,106.31 1 2 -github.com/ethereum/go-ethereum/ethutil/rlp.go:107.3,108.35 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:110.3,111.44 1 10 -github.com/ethereum/go-ethereum/ethutil/rlp.go:112.3,113.44 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:114.3,115.44 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:116.3,117.44 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:118.3,119.44 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:120.3,121.37 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:122.3,123.44 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:124.3,125.44 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:126.3,127.44 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:128.3,129.44 1 1 -github.com/ethereum/go-ethereum/ethutil/rlp.go:130.3,132.16 1 12 -github.com/ethereum/go-ethereum/ethutil/rlp.go:137.3,138.33 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:139.3,140.35 1 20 -github.com/ethereum/go-ethereum/ethutil/rlp.go:151.3,152.33 1 6 -github.com/ethereum/go-ethereum/ethutil/rlp.go:153.3,155.41 1 8 -github.com/ethereum/go-ethereum/ethutil/rlp.go:165.4,166.26 2 8 -github.com/ethereum/go-ethereum/ethutil/rlp.go:169.4,170.25 2 8 -github.com/ethereum/go-ethereum/ethutil/rlp.go:132.16,134.5 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:134.6,136.5 1 12 -github.com/ethereum/go-ethereum/ethutil/rlp.go:140.35,142.5 1 11 -github.com/ethereum/go-ethereum/ethutil/rlp.go:142.6,142.26 1 9 -github.com/ethereum/go-ethereum/ethutil/rlp.go:142.26,145.5 2 8 -github.com/ethereum/go-ethereum/ethutil/rlp.go:145.6,150.5 4 1 -github.com/ethereum/go-ethereum/ethutil/rlp.go:155.41,156.20 1 8 -github.com/ethereum/go-ethereum/ethutil/rlp.go:156.20,158.6 1 8 -github.com/ethereum/go-ethereum/ethutil/rlp.go:158.7,162.6 3 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:166.26,168.5 1 19 -github.com/ethereum/go-ethereum/ethutil/rlp.go:172.4,175.3 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:182.60,185.9 3 16 -github.com/ethereum/go-ethereum/ethutil/rlp.go:241.2,241.17 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:186.2,187.28 1 3 -github.com/ethereum/go-ethereum/ethutil/rlp.go:189.2,192.44 2 9 -github.com/ethereum/go-ethereum/ethutil/rlp.go:194.2,199.54 3 1 -github.com/ethereum/go-ethereum/ethutil/rlp.go:201.2,205.30 4 3 -github.com/ethereum/go-ethereum/ethutil/rlp.go:217.3,217.20 1 3 -github.com/ethereum/go-ethereum/ethutil/rlp.go:219.2,226.38 5 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:235.3,235.20 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:237.2,238.53 1 0 -github.com/ethereum/go-ethereum/ethutil/rlp.go:205.30,216.4 5 9 -github.com/ethereum/go-ethereum/ethutil/rlp.go:226.38,234.4 5 0 -github.com/ethereum/go-ethereum/ethutil/set.go:13.40,15.24 2 0 -github.com/ethereum/go-ethereum/ethutil/set.go:19.2,19.12 1 0 -github.com/ethereum/go-ethereum/ethutil/set.go:15.24,17.3 1 0 -github.com/ethereum/go-ethereum/ethutil/set.go:22.54,26.2 2 0 -github.com/ethereum/go-ethereum/ethutil/set.go:28.50,32.2 2 0 -github.com/ethereum/go-ethereum/ethutil/set.go:34.32,36.2 1 0 -github.com/ethereum/go-ethereum/ethutil/big.go:8.32,13.2 3 18 -github.com/ethereum/go-ethereum/ethutil/big.go:18.31,23.2 3 8 -github.com/ethereum/go-ethereum/ethutil/big.go:28.33,33.2 3 1 -github.com/ethereum/go-ethereum/ethutil/big.go:35.40,37.2 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:46.32,54.2 2 2 -github.com/ethereum/go-ethereum/ethutil/big.go:56.32,57.22 1 2 -github.com/ethereum/go-ethereum/ethutil/big.go:57.22,59.3 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:59.4,62.3 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:69.48,72.31 2 4 -github.com/ethereum/go-ethereum/ethutil/big.go:76.2,76.64 1 3 -github.com/ethereum/go-ethereum/ethutil/big.go:72.31,74.3 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:82.37,84.2 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:89.37,90.19 1 2 -github.com/ethereum/go-ethereum/ethutil/big.go:94.2,94.10 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:90.19,92.3 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:100.37,101.19 1 2 -github.com/ethereum/go-ethereum/ethutil/big.go:105.2,105.10 1 1 -github.com/ethereum/go-ethereum/ethutil/big.go:101.19,103.3 1 1 -github.com/ethereum/go-ethereum/ethutil/config.go:30.85,31.19 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:48.2,48.15 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:31.19,33.29 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:37.3,41.17 2 0 -github.com/ethereum/go-ethereum/ethutil/config.go:46.3,46.83 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:33.29,36.4 2 0 -github.com/ethereum/go-ethereum/ethutil/config.go:41.17,43.4 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:43.5,45.4 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:52.61,55.2 2 0 -github.com/ethereum/go-ethereum/ethutil/config.go:57.44,59.2 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:67.49,69.2 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:71.43,71.64 1 0 -github.com/ethereum/go-ethereum/ethutil/config.go:72.43,72.73 2 0 -github.com/ethereum/go-ethereum/ethutil/list.go:20.35,22.34 2 0 -github.com/ethereum/go-ethereum/ethutil/list.go:26.2,26.49 1 0 -github.com/ethereum/go-ethereum/ethutil/list.go:22.34,24.3 1 0 -github.com/ethereum/go-ethereum/ethutil/list.go:29.24,31.2 1 0 -github.com/ethereum/go-ethereum/ethutil/list.go:34.42,35.25 1 0 -github.com/ethereum/go-ethereum/ethutil/list.go:44.2,44.12 1 0 -github.com/ethereum/go-ethereum/ethutil/list.go:35.25,42.3 4 0 -github.com/ethereum/go-ethereum/ethutil/list.go:47.48,53.2 3 0 -github.com/ethereum/go-ethereum/ethutil/list.go:57.41,63.2 4 0 -github.com/ethereum/go-ethereum/ethutil/list.go:66.43,68.2 1 0 -github.com/ethereum/go-ethereum/ethutil/list.go:71.35,74.35 2 0 -github.com/ethereum/go-ethereum/ethutil/list.go:78.2,80.21 2 0 -github.com/ethereum/go-ethereum/ethutil/list.go:74.35,76.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:33.44,35.16 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:38.2,41.16 3 0 -github.com/ethereum/go-ethereum/ethutil/package.go:45.2,45.21 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:35.16,37.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:41.16,43.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:51.48,55.49 3 0 -github.com/ethereum/go-ethereum/ethutil/package.go:60.2,60.23 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:55.49,56.3 0 0 -github.com/ethereum/go-ethereum/ethutil/package.go:56.4,56.23 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:56.23,58.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:66.66,69.26 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:75.2,75.8 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:69.26,70.19 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:70.19,72.4 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:83.50,85.16 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:88.2,92.23 3 0 -github.com/ethereum/go-ethereum/ethutil/package.go:96.2,97.16 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:101.2,102.16 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:106.2,106.26 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:110.2,111.20 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:115.2,116.16 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:120.2,122.24 2 0 -github.com/ethereum/go-ethereum/ethutil/package.go:85.16,87.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:92.23,94.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:97.16,99.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:102.16,104.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:106.26,108.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:111.20,113.3 1 0 -github.com/ethereum/go-ethereum/ethutil/package.go:116.16,118.3 1 0 -github.com/ethereum/go-ethereum/ethutil/common.go:9.23,11.2 1 2 -github.com/ethereum/go-ethereum/ethutil/common.go:13.40,14.43 1 1 -github.com/ethereum/go-ethereum/ethutil/common.go:17.2,17.13 1 1 -github.com/ethereum/go-ethereum/ethutil/common.go:14.43,16.3 1 0 -github.com/ethereum/go-ethereum/ethutil/common.go:36.44,42.9 2 12 -github.com/ethereum/go-ethereum/ethutil/common.go:70.2,70.27 1 12 -github.com/ethereum/go-ethereum/ethutil/common.go:74.2,74.41 1 10 -github.com/ethereum/go-ethereum/ethutil/common.go:43.2,45.20 2 2 -github.com/ethereum/go-ethereum/ethutil/common.go:46.2,48.21 2 2 -github.com/ethereum/go-ethereum/ethutil/common.go:49.2,51.18 2 1 -github.com/ethereum/go-ethereum/ethutil/common.go:52.2,54.19 2 1 -github.com/ethereum/go-ethereum/ethutil/common.go:55.2,57.18 2 1 -github.com/ethereum/go-ethereum/ethutil/common.go:58.2,60.20 2 1 -github.com/ethereum/go-ethereum/ethutil/common.go:61.2,63.20 2 2 -github.com/ethereum/go-ethereum/ethutil/common.go:64.2,66.16 2 1 -github.com/ethereum/go-ethereum/ethutil/common.go:70.27,72.3 1 2 -github.com/ethereum/go-ethereum/ethutil/rand.go:9.48,12.17 3 2 -github.com/ethereum/go-ethereum/ethutil/rand.go:15.2,15.16 1 2 -github.com/ethereum/go-ethereum/ethutil/rand.go:18.2,18.40 1 2 -github.com/ethereum/go-ethereum/ethutil/rand.go:12.17,14.3 1 0 -github.com/ethereum/go-ethereum/ethutil/rand.go:15.16,17.3 1 0 -github.com/ethereum/go-ethereum/ethutil/rand.go:22.37,24.2 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:19.35,21.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:23.39,25.31 2 39 -github.com/ethereum/go-ethereum/ethutil/value.go:29.2,29.23 1 39 -github.com/ethereum/go-ethereum/ethutil/value.go:25.31,27.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:32.39,34.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:36.32,38.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:40.29,42.45 1 8 -github.com/ethereum/go-ethereum/ethutil/value.go:46.2,46.25 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:42.45,44.3 1 7 -github.com/ethereum/go-ethereum/ethutil/value.go:49.37,51.2 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:53.43,55.2 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:57.33,58.36 1 11 -github.com/ethereum/go-ethereum/ethutil/value.go:80.2,80.10 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:58.36,60.3 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:60.4,60.44 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:60.44,62.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:62.4,62.44 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:62.44,64.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:64.4,64.44 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:64.44,66.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:66.4,66.45 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:66.45,68.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:68.4,68.45 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:68.45,70.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:70.4,70.41 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:70.41,72.3 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:72.4,72.42 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:72.42,74.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:74.4,74.44 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:74.44,76.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:76.4,76.46 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:76.46,78.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:83.31,84.35 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:107.2,107.10 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:84.35,86.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:86.4,86.43 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:86.43,88.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:88.4,88.43 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:88.43,90.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:90.4,90.43 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:90.43,92.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:92.4,92.41 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:92.41,94.3 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:94.4,94.45 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:94.45,96.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:96.4,96.45 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:96.45,98.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:98.4,98.44 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:98.44,100.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:100.4,100.46 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:100.46,102.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:102.4,102.44 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:102.44,105.3 2 1 -github.com/ethereum/go-ethereum/ethutil/value.go:110.31,111.35 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:115.2,115.12 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:111.35,113.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:118.37,119.35 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:131.2,131.22 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:119.35,123.3 2 1 -github.com/ethereum/go-ethereum/ethutil/value.go:123.4,123.44 1 9 -github.com/ethereum/go-ethereum/ethutil/value.go:123.44,125.3 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:125.4,125.42 1 6 -github.com/ethereum/go-ethereum/ethutil/value.go:125.42,127.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:127.4,129.3 1 6 -github.com/ethereum/go-ethereum/ethutil/value.go:134.32,135.35 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:143.2,143.11 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:135.35,137.3 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:137.4,137.42 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:137.42,139.3 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:139.4,139.40 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:139.40,141.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:146.34,147.35 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:159.2,159.17 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:147.35,149.3 1 6 -github.com/ethereum/go-ethereum/ethutil/value.go:149.4,149.40 1 4 -github.com/ethereum/go-ethereum/ethutil/value.go:149.40,151.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:151.4,151.42 1 4 -github.com/ethereum/go-ethereum/ethutil/value.go:151.42,153.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:153.4,153.44 1 4 -github.com/ethereum/go-ethereum/ethutil/value.go:153.44,155.3 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:155.4,157.3 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:162.31,163.36 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:167.2,167.12 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:163.36,165.3 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:170.41,171.42 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:175.2,175.24 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:171.42,173.3 1 10 -github.com/ethereum/go-ethereum/ethutil/value.go:178.46,182.2 2 1 -github.com/ethereum/go-ethereum/ethutil/value.go:184.42,188.2 2 1 -github.com/ethereum/go-ethereum/ethutil/value.go:190.52,194.2 2 1 -github.com/ethereum/go-ethereum/ethutil/value.go:197.34,199.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:201.32,203.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:205.33,208.2 2 0 -github.com/ethereum/go-ethereum/ethutil/value.go:213.33,217.2 2 0 -github.com/ethereum/go-ethereum/ethutil/value.go:219.34,221.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:224.39,225.42 1 5 -github.com/ethereum/go-ethereum/ethutil/value.go:239.2,239.22 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:225.42,227.20 1 5 -github.com/ethereum/go-ethereum/ethutil/value.go:231.3,231.14 1 5 -github.com/ethereum/go-ethereum/ethutil/value.go:235.3,235.26 1 5 -github.com/ethereum/go-ethereum/ethutil/value.go:227.20,229.4 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:231.14,233.4 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:242.34,243.32 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:252.2,252.12 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:244.2,245.41 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:246.2,247.34 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:248.2,249.28 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:255.38,257.2 1 4 -github.com/ethereum/go-ethereum/ethutil/value.go:259.43,261.2 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:263.35,265.2 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:268.29,272.2 2 4 -github.com/ethereum/go-ethereum/ethutil/value.go:274.44,275.20 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:282.2,282.22 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:275.20,280.3 3 3 -github.com/ethereum/go-ethereum/ethutil/value.go:286.42,289.14 2 0 -github.com/ethereum/go-ethereum/ethutil/value.go:301.2,301.13 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:289.14,290.41 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:290.41,291.30 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:291.30,293.5 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:294.5,294.43 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:294.43,295.30 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:295.30,297.5 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:304.26,306.2 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:308.39,313.2 3 2 -github.com/ethereum/go-ethereum/ethutil/value.go:315.48,319.2 2 5 -github.com/ethereum/go-ethereum/ethutil/value.go:330.59,334.12 3 4 -github.com/ethereum/go-ethereum/ethutil/value.go:347.2,347.13 1 4 -github.com/ethereum/go-ethereum/ethutil/value.go:335.2,336.35 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:337.2,338.35 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:339.2,340.35 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:341.2,342.41 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:343.2,344.35 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:350.50,352.2 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:354.50,356.2 1 2 -github.com/ethereum/go-ethereum/ethutil/value.go:358.50,360.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:362.50,364.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:366.50,368.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:376.48,378.2 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:380.36,382.2 1 0 -github.com/ethereum/go-ethereum/ethutil/value.go:384.38,385.30 1 4 -github.com/ethereum/go-ethereum/ethutil/value.go:389.2,392.13 3 3 -github.com/ethereum/go-ethereum/ethutil/value.go:385.30,387.3 1 1 -github.com/ethereum/go-ethereum/ethutil/value.go:395.41,397.2 1 3 -github.com/ethereum/go-ethereum/ethutil/value.go:399.36,401.2 1 0 -github.com/ethereum/go-ethereum/event/event.go:41.66,45.17 4 1005 -github.com/ethereum/go-ethereum/event/event.go:63.2,63.12 1 1004 -github.com/ethereum/go-ethereum/event/event.go:45.17,47.3 1 1 -github.com/ethereum/go-ethereum/event/event.go:47.4,48.22 1 1004 -github.com/ethereum/go-ethereum/event/event.go:51.3,51.27 1 1004 -github.com/ethereum/go-ethereum/event/event.go:48.22,50.4 1 5 -github.com/ethereum/go-ethereum/event/event.go:51.27,54.32 3 1006 -github.com/ethereum/go-ethereum/event/event.go:57.4,60.25 4 1005 -github.com/ethereum/go-ethereum/event/event.go:54.32,56.5 1 1 -github.com/ethereum/go-ethereum/event/event.go:68.48,71.17 3 6657815 -github.com/ethereum/go-ethereum/event/event.go:75.2,77.27 3 6657811 -github.com/ethereum/go-ethereum/event/event.go:80.2,80.12 1 6657811 -github.com/ethereum/go-ethereum/event/event.go:71.17,74.3 2 4 -github.com/ethereum/go-ethereum/event/event.go:77.27,79.3 1 4004 -github.com/ethereum/go-ethereum/event/event.go:86.28,88.32 2 5 -github.com/ethereum/go-ethereum/event/event.go:93.2,95.20 3 5 -github.com/ethereum/go-ethereum/event/event.go:88.32,89.28 1 3 -github.com/ethereum/go-ethereum/event/event.go:89.28,91.4 1 3 -github.com/ethereum/go-ethereum/event/event.go:98.36,100.34 2 1001 -github.com/ethereum/go-ethereum/event/event.go:109.2,109.22 1 1001 -github.com/ethereum/go-ethereum/event/event.go:100.34,101.37 1 1001 -github.com/ethereum/go-ethereum/event/event.go:101.37,102.22 1 1001 -github.com/ethereum/go-ethereum/event/event.go:102.22,104.5 1 5 -github.com/ethereum/go-ethereum/event/event.go:104.6,106.5 1 996 -github.com/ethereum/go-ethereum/event/event.go:112.46,113.26 1 2007 -github.com/ethereum/go-ethereum/event/event.go:118.2,118.11 1 1005 -github.com/ethereum/go-ethereum/event/event.go:113.26,114.16 1 17982 -github.com/ethereum/go-ethereum/event/event.go:114.16,116.4 1 1002 -github.com/ethereum/go-ethereum/event/event.go:121.52,126.2 4 996 -github.com/ethereum/go-ethereum/event/event.go:142.35,150.2 2 1005 -github.com/ethereum/go-ethereum/event/event.go:152.44,154.2 1 1003 -github.com/ethereum/go-ethereum/event/event.go:156.32,159.2 2 1001 -github.com/ethereum/go-ethereum/event/event.go:161.30,164.14 3 1004 -github.com/ethereum/go-ethereum/event/event.go:167.2,173.19 6 1003 -github.com/ethereum/go-ethereum/event/event.go:164.14,166.3 1 1 -github.com/ethereum/go-ethereum/event/event.go:176.42,178.9 2 4004 -github.com/ethereum/go-ethereum/event/event.go:182.2,182.20 1 4004 -github.com/ethereum/go-ethereum/event/event.go:179.2,179.21 0 1004 -github.com/ethereum/go-ethereum/event/event.go:180.2,180.19 0 3000 -github.com/ethereum/go-ethereum/logger/loggers.go:56.13,58.2 1 1 -github.com/ethereum/go-ethereum/logger/loggers.go:64.21,70.36 2 1 -github.com/ethereum/go-ethereum/logger/loggers.go:77.2,77.6 1 1 -github.com/ethereum/go-ethereum/logger/loggers.go:70.36,75.3 4 22 -github.com/ethereum/go-ethereum/logger/loggers.go:77.6,78.10 1 52 -github.com/ethereum/go-ethereum/logger/loggers.go:79.3,80.31 1 20 -github.com/ethereum/go-ethereum/logger/loggers.go:84.3,86.19 2 16 -github.com/ethereum/go-ethereum/logger/loggers.go:88.3,90.31 1 7 -github.com/ethereum/go-ethereum/logger/loggers.go:93.4,96.17 4 7 -github.com/ethereum/go-ethereum/logger/loggers.go:98.3,100.31 1 8 -github.com/ethereum/go-ethereum/logger/loggers.go:103.4,105.32 3 8 -github.com/ethereum/go-ethereum/logger/loggers.go:108.4,108.17 1 8 -github.com/ethereum/go-ethereum/logger/loggers.go:80.31,82.5 1 19 -github.com/ethereum/go-ethereum/logger/loggers.go:90.31,92.5 1 6 -github.com/ethereum/go-ethereum/logger/loggers.go:100.31,102.5 1 6 -github.com/ethereum/go-ethereum/logger/loggers.go:105.32,107.5 1 6 -github.com/ethereum/go-ethereum/logger/loggers.go:113.68,114.22 1 22 -github.com/ethereum/go-ethereum/logger/loggers.go:119.2,119.11 1 12 -github.com/ethereum/go-ethereum/logger/loggers.go:114.22,115.37 1 19 -github.com/ethereum/go-ethereum/logger/loggers.go:115.37,117.4 1 14 -github.com/ethereum/go-ethereum/logger/loggers.go:124.14,128.2 3 7 -github.com/ethereum/go-ethereum/logger/loggers.go:132.14,136.2 3 8 -github.com/ethereum/go-ethereum/logger/loggers.go:139.34,141.2 1 16 -github.com/ethereum/go-ethereum/logger/loggers.go:150.36,152.2 1 7 -github.com/ethereum/go-ethereum/logger/loggers.go:154.64,156.2 1 10 -github.com/ethereum/go-ethereum/logger/loggers.go:158.78,160.2 1 10 -github.com/ethereum/go-ethereum/logger/loggers.go:163.49,165.2 1 2 -github.com/ethereum/go-ethereum/logger/loggers.go:168.48,170.2 1 4 -github.com/ethereum/go-ethereum/logger/loggers.go:173.48,175.2 1 3 -github.com/ethereum/go-ethereum/logger/loggers.go:178.49,180.2 1 1 -github.com/ethereum/go-ethereum/logger/loggers.go:183.55,185.2 1 0 -github.com/ethereum/go-ethereum/logger/loggers.go:188.63,190.2 1 7 -github.com/ethereum/go-ethereum/logger/loggers.go:193.62,195.2 1 1 -github.com/ethereum/go-ethereum/logger/loggers.go:198.62,200.2 1 1 -github.com/ethereum/go-ethereum/logger/loggers.go:203.63,205.2 1 1 -github.com/ethereum/go-ethereum/logger/loggers.go:208.69,210.2 1 0 -github.com/ethereum/go-ethereum/logger/loggers.go:213.49,217.2 3 0 -github.com/ethereum/go-ethereum/logger/loggers.go:220.63,224.2 3 0 -github.com/ethereum/go-ethereum/logger/loggers.go:228.77,231.2 2 11 -github.com/ethereum/go-ethereum/logger/loggers.go:238.61,240.2 1 2 -github.com/ethereum/go-ethereum/logger/loggers.go:242.48,244.2 1 0 -github.com/ethereum/go-ethereum/logger/loggers.go:246.47,248.2 1 2 -github.com/ethereum/go-ethereum/p2p/client_identity.go:23.133,34.2 2 6 -github.com/ethereum/go-ethereum/p2p/client_identity.go:36.39,37.2 0 0 -github.com/ethereum/go-ethereum/p2p/client_identity.go:39.48,41.33 2 11 -github.com/ethereum/go-ethereum/p2p/client_identity.go:45.2,50.20 1 11 -github.com/ethereum/go-ethereum/p2p/client_identity.go:41.33,43.3 1 11 -github.com/ethereum/go-ethereum/p2p/client_identity.go:53.48,55.2 1 23 -github.com/ethereum/go-ethereum/p2p/client_identity.go:57.77,59.2 1 1 -github.com/ethereum/go-ethereum/p2p/client_identity.go:61.61,63.2 1 2 -github.com/ethereum/go-ethereum/p2p/natpmp.go:21.42,23.2 1 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:25.70,27.16 2 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:30.2,32.8 3 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:27.16,29.3 1 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:36.71,37.18 1 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:42.2,43.16 2 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:46.2,47.8 2 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:37.18,40.3 2 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:43.16,45.3 1 0 -github.com/ethereum/go-ethereum/p2p/natpmp.go:50.103,55.2 2 0 -github.com/ethereum/go-ethereum/p2p/peer_error.go:60.79,62.9 2 17 -github.com/ethereum/go-ethereum/p2p/peer_error.go:65.2,67.34 3 17 -github.com/ethereum/go-ethereum/p2p/peer_error.go:62.9,64.3 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error.go:70.39,72.2 1 15 -github.com/ethereum/go-ethereum/p2p/peer_error.go:74.44,76.2 1 19 -github.com/ethereum/go-ethereum/p2p/protocol.go:81.37,82.38 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:86.2,86.30 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:82.38,84.3 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:95.48,101.2 2 10 -github.com/ethereum/go-ethereum/p2p/protocol.go:103.35,104.22 1 10 -github.com/ethereum/go-ethereum/p2p/protocol.go:104.22,112.3 2 7 -github.com/ethereum/go-ethereum/p2p/protocol.go:115.34,116.2 0 10 -github.com/ethereum/go-ethereum/p2p/protocol.go:118.34,121.2 2 6 -github.com/ethereum/go-ethereum/p2p/protocol.go:123.37,125.2 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:127.41,129.2 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:131.44,133.2 1 16 -github.com/ethereum/go-ethereum/p2p/protocol.go:135.64,138.25 3 8 -github.com/ethereum/go-ethereum/p2p/protocol.go:138.25,140.3 1 8 -github.com/ethereum/go-ethereum/p2p/protocol.go:140.4,142.3 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:145.66,146.32 1 3 -github.com/ethereum/go-ethereum/p2p/protocol.go:176.2,176.17 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:146.32,148.3 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:148.4,149.42 1 2 -github.com/ethereum/go-ethereum/p2p/protocol.go:154.3,154.21 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:149.42,153.4 3 2 -github.com/ethereum/go-ethereum/p2p/protocol.go:155.3,160.5 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:161.3,163.19 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:164.3,164.16 0 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:165.3,167.65 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:170.3,171.25 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:172.3,173.73 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:167.65,169.5 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:179.62,183.2 2 21 -github.com/ethereum/go-ethereum/p2p/protocol.go:185.91,189.22 4 2 -github.com/ethereum/go-ethereum/p2p/protocol.go:189.22,191.3 1 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:194.49,196.16 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:196.16,201.3 4 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:204.53,207.29 3 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:212.2,224.30 4 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:230.2,230.22 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:235.2,235.23 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:241.2,241.82 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:247.2,247.77 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:253.2,253.23 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:263.2,264.20 2 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:268.2,277.8 5 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:207.29,210.3 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:224.30,227.3 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:230.22,233.3 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:235.23,238.3 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:241.82,244.3 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:247.77,250.3 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:253.23,255.57 2 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:255.57,258.4 2 0 -github.com/ethereum/go-ethereum/p2p/protocol.go:258.5,260.4 1 1 -github.com/ethereum/go-ethereum/p2p/protocol.go:264.20,267.3 2 3 -github.com/ethereum/go-ethereum/p2p/server.go:32.35,36.2 1 6 -github.com/ethereum/go-ethereum/p2p/server.go:38.60,43.9 5 0 -github.com/ethereum/go-ethereum/p2p/server.go:46.2,46.15 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:43.9,45.3 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:49.59,54.2 4 1 -github.com/ethereum/go-ethereum/p2p/server.go:56.52,61.2 4 0 -github.com/ethereum/go-ethereum/p2p/server.go:63.55,68.2 4 0 -github.com/ethereum/go-ethereum/p2p/server.go:98.129,101.33 2 5 -github.com/ethereum/go-ethereum/p2p/server.go:104.2,130.32 5 5 -github.com/ethereum/go-ethereum/p2p/server.go:133.2,133.13 1 5 -github.com/ethereum/go-ethereum/p2p/server.go:101.33,103.3 1 3 -github.com/ethereum/go-ethereum/p2p/server.go:130.32,132.3 1 10 -github.com/ethereum/go-ethereum/p2p/server.go:136.79,139.2 2 0 -github.com/ethereum/go-ethereum/p2p/server.go:141.74,144.2 2 0 -github.com/ethereum/go-ethereum/p2p/server.go:146.53,148.2 1 1 -github.com/ethereum/go-ethereum/p2p/server.go:150.58,155.16 4 1 -github.com/ethereum/go-ethereum/p2p/server.go:168.2,168.8 1 1 -github.com/ethereum/go-ethereum/p2p/server.go:155.16,157.37 2 1 -github.com/ethereum/go-ethereum/p2p/server.go:161.3,161.25 1 1 -github.com/ethereum/go-ethereum/p2p/server.go:157.37,160.4 2 2 -github.com/ethereum/go-ethereum/p2p/server.go:161.25,163.4 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:163.5,166.4 2 1 -github.com/ethereum/go-ethereum/p2p/server.go:171.45,174.34 3 0 -github.com/ethereum/go-ethereum/p2p/server.go:179.2,179.8 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:174.34,175.18 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:175.18,177.4 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:182.37,186.2 3 1 -github.com/ethereum/go-ethereum/p2p/server.go:190.48,193.9 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:194.2,195.34 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:196.2,196.10 0 0 -github.com/ethereum/go-ethereum/p2p/server.go:200.61,202.2 1 7 -github.com/ethereum/go-ethereum/p2p/server.go:204.43,206.2 1 7 -github.com/ethereum/go-ethereum/p2p/server.go:208.41,210.2 1 7 -github.com/ethereum/go-ethereum/p2p/server.go:212.58,215.34 3 1 -github.com/ethereum/go-ethereum/p2p/server.go:215.34,216.18 1 2 -github.com/ethereum/go-ethereum/p2p/server.go:216.18,218.4 1 2 -github.com/ethereum/go-ethereum/p2p/server.go:223.51,225.12 2 4 -github.com/ethereum/go-ethereum/p2p/server.go:237.2,237.10 1 4 -github.com/ethereum/go-ethereum/p2p/server.go:249.2,249.33 1 4 -github.com/ethereum/go-ethereum/p2p/server.go:225.12,227.17 2 3 -github.com/ethereum/go-ethereum/p2p/server.go:227.17,231.4 3 0 -github.com/ethereum/go-ethereum/p2p/server.go:231.5,235.4 3 3 -github.com/ethereum/go-ethereum/p2p/server.go:237.10,239.17 2 3 -github.com/ethereum/go-ethereum/p2p/server.go:239.17,243.4 3 0 -github.com/ethereum/go-ethereum/p2p/server.go:243.5,247.4 3 3 -github.com/ethereum/go-ethereum/p2p/server.go:252.28,255.18 2 4 -github.com/ethereum/go-ethereum/p2p/server.go:263.2,263.20 1 4 -github.com/ethereum/go-ethereum/p2p/server.go:271.2,277.34 6 4 -github.com/ethereum/go-ethereum/p2p/server.go:282.2,283.32 2 4 -github.com/ethereum/go-ethereum/p2p/server.go:291.2,295.6 3 4 -github.com/ethereum/go-ethereum/p2p/server.go:305.2,305.33 1 4 -github.com/ethereum/go-ethereum/p2p/server.go:255.18,261.3 5 3 -github.com/ethereum/go-ethereum/p2p/server.go:263.20,269.3 5 3 -github.com/ethereum/go-ethereum/p2p/server.go:277.34,278.18 1 8 -github.com/ethereum/go-ethereum/p2p/server.go:278.18,280.4 1 6 -github.com/ethereum/go-ethereum/p2p/server.go:283.32,288.3 1 6 -github.com/ethereum/go-ethereum/p2p/server.go:295.6,296.10 1 8 -github.com/ethereum/go-ethereum/p2p/server.go:297.3,300.26 3 8 -github.com/ethereum/go-ethereum/p2p/server.go:300.26,301.14 1 4 -github.com/ethereum/go-ethereum/p2p/server.go:309.63,310.6 1 3 -github.com/ethereum/go-ethereum/p2p/server.go:310.6,311.10 1 2591 -github.com/ethereum/go-ethereum/p2p/server.go:312.3,313.46 1 2588 -github.com/ethereum/go-ethereum/p2p/server.go:314.3,318.10 4 3 -github.com/ethereum/go-ethereum/p2p/server.go:325.56,330.6 4 3 -github.com/ethereum/go-ethereum/p2p/server.go:330.6,331.10 1 10 -github.com/ethereum/go-ethereum/p2p/server.go:332.3,338.15 3 4 -github.com/ethereum/go-ethereum/p2p/server.go:339.3,346.21 3 3 -github.com/ethereum/go-ethereum/p2p/server.go:347.3,348.31 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:349.3,350.41 1 3 -github.com/ethereum/go-ethereum/p2p/server.go:353.4,355.10 3 3 -github.com/ethereum/go-ethereum/p2p/server.go:350.41,352.5 1 1 -github.com/ethereum/go-ethereum/p2p/server.go:361.61,366.11 4 6 -github.com/ethereum/go-ethereum/p2p/server.go:369.2,369.8 1 6 -github.com/ethereum/go-ethereum/p2p/server.go:366.11,368.3 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:373.73,376.16 3 2588 -github.com/ethereum/go-ethereum/p2p/server.go:383.2,383.16 1 2588 -github.com/ethereum/go-ethereum/p2p/server.go:376.16,379.17 3 3 -github.com/ethereum/go-ethereum/p2p/server.go:379.17,381.4 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:383.16,386.3 2 2585 -github.com/ethereum/go-ethereum/p2p/server.go:386.4,389.3 2 3 -github.com/ethereum/go-ethereum/p2p/server.go:393.84,396.16 3 3 -github.com/ethereum/go-ethereum/p2p/server.go:399.2,399.16 1 3 -github.com/ethereum/go-ethereum/p2p/server.go:396.16,398.3 1 3 -github.com/ethereum/go-ethereum/p2p/server.go:399.16,402.3 2 0 -github.com/ethereum/go-ethereum/p2p/server.go:402.4,404.3 1 3 -github.com/ethereum/go-ethereum/p2p/server.go:408.86,411.17 3 6 -github.com/ethereum/go-ethereum/p2p/server.go:411.17,415.3 3 0 -github.com/ethereum/go-ethereum/p2p/server.go:415.4,424.3 7 6 -github.com/ethereum/go-ethereum/p2p/server.go:428.59,435.17 6 6 -github.com/ethereum/go-ethereum/p2p/server.go:441.2,459.24 13 6 -github.com/ethereum/go-ethereum/p2p/server.go:435.17,439.3 3 0 -github.com/ethereum/go-ethereum/p2p/server.go:463.38,467.2 3 8 -github.com/ethereum/go-ethereum/p2p/server.go:469.74,471.35 1 1 -github.com/ethereum/go-ethereum/p2p/server.go:475.2,477.34 3 1 -github.com/ethereum/go-ethereum/p2p/server.go:482.2,483.12 2 1 -github.com/ethereum/go-ethereum/p2p/server.go:471.35,473.3 1 0 -github.com/ethereum/go-ethereum/p2p/server.go:477.34,478.82 1 2 -github.com/ethereum/go-ethereum/p2p/server.go:478.82,480.4 1 0 -github.com/ethereum/go-ethereum/p2p/connection.go:32.32,35.2 2 18 -github.com/ethereum/go-ethereum/p2p/connection.go:37.33,40.2 2 18 -github.com/ethereum/go-ethereum/p2p/connection.go:42.35,46.2 3 18 -github.com/ethereum/go-ethereum/p2p/connection.go:48.36,52.2 3 18 -github.com/ethereum/go-ethereum/p2p/connection.go:54.72,64.2 1 18 -github.com/ethereum/go-ethereum/p2p/connection.go:66.46,68.2 1 18 -github.com/ethereum/go-ethereum/p2p/connection.go:70.47,72.2 1 19 -github.com/ethereum/go-ethereum/p2p/connection.go:74.51,76.2 1 8 -github.com/ethereum/go-ethereum/p2p/connection.go:78.37,86.6 7 18 -github.com/ethereum/go-ethereum/p2p/connection.go:86.6,89.23 2 304 -github.com/ethereum/go-ethereum/p2p/connection.go:96.3,96.10 1 304 -github.com/ethereum/go-ethereum/p2p/connection.go:89.23,92.4 2 12 -github.com/ethereum/go-ethereum/p2p/connection.go:92.5,94.4 1 292 -github.com/ethereum/go-ethereum/p2p/connection.go:97.3,98.32 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:99.3,100.18 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:112.4,112.46 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:113.3,115.42 2 7 -github.com/ethereum/go-ethereum/p2p/connection.go:120.4,120.46 1 7 -github.com/ethereum/go-ethereum/p2p/connection.go:121.3,122.25 1 7 -github.com/ethereum/go-ethereum/p2p/connection.go:123.3,126.10 3 18 -github.com/ethereum/go-ethereum/p2p/connection.go:100.18,101.43 1 133 -github.com/ethereum/go-ethereum/p2p/connection.go:101.43,103.6 1 129 -github.com/ethereum/go-ethereum/p2p/connection.go:103.7,103.25 1 4 -github.com/ethereum/go-ethereum/p2p/connection.go:103.25,105.6 1 0 -github.com/ethereum/go-ethereum/p2p/connection.go:105.7,107.6 1 4 -github.com/ethereum/go-ethereum/p2p/connection.go:108.6,111.5 2 3 -github.com/ethereum/go-ethereum/p2p/connection.go:115.42,117.5 1 0 -github.com/ethereum/go-ethereum/p2p/connection.go:117.6,119.5 1 7 -github.com/ethereum/go-ethereum/p2p/connection.go:132.38,136.6 4 18 -github.com/ethereum/go-ethereum/p2p/connection.go:136.6,137.35 1 56 -github.com/ethereum/go-ethereum/p2p/connection.go:141.3,141.10 1 56 -github.com/ethereum/go-ethereum/p2p/connection.go:137.35,140.4 2 19 -github.com/ethereum/go-ethereum/p2p/connection.go:142.3,143.38 1 19 -github.com/ethereum/go-ethereum/p2p/connection.go:144.3,145.18 1 19 -github.com/ethereum/go-ethereum/p2p/connection.go:151.3,154.10 3 18 -github.com/ethereum/go-ethereum/p2p/connection.go:145.18,148.5 2 19 -github.com/ethereum/go-ethereum/p2p/connection.go:148.6,150.5 1 0 -github.com/ethereum/go-ethereum/p2p/connection.go:159.43,166.2 4 19 -github.com/ethereum/go-ethereum/p2p/connection.go:168.39,169.34 1 19 -github.com/ethereum/go-ethereum/p2p/connection.go:169.34,173.3 3 0 -github.com/ethereum/go-ethereum/p2p/connection.go:176.69,180.15 4 19 -github.com/ethereum/go-ethereum/p2p/connection.go:184.2,184.13 1 19 -github.com/ethereum/go-ethereum/p2p/connection.go:180.15,183.3 2 0 -github.com/ethereum/go-ethereum/p2p/connection.go:187.74,199.6 8 136 -github.com/ethereum/go-ethereum/p2p/connection.go:248.2,248.13 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:199.6,203.28 1 152 -github.com/ethereum/go-ethereum/p2p/connection.go:218.3,218.12 1 17 -github.com/ethereum/go-ethereum/p2p/connection.go:203.28,205.11 2 145 -github.com/ethereum/go-ethereum/p2p/connection.go:216.4,216.39 1 10 -github.com/ethereum/go-ethereum/p2p/connection.go:205.11,207.38 2 135 -github.com/ethereum/go-ethereum/p2p/connection.go:214.5,214.14 1 135 -github.com/ethereum/go-ethereum/p2p/connection.go:207.38,208.15 1 2 -github.com/ethereum/go-ethereum/p2p/connection.go:208.15,210.7 1 1 -github.com/ethereum/go-ethereum/p2p/connection.go:210.8,212.7 1 1 -github.com/ethereum/go-ethereum/p2p/connection.go:218.12,220.50 1 10 -github.com/ethereum/go-ethereum/p2p/connection.go:224.4,227.18 3 9 -github.com/ethereum/go-ethereum/p2p/connection.go:220.50,222.10 2 1 -github.com/ethereum/go-ethereum/p2p/connection.go:227.18,229.5 1 8 -github.com/ethereum/go-ethereum/p2p/connection.go:229.6,232.5 2 1 -github.com/ethereum/go-ethereum/p2p/connection.go:233.5,239.4 4 7 -github.com/ethereum/go-ethereum/p2p/connection.go:251.82,253.6 2 136 -github.com/ethereum/go-ethereum/p2p/connection.go:274.2,274.13 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:253.6,259.41 4 136 -github.com/ethereum/go-ethereum/p2p/connection.go:259.41,260.21 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:263.4,263.42 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:260.21,262.5 1 10 -github.com/ethereum/go-ethereum/p2p/connection.go:263.42,264.10 1 136 -github.com/ethereum/go-ethereum/p2p/connection.go:266.5,272.4 4 0 -github.com/ethereum/go-ethereum/p2p/message.go:16.33,18.2 1 54 -github.com/ethereum/go-ethereum/p2p/message.go:20.40,22.2 1 5 -github.com/ethereum/go-ethereum/p2p/message.go:24.72,43.2 1 37 -github.com/ethereum/go-ethereum/p2p/message.go:45.60,59.2 5 5 -github.com/ethereum/go-ethereum/p2p/message.go:61.41,63.2 1 5 -github.com/ethereum/go-ethereum/p2p/message.go:67.54,68.28 1 28 -github.com/ethereum/go-ethereum/p2p/message.go:74.2,74.8 1 28 -github.com/ethereum/go-ethereum/p2p/message.go:68.28,71.3 2 27 -github.com/ethereum/go-ethereum/p2p/message.go:71.4,73.3 1 1 -github.com/ethereum/go-ethereum/p2p/messenger.go:28.104,41.2 2 10 -github.com/ethereum/go-ethereum/p2p/messenger.go:43.32,49.2 5 10 -github.com/ethereum/go-ethereum/p2p/messenger.go:51.31,56.42 4 10 -github.com/ethereum/go-ethereum/p2p/messenger.go:59.2,62.19 4 10 -github.com/ethereum/go-ethereum/p2p/messenger.go:56.42,58.3 1 14 -github.com/ethereum/go-ethereum/p2p/messenger.go:65.36,67.6 2 10 -github.com/ethereum/go-ethereum/p2p/messenger.go:67.6,68.10 1 14 -github.com/ethereum/go-ethereum/p2p/messenger.go:69.3,71.10 1 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:76.3,78.10 2 10 -github.com/ethereum/go-ethereum/p2p/messenger.go:71.10,73.5 1 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:73.6,75.5 1 0 -github.com/ethereum/go-ethereum/p2p/messenger.go:88.47,97.16 3 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:102.2,103.16 2 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:108.2,114.6 5 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:97.16,100.3 2 0 -github.com/ethereum/go-ethereum/p2p/messenger.go:103.16,106.3 2 0 -github.com/ethereum/go-ethereum/p2p/messenger.go:114.6,115.10 1 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:116.3,118.10 1 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:123.3,124.10 1 0 -github.com/ethereum/go-ethereum/p2p/messenger.go:118.10,120.5 1 0 -github.com/ethereum/go-ethereum/p2p/messenger.go:120.6,122.5 1 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:134.82,138.42 4 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:144.2,144.67 1 0 -github.com/ethereum/go-ethereum/p2p/messenger.go:138.42,139.20 1 5 -github.com/ethereum/go-ethereum/p2p/messenger.go:142.3,142.16 1 1 -github.com/ethereum/go-ethereum/p2p/messenger.go:139.20,141.4 1 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:147.128,152.6 4 8 -github.com/ethereum/go-ethereum/p2p/messenger.go:152.6,153.10 1 19 -github.com/ethereum/go-ethereum/p2p/messenger.go:154.3,155.10 1 10 -github.com/ethereum/go-ethereum/p2p/messenger.go:162.3,163.14 1 9 -github.com/ethereum/go-ethereum/p2p/messenger.go:155.10,158.5 2 3 -github.com/ethereum/go-ethereum/p2p/messenger.go:158.6,161.5 1 7 -github.com/ethereum/go-ethereum/p2p/messenger.go:163.14,167.5 3 1 -github.com/ethereum/go-ethereum/p2p/messenger.go:167.6,172.5 4 8 -github.com/ethereum/go-ethereum/p2p/messenger.go:177.57,182.33 5 3 -github.com/ethereum/go-ethereum/p2p/messenger.go:182.33,184.9 2 5 -github.com/ethereum/go-ethereum/p2p/messenger.go:184.9,194.4 8 4 -github.com/ethereum/go-ethereum/p2p/messenger.go:194.5,197.4 1 1 -github.com/ethereum/go-ethereum/p2p/messenger.go:201.63,206.23 5 26 -github.com/ethereum/go-ethereum/p2p/messenger.go:214.2,216.28 2 24 -github.com/ethereum/go-ethereum/p2p/messenger.go:219.2,219.12 1 24 -github.com/ethereum/go-ethereum/p2p/messenger.go:206.23,209.10 3 5 -github.com/ethereum/go-ethereum/p2p/messenger.go:212.3,212.29 1 3 -github.com/ethereum/go-ethereum/p2p/messenger.go:209.10,211.4 1 2 -github.com/ethereum/go-ethereum/p2p/messenger.go:216.28,218.3 1 18 -github.com/ethereum/go-ethereum/p2p/natupnp.go:23.54,25.16 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:28.2,29.16 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:32.2,36.16 4 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:40.2,49.32 5 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:92.2,93.8 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:25.16,27.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:29.16,31.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:36.16,38.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:49.32,51.17 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:54.3,56.17 3 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:61.3,62.43 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:67.3,70.19 4 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:73.3,75.19 3 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:78.3,81.17 4 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:84.3,86.17 3 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:89.3,90.9 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:51.17,53.4 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:56.17,57.12 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:62.43,63.12 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:70.19,71.12 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:75.19,76.12 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:81.17,83.4 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:86.17,88.4 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:148.59,150.31 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:155.2,155.12 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:150.31,151.37 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:151.37,153.4 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:158.62,160.31 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:165.2,165.12 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:160.31,161.39 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:161.39,163.4 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:168.40,170.16 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:173.2,174.30 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:177.2,177.27 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:170.16,172.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:174.30,176.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:180.60,182.16 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:185.2,186.25 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:190.2,193.16 3 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:196.2,197.75 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:201.2,202.14 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:206.2,207.14 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:211.2,212.14 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:216.2,217.8 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:182.16,184.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:186.25,189.3 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:193.16,195.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:197.75,200.3 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:202.14,205.3 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:207.14,210.3 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:212.14,215.3 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:220.48,226.2 5 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:228.79,234.16 3 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:237.2,246.16 8 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:250.2,250.19 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:254.2,254.25 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:260.2,260.8 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:234.16,236.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:246.16,248.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:250.19,252.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:254.25,259.3 3 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:267.64,274.16 4 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:280.2,281.8 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:274.16,276.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:284.65,286.16 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:289.2,290.8 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:286.16,288.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:293.152,307.16 7 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:313.2,315.8 3 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:307.16,309.3 1 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:318.98,327.16 4 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:333.2,334.8 2 0 -github.com/ethereum/go-ethereum/p2p/natupnp.go:327.16,329.3 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:57.55,62.2 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:64.63,70.2 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:72.71,73.26 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:81.2,81.50 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:73.26,75.23 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:79.3,79.21 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:75.23,78.4 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:84.45,85.22 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:99.2,99.8 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:86.2,86.12 0 0 -github.com/ethereum/go-ethereum/p2p/network.go:87.2,89.18 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:94.2,95.42 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:96.2,97.57 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:89.18,91.4 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:91.5,93.4 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:102.32,106.2 3 0 -github.com/ethereum/go-ethereum/p2p/network.go:108.63,110.16 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:115.2,115.8 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:110.16,112.3 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:112.4,114.3 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:118.46,122.6 3 0 -github.com/ethereum/go-ethereum/p2p/network.go:141.2,142.28 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:122.6,123.10 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:124.3,127.53 3 0 -github.com/ethereum/go-ethereum/p2p/network.go:130.3,131.30 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:135.3,137.13 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:127.53,129.5 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:131.30,132.54 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:132.54,133.6 0 0 -github.com/ethereum/go-ethereum/p2p/network.go:142.28,143.73 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:143.73,145.4 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:145.5,147.4 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:151.74,153.16 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:159.2,159.17 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:153.16,158.3 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:162.69,164.16 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:169.2,169.17 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:164.16,168.3 3 0 -github.com/ethereum/go-ethereum/p2p/network.go:172.65,173.39 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:177.2,179.16 3 0 -github.com/ethereum/go-ethereum/p2p/network.go:183.2,183.19 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:188.2,188.18 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:195.2,195.8 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:173.39,175.3 1 0 -github.com/ethereum/go-ethereum/p2p/network.go:179.16,182.3 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:183.19,187.3 3 0 -github.com/ethereum/go-ethereum/p2p/network.go:188.18,192.3 2 0 -github.com/ethereum/go-ethereum/p2p/network.go:192.4,194.3 1 0 -github.com/ethereum/go-ethereum/p2p/peer.go:24.42,26.2 1 9 -github.com/ethereum/go-ethereum/p2p/peer.go:28.51,30.2 1 0 -github.com/ethereum/go-ethereum/p2p/peer.go:32.36,34.2 1 9 -github.com/ethereum/go-ethereum/p2p/peer.go:36.83,52.2 8 7 -github.com/ethereum/go-ethereum/p2p/peer.go:54.35,56.18 2 20 -github.com/ethereum/go-ethereum/p2p/peer.go:61.2,61.89 1 18 -github.com/ethereum/go-ethereum/p2p/peer.go:56.18,58.3 1 9 -github.com/ethereum/go-ethereum/p2p/peer.go:58.4,60.3 1 9 -github.com/ethereum/go-ethereum/p2p/peer.go:64.58,66.2 1 24 -github.com/ethereum/go-ethereum/p2p/peer.go:68.27,71.2 2 7 -github.com/ethereum/go-ethereum/p2p/peer.go:73.26,79.2 2 7 -github.com/ethereum/go-ethereum/p2p/peer.go:81.39,83.2 1 2 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:25.153,33.2 1 8 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:35.39,37.2 1 8 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:39.38,43.2 3 8 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:45.40,46.6 1 8 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:46.6,47.10 1 19 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:48.3,49.10 1 11 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:55.3,57.10 2 8 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:49.10,52.5 2 11 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:52.6,54.5 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:62.60,64.24 2 11 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:83.2,83.40 1 11 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:86.2,86.31 1 11 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:65.2,66.35 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:67.2,68.31 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:69.2,70.27 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:71.2,72.29 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:73.2,74.27 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:75.2,76.28 1 11 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:77.2,78.32 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:79.2,80.47 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:83.40,85.3 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:86.31,91.3 1 11 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:94.69,95.24 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:96.2,97.11 1 0 -github.com/ethereum/go-ethereum/p2p/peer_error_handler.go:98.2,99.11 1 0 -github.com/ethereum/go-ethereum/pow/ar/ops.go:11.13,21.2 9 1 -github.com/ethereum/go-ethereum/pow/ar/ops.go:23.34,25.2 1 899964 -github.com/ethereum/go-ethereum/pow/ar/ops.go:26.34,28.2 1 6 -github.com/ethereum/go-ethereum/pow/ar/ops.go:29.34,31.2 1 12 -github.com/ethereum/go-ethereum/pow/ar/ops.go:32.34,34.2 1 12 -github.com/ethereum/go-ethereum/pow/ar/ops.go:35.34,37.2 1 0 -github.com/ethereum/go-ethereum/pow/ar/ops.go:38.33,40.2 1 0 -github.com/ethereum/go-ethereum/pow/ar/ops.go:41.35,46.2 3 6 -github.com/ethereum/go-ethereum/pow/ar/ops.go:47.37,51.2 2 6 -github.com/ethereum/go-ethereum/pow/ar/ops.go:52.34,54.2 1 0 -github.com/ethereum/go-ethereum/pow/ar/pow.go:19.33,21.2 1 1 -github.com/ethereum/go-ethereum/pow/ar/pow.go:23.56,26.32 2 1 -github.com/ethereum/go-ethereum/pow/ar/pow.go:26.32,31.23 4 150000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:37.3,38.49 2 150000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:31.23,33.4 1 149979 -github.com/ethereum/go-ethereum/pow/ar/pow.go:33.5,35.4 1 21 -github.com/ethereum/go-ethereum/pow/ar/pow.go:42.69,44.32 2 6 -github.com/ethereum/go-ethereum/pow/ar/pow.go:48.2,48.30 1 6 -github.com/ethereum/go-ethereum/pow/ar/pow.go:55.2,56.34 2 6 -github.com/ethereum/go-ethereum/pow/ar/pow.go:74.2,74.18 1 6 -github.com/ethereum/go-ethereum/pow/ar/pow.go:44.32,46.3 1 60000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:48.30,53.3 3 900000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:56.34,58.10 2 9000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:68.3,69.65 2 9000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:58.10,59.29 1 9000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:59.29,61.5 1 900000 -github.com/ethereum/go-ethereum/pow/ar/pow.go:62.5,63.29 1 0 -github.com/ethereum/go-ethereum/pow/ar/pow.go:63.29,65.5 1 0 -github.com/ethereum/go-ethereum/pow/ar/pow.go:69.65,71.4 1 0 -github.com/ethereum/go-ethereum/pow/ar/pow.go:77.53,94.2 12 0 -github.com/ethereum/go-ethereum/pow/ar/pow.go:96.45,104.6 6 1 -github.com/ethereum/go-ethereum/pow/ar/pow.go:104.6,105.54 1 6 -github.com/ethereum/go-ethereum/pow/ar/pow.go:110.3,116.51 5 6 -github.com/ethereum/go-ethereum/pow/ar/pow.go:105.54,108.4 2 1 -github.com/ethereum/go-ethereum/pow/ar/pow.go:116.51,118.4 1 1 -github.com/ethereum/go-ethereum/pow/ar/pow.go:118.5,120.4 1 5 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:18.37,20.2 1 0 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:22.35,23.31 1 510007 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:36.2,36.12 1 0 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:23.31,25.3 1 509988 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:25.4,25.43 1 19 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:25.43,27.3 1 13 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:27.4,27.40 1 6 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:27.40,29.23 2 6 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:33.3,33.54 1 6 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:29.23,31.4 1 60000 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:48.26,50.2 1 7 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:52.43,57.46 3 510021 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:61.2,61.10 1 510021 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:57.46,59.3 1 509988 -github.com/ethereum/go-ethereum/pow/ar/rnd.go:64.42,66.2 1 450021 -github.com/ethereum/go-ethereum/ptrie/hashnode.go:7.36,9.2 1 0 -github.com/ethereum/go-ethereum/ptrie/hashnode.go:11.45,13.2 1 0 -github.com/ethereum/go-ethereum/ptrie/hashnode.go:15.42,17.2 1 2 -github.com/ethereum/go-ethereum/ptrie/hashnode.go:20.36,20.50 1 0 -github.com/ethereum/go-ethereum/ptrie/hashnode.go:21.36,21.51 1 0 -github.com/ethereum/go-ethereum/ptrie/hashnode.go:22.36,22.51 1 0 -github.com/ethereum/go-ethereum/ptrie/node.go:17.51,17.78 1 0 -github.com/ethereum/go-ethereum/ptrie/node.go:18.51,18.78 1 0 -github.com/ethereum/go-ethereum/ptrie/node.go:19.51,19.78 1 2 -github.com/ethereum/go-ethereum/ptrie/node.go:20.51,20.91 1 81 -github.com/ethereum/go-ethereum/ptrie/node.go:21.51,21.90 1 18 -github.com/ethereum/go-ethereum/ptrie/node.go:24.50,26.34 2 12 -github.com/ethereum/go-ethereum/ptrie/node.go:34.2,34.42 1 12 -github.com/ethereum/go-ethereum/ptrie/node.go:26.34,27.18 1 204 -github.com/ethereum/go-ethereum/ptrie/node.go:27.18,29.4 1 95 -github.com/ethereum/go-ethereum/ptrie/node.go:29.5,31.4 1 109 -github.com/ethereum/go-ethereum/ptrie/node.go:38.51,40.2 1 49 -github.com/ethereum/go-ethereum/ptrie/shortnode.go:11.63,13.2 1 147 -github.com/ethereum/go-ethereum/ptrie/shortnode.go:14.37,18.2 2 85 -github.com/ethereum/go-ethereum/ptrie/shortnode.go:19.37,19.52 1 0 -github.com/ethereum/go-ethereum/ptrie/shortnode.go:20.37,20.52 1 0 -github.com/ethereum/go-ethereum/ptrie/shortnode.go:22.46,24.2 1 97 -github.com/ethereum/go-ethereum/ptrie/shortnode.go:25.43,27.2 1 76 -github.com/ethereum/go-ethereum/ptrie/shortnode.go:29.37,31.2 1 85 -github.com/ethereum/go-ethereum/ptrie/trie.go:19.42,21.2 1 7 -github.com/ethereum/go-ethereum/ptrie/trie.go:22.48,24.2 1 76 -github.com/ethereum/go-ethereum/ptrie/trie.go:33.23,35.2 1 6 -github.com/ethereum/go-ethereum/ptrie/trie.go:37.46,46.2 6 2 -github.com/ethereum/go-ethereum/ptrie/trie.go:49.33,49.55 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:50.33,52.22 2 7 -github.com/ethereum/go-ethereum/ptrie/trie.go:63.2,65.13 2 7 -github.com/ethereum/go-ethereum/ptrie/trie.go:52.22,54.33 2 7 -github.com/ethereum/go-ethereum/ptrie/trie.go:54.33,56.4 1 7 -github.com/ethereum/go-ethereum/ptrie/trie.go:56.5,58.4 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:59.4,61.3 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:68.56,68.106 1 74 -github.com/ethereum/go-ethereum/ptrie/trie.go:69.50,75.21 4 74 -github.com/ethereum/go-ethereum/ptrie/trie.go:81.2,81.18 1 74 -github.com/ethereum/go-ethereum/ptrie/trie.go:75.21,77.3 1 70 -github.com/ethereum/go-ethereum/ptrie/trie.go:77.4,79.3 1 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:84.48,84.80 1 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:85.42,92.14 5 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:96.2,96.12 1 1 -github.com/ethereum/go-ethereum/ptrie/trie.go:92.14,94.3 1 3 -github.com/ethereum/go-ethereum/ptrie/trie.go:99.49,99.84 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:100.43,108.2 5 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:110.66,111.19 1 298 -github.com/ethereum/go-ethereum/ptrie/trie.go:115.2,115.17 1 285 -github.com/ethereum/go-ethereum/ptrie/trie.go:119.2,119.29 1 206 -github.com/ethereum/go-ethereum/ptrie/trie.go:111.19,113.3 1 13 -github.com/ethereum/go-ethereum/ptrie/trie.go:115.17,117.3 1 79 -github.com/ethereum/go-ethereum/ptrie/trie.go:120.2,123.26 3 76 -github.com/ethereum/go-ethereum/ptrie/trie.go:127.3,129.28 3 76 -github.com/ethereum/go-ethereum/ptrie/trie.go:139.3,139.23 1 76 -github.com/ethereum/go-ethereum/ptrie/trie.go:143.3,143.50 1 63 -github.com/ethereum/go-ethereum/ptrie/trie.go:145.2,149.13 3 130 -github.com/ethereum/go-ethereum/ptrie/trie.go:151.2,152.24 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:123.26,125.4 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:129.28,131.4 1 54 -github.com/ethereum/go-ethereum/ptrie/trie.go:131.5,138.4 6 22 -github.com/ethereum/go-ethereum/ptrie/trie.go:139.23,141.4 1 13 -github.com/ethereum/go-ethereum/ptrie/trie.go:156.51,157.19 1 15 -github.com/ethereum/go-ethereum/ptrie/trie.go:161.2,161.17 1 12 -github.com/ethereum/go-ethereum/ptrie/trie.go:165.2,165.29 1 12 -github.com/ethereum/go-ethereum/ptrie/trie.go:157.19,159.3 1 3 -github.com/ethereum/go-ethereum/ptrie/trie.go:161.17,163.3 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:166.2,170.57 3 5 -github.com/ethereum/go-ethereum/ptrie/trie.go:174.3,174.13 1 1 -github.com/ethereum/go-ethereum/ptrie/trie.go:175.2,176.45 1 7 -github.com/ethereum/go-ethereum/ptrie/trie.go:177.2,178.24 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:170.57,172.4 1 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:182.54,183.19 1 10 -github.com/ethereum/go-ethereum/ptrie/trie.go:187.2,187.29 1 10 -github.com/ethereum/go-ethereum/ptrie/trie.go:183.19,185.3 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:188.2,191.26 3 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:210.2,215.27 4 6 -github.com/ethereum/go-ethereum/ptrie/trie.go:225.3,226.16 2 6 -github.com/ethereum/go-ethereum/ptrie/trie.go:242.3,242.15 1 6 -github.com/ethereum/go-ethereum/ptrie/trie.go:244.2,245.24 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:191.26,193.4 1 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:193.5,193.42 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:193.42,197.33 3 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:205.4,205.12 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:198.4,200.48 2 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:201.4,202.44 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:206.5,208.4 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:215.27,216.29 1 102 -github.com/ethereum/go-ethereum/ptrie/trie.go:216.29,217.18 1 10 -github.com/ethereum/go-ethereum/ptrie/trie.go:217.18,219.6 1 6 -github.com/ethereum/go-ethereum/ptrie/trie.go:219.7,221.6 1 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:226.16,228.4 1 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:228.5,228.22 1 6 -github.com/ethereum/go-ethereum/ptrie/trie.go:228.22,230.33 2 2 -github.com/ethereum/go-ethereum/ptrie/trie.go:231.4,234.49 2 0 -github.com/ethereum/go-ethereum/ptrie/trie.go:235.4,236.68 1 2 -github.com/ethereum/go-ethereum/ptrie/trie.go:238.5,240.4 1 4 -github.com/ethereum/go-ethereum/ptrie/trie.go:250.53,252.11 2 95 -github.com/ethereum/go-ethereum/ptrie/trie.go:253.2,254.105 1 3 -github.com/ethereum/go-ethereum/ptrie/trie.go:255.2,257.26 2 5 -github.com/ethereum/go-ethereum/ptrie/trie.go:260.3,260.15 1 5 -github.com/ethereum/go-ethereum/ptrie/trie.go:261.2,262.34 1 25 -github.com/ethereum/go-ethereum/ptrie/trie.go:263.2,264.41 1 62 -github.com/ethereum/go-ethereum/ptrie/trie.go:257.26,259.4 1 85 -github.com/ethereum/go-ethereum/ptrie/trie.go:268.41,269.29 1 200 -github.com/ethereum/go-ethereum/ptrie/trie.go:270.2,272.28 2 5 -github.com/ethereum/go-ethereum/ptrie/trie.go:273.2,274.14 1 195 -github.com/ethereum/go-ethereum/ptrie/trie.go:278.48,280.21 2 103 -github.com/ethereum/go-ethereum/ptrie/trie.go:287.2,287.23 1 27 -github.com/ethereum/go-ethereum/ptrie/trie.go:280.21,285.3 3 76 -github.com/ethereum/go-ethereum/ptrie/valuenode.go:8.46,8.61 1 0 -github.com/ethereum/go-ethereum/ptrie/valuenode.go:9.46,9.66 1 3 -github.com/ethereum/go-ethereum/ptrie/valuenode.go:10.46,10.61 1 0 -github.com/ethereum/go-ethereum/ptrie/valuenode.go:11.46,11.61 1 0 -github.com/ethereum/go-ethereum/ptrie/valuenode.go:12.46,12.66 1 0 -github.com/ethereum/go-ethereum/ptrie/valuenode.go:13.46,13.66 1 135 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:8.37,10.2 1 27 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:12.36,12.51 1 0 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:13.36,16.2 2 0 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:18.35,18.50 1 136 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:21.42,22.34 1 0 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:28.2,28.8 1 0 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:22.34,23.18 1 0 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:23.18,25.4 1 0 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:31.42,33.2 1 27 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:35.45,37.34 2 33 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:45.2,45.10 1 33 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:37.34,38.18 1 561 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:38.18,40.4 1 136 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:40.5,42.4 1 425 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:48.47,50.2 1 265 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:52.40,53.31 1 249 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:58.2,58.12 1 134 -github.com/ethereum/go-ethereum/ptrie/fullnode.go:53.31,57.3 2 115 -github.com/ethereum/go-ethereum/rlp/decode.go:69.50,71.2 1 73 -github.com/ethereum/go-ethereum/rlp/decode.go:73.47,75.9 2 2 -github.com/ethereum/go-ethereum/rlp/decode.go:76.2,77.19 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:78.2,79.20 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:80.2,81.23 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:85.52,87.16 2 36 -github.com/ethereum/go-ethereum/rlp/decode.go:90.2,91.12 2 31 -github.com/ethereum/go-ethereum/rlp/decode.go:87.16,89.3 1 5 -github.com/ethereum/go-ethereum/rlp/decode.go:94.53,96.16 2 24 -github.com/ethereum/go-ethereum/rlp/decode.go:99.2,100.12 2 16 -github.com/ethereum/go-ethereum/rlp/decode.go:96.16,98.3 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:103.55,105.16 2 7 -github.com/ethereum/go-ethereum/rlp/decode.go:108.2,109.12 2 5 -github.com/ethereum/go-ethereum/rlp/decode.go:105.16,107.3 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:112.60,114.2 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:116.55,118.16 2 4 -github.com/ethereum/go-ethereum/rlp/decode.go:121.2,122.14 2 3 -github.com/ethereum/go-ethereum/rlp/decode.go:126.2,127.12 2 3 -github.com/ethereum/go-ethereum/rlp/decode.go:118.16,120.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:122.14,125.3 2 2 -github.com/ethereum/go-ethereum/rlp/decode.go:132.57,134.89 2 8 -github.com/ethereum/go-ethereum/rlp/decode.go:141.2,142.16 2 5 -github.com/ethereum/go-ethereum/rlp/decode.go:145.2,146.33 2 5 -github.com/ethereum/go-ethereum/rlp/decode.go:149.2,149.50 1 5 -github.com/ethereum/go-ethereum/rlp/decode.go:152.2,152.17 1 5 -github.com/ethereum/go-ethereum/rlp/decode.go:134.89,135.34 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:135.34,137.4 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:137.5,139.4 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:142.16,144.3 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:146.33,148.3 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:149.50,151.3 1 9 -github.com/ethereum/go-ethereum/rlp/decode.go:161.83,163.16 2 20 -github.com/ethereum/go-ethereum/rlp/decode.go:166.2,166.15 1 20 -github.com/ethereum/go-ethereum/rlp/decode.go:175.2,176.6 2 14 -github.com/ethereum/go-ethereum/rlp/decode.go:203.2,203.19 1 11 -github.com/ethereum/go-ethereum/rlp/decode.go:211.2,211.20 1 11 -github.com/ethereum/go-ethereum/rlp/decode.go:163.16,165.3 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:166.15,167.34 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:172.3,172.21 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:167.34,169.4 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:169.5,171.4 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:176.6,177.18 1 49 -github.com/ethereum/go-ethereum/rlp/decode.go:180.3,180.34 1 48 -github.com/ethereum/go-ethereum/rlp/decode.go:196.3,196.50 1 48 -github.com/ethereum/go-ethereum/rlp/decode.go:201.3,201.6 1 35 -github.com/ethereum/go-ethereum/rlp/decode.go:177.18,179.4 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:180.34,182.22 1 23 -github.com/ethereum/go-ethereum/rlp/decode.go:191.4,191.22 1 23 -github.com/ethereum/go-ethereum/rlp/decode.go:182.22,184.19 2 9 -github.com/ethereum/go-ethereum/rlp/decode.go:187.5,189.18 3 9 -github.com/ethereum/go-ethereum/rlp/decode.go:184.19,186.6 1 7 -github.com/ethereum/go-ethereum/rlp/decode.go:191.22,193.5 1 23 -github.com/ethereum/go-ethereum/rlp/decode.go:196.50,197.9 1 11 -github.com/ethereum/go-ethereum/rlp/decode.go:198.5,198.24 1 37 -github.com/ethereum/go-ethereum/rlp/decode.go:198.24,200.4 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:203.19,204.34 1 9 -github.com/ethereum/go-ethereum/rlp/decode.go:204.34,207.4 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:207.5,209.4 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:214.58,216.16 2 8 -github.com/ethereum/go-ethereum/rlp/decode.go:219.2,219.18 1 7 -github.com/ethereum/go-ethereum/rlp/decode.go:222.2,223.16 2 4 -github.com/ethereum/go-ethereum/rlp/decode.go:226.2,226.12 1 4 -github.com/ethereum/go-ethereum/rlp/decode.go:216.16,218.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:219.18,221.3 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:223.16,225.3 1 4 -github.com/ethereum/go-ethereum/rlp/decode.go:231.58,233.16 2 18 -github.com/ethereum/go-ethereum/rlp/decode.go:236.2,236.14 1 18 -github.com/ethereum/go-ethereum/rlp/decode.go:256.2,256.12 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:233.16,235.3 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:237.2,238.21 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:241.3,243.15 3 2 -github.com/ethereum/go-ethereum/rlp/decode.go:244.2,245.31 1 9 -github.com/ethereum/go-ethereum/rlp/decode.go:248.3,249.43 2 7 -github.com/ethereum/go-ethereum/rlp/decode.go:252.3,252.23 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:253.2,254.51 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:238.21,240.4 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:245.31,247.4 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:249.43,251.4 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:259.41,261.37 2 14 -github.com/ethereum/go-ethereum/rlp/decode.go:261.37,263.3 1 35 -github.com/ethereum/go-ethereum/rlp/decode.go:271.59,273.38 2 4 -github.com/ethereum/go-ethereum/rlp/decode.go:282.2,282.56 1 4 -github.com/ethereum/go-ethereum/rlp/decode.go:300.2,300.17 1 4 -github.com/ethereum/go-ethereum/rlp/decode.go:273.38,274.41 1 11 -github.com/ethereum/go-ethereum/rlp/decode.go:274.41,276.18 2 10 -github.com/ethereum/go-ethereum/rlp/decode.go:279.4,279.43 1 10 -github.com/ethereum/go-ethereum/rlp/decode.go:276.18,278.5 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:282.56,283.36 1 9 -github.com/ethereum/go-ethereum/rlp/decode.go:286.3,286.28 1 9 -github.com/ethereum/go-ethereum/rlp/decode.go:295.3,295.44 1 9 -github.com/ethereum/go-ethereum/rlp/decode.go:298.3,298.13 1 9 -github.com/ethereum/go-ethereum/rlp/decode.go:283.36,285.4 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:286.28,288.18 2 19 -github.com/ethereum/go-ethereum/rlp/decode.go:288.18,290.10 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:291.6,291.25 1 16 -github.com/ethereum/go-ethereum/rlp/decode.go:291.25,293.5 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:295.44,297.4 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:303.56,306.16 3 5 -github.com/ethereum/go-ethereum/rlp/decode.go:309.2,309.56 1 5 -github.com/ethereum/go-ethereum/rlp/decode.go:324.2,324.17 1 5 -github.com/ethereum/go-ethereum/rlp/decode.go:306.16,308.3 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:309.56,311.48 2 13 -github.com/ethereum/go-ethereum/rlp/decode.go:315.3,316.18 2 8 -github.com/ethereum/go-ethereum/rlp/decode.go:319.3,319.60 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:322.3,322.13 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:311.48,314.4 2 5 -github.com/ethereum/go-ethereum/rlp/decode.go:316.18,318.4 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:319.60,321.4 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:329.58,331.16 2 9 -github.com/ethereum/go-ethereum/rlp/decode.go:334.2,334.18 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:347.2,347.12 1 8 -github.com/ethereum/go-ethereum/rlp/decode.go:331.16,333.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:334.18,336.71 2 2 -github.com/ethereum/go-ethereum/rlp/decode.go:339.3,339.17 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:336.71,338.4 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:340.4,342.17 2 6 -github.com/ethereum/go-ethereum/rlp/decode.go:345.3,345.30 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:342.17,344.4 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:352.61,354.2 1 5 -github.com/ethereum/go-ethereum/rlp/decode.go:356.56,361.46 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:364.2,364.47 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:361.46,363.3 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:376.31,377.11 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:378.2,379.16 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:380.2,381.18 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:382.2,383.16 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:384.2,385.39 1 0 -github.com/ethereum/go-ethereum/rlp/decode.go:435.38,437.2 1 109 -github.com/ethereum/go-ethereum/rlp/decode.go:442.42,444.16 2 25 -github.com/ethereum/go-ethereum/rlp/decode.go:447.2,447.14 1 23 -github.com/ethereum/go-ethereum/rlp/decode.go:444.16,446.3 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:448.2,450.32 2 8 -github.com/ethereum/go-ethereum/rlp/decode.go:451.2,453.38 2 12 -github.com/ethereum/go-ethereum/rlp/decode.go:456.3,456.16 1 11 -github.com/ethereum/go-ethereum/rlp/decode.go:457.2,458.32 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:453.38,455.4 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:465.41,467.2 1 31 -github.com/ethereum/go-ethereum/rlp/decode.go:469.52,471.16 2 91 -github.com/ethereum/go-ethereum/rlp/decode.go:474.2,474.14 1 75 -github.com/ethereum/go-ethereum/rlp/decode.go:471.16,473.3 1 16 -github.com/ethereum/go-ethereum/rlp/decode.go:475.2,477.32 2 62 -github.com/ethereum/go-ethereum/rlp/decode.go:478.2,479.31 1 11 -github.com/ethereum/go-ethereum/rlp/decode.go:482.3,482.32 1 7 -github.com/ethereum/go-ethereum/rlp/decode.go:483.2,484.30 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:479.31,481.4 1 4 -github.com/ethereum/go-ethereum/rlp/decode.go:491.50,493.16 2 40 -github.com/ethereum/go-ethereum/rlp/decode.go:496.2,496.18 1 39 -github.com/ethereum/go-ethereum/rlp/decode.go:499.2,502.18 4 37 -github.com/ethereum/go-ethereum/rlp/decode.go:493.16,495.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:496.18,498.3 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:507.34,508.23 1 31 -github.com/ethereum/go-ethereum/rlp/decode.go:511.2,512.25 2 30 -github.com/ethereum/go-ethereum/rlp/decode.go:515.2,516.22 2 28 -github.com/ethereum/go-ethereum/rlp/decode.go:519.2,521.12 3 28 -github.com/ethereum/go-ethereum/rlp/decode.go:508.23,510.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:512.25,514.3 1 2 -github.com/ethereum/go-ethereum/rlp/decode.go:516.22,518.3 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:527.48,528.16 1 73 -github.com/ethereum/go-ethereum/rlp/decode.go:531.2,533.32 3 72 -github.com/ethereum/go-ethereum/rlp/decode.go:536.2,536.18 1 71 -github.com/ethereum/go-ethereum/rlp/decode.go:539.2,540.16 2 70 -github.com/ethereum/go-ethereum/rlp/decode.go:543.2,543.37 1 69 -github.com/ethereum/go-ethereum/rlp/decode.go:528.16,530.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:533.32,535.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:536.18,538.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:540.16,542.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:557.61,559.22 2 224 -github.com/ethereum/go-ethereum/rlp/decode.go:562.2,562.16 1 224 -github.com/ethereum/go-ethereum/rlp/decode.go:572.2,572.45 1 201 -github.com/ethereum/go-ethereum/rlp/decode.go:575.2,575.28 1 200 -github.com/ethereum/go-ethereum/rlp/decode.go:559.22,561.3 1 94 -github.com/ethereum/go-ethereum/rlp/decode.go:562.16,563.40 1 192 -github.com/ethereum/go-ethereum/rlp/decode.go:566.3,567.17 2 175 -github.com/ethereum/go-ethereum/rlp/decode.go:570.3,570.30 1 169 -github.com/ethereum/go-ethereum/rlp/decode.go:563.40,565.4 1 17 -github.com/ethereum/go-ethereum/rlp/decode.go:567.17,569.4 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:572.45,574.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:578.65,580.16 2 175 -github.com/ethereum/go-ethereum/rlp/decode.go:583.2,584.9 2 170 -github.com/ethereum/go-ethereum/rlp/decode.go:580.16,582.3 1 5 -github.com/ethereum/go-ethereum/rlp/decode.go:585.2,589.22 2 76 -github.com/ethereum/go-ethereum/rlp/decode.go:590.2,595.39 1 37 -github.com/ethereum/go-ethereum/rlp/decode.go:596.2,604.27 2 6 -github.com/ethereum/go-ethereum/rlp/decode.go:605.2,611.37 1 47 -github.com/ethereum/go-ethereum/rlp/decode.go:612.2,620.25 2 4 -github.com/ethereum/go-ethereum/rlp/decode.go:624.54,625.15 1 17 -github.com/ethereum/go-ethereum/rlp/decode.go:632.2,633.29 2 11 -github.com/ethereum/go-ethereum/rlp/decode.go:636.2,637.48 2 11 -github.com/ethereum/go-ethereum/rlp/decode.go:625.15,627.20 2 6 -github.com/ethereum/go-ethereum/rlp/decode.go:630.3,630.24 1 6 -github.com/ethereum/go-ethereum/rlp/decode.go:627.20,629.4 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:633.29,635.3 1 44 -github.com/ethereum/go-ethereum/rlp/decode.go:640.51,643.33 3 30 -github.com/ethereum/go-ethereum/rlp/decode.go:647.2,647.19 1 30 -github.com/ethereum/go-ethereum/rlp/decode.go:650.2,650.12 1 30 -github.com/ethereum/go-ethereum/rlp/decode.go:643.33,646.3 2 27 -github.com/ethereum/go-ethereum/rlp/decode.go:647.19,649.3 1 3 -github.com/ethereum/go-ethereum/rlp/decode.go:653.43,656.39 3 181 -github.com/ethereum/go-ethereum/rlp/decode.go:659.2,659.15 1 181 -github.com/ethereum/go-ethereum/rlp/decode.go:656.39,658.3 1 1 -github.com/ethereum/go-ethereum/rlp/decode.go:662.37,664.22 2 211 -github.com/ethereum/go-ethereum/rlp/decode.go:664.22,666.3 1 76 -github.com/ethereum/go-ethereum/rlp/typecache.go:21.58,25.17 4 70 -github.com/ethereum/go-ethereum/rlp/typecache.go:29.2,31.29 3 21 -github.com/ethereum/go-ethereum/rlp/typecache.go:25.17,27.3 1 49 -github.com/ethereum/go-ethereum/rlp/typecache.go:34.59,36.17 2 41 -github.com/ethereum/go-ethereum/rlp/typecache.go:43.2,45.16 3 27 -github.com/ethereum/go-ethereum/rlp/typecache.go:50.2,51.28 2 26 -github.com/ethereum/go-ethereum/rlp/typecache.go:36.17,39.3 1 14 -github.com/ethereum/go-ethereum/rlp/typecache.go:45.16,49.3 2 1 -github.com/ethereum/go-ethereum/rlp/typecache.go:59.64,62.9 3 27 -github.com/ethereum/go-ethereum/rlp/typecache.go:86.2,86.18 1 27 -github.com/ethereum/go-ethereum/rlp/typecache.go:63.2,64.31 1 1 -github.com/ethereum/go-ethereum/rlp/typecache.go:65.2,66.36 1 2 -github.com/ethereum/go-ethereum/rlp/typecache.go:67.2,68.30 1 1 -github.com/ethereum/go-ethereum/rlp/typecache.go:69.2,70.35 1 1 -github.com/ethereum/go-ethereum/rlp/typecache.go:71.2,72.37 1 2 -github.com/ethereum/go-ethereum/rlp/typecache.go:73.2,74.30 1 1 -github.com/ethereum/go-ethereum/rlp/typecache.go:75.2,76.43 1 8 -github.com/ethereum/go-ethereum/rlp/typecache.go:77.2,78.45 1 4 -github.com/ethereum/go-ethereum/rlp/typecache.go:79.2,80.42 1 5 -github.com/ethereum/go-ethereum/rlp/typecache.go:81.2,82.33 1 1 -github.com/ethereum/go-ethereum/rlp/typecache.go:83.2,84.64 1 1 -github.com/ethereum/go-ethereum/rlp/typecache.go:89.37,91.2 1 22 -github.com/ethereum/go-ethereum/state/dump.go:23.34,29.70 2 1 -github.com/ethereum/go-ethereum/state/dump.go:42.2,43.16 2 1 -github.com/ethereum/go-ethereum/state/dump.go:47.2,47.13 1 1 -github.com/ethereum/go-ethereum/state/dump.go:29.70,35.66 4 0 -github.com/ethereum/go-ethereum/state/dump.go:39.3,39.59 1 0 -github.com/ethereum/go-ethereum/state/dump.go:35.66,38.4 2 0 -github.com/ethereum/go-ethereum/state/dump.go:43.16,45.3 1 0 -github.com/ethereum/go-ethereum/state/dump.go:51.48,53.59 2 0 -github.com/ethereum/go-ethereum/state/dump.go:53.59,55.3 1 0 -github.com/ethereum/go-ethereum/state/errors.go:13.36,17.2 2 0 -github.com/ethereum/go-ethereum/state/errors.go:18.40,20.2 1 0 -github.com/ethereum/go-ethereum/state/errors.go:21.51,23.2 1 0 -github.com/ethereum/go-ethereum/state/log.go:16.51,23.16 3 0 -github.com/ethereum/go-ethereum/state/log.go:27.2,27.12 1 0 -github.com/ethereum/go-ethereum/state/log.go:23.16,25.3 1 0 -github.com/ethereum/go-ethereum/state/log.go:30.40,32.2 1 0 -github.com/ethereum/go-ethereum/state/log.go:34.34,36.2 1 0 -github.com/ethereum/go-ethereum/state/log.go:40.40,42.27 2 0 -github.com/ethereum/go-ethereum/state/log.go:46.2,46.13 1 0 -github.com/ethereum/go-ethereum/state/log.go:42.27,44.3 1 0 -github.com/ethereum/go-ethereum/state/log.go:49.34,51.27 2 0 -github.com/ethereum/go-ethereum/state/log.go:54.2,54.47 1 0 -github.com/ethereum/go-ethereum/state/log.go:51.27,53.3 1 0 -github.com/ethereum/go-ethereum/state/manifest.go:16.30,21.2 3 6 -github.com/ethereum/go-ethereum/state/manifest.go:23.28,25.2 1 6 -github.com/ethereum/go-ethereum/state/manifest.go:27.57,31.2 2 0 -github.com/ethereum/go-ethereum/state/manifest.go:49.52,51.2 1 0 -github.com/ethereum/go-ethereum/state/manifest.go:53.38,55.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:32.34,34.2 1 6 -github.com/ethereum/go-ethereum/state/state.go:36.32,38.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:40.37,42.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:44.32,46.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:49.53,51.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:55.2,55.21 1 0 -github.com/ethereum/go-ethereum/state/state.go:51.24,53.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:58.61,61.38 2 0 -github.com/ethereum/go-ethereum/state/state.go:65.2,65.66 1 0 -github.com/ethereum/go-ethereum/state/state.go:61.38,63.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:68.61,70.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:70.24,72.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:75.49,77.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:81.2,81.10 1 0 -github.com/ethereum/go-ethereum/state/state.go:77.24,79.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:84.56,86.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:86.24,88.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:91.48,93.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:97.2,97.12 1 0 -github.com/ethereum/go-ethereum/state/state.go:93.24,95.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:100.49,102.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:106.2,106.12 1 0 -github.com/ethereum/go-ethereum/state/state.go:102.24,104.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:109.66,111.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:111.24,113.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:116.45,118.24 2 0 -github.com/ethereum/go-ethereum/state/state.go:124.2,124.14 1 0 -github.com/ethereum/go-ethereum/state/state.go:118.24,122.3 2 0 -github.com/ethereum/go-ethereum/state/state.go:132.64,135.37 2 0 -github.com/ethereum/go-ethereum/state/state.go:139.2,139.65 1 0 -github.com/ethereum/go-ethereum/state/state.go:135.37,137.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:143.64,147.2 2 0 -github.com/ethereum/go-ethereum/state/state.go:150.61,154.24 3 3 -github.com/ethereum/go-ethereum/state/state.go:158.2,159.20 2 1 -github.com/ethereum/go-ethereum/state/state.go:163.2,166.20 3 0 -github.com/ethereum/go-ethereum/state/state.go:154.24,156.3 1 2 -github.com/ethereum/go-ethereum/state/state.go:159.20,161.3 1 1 -github.com/ethereum/go-ethereum/state/state.go:169.56,171.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:174.66,176.24 2 1 -github.com/ethereum/go-ethereum/state/state.go:180.2,180.20 1 1 -github.com/ethereum/go-ethereum/state/state.go:176.24,178.3 1 1 -github.com/ethereum/go-ethereum/state/state.go:184.61,193.2 5 1 -github.com/ethereum/go-ethereum/state/state.go:196.57,198.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:204.40,206.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:208.34,209.22 1 2 -github.com/ethereum/go-ethereum/state/state.go:226.2,226.12 1 0 -github.com/ethereum/go-ethereum/state/state.go:209.22,211.49 2 2 -github.com/ethereum/go-ethereum/state/state.go:215.3,215.41 1 2 -github.com/ethereum/go-ethereum/state/state.go:219.3,223.15 4 2 -github.com/ethereum/go-ethereum/state/state.go:211.49,213.4 1 1 -github.com/ethereum/go-ethereum/state/state.go:215.41,217.4 1 0 -github.com/ethereum/go-ethereum/state/state.go:229.38,230.18 1 1 -github.com/ethereum/go-ethereum/state/state.go:234.2,237.24 4 1 -github.com/ethereum/go-ethereum/state/state.go:230.18,232.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:240.31,242.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:245.25,249.45 2 0 -github.com/ethereum/go-ethereum/state/state.go:258.2,258.11 1 0 -github.com/ethereum/go-ethereum/state/state.go:249.45,250.31 1 0 -github.com/ethereum/go-ethereum/state/state.go:255.3,255.22 1 0 -github.com/ethereum/go-ethereum/state/state.go:250.31,251.12 1 0 -github.com/ethereum/go-ethereum/state/state.go:262.24,264.45 1 0 -github.com/ethereum/go-ethereum/state/state.go:272.2,274.11 2 0 -github.com/ethereum/go-ethereum/state/state.go:264.45,265.31 1 0 -github.com/ethereum/go-ethereum/state/state.go:269.3,269.27 1 0 -github.com/ethereum/go-ethereum/state/state.go:265.31,266.12 1 0 -github.com/ethereum/go-ethereum/state/state.go:277.28,280.2 2 0 -github.com/ethereum/go-ethereum/state/state.go:282.29,286.40 2 0 -github.com/ethereum/go-ethereum/state/state.go:290.2,290.48 1 0 -github.com/ethereum/go-ethereum/state/state.go:302.2,302.13 1 0 -github.com/ethereum/go-ethereum/state/state.go:286.40,288.3 1 0 -github.com/ethereum/go-ethereum/state/state.go:290.48,291.25 1 0 -github.com/ethereum/go-ethereum/state/state.go:291.25,294.4 2 0 -github.com/ethereum/go-ethereum/state/state.go:294.5,298.4 2 0 -github.com/ethereum/go-ethereum/state/state.go:302.13,304.13 2 0 -github.com/ethereum/go-ethereum/state/state.go:304.13,308.4 2 0 -github.com/ethereum/go-ethereum/state/state.go:312.41,314.2 1 0 -github.com/ethereum/go-ethereum/state/state.go:317.42,318.48 1 0 -github.com/ethereum/go-ethereum/state/state.go:318.48,320.3 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:14.34,16.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:20.36,22.31 2 1 -github.com/ethereum/go-ethereum/state/state_object.go:27.2,27.12 1 1 -github.com/ethereum/go-ethereum/state/state_object.go:22.31,25.3 1 1 -github.com/ethereum/go-ethereum/state/state_object.go:55.34,58.2 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:60.47,70.2 6 2 -github.com/ethereum/go-ethereum/state/state_object.go:72.78,78.2 4 0 -github.com/ethereum/go-ethereum/state/state_object.go:80.65,85.2 3 0 -github.com/ethereum/go-ethereum/state/state_object.go:87.44,90.2 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:92.59,94.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:96.63,98.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:100.66,102.2 1 1 -github.com/ethereum/go-ethereum/state/state_object.go:103.73,105.2 1 2 -github.com/ethereum/go-ethereum/state/state_object.go:107.62,109.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:111.60,115.18 3 1 -github.com/ethereum/go-ethereum/state/state_object.go:123.2,123.14 1 1 -github.com/ethereum/go-ethereum/state/state_object.go:115.18,118.21 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:118.21,120.4 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:126.67,129.2 2 2 -github.com/ethereum/go-ethereum/state/state_object.go:132.60,134.39 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:140.2,141.49 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:134.39,138.3 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:141.49,143.31 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:143.31,145.4 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:149.33,150.39 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:161.2,162.12 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:150.39,151.23 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:158.3,158.35 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:151.23,155.12 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:162.12,166.3 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:169.60,170.39 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:174.2,174.62 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:170.39,172.3 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:177.51,181.2 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:182.50,182.74 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:184.51,188.2 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:189.50,189.74 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:191.51,193.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:195.45,195.68 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:202.54,202.56 0 0 -github.com/ethereum/go-ethereum/state/state_object.go:203.61,205.30 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:209.2,211.12 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:205.30,207.3 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:214.56,218.2 2 0 -github.com/ethereum/go-ethereum/state/state_object.go:220.60,221.31 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:225.2,230.12 4 0 -github.com/ethereum/go-ethereum/state/state_object.go:221.31,223.3 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:233.57,240.2 4 0 -github.com/ethereum/go-ethereum/state/state_object.go:242.46,247.23 5 1 -github.com/ethereum/go-ethereum/state/state_object.go:250.2,256.20 6 1 -github.com/ethereum/go-ethereum/state/state_object.go:247.23,249.3 1 1 -github.com/ethereum/go-ethereum/state/state_object.go:259.56,261.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:267.36,269.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:272.40,274.2 1 1 -github.com/ethereum/go-ethereum/state/state_object.go:277.35,279.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:282.48,284.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:286.40,288.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:295.42,297.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:299.48,301.2 1 0 -github.com/ethereum/go-ethereum/state/state_object.go:303.46,315.2 8 0 -github.com/ethereum/go-ethereum/trie/encoding.go:9.44,11.37 2 17 -github.com/ethereum/go-ethereum/trie/encoding.go:15.2,15.21 1 17 -github.com/ethereum/go-ethereum/trie/encoding.go:19.2,21.17 3 17 -github.com/ethereum/go-ethereum/trie/encoding.go:27.2,28.40 2 17 -github.com/ethereum/go-ethereum/trie/encoding.go:32.2,32.22 1 17 -github.com/ethereum/go-ethereum/trie/encoding.go:11.37,13.3 1 9 -github.com/ethereum/go-ethereum/trie/encoding.go:15.21,17.3 1 9 -github.com/ethereum/go-ethereum/trie/encoding.go:21.17,23.3 1 9 -github.com/ethereum/go-ethereum/trie/encoding.go:23.4,25.3 1 8 -github.com/ethereum/go-ethereum/trie/encoding.go:28.40,30.3 1 46 -github.com/ethereum/go-ethereum/trie/encoding.go:35.39,38.18 3 12 -github.com/ethereum/go-ethereum/trie/encoding.go:41.2,41.20 1 12 -github.com/ethereum/go-ethereum/trie/encoding.go:47.2,47.13 1 12 -github.com/ethereum/go-ethereum/trie/encoding.go:38.18,40.3 1 7 -github.com/ethereum/go-ethereum/trie/encoding.go:41.20,43.3 1 6 -github.com/ethereum/go-ethereum/trie/encoding.go:43.4,45.3 1 6 -github.com/ethereum/go-ethereum/trie/encoding.go:50.42,55.24 4 21 -github.com/ethereum/go-ethereum/trie/encoding.go:58.2,60.17 2 21 -github.com/ethereum/go-ethereum/trie/encoding.go:55.24,57.3 1 152 -github.com/ethereum/go-ethereum/trie/encoding.go:63.39,67.24 3 0 -github.com/ethereum/go-ethereum/trie/encoding.go:73.2,75.20 2 0 -github.com/ethereum/go-ethereum/trie/encoding.go:67.24,68.13 1 0 -github.com/ethereum/go-ethereum/trie/encoding.go:68.13,70.4 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:18.44,19.21 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:23.2,23.21 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:32.2,32.19 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:19.21,21.3 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:23.21,25.17 2 0 -github.com/ethereum/go-ethereum/trie/iterator.go:29.3,29.17 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:25.17,27.4 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:43.40,45.2 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:47.70,48.23 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:73.2,73.12 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:49.2,55.11 4 0 -github.com/ethereum/go-ethereum/trie/iterator.go:56.2,57.29 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:61.3,61.33 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:67.2,70.79 2 0 -github.com/ethereum/go-ethereum/trie/iterator.go:57.29,59.4 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:61.33,63.16 2 0 -github.com/ethereum/go-ethereum/trie/iterator.go:63.16,65.5 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:76.83,77.35 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:129.2,129.12 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:78.2,79.13 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:80.2,81.19 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:90.3,91.19 2 0 -github.com/ethereum/go-ethereum/trie/iterator.go:95.3,95.27 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:102.2,104.22 2 0 -github.com/ethereum/go-ethereum/trie/iterator.go:81.19,85.16 3 0 -github.com/ethereum/go-ethereum/trie/iterator.go:85.16,87.5 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:91.19,93.4 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:95.27,98.16 3 0 -github.com/ethereum/go-ethereum/trie/iterator.go:98.16,100.5 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:104.22,105.49 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:105.49,110.5 3 0 -github.com/ethereum/go-ethereum/trie/iterator.go:111.5,115.26 4 0 -github.com/ethereum/go-ethereum/trie/iterator.go:123.4,123.18 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:115.26,117.5 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:117.6,117.49 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:117.49,119.5 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:119.6,121.5 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:123.18,125.5 1 0 -github.com/ethereum/go-ethereum/trie/iterator.go:133.47,143.2 6 0 -github.com/ethereum/go-ethereum/trie/slice.go:9.39,10.22 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:13.2,13.22 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:18.2,18.13 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:10.22,12.3 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:13.22,14.16 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:14.16,16.4 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:22.44,25.17 2 6 -github.com/ethereum/go-ethereum/trie/slice.go:32.2,32.10 1 6 -github.com/ethereum/go-ethereum/trie/slice.go:25.17,26.19 1 11 -github.com/ethereum/go-ethereum/trie/slice.go:29.3,29.6 1 7 -github.com/ethereum/go-ethereum/trie/slice.go:26.19,27.9 1 4 -github.com/ethereum/go-ethereum/trie/slice.go:35.29,37.2 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:39.31,40.16 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:44.2,44.10 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:40.16,42.3 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:47.35,48.21 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:52.2,52.35 1 0 -github.com/ethereum/go-ethereum/trie/slice.go:48.21,50.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:12.44,15.59 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:19.2,19.59 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:15.59,17.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:22.27,24.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:41.64,43.2 1 16 -github.com/ethereum/go-ethereum/trie/trie.go:45.29,47.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:55.43,57.2 1 1 -github.com/ethereum/go-ethereum/trie/trie.go:59.69,63.29 3 26 -github.com/ethereum/go-ethereum/trie/trie.go:72.2,72.10 1 10 -github.com/ethereum/go-ethereum/trie/trie.go:63.29,70.3 4 16 -github.com/ethereum/go-ethereum/trie/trie.go:75.52,77.2 1 25 -github.com/ethereum/go-ethereum/trie/trie.go:79.52,81.37 1 13 -github.com/ethereum/go-ethereum/trie/trie.go:86.2,90.15 3 0 -github.com/ethereum/go-ethereum/trie/trie.go:97.2,99.14 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:81.37,83.3 1 13 -github.com/ethereum/go-ethereum/trie/trie.go:90.15,91.31 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:91.31,94.4 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:102.40,106.2 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:108.30,110.20 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:114.2,114.37 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:120.2,124.28 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:110.20,112.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:114.37,115.17 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:115.17,118.4 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:124.28,126.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:129.28,130.37 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:135.2,135.23 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:130.37,131.17 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:131.17,133.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:152.45,154.32 2 2 -github.com/ethereum/go-ethereum/trie/trie.go:160.2,160.21 1 2 -github.com/ethereum/go-ethereum/trie/trie.go:154.32,156.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:156.4,158.3 1 2 -github.com/ethereum/go-ethereum/trie/trie.go:163.55,172.2 5 1 -github.com/ethereum/go-ethereum/trie/trie.go:174.45,175.26 1 9 -github.com/ethereum/go-ethereum/trie/trie.go:176.2,182.24 1 1 -github.com/ethereum/go-ethereum/trie/trie.go:183.2,184.19 1 7 -github.com/ethereum/go-ethereum/trie/trie.go:185.2,186.46 1 1 -github.com/ethereum/go-ethereum/trie/trie.go:194.42,201.17 5 8 -github.com/ethereum/go-ethereum/trie/trie.go:206.2,206.17 1 8 -github.com/ethereum/go-ethereum/trie/trie.go:201.17,203.3 1 6 -github.com/ethereum/go-ethereum/trie/trie.go:203.4,205.3 1 2 -github.com/ethereum/go-ethereum/trie/trie.go:209.39,217.2 5 0 -github.com/ethereum/go-ethereum/trie/trie.go:219.35,227.2 5 0 -github.com/ethereum/go-ethereum/trie/trie.go:229.36,230.31 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:231.2,232.14 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:235.3,235.19 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:236.2,237.18 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:241.3,241.11 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:242.2,243.72 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:232.14,234.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:237.18,239.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:248.37,250.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:253.29,255.39 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:259.2,259.13 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:255.39,257.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:263.23,266.2 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:268.23,271.2 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:273.31,275.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:277.67,280.48 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:284.2,287.17 3 0 -github.com/ethereum/go-ethereum/trie/trie.go:304.2,304.28 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:280.48,282.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:287.17,289.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:289.4,289.24 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:289.24,294.57 3 0 -github.com/ethereum/go-ethereum/trie/trie.go:294.57,296.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:296.5,298.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:299.4,299.25 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:299.25,301.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:307.57,310.23 2 18 -github.com/ethereum/go-ethereum/trie/trie.go:314.2,315.19 2 13 -github.com/ethereum/go-ethereum/trie/trie.go:321.2,323.13 2 13 -github.com/ethereum/go-ethereum/trie/trie.go:310.23,312.3 1 5 -github.com/ethereum/go-ethereum/trie/trie.go:315.19,317.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:317.4,317.26 1 13 -github.com/ethereum/go-ethereum/trie/trie.go:317.26,319.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:326.84,328.2 1 6 -github.com/ethereum/go-ethereum/trie/trie.go:330.50,333.2 1 25 -github.com/ethereum/go-ethereum/trie/trie.go:335.44,337.25 2 13 -github.com/ethereum/go-ethereum/trie/trie.go:340.2,340.14 1 13 -github.com/ethereum/go-ethereum/trie/trie.go:337.25,339.3 1 221 -github.com/ethereum/go-ethereum/trie/trie.go:343.89,344.19 1 22 -github.com/ethereum/go-ethereum/trie/trie.go:349.2,350.33 2 19 -github.com/ethereum/go-ethereum/trie/trie.go:356.2,358.28 2 12 -github.com/ethereum/go-ethereum/trie/trie.go:412.2,412.25 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:344.19,346.3 1 3 -github.com/ethereum/go-ethereum/trie/trie.go:350.33,354.3 2 7 -github.com/ethereum/go-ethereum/trie/trie.go:358.28,365.26 3 6 -github.com/ethereum/go-ethereum/trie/trie.go:370.3,372.31 3 6 -github.com/ethereum/go-ethereum/trie/trie.go:388.3,388.26 1 6 -github.com/ethereum/go-ethereum/trie/trie.go:365.26,368.4 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:372.31,375.4 1 2 -github.com/ethereum/go-ethereum/trie/trie.go:375.5,386.4 6 4 -github.com/ethereum/go-ethereum/trie/trie.go:388.26,391.4 1 1 -github.com/ethereum/go-ethereum/trie/trie.go:391.5,394.4 2 5 -github.com/ethereum/go-ethereum/trie/trie.go:395.4,400.27 2 6 -github.com/ethereum/go-ethereum/trie/trie.go:407.3,409.24 2 6 -github.com/ethereum/go-ethereum/trie/trie.go:400.27,402.18 2 102 -github.com/ethereum/go-ethereum/trie/trie.go:402.18,404.5 1 102 -github.com/ethereum/go-ethereum/trie/trie.go:415.70,416.19 1 5 -github.com/ethereum/go-ethereum/trie/trie.go:421.2,423.33 2 5 -github.com/ethereum/go-ethereum/trie/trie.go:430.2,432.28 2 5 -github.com/ethereum/go-ethereum/trie/trie.go:502.2,502.28 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:416.19,418.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:423.33,428.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:432.28,438.26 3 2 -github.com/ethereum/go-ethereum/trie/trie.go:438.26,442.4 1 2 -github.com/ethereum/go-ethereum/trie/trie.go:442.5,442.42 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:442.42,447.24 4 0 -github.com/ethereum/go-ethereum/trie/trie.go:456.4,456.25 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:447.24,450.5 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:450.6,452.5 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:457.5,459.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:460.4,465.27 3 3 -github.com/ethereum/go-ethereum/trie/trie.go:472.3,474.27 3 3 -github.com/ethereum/go-ethereum/trie/trie.go:483.3,483.19 1 3 -github.com/ethereum/go-ethereum/trie/trie.go:499.3,499.24 1 3 -github.com/ethereum/go-ethereum/trie/trie.go:465.27,467.18 2 51 -github.com/ethereum/go-ethereum/trie/trie.go:467.18,469.5 1 51 -github.com/ethereum/go-ethereum/trie/trie.go:474.27,475.18 1 51 -github.com/ethereum/go-ethereum/trie/trie.go:475.18,476.21 1 5 -github.com/ethereum/go-ethereum/trie/trie.go:476.21,478.6 1 3 -github.com/ethereum/go-ethereum/trie/trie.go:478.7,480.6 1 2 -github.com/ethereum/go-ethereum/trie/trie.go:483.19,485.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:485.5,485.25 1 3 -github.com/ethereum/go-ethereum/trie/trie.go:485.25,487.25 2 1 -github.com/ethereum/go-ethereum/trie/trie.go:487.25,489.5 1 1 -github.com/ethereum/go-ethereum/trie/trie.go:489.6,489.31 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:489.31,492.5 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:494.5,496.4 1 2 -github.com/ethereum/go-ethereum/trie/trie.go:516.44,518.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:520.40,522.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:526.62,527.28 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:527.28,530.37 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:530.37,532.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:532.5,533.25 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:533.25,535.5 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:535.6,538.5 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:540.4,541.42 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:541.42,542.48 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:542.48,544.5 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:544.6,545.39 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:545.39,547.6 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:547.7,549.19 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:549.19,552.7 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:559.46,562.2 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:564.44,565.24 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:569.2,571.16 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:565.24,567.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:574.37,576.27 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:579.2,579.23 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:576.27,578.3 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:582.38,584.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:586.40,588.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:592.47,594.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:596.77,598.2 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:600.94,601.28 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:601.28,605.70 3 0 -github.com/ethereum/go-ethereum/trie/trie.go:605.70,607.4 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:607.5,608.25 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:608.25,610.5 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:610.6,612.5 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:614.4,615.42 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:615.42,617.48 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:617.48,619.5 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:619.6,620.72 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:620.72,622.6 1 0 -github.com/ethereum/go-ethereum/trie/trie.go:622.7,624.19 2 0 -github.com/ethereum/go-ethereum/trie/trie.go:624.19,626.7 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:25.24,27.2 1 4 -github.com/ethereum/go-ethereum/vm/stack.go:29.36,31.2 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:33.28,35.2 1 141 -github.com/ethereum/go-ethereum/vm/stack.go:37.33,44.2 4 42 -github.com/ethereum/go-ethereum/vm/stack.go:46.46,53.2 4 20 -github.com/ethereum/go-ethereum/vm/stack.go:55.34,59.2 2 16 -github.com/ethereum/go-ethereum/vm/stack.go:61.47,65.2 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:67.52,71.2 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:73.39,77.2 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:79.35,81.2 1 84 -github.com/ethereum/go-ethereum/vm/stack.go:83.50,86.29 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:91.2,91.12 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:86.29,89.3 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:94.26,96.22 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:103.2,103.30 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:96.22,97.31 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:97.31,99.4 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:100.4,102.3 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:110.26,112.2 1 3 -github.com/ethereum/go-ethereum/vm/stack.go:114.56,115.20 1 2 -github.com/ethereum/go-ethereum/vm/stack.go:115.20,118.24 3 2 -github.com/ethereum/go-ethereum/vm/stack.go:128.3,128.43 1 2 -github.com/ethereum/go-ethereum/vm/stack.go:118.24,121.16 2 2 -github.com/ethereum/go-ethereum/vm/stack.go:121.16,126.5 2 2 -github.com/ethereum/go-ethereum/vm/stack.go:132.38,133.28 1 28 -github.com/ethereum/go-ethereum/vm/stack.go:133.28,135.3 1 8 -github.com/ethereum/go-ethereum/vm/stack.go:138.49,139.32 1 4 -github.com/ethereum/go-ethereum/vm/stack.go:145.2,145.12 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:139.32,143.3 2 4 -github.com/ethereum/go-ethereum/vm/stack.go:148.59,149.35 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:157.2,157.8 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:149.35,155.3 4 0 -github.com/ethereum/go-ethereum/vm/stack.go:160.28,162.2 1 139 -github.com/ethereum/go-ethereum/vm/stack.go:164.32,166.2 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:168.26,170.22 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:179.2,179.37 1 0 -github.com/ethereum/go-ethereum/vm/stack.go:170.22,172.45 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:172.45,175.4 2 0 -github.com/ethereum/go-ethereum/vm/stack.go:176.4,178.3 1 0 -github.com/ethereum/go-ethereum/vm/address.go:19.55,21.2 1 2 -github.com/ethereum/go-ethereum/vm/address.go:29.35,31.2 1 1 -github.com/ethereum/go-ethereum/vm/address.go:33.38,35.2 1 1 -github.com/ethereum/go-ethereum/vm/address.go:37.38,39.15 1 0 -github.com/ethereum/go-ethereum/vm/address.go:41.2,41.29 1 0 -github.com/ethereum/go-ethereum/vm/address.go:39.15,39.28 1 0 -github.com/ethereum/go-ethereum/vm/execution.go:19.103,21.2 1 2 -github.com/ethereum/go-ethereum/vm/execution.go:23.38,25.2 1 0 -github.com/ethereum/go-ethereum/vm/execution.go:27.81,32.2 2 2 -github.com/ethereum/go-ethereum/vm/execution.go:34.92,39.15 4 2 -github.com/ethereum/go-ethereum/vm/execution.go:46.2,56.24 3 2 -github.com/ethereum/go-ethereum/vm/execution.go:60.2,60.16 1 2 -github.com/ethereum/go-ethereum/vm/execution.go:90.2,90.8 1 2 -github.com/ethereum/go-ethereum/vm/execution.go:39.15,40.39 1 2 -github.com/ethereum/go-ethereum/vm/execution.go:43.3,43.57 1 2 -github.com/ethereum/go-ethereum/vm/execution.go:40.39,42.4 1 0 -github.com/ethereum/go-ethereum/vm/execution.go:56.24,58.3 1 2 -github.com/ethereum/go-ethereum/vm/execution.go:60.16,64.3 2 0 -github.com/ethereum/go-ethereum/vm/execution.go:64.4,68.40 3 2 -github.com/ethereum/go-ethereum/vm/execution.go:68.40,69.32 1 2 -github.com/ethereum/go-ethereum/vm/execution.go:69.32,72.5 2 2 -github.com/ethereum/go-ethereum/vm/execution.go:73.5,78.39 3 0 -github.com/ethereum/go-ethereum/vm/execution.go:85.4,86.20 2 0 -github.com/ethereum/go-ethereum/vm/execution.go:78.39,82.5 2 0 -github.com/ethereum/go-ethereum/vm/execution.go:93.74,95.2 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:20.52,21.13 1 4 -github.com/ethereum/go-ethereum/vm/vm.go:22.2,23.25 1 3 -github.com/ethereum/go-ethereum/vm/vm.go:24.2,25.23 1 1 -github.com/ethereum/go-ethereum/vm/vm.go:29.70,33.15 2 1 -github.com/ethereum/go-ethereum/vm/vm.go:41.2,41.28 1 1 -github.com/ethereum/go-ethereum/vm/vm.go:45.2,52.25 1 1 -github.com/ethereum/go-ethereum/vm/vm.go:59.2,59.6 1 1 -github.com/ethereum/go-ethereum/vm/vm.go:33.15,34.31 1 1 -github.com/ethereum/go-ethereum/vm/vm.go:34.31,37.4 2 1 -github.com/ethereum/go-ethereum/vm/vm.go:41.28,43.3 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:52.25,53.23 1 15 -github.com/ethereum/go-ethereum/vm/vm.go:53.23,55.5 1 1 -github.com/ethereum/go-ethereum/vm/vm.go:59.6,68.44 5 22 -github.com/ethereum/go-ethereum/vm/vm.go:72.3,75.13 3 22 -github.com/ethereum/go-ethereum/vm/vm.go:144.3,144.39 1 22 -github.com/ethereum/go-ethereum/vm/vm.go:158.3,158.27 1 22 -github.com/ethereum/go-ethereum/vm/vm.go:166.3,168.13 2 22 -github.com/ethereum/go-ethereum/vm/vm.go:707.3,707.7 1 21 -github.com/ethereum/go-ethereum/vm/vm.go:68.44,70.4 1 24 -github.com/ethereum/go-ethereum/vm/vm.go:76.3,77.25 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:78.3,79.25 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:80.3,81.21 1 3 -github.com/ethereum/go-ethereum/vm/vm.go:82.3,86.65 4 0 -github.com/ethereum/go-ethereum/vm/vm.go:93.4,93.43 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:94.3,95.23 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:96.3,98.52 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:99.3,102.52 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:103.3,105.51 2 4 -github.com/ethereum/go-ethereum/vm/vm.go:106.3,109.69 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:110.3,115.69 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:116.3,119.69 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:120.3,123.69 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:124.3,127.82 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:128.3,136.37 6 0 -github.com/ethereum/go-ethereum/vm/vm.go:137.3,141.82 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:86.65,88.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:88.6,88.73 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:88.73,90.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:90.6,92.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:144.39,149.50 4 4 -github.com/ethereum/go-ethereum/vm/vm.go:149.50,155.5 4 2 -github.com/ethereum/go-ethereum/vm/vm.go:158.27,164.4 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:170.3,179.20 5 3 -github.com/ethereum/go-ethereum/vm/vm.go:180.3,189.20 5 0 -github.com/ethereum/go-ethereum/vm/vm.go:190.3,199.20 5 0 -github.com/ethereum/go-ethereum/vm/vm.go:200.3,204.32 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:208.4,211.20 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:212.3,216.32 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:231.4,231.20 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:232.3,240.20 5 0 -github.com/ethereum/go-ethereum/vm/vm.go:241.3,245.32 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:260.4,260.20 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:262.3,270.20 5 1 -github.com/ethereum/go-ethereum/vm/vm.go:271.3,277.20 4 0 -github.com/ethereum/go-ethereum/vm/vm.go:278.3,282.20 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:287.3,292.20 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:298.3,302.26 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:307.3,312.20 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:318.3,323.21 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:328.3,331.35 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:338.3,342.30 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:343.3,347.29 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:348.3,352.30 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:353.3,356.85 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:363.3,375.20 8 0 -github.com/ethereum/go-ethereum/vm/vm.go:376.3,388.20 8 0 -github.com/ethereum/go-ethereum/vm/vm.go:391.3,396.34 4 0 -github.com/ethereum/go-ethereum/vm/vm.go:399.3,400.47 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:402.3,408.23 4 0 -github.com/ethereum/go-ethereum/vm/vm.go:410.3,413.36 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:415.3,417.36 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:419.3,422.21 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:424.3,432.32 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:439.4,439.34 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:440.3,442.29 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:444.3,452.19 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:459.4,461.26 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:462.3,464.25 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:472.4,473.17 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:475.3,477.25 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:485.4,492.19 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:499.4,501.30 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:502.3,503.29 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:506.3,509.38 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:511.3,514.38 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:516.3,519.32 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:521.3,524.22 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:526.3,529.26 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:531.3,533.29 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:536.3,544.36 5 11 -github.com/ethereum/go-ethereum/vm/vm.go:545.3,547.15 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:548.3,550.17 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:551.3,553.18 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:555.3,559.19 4 0 -github.com/ethereum/go-ethereum/vm/vm.go:561.3,565.61 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:567.3,572.53 4 4 -github.com/ethereum/go-ethereum/vm/vm.go:574.3,579.28 4 3 -github.com/ethereum/go-ethereum/vm/vm.go:581.3,586.49 4 0 -github.com/ethereum/go-ethereum/vm/vm.go:588.3,593.12 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:594.3,597.38 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:606.3,606.17 0 0 -github.com/ethereum/go-ethereum/vm/vm.go:607.3,608.31 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:609.3,610.44 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:611.3,612.27 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:614.3,637.18 8 0 -github.com/ethereum/go-ethereum/vm/vm.go:649.3,664.22 8 0 -github.com/ethereum/go-ethereum/vm/vm.go:670.4,672.18 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:680.3,685.35 4 0 -github.com/ethereum/go-ethereum/vm/vm.go:686.3,695.15 5 0 -github.com/ethereum/go-ethereum/vm/vm.go:696.3,698.35 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:699.3,704.67 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:204.32,206.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:216.32,218.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:218.6,220.53 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:226.5,228.15 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:220.53,222.6 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:222.7,224.6 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:245.32,247.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:247.6,249.32 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:255.5,257.15 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:249.32,251.6 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:251.7,253.6 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:282.20,284.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:284.6,286.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:292.20,294.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:294.6,296.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:302.26,304.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:304.6,306.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:312.20,314.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:314.6,316.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:323.21,325.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:325.6,327.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:331.35,333.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:333.6,335.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:356.85,360.5 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:360.6,362.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:432.32,437.5 3 0 -github.com/ethereum/go-ethereum/vm/vm.go:452.19,455.5 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:455.6,455.28 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:455.28,457.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:464.25,468.5 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:468.6,470.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:477.25,481.5 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:481.6,483.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:492.19,495.5 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:495.6,495.28 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:495.28,497.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:597.38,600.43 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:604.5,604.13 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:600.43,602.6 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:637.18,643.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:643.6,647.5 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:664.22,666.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:666.6,668.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:672.18,674.5 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:674.6,678.5 2 0 -github.com/ethereum/go-ethereum/vm/vm.go:711.35,713.2 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:715.29,717.2 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:719.72,719.87 1 0 -github.com/ethereum/go-ethereum/vm/vm.go:720.72,720.87 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:32.43,34.25 2 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:38.2,38.57 1 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:34.25,36.3 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:41.75,44.22 2 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:60.2,70.30 1 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:100.2,100.21 1 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:105.2,105.28 1 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:109.2,111.6 2 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:44.22,46.16 1 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:46.16,47.32 1 3 -github.com/ethereum/go-ethereum/vm/vm_debug.go:47.32,56.5 4 1 -github.com/ethereum/go-ethereum/vm/vm_debug.go:70.30,71.23 1 33 -github.com/ethereum/go-ethereum/vm/vm_debug.go:71.23,73.5 1 1 -github.com/ethereum/go-ethereum/vm/vm_debug.go:76.34,81.14 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:95.4,95.15 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:81.14,83.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:83.6,85.64 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:91.5,91.12 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:85.64,87.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:87.7,87.43 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:87.43,89.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:100.21,102.3 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:105.28,107.3 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:111.6,122.30 5 80 -github.com/ethereum/go-ethereum/vm/vm_debug.go:139.3,140.44 2 80 -github.com/ethereum/go-ethereum/vm/vm_debug.go:146.3,150.13 3 80 -github.com/ethereum/go-ethereum/vm/vm_debug.go:253.3,253.39 1 79 -github.com/ethereum/go-ethereum/vm/vm_debug.go:270.3,273.27 3 79 -github.com/ethereum/go-ethereum/vm/vm_debug.go:283.3,283.13 1 79 -github.com/ethereum/go-ethereum/vm/vm_debug.go:917.3,921.22 3 77 -github.com/ethereum/go-ethereum/vm/vm_debug.go:122.30,123.14 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:131.4,132.19 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:136.4,136.92 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:124.4,125.98 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:125.98,128.6 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:132.19,134.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:140.44,141.37 1 88 -github.com/ethereum/go-ethereum/vm/vm_debug.go:141.37,143.5 1 88 -github.com/ethereum/go-ethereum/vm/vm_debug.go:152.3,153.14 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:154.3,155.14 1 10 -github.com/ethereum/go-ethereum/vm/vm_debug.go:156.3,157.14 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:158.3,160.14 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:161.3,163.14 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:164.3,171.52 6 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:173.3,174.25 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:175.3,178.25 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:179.3,182.21 2 9 -github.com/ethereum/go-ethereum/vm/vm_debug.go:184.3,190.65 5 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:201.4,201.46 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:202.3,204.23 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:205.3,207.52 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:208.3,211.52 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:212.3,214.51 2 10 -github.com/ethereum/go-ethereum/vm/vm_debug.go:215.3,218.69 2 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:219.3,224.69 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:225.3,228.69 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:229.3,232.69 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:233.3,236.82 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:237.3,245.37 6 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:246.3,250.82 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:190.65,193.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:193.6,193.73 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:193.73,197.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:197.6,200.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:253.39,258.50 4 12 -github.com/ethereum/go-ethereum/vm/vm_debug.go:258.50,266.5 5 6 -github.com/ethereum/go-ethereum/vm/vm_debug.go:273.27,281.4 4 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:285.3,295.20 6 9 -github.com/ethereum/go-ethereum/vm/vm_debug.go:296.3,306.20 6 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:307.3,317.20 6 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:318.3,322.32 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:326.4,330.20 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:331.3,336.32 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:351.4,352.20 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:353.3,358.32 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:364.4,367.20 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:368.3,373.32 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:388.4,389.20 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:391.3,402.20 6 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:403.3,405.17 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:422.3,428.20 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:429.3,433.20 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:438.3,443.20 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:449.3,453.26 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:458.3,463.20 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:469.3,474.21 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:479.3,481.35 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:488.3,492.30 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:493.3,497.29 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:498.3,502.30 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:503.3,506.34 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:514.4,516.20 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:517.3,530.20 8 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:531.3,544.20 8 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:547.3,553.31 4 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:555.3,558.44 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:559.3,566.45 4 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:567.3,572.33 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:573.3,577.33 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:578.3,583.32 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:584.3,591.32 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:598.4,600.34 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:601.3,605.28 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:606.3,614.19 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:621.4,625.72 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:626.3,628.25 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:636.4,639.28 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:640.3,642.25 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:650.4,657.19 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:664.4,668.72 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:669.3,672.40 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:675.3,680.37 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:681.3,686.37 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:687.3,692.33 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:693.3,698.43 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:699.3,704.47 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:705.3,706.35 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:709.3,720.41 8 47 -github.com/ethereum/go-ethereum/vm/vm_debug.go:721.3,722.15 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:723.3,729.151 4 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:732.3,736.62 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:737.3,742.27 5 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:746.4,749.30 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:750.3,755.40 4 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:756.3,761.32 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:762.3,768.42 4 10 -github.com/ethereum/go-ethereum/vm/vm_debug.go:769.3,774.59 4 9 -github.com/ethereum/go-ethereum/vm/vm_debug.go:775.3,780.30 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:784.4,784.59 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:785.3,789.12 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:790.3,793.38 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:799.3,799.17 0 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:800.3,801.18 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:802.3,803.44 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:804.3,805.27 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:807.3,831.18 9 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:844.4,847.23 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:850.3,865.22 8 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:871.4,873.18 3 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:882.4,885.23 2 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:889.3,895.35 4 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:896.3,903.15 4 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:904.3,907.35 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:908.3,914.67 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:322.32,324.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:336.32,338.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:338.6,340.53 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:346.5,348.15 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:340.53,342.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:342.7,344.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:358.32,360.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:360.6,362.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:373.32,375.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:375.6,377.32 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:383.5,385.15 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:377.32,379.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:379.7,381.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:405.17,410.39 5 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:416.5,420.20 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:410.39,412.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:412.7,414.6 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:433.20,435.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:435.6,437.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:443.20,445.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:445.6,447.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:453.26,455.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:455.6,457.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:463.20,465.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:465.6,467.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:474.21,476.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:476.6,478.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:481.35,483.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:483.6,485.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:506.34,510.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:510.6,512.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:591.32,596.5 3 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:614.19,617.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:617.6,617.28 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:617.28,619.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:628.25,632.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:632.6,634.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:642.25,646.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:646.6,648.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:657.19,660.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:660.6,660.28 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:660.28,662.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:729.151,731.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:742.27,744.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:780.30,782.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:793.38,796.13 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:831.18,838.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:838.6,842.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:847.23,849.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:865.22,867.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:867.6,869.5 1 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:873.18,877.5 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:877.6,881.5 2 2 -github.com/ethereum/go-ethereum/vm/vm_debug.go:885.23,887.5 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:921.22,922.51 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:922.51,923.41 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:923.41,926.98 2 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:926.98,928.7 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:929.7,929.29 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:929.29,930.97 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:930.97,932.7 1 0 -github.com/ethereum/go-ethereum/vm/vm_debug.go:940.77,941.31 1 248 -github.com/ethereum/go-ethereum/vm/vm_debug.go:945.2,945.13 1 248 -github.com/ethereum/go-ethereum/vm/vm_debug.go:941.31,943.3 1 248 -github.com/ethereum/go-ethereum/vm/vm_debug.go:948.44,949.31 1 82 -github.com/ethereum/go-ethereum/vm/vm_debug.go:954.2,954.13 1 82 -github.com/ethereum/go-ethereum/vm/vm_debug.go:949.31,952.3 2 82 -github.com/ethereum/go-ethereum/vm/vm_debug.go:957.40,959.2 1 4 -github.com/ethereum/go-ethereum/vm/vm_debug.go:961.34,963.2 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:34.126,46.2 5 4 -github.com/ethereum/go-ethereum/vm/closure.go:49.57,51.14 2 3 -github.com/ethereum/go-ethereum/vm/closure.go:55.2,55.10 1 3 -github.com/ethereum/go-ethereum/vm/closure.go:51.14,53.3 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:58.50,60.2 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:62.39,64.2 1 102 -github.com/ethereum/go-ethereum/vm/closure.go:66.39,67.21 1 102 -github.com/ethereum/go-ethereum/vm/closure.go:71.2,71.10 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:67.21,69.3 1 102 -github.com/ethereum/go-ethereum/vm/closure.go:74.45,75.42 1 11 -github.com/ethereum/go-ethereum/vm/closure.go:79.2,79.24 1 11 -github.com/ethereum/go-ethereum/vm/closure.go:75.42,77.3 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:82.54,83.72 1 47 -github.com/ethereum/go-ethereum/vm/closure.go:87.2,89.34 2 47 -github.com/ethereum/go-ethereum/vm/closure.go:83.72,85.3 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:92.62,94.2 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:96.36,98.2 1 16 -github.com/ethereum/go-ethereum/vm/closure.go:100.82,106.2 3 4 -github.com/ethereum/go-ethereum/vm/closure.go:108.45,113.2 2 4 -github.com/ethereum/go-ethereum/vm/closure.go:115.45,116.24 1 102 -github.com/ethereum/go-ethereum/vm/closure.go:121.2,124.13 3 102 -github.com/ethereum/go-ethereum/vm/closure.go:116.24,118.3 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:128.50,132.2 2 0 -github.com/ethereum/go-ethereum/vm/closure.go:134.47,136.2 1 2 -github.com/ethereum/go-ethereum/vm/closure.go:138.39,140.2 1 0 -github.com/ethereum/go-ethereum/vm/closure.go:142.51,144.2 1 0 -github.com/ethereum/go-ethereum/vm/common.go:46.44,47.30 1 20 -github.com/ethereum/go-ethereum/vm/common.go:51.2,51.33 1 18 -github.com/ethereum/go-ethereum/vm/common.go:47.30,49.3 1 2 -github.com/ethereum/go-ethereum/vm/common.go:55.29,57.2 1 94 -github.com/ethereum/go-ethereum/vm/common.go:60.40,63.59 2 0 -github.com/ethereum/go-ethereum/vm/common.go:67.2,67.12 1 0 -github.com/ethereum/go-ethereum/vm/common.go:63.59,65.3 1 0 -github.com/ethereum/go-ethereum/vm/types.go:328.33,330.19 2 81 -github.com/ethereum/go-ethereum/vm/types.go:334.2,334.12 1 81 -github.com/ethereum/go-ethereum/vm/types.go:330.19,332.3 1 0 -github.com/ethereum/go-ethereum/vm/asm.go:10.48,12.6 2 0 -github.com/ethereum/go-ethereum/vm/asm.go:44.2,44.8 1 0 -github.com/ethereum/go-ethereum/vm/asm.go:12.6,13.50 1 0 -github.com/ethereum/go-ethereum/vm/asm.go:18.3,24.13 4 0 -github.com/ethereum/go-ethereum/vm/asm.go:41.3,41.27 1 0 -github.com/ethereum/go-ethereum/vm/asm.go:13.50,15.4 1 0 -github.com/ethereum/go-ethereum/vm/asm.go:25.3,28.39 3 0 -github.com/ethereum/go-ethereum/vm/asm.go:32.4,33.22 2 0 -github.com/ethereum/go-ethereum/vm/asm.go:36.4,38.31 2 0 -github.com/ethereum/go-ethereum/vm/asm.go:28.39,30.5 1 0 -github.com/ethereum/go-ethereum/vm/asm.go:33.22,35.5 1 0 -github.com/ethereum/go-ethereum/vm/errors.go:12.43,14.2 1 0 -github.com/ethereum/go-ethereum/vm/errors.go:16.42,18.2 1 0 -github.com/ethereum/go-ethereum/vm/errors.go:20.31,23.2 2 2 -github.com/ethereum/go-ethereum/vm/errors.go:29.40,31.2 1 0 -github.com/ethereum/go-ethereum/vm/errors.go:33.39,35.2 1 0 -github.com/ethereum/go-ethereum/vm/errors.go:37.30,40.2 2 0 -github.com/ethereum/go-ethereum/vm/errors.go:44.39,46.2 1 0 -github.com/ethereum/go-ethereum/vm/errors.go:48.33,51.2 2 2 -github.com/ethereum/go-ethereum/vm/analysis.go:9.63,14.50 4 3 -github.com/ethereum/go-ethereum/vm/analysis.go:34.2,34.8 1 3 -github.com/ethereum/go-ethereum/vm/analysis.go:14.50,16.13 2 117 -github.com/ethereum/go-ethereum/vm/analysis.go:17.3,19.33 2 61 -github.com/ethereum/go-ethereum/vm/analysis.go:23.4,24.13 2 61 -github.com/ethereum/go-ethereum/vm/analysis.go:25.3,26.10 1 0 -github.com/ethereum/go-ethereum/vm/analysis.go:30.3,31.14 1 56 -github.com/ethereum/go-ethereum/vm/analysis.go:19.33,21.5 1 61 -github.com/ethereum/go-ethereum/vm/analysis.go:26.10,28.5 1 0 -github.com/ethereum/go-ethereum/vm/environment.go:38.56,39.36 1 0 -github.com/ethereum/go-ethereum/vm/environment.go:43.2,50.12 3 0 -github.com/ethereum/go-ethereum/vm/environment.go:39.36,41.3 1 0 -github.com/ethereum/go-ethereum/wire/client_identity.go:21.118,31.2 2 1 -github.com/ethereum/go-ethereum/wire/client_identity.go:33.39,34.2 0 0 -github.com/ethereum/go-ethereum/wire/client_identity.go:36.48,38.33 2 2 -github.com/ethereum/go-ethereum/wire/client_identity.go:42.2,47.20 1 2 -github.com/ethereum/go-ethereum/wire/client_identity.go:38.33,40.3 1 2 -github.com/ethereum/go-ethereum/wire/client_identity.go:50.77,52.2 1 1 -github.com/ethereum/go-ethereum/wire/client_identity.go:54.61,56.2 1 2 -github.com/ethereum/go-ethereum/wire/messages2.go:23.37,25.2 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:28.37,29.36 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:33.2,36.12 3 0 -github.com/ethereum/go-ethereum/wire/messages2.go:29.36,31.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:43.68,47.26 3 0 -github.com/ethereum/go-ethereum/wire/messages2.go:58.2,67.16 6 0 -github.com/ethereum/go-ethereum/wire/messages2.go:71.2,71.12 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:47.26,48.59 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:48.59,50.4 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:50.5,50.50 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:50.50,52.4 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:52.5,54.4 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:67.16,69.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:74.101,75.20 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:79.2,79.20 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:84.2,84.46 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:88.2,90.40 3 0 -github.com/ethereum/go-ethereum/wire/messages2.go:94.2,106.8 6 0 -github.com/ethereum/go-ethereum/wire/messages2.go:75.20,77.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:79.20,81.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:84.46,86.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:90.40,92.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:112.52,114.15 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:122.2,124.6 3 0 -github.com/ethereum/go-ethereum/wire/messages2.go:149.2,151.78 3 0 -github.com/ethereum/go-ethereum/wire/messages2.go:159.2,159.8 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:114.15,115.31 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:115.31,117.4 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:124.6,131.27 4 0 -github.com/ethereum/go-ethereum/wire/messages2.go:144.3,145.18 2 0 -github.com/ethereum/go-ethereum/wire/messages2.go:131.27,132.28 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:132.28,135.5 2 0 -github.com/ethereum/go-ethereum/wire/messages2.go:135.6,136.10 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:140.5,140.20 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:140.20,141.9 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:151.78,154.17 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:154.17,156.4 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:162.82,163.20 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:167.2,167.20 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:172.2,172.46 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:176.2,178.40 3 0 -github.com/ethereum/go-ethereum/wire/messages2.go:182.2,194.8 6 0 -github.com/ethereum/go-ethereum/wire/messages2.go:163.20,165.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:167.20,169.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:172.46,174.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:178.40,180.3 1 0 -github.com/ethereum/go-ethereum/wire/messages2.go:197.50,199.2 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:62.35,64.2 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:72.57,77.2 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:84.59,86.15 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:92.2,98.6 2 0 -github.com/ethereum/go-ethereum/wire/messaging.go:145.2,145.29 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:155.2,155.8 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:86.15,87.31 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:87.31,89.4 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:98.6,104.27 4 0 -github.com/ethereum/go-ethereum/wire/messaging.go:113.3,113.31 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:120.3,121.21 2 0 -github.com/ethereum/go-ethereum/wire/messaging.go:134.3,134.29 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:104.27,105.28 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:105.28,108.5 2 0 -github.com/ethereum/go-ethereum/wire/messaging.go:108.6,109.10 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:113.31,117.12 2 0 -github.com/ethereum/go-ethereum/wire/messaging.go:121.21,123.48 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:128.4,131.19 2 0 -github.com/ethereum/go-ethereum/wire/messaging.go:123.48,125.5 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:134.29,139.22 4 0 -github.com/ethereum/go-ethereum/wire/messaging.go:139.22,140.10 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:145.29,153.3 4 0 -github.com/ethereum/go-ethereum/wire/messaging.go:160.50,174.16 7 0 -github.com/ethereum/go-ethereum/wire/messaging.go:178.2,178.12 1 0 -github.com/ethereum/go-ethereum/wire/messaging.go:174.16,176.3 1 0 -- cgit v1.2.3 From 7a79428278412ab1f73708af51bce063b000b7a7 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 12:05:59 -0600 Subject: Update cover command installation --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 923827e7c..cffd864ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - go get code.google.com/p/go.tools/cmd/goimports - go get github.com/golang/lint/golint # - go get golang.org/x/tools/cmd/vet - - go get golang.org/x/tools/cmd/cover + - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - go get github.com/mattn/goveralls - ./install_deps.sh before_script: -- cgit v1.2.3 From 7ddebd7a7593a00b80757f3239f32099755405ca Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 13:21:24 -0600 Subject: Exclude VM tests --- gocoverage.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gocoverage.sh b/gocoverage.sh index 35038108b..12a4c93cc 100755 --- a/gocoverage.sh +++ b/gocoverage.sh @@ -13,7 +13,10 @@ for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d) do if ls $dir/*.go &> /dev/null; then # echo $dir - go test -covermode=count -coverprofile=$dir/profile.tmp $dir + if [[ $dir != "./tests/vm" ]] + then + go test -covermode=count -coverprofile=$dir/profile.tmp $dir + fi if [ -f $dir/profile.tmp ] then cat $dir/profile.tmp | tail -n +2 >> profile.cov -- cgit v1.2.3 From f7ec759ef03ac900f129536a1c101050b3623127 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 13:34:48 -0600 Subject: inline dependency installation script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cffd864ab..3f12f15b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ install: # - go get golang.org/x/tools/cmd/vet - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - go get github.com/mattn/goveralls - - ./install_deps.sh + - ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get $ETH_DEPS; fi before_script: - gofmt -l -w . - goimports -l -w . -- cgit v1.2.3 From 03dc6ec0d42171c1642430baaf8881bb59de3d8f Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 13:46:06 -0600 Subject: Update travis go version to tip --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3f12f15b1..a80338bc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.3 + - tip before_install: - sudo add-apt-repository ppa:ubuntu-sdk-team/ppa -y - sudo apt-get update -qq -- cgit v1.2.3 From 26bf95731ba7a469e13d996f291795a817cff480 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 14:31:19 -0600 Subject: Use repo default branches --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f37ce892..82ce9f7fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,14 +25,14 @@ RUN apt-get install -y qtbase5-private-dev qtdeclarative5-private-dev libqt5open ## Fetch and install serpent-go RUN go get -v -d github.com/ethereum/serpent-go WORKDIR $GOPATH/src/github.com/ethereum/serpent-go -RUN git checkout master +# RUN git checkout master RUN git submodule update --init RUN go install -v # Fetch and install go-ethereum RUN go get -v -d github.com/ethereum/go-ethereum/... WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum -RUN git checkout poc8 +# RUN git checkout develop RUN ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get $ETH_DEPS; fi RUN go install -v ./cmd/ethereum -- cgit v1.2.3 From 05da381c15bed6f46c6ee54e9f8bdfc6c2bb6f64 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 14:36:13 -0600 Subject: Add coveralls coverage badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 564e5c56d..c54a555cb 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Ethereum [![Build Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](http://build.ethdev.com:8010/builders/Linux%20Go%20master%20branch/builds/-1) master [![Build Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](http://build.ethdev.com:8010/builders/Linux%20Go%20develop%20branch/builds/-1) develop +[![Coverage Status](https://coveralls.io/repos/ethereum/go-ethereum/badge.png?branch=tests)](https://coveralls.io/r/ethereum/go-ethereum?branch=tests) tests Ethereum Go Client © 2014 Jeffrey Wilcke. -- cgit v1.2.3 From 43bf3b4a783e53e5954d9aa19b1423dbfed85029 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 14:46:32 -0600 Subject: Move goveralls call to script --- .travis.yml | 2 +- gocoverage.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a80338bc3..21c15068b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_script: # - go vet ./... # - go test -race ./... script: - - ./gocoverage.sh && goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN + - ./gocoverage.sh env: - secure: "U2U1AmkU4NJBgKR/uUAebQY87cNL0+1JHjnLOmmXwxYYyj5ralWb1aSuSH3qSXiT93qLBmtaUkuv9fberHVqrbAeVlztVdUsKAq7JMQH+M99iFkC9UiRMqHmtjWJ0ok4COD1sRYixxi21wb/JrMe3M1iL4QJVS61iltjHhVdM64=" diff --git a/gocoverage.sh b/gocoverage.sh index 12a4c93cc..24c8e9280 100755 --- a/gocoverage.sh +++ b/gocoverage.sh @@ -29,4 +29,4 @@ go tool cover -func profile.cov # To submit the test coverage result to coveralls.io, # use goveralls (https://github.com/mattn/goveralls) -# goveralls -coverprofile=profile.cov -service=travis-ci +goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN -- cgit v1.2.3 From 4fd4facf35dc8a2f273fd5e4acacf5c62baa0de2 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 21 Dec 2014 14:54:51 -0600 Subject: Remove old file --- install_deps.sh | 8 -------- 1 file changed, 8 deletions(-) delete mode 100755 install_deps.sh diff --git a/install_deps.sh b/install_deps.sh deleted file mode 100755 index 73a313324..000000000 --- a/install_deps.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e - -TEST_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g') -if [ "$TEST_DEPS" ]; then - go get -race $TEST_DEPS -fi -- cgit v1.2.3 From 8130df63caa719831aeb05f56683ea7439f4af0e Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 22 Dec 2014 10:58:28 +0100 Subject: updated whisper ui --- cmd/mist/assets/qml/views/whisper.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/mist/assets/qml/views/whisper.qml b/cmd/mist/assets/qml/views/whisper.qml index b43ea4f8b..80d401301 100644 --- a/cmd/mist/assets/qml/views/whisper.qml +++ b/cmd/mist/assets/qml/views/whisper.qml @@ -25,7 +25,7 @@ Rectangle { } function onMessage(message) { - whisperModel.insert(0, {data: JSON.stringify({from: message.from, payload: eth.toAscii(message.payload)})}) + whisperModel.insert(0, {from: message.from, payload: eth.toAscii(message.payload)}) } RowLayout { @@ -66,7 +66,8 @@ Rectangle { left: parent.left right: parent.right } - TableViewColumn{ role: "data" ; title: "Data" ; width: parent.width - 2 } + TableViewColumn{ id: fromRole; role: "from" ; title: "From"; width: 300 } + TableViewColumn{ role: "payload" ; title: "Payload" ; width: parent.width - fromRole.width - 2 } model: ListModel { id: whisperModel -- cgit v1.2.3 From a153b47c2be80bbfb38954c5eae310305d54120b Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 22 Dec 2014 11:56:34 +0100 Subject: moved --- cmd/mist/assets/qml/browser.qml | 414 ++++++++++++++++++++++++++++++++++++++++ cmd/mist/assets/qml/main.qml | 2 +- cmd/mist/assets/qml/webapp.qml | 413 --------------------------------------- 3 files changed, 415 insertions(+), 414 deletions(-) create mode 100644 cmd/mist/assets/qml/browser.qml delete mode 100644 cmd/mist/assets/qml/webapp.qml diff --git a/cmd/mist/assets/qml/browser.qml b/cmd/mist/assets/qml/browser.qml new file mode 100644 index 000000000..26fef0377 --- /dev/null +++ b/cmd/mist/assets/qml/browser.qml @@ -0,0 +1,414 @@ +import QtQuick 2.0 +import QtWebKit 3.0 +import QtWebKit.experimental 1.0 +import QtQuick.Controls 1.0; +import QtQuick.Controls.Styles 1.0 +import QtQuick.Layouts 1.0; +import QtQuick.Window 2.1; +import Ethereum 1.0 + +Rectangle { + id: window + property var title: "Browser" + property var iconSource: "../browser.png" + property var menuItem + + property alias url: webview.url + property alias webView: webview + + property var cleanPath: false + property var open: function(url) { + if(!window.cleanPath) { + var uri = url; + if(!/.*\:\/\/.*/.test(uri)) { + uri = "http://" + uri; + } + + var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/ + + if(reg.test(uri)) { + uri.replace(reg, function(match, pre, domain, path) { + uri = pre; + + var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4)); + var ip = []; + for(var i = 0, l = lookup.length; i < l; i++) { + ip.push(lookup.charCodeAt(i)) + } + + if(ip.length != 0) { + uri += lookup; + } else { + uri += domain; + } + + uri += path; + }); + } + + window.cleanPath = true; + + webview.url = uri; + + //uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2$3"); + uriNav.text = uri; + } else { + // Prevent inf loop. + window.cleanPath = false; + } + } + + Component.onCompleted: { + //webview.url = "http://etherian.io" + webview.url = "file:///Users/jeffrey/test.html" + } + + signal messages(var messages, int id); + onMessages: { + // Bit of a cheat to get proper JSON + var m = JSON.parse(JSON.parse(JSON.stringify(messages))) + webview.postEvent("messages", [m, id]); + } + + Item { + objectName: "root" + id: root + anchors.fill: parent + state: "inspectorShown" + + RowLayout { + id: navBar + height: 40 + anchors { + left: parent.left + right: parent.right + leftMargin: 7 + } + + Button { + id: back + onClicked: { + webview.goBack() + } + style: ButtonStyle { + background: Image { + source: "../back.png" + width: 30 + height: 30 + } + } + } + + TextField { + anchors { + left: back.right + right: toggleInspector.left + leftMargin: 5 + rightMargin: 5 + } + text: "http://etherian.io" + id: uriNav + y: parent.height / 2 - this.height / 2 + + Keys.onReturnPressed: { + webview.url = this.text; + } + } + + Button { + id: toggleInspector + anchors { + right: parent.right + } + iconSource: "../bug.png" + onClicked: { + if(inspector.visible == true){ + inspector.visible = false + }else{ + inspector.visible = true + inspector.url = webview.experimental.remoteInspectorUrl + } + } + } + } + + + WebView { + objectName: "webView" + id: webview + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + top: navBar.bottom + } + + //property var cleanPath: false + onNavigationRequested: { + window.open(request.url.toString()); + } + + function sendMessage(data) { + webview.experimental.postMessage(JSON.stringify(data)) + } + + + experimental.preferences.javascriptEnabled: true + experimental.preferences.navigatorQtObjectEnabled: true + experimental.preferences.developerExtrasEnabled: true + //experimental.userScripts: ["../ext/qt_messaging_adapter.js", "../ext/q.js", "../ext/big.js", "../ext/string.js", "../ext/html_messaging.js"] + experimental.userScripts: ["../ext/q.js", "../ext/eth.js/main.js", "../ext/eth.js/qt.js", "../ext/setup.js"] + experimental.onMessageReceived: { + console.log("[onMessageReceived]: ", message.data) + // TODO move to messaging.js + var data = JSON.parse(message.data) + + try { + switch(data.call) { + case "compile": + postData(data._id, eth.compile(data.args[0])) + break + + case "coinbase": + postData(data._id, eth.coinBase()) + + case "account": + postData(data._id, eth.key().address); + + case "isListening": + postData(data._id, eth.isListening()) + + break + + case "isMining": + postData(data._id, eth.isMining()) + + break + + case "peerCount": + postData(data._id, eth.peerCount()) + + break + + case "countAt": + require(1) + postData(data._id, eth.txCountAt(data.args[0])) + + break + + case "codeAt": + require(1) + var code = eth.codeAt(data.args[0]) + postData(data._id, code); + + break + + case "blockByNumber": + require(1) + var block = eth.blockByNumber(data.args[0]) + postData(data._id, block) + break + + case "blockByHash": + require(1) + var block = eth.blockByHash(data.args[0]) + postData(data._id, block) + break + + require(2) + var block = eth.blockByHash(data.args[0]) + postData(data._id, block.transactions[data.args[1]]) + break + + case "transactionByHash": + case "transactionByNumber": + require(2) + + var block; + if (data.call === "transactionByHash") + block = eth.blockByHash(data.args[0]) + else + block = eth.blockByNumber(data.args[0]) + + var tx = block.transactions.get(data.args[1]) + + postData(data._id, tx) + break + + case "uncleByHash": + case "uncleByNumber": + require(2) + + var block; + if (data.call === "uncleByHash") + block = eth.blockByHash(data.args[0]) + else + block = eth.blockByNumber(data.args[0]) + + var uncle = block.uncles.get(data.args[1]) + + postData(data._id, uncle) + + break + + case "transact": + require(5) + + var tx = eth.transact(data.args) + postData(data._id, tx) + + break + + case "stateAt": + require(2); + + var storage = eth.storageAt(data.args[0], data.args[1]); + postData(data._id, storage) + + break + + case "call": + require(1); + var ret = eth.call(data.args) + postData(data._id, ret) + break + + case "balanceAt": + require(1); + + postData(data._id, eth.balanceAt(data.args[0])); + break + + case "watch": + require(2) + eth.watch(data.args[0], data.args[1]) + + case "disconnect": + require(1) + postData(data._id, null) + break; + + case "messages": + require(1); + + var messages = JSON.parse(eth.getMessages(data.args[0])) + postData(data._id, messages) + break + + case "mutan": + require(1) + + var code = eth.compileMutan(data.args[0]) + postData(data._id, "0x"+code) + break; + + case "newFilterString": + require(1) + var id = eth.newFilterString(data.args[0]) + postData(data._id, id); + break; + + case "newFilter": + require(1) + var id = eth.newFilter(data.args[0]) + + postData(data._id, id); + break; + + case "getMessages": + require(1); + + var messages = eth.messages(data.args[0]); + var m = JSON.parse(JSON.parse(JSON.stringify(messages))) + postData(data._id, m); + + break; + + case "deleteFilter": + require(1); + eth.uninstallFilter(data.args[0]) + break; + } + } catch(e) { + console.log(data.call + ": " + e) + + postData(data._id, null); + } + } + + + function post(seed, data) { + postData(data._id, data) + } + + function require(args, num) { + if(args.length < num) { + throw("required argument count of "+num+" got "+args.length); + } + } + function postData(seed, data) { + webview.experimental.postMessage(JSON.stringify({data: data, _id: seed})) + } + function postEvent(event, data) { + webview.experimental.postMessage(JSON.stringify({data: data, _event: event})) + } + + function onWatchedCb(data, id) { + var messages = JSON.parse(data) + postEvent("watched:"+id, messages) + } + + function onNewBlockCb(block) { + postEvent("block:new", block) + } + function onObjectChangeCb(stateObject) { + postEvent("object:"+stateObject.address(), stateObject) + } + function onStorageChangeCb(storageObject) { + var ev = ["storage", storageObject.stateAddress, storageObject.address].join(":"); + postEvent(ev, [storageObject.address, storageObject.value]) + } + } + + + Rectangle { + id: sizeGrip + color: "gray" + visible: false + height: 10 + anchors { + left: root.left + right: root.right + } + y: Math.round(root.height * 2 / 3) + + MouseArea { + anchors.fill: parent + drag.target: sizeGrip + drag.minimumY: 0 + drag.maximumY: root.height + drag.axis: Drag.YAxis + } + } + + WebView { + id: inspector + visible: false + anchors { + left: root.left + right: root.right + top: sizeGrip.bottom + bottom: root.bottom + } + } + + states: [ + State { + name: "inspectorShown" + PropertyChanges { + target: inspector + } + } + ] + } +} diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 65cea439a..06a7bc2a8 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -45,7 +45,7 @@ ApplicationWindow { // Takes care of loading all default plugins Component.onCompleted: { var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); - var browser = addPlugin("./webapp.qml", {noAdd: true, close: false, section: "ethereum", active: true}); + var browser = addPlugin("./browser.qml", {noAdd: true, close: false, section: "ethereum", active: true}); root.browser = browser; addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); diff --git a/cmd/mist/assets/qml/webapp.qml b/cmd/mist/assets/qml/webapp.qml deleted file mode 100644 index bd7399dc9..000000000 --- a/cmd/mist/assets/qml/webapp.qml +++ /dev/null @@ -1,413 +0,0 @@ -import QtQuick 2.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import QtQuick.Controls 1.0; -import QtQuick.Controls.Styles 1.0 -import QtQuick.Layouts 1.0; -import QtQuick.Window 2.1; -import Ethereum 1.0 - -Rectangle { - id: window - property var title: "Browser" - property var iconSource: "../browser.png" - property var menuItem - - property alias url: webview.url - property alias webView: webview - - property var cleanPath: false - property var open: function(url) { - if(!window.cleanPath) { - var uri = url; - if(!/.*\:\/\/.*/.test(uri)) { - uri = "http://" + uri; - } - - var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/ - - if(reg.test(uri)) { - uri.replace(reg, function(match, pre, domain, path) { - uri = pre; - - var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4)); - var ip = []; - for(var i = 0, l = lookup.length; i < l; i++) { - ip.push(lookup.charCodeAt(i)) - } - - if(ip.length != 0) { - uri += lookup; - } else { - uri += domain; - } - - uri += path; - }); - } - - window.cleanPath = true; - - webview.url = uri; - - //uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2$3"); - uriNav.text = uri; - } else { - // Prevent inf loop. - window.cleanPath = false; - } - } - - Component.onCompleted: { - webview.url = "http://etherian.io" - } - - signal messages(var messages, int id); - onMessages: { - // Bit of a cheat to get proper JSON - var m = JSON.parse(JSON.parse(JSON.stringify(messages))) - webview.postEvent("messages", [m, id]); - } - - Item { - objectName: "root" - id: root - anchors.fill: parent - state: "inspectorShown" - - RowLayout { - id: navBar - height: 40 - anchors { - left: parent.left - right: parent.right - leftMargin: 7 - } - - Button { - id: back - onClicked: { - webview.goBack() - } - style: ButtonStyle { - background: Image { - source: "../back.png" - width: 30 - height: 30 - } - } - } - - TextField { - anchors { - left: back.right - right: toggleInspector.left - leftMargin: 5 - rightMargin: 5 - } - text: "http://etherian.io" - id: uriNav - y: parent.height / 2 - this.height / 2 - - Keys.onReturnPressed: { - webview.url = this.text; - } - } - - Button { - id: toggleInspector - anchors { - right: parent.right - } - iconSource: "../bug.png" - onClicked: { - if(inspector.visible == true){ - inspector.visible = false - }else{ - inspector.visible = true - inspector.url = webview.experimental.remoteInspectorUrl - } - } - } - } - - - WebView { - objectName: "webView" - id: webview - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - top: navBar.bottom - } - - //property var cleanPath: false - onNavigationRequested: { - window.open(request.url.toString()); - } - - function sendMessage(data) { - webview.experimental.postMessage(JSON.stringify(data)) - } - - - experimental.preferences.javascriptEnabled: true - experimental.preferences.navigatorQtObjectEnabled: true - experimental.preferences.developerExtrasEnabled: true - //experimental.userScripts: ["../ext/qt_messaging_adapter.js", "../ext/q.js", "../ext/big.js", "../ext/string.js", "../ext/html_messaging.js"] - experimental.userScripts: ["../ext/q.js", "../ext/eth.js/main.js", "../ext/eth.js/qt.js", "../ext/setup.js"] - experimental.onMessageReceived: { - console.log("[onMessageReceived]: ", message.data) - // TODO move to messaging.js - var data = JSON.parse(message.data) - - try { - switch(data.call) { - case "compile": - postData(data._id, eth.compile(data.args[0])) - break - - case "coinbase": - postData(data._id, eth.coinBase()) - - case "account": - postData(data._id, eth.key().address); - - case "isListening": - postData(data._id, eth.isListening()) - - break - - case "isMining": - postData(data._id, eth.isMining()) - - break - - case "peerCount": - postData(data._id, eth.peerCount()) - - break - - case "countAt": - require(1) - postData(data._id, eth.txCountAt(data.args[0])) - - break - - case "codeAt": - require(1) - var code = eth.codeAt(data.args[0]) - postData(data._id, code); - - break - - case "blockByNumber": - require(1) - var block = eth.blockByNumber(data.args[0]) - postData(data._id, block) - break - - case "blockByHash": - require(1) - var block = eth.blockByHash(data.args[0]) - postData(data._id, block) - break - - require(2) - var block = eth.blockByHash(data.args[0]) - postData(data._id, block.transactions[data.args[1]]) - break - - case "transactionByHash": - case "transactionByNumber": - require(2) - - var block; - if (data.call === "transactionByHash") - block = eth.blockByHash(data.args[0]) - else - block = eth.blockByNumber(data.args[0]) - - var tx = block.transactions.get(data.args[1]) - - postData(data._id, tx) - break - - case "uncleByHash": - case "uncleByNumber": - require(2) - - var block; - if (data.call === "uncleByHash") - block = eth.blockByHash(data.args[0]) - else - block = eth.blockByNumber(data.args[0]) - - var uncle = block.uncles.get(data.args[1]) - - postData(data._id, uncle) - - break - - case "transact": - require(5) - - var tx = eth.transact(data.args) - postData(data._id, tx) - - break - - case "stateAt": - require(2); - - var storage = eth.storageAt(data.args[0], data.args[1]); - postData(data._id, storage) - - break - - case "call": - require(1); - var ret = eth.call(data.args) - postData(data._id, ret) - break - - case "balanceAt": - require(1); - - postData(data._id, eth.balanceAt(data.args[0])); - break - - case "watch": - require(2) - eth.watch(data.args[0], data.args[1]) - - case "disconnect": - require(1) - postData(data._id, null) - break; - - case "messages": - require(1); - - var messages = JSON.parse(eth.getMessages(data.args[0])) - postData(data._id, messages) - break - - case "mutan": - require(1) - - var code = eth.compileMutan(data.args[0]) - postData(data._id, "0x"+code) - break; - - case "newFilterString": - require(1) - var id = eth.newFilterString(data.args[0]) - postData(data._id, id); - break; - - case "newFilter": - require(1) - var id = eth.newFilter(data.args[0]) - - postData(data._id, id); - break; - - case "getMessages": - require(1); - - var messages = eth.messages(data.args[0]); - var m = JSON.parse(JSON.parse(JSON.stringify(messages))) - postData(data._id, m); - - break; - - case "deleteFilter": - require(1); - eth.uninstallFilter(data.args[0]) - break; - } - } catch(e) { - console.log(data.call + ": " + e) - - postData(data._id, null); - } - } - - - function post(seed, data) { - postData(data._id, data) - } - - function require(args, num) { - if(args.length < num) { - throw("required argument count of "+num+" got "+args.length); - } - } - function postData(seed, data) { - webview.experimental.postMessage(JSON.stringify({data: data, _id: seed})) - } - function postEvent(event, data) { - webview.experimental.postMessage(JSON.stringify({data: data, _event: event})) - } - - function onWatchedCb(data, id) { - var messages = JSON.parse(data) - postEvent("watched:"+id, messages) - } - - function onNewBlockCb(block) { - postEvent("block:new", block) - } - function onObjectChangeCb(stateObject) { - postEvent("object:"+stateObject.address(), stateObject) - } - function onStorageChangeCb(storageObject) { - var ev = ["storage", storageObject.stateAddress, storageObject.address].join(":"); - postEvent(ev, [storageObject.address, storageObject.value]) - } - } - - - Rectangle { - id: sizeGrip - color: "gray" - visible: false - height: 10 - anchors { - left: root.left - right: root.right - } - y: Math.round(root.height * 2 / 3) - - MouseArea { - anchors.fill: parent - drag.target: sizeGrip - drag.minimumY: 0 - drag.maximumY: root.height - drag.axis: Drag.YAxis - } - } - - WebView { - id: inspector - visible: false - anchors { - left: root.left - right: root.right - top: sizeGrip.bottom - bottom: root.bottom - } - } - - states: [ - State { - name: "inspectorShown" - PropertyChanges { - target: inspector - } - } - ] - } -} -- cgit v1.2.3 From e42517754ac2912b6d3ca78a34b8aeadf8805906 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 22 Dec 2014 11:57:13 +0100 Subject: updated ethereum.js --- cmd/ethtest/.bowerrc | 5 + cmd/ethtest/.editorconfig | 12 + cmd/ethtest/.gitignore | 18 ++ cmd/ethtest/.jshintrc | 50 ++++ cmd/ethtest/.npmignore | 9 + cmd/ethtest/.travis.yml | 11 + cmd/ethtest/LICENSE | 14 ++ cmd/ethtest/README.md | 79 ++++++ cmd/ethtest/bower.json | 51 ++++ cmd/ethtest/dist/ethereum.js | 20 ++ cmd/ethtest/dist/ethereum.js.map | 29 +++ cmd/ethtest/dist/ethereum.min.js | 1 + cmd/ethtest/example/contract.html | 75 ++++++ cmd/ethtest/example/index.html | 41 ++++ cmd/ethtest/example/node-app.js | 16 ++ cmd/ethtest/gulpfile.js | 123 ++++++++++ cmd/ethtest/index.js | 8 + cmd/ethtest/index_qt.js | 5 + cmd/ethtest/lib/abi.js | 218 +++++++++++++++++ cmd/ethtest/lib/autoprovider.js | 103 ++++++++ cmd/ethtest/lib/contract.js | 65 +++++ cmd/ethtest/lib/httprpc.js | 95 ++++++++ cmd/ethtest/lib/main.js | 494 ++++++++++++++++++++++++++++++++++++++ cmd/ethtest/lib/qt.js | 45 ++++ cmd/ethtest/lib/websocket.js | 78 ++++++ cmd/ethtest/package.json | 67 ++++++ 26 files changed, 1732 insertions(+) create mode 100644 cmd/ethtest/.bowerrc create mode 100644 cmd/ethtest/.editorconfig create mode 100644 cmd/ethtest/.gitignore create mode 100644 cmd/ethtest/.jshintrc create mode 100644 cmd/ethtest/.npmignore create mode 100644 cmd/ethtest/.travis.yml create mode 100644 cmd/ethtest/LICENSE create mode 100644 cmd/ethtest/README.md create mode 100644 cmd/ethtest/bower.json create mode 100644 cmd/ethtest/dist/ethereum.js create mode 100644 cmd/ethtest/dist/ethereum.js.map create mode 100644 cmd/ethtest/dist/ethereum.min.js create mode 100644 cmd/ethtest/example/contract.html create mode 100644 cmd/ethtest/example/index.html create mode 100644 cmd/ethtest/example/node-app.js create mode 100644 cmd/ethtest/gulpfile.js create mode 100644 cmd/ethtest/index.js create mode 100644 cmd/ethtest/index_qt.js create mode 100644 cmd/ethtest/lib/abi.js create mode 100644 cmd/ethtest/lib/autoprovider.js create mode 100644 cmd/ethtest/lib/contract.js create mode 100644 cmd/ethtest/lib/httprpc.js create mode 100644 cmd/ethtest/lib/main.js create mode 100644 cmd/ethtest/lib/qt.js create mode 100644 cmd/ethtest/lib/websocket.js create mode 100644 cmd/ethtest/package.json diff --git a/cmd/ethtest/.bowerrc b/cmd/ethtest/.bowerrc new file mode 100644 index 000000000..c3a8813e8 --- /dev/null +++ b/cmd/ethtest/.bowerrc @@ -0,0 +1,5 @@ +{ + "directory": "example/js/", + "cwd": "./", + "analytics": false +} \ No newline at end of file diff --git a/cmd/ethtest/.editorconfig b/cmd/ethtest/.editorconfig new file mode 100644 index 000000000..60a2751d3 --- /dev/null +++ b/cmd/ethtest/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false \ No newline at end of file diff --git a/cmd/ethtest/.gitignore b/cmd/ethtest/.gitignore new file mode 100644 index 000000000..399b6dc88 --- /dev/null +++ b/cmd/ethtest/.gitignore @@ -0,0 +1,18 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +*.swp +/tmp +*/**/*un~ +*un~ +.DS_Store +*/**/.DS_Store +ethereum/ethereum +ethereal/ethereal +example/js +node_modules +bower_components +npm-debug.log diff --git a/cmd/ethtest/.jshintrc b/cmd/ethtest/.jshintrc new file mode 100644 index 000000000..c0ec5f89d --- /dev/null +++ b/cmd/ethtest/.jshintrc @@ -0,0 +1,50 @@ +{ + "predef": [ + "console", + "require", + "equal", + "test", + "testBoth", + "testWithDefault", + "raises", + "deepEqual", + "start", + "stop", + "ok", + "strictEqual", + "module", + "expect", + "reject", + "impl" + ], + + "esnext": true, + "proto": true, + "node" : true, + "browser" : true, + "browserify" : true, + + "boss" : true, + "curly": false, + "debug": true, + "devel": true, + "eqeqeq": true, + "evil": true, + "forin": false, + "immed": false, + "laxbreak": false, + "newcap": true, + "noarg": true, + "noempty": false, + "nonew": false, + "nomen": false, + "onevar": false, + "plusplus": false, + "regexp": false, + "undef": true, + "sub": true, + "strict": false, + "white": false, + "shadow": true, + "eqnull": true +} \ No newline at end of file diff --git a/cmd/ethtest/.npmignore b/cmd/ethtest/.npmignore new file mode 100644 index 000000000..5bbffe4fd --- /dev/null +++ b/cmd/ethtest/.npmignore @@ -0,0 +1,9 @@ +example/js +node_modules +test +.gitignore +.editorconfig +.travis.yml +.npmignore +component.json +testling.html \ No newline at end of file diff --git a/cmd/ethtest/.travis.yml b/cmd/ethtest/.travis.yml new file mode 100644 index 000000000..fafacbd5a --- /dev/null +++ b/cmd/ethtest/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - "0.11" + - "0.10" +before_script: + - npm install + - npm install jshint +script: + - "jshint *.js lib" +after_script: + - npm run-script gulp diff --git a/cmd/ethtest/LICENSE b/cmd/ethtest/LICENSE new file mode 100644 index 000000000..0f187b873 --- /dev/null +++ b/cmd/ethtest/LICENSE @@ -0,0 +1,14 @@ +This file is part of ethereum.js. + +ethereum.js is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +ethereum.js is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with ethereum.js. If not, see . \ No newline at end of file diff --git a/cmd/ethtest/README.md b/cmd/ethtest/README.md new file mode 100644 index 000000000..865b62c6b --- /dev/null +++ b/cmd/ethtest/README.md @@ -0,0 +1,79 @@ +# Ethereum JavaScript API + +This is the Ethereum compatible JavaScript API using `Promise`s +which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec. It's available on npm as a node module and also for bower and component as an embeddable js + +[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] + + + +## Installation + +### Node.js + + npm install ethereum.js + +### For browser +Bower + + bower install ethereum.js + +Component + + component install ethereum/ethereum.js + +* Include `ethereum.min.js` in your html file. +* Include [es6-promise](https://github.com/jakearchibald/es6-promise) or another ES6-Shim if your browser doesn't support ECMAScript 6. + +## Usage +Require the library: + + var web3 = require('web3'); + +Set a provider (QtProvider, WebSocketProvider, HttpRpcProvider) + + var web3.setProvider(new web3.providers.WebSocketProvider('ws://localhost:40404/eth')); + +There you go, now you can use it: + +``` +web3.eth.coinbase.then(function(result){ + console.log(result); + return web3.eth.balanceAt(result); +}).then(function(balance){ + console.log(web3.toDecimal(balance)); +}).catch(function(err){ + console.log(err); +}); +``` + + +For another example see `example/index.html`. + +## Building + +* `gulp build` + + +### Testing + +**Please note this repo is in it's early stage.** + +If you'd like to run a WebSocket ethereum node check out +[go-ethereum](https://github.com/ethereum/go-ethereum). + +To install ethereum and spawn a node: + +``` +go get github.com/ethereum/go-ethereum/ethereum +ethereum -ws -loglevel=4 +``` + +[npm-image]: https://badge.fury.io/js/ethereum.js.png +[npm-url]: https://npmjs.org/package/ethereum.js +[travis-image]: https://travis-ci.org/ethereum/ethereum.js.svg +[travis-url]: https://travis-ci.org/ethereum/ethereum.js +[dep-image]: https://david-dm.org/ethereum/ethereum.js.svg +[dep-url]: https://david-dm.org/ethereum/ethereum.js +[dep-dev-image]: https://david-dm.org/ethereum/ethereum.js/dev-status.svg +[dep-dev-url]: https://david-dm.org/ethereum/ethereum.js#info=devDependencies \ No newline at end of file diff --git a/cmd/ethtest/bower.json b/cmd/ethtest/bower.json new file mode 100644 index 000000000..cedae9023 --- /dev/null +++ b/cmd/ethtest/bower.json @@ -0,0 +1,51 @@ +{ + "name": "ethereum.js", + "namespace": "ethereum", + "version": "0.0.3", + "description": "Ethereum Compatible JavaScript API", + "main": ["./dist/ethereum.js", "./dist/ethereum.min.js"], + "dependencies": { + "es6-promise": "#master" + }, + "repository": { + "type": "git", + "url": "https://github.com/ethereum/ethereum.js.git" + }, + "homepage": "https://github.com/ethereum/ethereum.js", + "bugs": { + "url": "https://github.com/ethereum/ethereum.js/issues" + }, + "keywords": [ + "ethereum", + "javascript", + "API" + ], + "authors": [ + { + "name": "Marek Kotewicz", + "email": "marek@ethdev.com", + "homepage": "https://github.com/debris" + }, + { + "name": "Marian Oancea", + "email": "marian@ethdev.com", + "homepage": "https://github.com/cubedro" + } + ], + "license": "LGPL-3.0", + "ignore": [ + "example", + "lib", + "node_modules", + "package.json", + ".bowerrc", + ".editorconfig", + ".gitignore", + ".jshintrc", + ".npmignore", + ".travis.yml", + "gulpfile.js", + "index.js", + "**/*.txt" + ] +} \ No newline at end of file diff --git a/cmd/ethtest/dist/ethereum.js b/cmd/ethtest/dist/ethereum.js new file mode 100644 index 000000000..b64c15b9e --- /dev/null +++ b/cmd/ethtest/dist/ethereum.js @@ -0,0 +1,20 @@ +require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;oi&&(code=hex.charCodeAt(i),0!==code);i+=2)str+=String.fromCharCode(parseInt(hex.substr(i,2),16));return str},toDecimal:function(val){return parseInt(val,16)},fromAscii:function(str,pad){pad=void 0===pad?32:pad;for(var hex=this.toHex(str);hex.length<2*pad;)hex+="00";return"0x"+hex},eth:{prototype:Object(),watch:function(params){return new Filter(params,ethWatch)}},db:{prototype:Object()},shh:{prototype:Object(),watch:function(params){return new Filter(params,shhWatch)}},on:function(event,id,cb){return void 0===web3._events[event]&&(web3._events[event]={}),web3._events[event][id]=cb,this},off:function(event,id){return void 0!==web3._events[event]&&delete web3._events[event][id],this},trigger:function(event,id,data){var cb,callbacks=web3._events[event];callbacks&&callbacks[id]&&(cb=callbacks[id])(data)}};setupMethods(web3.eth,ethMethods()),setupProperties(web3.eth,ethProperties()),setupMethods(web3.db,dbMethods()),setupMethods(web3.shh,shhMethods()),ethWatch={changed:"eth_changed"},setupMethods(ethWatch,ethWatchMethods()),shhWatch={changed:"shh_changed"},setupMethods(shhWatch,shhWatchMethods()),ProviderManager=function(){var self,poll;this.queued=[],this.polls=[],this.ready=!1,this.provider=void 0,this.id=1,self=this,(poll=function(){self.provider&&self.provider.poll&&self.polls.forEach(function(data){data.data._id=self.id,self.id++,self.provider.poll(data.data,data.id)}),setTimeout(poll,12e3)})()},ProviderManager.prototype.send=function(data,cb){data._id=this.id,cb&&(web3._callbacks[data._id]=cb),data.args=data.args||[],this.id++,void 0!==this.provider?this.provider.send(data):(console.warn("provider is not set"),this.queued.push(data))},ProviderManager.prototype.set=function(provider){void 0!==this.provider&&void 0!==this.provider.unload&&this.provider.unload(),this.provider=provider,this.ready=!0},ProviderManager.prototype.sendQueued=function(){for(var i=0;this.queued.length;i++)this.send(this.queued[i])},ProviderManager.prototype.installed=function(){return void 0!==this.provider},ProviderManager.prototype.startPolling=function(data,pollId){this.provider&&this.provider.poll&&this.polls.push({data:data,id:pollId})},ProviderManager.prototype.stopPolling=function(pollId){var i,poll;for(i=this.polls.length;i--;)poll=this.polls[i],poll.id===pollId&&this.polls.splice(i,1)},web3.provider=new ProviderManager,web3.setProvider=function(provider){provider.onmessage=messageHandler,web3.provider.set(provider),web3.provider.sendQueued()},web3.haveProvider=function(){return!!web3.provider.provider},Filter=function(options,impl){this.impl=impl,this.callbacks=[];var self=this;this.promise=impl.newFilter(options),this.promise.then(function(id){self.id=id,web3.on(impl.changed,id,self.trigger.bind(self)),web3.provider.startPolling({call:impl.changed,args:[id]},id)})},Filter.prototype.arrived=function(callback){this.changed(callback)},Filter.prototype.changed=function(callback){var self=this;this.promise.then(function(id){self.callbacks.push(callback)})},Filter.prototype.trigger=function(messages){for(var i=0;ii&&(code=hex.charCodeAt(i),0!==code);i+=2)str+=String.fromCharCode(parseInt(hex.substr(i,2),16));return str},toDecimal:function(val){return parseInt(val,16)},fromAscii:function(str,pad){pad=void 0===pad?32:pad;for(var hex=this.toHex(str);hex.length<2*pad;)hex+=\"00\";return\"0x\"+hex},eth:{prototype:Object(),watch:function(params){return new Filter(params,ethWatch)}},db:{prototype:Object()},shh:{prototype:Object(),watch:function(params){return new Filter(params,shhWatch)}},on:function(event,id,cb){return void 0===web3._events[event]&&(web3._events[event]={}),web3._events[event][id]=cb,this},off:function(event,id){return void 0!==web3._events[event]&&delete web3._events[event][id],this},trigger:function(event,id,data){var cb,callbacks=web3._events[event];callbacks&&callbacks[id]&&(cb=callbacks[id])(data)}};setupMethods(web3.eth,ethMethods()),setupProperties(web3.eth,ethProperties()),setupMethods(web3.db,dbMethods()),setupMethods(web3.shh,shhMethods()),ethWatch={changed:\"eth_changed\"},setupMethods(ethWatch,ethWatchMethods()),shhWatch={changed:\"shh_changed\"},setupMethods(shhWatch,shhWatchMethods()),ProviderManager=function(){var self,poll;this.queued=[],this.polls=[],this.ready=!1,this.provider=void 0,this.id=1,self=this,(poll=function(){self.provider&&self.provider.poll&&self.polls.forEach(function(data){data.data._id=self.id,self.id++,self.provider.poll(data.data,data.id)}),setTimeout(poll,12e3)})()},ProviderManager.prototype.send=function(data,cb){data._id=this.id,cb&&(web3._callbacks[data._id]=cb),data.args=data.args||[],this.id++,void 0!==this.provider?this.provider.send(data):(console.warn(\"provider is not set\"),this.queued.push(data))},ProviderManager.prototype.set=function(provider){void 0!==this.provider&&void 0!==this.provider.unload&&this.provider.unload(),this.provider=provider,this.ready=!0},ProviderManager.prototype.sendQueued=function(){for(var i=0;this.queued.length;i++)this.send(this.queued[i])},ProviderManager.prototype.installed=function(){return void 0!==this.provider},ProviderManager.prototype.startPolling=function(data,pollId){this.provider&&this.provider.poll&&this.polls.push({data:data,id:pollId})},ProviderManager.prototype.stopPolling=function(pollId){var i,poll;for(i=this.polls.length;i--;)poll=this.polls[i],poll.id===pollId&&this.polls.splice(i,1)},web3.provider=new ProviderManager,web3.setProvider=function(provider){provider.onmessage=messageHandler,web3.provider.set(provider),web3.provider.sendQueued()},web3.haveProvider=function(){return!!web3.provider.provider},Filter=function(options,impl){this.impl=impl,this.callbacks=[];var self=this;this.promise=impl.newFilter(options),this.promise.then(function(id){self.id=id,web3.on(impl.changed,id,self.trigger.bind(self)),web3.provider.startPolling({call:impl.changed,args:[id]},id)})},Filter.prototype.arrived=function(callback){this.changed(callback)},Filter.prototype.changed=function(callback){var self=this;this.promise.then(function(id){self.callbacks.push(callback)})},Filter.prototype.trigger=function(messages){for(var i=0;ir&&(e=t.charCodeAt(r),0!==e);r+=2)n+=String.fromCharCode(parseInt(t.substr(r,2),16));return n},toDecimal:function(t){return parseInt(t,16)},fromAscii:function(t,e){e=void 0===e?32:e;for(var n=this.toHex(t);n.length<2*e;)n+="00";return"0x"+n},eth:{prototype:Object(),watch:function(t){return new a(t,o)}},db:{prototype:Object()},shh:{prototype:Object(),watch:function(t){return new a(t,i)}},on:function(t,e,n){return void 0===g._events[t]&&(g._events[t]={}),g._events[t][e]=n,this},off:function(t,e){return void 0!==g._events[t]&&delete g._events[t][e],this},trigger:function(t,e,n){var r,o=g._events[t];o&&o[e]&&(r=o[e])(n)}};f(g.eth,u()),v(g.eth,c()),f(g.db,l()),f(g.shh,h()),o={changed:"eth_changed"},f(o,p()),i={changed:"shh_changed"},f(i,d()),s=function(){var t,e;this.queued=[],this.polls=[],this.ready=!1,this.provider=void 0,this.id=1,t=this,(e=function(){t.provider&&t.provider.poll&&t.polls.forEach(function(e){e.data._id=t.id,t.id++,t.provider.poll(e.data,e.id)}),setTimeout(e,12e3)})()},s.prototype.send=function(t,e){t._id=this.id,e&&(g._callbacks[t._id]=e),t.args=t.args||[],this.id++,void 0!==this.provider?this.provider.send(t):(console.warn("provider is not set"),this.queued.push(t))},s.prototype.set=function(t){void 0!==this.provider&&void 0!==this.provider.unload&&this.provider.unload(),this.provider=t,this.ready=!0},s.prototype.sendQueued=function(){for(var t=0;this.queued.length;t++)this.send(this.queued[t])},s.prototype.installed=function(){return void 0!==this.provider},s.prototype.startPolling=function(t,e){this.provider&&this.provider.poll&&this.polls.push({data:t,id:e})},s.prototype.stopPolling=function(t){var e,n;for(e=this.polls.length;e--;)n=this.polls[e],n.id===t&&this.polls.splice(e,1)},g.provider=new s,g.setProvider=function(t){t.onmessage=r,g.provider.set(t),g.provider.sendQueued()},g.haveProvider=function(){return!!g.provider.provider},a=function(t,e){this.impl=e,this.callbacks=[];var n=this;this.promise=e.newFilter(t),this.promise.then(function(t){n.id=t,g.on(e.changed,t,n.trigger.bind(n)),g.provider.startPolling({call:e.changed,args:[t]},t)})},a.prototype.arrived=function(t){this.changed(t)},a.prototype.changed=function(t){var e=this;this.promise.then(function(){e.callbacks.push(t)})},a.prototype.trigger=function(t){for(var e=0;e + + + + + + + + +

contract

+
+
+ +
+ +
+ + + diff --git a/cmd/ethtest/example/index.html b/cmd/ethtest/example/index.html new file mode 100644 index 000000000..d0bf094ef --- /dev/null +++ b/cmd/ethtest/example/index.html @@ -0,0 +1,41 @@ + + + + + + + + + +

coinbase balance

+ +
+
+
+
+ + + diff --git a/cmd/ethtest/example/node-app.js b/cmd/ethtest/example/node-app.js new file mode 100644 index 000000000..f63fa9115 --- /dev/null +++ b/cmd/ethtest/example/node-app.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +require('es6-promise').polyfill(); + +var web3 = require("../index.js"); + +web3.setProvider(new web3.providers.HttpRpcProvider('http://localhost:8080')); + +web3.eth.coinbase.then(function(result){ + console.log(result); + return web3.eth.balanceAt(result); +}).then(function(balance){ + console.log(web3.toDecimal(balance)); +}).catch(function(err){ + console.log(err); +}); \ No newline at end of file diff --git a/cmd/ethtest/gulpfile.js b/cmd/ethtest/gulpfile.js new file mode 100644 index 000000000..9e0717d8b --- /dev/null +++ b/cmd/ethtest/gulpfile.js @@ -0,0 +1,123 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); + +var del = require('del'); +var gulp = require('gulp'); +var browserify = require('browserify'); +var jshint = require('gulp-jshint'); +var uglify = require('gulp-uglify'); +var rename = require('gulp-rename'); +var envify = require('envify/custom'); +var unreach = require('unreachable-branch-transform'); +var source = require('vinyl-source-stream'); +var exorcist = require('exorcist'); +var bower = require('bower'); + +var DEST = './dist/'; + +var build = function(src, dst) { + return browserify({ + debug: true, + insert_global_vars: false, + detectGlobals: false, + bundleExternal: false + }) + .require('./' + src + '.js', {expose: 'web3'}) + .add('./' + src + '.js') + .transform('envify', { + NODE_ENV: 'build' + }) + .transform('unreachable-branch-transform') + .transform('uglifyify', { + mangle: false, + compress: { + dead_code: false, + conditionals: true, + unused: false, + hoist_funs: true, + hoist_vars: true, + negate_iife: false + }, + beautify: true, + warnings: true + }) + .bundle() + .pipe(exorcist(path.join( DEST, dst + '.js.map'))) + .pipe(source(dst + '.js')) + .pipe(gulp.dest( DEST )); +}; + +var buildDev = function(src, dst) { + return browserify({ + debug: true, + insert_global_vars: false, + detectGlobals: false, + bundleExternal: false + }) + .require('./' + src + '.js', {expose: 'web3'}) + .add('./' + src + '.js') + .transform('envify', { + NODE_ENV: 'build' + }) + .transform('unreachable-branch-transform') + .bundle() + .pipe(exorcist(path.join( DEST, dst + '.js.map'))) + .pipe(source(dst + '.js')) + .pipe(gulp.dest( DEST )); +}; + +var uglifyFile = function(file) { + return gulp.src( DEST + file + '.js') + .pipe(uglify()) + .pipe(rename(file + '.min.js')) + .pipe(gulp.dest( DEST )); +}; + +gulp.task('bower', function(cb){ + bower.commands.install().on('end', function (installed){ + console.log(installed); + cb(); + }); +}); + +gulp.task('lint', function(){ + return gulp.src(['./*.js', './lib/*.js']) + .pipe(jshint()) + .pipe(jshint.reporter('default')); +}); + +gulp.task('clean', ['lint'], function(cb) { + del([ DEST ], cb); +}); + +gulp.task('build', ['clean'], function () { + return build('index', 'ethereum'); +}); + +gulp.task('buildQt', ['clean'], function () { + return build('index_qt', 'ethereum'); +}); + +gulp.task('buildDev', ['clean'], function () { + return buildDev('index', 'ethereum'); +}); + +gulp.task('uglify', ['build'], function(){ + return uglifyFile('ethereum'); +}); + +gulp.task('uglifyQt', ['buildQt'], function () { + return uglifyFile('ethereum'); +}); + +gulp.task('watch', function() { + gulp.watch(['./lib/*.js'], ['lint', 'prepare', 'build']); +}); + +gulp.task('default', ['bower', 'lint', 'build', 'uglify']); +gulp.task('qt', ['bower', 'lint', 'buildQt', 'uglifyQt']); +gulp.task('dev', ['bower', 'lint', 'buildDev']); + diff --git a/cmd/ethtest/index.js b/cmd/ethtest/index.js new file mode 100644 index 000000000..c2de7e735 --- /dev/null +++ b/cmd/ethtest/index.js @@ -0,0 +1,8 @@ +var web3 = require('./lib/main'); +web3.providers.WebSocketProvider = require('./lib/websocket'); +web3.providers.HttpRpcProvider = require('./lib/httprpc'); +web3.providers.QtProvider = require('./lib/qt'); +web3.providers.AutoProvider = require('./lib/autoprovider'); +web3.contract = require('./lib/contract'); + +module.exports = web3; diff --git a/cmd/ethtest/index_qt.js b/cmd/ethtest/index_qt.js new file mode 100644 index 000000000..d5e47597e --- /dev/null +++ b/cmd/ethtest/index_qt.js @@ -0,0 +1,5 @@ +var web3 = require('./lib/main'); +web3.providers.QtProvider = require('./lib/qt'); +web3.contract = require('./lib/contract'); + +module.exports = web3; diff --git a/cmd/ethtest/lib/abi.js b/cmd/ethtest/lib/abi.js new file mode 100644 index 000000000..2cff503d3 --- /dev/null +++ b/cmd/ethtest/lib/abi.js @@ -0,0 +1,218 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file abi.js + * @authors: + * Marek Kotewicz + * Gav Wood + * @date 2014 + */ + +// TODO: make these be actually accurate instead of falling back onto JS's doubles. +var hexToDec = function (hex) { + return parseInt(hex, 16).toString(); +}; + +var decToHex = function (dec) { + return parseInt(dec).toString(16); +}; + +var findIndex = function (array, callback) { + var end = false; + var i = 0; + for (; i < array.length && !end; i++) { + end = callback(array[i]); + } + return end ? i - 1 : -1; +}; + +var findMethodIndex = function (json, methodName) { + return findIndex(json, function (method) { + return method.name === methodName; + }); +}; + +var padLeft = function (string, chars) { + return Array(chars - string.length + 1).join("0") + string; +}; + +var setupInputTypes = function () { + var prefixedType = function (prefix) { + return function (type, value) { + var expected = prefix; + if (type.indexOf(expected) !== 0) { + return false; + } + + var padding = parseInt(type.slice(expected.length)) / 8; + if (typeof value === "number") + value = value.toString(16); + else if (value.indexOf('0x') === 0) + value = value.substr(2); + else + value = (+value).toString(16); + return padLeft(value, padding * 2); + }; + }; + + var namedType = function (name, padding, formatter) { + return function (type, value) { + if (type !== name) { + return false; + } + + return padLeft(formatter ? formatter(value) : value, padding * 2); + }; + }; + + var formatBool = function (value) { + return value ? '0x1' : '0x0'; + }; + + return [ + prefixedType('uint'), + prefixedType('int'), + prefixedType('hash'), + namedType('address', 20), + namedType('bool', 1, formatBool), + ]; +}; + +var inputTypes = setupInputTypes(); + +var toAbiInput = function (json, methodName, params) { + var bytes = ""; + var index = findMethodIndex(json, methodName); + + if (index === -1) { + return; + } + + bytes = "0x" + padLeft(index.toString(16), 2); + var method = json[index]; + + for (var i = 0; i < method.inputs.length; i++) { + var found = false; + for (var j = 0; j < inputTypes.length && !found; j++) { + found = inputTypes[j](method.inputs[i].type, params[i]); + } + if (!found) { + console.error('unsupported json type: ' + method.inputs[i].type); + } + bytes += found; + } + return bytes; +}; + +var setupOutputTypes = function () { + var prefixedType = function (prefix) { + return function (type) { + var expected = prefix; + if (type.indexOf(expected) !== 0) { + return -1; + } + + var padding = parseInt(type.slice(expected.length)) / 8; + return padding * 2; + }; + }; + + var namedType = function (name, padding) { + return function (type) { + return name === type ? padding * 2 : -1; + }; + }; + + var formatInt = function (value) { + return value.length <= 8 ? +parseInt(value, 16) : hexToDec(value); + }; + + var formatHash = function (value) { + return "0x" + value; + }; + + var formatBool = function (value) { + return value === '1' ? true : false; + }; + + return [ + { padding: prefixedType('uint'), format: formatInt }, + { padding: prefixedType('int'), format: formatInt }, + { padding: prefixedType('hash'), format: formatHash }, + { padding: namedType('address', 20) }, + { padding: namedType('bool', 1), format: formatBool } + ]; +}; + +var outputTypes = setupOutputTypes(); + +var fromAbiOutput = function (json, methodName, output) { + var index = findMethodIndex(json, methodName); + + if (index === -1) { + return; + } + + output = output.slice(2); + + var result = []; + var method = json[index]; + for (var i = 0; i < method.outputs.length; i++) { + var padding = -1; + for (var j = 0; j < outputTypes.length && padding === -1; j++) { + padding = outputTypes[j].padding(method.outputs[i].type); + } + + if (padding === -1) { + // not found output parsing + continue; + } + var res = output.slice(0, padding); + var formatter = outputTypes[j - 1].format; + result.push(formatter ? formatter(res) : ("0x" + res)); + output = output.slice(padding); + } + + return result; +}; + +var inputParser = function (json) { + var parser = {}; + json.forEach(function (method) { + parser[method.name] = function () { + var params = Array.prototype.slice.call(arguments); + return toAbiInput(json, method.name, params); + }; + }); + + return parser; +}; + +var outputParser = function (json) { + var parser = {}; + json.forEach(function (method) { + parser[method.name] = function (output) { + return fromAbiOutput(json, method.name, output); + }; + }); + + return parser; +}; + +module.exports = { + inputParser: inputParser, + outputParser: outputParser +}; diff --git a/cmd/ethtest/lib/autoprovider.js b/cmd/ethtest/lib/autoprovider.js new file mode 100644 index 000000000..bfbc3ab6e --- /dev/null +++ b/cmd/ethtest/lib/autoprovider.js @@ -0,0 +1,103 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file autoprovider.js + * @authors: + * Marek Kotewicz + * Marian Oancea + * @date 2014 + */ + +/* + * @brief if qt object is available, uses QtProvider, + * if not tries to connect over websockets + * if it fails, it uses HttpRpcProvider + */ + +// TODO: work out which of the following two lines it is supposed to be... +//if (process.env.NODE_ENV !== 'build') { +if ("build" !== 'build') {/* + var WebSocket = require('ws'); // jshint ignore:line + var web3 = require('./main.js'); // jshint ignore:line +*/} + +var AutoProvider = function (userOptions) { + if (web3.haveProvider()) { + return; + } + + // before we determine what provider we are, we have to cache request + this.sendQueue = []; + this.onmessageQueue = []; + + if (navigator.qt) { + this.provider = new web3.providers.QtProvider(); + return; + } + + userOptions = userOptions || {}; + var options = { + httprpc: userOptions.httprpc || 'http://localhost:8080', + websockets: userOptions.websockets || 'ws://localhost:40404/eth' + }; + + var self = this; + var closeWithSuccess = function (success) { + ws.close(); + if (success) { + self.provider = new web3.providers.WebSocketProvider(options.websockets); + } else { + self.provider = new web3.providers.HttpRpcProvider(options.httprpc); + self.poll = self.provider.poll.bind(self.provider); + } + self.sendQueue.forEach(function (payload) { + self.provider(payload); + }); + self.onmessageQueue.forEach(function (handler) { + self.provider.onmessage = handler; + }); + }; + + var ws = new WebSocket(options.websockets); + + ws.onopen = function() { + closeWithSuccess(true); + }; + + ws.onerror = function() { + closeWithSuccess(false); + }; +}; + +AutoProvider.prototype.send = function (payload) { + if (this.provider) { + this.provider.send(payload); + return; + } + this.sendQueue.push(payload); +}; + +Object.defineProperty(AutoProvider.prototype, 'onmessage', { + set: function (handler) { + if (this.provider) { + this.provider.onmessage = handler; + return; + } + this.onmessageQueue.push(handler); + } +}); + +module.exports = AutoProvider; diff --git a/cmd/ethtest/lib/contract.js b/cmd/ethtest/lib/contract.js new file mode 100644 index 000000000..17b077484 --- /dev/null +++ b/cmd/ethtest/lib/contract.js @@ -0,0 +1,65 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file contract.js + * @authors: + * Marek Kotewicz + * @date 2014 + */ + +// TODO: work out which of the following two lines it is supposed to be... +//if (process.env.NODE_ENV !== 'build') { +if ("build" !== 'build') {/* + var web3 = require('./web3'); // jshint ignore:line +*/} +var abi = require('./abi'); + +var contract = function (address, desc) { + var inputParser = abi.inputParser(desc); + var outputParser = abi.outputParser(desc); + + var contract = {}; + + desc.forEach(function (method) { + contract[method.name] = function () { + var params = Array.prototype.slice.call(arguments); + var parsed = inputParser[method.name].apply(null, params); + + var onSuccess = function (result) { + return outputParser[method.name](result); + }; + + return { + call: function (extra) { + extra = extra || {}; + extra.to = address; + extra.data = parsed; + return web3.eth.call(extra).then(onSuccess); + }, + transact: function (extra) { + extra = extra || {}; + extra.to = address; + extra.data = parsed; + return web3.eth.transact(extra).then(onSuccess); + } + }; + }; + }); + + return contract; +}; + +module.exports = contract; diff --git a/cmd/ethtest/lib/httprpc.js b/cmd/ethtest/lib/httprpc.js new file mode 100644 index 000000000..ee6b5c307 --- /dev/null +++ b/cmd/ethtest/lib/httprpc.js @@ -0,0 +1,95 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file httprpc.js + * @authors: + * Marek Kotewicz + * Marian Oancea + * @date 2014 + */ + +// TODO: work out which of the following two lines it is supposed to be... +//if (process.env.NODE_ENV !== 'build') { +if ("build" !== "build") {/* + var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line +*/} + +var HttpRpcProvider = function (host) { + this.handlers = []; + this.host = host; +}; + +function formatJsonRpcObject(object) { + return { + jsonrpc: '2.0', + method: object.call, + params: object.args, + id: object._id + }; +} + +function formatJsonRpcMessage(message) { + var object = JSON.parse(message); + + return { + _id: object.id, + data: object.result, + error: object.error + }; +} + +HttpRpcProvider.prototype.sendRequest = function (payload, cb) { + var data = formatJsonRpcObject(payload); + + var request = new XMLHttpRequest(); + request.open("POST", this.host, true); + request.send(JSON.stringify(data)); + request.onreadystatechange = function () { + if (request.readyState === 4 && cb) { + cb(request); + } + }; +}; + +HttpRpcProvider.prototype.send = function (payload) { + var self = this; + this.sendRequest(payload, function (request) { + self.handlers.forEach(function (handler) { + handler.call(self, formatJsonRpcMessage(request.responseText)); + }); + }); +}; + +HttpRpcProvider.prototype.poll = function (payload, id) { + var self = this; + this.sendRequest(payload, function (request) { + var parsed = JSON.parse(request.responseText); + if (parsed.error || (parsed.result instanceof Array ? parsed.result.length === 0 : !parsed.result)) { + return; + } + self.handlers.forEach(function (handler) { + handler.call(self, {_event: payload.call, _id: id, data: parsed.result}); + }); + }); +}; + +Object.defineProperty(HttpRpcProvider.prototype, "onmessage", { + set: function (handler) { + this.handlers.push(handler); + } +}); + +module.exports = HttpRpcProvider; diff --git a/cmd/ethtest/lib/main.js b/cmd/ethtest/lib/main.js new file mode 100644 index 000000000..59c60cfa8 --- /dev/null +++ b/cmd/ethtest/lib/main.js @@ -0,0 +1,494 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file main.js + * @authors: + * Jeffrey Wilcke + * Marek Kotewicz + * Marian Oancea + * Gav Wood + * @date 2014 + */ + +function flattenPromise (obj) { + if (obj instanceof Promise) { + return Promise.resolve(obj); + } + + if (obj instanceof Array) { + return new Promise(function (resolve) { + var promises = obj.map(function (o) { + return flattenPromise(o); + }); + + return Promise.all(promises).then(function (res) { + for (var i = 0; i < obj.length; i++) { + obj[i] = res[i]; + } + resolve(obj); + }); + }); + } + + if (obj instanceof Object) { + return new Promise(function (resolve) { + var keys = Object.keys(obj); + var promises = keys.map(function (key) { + return flattenPromise(obj[key]); + }); + + return Promise.all(promises).then(function (res) { + for (var i = 0; i < keys.length; i++) { + obj[keys[i]] = res[i]; + } + resolve(obj); + }); + }); + } + + return Promise.resolve(obj); +} + +var web3Methods = function () { + return [ + { name: 'sha3', call: 'web3_sha3' } + ]; +}; + +var ethMethods = function () { + var blockCall = function (args) { + return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber"; + }; + + var transactionCall = function (args) { + return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber'; + }; + + var uncleCall = function (args) { + return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber'; + }; + + var methods = [ + { name: 'balanceAt', call: 'eth_balanceAt' }, + { name: 'stateAt', call: 'eth_stateAt' }, + { name: 'storageAt', call: 'eth_storageAt' }, + { name: 'countAt', call: 'eth_countAt'}, + { name: 'codeAt', call: 'eth_codeAt' }, + { name: 'transact', call: 'eth_transact' }, + { name: 'call', call: 'eth_call' }, + { name: 'block', call: blockCall }, + { name: 'transaction', call: transactionCall }, + { name: 'uncle', call: uncleCall }, + { name: 'compilers', call: 'eth_compilers' }, + { name: 'lll', call: 'eth_lll' }, + { name: 'solidity', call: 'eth_solidity' }, + { name: 'serpent', call: 'eth_serpent' }, + { name: 'logs', call: 'eth_logs' } + ]; + return methods; +}; + +var ethProperties = function () { + return [ + { name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' }, + { name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' }, + { name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' }, + { name: 'gasPrice', getter: 'eth_gasPrice' }, + { name: 'account', getter: 'eth_account' }, + { name: 'accounts', getter: 'eth_accounts' }, + { name: 'peerCount', getter: 'eth_peerCount' }, + { name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' }, + { name: 'number', getter: 'eth_number'} + ]; +}; + +var dbMethods = function () { + return [ + { name: 'put', call: 'db_put' }, + { name: 'get', call: 'db_get' }, + { name: 'putString', call: 'db_putString' }, + { name: 'getString', call: 'db_getString' } + ]; +}; + +var shhMethods = function () { + return [ + { name: 'post', call: 'shh_post' }, + { name: 'newIdentity', call: 'shh_newIdentity' }, + { name: 'haveIdentity', call: 'shh_haveIdentity' }, + { name: 'newGroup', call: 'shh_newGroup' }, + { name: 'addToGroup', call: 'shh_addToGroup' } + ]; +}; + +var ethWatchMethods = function () { + var newFilter = function (args) { + return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter'; + }; + + return [ + { name: 'newFilter', call: newFilter }, + { name: 'uninstallFilter', call: 'eth_uninstallFilter' }, + { name: 'getMessages', call: 'eth_filterLogs' } + ]; +}; + +var shhWatchMethods = function () { + return [ + { name: 'newFilter', call: 'shh_newFilter' }, + { name: 'uninstallFilter', call: 'shh_uninstallFilter' }, + { name: 'getMessage', call: 'shh_getMessages' } + ]; +}; + +var setupMethods = function (obj, methods) { + methods.forEach(function (method) { + obj[method.name] = function () { + return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) { + var call = typeof method.call === "function" ? method.call(args) : method.call; + return {call: call, args: args}; + }).then(function (request) { + return new Promise(function (resolve, reject) { + web3.provider.send(request, function (err, result) { + if (!err) { + resolve(result); + return; + } + reject(err); + }); + }); + }).catch(function(err) { + console.error(err); + }); + }; + }); +}; + +var setupProperties = function (obj, properties) { + properties.forEach(function (property) { + var proto = {}; + proto.get = function () { + return new Promise(function(resolve, reject) { + web3.provider.send({call: property.getter}, function(err, result) { + if (!err) { + resolve(result); + return; + } + reject(err); + }); + }); + }; + if (property.setter) { + proto.set = function (val) { + return flattenPromise([val]).then(function (args) { + return new Promise(function (resolve) { + web3.provider.send({call: property.setter, args: args}, function (err, result) { + if (!err) { + resolve(result); + return; + } + reject(err); + }); + }); + }).catch(function (err) { + console.error(err); + }); + }; + } + Object.defineProperty(obj, property.name, proto); + }); +}; + +// TODO: import from a dependency, don't duplicate. +var hexToDec = function (hex) { + return parseInt(hex, 16).toString(); +}; + +var decToHex = function (dec) { + return parseInt(dec).toString(16); +}; + + +var web3 = { + _callbacks: {}, + _events: {}, + providers: {}, + + toAscii: function(hex) { + // Find termination + var str = ""; + var i = 0, l = hex.length; + if (hex.substring(0, 2) === '0x') + i = 2; + for(; i < l; i+=2) { + var code = hex.charCodeAt(i); + if(code === 0) { + break; + } + + str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); + } + + return str; + }, + + fromAscii: function(str, pad) { + pad = pad === undefined ? 32 : pad; + var hex = this.toHex(str); + while(hex.length < pad*2) + hex += "00"; + return "0x" + hex; + }, + + toDecimal: function (val) { + return hexToDec(val.substring(2)); + }, + + fromDecimal: function (val) { + return "0x" + decToHex(val); + }, + + toEth: function(str) { + var val = typeof str === "string" ? str.indexOf('0x') == 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str; + var unit = 0; + var units = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ]; + while (val > 3000 && unit < units.length - 1) + { + val /= 1000; + unit++; + } + var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2); + while (true) { + var o = s; + s = s.replace(/(\d)(\d\d\d[\.\,])/, function($0, $1, $2) { return $1 + ',' + $2; }); + if (o == s) + break; + } + return s + ' ' + units[unit]; + }, + + eth: { + prototype: Object(), // jshint ignore:line + watch: function (params) { + return new Filter(params, ethWatch); + } + }, + + db: { + prototype: Object() // jshint ignore:line + }, + + shh: { + prototype: Object(), // jshint ignore:line + watch: function (params) { + return new Filter(params, shhWatch); + } + }, + + on: function(event, id, cb) { + if(web3._events[event] === undefined) { + web3._events[event] = {}; + } + + web3._events[event][id] = cb; + return this; + }, + + off: function(event, id) { + if(web3._events[event] !== undefined) { + delete web3._events[event][id]; + } + + return this; + }, + + trigger: function(event, id, data) { + var callbacks = web3._events[event]; + if (!callbacks || !callbacks[id]) { + return; + } + var cb = callbacks[id]; + cb(data); + } +}; + +setupMethods(web3, web3Methods()); +setupMethods(web3.eth, ethMethods()); +setupProperties(web3.eth, ethProperties()); +setupMethods(web3.db, dbMethods()); +setupMethods(web3.shh, shhMethods()); + +var ethWatch = { + changed: 'eth_changed' +}; +setupMethods(ethWatch, ethWatchMethods()); +var shhWatch = { + changed: 'shh_changed' +}; +setupMethods(shhWatch, shhWatchMethods()); + +var ProviderManager = function() { + this.queued = []; + this.polls = []; + this.ready = false; + this.provider = undefined; + this.id = 1; + + var self = this; + var poll = function () { + if (self.provider && self.provider.poll) { + self.polls.forEach(function (data) { + data.data._id = self.id; + self.id++; + self.provider.poll(data.data, data.id); + }); + } + setTimeout(poll, 12000); + }; + poll(); +}; + +ProviderManager.prototype.send = function(data, cb) { + data._id = this.id; + if (cb) { + web3._callbacks[data._id] = cb; + } + + data.args = data.args || []; + this.id++; + + if(this.provider !== undefined) { + this.provider.send(data); + } else { + console.warn("provider is not set"); + this.queued.push(data); + } +}; + +ProviderManager.prototype.set = function(provider) { + if(this.provider !== undefined && this.provider.unload !== undefined) { + this.provider.unload(); + } + + this.provider = provider; + this.ready = true; +}; + +ProviderManager.prototype.sendQueued = function() { + for(var i = 0; this.queued.length; i++) { + // Resend + this.send(this.queued[i]); + } +}; + +ProviderManager.prototype.installed = function() { + return this.provider !== undefined; +}; + +ProviderManager.prototype.startPolling = function (data, pollId) { + if (!this.provider || !this.provider.poll) { + return; + } + this.polls.push({data: data, id: pollId}); +}; + +ProviderManager.prototype.stopPolling = function (pollId) { + for (var i = this.polls.length; i--;) { + var poll = this.polls[i]; + if (poll.id === pollId) { + this.polls.splice(i, 1); + } + } +}; + +web3.provider = new ProviderManager(); + +web3.setProvider = function(provider) { + provider.onmessage = messageHandler; + web3.provider.set(provider); + web3.provider.sendQueued(); +}; + +web3.haveProvider = function() { + return !!web3.provider.provider; +}; + +var Filter = function(options, impl) { + this.impl = impl; + this.callbacks = []; + + var self = this; + this.promise = impl.newFilter(options); + this.promise.then(function (id) { + self.id = id; + web3.on(impl.changed, id, self.trigger.bind(self)); + web3.provider.startPolling({call: impl.changed, args: [id]}, id); + }); +}; + +Filter.prototype.arrived = function(callback) { + this.changed(callback); +}; + +Filter.prototype.changed = function(callback) { + var self = this; + this.promise.then(function(id) { + self.callbacks.push(callback); + }); +}; + +Filter.prototype.trigger = function(messages) { + for(var i = 0; i < this.callbacks.length; i++) { + this.callbacks[i].call(this, messages); + } +}; + +Filter.prototype.uninstall = function() { + var self = this; + this.promise.then(function (id) { + self.impl.uninstallFilter(id); + web3.provider.stopPolling(id); + web3.off(impl.changed, id); + }); +}; + +Filter.prototype.messages = function() { + var self = this; + return this.promise.then(function (id) { + return self.impl.getMessages(id); + }); +}; + +Filter.prototype.logs = function () { + return this.messages(); +}; + +function messageHandler(data) { + if(data._event !== undefined) { + web3.trigger(data._event, data._id, data.data); + return; + } + + if(data._id) { + var cb = web3._callbacks[data._id]; + if (cb) { + cb.call(this, data.error, data.data); + delete web3._callbacks[data._id]; + } + } +} + +module.exports = web3; diff --git a/cmd/ethtest/lib/qt.js b/cmd/ethtest/lib/qt.js new file mode 100644 index 000000000..f02239547 --- /dev/null +++ b/cmd/ethtest/lib/qt.js @@ -0,0 +1,45 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file qt.js + * @authors: + * Jeffrey Wilcke + * Marek Kotewicz + * @date 2014 + */ + +var QtProvider = function() { + this.handlers = []; + + var self = this; + navigator.qt.onmessage = function (message) { + self.handlers.forEach(function (handler) { + handler.call(self, JSON.parse(message.data)); + }); + }; +}; + +QtProvider.prototype.send = function(payload) { + navigator.qt.postMessage(JSON.stringify(payload)); +}; + +Object.defineProperty(QtProvider.prototype, "onmessage", { + set: function(handler) { + this.handlers.push(handler); + } +}); + +module.exports = QtProvider; diff --git a/cmd/ethtest/lib/websocket.js b/cmd/ethtest/lib/websocket.js new file mode 100644 index 000000000..24a072531 --- /dev/null +++ b/cmd/ethtest/lib/websocket.js @@ -0,0 +1,78 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file websocket.js + * @authors: + * Jeffrey Wilcke + * Marek Kotewicz + * Marian Oancea + * @date 2014 + */ + +// TODO: work out which of the following two lines it is supposed to be... +//if (process.env.NODE_ENV !== 'build') { +if ("build" !== "build") {/* + var WebSocket = require('ws'); // jshint ignore:line +*/} + +var WebSocketProvider = function(host) { + // onmessage handlers + this.handlers = []; + // queue will be filled with messages if send is invoked before the ws is ready + this.queued = []; + this.ready = false; + + this.ws = new WebSocket(host); + + var self = this; + this.ws.onmessage = function(event) { + for(var i = 0; i < self.handlers.length; i++) { + self.handlers[i].call(self, JSON.parse(event.data), event); + } + }; + + this.ws.onopen = function() { + self.ready = true; + + for(var i = 0; i < self.queued.length; i++) { + // Resend + self.send(self.queued[i]); + } + }; +}; + +WebSocketProvider.prototype.send = function(payload) { + if(this.ready) { + var data = JSON.stringify(payload); + + this.ws.send(data); + } else { + this.queued.push(payload); + } +}; + +WebSocketProvider.prototype.onMessage = function(handler) { + this.handlers.push(handler); +}; + +WebSocketProvider.prototype.unload = function() { + this.ws.close(); +}; +Object.defineProperty(WebSocketProvider.prototype, "onmessage", { + set: function(provider) { this.onMessage(provider); } +}); + +module.exports = WebSocketProvider; diff --git a/cmd/ethtest/package.json b/cmd/ethtest/package.json new file mode 100644 index 000000000..24141ea2e --- /dev/null +++ b/cmd/ethtest/package.json @@ -0,0 +1,67 @@ +{ + "name": "ethereum.js", + "namespace": "ethereum", + "version": "0.0.5", + "description": "Ethereum Compatible JavaScript API", + "main": "./index.js", + "directories": { + "lib": "./lib" + }, + "dependencies": { + "es6-promise": "*", + "ws": "*", + "xmlhttprequest": "*" + }, + "devDependencies": { + "bower": ">=1.3.0", + "browserify": ">=6.0", + "del": ">=0.1.1", + "envify": "^3.0.0", + "exorcist": "^0.1.6", + "gulp": ">=3.4.0", + "gulp-jshint": ">=1.5.0", + "gulp-rename": ">=1.2.0", + "gulp-uglify": ">=1.0.0", + "jshint": ">=2.5.0", + "uglifyify": "^2.6.0", + "unreachable-branch-transform": "^0.1.0", + "vinyl-source-stream": "^1.0.0" + }, + "scripts": { + "build": "gulp", + "watch": "gulp watch", + "lint": "gulp lint" + }, + "repository": { + "type": "git", + "url": "https://github.com/ethereum/ethereum.js.git" + }, + "homepage": "https://github.com/ethereum/ethereum.js", + "bugs": { + "url": "https://github.com/ethereum/ethereum.js/issues" + }, + "keywords": [ + "ethereum", + "javascript", + "API" + ], + "author": "ethdev.com", + "authors": [ + { + "name": "Jeffery Wilcke", + "email": "jeff@ethdev.com", + "url": "https://github.com/obscuren" + }, + { + "name": "Marek Kotewicz", + "email": "marek@ethdev.com", + "url": "https://github.com/debris" + }, + { + "name": "Marian Oancea", + "email": "marian@ethdev.com", + "url": "https://github.com/cubedro" + } + ], + "license": "LGPL-3.0" +} -- cgit v1.2.3 From 4051c0333f43765a7414a4e0e8ac51e7148b0646 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 22 Dec 2014 13:23:11 +0100 Subject: Added whisper js api --- cmd/mist/assets/qml/browser.qml | 40 +++++++-- cmd/mist/assets/qml/views/whisper.qml | 2 +- cmd/mist/gui.go | 64 +++++++------- cmd/mist/ui_lib.go | 162 ++++++++++++++++------------------ ui/qt/qwhisper/message.go | 4 +- ui/qt/qwhisper/whisper.go | 9 +- whisper/whisper.go | 2 +- 7 files changed, 153 insertions(+), 130 deletions(-) diff --git a/cmd/mist/assets/qml/browser.qml b/cmd/mist/assets/qml/browser.qml index 26fef0377..867260507 100644 --- a/cmd/mist/assets/qml/browser.qml +++ b/cmd/mist/assets/qml/browser.qml @@ -59,15 +59,18 @@ Rectangle { } Component.onCompleted: { - //webview.url = "http://etherian.io" - webview.url = "file:///Users/jeffrey/test.html" + webview.url = "http://etherian.io" } signal messages(var messages, int id); onMessages: { // Bit of a cheat to get proper JSON var m = JSON.parse(JSON.parse(JSON.stringify(messages))) - webview.postEvent("messages", [m, id]); + webview.postEvent("messages", id, m); + } + + function onShhMessage(message, id) { + webview.postEvent("shhChanged", id, message) } Item { @@ -328,6 +331,33 @@ Rectangle { require(1); eth.uninstallFilter(data.args[0]) break; + + + case "shhNewFilter": + require(1); + var id = shh.watch(data.args[0], window); + postData(data._id, id); + break; + + case "newIdentity": + postData(data._id, shh.newIdentity()) + break + + case "post": + require(1); + var params = data.args[0]; + var fields = ["payload", "to", "from"]; + for(var i = 0; i < fields.length; i++) { + params[fields[i]] = params[fields[i]] || ""; + } + if(typeof params.payload === "object") { params.payload = params.payload.join(""); } + params.topics = params.topics || []; + params.priority = params.priority || 1000; + params.ttl = params.ttl || 100; + + console.log(JSON.stringify(params)) + shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl); + break; } } catch(e) { console.log(data.call + ": " + e) @@ -349,8 +379,8 @@ Rectangle { function postData(seed, data) { webview.experimental.postMessage(JSON.stringify({data: data, _id: seed})) } - function postEvent(event, data) { - webview.experimental.postMessage(JSON.stringify({data: data, _event: event})) + function postEvent(event, id, data) { + webview.experimental.postMessage(JSON.stringify({data: data, _id: id, _event: event})) } function onWatchedCb(data, id) { diff --git a/cmd/mist/assets/qml/views/whisper.qml b/cmd/mist/assets/qml/views/whisper.qml index 80d401301..ffe391666 100644 --- a/cmd/mist/assets/qml/views/whisper.qml +++ b/cmd/mist/assets/qml/views/whisper.qml @@ -24,7 +24,7 @@ Rectangle { var t = shh.watch({}, root) } - function onMessage(message) { + function onShhMessage(message, i) { whisperModel.insert(0, {from: message.from, payload: eth.toAscii(message.payload)}) } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e858d7c61..1152f0dcd 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -43,38 +43,6 @@ import ( "gopkg.in/qml.v1" ) -/* -func LoadExtension(path string) (uintptr, error) { - lib, err := ffi.NewLibrary(path) - if err != nil { - return 0, err - } - - so, err := lib.Fct("sharedObject", ffi.Pointer, nil) - if err != nil { - return 0, err - } - - ptr := so() - - err = lib.Close() - if err != nil { - return 0, err - } - - return ptr.Interface().(uintptr), nil -} -*/ -/* - vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") - fmt.Printf("Fetched vec with addr: %#x\n", vec) - if errr != nil { - fmt.Println(errr) - } else { - context.SetVar("vec", (unsafe.Pointer)(vec)) - } -*/ - var guilogger = logger.NewLogger("GUI") type Gui struct { @@ -535,3 +503,35 @@ func (gui *Gui) privateKey() string { func (gui *Gui) address() []byte { return gui.eth.KeyManager().Address() } + +/* +func LoadExtension(path string) (uintptr, error) { + lib, err := ffi.NewLibrary(path) + if err != nil { + return 0, err + } + + so, err := lib.Fct("sharedObject", ffi.Pointer, nil) + if err != nil { + return 0, err + } + + ptr := so() + + err = lib.Close() + if err != nil { + return 0, err + } + + return ptr.Interface().(uintptr), nil +} +*/ +/* + vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") + fmt.Printf("Fetched vec with addr: %#x\n", vec) + if errr != nil { + fmt.Println(errr) + } else { + context.SetVar("vec", (unsafe.Pointer)(vec)) + } +*/ diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index fd4ffcb84..4a92f6479 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -225,6 +225,83 @@ func (self *UiLib) StartDebugger() { dbWindow.Show() } +func (self *UiLib) Transact(params map[string]interface{}) (string, error) { + object := mapToTxParams(params) + + return self.JSXEth.Transact( + object["from"], + object["to"], + object["value"], + object["gas"], + object["gasPrice"], + object["data"], + ) +} + +func (self *UiLib) Compile(code string) (string, error) { + bcode, err := ethutil.Compile(code, false) + if err != nil { + return err.Error(), err + } + + return ethutil.Bytes2Hex(bcode), err +} + +func (self *UiLib) Call(params map[string]interface{}) (string, error) { + object := mapToTxParams(params) + + return self.JSXEth.Execute( + object["to"], + object["value"], + object["gas"], + object["gasPrice"], + object["data"], + ) +} + +func (self *UiLib) AddLocalTransaction(to, data, gas, gasPrice, value string) int { + return self.miner.AddLocalTx(&miner.LocalTx{ + To: ethutil.Hex2Bytes(to), + Data: ethutil.Hex2Bytes(data), + Gas: gas, + GasPrice: gasPrice, + Value: value, + }) - 1 +} + +func (self *UiLib) RemoveLocalTransaction(id int) { + self.miner.RemoveLocalTx(id) +} + +func (self *UiLib) SetGasPrice(price string) { + self.miner.MinAcceptedGasPrice = ethutil.Big(price) +} + +func (self *UiLib) ToggleMining() bool { + if !self.miner.Mining() { + self.miner.Start() + + return true + } else { + self.miner.Stop() + + return false + } +} + +func (self *UiLib) ToHex(data string) string { + return "0x" + ethutil.Bytes2Hex([]byte(data)) +} + +func (self *UiLib) ToAscii(data string) string { + start := 0 + if len(data) > 1 && data[0:2] == "0x" { + start = 2 + } + return string(ethutil.Hex2Bytes(data[start:])) +} + +/// Ethereum filter methods func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { filter := qt.NewFilterFromMap(object, self.eth) filter.MessageCallback = func(messages state.Messages) { @@ -312,88 +389,3 @@ func mapToTxParams(object map[string]interface{}) map[string]string { return conv } - -func (self *UiLib) Transact(params map[string]interface{}) (string, error) { - object := mapToTxParams(params) - - return self.JSXEth.Transact( - object["from"], - object["to"], - object["value"], - object["gas"], - object["gasPrice"], - object["data"], - ) -} - -func (self *UiLib) Compile(code string) (string, error) { - bcode, err := ethutil.Compile(code, false) - if err != nil { - return err.Error(), err - } - - return ethutil.Bytes2Hex(bcode), err -} - -func (self *UiLib) Call(params map[string]interface{}) (string, error) { - object := mapToTxParams(params) - - return self.JSXEth.Execute( - object["to"], - object["value"], - object["gas"], - object["gasPrice"], - object["data"], - ) -} - -func (self *UiLib) AddLocalTransaction(to, data, gas, gasPrice, value string) int { - return self.miner.AddLocalTx(&miner.LocalTx{ - To: ethutil.Hex2Bytes(to), - Data: ethutil.Hex2Bytes(data), - Gas: gas, - GasPrice: gasPrice, - Value: value, - }) - 1 -} - -func (self *UiLib) RemoveLocalTransaction(id int) { - self.miner.RemoveLocalTx(id) -} - -func (self *UiLib) SetGasPrice(price string) { - self.miner.MinAcceptedGasPrice = ethutil.Big(price) -} - -func (self *UiLib) ToggleMining() bool { - if !self.miner.Mining() { - self.miner.Start() - - return true - } else { - self.miner.Stop() - - return false - } -} - -func (self *UiLib) ToHex(data string) string { - return "0x" + ethutil.Bytes2Hex([]byte(data)) -} - -func (self *UiLib) ToAscii(data string) string { - start := 0 - if len(data) > 1 && data[0:2] == "0x" { - start = 2 - } - return string(ethutil.Hex2Bytes(data[start:])) -} - -/* -// XXX Refactor me & MOVE -func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { - return self.filterManager.InstallFilter(filter) -} -func (self *Ethereum) UninstallFilter(id int) { self.filterManager.UninstallFilter(id) } -func (self *Ethereum) GetFilter(id int) *core.Filter { return self.filterManager.GetFilter(id) } -*/ diff --git a/ui/qt/qwhisper/message.go b/ui/qt/qwhisper/message.go index 07505ba09..c87647399 100644 --- a/ui/qt/qwhisper/message.go +++ b/ui/qt/qwhisper/message.go @@ -8,7 +8,7 @@ import ( type Message struct { ref *whisper.Message - Flags byte + Flags int32 Payload string From string } @@ -16,7 +16,7 @@ type Message struct { func ToQMessage(msg *whisper.Message) *Message { return &Message{ ref: msg, - Flags: msg.Flags, + Flags: int32(msg.Flags), Payload: ethutil.Bytes2Hex(msg.Payload), From: ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())), } diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index 6fb00cdac..62676daf5 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -33,9 +33,9 @@ func (self *Whisper) SetView(view qml.Object) { self.view = view } -func (self *Whisper) Post(data string, to, from string, topics []string, pow, ttl uint32) { +func (self *Whisper) Post(data, to, from string, topics []string, priority, ttl uint32) { msg := whisper.NewMessage(fromHex(data)) - envelope, err := msg.Seal(time.Duration(pow), whisper.Opts{ + envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{ Ttl: time.Duration(ttl), To: crypto.ToECDSAPub(fromHex(to)), From: crypto.ToECDSA(fromHex(from)), @@ -64,13 +64,14 @@ func (self *Whisper) HasIdentity(key string) bool { func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int { filter := filterFromMap(opts) + var i int filter.Fn = func(msg *whisper.Message) { if view != nil { - view.Call("onMessage", ToQMessage(msg)) + view.Call("onShhMessage", ToQMessage(msg), i) } } - i := self.Whisper.Watch(filter) + i = self.Whisper.Watch(filter) self.watches[i] = &Watch{} return i diff --git a/whisper/whisper.go b/whisper/whisper.go index 9721ca9f9..ffcdd7d40 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -175,7 +175,7 @@ func (self *Whisper) add(envelope *Envelope) error { if !self.expiry[envelope.Expiry].Has(hash) { self.expiry[envelope.Expiry].Add(hash) - self.postEvent(envelope) + go self.postEvent(envelope) } return nil -- cgit v1.2.3 From e32f7baa0d5d949a84a3b29c57220f837eae356a Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 22 Dec 2014 14:59:52 +0100 Subject: Concat and pad data --- cmd/mist/assets/qml/browser.qml | 5 +++-- cmd/mist/assets/qml/views/whisper.qml | 2 +- ui/qt/qwhisper/whisper.go | 9 +++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cmd/mist/assets/qml/browser.qml b/cmd/mist/assets/qml/browser.qml index 867260507..1425f60c0 100644 --- a/cmd/mist/assets/qml/browser.qml +++ b/cmd/mist/assets/qml/browser.qml @@ -59,7 +59,8 @@ Rectangle { } Component.onCompleted: { - webview.url = "http://etherian.io" + //webview.url = "http://etherian.io" + webview.url = "file:///Users/jeffrey/test.html" } signal messages(var messages, int id); @@ -350,7 +351,7 @@ Rectangle { for(var i = 0; i < fields.length; i++) { params[fields[i]] = params[fields[i]] || ""; } - if(typeof params.payload === "object") { params.payload = params.payload.join(""); } + if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); } params.topics = params.topics || []; params.priority = params.priority || 1000; params.ttl = params.ttl || 100; diff --git a/cmd/mist/assets/qml/views/whisper.qml b/cmd/mist/assets/qml/views/whisper.qml index ffe391666..56c4f1b07 100644 --- a/cmd/mist/assets/qml/views/whisper.qml +++ b/cmd/mist/assets/qml/views/whisper.qml @@ -52,7 +52,7 @@ Rectangle { Button { text: "Send" onClicked: { - shh.post(eth.toHex(data.text), "", identity, topics.text.split(","), 500, 50) + shh.post([eth.toHex(data.text)], "", identity, topics.text.split(","), 500, 50) } } } diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index 62676daf5..0627acd29 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -33,8 +33,13 @@ func (self *Whisper) SetView(view qml.Object) { self.view = view } -func (self *Whisper) Post(data, to, from string, topics []string, priority, ttl uint32) { - msg := whisper.NewMessage(fromHex(data)) +func (self *Whisper) Post(payload []string, to, from string, topics []string, priority, ttl uint32) { + var data []byte + for _, d := range payload { + data = append(data, fromHex(d)...) + } + + msg := whisper.NewMessage(data) envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{ Ttl: time.Duration(ttl), To: crypto.ToECDSAPub(fromHex(to)), -- cgit v1.2.3 From 4b52cd512d3c54451e680fcc6c3d67d059065bec Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 22 Dec 2014 15:01:52 +0100 Subject: Removal of "debug" url :) --- cmd/mist/assets/qml/browser.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/mist/assets/qml/browser.qml b/cmd/mist/assets/qml/browser.qml index 1425f60c0..abaab4f15 100644 --- a/cmd/mist/assets/qml/browser.qml +++ b/cmd/mist/assets/qml/browser.qml @@ -59,8 +59,7 @@ Rectangle { } Component.onCompleted: { - //webview.url = "http://etherian.io" - webview.url = "file:///Users/jeffrey/test.html" + webview.url = "http://etherian.io" } signal messages(var messages, int id); -- cgit v1.2.3 From 4cd79d8ddd7608d60344b13fe4bda7315429d1d9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 13:48:44 +0100 Subject: Refactored block & Transaction * Includes new rlp decoder --- cmd/ethereum/repl/repl.go | 6 - cmd/utils/cmd.go | 2 +- cmd/utils/vm_env.go | 12 +- core/block_manager.go | 86 ++++---- core/chain_manager.go | 134 +++++++------ core/filter.go | 13 +- core/genesis.go | 65 +++--- core/types/block.go | 490 ++++++++++++++++------------------------------ core/types/block_test.go | 23 +++ core/types/transaction.go | 121 ++++++------ core/vm_env.go | 12 +- eth/backend.go | 2 +- eth/protocol.go | 2 +- miner/miner.go | 10 +- pow/block.go | 2 +- pow/ezp/pow.go | 4 +- xeth/js_types.go | 20 +- xeth/pipe.go | 2 +- xeth/vm_env.go | 12 +- 19 files changed, 450 insertions(+), 568 deletions(-) create mode 100644 core/types/block_test.go diff --git a/cmd/ethereum/repl/repl.go b/cmd/ethereum/repl/repl.go index 4a7880ff4..822aaa19d 100644 --- a/cmd/ethereum/repl/repl.go +++ b/cmd/ethereum/repl/repl.go @@ -86,12 +86,6 @@ func (self *JSRepl) Stop() { } func (self *JSRepl) parseInput(code string) { - defer func() { - if r := recover(); r != nil { - fmt.Println("[native] error", r) - } - }() - value, err := self.re.Run(code) if err != nil { fmt.Println(err) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 3e3ac617a..2b24ac532 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -325,7 +325,7 @@ func BlockDo(ethereum *eth.Ethereum, hash []byte) error { return fmt.Errorf("unknown block %x", hash) } - parent := ethereum.ChainManager().GetBlock(block.PrevHash) + parent := ethereum.ChainManager().GetBlock(block.ParentHash()) _, err := ethereum.BlockManager().TransitionState(parent.State(), parent, block) if err != nil { diff --git a/cmd/utils/vm_env.go b/cmd/utils/vm_env.go index 461a797c2..be6249e82 100644 --- a/cmd/utils/vm_env.go +++ b/cmd/utils/vm_env.go @@ -30,15 +30,15 @@ func NewEnv(state *state.StateDB, block *types.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) BlockNumber() *big.Int { return self.block.Number() } +func (self *VMEnv) PrevHash() []byte { return self.block.ParentHash() } +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) GasLimit() *big.Int { return self.block.GasLimit() } func (self *VMEnv) Value() *big.Int { return self.value } func (self *VMEnv) State() *state.StateDB { return self.state } -func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit } func (self *VMEnv) Depth() int { return self.depth } func (self *VMEnv) SetDepth(i int) { self.depth = i } func (self *VMEnv) AddLog(log state.Log) { diff --git a/core/block_manager.go b/core/block_manager.go index b60cecc29..c61cf6504 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -17,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/pow" "github.com/ethereum/go-ethereum/pow/ezp" "github.com/ethereum/go-ethereum/state" + "gopkg.in/fatih/set.v0" ) var statelogger = logger.NewLogger("BLOCK") @@ -82,8 +83,8 @@ func NewBlockManager(txpool *TxPool, chainManager *ChainManager, eventMux *event } func (sm *BlockManager) TransitionState(statedb *state.StateDB, parent, block *types.Block) (receipts types.Receipts, err error) { - coinbase := statedb.GetOrNewStateObject(block.Coinbase) - coinbase.SetGasPool(block.CalcGasLimit(parent)) + coinbase := statedb.GetOrNewStateObject(block.Header().Coinbase) + coinbase.SetGasPool(CalcGasLimit(parent, block)) // Process the transactions on to current block receipts, _, _, _, err = sm.ApplyTransactions(coinbase, statedb, block, block.Transactions(), false) @@ -156,7 +157,7 @@ done: } block.Reward = cumulativeSum - block.GasUsed = totalUsedGas + block.Header().GasUsed = totalUsedGas return receipts, handled, unhandled, erroneous, err } @@ -166,14 +167,15 @@ func (sm *BlockManager) Process(block *types.Block) (td *big.Int, msgs state.Mes sm.mutex.Lock() defer sm.mutex.Unlock() - if sm.bc.HasBlock(block.Hash()) { - return nil, nil, &KnownBlockError{block.Number, block.Hash()} + header := block.Header() + if sm.bc.HasBlock(header.Hash()) { + return nil, nil, &KnownBlockError{header.Number, header.Hash()} } - if !sm.bc.HasBlock(block.PrevHash) { - return nil, nil, ParentError(block.PrevHash) + if !sm.bc.HasBlock(header.ParentHash) { + return nil, nil, ParentError(header.ParentHash) } - parent := sm.bc.GetBlock(block.PrevHash) + parent := sm.bc.GetBlock(header.ParentHash) return sm.ProcessWithParent(block, parent) } @@ -181,7 +183,7 @@ func (sm *BlockManager) Process(block *types.Block) (td *big.Int, msgs state.Mes func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.Int, messages state.Messages, err error) { sm.lastAttemptedBlock = block - state := parent.State().Copy() + state := state.New(parent.Trie().Copy()) // Defer the Undo on the Trie. If the block processing happened // we don't want to undo but since undo only happens on dirty @@ -199,23 +201,23 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I return } + header := block.Header() + rbloom := types.CreateBloom(receipts) - if bytes.Compare(rbloom, block.LogsBloom) != 0 { + if bytes.Compare(rbloom, header.Bloom) != 0 { err = fmt.Errorf("unable to replicate block's bloom=%x", rbloom) return } txSha := types.DeriveSha(block.Transactions()) - if bytes.Compare(txSha, block.TxSha) != 0 { - err = fmt.Errorf("validating transaction root. received=%x got=%x", block.TxSha, txSha) + if bytes.Compare(txSha, header.TxHash) != 0 { + err = fmt.Errorf("validating transaction root. received=%x got=%x", header.TxHash, txSha) return } receiptSha := types.DeriveSha(receipts) - if bytes.Compare(receiptSha, block.ReceiptSha) != 0 { - //chainlogger.Debugf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha) - fmt.Printf("%x\n", ethutil.Encode(receipts)) - err = fmt.Errorf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha) + if bytes.Compare(receiptSha, header.ReceiptHash) != 0 { + err = fmt.Errorf("validating receipt root. received=%x got=%x", header.ReceiptHash, receiptSha) return } @@ -225,8 +227,8 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I state.Update(ethutil.Big0) - if !block.State().Cmp(state) { - err = fmt.Errorf("invalid merkle root. received=%x got=%x", block.Root(), state.Root()) + if !bytes.Equal(header.Root, state.Root()) { + err = fmt.Errorf("invalid merkle root. received=%x got=%x", header.Root, state.Root()) return } @@ -238,7 +240,7 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I messages := state.Manifest().Messages state.Manifest().Reset() - chainlogger.Infof("Processed block #%d (%x...)\n", block.Number, block.Hash()[0:4]) + chainlogger.Infof("Processed block #%d (%x...)\n", header.Number, block.Hash()[0:4]) sm.txpool.RemoveSet(block.Transactions()) @@ -250,14 +252,14 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I func (sm *BlockManager) CalculateTD(block *types.Block) (*big.Int, bool) { uncleDiff := new(big.Int) - for _, uncle := range block.Uncles { + for _, uncle := range block.Uncles() { uncleDiff = uncleDiff.Add(uncleDiff, uncle.Difficulty) } // TD(genesis_block) = 0 and TD(B) = TD(B.parent) + sum(u.difficulty for u in B.uncles) + B.difficulty td := new(big.Int) td = td.Add(sm.bc.Td(), uncleDiff) - td = td.Add(td, block.Difficulty) + td = td.Add(td, block.Header().Difficulty) // The new TD will only be accepted if the new difficulty is // is greater than the previous. @@ -273,13 +275,13 @@ func (sm *BlockManager) CalculateTD(block *types.Block) (*big.Int, bool) { // Validation validates easy over difficult (dagger takes longer time = difficult) func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error { expd := CalcDifficulty(block, parent) - if expd.Cmp(block.Difficulty) < 0 { - return fmt.Errorf("Difficulty check failed for block %v, %v", block.Difficulty, expd) + if expd.Cmp(block.Header().Difficulty) < 0 { + return fmt.Errorf("Difficulty check failed for block %v, %v", block.Header().Difficulty, expd) } - diff := block.Time - parent.Time + diff := block.Header().Time - parent.Header().Time if diff < 0 { - return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Time, sm.bc.CurrentBlock().Time) + return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Header().Time, sm.bc.CurrentBlock().Header().Time) } /* XXX @@ -291,7 +293,7 @@ func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error { // Verify the nonce of the block. Return an error if it's not valid if !sm.Pow.Verify(block /*block.HashNoNonce(), block.Difficulty, block.Nonce*/) { - return ValidationError("Block's nonce is invalid (= %v)", ethutil.Bytes2Hex(block.Nonce)) + return ValidationError("Block's nonce is invalid (= %v)", ethutil.Bytes2Hex(block.Header().Nonce)) } return nil @@ -300,24 +302,28 @@ func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error { func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent *types.Block) error { reward := new(big.Int).Set(BlockReward) - knownUncles := ethutil.Set(parent.Uncles) - nonces := ethutil.NewSet(block.Nonce) - for _, uncle := range block.Uncles { + knownUncles := set.New() + for _, uncle := range parent.Uncles() { + knownUncles.Add(uncle.Hash()) + } + + nonces := ethutil.NewSet(block.Header().Nonce) + for _, uncle := range block.Uncles() { if nonces.Include(uncle.Nonce) { // Error not unique return UncleError("Uncle not unique") } - uncleParent := sm.bc.GetBlock(uncle.PrevHash) + uncleParent := sm.bc.GetBlock(uncle.ParentHash) if uncleParent == nil { - return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.PrevHash[0:4])) + return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4])) } - if uncleParent.Number.Cmp(new(big.Int).Sub(parent.Number, big.NewInt(6))) < 0 { + if uncleParent.Header().Number.Cmp(new(big.Int).Sub(parent.Header().Number, big.NewInt(6))) < 0 { return UncleError("Uncle too old") } - if knownUncles.Include(uncle.Hash()) { + if knownUncles.Has(uncle.Hash()) { return UncleError("Uncle in chain") } @@ -333,15 +339,15 @@ func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent } // Get the account associated with the coinbase - account := statedb.GetAccount(block.Coinbase) + account := statedb.GetAccount(block.Header().Coinbase) // Reward amount of ether to the coinbase address account.AddAmount(reward) statedb.Manifest().AddMessage(&state.Message{ - To: block.Coinbase, + To: block.Header().Coinbase, Input: nil, Origin: nil, - Block: block.Hash(), Timestamp: block.Time, Coinbase: block.Coinbase, Number: block.Number, + Block: block.Hash(), Timestamp: int64(block.Header().Time), Coinbase: block.Header().Coinbase, Number: block.Header().Number, Value: new(big.Int).Add(reward, block.Reward), }) @@ -349,15 +355,15 @@ func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent } func (sm *BlockManager) GetMessages(block *types.Block) (messages []*state.Message, err error) { - if !sm.bc.HasBlock(block.PrevHash) { - return nil, ParentError(block.PrevHash) + if !sm.bc.HasBlock(block.Header().ParentHash) { + return nil, ParentError(block.Header().ParentHash) } sm.lastAttemptedBlock = block var ( - parent = sm.bc.GetBlock(block.PrevHash) - state = parent.State().Copy() + parent = sm.bc.GetBlock(block.Header().ParentHash) + state = state.New(parent.Trie().Copy()) ) defer state.Reset() diff --git a/core/chain_manager.go b/core/chain_manager.go index e6268c01e..e35c4aa3a 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -1,6 +1,7 @@ package core import ( + "bytes" "fmt" "math/big" "sync" @@ -9,11 +10,13 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/state" ) var chainlogger = logger.NewLogger("CHAIN") +/* func AddTestNetFunds(block *types.Block) { for _, addr := range []string{ "51ba59315b3a95761d0863b05ccc7a7f54703d99", @@ -31,20 +34,41 @@ func AddTestNetFunds(block *types.Block) { block.State().UpdateStateObject(account) } } +*/ func CalcDifficulty(block, parent *types.Block) *big.Int { diff := new(big.Int) - adjust := new(big.Int).Rsh(parent.Difficulty, 10) - if block.Time >= parent.Time+5 { - diff.Sub(parent.Difficulty, adjust) + bh, ph := block.Header(), parent.Header() + adjust := new(big.Int).Rsh(ph.Difficulty, 10) + if bh.Time >= ph.Time+5 { + diff.Sub(ph.Difficulty, adjust) } else { - diff.Add(parent.Difficulty, adjust) + diff.Add(ph.Difficulty, adjust) } return diff } +func CalcGasLimit(parent, block *types.Block) *big.Int { + if block.Number().Cmp(big.NewInt(0)) == 0 { + return ethutil.BigPow(10, 6) + } + + // ((1024-1) * parent.gasLimit + (gasUsed * 6 / 5)) / 1024 + + previous := new(big.Int).Mul(big.NewInt(1024-1), parent.GasLimit()) + current := new(big.Rat).Mul(new(big.Rat).SetInt(parent.GasUsed()), big.NewRat(6, 5)) + curInt := new(big.Int).Div(current.Num(), current.Denom()) + + result := new(big.Int).Add(previous, curInt) + result.Div(result, big.NewInt(1024)) + + min := big.NewInt(125000) + + return ethutil.BigMax(min, result) +} + type ChainManager struct { //eth EthManager processor types.BlockProcessor @@ -90,7 +114,7 @@ func (self *ChainManager) CurrentBlock() *types.Block { func NewChainManager(mux *event.TypeMux) *ChainManager { bc := &ChainManager{} - bc.genesisBlock = types.NewBlockFromBytes(ethutil.Encode(Genesis)) + bc.genesisBlock = GenesisBlock() bc.eventMux = mux bc.setLastBlock() @@ -112,7 +136,7 @@ func (self *ChainManager) SetProcessor(proc types.BlockProcessor) { } func (self *ChainManager) State() *state.StateDB { - return self.CurrentBlock().State() + return state.New(self.CurrentBlock().Trie()) } func (self *ChainManager) TransState() *state.StateDB { @@ -122,13 +146,11 @@ func (self *ChainManager) TransState() *state.StateDB { func (bc *ChainManager) setLastBlock() { data, _ := ethutil.Config.Db.Get([]byte("LastBlock")) if len(data) != 0 { - // Prep genesis - AddTestNetFunds(bc.genesisBlock) - - block := types.NewBlockFromBytes(data) - bc.currentBlock = block + var block types.Block + rlp.Decode(bytes.NewReader(data), &block) + bc.currentBlock = &block bc.lastBlockHash = block.Hash() - bc.lastBlockNumber = block.Number.Uint64() + bc.lastBlockNumber = block.Header().Number.Uint64() // Set the last know difficulty (might be 0x0 as initial value, Genesis) bc.td = ethutil.BigD(ethutil.Config.Db.LastKnownTD()) @@ -144,27 +166,28 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block { bc.mu.RLock() defer bc.mu.RUnlock() - var root interface{} - hash := ZeroHash256 + var root []byte + parentHash := ZeroHash256 if bc.CurrentBlock != nil { - root = bc.currentBlock.Root() - hash = bc.lastBlockHash + root = bc.currentBlock.Header().Root + parentHash = bc.lastBlockHash } - block := types.CreateBlock( - root, - hash, + block := types.NewBlock( + parentHash, coinbase, + root, ethutil.BigPow(2, 32), nil, "") parent := bc.currentBlock if parent != nil { - block.Difficulty = CalcDifficulty(block, parent) - block.Number = new(big.Int).Add(bc.currentBlock.Number, ethutil.Big1) - block.GasLimit = block.CalcGasLimit(bc.currentBlock) + header := block.Header() + header.Difficulty = CalcDifficulty(block, parent) + header.Number = new(big.Int).Add(parent.Header().Number, ethutil.Big1) + header.GasLimit = CalcGasLimit(parent, block) } @@ -175,9 +198,6 @@ func (bc *ChainManager) Reset() { bc.mu.Lock() defer bc.mu.Unlock() - AddTestNetFunds(bc.genesisBlock) - - bc.genesisBlock.Trie().Sync() // Prepare the genesis block bc.write(bc.genesisBlock) bc.insert(bc.genesisBlock) @@ -193,18 +213,20 @@ func (self *ChainManager) Export() []byte { self.mu.RLock() defer self.mu.RUnlock() - chainlogger.Infof("exporting %v blocks...\n", self.currentBlock.Number) + chainlogger.Infof("exporting %v blocks...\n", self.currentBlock.Header().Number) - blocks := make([]*types.Block, int(self.currentBlock.Number.Int64())+1) - for block := self.currentBlock; block != nil; block = self.GetBlock(block.PrevHash) { - blocks[block.Number.Int64()] = block + blocks := make([]*types.Block, int(self.currentBlock.NumberU64())+1) + for block := self.currentBlock; block != nil; block = self.GetBlock(block.Header().ParentHash) { + blocks[block.NumberU64()] = block } + //fmt.Println(blocks) + return nil return ethutil.Encode(blocks) } func (bc *ChainManager) insert(block *types.Block) { - encodedBlock := block.RlpEncode() + encodedBlock := ethutil.Encode(block) ethutil.Config.Db.Put([]byte("LastBlock"), encodedBlock) bc.currentBlock = block bc.lastBlockHash = block.Hash() @@ -213,7 +235,7 @@ func (bc *ChainManager) insert(block *types.Block) { func (bc *ChainManager) write(block *types.Block) { bc.writeBlockInfo(block) - encodedBlock := block.RlpEncode() + encodedBlock := ethutil.Encode(block) ethutil.Config.Db.Put(block.Hash(), encodedBlock) } @@ -238,11 +260,11 @@ func (self *ChainManager) GetBlockHashesFromHash(hash []byte, max uint64) (chain for i := uint64(0); i < max; i++ { chain = append(chain, block.Hash()) - if block.Number.Cmp(ethutil.Big0) <= 0 { + if block.Header().Number.Cmp(ethutil.Big0) <= 0 { break } - block = self.GetBlock(block.PrevHash) + block = self.GetBlock(block.Header().ParentHash) } return @@ -253,8 +275,13 @@ func (self *ChainManager) GetBlock(hash []byte) *types.Block { if len(data) == 0 { return nil } + var block types.Block + if err := rlp.Decode(bytes.NewReader(data), &block); err != nil { + fmt.Println(err) + return nil + } - return types.NewBlockFromBytes(data) + return &block } func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block { @@ -262,13 +289,13 @@ func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block { defer self.mu.RUnlock() block := self.currentBlock - for ; block != nil; block = self.GetBlock(block.PrevHash) { - if block.Number.Uint64() == num { + for ; block != nil; block = self.GetBlock(block.Header().ParentHash) { + if block.Header().Number.Uint64() == num { break } } - if block != nil && block.Number.Uint64() == 0 && num != 0 { + if block != nil && block.Header().Number.Uint64() == 0 && num != 0 { return nil } @@ -281,40 +308,28 @@ func (bc *ChainManager) setTotalDifficulty(td *big.Int) { } func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) { - parent := self.GetBlock(block.PrevHash) + parent := self.GetBlock(block.Header().ParentHash) if parent == nil { - return nil, fmt.Errorf("Unable to calculate total diff without known parent %x", block.PrevHash) + return nil, fmt.Errorf("Unable to calculate total diff without known parent %x", block.Header().ParentHash) } - parentTd := parent.BlockInfo().TD + parentTd := parent.Td uncleDiff := new(big.Int) - for _, uncle := range block.Uncles { + for _, uncle := range block.Uncles() { uncleDiff = uncleDiff.Add(uncleDiff, uncle.Difficulty) } td := new(big.Int) td = td.Add(parentTd, uncleDiff) - td = td.Add(td, block.Difficulty) + td = td.Add(td, block.Header().Difficulty) return td, nil } -func (bc *ChainManager) BlockInfo(block *types.Block) types.BlockInfo { - bi := types.BlockInfo{} - data, _ := ethutil.Config.Db.Get(append(block.Hash(), []byte("Info")...)) - bi.RlpDecode(data) - - return bi -} - // Unexported method for writing extra non-essential block info to the db func (bc *ChainManager) writeBlockInfo(block *types.Block) { bc.lastBlockNumber++ - bi := types.BlockInfo{Number: bc.lastBlockNumber, Hash: block.Hash(), Parent: block.PrevHash, TD: bc.td} - - // For now we use the block hash with the words "info" appended as key - ethutil.Config.Db.Put(append(block.Hash(), []byte("Info")...), bi.RlpEncode()) } func (bc *ChainManager) Stop() { @@ -331,7 +346,8 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error { continue } - chainlogger.Infof("block #%v process failed (%x)\n", block.Number, block.Hash()[:4]) + h := block.Header() + chainlogger.Infof("block #%v process failed (%x)\n", h.Number, h.Hash()[:4]) chainlogger.Infoln(block) chainlogger.Infoln(err) return err @@ -339,16 +355,16 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error { self.mu.Lock() { - self.write(block) + cblock := self.currentBlock if td.Cmp(self.td) > 0 { - if block.Number.Cmp(new(big.Int).Add(self.currentBlock.Number, ethutil.Big1)) < 0 { - chainlogger.Infof("Split detected. New head #%v (%x), was #%v (%x)\n", block.Number, block.Hash()[:4], self.currentBlock.Number, self.currentBlock.Hash()[:4]) + if block.Header().Number.Cmp(new(big.Int).Add(cblock.Header().Number, ethutil.Big1)) < 0 { + chainlogger.Infof("Split detected. New head #%v (%x), was #%v (%x)\n", block.Header().Number, block.Hash()[:4], cblock.Header().Number, cblock.Hash()[:4]) } self.setTotalDifficulty(td) self.insert(block) - self.transState = self.currentBlock.State().Copy() + self.transState = state.New(cblock.Trie().Copy()) } } diff --git a/core/filter.go b/core/filter.go index fb992782d..7c34748df 100644 --- a/core/filter.go +++ b/core/filter.go @@ -76,13 +76,14 @@ func (self *Filter) SetSkip(skip int) { // Run filters messages with the current parameters set func (self *Filter) Find() []*state.Message { + earliestBlock := self.eth.ChainManager().CurrentBlock() var earliestBlockNo uint64 = uint64(self.earliest) if self.earliest == -1 { - earliestBlockNo = self.eth.ChainManager().CurrentBlock().Number.Uint64() + earliestBlockNo = earliestBlock.NumberU64() } var latestBlockNo uint64 = uint64(self.latest) if self.latest == -1 { - latestBlockNo = self.eth.ChainManager().CurrentBlock().Number.Uint64() + latestBlockNo = earliestBlock.NumberU64() } var ( @@ -93,7 +94,7 @@ func (self *Filter) Find() []*state.Message { for i := 0; !quit && block != nil; i++ { // Quit on latest switch { - case block.Number.Uint64() == earliestBlockNo, block.Number.Uint64() == 0: + case block.NumberU64() == earliestBlockNo, block.NumberU64() == 0: quit = true case self.max <= len(messages): break @@ -113,7 +114,7 @@ func (self *Filter) Find() []*state.Message { messages = append(messages, self.FilterMessages(msgs)...) } - block = self.eth.ChainManager().GetBlock(block.PrevHash) + block = self.eth.ChainManager().GetBlock(block.ParentHash()) } skip := int(math.Min(float64(len(messages)), float64(self.skip))) @@ -176,7 +177,7 @@ func (self *Filter) bloomFilter(block *types.Block) bool { var fromIncluded, toIncluded bool if len(self.from) > 0 { for _, from := range self.from { - if types.BloomLookup(block.LogsBloom, from) || bytes.Equal(block.Coinbase, from) { + if types.BloomLookup(block.Bloom(), from) || bytes.Equal(block.Coinbase(), from) { fromIncluded = true break } @@ -187,7 +188,7 @@ func (self *Filter) bloomFilter(block *types.Block) bool { if len(self.to) > 0 { for _, to := range self.to { - if types.BloomLookup(block.LogsBloom, ethutil.U256(new(big.Int).Add(ethutil.Big1, ethutil.BigD(to))).Bytes()) || bytes.Equal(block.Coinbase, to) { + if types.BloomLookup(block.Bloom(), ethutil.U256(new(big.Int).Add(ethutil.Big1, ethutil.BigD(to))).Bytes()) || bytes.Equal(block.Coinbase(), to) { toIncluded = true break } diff --git a/core/genesis.go b/core/genesis.go index 707154759..51afa314e 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -3,8 +3,10 @@ package core import ( "math/big" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/state" ) /* @@ -17,36 +19,35 @@ var ZeroHash512 = make([]byte, 64) var EmptyShaList = crypto.Sha3(ethutil.Encode([]interface{}{})) var EmptyListRoot = crypto.Sha3(ethutil.Encode("")) -var GenesisHeader = []interface{}{ - // Previous hash (none) - ZeroHash256, - // Empty uncles - EmptyShaList, - // Coinbase - ZeroHash160, - // Root state - EmptyShaList, - // tx root - EmptyListRoot, - // receipt root - EmptyListRoot, - // bloom - ZeroHash512, - // Difficulty - //ethutil.BigPow(2, 22), - big.NewInt(131072), - // Number - ethutil.Big0, - // Block upper gas bound - big.NewInt(1000000), - // Block gas used - ethutil.Big0, - // Time - ethutil.Big0, - // Extra - nil, - // Nonce - crypto.Sha3(big.NewInt(42).Bytes()), -} +func GenesisBlock() *types.Block { + genesis := types.NewBlock(ZeroHash256, ZeroHash160, EmptyListRoot, big.NewInt(131072), crypto.Sha3(big.NewInt(42).Bytes()), "") + genesis.Header().Number = ethutil.Big0 + genesis.Header().GasLimit = big.NewInt(1000000) + genesis.Header().GasUsed = ethutil.Big0 + genesis.Header().Time = 0 + + genesis.SetUncles([]*types.Header{}) + genesis.SetTransactions(types.Transactions{}) + genesis.SetReceipts(types.Receipts{}) -var Genesis = []interface{}{GenesisHeader, []interface{}{}, []interface{}{}} + statedb := state.New(genesis.Trie()) + for _, addr := range []string{ + "51ba59315b3a95761d0863b05ccc7a7f54703d99", + "e4157b34ea9615cfbde6b4fda419828124b70c78", + "b9c015918bdaba24b4ff057a92a3873d6eb201be", + "6c386a4b26f73c802f34673f7248bb118f97424a", + "cd2a3d9f938e13cd947ec05abc7fe734df8dd826", + "2ef47100e0787b915105fd5e3f4ff6752079d5cb", + "e6716f9544a56c530d868e4bfbacb172315bdead", + "1a26338f0d905e295fccb71fa9ea849ffa12aaf4", + } { + codedAddr := ethutil.Hex2Bytes(addr) + account := statedb.GetAccount(codedAddr) + account.SetBalance(ethutil.Big("1606938044258990275541962092341162602522202993782792835301376")) //ethutil.BigPow(2, 200) + statedb.UpdateStateObject(account) + } + statedb.Sync() + genesis.Header().Root = statedb.Root() + + return genesis +} diff --git a/core/types/block.go b/core/types/block.go index 2d889f35f..b0fcbdd9b 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -9,408 +9,252 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/trie" ) -type BlockInfo struct { - Number uint64 - Hash []byte - Parent []byte - TD *big.Int -} - -func (bi *BlockInfo) RlpDecode(data []byte) { - decoder := ethutil.NewValueFromBytes(data) - - bi.Number = decoder.Get(0).Uint() - bi.Hash = decoder.Get(1).Bytes() - bi.Parent = decoder.Get(2).Bytes() - bi.TD = decoder.Get(3).BigInt() -} - -func (bi *BlockInfo) RlpEncode() []byte { - return ethutil.Encode([]interface{}{bi.Number, bi.Hash, bi.Parent, bi.TD}) -} - -type Blocks []*Block - -func (self Blocks) AsSet() ethutil.UniqueSet { - set := make(ethutil.UniqueSet) - for _, block := range self { - set.Insert(block.Hash()) - } - - return set -} - -type BlockBy func(b1, b2 *Block) bool - -func (self BlockBy) Sort(blocks Blocks) { - bs := blockSorter{ - blocks: blocks, - by: self, - } - sort.Sort(bs) -} - -type blockSorter struct { - blocks Blocks - by func(b1, b2 *Block) bool -} - -func (self blockSorter) Len() int { return len(self.blocks) } -func (self blockSorter) Swap(i, j int) { - self.blocks[i], self.blocks[j] = self.blocks[j], self.blocks[i] -} -func (self blockSorter) Less(i, j int) bool { return self.by(self.blocks[i], self.blocks[j]) } - -func Number(b1, b2 *Block) bool { return b1.Number.Cmp(b2.Number) < 0 } - -type Block struct { +type Header struct { // Hash to the previous block - PrevHash ethutil.Bytes + ParentHash ethutil.Bytes // Uncles of this block - Uncles Blocks - UncleSha []byte + UncleHash []byte // The coin base address Coinbase []byte // Block Trie state - //state *ethutil.Trie - state *state.StateDB + Root []byte + // Tx sha + TxHash []byte + // Receipt sha + ReceiptHash []byte + // Bloom + Bloom []byte // Difficulty for the current block Difficulty *big.Int - // Creation time - Time int64 // The block number Number *big.Int // Gas limit GasLimit *big.Int // Gas used GasUsed *big.Int + // Creation time + Time uint64 // Extra data Extra string // Block Nonce for verification Nonce ethutil.Bytes - // List of transactions and/or contracts - transactions Transactions - receipts Receipts - TxSha, ReceiptSha []byte - LogsBloom []byte - - Reward *big.Int } -func NewBlockFromBytes(raw []byte) *Block { - block := &Block{} - block.RlpDecode(raw) +func (self *Header) rlpData(withNonce bool) []interface{} { + fields := []interface{}{self.ParentHash, self.UncleHash, self.Coinbase, self.Root, self.TxHash, self.ReceiptHash, self.Bloom, self.Difficulty, self.Number, self.GasLimit, self.GasUsed, self.Time, self.Extra} + if withNonce { + fields = append(fields, self.Nonce) + } - return block + return fields +} + +func (self *Header) RlpData() interface{} { + return self.rlpData(true) } -// New block takes a raw encoded string -func NewBlockFromRlpValue(rlpValue *ethutil.Value) *Block { - block := &Block{} - block.RlpValueDecode(rlpValue) +func (self *Header) Hash() []byte { + return crypto.Sha3(ethutil.Encode(self.rlpData(true))) +} - return block +func (self *Header) HashNoNonce() []byte { + return crypto.Sha3(ethutil.Encode(self.rlpData(false))) } -func CreateBlock(root interface{}, - prevHash []byte, - base []byte, - Difficulty *big.Int, - Nonce []byte, - extra string) *Block { - - block := &Block{ - PrevHash: prevHash, - Coinbase: base, - Difficulty: Difficulty, - Nonce: Nonce, - Time: time.Now().Unix(), +type Block struct { + header *Header + uncles []*Header + transactions Transactions + Td *big.Int + + receipts Receipts + Reward *big.Int +} + +func NewBlock(parentHash []byte, coinbase []byte, root []byte, difficulty *big.Int, nonce []byte, extra string) *Block { + header := &Header{ + Root: root, + ParentHash: parentHash, + Coinbase: coinbase, + Difficulty: difficulty, + Nonce: nonce, + Time: uint64(time.Now().Unix()), Extra: extra, - UncleSha: nil, GasUsed: new(big.Int), GasLimit: new(big.Int), } - block.SetUncles([]*Block{}) - block.state = state.New(trie.New(ethutil.Config.Db, root)) + block := &Block{header: header, Reward: new(big.Int)} return block } -// Returns a hash of the block -func (block *Block) Hash() ethutil.Bytes { - return crypto.Sha3(ethutil.NewValue(block.header()).Encode()) - //return crypto.Sha3(block.Value().Encode()) -} - -func (block *Block) HashNoNonce() []byte { - return crypto.Sha3(ethutil.Encode(block.miningHeader())) -} - -func (block *Block) State() *state.StateDB { - return block.state -} - -func (block *Block) Transactions() Transactions { - return block.transactions +func NewBlockWithHeader(header *Header) *Block { + return &Block{header: header} } -func (block *Block) CalcGasLimit(parent *Block) *big.Int { - if block.Number.Cmp(big.NewInt(0)) == 0 { - return ethutil.BigPow(10, 6) +func (self *Block) DecodeRLP(s *rlp.Stream) error { + if _, err := s.List(); err != nil { + return err } - // ((1024-1) * parent.gasLimit + (gasUsed * 6 / 5)) / 1024 - - previous := new(big.Int).Mul(big.NewInt(1024-1), parent.GasLimit) - current := new(big.Rat).Mul(new(big.Rat).SetInt(parent.GasUsed), big.NewRat(6, 5)) - curInt := new(big.Int).Div(current.Num(), current.Denom()) - - result := new(big.Int).Add(previous, curInt) - result.Div(result, big.NewInt(1024)) - - min := big.NewInt(125000) - - return ethutil.BigMax(min, result) -} - -func (block *Block) BlockInfo() BlockInfo { - bi := BlockInfo{} - data, _ := ethutil.Config.Db.Get(append(block.Hash(), []byte("Info")...)) - bi.RlpDecode(data) - - return bi -} - -func (self *Block) GetTransaction(hash []byte) *Transaction { - for _, tx := range self.transactions { - if bytes.Compare(tx.Hash(), hash) == 0 { - return tx - } + var header Header + if err := s.Decode(&header); err != nil { + return err } - return nil -} - -// Sync the block's state and contract respectively -func (block *Block) Sync() { - block.state.Sync() -} - -func (block *Block) Undo() { - // Sync the block state itself - block.state.Reset() -} - -/////// Block Encoding -func (block *Block) rlpReceipts() interface{} { - // Marshal the transactions of this block - encR := make([]interface{}, len(block.receipts)) - for i, r := range block.receipts { - // Cast it to a string (safe) - encR[i] = r.RlpData() + var transactions []*Transaction + if err := s.Decode(&transactions); err != nil { + return err } - return encR -} + var uncleHeaders []*Header + if err := s.Decode(&uncleHeaders); err != nil { + return err + } -func (block *Block) rlpUncles() interface{} { - // Marshal the transactions of this block - uncles := make([]interface{}, len(block.Uncles)) - for i, uncle := range block.Uncles { - // Cast it to a string (safe) - uncles[i] = uncle.header() + var tdBytes []byte + if err := s.Decode(&tdBytes); err != nil { + // If this block comes from the network that's fine. If loaded from disk it should be there + // Blocks don't store their Td when propagated over the network + } else { + self.Td = ethutil.BigD(tdBytes) } - return uncles -} + if err := s.ListEnd(); err != nil { + return err + } -func (block *Block) SetUncles(uncles []*Block) { - block.Uncles = uncles - block.UncleSha = crypto.Sha3(ethutil.Encode(block.rlpUncles())) -} + self.header = &header + self.uncles = uncleHeaders + self.transactions = transactions -func (self *Block) SetReceipts(receipts Receipts) { - self.receipts = receipts - self.ReceiptSha = DeriveSha(receipts) - self.LogsBloom = CreateBloom(receipts) + return nil } -func (self *Block) SetTransactions(txs Transactions) { - self.transactions = txs - self.TxSha = DeriveSha(txs) +func (self *Block) Header() *Header { + return self.header } -func (block *Block) Value() *ethutil.Value { - return ethutil.NewValue([]interface{}{block.header(), block.transactions, block.rlpUncles()}) +func (self *Block) Uncles() []*Header { + return self.uncles } -func (block *Block) RlpEncode() []byte { - // Encode a slice interface which contains the header and the list of - // transactions. - return block.Value().Encode() +func (self *Block) SetUncles(uncleHeaders []*Header) { + self.uncles = uncleHeaders + self.header.UncleHash = crypto.Sha3(ethutil.Encode(uncleHeaders)) } -func (block *Block) RlpDecode(data []byte) { - rlpValue := ethutil.NewValueFromBytes(data) - block.RlpValueDecode(rlpValue) +func (self *Block) Transactions() Transactions { + return self.transactions } -func (block *Block) RlpValueDecode(decoder *ethutil.Value) { - block.setHeader(decoder.Get(0)) - - // Tx list might be empty if this is an uncle. Uncles only have their - // header set. - if decoder.Get(1).IsNil() == false { // Yes explicitness - //receipts := decoder.Get(1) - //block.receipts = make([]*Receipt, receipts.Len()) - txs := decoder.Get(1) - block.transactions = make(Transactions, txs.Len()) - for i := 0; i < txs.Len(); i++ { - block.transactions[i] = NewTransactionFromValue(txs.Get(i)) - //receipt := NewRecieptFromValue(receipts.Get(i)) - //block.transactions[i] = receipt.Tx - //block.receipts[i] = receipt - } - - } - - if decoder.Get(2).IsNil() == false { // Yes explicitness - uncles := decoder.Get(2) - block.Uncles = make([]*Block, uncles.Len()) - for i := 0; i < uncles.Len(); i++ { - block.Uncles[i] = NewUncleBlockFromValue(uncles.Get(i)) +func (self *Block) Transaction(hash []byte) *Transaction { + for _, transaction := range self.transactions { + if bytes.Equal(hash, transaction.Hash()) { + return transaction } } - + return nil } -func (self *Block) setHeader(header *ethutil.Value) { - self.PrevHash = header.Get(0).Bytes() - self.UncleSha = header.Get(1).Bytes() - self.Coinbase = header.Get(2).Bytes() - self.state = state.New(trie.New(ethutil.Config.Db, header.Get(3).Val)) - self.TxSha = header.Get(4).Bytes() - self.ReceiptSha = header.Get(5).Bytes() - self.LogsBloom = header.Get(6).Bytes() - self.Difficulty = header.Get(7).BigInt() - self.Number = header.Get(8).BigInt() - self.GasLimit = header.Get(9).BigInt() - self.GasUsed = header.Get(10).BigInt() - self.Time = int64(header.Get(11).BigInt().Uint64()) - self.Extra = header.Get(12).Str() - self.Nonce = header.Get(13).Bytes() +func (self *Block) SetTransactions(transactions Transactions) { + self.transactions = transactions + self.header.TxHash = DeriveSha(transactions) } -func NewUncleBlockFromValue(header *ethutil.Value) *Block { - block := &Block{} - block.setHeader(header) - - return block +func (self *Block) Receipts() Receipts { + return self.receipts } -func (block *Block) Trie() *trie.Trie { - return block.state.Trie +func (self *Block) SetReceipts(receipts Receipts) { + self.receipts = receipts + self.header.ReceiptHash = DeriveSha(receipts) + self.header.Bloom = CreateBloom(receipts) } -func (block *Block) Root() interface{} { - return block.state.Root() +func (self *Block) RlpData() interface{} { + return []interface{}{self.header, self.transactions, self.uncles} +} + +func (self *Block) RlpDataForStorage() interface{} { + return []interface{}{self.header, self.transactions, self.uncles, self.Td /* TODO receipts */} +} + +// Header accessors (add as you need them) +func (self *Block) Number() *big.Int { return self.header.Number } +func (self *Block) NumberU64() uint64 { return self.header.Number.Uint64() } +func (self *Block) ParentHash() []byte { return self.header.ParentHash } +func (self *Block) Bloom() []byte { return self.header.Bloom } +func (self *Block) Coinbase() []byte { return self.header.Coinbase } +func (self *Block) Time() int64 { return int64(self.header.Time) } +func (self *Block) GasLimit() *big.Int { return self.header.GasLimit } +func (self *Block) GasUsed() *big.Int { return self.header.GasUsed } +func (self *Block) Hash() []byte { return self.header.Hash() } +func (self *Block) Trie() *trie.Trie { return trie.New(ethutil.Config.Db, self.header.Root) } +func (self *Block) State() *state.StateDB { return state.New(self.Trie()) } +func (self *Block) Size() ethutil.StorageSize { return ethutil.StorageSize(len(ethutil.Encode(self))) } + +// Implement block.Pow +func (self *Block) Difficulty() *big.Int { return self.header.Difficulty } +func (self *Block) N() []byte { return self.header.Nonce } +func (self *Block) HashNoNonce() []byte { + return crypto.Sha3(ethutil.Encode(self.header.rlpData(false))) +} + +func (self *Block) String() string { + return fmt.Sprintf(`BLOCK(%x): Size: %v { +%v +%v +%v +} +`, self.header.Hash(), self.Size(), self.header, self.uncles, self.transactions) +} + +func (self *Header) String() string { + return fmt.Sprintf(`ParentHash: %x +UncleHash: %x +Coinbase: %x +Root: %x +TxSha %x +ReceiptSha: %x +Bloom: %x +Difficulty: %v +Number: %v +GasLimit: %v +GasUsed: %v +Time: %v +Extra: %v +Nonce: %x +`, self.ParentHash, self.UncleHash, self.Coinbase, self.Root, self.TxHash, self.ReceiptHash, self.Bloom, self.Difficulty, self.Number, self.GasLimit, self.GasUsed, self.Time, self.Extra, self.Nonce) } -func (block *Block) Diff() *big.Int { - return block.Difficulty -} +type Blocks []*Block -func (self *Block) Receipts() []*Receipt { - return self.receipts -} +type BlockBy func(b1, b2 *Block) bool -func (block *Block) miningHeader() []interface{} { - return []interface{}{ - // Sha of the previous block - block.PrevHash, - // Sha of uncles - block.UncleSha, - // Coinbase address - block.Coinbase, - // root state - block.Root(), - // tx root - block.TxSha, - // Sha of tx - block.ReceiptSha, - // Bloom - block.LogsBloom, - // Current block Difficulty - block.Difficulty, - // The block number - block.Number, - // Block upper gas bound - block.GasLimit, - // Block gas used - block.GasUsed, - // Time the block was found? - block.Time, - // Extra data - block.Extra, +func (self BlockBy) Sort(blocks Blocks) { + bs := blockSorter{ + blocks: blocks, + by: self, } + sort.Sort(bs) } -func (block *Block) header() []interface{} { - return append(block.miningHeader(), block.Nonce) -} - -func (block *Block) String() string { - return fmt.Sprintf(` - BLOCK(%x): Size: %v - PrevHash: %x - UncleSha: %x - Coinbase: %x - Root: %x - TxSha %x - ReceiptSha: %x - Bloom: %x - Difficulty: %v - Number: %v - MaxLimit: %v - GasUsed: %v - Time: %v - Extra: %v - Nonce: %x - NumTx: %v -`, - block.Hash(), - block.Size(), - block.PrevHash, - block.UncleSha, - block.Coinbase, - block.Root(), - block.TxSha, - block.ReceiptSha, - block.LogsBloom, - block.Difficulty, - block.Number, - block.GasLimit, - block.GasUsed, - block.Time, - block.Extra, - block.Nonce, - len(block.transactions), - ) -} - -func (self *Block) Size() ethutil.StorageSize { - return ethutil.StorageSize(len(self.RlpEncode())) +type blockSorter struct { + blocks Blocks + by func(b1, b2 *Block) bool } -// Implement RlpEncodable -func (self *Block) RlpData() interface{} { - return []interface{}{self.header(), self.transactions, self.rlpUncles()} +func (self blockSorter) Len() int { return len(self.blocks) } +func (self blockSorter) Swap(i, j int) { + self.blocks[i], self.blocks[j] = self.blocks[j], self.blocks[i] } +func (self blockSorter) Less(i, j int) bool { return self.by(self.blocks[i], self.blocks[j]) } -// Implement pow.Block -func (self *Block) N() []byte { return self.Nonce } +func Number(b1, b2 *Block) bool { return b1.Header().Number.Cmp(b2.Header().Number) < 0 } diff --git a/core/types/block_test.go b/core/types/block_test.go new file mode 100644 index 000000000..c85708975 --- /dev/null +++ b/core/types/block_test.go @@ -0,0 +1,23 @@ +package types + +import ( + "bytes" + "testing" + + "github.com/ethereum/go-ethereum/ethdb" + "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/rlp" +) + +func init() { + ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "") + ethutil.Config.Db, _ = ethdb.NewMemDatabase() +} + +func TestNewBlock(t *testing.T) { + block := GenesisBlock() + data := ethutil.Encode(block) + + var genesis Block + err := rlp.Decode(bytes.NewReader(data), &genesis) +} diff --git a/core/types/transaction.go b/core/types/transaction.go index 3a87f7844..c2f7df7a7 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -1,11 +1,13 @@ package types import ( + "bytes" "fmt" "math/big" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/rlp" "github.com/obscuren/secp256k1-go" ) @@ -14,22 +16,22 @@ func IsContractAddr(addr []byte) bool { } type Transaction struct { - nonce uint64 - recipient []byte - value *big.Int - gas *big.Int - gasPrice *big.Int - data []byte - v byte - r, s []byte + AccountNonce uint64 + Recipient []byte + Amount *big.Int + GasAmount *big.Int + Price *big.Int + Payload []byte + V uint64 + R, S []byte } -func NewContractCreationTx(value, gas, gasPrice *big.Int, script []byte) *Transaction { - return &Transaction{recipient: nil, value: value, gas: gas, gasPrice: gasPrice, data: script} +func NewContractCreationTx(Amount, gasAmount, price *big.Int, data []byte) *Transaction { + return NewTransactionMessage(nil, Amount, gasAmount, price, data) } -func NewTransactionMessage(to []byte, value, gas, gasPrice *big.Int, data []byte) *Transaction { - return &Transaction{recipient: to, value: value, gasPrice: gasPrice, gas: gas, data: data} +func NewTransactionMessage(to []byte, Amount, gasAmount, price *big.Int, data []byte) *Transaction { + return &Transaction{Recipient: to, Amount: Amount, Price: price, GasAmount: gasAmount, Payload: data} } func NewTransactionFromBytes(data []byte) *Transaction { @@ -39,7 +41,7 @@ func NewTransactionFromBytes(data []byte) *Transaction { return tx } -func NewTransactionFromValue(val *ethutil.Value) *Transaction { +func NewTransactionFromAmount(val *ethutil.Value) *Transaction { tx := &Transaction{} tx.RlpValueDecode(val) @@ -47,33 +49,33 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction { } func (tx *Transaction) Hash() []byte { - data := []interface{}{tx.nonce, tx.gasPrice, tx.gas, tx.recipient, tx.value, tx.data} + data := []interface{}{tx.AccountNonce, tx.Price, tx.GasAmount, tx.Recipient, tx.Amount, tx.Payload} - return crypto.Sha3(ethutil.NewValue(data).Encode()) + return crypto.Sha3(ethutil.Encode(data)) } func (self *Transaction) Data() []byte { - return self.data + return self.Payload } func (self *Transaction) Gas() *big.Int { - return self.gas + return self.GasAmount } func (self *Transaction) GasPrice() *big.Int { - return self.gasPrice + return self.Price } func (self *Transaction) Value() *big.Int { - return self.value + return self.Amount } func (self *Transaction) Nonce() uint64 { - return self.nonce + return self.AccountNonce } -func (self *Transaction) SetNonce(nonce uint64) { - self.nonce = nonce +func (self *Transaction) SetNonce(AccountNonce uint64) { + self.AccountNonce = AccountNonce } func (self *Transaction) From() []byte { @@ -81,13 +83,13 @@ func (self *Transaction) From() []byte { } func (self *Transaction) To() []byte { - return self.recipient + return self.Recipient } func (tx *Transaction) Curve() (v byte, r []byte, s []byte) { - v = tx.v - r = ethutil.LeftPadBytes(tx.r, 32) - s = ethutil.LeftPadBytes(tx.s, 32) + v = byte(tx.V) + r = ethutil.LeftPadBytes(tx.R, 32) + s = ethutil.LeftPadBytes(tx.S, 32) return } @@ -130,42 +132,37 @@ func (tx *Transaction) Sign(privk []byte) error { sig := tx.Signature(privk) - tx.r = sig[:32] - tx.s = sig[32:64] - tx.v = sig[64] + 27 + tx.R = sig[:32] + tx.S = sig[32:64] + tx.V = uint64(sig[64] + 27) return nil } func (tx *Transaction) RlpData() interface{} { - data := []interface{}{tx.nonce, tx.gasPrice, tx.gas, tx.recipient, tx.value, tx.data} + data := []interface{}{tx.AccountNonce, tx.Price, tx.GasAmount, tx.Recipient, tx.Amount, tx.Payload} - return append(data, tx.v, new(big.Int).SetBytes(tx.r).Bytes(), new(big.Int).SetBytes(tx.s).Bytes()) -} - -func (tx *Transaction) RlpValue() *ethutil.Value { - return ethutil.NewValue(tx.RlpData()) + return append(data, tx.V, new(big.Int).SetBytes(tx.R).Bytes(), new(big.Int).SetBytes(tx.S).Bytes()) } func (tx *Transaction) RlpEncode() []byte { - return tx.RlpValue().Encode() + return ethutil.Encode(tx) } func (tx *Transaction) RlpDecode(data []byte) { - tx.RlpValueDecode(ethutil.NewValueFromBytes(data)) + rlp.Decode(bytes.NewReader(data), tx) } func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) { - tx.nonce = decoder.Get(0).Uint() - tx.gasPrice = decoder.Get(1).BigInt() - tx.gas = decoder.Get(2).BigInt() - tx.recipient = decoder.Get(3).Bytes() - tx.value = decoder.Get(4).BigInt() - tx.data = decoder.Get(5).Bytes() - tx.v = byte(decoder.Get(6).Uint()) - - tx.r = decoder.Get(7).Bytes() - tx.s = decoder.Get(8).Bytes() + tx.AccountNonce = decoder.Get(0).Uint() + tx.Price = decoder.Get(1).BigInt() + tx.GasAmount = decoder.Get(2).BigInt() + tx.Recipient = decoder.Get(3).Bytes() + tx.Amount = decoder.Get(4).BigInt() + tx.Payload = decoder.Get(5).Bytes() + tx.V = decoder.Get(6).Uint() + tx.R = decoder.Get(7).Bytes() + tx.S = decoder.Get(8).Bytes() } func (tx *Transaction) String() string { @@ -174,10 +171,10 @@ func (tx *Transaction) String() string { Contract: %v From: %x To: %x - Nonce: %v - GasPrice: %v - Gas: %v - Value: %v + AccountNonce: %v + GasAmountPrice: %v + GasAmount: %v + Amount: %v Data: 0x%x V: 0x%x R: 0x%x @@ -185,17 +182,17 @@ func (tx *Transaction) String() string { Hex: %x `, tx.Hash(), - len(tx.recipient) == 0, + len(tx.Recipient) == 0, tx.From(), - tx.recipient, - tx.nonce, - tx.gasPrice, - tx.gas, - tx.value, - tx.data, - tx.v, - tx.r, - tx.s, + tx.Recipient, + tx.AccountNonce, + tx.Price, + tx.GasAmount, + tx.Amount, + tx.Payload, + tx.V, + tx.R, + tx.S, ethutil.Encode(tx), ) } @@ -220,5 +217,5 @@ func (s Transactions) GetRlp(i int) []byte { return ethutil.Rlp(s[i]) } type TxByNonce struct{ Transactions } func (s TxByNonce) Less(i, j int) bool { - return s.Transactions[i].nonce < s.Transactions[j].nonce + return s.Transactions[i].AccountNonce < s.Transactions[j].AccountNonce } diff --git a/core/vm_env.go b/core/vm_env.go index ad63ecf9c..209115eab 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -24,15 +24,15 @@ func NewEnv(state *state.StateDB, msg Message, block *types.Block) *VMEnv { } func (self *VMEnv) Origin() []byte { return self.msg.From() } -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) BlockNumber() *big.Int { return self.block.Number() } +func (self *VMEnv) PrevHash() []byte { return self.block.ParentHash() } +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) GasLimit() *big.Int { return self.block.GasLimit() } func (self *VMEnv) Value() *big.Int { return self.msg.Value() } func (self *VMEnv) State() *state.StateDB { return self.state } -func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit } func (self *VMEnv) Depth() int { return self.depth } func (self *VMEnv) SetDepth(i int) { self.depth = i } func (self *VMEnv) AddLog(log state.Log) { diff --git a/eth/backend.go b/eth/backend.go index 0aad6a514..383cda46f 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -235,7 +235,7 @@ func (self *Ethereum) blockBroadcastLoop() { // automatically stops if unsubscribe for obj := range self.txSub.Chan() { event := obj.(core.NewMinedBlockEvent) - self.server.Broadcast("eth", NewBlockMsg, event.Block.Value().Val) + self.server.Broadcast("eth", NewBlockMsg, event.Block.RlpData()) } } diff --git a/eth/protocol.go b/eth/protocol.go index 3b6f95d44..963d41794 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -172,7 +172,7 @@ func (self *ethProtocol) handle() error { } block := self.chainManager.GetBlock(hash) if block != nil { - blocks = append(blocks, block.Value().Raw()) + blocks = append(blocks, block.RlpData()) } } return self.rw.EncodeMsg(BlocksMsg, blocks...) diff --git a/miner/miner.go b/miner/miner.go index d909c228b..c9a6922bb 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -56,7 +56,7 @@ type Miner struct { eth *eth.Ethereum events event.Subscription - uncles types.Blocks + uncles []*types.Header localTxs map[int]*LocalTx localTxId int @@ -184,9 +184,9 @@ func (self *Miner) mine() { block.SetUncles(self.uncles) } - parent := chainMan.GetBlock(block.PrevHash) - coinbase := block.State().GetOrNewStateObject(block.Coinbase) - coinbase.SetGasPool(block.CalcGasLimit(parent)) + parent := chainMan.GetBlock(block.ParentHash()) + coinbase := block.State().GetOrNewStateObject(block.Coinbase()) + coinbase.SetGasPool(core.CalcGasLimit(parent, block)) transactions := self.finiliseTxs() @@ -211,7 +211,7 @@ func (self *Miner) mine() { // Find a valid nonce nonce := self.pow.Search(block, self.powQuitCh) if nonce != nil { - block.Nonce = nonce + block.Header().Nonce = nonce err := chainMan.InsertChain(types.Blocks{block}) if err != nil { minerlogger.Infoln(err) diff --git a/pow/block.go b/pow/block.go index 4759e19fb..62df2b5ff 100644 --- a/pow/block.go +++ b/pow/block.go @@ -3,7 +3,7 @@ package pow import "math/big" type Block interface { - Diff() *big.Int + Difficulty() *big.Int HashNoNonce() []byte N() []byte } diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go index f669f8aa4..f9f27326f 100644 --- a/pow/ezp/pow.go +++ b/pow/ezp/pow.go @@ -35,7 +35,7 @@ func (pow *EasyPow) Turbo(on bool) { func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte { r := rand.New(rand.NewSource(time.Now().UnixNano())) hash := block.HashNoNonce() - diff := block.Diff() + diff := block.Difficulty() i := int64(0) start := time.Now().UnixNano() t := time.Now() @@ -89,5 +89,5 @@ func verify(hash []byte, diff *big.Int, nonce []byte) bool { } func Verify(block pow.Block) bool { - return verify(block.HashNoNonce(), block.Diff(), block.N()) + return verify(block.HashNoNonce(), block.Difficulty(), block.N()) } diff --git a/xeth/js_types.go b/xeth/js_types.go index 04018f6a5..4bb1f4e7d 100644 --- a/xeth/js_types.go +++ b/xeth/js_types.go @@ -42,21 +42,21 @@ func NewJSBlock(block *types.Block) *JSBlock { } txlist := ethutil.NewList(ptxs) - puncles := make([]*JSBlock, len(block.Uncles)) - for i, uncle := range block.Uncles { - puncles[i] = NewJSBlock(uncle) + puncles := make([]*JSBlock, len(block.Uncles())) + for i, uncle := range block.Uncles() { + puncles[i] = NewJSBlock(types.NewBlockWithHeader(uncle)) } ulist := ethutil.NewList(puncles) return &JSBlock{ ref: block, Size: block.Size().String(), - Number: int(block.Number.Uint64()), GasUsed: block.GasUsed.String(), - GasLimit: block.GasLimit.String(), Hash: ethutil.Bytes2Hex(block.Hash()), + Number: int(block.NumberU64()), GasUsed: block.GasUsed().String(), + GasLimit: block.GasLimit().String(), Hash: ethutil.Bytes2Hex(block.Hash()), Transactions: txlist, Uncles: ulist, - Time: block.Time, - Coinbase: ethutil.Bytes2Hex(block.Coinbase), - PrevHash: ethutil.Bytes2Hex(block.PrevHash), - Bloom: ethutil.Bytes2Hex(block.LogsBloom), + Time: block.Time(), + Coinbase: ethutil.Bytes2Hex(block.Coinbase()), + PrevHash: ethutil.Bytes2Hex(block.ParentHash()), + Bloom: ethutil.Bytes2Hex(block.Bloom()), Raw: block.String(), } } @@ -70,7 +70,7 @@ func (self *JSBlock) ToString() string { } func (self *JSBlock) GetTransaction(hash string) *JSTransaction { - tx := self.ref.GetTransaction(ethutil.Hex2Bytes(hash)) + tx := self.ref.Transaction(ethutil.Hex2Bytes(hash)) if tx == nil { return nil } diff --git a/xeth/pipe.go b/xeth/pipe.go index 06820cc86..775d5cfc5 100644 --- a/xeth/pipe.go +++ b/xeth/pipe.go @@ -140,7 +140,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, to []byte, value, gas, price *et // Do some pre processing for our "pre" events and hooks block := self.chainManager.NewBlock(key.Address()) coinbase := state.GetStateObject(key.Address()) - coinbase.SetGasPool(block.GasLimit) + coinbase.SetGasPool(block.GasLimit()) self.blockManager.ApplyTransactions(coinbase, state, block, types.Transactions{tx}, true) err := self.obj.TxPool().Add(tx) diff --git a/xeth/vm_env.go b/xeth/vm_env.go index 7fb674a94..7633e0640 100644 --- a/xeth/vm_env.go +++ b/xeth/vm_env.go @@ -28,15 +28,15 @@ func NewEnv(state *state.StateDB, block *types.Block, value *big.Int, sender []b } func (self *VMEnv) Origin() []byte { return self.sender } -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) BlockNumber() *big.Int { return self.block.Number() } +func (self *VMEnv) PrevHash() []byte { return self.block.ParentHash() } +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) GasLimit() *big.Int { return self.block.GasLimit() } func (self *VMEnv) Value() *big.Int { return self.value } func (self *VMEnv) State() *state.StateDB { return self.state } -func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit } func (self *VMEnv) Depth() int { return self.depth } func (self *VMEnv) SetDepth(i int) { self.depth = i } func (self *VMEnv) AddLog(log state.Log) { -- cgit v1.2.3 From 9e5257b83b8572077b9c26e4ae9a9443f765bf6e Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 14:33:15 +0100 Subject: Chain importer --- cmd/ethereum/flags.go | 2 ++ cmd/ethereum/main.go | 28 +++++++++++++++++++++++++++- core/block_manager.go | 4 ++-- core/chain_manager.go | 5 ----- core/types/block.go | 36 +++++++++++++++++++++--------------- core/types/transaction.go | 28 ++++++++++++++-------------- 6 files changed, 66 insertions(+), 37 deletions(-) diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 72f1db458..d27b739c3 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -58,6 +58,7 @@ var ( DumpHash string DumpNumber int VmType int + ImportChain string ) // flags specific to cli client @@ -104,6 +105,7 @@ func Init() { flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0") flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false") flag.BoolVar(&ShowGenesis, "genesis", false, "Dump the genesis block") + flag.StringVar(&ImportChain, "chain", "", "Imports fiven chain") flag.BoolVar(&Dump, "dump", false, "output the ethereum state in JSON format. Sub args [number, hash]") flag.StringVar(&DumpHash, "hash", "", "specify arg in hex") diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index fff9aedf8..f16244a2d 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -18,6 +18,7 @@ package main import ( + "bytes" "fmt" "os" "runtime" @@ -26,6 +27,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/rlp" ) const ( @@ -38,6 +40,10 @@ var clilogger = logger.NewLogger("CLI") func main() { runtime.GOMAXPROCS(runtime.NumCPU()) + defer func() { + logger.Flush() + }() + utils.HandleInterrupt() // precedence: code-internal flag default < config file < environment variables < command line @@ -112,6 +118,27 @@ func main() { utils.StartMining(ethereum) } + if len(ImportChain) > 0 { + clilogger.Infof("importing chain '%s'\n", ImportChain) + c, err := ethutil.ReadAllFile(ImportChain) + if err != nil { + clilogger.Infoln(err) + return + } + var chain types.Blocks + if err := rlp.Decode(bytes.NewReader([]byte(c)), &chain); err != nil { + clilogger.Infoln(err) + return + } + + ethereum.ChainManager().Reset() + if err := ethereum.ChainManager().InsertChain(chain); err != nil { + clilogger.Infoln(err) + return + } + clilogger.Infof("imported %d blocks\n", len(chain)) + } + // better reworked as cases if StartJsConsole { InitJsConsole(ethereum) @@ -131,5 +158,4 @@ func main() { // this blocks the thread ethereum.WaitForShutdown() - logger.Flush() } diff --git a/core/block_manager.go b/core/block_manager.go index c61cf6504..ef2113bfb 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -304,7 +304,7 @@ func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent knownUncles := set.New() for _, uncle := range parent.Uncles() { - knownUncles.Add(uncle.Hash()) + knownUncles.Add(string(uncle.Hash())) } nonces := ethutil.NewSet(block.Header().Nonce) @@ -323,7 +323,7 @@ func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent return UncleError("Uncle too old") } - if knownUncles.Has(uncle.Hash()) { + if knownUncles.Has(string(uncle.Hash())) { return UncleError("Uncle in chain") } diff --git a/core/chain_manager.go b/core/chain_manager.go index e35c4aa3a..fe687e501 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -204,9 +204,6 @@ func (bc *ChainManager) Reset() { bc.currentBlock = bc.genesisBlock bc.setTotalDifficulty(ethutil.Big("0")) - - // Set the last know difficulty (might be 0x0 as initial value, Genesis) - bc.td = ethutil.BigD(ethutil.Config.Db.LastKnownTD()) } func (self *ChainManager) Export() []byte { @@ -219,9 +216,7 @@ func (self *ChainManager) Export() []byte { for block := self.currentBlock; block != nil; block = self.GetBlock(block.Header().ParentHash) { blocks[block.NumberU64()] = block } - //fmt.Println(blocks) - return nil return ethutil.Encode(blocks) } diff --git a/core/types/block.go b/core/types/block.go index b0fcbdd9b..940f2402e 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -209,28 +209,34 @@ func (self *Block) HashNoNonce() []byte { func (self *Block) String() string { return fmt.Sprintf(`BLOCK(%x): Size: %v { +Header: +[ %v +] +Transactions: %v +Uncles: %v } -`, self.header.Hash(), self.Size(), self.header, self.uncles, self.transactions) +`, self.header.Hash(), self.Size(), self.header, self.transactions, self.uncles) } func (self *Header) String() string { - return fmt.Sprintf(`ParentHash: %x -UncleHash: %x -Coinbase: %x -Root: %x -TxSha %x -ReceiptSha: %x -Bloom: %x -Difficulty: %v -Number: %v -GasLimit: %v -GasUsed: %v -Time: %v -Extra: %v -Nonce: %x + return fmt.Sprintf(` + ParentHash: %x + UncleHash: %x + Coinbase: %x + Root: %x + TxSha %x + ReceiptSha: %x + Bloom: %x + Difficulty: %v + Number: %v + GasLimit: %v + GasUsed: %v + Time: %v + Extra: %v + Nonce: %x `, self.ParentHash, self.UncleHash, self.Coinbase, self.Root, self.TxHash, self.ReceiptHash, self.Bloom, self.Difficulty, self.Number, self.GasLimit, self.GasUsed, self.Time, self.Extra, self.Nonce) } diff --git a/core/types/transaction.go b/core/types/transaction.go index c2f7df7a7..59244adc3 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -17,10 +17,10 @@ func IsContractAddr(addr []byte) bool { type Transaction struct { AccountNonce uint64 + Price *big.Int + GasLimit *big.Int Recipient []byte Amount *big.Int - GasAmount *big.Int - Price *big.Int Payload []byte V uint64 R, S []byte @@ -31,7 +31,7 @@ func NewContractCreationTx(Amount, gasAmount, price *big.Int, data []byte) *Tran } func NewTransactionMessage(to []byte, Amount, gasAmount, price *big.Int, data []byte) *Transaction { - return &Transaction{Recipient: to, Amount: Amount, Price: price, GasAmount: gasAmount, Payload: data} + return &Transaction{Recipient: to, Amount: Amount, Price: price, GasLimit: gasAmount, Payload: data} } func NewTransactionFromBytes(data []byte) *Transaction { @@ -49,7 +49,7 @@ func NewTransactionFromAmount(val *ethutil.Value) *Transaction { } func (tx *Transaction) Hash() []byte { - data := []interface{}{tx.AccountNonce, tx.Price, tx.GasAmount, tx.Recipient, tx.Amount, tx.Payload} + data := []interface{}{tx.AccountNonce, tx.Price, tx.GasLimit, tx.Recipient, tx.Amount, tx.Payload} return crypto.Sha3(ethutil.Encode(data)) } @@ -59,7 +59,7 @@ func (self *Transaction) Data() []byte { } func (self *Transaction) Gas() *big.Int { - return self.GasAmount + return self.GasLimit } func (self *Transaction) GasPrice() *big.Int { @@ -140,7 +140,7 @@ func (tx *Transaction) Sign(privk []byte) error { } func (tx *Transaction) RlpData() interface{} { - data := []interface{}{tx.AccountNonce, tx.Price, tx.GasAmount, tx.Recipient, tx.Amount, tx.Payload} + data := []interface{}{tx.AccountNonce, tx.Price, tx.GasLimit, tx.Recipient, tx.Amount, tx.Payload} return append(data, tx.V, new(big.Int).SetBytes(tx.R).Bytes(), new(big.Int).SetBytes(tx.S).Bytes()) } @@ -156,7 +156,7 @@ func (tx *Transaction) RlpDecode(data []byte) { func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) { tx.AccountNonce = decoder.Get(0).Uint() tx.Price = decoder.Get(1).BigInt() - tx.GasAmount = decoder.Get(2).BigInt() + tx.GasLimit = decoder.Get(2).BigInt() tx.Recipient = decoder.Get(3).Bytes() tx.Amount = decoder.Get(4).BigInt() tx.Payload = decoder.Get(5).Bytes() @@ -171,23 +171,23 @@ func (tx *Transaction) String() string { Contract: %v From: %x To: %x - AccountNonce: %v - GasAmountPrice: %v - GasAmount: %v - Amount: %v + Nonce: %v + GasPrice: %v + GasLimit %v + Value: %v Data: 0x%x V: 0x%x R: 0x%x S: 0x%x Hex: %x - `, +`, tx.Hash(), len(tx.Recipient) == 0, tx.From(), - tx.Recipient, + tx.To(), tx.AccountNonce, tx.Price, - tx.GasAmount, + tx.GasLimit, tx.Amount, tx.Payload, tx.V, -- cgit v1.2.3 From e2e3fa3d11b37c8a22ebafe9c02dfd8089ac4d51 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 14:44:45 +0100 Subject: Updated Mist to use new blocks --- cmd/mist/gui.go | 8 ++++---- cmd/mist/html_container.go | 2 +- cmd/mist/qml_container.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 1152f0dcd..e5e18bbaa 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -221,7 +221,7 @@ func (gui *Gui) setInitialChain(ancientBlocks bool) { sBlk := gui.eth.ChainManager().LastBlockHash() blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { - sBlk = blk.PrevHash + sBlk = blk.ParentHash() gui.processBlock(blk, true) } @@ -322,7 +322,7 @@ func (gui *Gui) readPreviousTransactions() { } func (gui *Gui) processBlock(block *types.Block, initial bool) { - name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") + name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase()).Str(), "\x00") b := xeth.NewJSBlock(block) b.Name = name @@ -400,7 +400,7 @@ func (gui *Gui) update() { switch ev := ev.(type) { case core.NewBlockEvent: 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.ChainManager().State().GetBalance(gui.address()), nil) } @@ -438,7 +438,7 @@ func (gui *Gui) update() { case <-peerUpdateTicker.C: gui.setPeerInfo() case <-generalUpdateTicker.C: - statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number.String() + statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String() lastBlockLabel.Set("text", statusText) miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index b3fc219fa..bd11ccd57 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -139,7 +139,7 @@ func (app *HtmlApplication) Window() *qml.Window { } func (app *HtmlApplication) NewBlock(block *types.Block) { - b := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} + b := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} app.webView.Call("onNewBlockCb", b) } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index a0a46f9b1..ed24737d0 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -66,7 +66,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) { // Events func (app *QmlApplication) NewBlock(block *types.Block) { - pblock := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} + pblock := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} app.win.Call("onNewBlockCb", pblock) } -- cgit v1.2.3 From 1382e8d84bf039e8f5588f07029255d0f901cf44 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 14:50:04 +0100 Subject: Delete current chain for reset --- core/chain_manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/chain_manager.go b/core/chain_manager.go index fe687e501..485c195d5 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -198,6 +198,10 @@ func (bc *ChainManager) Reset() { bc.mu.Lock() defer bc.mu.Unlock() + for block := bc.currentBlock; block != nil; block = bc.GetBlock(block.Header().ParentHash) { + ethutil.Config.Db.Delete(block.Hash()) + } + // Prepare the genesis block bc.write(bc.genesisBlock) bc.insert(bc.genesisBlock) -- cgit v1.2.3 From 34f72ddb3d5a01d6c45c75604bc030c287d51fb2 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 15:18:48 +0100 Subject: Decode from stream directly --- cmd/ethereum/main.go | 5 ++--- ethdb/database.go | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index f16244a2d..12e22a438 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -18,7 +18,6 @@ package main import ( - "bytes" "fmt" "os" "runtime" @@ -120,13 +119,13 @@ func main() { if len(ImportChain) > 0 { clilogger.Infof("importing chain '%s'\n", ImportChain) - c, err := ethutil.ReadAllFile(ImportChain) + fh, err := os.OpenFile(ImportChain, os.O_RDONLY, os.ModePerm) if err != nil { clilogger.Infoln(err) return } var chain types.Blocks - if err := rlp.Decode(bytes.NewReader([]byte(c)), &chain); err != nil { + if err := rlp.Decode(fh, &chain); err != nil { clilogger.Infoln(err) return } diff --git a/ethdb/database.go b/ethdb/database.go index 19aa83466..47ddec9c0 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -71,6 +71,10 @@ func (self *LDBDatabase) NewIterator() iterator.Iterator { return self.db.NewIterator(nil, nil) } +func (self *LDBDatabase) Write(batch *leveldb.Batch) error { + return self.db.Write(batch, nil) +} + func (self *LDBDatabase) Close() { // Close the leveldb database self.db.Close() -- cgit v1.2.3 From 7d2353f24dad8bba8914b4014117fe73248c211c Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 15:31:03 +0100 Subject: Close the file --- cmd/ethereum/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 12e22a438..d704140d4 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -124,6 +124,8 @@ func main() { clilogger.Infoln(err) return } + defer fh.Close() + var chain types.Blocks if err := rlp.Decode(fh, &chain); err != nil { clilogger.Infoln(err) -- cgit v1.2.3 From 1054c155db8ac59b97b81fa7a7a20f2239eb1e82 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 15:37:03 +0100 Subject: Moved import to utils --- cmd/ethereum/main.go | 20 ++------------------ cmd/utils/cmd.go | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index d704140d4..2e0a5663a 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/rlp" ) const ( @@ -118,26 +117,11 @@ func main() { } if len(ImportChain) > 0 { - clilogger.Infof("importing chain '%s'\n", ImportChain) - fh, err := os.OpenFile(ImportChain, os.O_RDONLY, os.ModePerm) + err := utils.ImportChain(ethereum, ImportChain) if err != nil { clilogger.Infoln(err) - return } - defer fh.Close() - - var chain types.Blocks - if err := rlp.Decode(fh, &chain); err != nil { - clilogger.Infoln(err) - return - } - - ethereum.ChainManager().Reset() - if err := ethereum.ChainManager().InsertChain(chain); err != nil { - clilogger.Infoln(err) - return - } - clilogger.Infof("imported %d blocks\n", len(chain)) + return } // better reworked as cases diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 2b24ac532..c0a5d1c97 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -13,6 +13,7 @@ import ( "runtime" "bitbucket.org/kardianos/osext" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" @@ -20,6 +21,7 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/xeth" ) @@ -335,3 +337,25 @@ func BlockDo(ethereum *eth.Ethereum, hash []byte) error { return nil } + +func ImportChain(ethereum *eth.Ethereum, fn string) error { + clilogger.Infof("importing chain '%s'\n", ImportChain) + fh, err := os.OpenFile(fn, os.O_RDONLY, os.ModePerm) + if err != nil { + return err + } + defer fh.Close() + + var chain types.Blocks + if err := rlp.Decode(fh, &chain); err != nil { + return err + } + + ethereum.ChainManager().Reset() + if err := ethereum.ChainManager().InsertChain(chain); err != nil { + return err + } + clilogger.Infof("imported %d blocks\n", len(chain)) + + return nil +} -- cgit v1.2.3 From f468a9a0e236f8467012ffe35c1d8ff58e30a81a Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 15:46:46 +0100 Subject: Enable websockets for mist. Closes #218 --- cmd/mist/main.go | 4 ++++ cmd/utils/websockets.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/cmd/mist/main.go b/cmd/mist/main.go index eaf0af0c7..5f809f1c5 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -69,6 +69,10 @@ func run() error { utils.StartRpc(ethereum, RpcPort) } + if StartWebSockets { + utils.StartWebSockets(ethereum) + } + gui := NewWindow(ethereum, config, clientIdentity, KeyRing, LogLevel) gui.stdLog = stdLog diff --git a/cmd/utils/websockets.go b/cmd/utils/websockets.go index d3ba50e78..cf9ebba92 100644 --- a/cmd/utils/websockets.go +++ b/cmd/utils/websockets.go @@ -3,10 +3,13 @@ package utils import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/websocket" "github.com/ethereum/go-ethereum/xeth" ) +var wslogger = logger.NewLogger("WS") + func args(v ...interface{}) []interface{} { return v } @@ -106,6 +109,8 @@ func (self *WebSocketServer) Serv() { } func StartWebSockets(eth *eth.Ethereum) { + wslogger.Infoln("Starting WebSockets") + sock := NewWebSocketServer(eth) go sock.Serv() } -- cgit v1.2.3 From 780abaec988df302e0c98f1a35e9af35b5623746 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Dec 2014 18:35:36 +0100 Subject: Switched to new trie --- cmd/ethereum/main.go | 6 +- cmd/utils/cmd.go | 2 +- core/block_manager.go | 1 + core/genesis.go | 2 +- core/types/block.go | 4 +- core/types/derive_sha.go | 8 +- javascript/types.go | 8 +- ptrie/fullnode.go | 7 + ptrie/trie.go | 25 +++- ptrie/trie_test.go | 2 +- state/dump.go | 26 ++-- state/state.go | 325 ---------------------------------------------- state/state_object.go | 42 +++--- state/statedb.go | 326 +++++++++++++++++++++++++++++++++++++++++++++++ xeth/hexface.go | 8 +- 15 files changed, 412 insertions(+), 380 deletions(-) delete mode 100644 state/state.go create mode 100644 state/statedb.go diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 2e0a5663a..e4070aa47 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -21,6 +21,7 @@ import ( "fmt" "os" "runtime" + "time" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/core/types" @@ -97,9 +98,6 @@ func main() { os.Exit(1) } - // block.GetRoot() does not exist - //fmt.Printf("RLP: %x\nstate: %x\nhash: %x\n", ethutil.Rlp(block), block.GetRoot(), block.Hash()) - // Leave the Println. This needs clean output for piping fmt.Printf("%s\n", block.State().Dump()) @@ -117,10 +115,12 @@ func main() { } if len(ImportChain) > 0 { + start := time.Now() err := utils.ImportChain(ethereum, ImportChain) if err != nil { clilogger.Infoln(err) } + clilogger.Infoln("export done in", time.Since(start)) return } diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index c0a5d1c97..466c51383 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -339,7 +339,7 @@ func BlockDo(ethereum *eth.Ethereum, hash []byte) error { } func ImportChain(ethereum *eth.Ethereum, fn string) error { - clilogger.Infof("importing chain '%s'\n", ImportChain) + clilogger.Infof("importing chain '%s'\n", fn) fh, err := os.OpenFile(fn, os.O_RDONLY, os.ModePerm) if err != nil { return err diff --git a/core/block_manager.go b/core/block_manager.go index ef2113bfb..1b9da1269 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -217,6 +217,7 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I receiptSha := types.DeriveSha(receipts) if bytes.Compare(receiptSha, header.ReceiptHash) != 0 { + fmt.Println("receipts", receipts) err = fmt.Errorf("validating receipt root. received=%x got=%x", header.ReceiptHash, receiptSha) return } diff --git a/core/genesis.go b/core/genesis.go index 51afa314e..10b40516f 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -20,7 +20,7 @@ var EmptyShaList = crypto.Sha3(ethutil.Encode([]interface{}{})) var EmptyListRoot = crypto.Sha3(ethutil.Encode("")) func GenesisBlock() *types.Block { - genesis := types.NewBlock(ZeroHash256, ZeroHash160, EmptyListRoot, big.NewInt(131072), crypto.Sha3(big.NewInt(42).Bytes()), "") + genesis := types.NewBlock(ZeroHash256, ZeroHash160, nil, big.NewInt(131072), crypto.Sha3(big.NewInt(42).Bytes()), "") genesis.Header().Number = ethutil.Big0 genesis.Header().GasLimit = big.NewInt(1000000) genesis.Header().GasUsed = ethutil.Big0 diff --git a/core/types/block.go b/core/types/block.go index 940f2402e..054767d67 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -9,9 +9,9 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/ptrie" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/trie" ) type Header struct { @@ -196,7 +196,7 @@ func (self *Block) Time() int64 { return int64(self.header.Time) } func (self *Block) GasLimit() *big.Int { return self.header.GasLimit } func (self *Block) GasUsed() *big.Int { return self.header.GasUsed } func (self *Block) Hash() []byte { return self.header.Hash() } -func (self *Block) Trie() *trie.Trie { return trie.New(ethutil.Config.Db, self.header.Root) } +func (self *Block) Trie() *ptrie.Trie { return ptrie.New(self.header.Root, ethutil.Config.Db) } func (self *Block) State() *state.StateDB { return state.New(self.Trie()) } func (self *Block) Size() ethutil.StorageSize { return ethutil.StorageSize(len(ethutil.Encode(self))) } diff --git a/core/types/derive_sha.go b/core/types/derive_sha.go index 1897ff198..0beb19670 100644 --- a/core/types/derive_sha.go +++ b/core/types/derive_sha.go @@ -2,7 +2,7 @@ package types import ( "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/ptrie" ) type DerivableList interface { @@ -11,10 +11,10 @@ type DerivableList interface { } func DeriveSha(list DerivableList) []byte { - trie := trie.New(ethutil.Config.Db, "") + trie := ptrie.New(nil, ethutil.Config.Db) for i := 0; i < list.Len(); i++ { - trie.Update(string(ethutil.NewValue(i).Encode()), string(list.GetRlp(i))) + trie.Update(ethutil.Encode(i), list.GetRlp(i)) } - return trie.GetRoot() + return trie.Root() } diff --git a/javascript/types.go b/javascript/types.go index cf5a6677b..ce1d9995a 100644 --- a/javascript/types.go +++ b/javascript/types.go @@ -18,11 +18,11 @@ type JSStateObject struct { func (self *JSStateObject) EachStorage(call otto.FunctionCall) otto.Value { cb := call.Argument(0) - self.JSObject.EachStorage(func(key string, value *ethutil.Value) { - value.Decode() - cb.Call(self.eth.toVal(self), self.eth.toVal(key), self.eth.toVal(ethutil.Bytes2Hex(value.Bytes()))) - }) + it := self.JSObject.Trie().Iterator() + for it.Next() { + cb.Call(self.eth.toVal(self), self.eth.toVal(ethutil.Bytes2Hex(it.Key)), self.eth.toVal(ethutil.Bytes2Hex(it.Value))) + } return otto.UndefinedValue() } diff --git a/ptrie/fullnode.go b/ptrie/fullnode.go index 7a7f7d22d..d6b0745ec 100644 --- a/ptrie/fullnode.go +++ b/ptrie/fullnode.go @@ -1,5 +1,7 @@ package ptrie +import "fmt" + type FullNode struct { trie *Trie nodes [17]Node @@ -56,6 +58,11 @@ func (self *FullNode) RlpData() interface{} { } func (self *FullNode) set(k byte, value Node) { + if _, ok := value.(*ValueNode); ok && k != 16 { + fmt.Println(value, k) + panic(":(") + } + self.nodes[int(k)] = value } diff --git a/ptrie/trie.go b/ptrie/trie.go index 9fe9ea52a..d8135f36c 100644 --- a/ptrie/trie.go +++ b/ptrie/trie.go @@ -19,7 +19,7 @@ func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) { t2.Update(it.Key, it.Value) } - return bytes.Compare(t2.Hash(), t1.Hash()) == 0, t2 + return bytes.Equal(t2.Hash(), t1.Hash()), t2 } type Trie struct { @@ -49,14 +49,17 @@ func (self *Trie) Iterator() *Iterator { return NewIterator(self) } +func (self *Trie) Copy() *Trie { + return New(self.roothash, self.cache.backend) +} + // Legacy support func (self *Trie) Root() []byte { return self.Hash() } func (self *Trie) Hash() []byte { var hash []byte if self.root != nil { - //hash = self.root.Hash().([]byte) t := self.root.Hash() - if byts, ok := t.([]byte); ok { + if byts, ok := t.([]byte); ok && len(byts) > 0 { hash = byts } else { hash = crypto.Sha3(ethutil.Encode(self.root.RlpData())) @@ -73,6 +76,9 @@ func (self *Trie) Hash() []byte { return hash } func (self *Trie) Commit() { + self.mu.Lock() + defer self.mu.Unlock() + // Hash first self.Hash() @@ -81,10 +87,15 @@ func (self *Trie) Commit() { // Reset should only be called if the trie has been hashed func (self *Trie) Reset() { + self.mu.Lock() + defer self.mu.Unlock() + self.cache.Reset() - revision := self.revisions.Remove(self.revisions.Back()).([]byte) - self.roothash = revision + if self.revisions.Len() > 0 { + revision := self.revisions.Remove(self.revisions.Back()).([]byte) + self.roothash = revision + } value := ethutil.NewValueFromBytes(self.cache.Get(self.roothash)) self.root = self.mknode(value) } @@ -173,7 +184,7 @@ func (self *Trie) insert(node Node, key []byte, value Node) Node { return cpy default: - panic("Invalid node") + panic(fmt.Sprintf("%T: invalid node: %v", node, node)) } } @@ -274,6 +285,8 @@ func (self *Trie) delete(node Node, key []byte) Node { func (self *Trie) mknode(value *ethutil.Value) Node { l := value.Len() switch l { + case 0: + return nil case 2: return NewShortNode(self, trie.CompactDecode(string(value.Get(0).Bytes())), self.mknode(value.Get(1))) case 17: diff --git a/ptrie/trie_test.go b/ptrie/trie_test.go index 5b1c64140..63a8ed36e 100644 --- a/ptrie/trie_test.go +++ b/ptrie/trie_test.go @@ -141,7 +141,7 @@ func TestReplication(t *testing.T) { trie2 := New(trie.roothash, trie.cache.backend) if string(trie2.GetString("horse")) != "stallion" { - t.Error("expected to have harse => stallion") + t.Error("expected to have horse => stallion") } hash := trie2.Hash() diff --git a/state/dump.go b/state/dump.go index c1f5ecf3a..40ecff50c 100644 --- a/state/dump.go +++ b/state/dump.go @@ -22,22 +22,23 @@ type World struct { func (self *StateDB) Dump() []byte { world := World{ - Root: ethutil.Bytes2Hex(self.Trie.GetRoot()), + Root: ethutil.Bytes2Hex(self.trie.Root()), Accounts: make(map[string]Account), } - self.Trie.NewIterator().Each(func(key string, value *ethutil.Value) { - stateObject := NewStateObjectFromBytes([]byte(key), value.Bytes()) + it := self.trie.Iterator() + for it.Next() { + stateObject := NewStateObjectFromBytes(it.Key, it.Value) account := Account{Balance: stateObject.balance.String(), Nonce: stateObject.Nonce, Root: ethutil.Bytes2Hex(stateObject.Root()), CodeHash: ethutil.Bytes2Hex(stateObject.codeHash)} account.Storage = make(map[string]string) - stateObject.EachStorage(func(key string, value *ethutil.Value) { - value.Decode() - account.Storage[ethutil.Bytes2Hex([]byte(key))] = ethutil.Bytes2Hex(value.Bytes()) - }) - world.Accounts[ethutil.Bytes2Hex([]byte(key))] = account - }) + storageIt := stateObject.State.trie.Iterator() + for storageIt.Next() { + account.Storage[ethutil.Bytes2Hex(it.Key)] = ethutil.Bytes2Hex(it.Value) + } + world.Accounts[ethutil.Bytes2Hex(it.Key)] = account + } json, err := json.MarshalIndent(world, "", " ") if err != nil { @@ -50,7 +51,8 @@ func (self *StateDB) Dump() []byte { // Debug stuff func (self *StateObject) CreateOutputForDiff() { fmt.Printf("%x %x %x %x\n", self.Address(), self.State.Root(), self.balance.Bytes(), self.Nonce) - self.EachStorage(func(addr string, value *ethutil.Value) { - fmt.Printf("%x %x\n", addr, value.Bytes()) - }) + it := self.State.trie.Iterator() + for it.Next() { + fmt.Printf("%x %x\n", it.Key, it.Value) + } } diff --git a/state/state.go b/state/state.go deleted file mode 100644 index f77da72f0..000000000 --- a/state/state.go +++ /dev/null @@ -1,325 +0,0 @@ -package state - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/trie" -) - -var statelogger = logger.NewLogger("STATE") - -// StateDBs within the ethereum protocol are used to store anything -// within the merkle trie. StateDBs take care of caching and storing -// nested states. It's the general query interface to retrieve: -// * Contracts -// * Accounts -type StateDB struct { - // The trie for this structure - Trie *trie.Trie - - stateObjects map[string]*StateObject - - manifest *Manifest - - refund map[string]*big.Int - - logs Logs -} - -// Create a new state from a given trie -func New(trie *trie.Trie) *StateDB { - return &StateDB{Trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string]*big.Int)} -} - -func (self *StateDB) EmptyLogs() { - self.logs = nil -} - -func (self *StateDB) AddLog(log Log) { - self.logs = append(self.logs, log) -} - -func (self *StateDB) Logs() Logs { - return self.logs -} - -// Retrieve the balance from the given address or 0 if object not found -func (self *StateDB) GetBalance(addr []byte) *big.Int { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - return stateObject.balance - } - - return ethutil.Big0 -} - -func (self *StateDB) Refund(addr []byte, gas *big.Int) { - if self.refund[string(addr)] == nil { - self.refund[string(addr)] = new(big.Int) - } - self.refund[string(addr)].Add(self.refund[string(addr)], gas) -} - -func (self *StateDB) AddBalance(addr []byte, amount *big.Int) { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - stateObject.AddBalance(amount) - } -} - -func (self *StateDB) GetNonce(addr []byte) uint64 { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - return stateObject.Nonce - } - - return 0 -} - -func (self *StateDB) SetNonce(addr []byte, nonce uint64) { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - stateObject.Nonce = nonce - } -} - -func (self *StateDB) GetCode(addr []byte) []byte { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - return stateObject.Code - } - - return nil -} - -func (self *StateDB) SetCode(addr, code []byte) { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - stateObject.SetCode(code) - } -} - -func (self *StateDB) GetState(a, b []byte) []byte { - stateObject := self.GetStateObject(a) - if stateObject != nil { - return stateObject.GetState(b).Bytes() - } - - return nil -} - -func (self *StateDB) SetState(addr, key []byte, value interface{}) { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - stateObject.SetState(key, ethutil.NewValue(value)) - } -} - -func (self *StateDB) Delete(addr []byte) bool { - stateObject := self.GetStateObject(addr) - if stateObject != nil { - stateObject.MarkForDeletion() - - return true - } - - return false -} - -// -// Setting, updating & deleting state object methods -// - -// Update the given state object and apply it to state trie -func (self *StateDB) UpdateStateObject(stateObject *StateObject) { - addr := stateObject.Address() - - if len(stateObject.CodeHash()) > 0 { - ethutil.Config.Db.Put(stateObject.CodeHash(), stateObject.Code) - } - - self.Trie.Update(string(addr), string(stateObject.RlpEncode())) -} - -// Delete the given state object and delete it from the state trie -func (self *StateDB) DeleteStateObject(stateObject *StateObject) { - self.Trie.Delete(string(stateObject.Address())) - - delete(self.stateObjects, string(stateObject.Address())) -} - -// Retrieve a state object given my the address. Nil if not found -func (self *StateDB) GetStateObject(addr []byte) *StateObject { - addr = ethutil.Address(addr) - - stateObject := self.stateObjects[string(addr)] - if stateObject != nil { - return stateObject - } - - data := self.Trie.Get(string(addr)) - if len(data) == 0 { - return nil - } - - stateObject = NewStateObjectFromBytes(addr, []byte(data)) - self.SetStateObject(stateObject) - - return stateObject -} - -func (self *StateDB) SetStateObject(object *StateObject) { - self.stateObjects[string(object.address)] = object -} - -// Retrieve a state object or create a new state object if nil -func (self *StateDB) GetOrNewStateObject(addr []byte) *StateObject { - stateObject := self.GetStateObject(addr) - if stateObject == nil { - stateObject = self.NewStateObject(addr) - } - - return stateObject -} - -// Create a state object whether it exist in the trie or not -func (self *StateDB) NewStateObject(addr []byte) *StateObject { - addr = ethutil.Address(addr) - - statelogger.Debugf("(+) %x\n", addr) - - stateObject := NewStateObject(addr) - self.stateObjects[string(addr)] = stateObject - - return stateObject -} - -// Deprecated -func (self *StateDB) GetAccount(addr []byte) *StateObject { - return self.GetOrNewStateObject(addr) -} - -// -// Setting, copying of the state methods -// - -func (s *StateDB) Cmp(other *StateDB) bool { - return s.Trie.Cmp(other.Trie) -} - -func (self *StateDB) Copy() *StateDB { - if self.Trie != nil { - state := New(self.Trie.Copy()) - for k, stateObject := range self.stateObjects { - state.stateObjects[k] = stateObject.Copy() - } - - for addr, refund := range self.refund { - state.refund[addr] = new(big.Int).Set(refund) - } - - logs := make(Logs, len(self.logs)) - copy(logs, self.logs) - state.logs = logs - - return state - } - - return nil -} - -func (self *StateDB) Set(state *StateDB) { - if state == nil { - panic("Tried setting 'state' to nil through 'Set'") - } - - self.Trie = state.Trie - self.stateObjects = state.stateObjects - self.refund = state.refund - self.logs = state.logs -} - -func (s *StateDB) Root() []byte { - return s.Trie.GetRoot() -} - -// Resets the trie and all siblings -func (s *StateDB) Reset() { - s.Trie.Undo() - - // Reset all nested states - for _, stateObject := range s.stateObjects { - if stateObject.State == nil { - continue - } - - stateObject.Reset() - } - - s.Empty() -} - -// Syncs the trie and all siblings -func (s *StateDB) Sync() { - // Sync all nested states - for _, stateObject := range s.stateObjects { - if stateObject.State == nil { - continue - } - - stateObject.State.Sync() - } - - s.Trie.Sync() - - s.Empty() -} - -func (self *StateDB) Empty() { - self.stateObjects = make(map[string]*StateObject) - self.refund = make(map[string]*big.Int) -} - -func (self *StateDB) Refunds() map[string]*big.Int { - return self.refund -} - -func (self *StateDB) Update(gasUsed *big.Int) { - var deleted bool - - self.refund = make(map[string]*big.Int) - - for _, stateObject := range self.stateObjects { - if stateObject.remove { - self.DeleteStateObject(stateObject) - deleted = true - } else { - stateObject.Sync() - - self.UpdateStateObject(stateObject) - } - } - - // FIXME trie delete is broken - if deleted { - valid, t2 := trie.ParanoiaCheck(self.Trie) - if !valid { - statelogger.Infof("Warn: PARANOIA: Different state root during copy %x vs %x\n", self.Trie.GetRoot(), t2.GetRoot()) - - self.Trie = t2 - } - } -} - -func (self *StateDB) Manifest() *Manifest { - return self.manifest -} - -// Debug stuff -func (self *StateDB) CreateOutputForDiff() { - for _, stateObject := range self.stateObjects { - stateObject.CreateOutputForDiff() - } -} diff --git a/state/state_object.go b/state/state_object.go index b8af4e702..420ad9757 100644 --- a/state/state_object.go +++ b/state/state_object.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/ptrie" ) type Code []byte @@ -62,7 +62,7 @@ func NewStateObject(addr []byte) *StateObject { address := ethutil.Address(addr) object := &StateObject{address: address, balance: new(big.Int), gasPool: new(big.Int)} - object.State = New(trie.New(ethutil.Config.Db, "")) + object.State = New(ptrie.New(nil, ethutil.Config.Db)) //New(trie.New(ethutil.Config.Db, "")) object.storage = make(Storage) object.gasPool = new(big.Int) @@ -72,7 +72,7 @@ func NewStateObject(addr []byte) *StateObject { func NewContract(address []byte, balance *big.Int, root []byte) *StateObject { contract := NewStateObject(address) contract.balance = balance - contract.State = New(trie.New(ethutil.Config.Db, string(root))) + contract.State = New(ptrie.New(nil, ethutil.Config.Db)) //New(trie.New(ethutil.Config.Db, string(root))) return contract } @@ -89,12 +89,12 @@ func (self *StateObject) MarkForDeletion() { statelogger.DebugDetailf("%x: #%d %v (deletion)\n", self.Address(), self.Nonce, self.balance) } -func (c *StateObject) GetAddr(addr []byte) *ethutil.Value { - return ethutil.NewValueFromBytes([]byte(c.State.Trie.Get(string(addr)))) +func (c *StateObject) getAddr(addr []byte) *ethutil.Value { + return ethutil.NewValueFromBytes([]byte(c.State.trie.Get(addr))) } -func (c *StateObject) SetAddr(addr []byte, value interface{}) { - c.State.Trie.Update(string(addr), string(ethutil.NewValue(value).Encode())) +func (c *StateObject) setAddr(addr []byte, value interface{}) { + c.State.trie.Update(addr, ethutil.Encode(value)) } func (self *StateObject) GetStorage(key *big.Int) *ethutil.Value { @@ -113,7 +113,7 @@ func (self *StateObject) GetState(k []byte) *ethutil.Value { value := self.storage[string(key)] if value == nil { - value = self.GetAddr(key) + value = self.getAddr(key) if !value.IsNil() { self.storage[string(key)] = value @@ -128,6 +128,7 @@ func (self *StateObject) SetState(k []byte, value *ethutil.Value) { self.storage[string(key)] = value.Copy() } +/* // Iterate over each storage address and yield callback func (self *StateObject) EachStorage(cb trie.EachCallback) { // First loop over the uncommit/cached values in storage @@ -145,23 +146,26 @@ func (self *StateObject) EachStorage(cb trie.EachCallback) { } }) } +*/ func (self *StateObject) Sync() { for key, value := range self.storage { if value.Len() == 0 { - self.State.Trie.Delete(string(key)) + self.State.trie.Delete([]byte(key)) continue } - self.SetAddr([]byte(key), value) + self.setAddr([]byte(key), value) } - valid, t2 := trie.ParanoiaCheck(self.State.Trie) - if !valid { - statelogger.Infof("Warn: PARANOIA: Different state storage root during copy %x vs %x\n", self.State.Root(), t2.GetRoot()) + /* + valid, t2 := ptrie.ParanoiaCheck(self.State.trie, ethutil.Config.Db) + if !valid { + statelogger.Infof("Warn: PARANOIA: Different state storage root during copy %x vs %x\n", self.State.Root(), t2.Root()) - self.State.Trie = t2 - } + self.State.trie = t2 + } + */ } func (c *StateObject) GetInstr(pc *big.Int) *ethutil.Value { @@ -276,8 +280,12 @@ func (c *StateObject) Init() Code { return c.InitCode } +func (self *StateObject) Trie() *ptrie.Trie { + return self.State.trie +} + func (self *StateObject) Root() []byte { - return self.State.Trie.GetRoot() + return self.Trie().Root() } func (self *StateObject) SetCode(code []byte) { @@ -302,7 +310,7 @@ func (c *StateObject) RlpDecode(data []byte) { c.Nonce = decoder.Get(0).Uint() c.balance = decoder.Get(1).BigInt() - c.State = New(trie.New(ethutil.Config.Db, decoder.Get(2).Interface())) + c.State = New(ptrie.New(decoder.Get(2).Bytes(), ethutil.Config.Db)) //New(trie.New(ethutil.Config.Db, decoder.Get(2).Interface())) c.storage = make(map[string]*ethutil.Value) c.gasPool = new(big.Int) diff --git a/state/statedb.go b/state/statedb.go new file mode 100644 index 000000000..6a11fc328 --- /dev/null +++ b/state/statedb.go @@ -0,0 +1,326 @@ +package state + +import ( + "bytes" + "math/big" + + "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/ptrie" +) + +var statelogger = logger.NewLogger("STATE") + +// StateDBs within the ethereum protocol are used to store anything +// within the merkle trie. StateDBs take care of caching and storing +// nested states. It's the general query interface to retrieve: +// * Contracts +// * Accounts +type StateDB struct { + //Trie *trie.Trie + trie *ptrie.Trie + + stateObjects map[string]*StateObject + + manifest *Manifest + + refund map[string]*big.Int + + logs Logs +} + +// Create a new state from a given trie +func New(trie *ptrie.Trie) *StateDB { + return &StateDB{trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string]*big.Int)} +} + +func (self *StateDB) EmptyLogs() { + self.logs = nil +} + +func (self *StateDB) AddLog(log Log) { + self.logs = append(self.logs, log) +} + +func (self *StateDB) Logs() Logs { + return self.logs +} + +// Retrieve the balance from the given address or 0 if object not found +func (self *StateDB) GetBalance(addr []byte) *big.Int { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + return stateObject.balance + } + + return ethutil.Big0 +} + +func (self *StateDB) Refund(addr []byte, gas *big.Int) { + if self.refund[string(addr)] == nil { + self.refund[string(addr)] = new(big.Int) + } + self.refund[string(addr)].Add(self.refund[string(addr)], gas) +} + +func (self *StateDB) AddBalance(addr []byte, amount *big.Int) { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + stateObject.AddBalance(amount) + } +} + +func (self *StateDB) GetNonce(addr []byte) uint64 { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + return stateObject.Nonce + } + + return 0 +} + +func (self *StateDB) SetNonce(addr []byte, nonce uint64) { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + stateObject.Nonce = nonce + } +} + +func (self *StateDB) GetCode(addr []byte) []byte { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + return stateObject.Code + } + + return nil +} + +func (self *StateDB) SetCode(addr, code []byte) { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + stateObject.SetCode(code) + } +} + +func (self *StateDB) GetState(a, b []byte) []byte { + stateObject := self.GetStateObject(a) + if stateObject != nil { + return stateObject.GetState(b).Bytes() + } + + return nil +} + +func (self *StateDB) SetState(addr, key []byte, value interface{}) { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + stateObject.SetState(key, ethutil.NewValue(value)) + } +} + +func (self *StateDB) Delete(addr []byte) bool { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + stateObject.MarkForDeletion() + + return true + } + + return false +} + +// +// Setting, updating & deleting state object methods +// + +// Update the given state object and apply it to state trie +func (self *StateDB) UpdateStateObject(stateObject *StateObject) { + addr := stateObject.Address() + + if len(stateObject.CodeHash()) > 0 { + ethutil.Config.Db.Put(stateObject.CodeHash(), stateObject.Code) + } + + self.trie.Update(addr, stateObject.RlpEncode()) +} + +// Delete the given state object and delete it from the state trie +func (self *StateDB) DeleteStateObject(stateObject *StateObject) { + self.trie.Delete(stateObject.Address()) + + delete(self.stateObjects, string(stateObject.Address())) +} + +// Retrieve a state object given my the address. Nil if not found +func (self *StateDB) GetStateObject(addr []byte) *StateObject { + addr = ethutil.Address(addr) + + stateObject := self.stateObjects[string(addr)] + if stateObject != nil { + return stateObject + } + + data := self.trie.Get(addr) + if len(data) == 0 { + return nil + } + + stateObject = NewStateObjectFromBytes(addr, []byte(data)) + self.SetStateObject(stateObject) + + return stateObject +} + +func (self *StateDB) SetStateObject(object *StateObject) { + self.stateObjects[string(object.address)] = object +} + +// Retrieve a state object or create a new state object if nil +func (self *StateDB) GetOrNewStateObject(addr []byte) *StateObject { + stateObject := self.GetStateObject(addr) + if stateObject == nil { + stateObject = self.NewStateObject(addr) + } + + return stateObject +} + +// Create a state object whether it exist in the trie or not +func (self *StateDB) NewStateObject(addr []byte) *StateObject { + addr = ethutil.Address(addr) + + statelogger.Debugf("(+) %x\n", addr) + + stateObject := NewStateObject(addr) + self.stateObjects[string(addr)] = stateObject + + return stateObject +} + +// Deprecated +func (self *StateDB) GetAccount(addr []byte) *StateObject { + return self.GetOrNewStateObject(addr) +} + +// +// Setting, copying of the state methods +// + +func (s *StateDB) Cmp(other *StateDB) bool { + return bytes.Equal(s.trie.Root(), other.trie.Root()) +} + +func (self *StateDB) Copy() *StateDB { + if self.trie != nil { + state := New(self.trie.Copy()) + for k, stateObject := range self.stateObjects { + state.stateObjects[k] = stateObject.Copy() + } + + for addr, refund := range self.refund { + state.refund[addr] = new(big.Int).Set(refund) + } + + logs := make(Logs, len(self.logs)) + copy(logs, self.logs) + state.logs = logs + + return state + } + + return nil +} + +func (self *StateDB) Set(state *StateDB) { + if state == nil { + panic("Tried setting 'state' to nil through 'Set'") + } + + self.trie = state.trie + self.stateObjects = state.stateObjects + self.refund = state.refund + self.logs = state.logs +} + +func (s *StateDB) Root() []byte { + return s.trie.Root() +} + +// Resets the trie and all siblings +func (s *StateDB) Reset() { + s.trie.Reset() + + // Reset all nested states + for _, stateObject := range s.stateObjects { + if stateObject.State == nil { + continue + } + + stateObject.Reset() + } + + s.Empty() +} + +// Syncs the trie and all siblings +func (s *StateDB) Sync() { + // Sync all nested states + for _, stateObject := range s.stateObjects { + if stateObject.State == nil { + continue + } + + stateObject.State.Sync() + } + + s.trie.Commit() + + s.Empty() +} + +func (self *StateDB) Empty() { + self.stateObjects = make(map[string]*StateObject) + self.refund = make(map[string]*big.Int) +} + +func (self *StateDB) Refunds() map[string]*big.Int { + return self.refund +} + +func (self *StateDB) Update(gasUsed *big.Int) { + var deleted bool + + self.refund = make(map[string]*big.Int) + + for _, stateObject := range self.stateObjects { + if stateObject.remove { + self.DeleteStateObject(stateObject) + deleted = true + } else { + stateObject.Sync() + + self.UpdateStateObject(stateObject) + } + } + + // FIXME trie delete is broken + if deleted { + valid, t2 := ptrie.ParanoiaCheck(self.trie, ethutil.Config.Db) + if !valid { + statelogger.Infof("Warn: PARANOIA: Different state root during copy %x vs %x\n", self.trie.Root(), t2.Root()) + + self.trie = t2 + } + } +} + +func (self *StateDB) Manifest() *Manifest { + return self.manifest +} + +// Debug stuff +func (self *StateDB) CreateOutputForDiff() { + for _, stateObject := range self.stateObjects { + stateObject.CreateOutputForDiff() + } +} diff --git a/xeth/hexface.go b/xeth/hexface.go index 6c084f947..c3d8cef86 100644 --- a/xeth/hexface.go +++ b/xeth/hexface.go @@ -138,10 +138,10 @@ type KeyVal struct { func (self *JSXEth) EachStorage(addr string) string { var values []KeyVal object := self.World().SafeGet(ethutil.Hex2Bytes(addr)) - object.EachStorage(func(name string, value *ethutil.Value) { - value.Decode() - values = append(values, KeyVal{ethutil.Bytes2Hex([]byte(name)), ethutil.Bytes2Hex(value.Bytes())}) - }) + it := object.Trie().Iterator() + for it.Next() { + values = append(values, KeyVal{ethutil.Bytes2Hex(it.Key), ethutil.Bytes2Hex(it.Value)}) + } valuesJson, err := json.Marshal(values) if err != nil { -- cgit v1.2.3 From fb1edd05f40bad04f2514d1463b5593dc51e9f77 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 24 Dec 2014 11:20:43 +0100 Subject: Removed the deferred reset --- core/block_manager.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/core/block_manager.go b/core/block_manager.go index 1b9da1269..8a5455306 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -185,12 +185,6 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I state := state.New(parent.Trie().Copy()) - // Defer the Undo on the Trie. If the block processing happened - // we don't want to undo but since undo only happens on dirty - // nodes this won't happen because Commit would have been called - // before that. - defer state.Reset() - // Block validation if err = sm.ValidateBlock(block, parent); err != nil { return -- cgit v1.2.3 From 7ba9fe4d5d46d4a9373327d52d1c0e82d5933bc1 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 24 Dec 2014 11:29:58 +0100 Subject: Reset peer during download on disc --- peer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/peer.go b/peer.go index 13f0239d4..ceb49a5af 100644 --- a/peer.go +++ b/peer.go @@ -412,6 +412,12 @@ func (p *Peer) HandleInbound() { //} case wire.MsgDiscTy: + blockPool := p.ethereum.blockPool + if blockPool.peer == p { + blockPool.peer = nil + blockPool.td = ethutil.Big0 + } + p.Stop() peerlogger.Infoln("Disconnect peer: ", DiscReason(msg.Data.Get(0).Uint())) case wire.MsgPingTy: -- cgit v1.2.3 From c9f963a77e6e728c90e08c0e0008f1dc40df1fe0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 24 Dec 2014 11:30:04 +0100 Subject: Bump --- cmd/ethereum/main.go | 2 +- cmd/mist/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 2a3c46054..30107c145 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -30,7 +30,7 @@ import ( const ( ClientIdentifier = "Ethereum(G)" - Version = "0.7.10" + Version = "0.7.11" ) var clilogger = logger.NewLogger("CLI") diff --git a/cmd/mist/main.go b/cmd/mist/main.go index eaf0af0c7..c6dc80171 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -31,7 +31,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.10" + Version = "0.7.11" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 58d477f7a676563c5237df9c0cfd20ddba5df03c Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 24 Dec 2014 14:47:50 +0100 Subject: Fixed a bug where keys where serialised twice --- ptrie/fullnode.go | 5 +++-- ptrie/iterator.go | 2 +- ptrie/node.go | 4 ++-- ptrie/trie.go | 24 +++++++++++++++++------- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ptrie/fullnode.go b/ptrie/fullnode.go index d6b0745ec..4dd98049d 100644 --- a/ptrie/fullnode.go +++ b/ptrie/fullnode.go @@ -23,7 +23,9 @@ func (self *FullNode) Branches() []Node { func (self *FullNode) Copy() Node { nnode := NewFullNode(self.trie) for i, node := range self.nodes { - nnode.nodes[i] = node + if node != nil { + nnode.nodes[i] = node + } } return nnode @@ -60,7 +62,6 @@ func (self *FullNode) RlpData() interface{} { func (self *FullNode) set(k byte, value Node) { if _, ok := value.(*ValueNode); ok && k != 16 { fmt.Println(value, k) - panic(":(") } self.nodes[int(k)] = value diff --git a/ptrie/iterator.go b/ptrie/iterator.go index 5714bdbc8..787ba09c0 100644 --- a/ptrie/iterator.go +++ b/ptrie/iterator.go @@ -14,7 +14,7 @@ type Iterator struct { } func NewIterator(trie *Trie) *Iterator { - return &Iterator{trie: trie, Key: []byte{0}} + return &Iterator{trie: trie, Key: make([]byte, 32)} } func (self *Iterator) Next() bool { diff --git a/ptrie/node.go b/ptrie/node.go index 2c85dbce7..ab90a1a02 100644 --- a/ptrie/node.go +++ b/ptrie/node.go @@ -17,7 +17,7 @@ type Node interface { func (self *ValueNode) String() string { return self.fstring("") } func (self *FullNode) String() string { return self.fstring("") } func (self *ShortNode) String() string { return self.fstring("") } -func (self *ValueNode) fstring(ind string) string { return fmt.Sprintf("%s ", self.data) } +func (self *ValueNode) fstring(ind string) string { return fmt.Sprintf("%x ", self.data) } func (self *HashNode) fstring(ind string) string { return fmt.Sprintf("%x ", self.key) } // Full node @@ -36,5 +36,5 @@ func (self *FullNode) fstring(ind string) string { // Short node func (self *ShortNode) fstring(ind string) string { - return fmt.Sprintf("[ %s: %v ] ", self.key, self.value.fstring(ind+" ")) + return fmt.Sprintf("[ %x: %v ] ", self.key, self.value.fstring(ind+" ")) } diff --git a/ptrie/trie.go b/ptrie/trie.go index d8135f36c..5c83b57d0 100644 --- a/ptrie/trie.go +++ b/ptrie/trie.go @@ -215,7 +215,7 @@ func (self *Trie) get(node Node, key []byte) Node { } func (self *Trie) delete(node Node, key []byte) Node { - if len(key) == 0 { + if len(key) == 0 && node == nil { return nil } @@ -234,7 +234,9 @@ func (self *Trie) delete(node Node, key []byte) Node { nkey := append(k, child.Key()...) n = NewShortNode(self, nkey, child.Value()) case *FullNode: - n = NewShortNode(self, node.key, child) + sn := NewShortNode(self, node.Key(), child) + sn.key = node.key + n = sn } return n @@ -275,9 +277,10 @@ func (self *Trie) delete(node Node, key []byte) Node { } return nnode - + case nil: + return nil default: - panic("Invalid node") + panic(fmt.Sprintf("%T: invalid node: %v (%v)", node, node, key)) } } @@ -288,7 +291,10 @@ func (self *Trie) mknode(value *ethutil.Value) Node { case 0: return nil case 2: - return NewShortNode(self, trie.CompactDecode(string(value.Get(0).Bytes())), self.mknode(value.Get(1))) + // A value node may consists of 2 bytes. + if value.Get(0).Len() != 0 { + return NewShortNode(self, trie.CompactDecode(string(value.Get(0).Bytes())), self.mknode(value.Get(1))) + } case 17: fnode := NewFullNode(self) for i := 0; i < l; i++ { @@ -297,9 +303,9 @@ func (self *Trie) mknode(value *ethutil.Value) Node { return fnode case 32: return &HashNode{value.Bytes()} - default: - return &ValueNode{self, value.Bytes()} } + + return &ValueNode{self, value.Bytes()} } func (self *Trie) trans(node Node) Node { @@ -323,3 +329,7 @@ func (self *Trie) store(node Node) interface{} { return node.RlpData() } + +func (self *Trie) PrintRoot() { + fmt.Println(self.root) +} -- cgit v1.2.3 From dc7c584a4de371e449752dce5b5e90b26c83d0bb Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 24 Dec 2014 14:54:06 +0100 Subject: export => import --- cmd/ethereum/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 3f9a2a838..7efee31e7 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -120,7 +120,7 @@ func main() { if err != nil { clilogger.Infoln(err) } - clilogger.Infoln("export done in", time.Since(start)) + clilogger.Infoln("import done in", time.Since(start)) return } -- cgit v1.2.3 From ce68ac695981523aca5cf83e051597f46070547d Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 13:18:19 +0100 Subject: Updated miner to new block api --- miner/miner.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/miner/miner.go b/miner/miner.go index c9a6922bb..aefcadab8 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -190,9 +190,11 @@ func (self *Miner) mine() { transactions := self.finiliseTxs() + state := block.State() + // Accumulate all valid transactions and apply them to the new state // Error may be ignored. It's not important during mining - receipts, txs, _, erroneous, err := blockManager.ApplyTransactions(coinbase, block.State(), block, transactions, true) + receipts, txs, _, erroneous, err := blockManager.ApplyTransactions(coinbase, state, block, transactions, true) if err != nil { minerlogger.Debugln(err) } @@ -202,9 +204,10 @@ func (self *Miner) mine() { block.SetReceipts(receipts) // Accumulate the rewards included for this block - blockManager.AccumelateRewards(block.State(), block, parent) + blockManager.AccumelateRewards(state, block, parent) - block.State().Update(ethutil.Big0) + state.Update(ethutil.Big0) + block.SetRoot(state.Root()) minerlogger.Infof("Mining on block. Includes %v transactions", len(transactions)) -- cgit v1.2.3 From 2f8a45cd8b2f565359f2c955145047acca2a2433 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 13:32:01 +0100 Subject: Fixed chain test & added new chain --- _data/chain1 | Bin 175331 -> 18036 bytes _data/chain2 | Bin 28118 -> 6125 bytes core/chain_manager_test.go | 47 +++++++++++++++++++++++++++++++-------------- core/helper_test.go | 6 +++--- core/types/block.go | 1 + 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/_data/chain1 b/_data/chain1 index ef392e001..809a55f1a 100755 Binary files a/_data/chain1 and b/_data/chain1 differ diff --git a/_data/chain2 b/_data/chain2 index 48ed4d5ea..3e9d2971a 100755 Binary files a/_data/chain2 and b/_data/chain2 differ diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index 52be8b0ea..6e85bae9a 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -2,7 +2,9 @@ package core import ( "fmt" + "os" "path" + "reflect" "runtime" "testing" @@ -10,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/rlp" //logpkg "github.com/ethereum/go-ethereum/logger" ) @@ -30,20 +33,19 @@ func init() { ethutil.Config.Db = db } -func loadChain(fn string, t *testing.T) types.Blocks { - c1, err := ethutil.ReadAllFile(path.Join("..", "_data", fn)) +func loadChain(fn string, t *testing.T) (types.Blocks, error) { + fh, err := os.OpenFile(path.Join("..", "_data", fn), os.O_RDONLY, os.ModePerm) if err != nil { - fmt.Println(err) - t.FailNow() + return nil, err } - value := ethutil.NewValueFromBytes([]byte(c1)) - blocks := make(types.Blocks, value.Len()) - it := value.NewIterator() - for it.Next() { - blocks[it.Idx()] = types.NewBlockFromRlpValue(it.Value()) + defer fh.Close() + + var chain types.Blocks + if err := rlp.Decode(fh, &chain); err != nil { + return nil, err } - return blocks + return chain, nil } func insertChain(done chan bool, chainMan *ChainManager, chain types.Blocks, t *testing.T) { @@ -56,11 +58,21 @@ func insertChain(done chan bool, chainMan *ChainManager, chain types.Blocks, t * } func TestChainInsertions(t *testing.T) { - chain1 := loadChain("chain1", t) - chain2 := loadChain("chain2", t) + chain1, err := loadChain("chain1", t) + if err != nil { + fmt.Println(err) + t.FailNow() + } + + chain2, err := loadChain("chain2", t) + if err != nil { + fmt.Println(err) + t.FailNow() + } + var eventMux event.TypeMux chainMan := NewChainManager(&eventMux) - txPool := NewTxPool(chainMan, nil, &eventMux) + txPool := NewTxPool(chainMan, &eventMux) blockMan := NewBlockManager(txPool, chainMan, &eventMux) chainMan.SetProcessor(blockMan) @@ -73,5 +85,12 @@ func TestChainInsertions(t *testing.T) { for i := 0; i < max; i++ { <-done } - fmt.Println(chainMan.CurrentBlock()) + + if reflect.DeepEqual(chain2[len(chain2)-1], chainMan.CurrentBlock()) { + t.Error("chain2 is canonical and shouldn't be") + } + + if !reflect.DeepEqual(chain1[len(chain1)-1], chainMan.CurrentBlock()) { + t.Error("chain1 isn't canonical and should be") + } } diff --git a/core/helper_test.go b/core/helper_test.go index b340144fd..b8bf254d7 100644 --- a/core/helper_test.go +++ b/core/helper_test.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/wire" + "github.com/ethereum/go-ethereum/p2p" ) // Implement our EthTest Manager @@ -54,11 +54,11 @@ func (tm *TestManager) TxPool() *TxPool { func (tm *TestManager) EventMux() *event.TypeMux { return tm.eventMux } -func (tm *TestManager) Broadcast(msgType wire.MsgType, data []interface{}) { +func (tm *TestManager) Broadcast(msgType p2p.Msg, data []interface{}) { fmt.Println("Broadcast not implemented") } -func (tm *TestManager) ClientIdentity() wire.ClientIdentity { +func (tm *TestManager) ClientIdentity() p2p.ClientIdentity { return nil } func (tm *TestManager) KeyManager() *crypto.KeyManager { diff --git a/core/types/block.go b/core/types/block.go index 054767d67..7b4695f73 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -199,6 +199,7 @@ func (self *Block) Hash() []byte { return self.header.Hash() } func (self *Block) Trie() *ptrie.Trie { return ptrie.New(self.header.Root, ethutil.Config.Db) } func (self *Block) State() *state.StateDB { return state.New(self.Trie()) } func (self *Block) Size() ethutil.StorageSize { return ethutil.StorageSize(len(ethutil.Encode(self))) } +func (self *Block) SetRoot(root []byte) { self.header.Root = root } // Implement block.Pow func (self *Block) Difficulty() *big.Int { return self.header.Difficulty } -- cgit v1.2.3 From 8df689bd448390c44ee2c344314257a5987a2e97 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 15:42:26 +0100 Subject: Chain tests --- _data/chain1 | Bin 18036 -> 0 bytes _data/chain2 | Bin 6125 -> 0 bytes _data/invalid1 | Bin 0 -> 36072 bytes _data/valid1 | Bin 0 -> 18036 bytes _data/valid2 | Bin 0 -> 6125 bytes _data/valid3 | Bin 0 -> 14712 bytes _data/valid4 | Bin 0 -> 12496 bytes core/chain_manager_test.go | 53 ++++++++++++++++++++++++++++++++++++++++----- 8 files changed, 48 insertions(+), 5 deletions(-) delete mode 100755 _data/chain1 delete mode 100755 _data/chain2 create mode 100755 _data/invalid1 create mode 100755 _data/valid1 create mode 100755 _data/valid2 create mode 100755 _data/valid3 create mode 100755 _data/valid4 diff --git a/_data/chain1 b/_data/chain1 deleted file mode 100755 index 809a55f1a..000000000 Binary files a/_data/chain1 and /dev/null differ diff --git a/_data/chain2 b/_data/chain2 deleted file mode 100755 index 3e9d2971a..000000000 Binary files a/_data/chain2 and /dev/null differ diff --git a/_data/invalid1 b/_data/invalid1 new file mode 100755 index 000000000..9c24b13e8 Binary files /dev/null and b/_data/invalid1 differ diff --git a/_data/valid1 b/_data/valid1 new file mode 100755 index 000000000..809a55f1a Binary files /dev/null and b/_data/valid1 differ diff --git a/_data/valid2 b/_data/valid2 new file mode 100755 index 000000000..3e9d2971a Binary files /dev/null and b/_data/valid2 differ diff --git a/_data/valid3 b/_data/valid3 new file mode 100755 index 000000000..685bc9fd7 Binary files /dev/null and b/_data/valid3 differ diff --git a/_data/valid4 b/_data/valid4 new file mode 100755 index 000000000..fc016057f Binary files /dev/null and b/_data/valid4 differ diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index 6e85bae9a..108718901 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -6,6 +6,7 @@ import ( "path" "reflect" "runtime" + "strconv" "testing" "github.com/ethereum/go-ethereum/core/types" @@ -13,15 +14,15 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/rlp" - //logpkg "github.com/ethereum/go-ethereum/logger" ) //var Logger logpkg.LogSystem + //var Log = logpkg.NewLogger("TEST") func init() { runtime.GOMAXPROCS(runtime.NumCPU()) - //Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.InfoLevel) + //Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.DebugLevel) //logpkg.AddLogSystem(Logger) ethutil.ReadConfig("/tmp/ethtest", "/tmp/ethtest", "ETH") @@ -50,21 +51,22 @@ func loadChain(fn string, t *testing.T) (types.Blocks, error) { func insertChain(done chan bool, chainMan *ChainManager, chain types.Blocks, t *testing.T) { err := chainMan.InsertChain(chain) + done <- true if err != nil { fmt.Println(err) t.FailNow() } - done <- true } func TestChainInsertions(t *testing.T) { - chain1, err := loadChain("chain1", t) + chain1, err := loadChain("valid1", t) if err != nil { fmt.Println(err) t.FailNow() } + fmt.Println(len(chain1)) - chain2, err := loadChain("chain2", t) + chain2, err := loadChain("valid2", t) if err != nil { fmt.Println(err) t.FailNow() @@ -94,3 +96,44 @@ func TestChainInsertions(t *testing.T) { t.Error("chain1 isn't canonical and should be") } } + +func TestChainMultipleInsertions(t *testing.T) { + const max = 4 + chains := make([]types.Blocks, max) + var longest int + for i := 0; i < max; i++ { + var err error + name := "valid" + strconv.Itoa(i+1) + chains[i], err = loadChain(name, t) + if len(chains[i]) >= len(chains[longest]) { + longest = i + } + fmt.Println("loaded", name, "with a length of", len(chains[i])) + if err != nil { + fmt.Println(err) + t.FailNow() + } + } + + var eventMux event.TypeMux + chainMan := NewChainManager(&eventMux) + txPool := NewTxPool(chainMan, &eventMux) + blockMan := NewBlockManager(txPool, chainMan, &eventMux) + chainMan.SetProcessor(blockMan) + done := make(chan bool, max) + for i, chain := range chains { + var i int = i + go func() { + insertChain(done, chainMan, chain, t) + fmt.Println(i, "done") + }() + } + + for i := 0; i < max; i++ { + <-done + } + + if !reflect.DeepEqual(chains[longest][len(chains[longest])-1], chainMan.CurrentBlock()) { + t.Error("Invalid canonical chain") + } +} -- cgit v1.2.3 From 1085960ed8550eb64ae7031b43b1174c8f1c8f94 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 15:58:40 +0100 Subject: fixed trie --- cmd/evm/main.go | 4 ++-- tests/helper/trie.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 2bdfdfa9f..66bba7289 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -37,8 +37,8 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/ptrie" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/vm" ) @@ -65,7 +65,7 @@ func main() { ethutil.ReadConfig("/tmp/evmtest", "/tmp/evm", "") db, _ := ethdb.NewMemDatabase() - statedb := state.New(trie.New(db, "")) + statedb := state.New(ptrie.New(nil, db)) sender := statedb.NewStateObject([]byte("sender")) receiver := statedb.NewStateObject([]byte("receiver")) //receiver.SetCode([]byte(*code)) diff --git a/tests/helper/trie.go b/tests/helper/trie.go index 32432cc7a..3cfb0bbe5 100644 --- a/tests/helper/trie.go +++ b/tests/helper/trie.go @@ -1,6 +1,6 @@ package helper -import "github.com/ethereum/go-ethereum/trie" +import "github.com/ethereum/go-ethereum/ptrie" type MemDatabase struct { db map[string][]byte @@ -24,8 +24,8 @@ func (db *MemDatabase) Print() {} func (db *MemDatabase) Close() {} func (db *MemDatabase) LastKnownTD() []byte { return nil } -func NewTrie() *trie.Trie { +func NewTrie() *ptrie.Trie { db, _ := NewMemDatabase() - return trie.New(db, "") + return ptrie.New(nil, db) } -- cgit v1.2.3 From 29c887ef2c39e91951e1ae14e7c4276334c434a4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 16:16:02 +0100 Subject: Removed incorrect range check for push --- vm/closure.go | 17 +++++++---------- vm/vm_debug.go | 5 +++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/vm/closure.go b/vm/closure.go index 97b31ada0..df216f2ae 100644 --- a/vm/closure.go +++ b/vm/closure.go @@ -1,8 +1,10 @@ package vm import ( + "math" "math/big" + "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" ) @@ -51,19 +53,14 @@ func (c *Closure) GetByte(x uint64) byte { } func (c *Closure) GetBytes(x, y int) []byte { - if x >= len(c.Code) || y >= len(c.Code) { - return nil - } - - return c.Code[x : x+y] + return c.GetRangeValue(uint64(x), uint64(y)) } -func (c *Closure) GetRangeValue(x, y uint64) []byte { - if x >= uint64(len(c.Code)) || y >= uint64(len(c.Code)) { - return nil - } +func (c *Closure) GetRangeValue(x, size uint64) []byte { + x = uint64(math.Min(float64(x), float64(len(c.Code)))) + y := uint64(math.Min(float64(x+size), float64(len(c.Code)))) - return c.Code[x : x+y] + return ethutil.LeftPadBytes(c.Code[x:y], int(size)) } func (c *Closure) Return(ret []byte) []byte { diff --git a/vm/vm_debug.go b/vm/vm_debug.go index aa3291e66..2ee13c516 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -716,7 +716,8 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * //a := big.NewInt(int64(op) - int64(PUSH1) + 1) a := uint64(op - PUSH1 + 1) //pc.Add(pc, ethutil.Big1) - val := ethutil.BigD(closure.GetRangeValue(pc+1, a)) + byts := closure.GetRangeValue(pc+1, a) + val := ethutil.BigD(byts) // Push value to stack stack.Push(val) pc += a @@ -724,7 +725,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * step += int(op) - int(PUSH1) + 1 - self.Printf(" => 0x%x", val.Bytes()) + self.Printf(" => 0x%x", byts) case POP: stack.Pop() case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: -- cgit v1.2.3 From 2ebf33ac1cd41277a296176198cfde9085948c0c Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 16:17:56 +0100 Subject: removed variable --- vm/vm_debug.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 2ee13c516..9a538c940 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -713,15 +713,11 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * // 0x50 range case PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH17, PUSH18, PUSH19, PUSH20, PUSH21, PUSH22, PUSH23, PUSH24, PUSH25, PUSH26, PUSH27, PUSH28, PUSH29, PUSH30, PUSH31, PUSH32: - //a := big.NewInt(int64(op) - int64(PUSH1) + 1) a := uint64(op - PUSH1 + 1) - //pc.Add(pc, ethutil.Big1) byts := closure.GetRangeValue(pc+1, a) - val := ethutil.BigD(byts) // Push value to stack - stack.Push(val) + stack.Push(ethutil.BigD(byts)) pc += a - //pc.Add(pc, a.Sub(a, big.NewInt(1))) step += int(op) - int(PUSH1) + 1 -- cgit v1.2.3 From cc5e621fc4d80269c335001528667e668ae267ee Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 16:18:46 +0100 Subject: updated tests --- tests/files/StateTests/stInitCodeTest.json | 76 +++++++-- tests/files/StateTests/stSystemOperationsTest.json | 188 ++++++++++++++++++++- tests/files/TrieTests/trietest.json | 55 ++++++ tests/files/VMTests/RandomTests/201412231524.json | 46 +++++ tests/files/VMTests/RandomTests/201412231526.json | 46 +++++ tests/files/VMTests/RandomTests/201412231529.json | 46 +++++ tests/files/VMTests/RandomTests/201412231535.json | 46 +++++ tests/files/VMTests/RandomTests/201412231543.json | 46 +++++ tests/files/VMTests/RandomTests/201412231544.json | 46 +++++ tests/files/VMTests/RandomTests/201412231545.json | 46 +++++ tests/files/VMTests/RandomTests/201412231546.json | 46 +++++ tests/files/VMTests/RandomTests/201412231549.json | 46 +++++ tests/files/VMTests/RandomTests/201412231551.json | 46 +++++ tests/files/VMTests/RandomTests/201412231552.json | 46 +++++ tests/files/VMTests/RandomTests/201412231553.json | 46 +++++ tests/files/VMTests/RandomTests/201412231556.json | 46 +++++ tests/files/VMTests/RandomTests/201412231557.json | 46 +++++ tests/files/VMTests/RandomTests/201412231558.json | 46 +++++ tests/files/VMTests/RandomTests/201412231559.json | 46 +++++ tests/files/VMTests/RandomTests/201412231601.json | 46 +++++ tests/files/VMTests/RandomTests/201412231602.json | 53 ++++++ tests/files/VMTests/RandomTests/201412231604.json | 46 +++++ tests/files/VMTests/RandomTests/201412231606.json | 46 +++++ tests/files/VMTests/RandomTests/201412231610.json | 46 +++++ tests/files/VMTests/RandomTests/201412231611.json | 46 +++++ tests/files/VMTests/RandomTests/201412231612.json | 46 +++++ tests/files/VMTests/RandomTests/201412231613.json | 46 +++++ tests/files/VMTests/RandomTests/201412231616.json | 53 ++++++ tests/files/VMTests/RandomTests/201412231617.json | 46 +++++ tests/files/VMTests/RandomTests/201412231619.json | 46 +++++ tests/files/VMTests/RandomTests/201412231620.json | 46 +++++ tests/files/VMTests/RandomTests/201412231622.json | 46 +++++ tests/files/VMTests/RandomTests/201412231623.json | 46 +++++ tests/files/VMTests/RandomTests/201412231625.json | 46 +++++ tests/files/VMTests/RandomTests/201412231626.json | 46 +++++ tests/files/VMTests/RandomTests/201412231627.json | 46 +++++ tests/files/VMTests/RandomTests/201412231629.json | 46 +++++ tests/files/VMTests/RandomTests/201412231630.json | 46 +++++ tests/files/VMTests/RandomTests/201412231631.json | 53 ++++++ tests/files/VMTests/RandomTests/201412231632.json | 46 +++++ tests/files/VMTests/RandomTests/201412231633.json | 46 +++++ tests/files/VMTests/RandomTests/201412231634.json | 46 +++++ tests/files/VMTests/RandomTests/201412231635.json | 46 +++++ tests/files/VMTests/RandomTests/201412231637.json | 46 +++++ tests/files/VMTests/RandomTests/201412231638.json | 46 +++++ tests/files/VMTests/RandomTests/201412231641.json | 46 +++++ tests/files/VMTests/RandomTests/201412231642.json | 46 +++++ tests/files/VMTests/RandomTests/201412231646.json | 46 +++++ tests/files/VMTests/RandomTests/201412231647.json | 46 +++++ tests/files/VMTests/RandomTests/201412231648.json | 46 +++++ tests/files/VMTests/RandomTests/201412231649.json | 46 +++++ tests/files/VMTests/RandomTests/201412231650.json | 46 +++++ tests/files/VMTests/RandomTests/201412231652.json | 46 +++++ tests/files/VMTests/RandomTests/201412231655.json | 46 +++++ tests/files/VMTests/RandomTests/201412231656.json | 46 +++++ tests/files/VMTests/RandomTests/201412231657.json | 46 +++++ tests/files/VMTests/RandomTests/201412231700.json | 46 +++++ tests/files/VMTests/RandomTests/201412231706.json | 46 +++++ tests/files/VMTests/RandomTests/201412231707.json | 31 ++++ tests/files/VMTests/RandomTests/201412231708.json | 46 +++++ tests/files/VMTests/RandomTests/201412231711.json | 46 +++++ tests/files/VMTests/RandomTests/201412231712.json | 46 +++++ tests/files/VMTests/RandomTests/201412231714.json | 46 +++++ tests/files/VMTests/RandomTests/201412231715.json | 46 +++++ tests/files/VMTests/RandomTests/201412231717.json | 46 +++++ tests/files/VMTests/RandomTests/201412231723.json | 46 +++++ tests/files/VMTests/RandomTests/201412231727.json | 46 +++++ tests/files/VMTests/RandomTests/201412232225.json | 46 +++++ tests/files/VMTests/RandomTests/201412232226.json | 31 ++++ tests/files/VMTests/RandomTests/201412232228.json | 46 +++++ tests/files/VMTests/RandomTests/201412232230.json | 46 +++++ tests/files/VMTests/RandomTests/201412232231.json | 46 +++++ tests/files/VMTests/RandomTests/201412232232.json | 46 +++++ tests/files/VMTests/RandomTests/201412232233.json | 46 +++++ tests/files/VMTests/RandomTests/201412232234.json | 46 +++++ tests/files/VMTests/RandomTests/201412232235.json | 53 ++++++ tests/files/VMTests/RandomTests/201412232236.json | 46 +++++ tests/files/VMTests/RandomTests/201412232237.json | 46 +++++ tests/files/VMTests/RandomTests/201412232238.json | 46 +++++ tests/files/VMTests/RandomTests/201412232239.json | 46 +++++ tests/files/VMTests/RandomTests/201412232240.json | 46 +++++ tests/files/VMTests/RandomTests/201412232241.json | 46 +++++ tests/files/VMTests/RandomTests/201412232242.json | 46 +++++ tests/files/VMTests/RandomTests/201412232243.json | 46 +++++ tests/files/VMTests/RandomTests/201412232244.json | 46 +++++ tests/files/VMTests/RandomTests/201412232245.json | 46 +++++ tests/files/VMTests/RandomTests/201412232246.json | 46 +++++ tests/files/VMTests/RandomTests/201412232247.json | 46 +++++ tests/files/VMTests/RandomTests/201412232248.json | 46 +++++ tests/files/VMTests/RandomTests/201412232249.json | 46 +++++ tests/files/VMTests/RandomTests/201412232250.json | 46 +++++ tests/files/VMTests/RandomTests/201412232252.json | 46 +++++ tests/files/VMTests/RandomTests/201412232253.json | 53 ++++++ tests/files/VMTests/RandomTests/201412232254.json | 46 +++++ tests/files/VMTests/RandomTests/201412232255.json | 46 +++++ tests/files/VMTests/RandomTests/201412232256.json | 53 ++++++ tests/files/VMTests/RandomTests/201412232257.json | 46 +++++ tests/files/VMTests/RandomTests/201412232258.json | 46 +++++ tests/files/VMTests/RandomTests/201412232300.json | 46 +++++ tests/files/VMTests/RandomTests/201412232301.json | 46 +++++ tests/files/VMTests/RandomTests/201412232303.json | 46 +++++ tests/files/VMTests/RandomTests/201412232304.json | 46 +++++ tests/files/VMTests/RandomTests/201412232305.json | 46 +++++ tests/files/VMTests/RandomTests/201412232306.json | 46 +++++ tests/files/VMTests/RandomTests/201412232307.json | 46 +++++ tests/files/VMTests/RandomTests/201412232308.json | 46 +++++ tests/files/VMTests/RandomTests/201412232309.json | 46 +++++ tests/files/VMTests/RandomTests/201412232311.json | 46 +++++ tests/files/VMTests/RandomTests/201412232312.json | 31 ++++ tests/files/VMTests/RandomTests/201412232313.json | 46 +++++ tests/files/VMTests/RandomTests/201412232314.json | 46 +++++ tests/files/VMTests/RandomTests/201412232317.json | 46 +++++ tests/files/VMTests/RandomTests/201412232318.json | 46 +++++ tests/files/VMTests/RandomTests/201412232319.json | 46 +++++ tests/files/VMTests/RandomTests/201412232320.json | 46 +++++ tests/files/VMTests/RandomTests/201412232321.json | 31 ++++ tests/files/VMTests/RandomTests/201412232323.json | 46 +++++ tests/files/VMTests/RandomTests/201412232324.json | 46 +++++ tests/files/VMTests/RandomTests/201412232327.json | 46 +++++ tests/files/VMTests/RandomTests/201412232328.json | 46 +++++ tests/files/VMTests/RandomTests/201412232330.json | 46 +++++ tests/files/VMTests/RandomTests/201412232331.json | 46 +++++ tests/files/VMTests/RandomTests/201412232335.json | 46 +++++ tests/files/VMTests/RandomTests/201412232336.json | 46 +++++ tests/files/VMTests/RandomTests/201412232338.json | 46 +++++ tests/files/VMTests/RandomTests/201412232341.json | 46 +++++ tests/files/VMTests/RandomTests/201412232342.json | 46 +++++ tests/files/VMTests/RandomTests/201412232343.json | 46 +++++ tests/files/VMTests/RandomTests/201412232345.json | 46 +++++ tests/files/VMTests/RandomTests/201412232348.json | 31 ++++ tests/files/VMTests/RandomTests/201412232349.json | 46 +++++ tests/files/VMTests/RandomTests/201412232351.json | 46 +++++ tests/files/VMTests/RandomTests/201412232352.json | 31 ++++ tests/files/VMTests/RandomTests/201412232353.json | 46 +++++ tests/files/VMTests/RandomTests/201412232354.json | 46 +++++ tests/files/VMTests/RandomTests/201412232355.json | 46 +++++ tests/files/VMTests/RandomTests/201412232356.json | 46 +++++ tests/files/VMTests/RandomTests/201412232357.json | 46 +++++ tests/files/VMTests/RandomTests/201412232358.json | 46 +++++ tests/files/VMTests/RandomTests/201412232359.json | 31 ++++ tests/files/VMTests/RandomTests/201412240001.json | 46 +++++ tests/files/VMTests/RandomTests/201412240002.json | 46 +++++ tests/files/VMTests/RandomTests/201412240004.json | 31 ++++ tests/files/VMTests/RandomTests/201412240005.json | 46 +++++ tests/files/VMTests/RandomTests/201412240006.json | 46 +++++ tests/files/VMTests/RandomTests/201412240007.json | 46 +++++ tests/files/VMTests/RandomTests/201412240010.json | 46 +++++ tests/files/VMTests/RandomTests/201412240011.json | 46 +++++ tests/files/VMTests/RandomTests/201412240012.json | 46 +++++ tests/files/VMTests/RandomTests/201412240013.json | 46 +++++ tests/files/VMTests/RandomTests/201412240014.json | 46 +++++ tests/files/VMTests/RandomTests/201412240015.json | 46 +++++ tests/files/VMTests/RandomTests/201412240016.json | 46 +++++ tests/files/VMTests/RandomTests/201412240017.json | 46 +++++ tests/files/VMTests/RandomTests/201412240019.json | 46 +++++ tests/files/VMTests/RandomTests/201412240020.json | 46 +++++ tests/files/VMTests/RandomTests/201412240021.json | 46 +++++ tests/files/VMTests/RandomTests/201412240022.json | 46 +++++ tests/files/VMTests/RandomTests/201412240023.json | 46 +++++ tests/files/VMTests/RandomTests/201412240024.json | 46 +++++ tests/files/VMTests/RandomTests/201412240025.json | 46 +++++ tests/files/VMTests/RandomTests/201412240026.json | 46 +++++ tests/files/VMTests/RandomTests/201412240028.json | 46 +++++ tests/files/VMTests/RandomTests/201412240030.json | 31 ++++ tests/files/VMTests/RandomTests/201412240031.json | 46 +++++ tests/files/VMTests/RandomTests/201412240032.json | 31 ++++ tests/files/VMTests/RandomTests/201412240034.json | 46 +++++ tests/files/VMTests/RandomTests/201412240035.json | 31 ++++ tests/files/VMTests/RandomTests/201412240037.json | 46 +++++ tests/files/VMTests/RandomTests/201412240039.json | 46 +++++ tests/files/VMTests/RandomTests/201412240040.json | 46 +++++ tests/files/VMTests/RandomTests/201412240041.json | 46 +++++ tests/files/VMTests/RandomTests/201412240042.json | 46 +++++ tests/files/VMTests/RandomTests/201412240044.json | 46 +++++ tests/files/VMTests/RandomTests/201412240045.json | 31 ++++ tests/files/VMTests/RandomTests/201412240047.json | 46 +++++ tests/files/VMTests/RandomTests/201412240051.json | 46 +++++ tests/files/VMTests/RandomTests/201412240052.json | 46 +++++ tests/files/VMTests/RandomTests/201412240053.json | 46 +++++ tests/files/VMTests/RandomTests/201412240054.json | 46 +++++ tests/files/VMTests/RandomTests/201412240055.json | 46 +++++ tests/files/VMTests/RandomTests/201412240056.json | 46 +++++ tests/files/VMTests/RandomTests/201412240058.json | 46 +++++ tests/files/VMTests/RandomTests/201412240059.json | 31 ++++ tests/files/VMTests/RandomTests/201412240100.json | 46 +++++ tests/files/VMTests/RandomTests/201412240101.json | 46 +++++ tests/files/VMTests/RandomTests/201412240103.json | 46 +++++ tests/files/VMTests/RandomTests/201412240104.json | 46 +++++ tests/files/VMTests/RandomTests/201412240105.json | 46 +++++ tests/files/VMTests/RandomTests/201412240106.json | 46 +++++ tests/files/VMTests/RandomTests/201412240107.json | 46 +++++ tests/files/VMTests/RandomTests/201412240110.json | 46 +++++ tests/files/VMTests/RandomTests/201412240111.json | 46 +++++ tests/files/VMTests/RandomTests/201412240112.json | 46 +++++ tests/files/VMTests/RandomTests/201412240113.json | 46 +++++ tests/files/VMTests/RandomTests/201412240115.json | 46 +++++ tests/files/VMTests/RandomTests/201412240116.json | 46 +++++ tests/files/VMTests/RandomTests/201412240117.json | 31 ++++ tests/files/VMTests/RandomTests/201412240119.json | 46 +++++ tests/files/VMTests/RandomTests/201412240120.json | 46 +++++ tests/files/VMTests/RandomTests/201412240121.json | 46 +++++ tests/files/VMTests/RandomTests/201412240122.json | 46 +++++ tests/files/VMTests/RandomTests/201412240123.json | 46 +++++ tests/files/VMTests/RandomTests/201412240124.json | 31 ++++ tests/files/VMTests/RandomTests/201412240125.json | 46 +++++ tests/files/VMTests/RandomTests/201412240126.json | 46 +++++ tests/files/VMTests/RandomTests/201412240127.json | 46 +++++ tests/files/VMTests/RandomTests/201412240128.json | 46 +++++ tests/files/VMTests/RandomTests/201412240129.json | 46 +++++ tests/files/VMTests/RandomTests/201412240130.json | 46 +++++ tests/files/VMTests/RandomTests/201412240131.json | 31 ++++ tests/files/VMTests/RandomTests/201412240132.json | 46 +++++ tests/files/VMTests/RandomTests/201412240133.json | 46 +++++ tests/files/VMTests/RandomTests/201412240134.json | 46 +++++ tests/files/VMTests/RandomTests/201412240136.json | 31 ++++ tests/files/VMTests/RandomTests/201412240137.json | 46 +++++ tests/files/VMTests/RandomTests/201412240138.json | 46 +++++ tests/files/VMTests/RandomTests/201412240139.json | 46 +++++ tests/files/VMTests/RandomTests/201412240140.json | 46 +++++ tests/files/VMTests/RandomTests/201412240141.json | 46 +++++ tests/files/VMTests/RandomTests/201412240142.json | 46 +++++ tests/files/VMTests/RandomTests/201412240148.json | 46 +++++ tests/files/VMTests/RandomTests/201412240149.json | 46 +++++ tests/files/VMTests/RandomTests/201412240150.json | 46 +++++ tests/files/VMTests/RandomTests/201412240151.json | 46 +++++ tests/files/VMTests/RandomTests/201412240152.json | 46 +++++ tests/files/VMTests/RandomTests/201412240153.json | 46 +++++ tests/files/VMTests/RandomTests/201412240154.json | 46 +++++ tests/files/VMTests/RandomTests/201412240155.json | 46 +++++ tests/files/VMTests/RandomTests/201412240156.json | 46 +++++ tests/files/VMTests/RandomTests/201412240157.json | 46 +++++ tests/files/VMTests/RandomTests/201412240158.json | 53 ++++++ tests/files/VMTests/RandomTests/201412240159.json | 46 +++++ tests/files/VMTests/RandomTests/201412240201.json | 46 +++++ tests/files/VMTests/RandomTests/201412240202.json | 46 +++++ tests/files/VMTests/RandomTests/201412240204.json | 46 +++++ tests/files/index.js | 8 +- 237 files changed, 10825 insertions(+), 14 deletions(-) create mode 100644 tests/files/VMTests/RandomTests/201412231524.json create mode 100644 tests/files/VMTests/RandomTests/201412231526.json create mode 100644 tests/files/VMTests/RandomTests/201412231529.json create mode 100644 tests/files/VMTests/RandomTests/201412231535.json create mode 100644 tests/files/VMTests/RandomTests/201412231543.json create mode 100644 tests/files/VMTests/RandomTests/201412231544.json create mode 100644 tests/files/VMTests/RandomTests/201412231545.json create mode 100644 tests/files/VMTests/RandomTests/201412231546.json create mode 100644 tests/files/VMTests/RandomTests/201412231549.json create mode 100644 tests/files/VMTests/RandomTests/201412231551.json create mode 100644 tests/files/VMTests/RandomTests/201412231552.json create mode 100644 tests/files/VMTests/RandomTests/201412231553.json create mode 100644 tests/files/VMTests/RandomTests/201412231556.json create mode 100644 tests/files/VMTests/RandomTests/201412231557.json create mode 100644 tests/files/VMTests/RandomTests/201412231558.json create mode 100644 tests/files/VMTests/RandomTests/201412231559.json create mode 100644 tests/files/VMTests/RandomTests/201412231601.json create mode 100644 tests/files/VMTests/RandomTests/201412231602.json create mode 100644 tests/files/VMTests/RandomTests/201412231604.json create mode 100644 tests/files/VMTests/RandomTests/201412231606.json create mode 100644 tests/files/VMTests/RandomTests/201412231610.json create mode 100644 tests/files/VMTests/RandomTests/201412231611.json create mode 100644 tests/files/VMTests/RandomTests/201412231612.json create mode 100644 tests/files/VMTests/RandomTests/201412231613.json create mode 100644 tests/files/VMTests/RandomTests/201412231616.json create mode 100644 tests/files/VMTests/RandomTests/201412231617.json create mode 100644 tests/files/VMTests/RandomTests/201412231619.json create mode 100644 tests/files/VMTests/RandomTests/201412231620.json create mode 100644 tests/files/VMTests/RandomTests/201412231622.json create mode 100644 tests/files/VMTests/RandomTests/201412231623.json create mode 100644 tests/files/VMTests/RandomTests/201412231625.json create mode 100644 tests/files/VMTests/RandomTests/201412231626.json create mode 100644 tests/files/VMTests/RandomTests/201412231627.json create mode 100644 tests/files/VMTests/RandomTests/201412231629.json create mode 100644 tests/files/VMTests/RandomTests/201412231630.json create mode 100644 tests/files/VMTests/RandomTests/201412231631.json create mode 100644 tests/files/VMTests/RandomTests/201412231632.json create mode 100644 tests/files/VMTests/RandomTests/201412231633.json create mode 100644 tests/files/VMTests/RandomTests/201412231634.json create mode 100644 tests/files/VMTests/RandomTests/201412231635.json create mode 100644 tests/files/VMTests/RandomTests/201412231637.json create mode 100644 tests/files/VMTests/RandomTests/201412231638.json create mode 100644 tests/files/VMTests/RandomTests/201412231641.json create mode 100644 tests/files/VMTests/RandomTests/201412231642.json create mode 100644 tests/files/VMTests/RandomTests/201412231646.json create mode 100644 tests/files/VMTests/RandomTests/201412231647.json create mode 100644 tests/files/VMTests/RandomTests/201412231648.json create mode 100644 tests/files/VMTests/RandomTests/201412231649.json create mode 100644 tests/files/VMTests/RandomTests/201412231650.json create mode 100644 tests/files/VMTests/RandomTests/201412231652.json create mode 100644 tests/files/VMTests/RandomTests/201412231655.json create mode 100644 tests/files/VMTests/RandomTests/201412231656.json create mode 100644 tests/files/VMTests/RandomTests/201412231657.json create mode 100644 tests/files/VMTests/RandomTests/201412231700.json create mode 100644 tests/files/VMTests/RandomTests/201412231706.json create mode 100644 tests/files/VMTests/RandomTests/201412231707.json create mode 100644 tests/files/VMTests/RandomTests/201412231708.json create mode 100644 tests/files/VMTests/RandomTests/201412231711.json create mode 100644 tests/files/VMTests/RandomTests/201412231712.json create mode 100644 tests/files/VMTests/RandomTests/201412231714.json create mode 100644 tests/files/VMTests/RandomTests/201412231715.json create mode 100644 tests/files/VMTests/RandomTests/201412231717.json create mode 100644 tests/files/VMTests/RandomTests/201412231723.json create mode 100644 tests/files/VMTests/RandomTests/201412231727.json create mode 100644 tests/files/VMTests/RandomTests/201412232225.json create mode 100644 tests/files/VMTests/RandomTests/201412232226.json create mode 100644 tests/files/VMTests/RandomTests/201412232228.json create mode 100644 tests/files/VMTests/RandomTests/201412232230.json create mode 100644 tests/files/VMTests/RandomTests/201412232231.json create mode 100644 tests/files/VMTests/RandomTests/201412232232.json create mode 100644 tests/files/VMTests/RandomTests/201412232233.json create mode 100644 tests/files/VMTests/RandomTests/201412232234.json create mode 100644 tests/files/VMTests/RandomTests/201412232235.json create mode 100644 tests/files/VMTests/RandomTests/201412232236.json create mode 100644 tests/files/VMTests/RandomTests/201412232237.json create mode 100644 tests/files/VMTests/RandomTests/201412232238.json create mode 100644 tests/files/VMTests/RandomTests/201412232239.json create mode 100644 tests/files/VMTests/RandomTests/201412232240.json create mode 100644 tests/files/VMTests/RandomTests/201412232241.json create mode 100644 tests/files/VMTests/RandomTests/201412232242.json create mode 100644 tests/files/VMTests/RandomTests/201412232243.json create mode 100644 tests/files/VMTests/RandomTests/201412232244.json create mode 100644 tests/files/VMTests/RandomTests/201412232245.json create mode 100644 tests/files/VMTests/RandomTests/201412232246.json create mode 100644 tests/files/VMTests/RandomTests/201412232247.json create mode 100644 tests/files/VMTests/RandomTests/201412232248.json create mode 100644 tests/files/VMTests/RandomTests/201412232249.json create mode 100644 tests/files/VMTests/RandomTests/201412232250.json create mode 100644 tests/files/VMTests/RandomTests/201412232252.json create mode 100644 tests/files/VMTests/RandomTests/201412232253.json create mode 100644 tests/files/VMTests/RandomTests/201412232254.json create mode 100644 tests/files/VMTests/RandomTests/201412232255.json create mode 100644 tests/files/VMTests/RandomTests/201412232256.json create mode 100644 tests/files/VMTests/RandomTests/201412232257.json create mode 100644 tests/files/VMTests/RandomTests/201412232258.json create mode 100644 tests/files/VMTests/RandomTests/201412232300.json create mode 100644 tests/files/VMTests/RandomTests/201412232301.json create mode 100644 tests/files/VMTests/RandomTests/201412232303.json create mode 100644 tests/files/VMTests/RandomTests/201412232304.json create mode 100644 tests/files/VMTests/RandomTests/201412232305.json create mode 100644 tests/files/VMTests/RandomTests/201412232306.json create mode 100644 tests/files/VMTests/RandomTests/201412232307.json create mode 100644 tests/files/VMTests/RandomTests/201412232308.json create mode 100644 tests/files/VMTests/RandomTests/201412232309.json create mode 100644 tests/files/VMTests/RandomTests/201412232311.json create mode 100644 tests/files/VMTests/RandomTests/201412232312.json create mode 100644 tests/files/VMTests/RandomTests/201412232313.json create mode 100644 tests/files/VMTests/RandomTests/201412232314.json create mode 100644 tests/files/VMTests/RandomTests/201412232317.json create mode 100644 tests/files/VMTests/RandomTests/201412232318.json create mode 100644 tests/files/VMTests/RandomTests/201412232319.json create mode 100644 tests/files/VMTests/RandomTests/201412232320.json create mode 100644 tests/files/VMTests/RandomTests/201412232321.json create mode 100644 tests/files/VMTests/RandomTests/201412232323.json create mode 100644 tests/files/VMTests/RandomTests/201412232324.json create mode 100644 tests/files/VMTests/RandomTests/201412232327.json create mode 100644 tests/files/VMTests/RandomTests/201412232328.json create mode 100644 tests/files/VMTests/RandomTests/201412232330.json create mode 100644 tests/files/VMTests/RandomTests/201412232331.json create mode 100644 tests/files/VMTests/RandomTests/201412232335.json create mode 100644 tests/files/VMTests/RandomTests/201412232336.json create mode 100644 tests/files/VMTests/RandomTests/201412232338.json create mode 100644 tests/files/VMTests/RandomTests/201412232341.json create mode 100644 tests/files/VMTests/RandomTests/201412232342.json create mode 100644 tests/files/VMTests/RandomTests/201412232343.json create mode 100644 tests/files/VMTests/RandomTests/201412232345.json create mode 100644 tests/files/VMTests/RandomTests/201412232348.json create mode 100644 tests/files/VMTests/RandomTests/201412232349.json create mode 100644 tests/files/VMTests/RandomTests/201412232351.json create mode 100644 tests/files/VMTests/RandomTests/201412232352.json create mode 100644 tests/files/VMTests/RandomTests/201412232353.json create mode 100644 tests/files/VMTests/RandomTests/201412232354.json create mode 100644 tests/files/VMTests/RandomTests/201412232355.json create mode 100644 tests/files/VMTests/RandomTests/201412232356.json create mode 100644 tests/files/VMTests/RandomTests/201412232357.json create mode 100644 tests/files/VMTests/RandomTests/201412232358.json create mode 100644 tests/files/VMTests/RandomTests/201412232359.json create mode 100644 tests/files/VMTests/RandomTests/201412240001.json create mode 100644 tests/files/VMTests/RandomTests/201412240002.json create mode 100644 tests/files/VMTests/RandomTests/201412240004.json create mode 100644 tests/files/VMTests/RandomTests/201412240005.json create mode 100644 tests/files/VMTests/RandomTests/201412240006.json create mode 100644 tests/files/VMTests/RandomTests/201412240007.json create mode 100644 tests/files/VMTests/RandomTests/201412240010.json create mode 100644 tests/files/VMTests/RandomTests/201412240011.json create mode 100644 tests/files/VMTests/RandomTests/201412240012.json create mode 100644 tests/files/VMTests/RandomTests/201412240013.json create mode 100644 tests/files/VMTests/RandomTests/201412240014.json create mode 100644 tests/files/VMTests/RandomTests/201412240015.json create mode 100644 tests/files/VMTests/RandomTests/201412240016.json create mode 100644 tests/files/VMTests/RandomTests/201412240017.json create mode 100644 tests/files/VMTests/RandomTests/201412240019.json create mode 100644 tests/files/VMTests/RandomTests/201412240020.json create mode 100644 tests/files/VMTests/RandomTests/201412240021.json create mode 100644 tests/files/VMTests/RandomTests/201412240022.json create mode 100644 tests/files/VMTests/RandomTests/201412240023.json create mode 100644 tests/files/VMTests/RandomTests/201412240024.json create mode 100644 tests/files/VMTests/RandomTests/201412240025.json create mode 100644 tests/files/VMTests/RandomTests/201412240026.json create mode 100644 tests/files/VMTests/RandomTests/201412240028.json create mode 100644 tests/files/VMTests/RandomTests/201412240030.json create mode 100644 tests/files/VMTests/RandomTests/201412240031.json create mode 100644 tests/files/VMTests/RandomTests/201412240032.json create mode 100644 tests/files/VMTests/RandomTests/201412240034.json create mode 100644 tests/files/VMTests/RandomTests/201412240035.json create mode 100644 tests/files/VMTests/RandomTests/201412240037.json create mode 100644 tests/files/VMTests/RandomTests/201412240039.json create mode 100644 tests/files/VMTests/RandomTests/201412240040.json create mode 100644 tests/files/VMTests/RandomTests/201412240041.json create mode 100644 tests/files/VMTests/RandomTests/201412240042.json create mode 100644 tests/files/VMTests/RandomTests/201412240044.json create mode 100644 tests/files/VMTests/RandomTests/201412240045.json create mode 100644 tests/files/VMTests/RandomTests/201412240047.json create mode 100644 tests/files/VMTests/RandomTests/201412240051.json create mode 100644 tests/files/VMTests/RandomTests/201412240052.json create mode 100644 tests/files/VMTests/RandomTests/201412240053.json create mode 100644 tests/files/VMTests/RandomTests/201412240054.json create mode 100644 tests/files/VMTests/RandomTests/201412240055.json create mode 100644 tests/files/VMTests/RandomTests/201412240056.json create mode 100644 tests/files/VMTests/RandomTests/201412240058.json create mode 100644 tests/files/VMTests/RandomTests/201412240059.json create mode 100644 tests/files/VMTests/RandomTests/201412240100.json create mode 100644 tests/files/VMTests/RandomTests/201412240101.json create mode 100644 tests/files/VMTests/RandomTests/201412240103.json create mode 100644 tests/files/VMTests/RandomTests/201412240104.json create mode 100644 tests/files/VMTests/RandomTests/201412240105.json create mode 100644 tests/files/VMTests/RandomTests/201412240106.json create mode 100644 tests/files/VMTests/RandomTests/201412240107.json create mode 100644 tests/files/VMTests/RandomTests/201412240110.json create mode 100644 tests/files/VMTests/RandomTests/201412240111.json create mode 100644 tests/files/VMTests/RandomTests/201412240112.json create mode 100644 tests/files/VMTests/RandomTests/201412240113.json create mode 100644 tests/files/VMTests/RandomTests/201412240115.json create mode 100644 tests/files/VMTests/RandomTests/201412240116.json create mode 100644 tests/files/VMTests/RandomTests/201412240117.json create mode 100644 tests/files/VMTests/RandomTests/201412240119.json create mode 100644 tests/files/VMTests/RandomTests/201412240120.json create mode 100644 tests/files/VMTests/RandomTests/201412240121.json create mode 100644 tests/files/VMTests/RandomTests/201412240122.json create mode 100644 tests/files/VMTests/RandomTests/201412240123.json create mode 100644 tests/files/VMTests/RandomTests/201412240124.json create mode 100644 tests/files/VMTests/RandomTests/201412240125.json create mode 100644 tests/files/VMTests/RandomTests/201412240126.json create mode 100644 tests/files/VMTests/RandomTests/201412240127.json create mode 100644 tests/files/VMTests/RandomTests/201412240128.json create mode 100644 tests/files/VMTests/RandomTests/201412240129.json create mode 100644 tests/files/VMTests/RandomTests/201412240130.json create mode 100644 tests/files/VMTests/RandomTests/201412240131.json create mode 100644 tests/files/VMTests/RandomTests/201412240132.json create mode 100644 tests/files/VMTests/RandomTests/201412240133.json create mode 100644 tests/files/VMTests/RandomTests/201412240134.json create mode 100644 tests/files/VMTests/RandomTests/201412240136.json create mode 100644 tests/files/VMTests/RandomTests/201412240137.json create mode 100644 tests/files/VMTests/RandomTests/201412240138.json create mode 100644 tests/files/VMTests/RandomTests/201412240139.json create mode 100644 tests/files/VMTests/RandomTests/201412240140.json create mode 100644 tests/files/VMTests/RandomTests/201412240141.json create mode 100644 tests/files/VMTests/RandomTests/201412240142.json create mode 100644 tests/files/VMTests/RandomTests/201412240148.json create mode 100644 tests/files/VMTests/RandomTests/201412240149.json create mode 100644 tests/files/VMTests/RandomTests/201412240150.json create mode 100644 tests/files/VMTests/RandomTests/201412240151.json create mode 100644 tests/files/VMTests/RandomTests/201412240152.json create mode 100644 tests/files/VMTests/RandomTests/201412240153.json create mode 100644 tests/files/VMTests/RandomTests/201412240154.json create mode 100644 tests/files/VMTests/RandomTests/201412240155.json create mode 100644 tests/files/VMTests/RandomTests/201412240156.json create mode 100644 tests/files/VMTests/RandomTests/201412240157.json create mode 100644 tests/files/VMTests/RandomTests/201412240158.json create mode 100644 tests/files/VMTests/RandomTests/201412240159.json create mode 100644 tests/files/VMTests/RandomTests/201412240201.json create mode 100644 tests/files/VMTests/RandomTests/201412240202.json create mode 100644 tests/files/VMTests/RandomTests/201412240204.json diff --git a/tests/files/StateTests/stInitCodeTest.json b/tests/files/StateTests/stInitCodeTest.json index 67aa42853..1c4670cef 100644 --- a/tests/files/StateTests/stInitCodeTest.json +++ b/tests/files/StateTests/stInitCodeTest.json @@ -588,7 +588,7 @@ } }, "transaction" : { - "data" : "0x600a80600c6000396000f200600160008035811a8100", + "data" : "0x600a80600c6000396000f300600160008035811a8100", "gasLimit" : "599", "gasPrice" : "1", "nonce" : "0", @@ -642,7 +642,7 @@ } }, "transaction" : { - "data" : "0x600a80600c6000396000f200600160008035811a8100", + "data" : "0x600a80600c6000396000f300600160008035811a8100", "gasLimit" : "590", "gasPrice" : "3", "nonce" : "0", @@ -651,6 +651,60 @@ "value" : "1" } }, + "StackUnderFlowContractCreation" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "1000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "9000", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x6000f1", + "gasLimit" : "1000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "0" + } + }, "TransactionContractCreation" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", @@ -696,7 +750,7 @@ } }, "transaction" : { - "data" : "0x600a80600c6000396000f200600160008035811a8100", + "data" : "0x600a80600c6000396000f300600160008035811a8100", "gasLimit" : "599", "gasPrice" : "1", "nonce" : "0", @@ -716,10 +770,10 @@ }, "logs" : [ ], - "out" : "0x", + "out" : "0xff600160008035811a81", "post" : { "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { - "balance" : "1000", + "balance" : "653", "code" : "0x", "nonce" : "0", "storage" : { @@ -727,13 +781,13 @@ }, "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { "balance" : "1", - "code" : "0x", + "code" : "0xff600160008035811a81", "nonce" : "0", "storage" : { } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "8999", + "balance" : "9346", "code" : "0x", "nonce" : "1", "storage" : { @@ -750,7 +804,7 @@ } }, "transaction" : { - "data" : "0x600a80600c6000396000f200ff600160008035811a81", + "data" : "0x600a80600c6000396000f300ff600160008035811a81", "gasLimit" : "1000", "gasPrice" : "1", "nonce" : "0", @@ -804,7 +858,7 @@ } }, "transaction" : { - "data" : "0x600a80600c600039600000f20000600160008035811a81", + "data" : "0x600a80600c600039600000f30000600160008035811a81", "gasLimit" : "1000", "gasPrice" : "1", "nonce" : "0", @@ -858,7 +912,7 @@ } }, "transaction" : { - "data" : "0x600a80600c6000396000fff2ffff600160008035811a81", + "data" : "0x600a80600c6000396000fff3ffff600160008035811a81", "gasLimit" : "1000", "gasPrice" : "1", "nonce" : "0", @@ -867,4 +921,4 @@ "value" : "1" } } -} \ No newline at end of file +} diff --git a/tests/files/StateTests/stSystemOperationsTest.json b/tests/files/StateTests/stSystemOperationsTest.json index 612331ae3..e92c8d9ad 100644 --- a/tests/files/StateTests/stSystemOperationsTest.json +++ b/tests/files/StateTests/stSystemOperationsTest.json @@ -5826,5 +5826,191 @@ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000" } + }, + "callValue" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "10000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000100000", + "code" : "0x34600055", + "nonce" : "0", + "storage" : { + "0x" : "0x0186a0" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "802", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "999999999999899198", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x34600055", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "10000000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "100000" + } + }, + "callerAccountBalance" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "10000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000100000", + "code" : "0x3331600055", + "nonce" : "0", + "storage" : { + "0x" : "0x0de0b6b3a6c9e2e0" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "822", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "999999999999899178", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x3331600055", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "10000000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "100000" + } + }, + "currentAccountBalance" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "10000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000100000", + "code" : "0x3031600055", + "nonce" : "0", + "storage" : { + "0x" : "0x0de0b6b3a76586a0" + } + }, + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "822", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "999999999999899178", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "code" : "0x3031600055", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "10000000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "100000" + } } -} \ No newline at end of file +} diff --git a/tests/files/TrieTests/trietest.json b/tests/files/TrieTests/trietest.json index ce5c2d191..d871a8a81 100644 --- a/tests/files/TrieTests/trietest.json +++ b/tests/files/TrieTests/trietest.json @@ -12,6 +12,61 @@ ], "root": "0x5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84" }, + "branchingTests": { + "in":[ + ["0x04110d816c380812a427968ece99b1c963dfbce6", "something"], + ["0x095e7baea6a6c7c4c2dfeb977efac326af552d87", "something"], + ["0x0a517d755cebbf66312b30fff713666a9cb917e0", "something"], + ["0x24dd378f51adc67a50e339e8031fe9bd4aafab36", "something"], + ["0x293f982d000532a7861ab122bdc4bbfd26bf9030", "something"], + ["0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5", "something"], + ["0x31c640b92c21a1f1465c91070b4b3b4d6854195f", "something"], + ["0x37f998764813b136ddf5a754f34063fd03065e36", "something"], + ["0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a", "something"], + ["0x4f36659fa632310b6ec438dea4085b522a2dd077", "something"], + ["0x62c01474f089b07dae603491675dc5b5748f7049", "something"], + ["0x729af7294be595a0efd7d891c9e51f89c07950c7", "something"], + ["0x83e3e5a16d3b696a0314b30b2534804dd5e11197", "something"], + ["0x8703df2417e0d7c59d063caa9583cb10a4d20532", "something"], + ["0x8dffcd74e5b5923512916c6a64b502689cfa65e1", "something"], + ["0x95a4d7cccb5204733874fa87285a176fe1e9e240", "something"], + ["0x99b2fcba8120bedd048fe79f5262a6690ed38c39", "something"], + ["0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf", "something"], + ["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "something"], + ["0xa9647f4a0a14042d91dc33c0328030a7157c93ae", "something"], + ["0xaa6cffe5185732689c18f37a7f86170cb7304c2a", "something"], + ["0xaae4a2e3c51c04606dcb3723456e58f3ed214f45", "something"], + ["0xc37a43e940dfb5baf581a0b82b351d48305fc885", "something"], + ["0xd2571607e241ecf590ed94b12d87c94babe36db6", "something"], + ["0xf735071cbee190d76b704ce68384fc21e389fbe7", "something"], + ["0x04110d816c380812a427968ece99b1c963dfbce6", null], + ["0x095e7baea6a6c7c4c2dfeb977efac326af552d87", null], + ["0x0a517d755cebbf66312b30fff713666a9cb917e0", null], + ["0x24dd378f51adc67a50e339e8031fe9bd4aafab36", null], + ["0x293f982d000532a7861ab122bdc4bbfd26bf9030", null], + ["0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5", null], + ["0x31c640b92c21a1f1465c91070b4b3b4d6854195f", null], + ["0x37f998764813b136ddf5a754f34063fd03065e36", null], + ["0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a", null], + ["0x4f36659fa632310b6ec438dea4085b522a2dd077", null], + ["0x62c01474f089b07dae603491675dc5b5748f7049", null], + ["0x729af7294be595a0efd7d891c9e51f89c07950c7", null], + ["0x83e3e5a16d3b696a0314b30b2534804dd5e11197", null], + ["0x8703df2417e0d7c59d063caa9583cb10a4d20532", null], + ["0x8dffcd74e5b5923512916c6a64b502689cfa65e1", null], + ["0x95a4d7cccb5204733874fa87285a176fe1e9e240", null], + ["0x99b2fcba8120bedd048fe79f5262a6690ed38c39", null], + ["0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf", null], + ["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", null], + ["0xa9647f4a0a14042d91dc33c0328030a7157c93ae", null], + ["0xaa6cffe5185732689c18f37a7f86170cb7304c2a", null], + ["0xaae4a2e3c51c04606dcb3723456e58f3ed214f45", null], + ["0xc37a43e940dfb5baf581a0b82b351d48305fc885", null], + ["0xd2571607e241ecf590ed94b12d87c94babe36db6", null], + ["0xf735071cbee190d76b704ce68384fc21e389fbe7", null] + ], + "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }, "jeff": { "in": [ ["0x0000000000000000000000000000000000000000000000000000000000000045", "0x22b224a1420a802ab51d326e29fa98e34c4f24ea"], diff --git a/tests/files/VMTests/RandomTests/201412231524.json b/tests/files/VMTests/RandomTests/201412231524.json new file mode 100644 index 000000000..87796042c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231524.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63705a0b6b69a11044518876953776", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63705a0b6b69a11044518876953776", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63705a0b6b69a11044518876953776", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231526.json b/tests/files/VMTests/RandomTests/201412231526.json new file mode 100644 index 000000000..17758b8d8 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231526.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5b6ca284a383618e389e20848652", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6ca284a383618e389e20848652", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6ca284a383618e389e20848652", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231529.json b/tests/files/VMTests/RandomTests/201412231529.json new file mode 100644 index 000000000..782e78a1c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231529.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6a5a558f440b6d7530533a356b7589", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a5a558f440b6d7530533a356b7589", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a5a558f440b6d7530533a356b7589", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231535.json b/tests/files/VMTests/RandomTests/201412231535.json new file mode 100644 index 000000000..fc661805d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231535.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x68931051429d9b75069160636bff", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x68931051429d9b75069160636bff", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x68931051429d9b75069160636bff", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231543.json b/tests/files/VMTests/RandomTests/201412231543.json new file mode 100644 index 000000000..2a6d004ae --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231543.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5a385968087df24038513535", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5a385968087df24038513535", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5a385968087df24038513535", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231544.json b/tests/files/VMTests/RandomTests/201412231544.json new file mode 100644 index 000000000..4925a5abd --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231544.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3463823507", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3463823507", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3463823507", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231545.json b/tests/files/VMTests/RandomTests/201412231545.json new file mode 100644 index 000000000..ad2b3a27e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231545.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66a3535b8b8af38a658b3b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66a3535b8b8af38a658b3b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66a3535b8b8af38a658b3b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231546.json b/tests/files/VMTests/RandomTests/201412231546.json new file mode 100644 index 000000000..58e7cd2d1 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231546.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63794554ff426ef0a18a8a9c6e137a8c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63794554ff426ef0a18a8a9c6e137a8c", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63794554ff426ef0a18a8a9c6e137a8c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231549.json b/tests/files/VMTests/RandomTests/201412231549.json new file mode 100644 index 000000000..51a58e1a3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231549.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66509a88803091046789893377", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66509a88803091046789893377", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66509a88803091046789893377", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231551.json b/tests/files/VMTests/RandomTests/201412231551.json new file mode 100644 index 000000000..fe7fad062 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231551.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x426a507bf0a09c7b6a381314", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426a507bf0a09c7b6a381314", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426a507bf0a09c7b6a381314", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231552.json b/tests/files/VMTests/RandomTests/201412231552.json new file mode 100644 index 000000000..4d3acf6c2 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231552.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x306383a29e826a05865054039f36", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x306383a29e826a05865054039f36", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x306383a29e826a05865054039f36", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231553.json b/tests/files/VMTests/RandomTests/201412231553.json new file mode 100644 index 000000000..52d885a00 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231553.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66691196a4a00209506d8290855570", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66691196a4a00209506d8290855570", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66691196a4a00209506d8290855570", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231556.json b/tests/files/VMTests/RandomTests/201412231556.json new file mode 100644 index 000000000..334f6644c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231556.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x645b7753a4806e848481311373338b66", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x645b7753a4806e848481311373338b66", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x645b7753a4806e848481311373338b66", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231557.json b/tests/files/VMTests/RandomTests/201412231557.json new file mode 100644 index 000000000..7992fb003 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231557.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x386609796d5a7b53", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x386609796d5a7b53", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x386609796d5a7b53", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231558.json b/tests/files/VMTests/RandomTests/201412231558.json new file mode 100644 index 000000000..ef3b6ae10 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231558.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x67767162694473797350685804", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x67767162694473797350685804", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x67767162694473797350685804", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231559.json b/tests/files/VMTests/RandomTests/201412231559.json new file mode 100644 index 000000000..fe298915b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231559.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x33666b7c09ff376d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33666b7c09ff376d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33666b7c09ff376d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231601.json b/tests/files/VMTests/RandomTests/201412231601.json new file mode 100644 index 000000000..09aa5b75b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231601.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4368696e44388f615b36", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4368696e44388f615b36", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4368696e44388f615b36", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231602.json b/tests/files/VMTests/RandomTests/201412231602.json new file mode 100644 index 000000000..95e1ca48b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231602.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x323b42196b09660754097135335b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9995", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x323b42196b09660754097135335b", + "nonce" : "0", + "storage" : { + } + }, + "cd1722f3947def4cf144679da39c4c32bdc35681" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x323b42196b09660754097135335b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231604.json b/tests/files/VMTests/RandomTests/201412231604.json new file mode 100644 index 000000000..6516f112b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231604.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6050693b0185f01830385835", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6050693b0185f01830385835", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6050693b0185f01830385835", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231606.json b/tests/files/VMTests/RandomTests/201412231606.json new file mode 100644 index 000000000..93d737617 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231606.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3a1563a385690668348e438532", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a1563a385690668348e438532", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a1563a385690668348e438532", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231610.json b/tests/files/VMTests/RandomTests/201412231610.json new file mode 100644 index 000000000..c0c1941ac --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231610.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x65329f329e31786a9905527af3", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65329f329e31786a9905527af3", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65329f329e31786a9905527af3", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231611.json b/tests/files/VMTests/RandomTests/201412231611.json new file mode 100644 index 000000000..be169fdd3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231611.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x648b099057166169", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x648b099057166169", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x648b099057166169", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231612.json b/tests/files/VMTests/RandomTests/201412231612.json new file mode 100644 index 000000000..272360ced --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231612.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x648b418282a168170b7b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x648b418282a168170b7b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x648b418282a168170b7b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231613.json b/tests/files/VMTests/RandomTests/201412231613.json new file mode 100644 index 000000000..5e573c9c3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231613.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6168616716912009f154", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6168616716912009f154", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6168616716912009f154", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231616.json b/tests/files/VMTests/RandomTests/201412231616.json new file mode 100644 index 000000000..4668a5fa2 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231616.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x44315a426414", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9976", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0000000000000000000000000000000000000100" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44315a426414", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44315a426414", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231617.json b/tests/files/VMTests/RandomTests/201412231617.json new file mode 100644 index 000000000..319d75bad --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231617.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x366e5279a28d1262769a6a535a9c9558", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x366e5279a28d1262769a6a535a9c9558", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x366e5279a28d1262769a6a535a9c9558", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231619.json b/tests/files/VMTests/RandomTests/201412231619.json new file mode 100644 index 000000000..47dd53b73 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231619.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x305b6a96a1928e7c9c56076d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x305b6a96a1928e7c9c56076d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x305b6a96a1928e7c9c56076d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231620.json b/tests/files/VMTests/RandomTests/201412231620.json new file mode 100644 index 000000000..a34fc6960 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231620.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x426c105531797997035a87408b18", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426c105531797997035a87408b18", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426c105531797997035a87408b18", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231622.json b/tests/files/VMTests/RandomTests/201412231622.json new file mode 100644 index 000000000..e7b4a3dde --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231622.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x336d0284979d526c2032f187667f17", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x336d0284979d526c2032f187667f17", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x336d0284979d526c2032f187667f17", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231623.json b/tests/files/VMTests/RandomTests/201412231623.json new file mode 100644 index 000000000..5aea43ebe --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231623.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x436b748c52f188780b108c6b96", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x436b748c52f188780b108c6b96", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x436b748c52f188780b108c6b96", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231625.json b/tests/files/VMTests/RandomTests/201412231625.json new file mode 100644 index 000000000..d1be27e2d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231625.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x69578e0b9af2098244338a6b9e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69578e0b9af2098244338a6b9e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69578e0b9af2098244338a6b9e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231626.json b/tests/files/VMTests/RandomTests/201412231626.json new file mode 100644 index 000000000..81c994124 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231626.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x698d73727651077b193857669659986c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x698d73727651077b193857669659986c", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x698d73727651077b193857669659986c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231627.json b/tests/files/VMTests/RandomTests/201412231627.json new file mode 100644 index 000000000..22db4ecd5 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231627.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x61a3746479129d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x61a3746479129d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x61a3746479129d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231629.json b/tests/files/VMTests/RandomTests/201412231629.json new file mode 100644 index 000000000..0766e10c8 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231629.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x638a058c78639b13", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x638a058c78639b13", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x638a058c78639b13", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231630.json b/tests/files/VMTests/RandomTests/201412231630.json new file mode 100644 index 000000000..67cf14229 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231630.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x41655674197220", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x41655674197220", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x41655674197220", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231631.json b/tests/files/VMTests/RandomTests/201412231631.json new file mode 100644 index 000000000..11062c07e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231631.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6009316459a059", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9978", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0000000000000000000000000000000000000009" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6009316459a059", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6009316459a059", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231632.json b/tests/files/VMTests/RandomTests/201412231632.json new file mode 100644 index 000000000..93c1344b9 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231632.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x443318426c6f956f0b336e78383c4369", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9995", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x443318426c6f956f0b336e78383c4369", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x443318426c6f956f0b336e78383c4369", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231633.json b/tests/files/VMTests/RandomTests/201412231633.json new file mode 100644 index 000000000..f014bd1e2 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231633.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6473698a7f1340658e56", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6473698a7f1340658e56", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6473698a7f1340658e56", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231634.json b/tests/files/VMTests/RandomTests/201412231634.json new file mode 100644 index 000000000..c7727700c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231634.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x65719aa3181753653597138b8e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65719aa3181753653597138b8e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65719aa3181753653597138b8e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231635.json b/tests/files/VMTests/RandomTests/201412231635.json new file mode 100644 index 000000000..c9c521262 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231635.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x69798d6e9141115b131a6e6c1386", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69798d6e9141115b131a6e6c1386", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69798d6e9141115b131a6e6c1386", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231637.json b/tests/files/VMTests/RandomTests/201412231637.json new file mode 100644 index 000000000..bdd16f0ff --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231637.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x641378737e82670a328d789167", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x641378737e82670a328d789167", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x641378737e82670a328d789167", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231638.json b/tests/files/VMTests/RandomTests/201412231638.json new file mode 100644 index 000000000..80b936ea6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231638.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6045646b557c87", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6045646b557c87", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6045646b557c87", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231641.json b/tests/files/VMTests/RandomTests/201412231641.json new file mode 100644 index 000000000..29e23a513 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231641.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6272118c6d703a868015017b97162052", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6272118c6d703a868015017b97162052", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6272118c6d703a868015017b97162052", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231642.json b/tests/files/VMTests/RandomTests/201412231642.json new file mode 100644 index 000000000..a09f74c74 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231642.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6b19134596f284a0353360996b6939", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b19134596f284a0353360996b6939", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b19134596f284a0353360996b6939", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231646.json b/tests/files/VMTests/RandomTests/201412231646.json new file mode 100644 index 000000000..071f396d5 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231646.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x65951208a181326c767c9977396385", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65951208a181326c767c9977396385", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65951208a181326c767c9977396385", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231647.json b/tests/files/VMTests/RandomTests/201412231647.json new file mode 100644 index 000000000..9abe830e2 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231647.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6a9f6ca23b118650a19f3a5167a0a459", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a9f6ca23b118650a19f3a5167a0a459", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a9f6ca23b118650a19f3a5167a0a459", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231648.json b/tests/files/VMTests/RandomTests/201412231648.json new file mode 100644 index 000000000..0950d8111 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231648.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x403211545b6567326896", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9975", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x403211545b6567326896", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x403211545b6567326896", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231649.json b/tests/files/VMTests/RandomTests/201412231649.json new file mode 100644 index 000000000..a5fd738f4 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231649.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x36586333a18e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x36586333a18e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x36586333a18e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231650.json b/tests/files/VMTests/RandomTests/201412231650.json new file mode 100644 index 000000000..9195dda7c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231650.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x698640897c149c02068770698888", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x698640897c149c02068770698888", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x698640897c149c02068770698888", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231652.json b/tests/files/VMTests/RandomTests/201412231652.json new file mode 100644 index 000000000..1e0d270e0 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231652.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66086c52a2970b6e658ff067", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66086c52a2970b6e658ff067", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66086c52a2970b6e658ff067", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231655.json b/tests/files/VMTests/RandomTests/201412231655.json new file mode 100644 index 000000000..7cb1a645d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231655.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x33596a089c13547908f3ff8473", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33596a089c13547908f3ff8473", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33596a089c13547908f3ff8473", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231656.json b/tests/files/VMTests/RandomTests/201412231656.json new file mode 100644 index 000000000..002adc177 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231656.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x658a3a577683633433698e0b92325815", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x658a3a577683633433698e0b92325815", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x658a3a577683633433698e0b92325815", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231657.json b/tests/files/VMTests/RandomTests/201412231657.json new file mode 100644 index 000000000..2c2d93ece --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231657.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x677af1721211348a9669433c930b8493", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x677af1721211348a9669433c930b8493", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x677af1721211348a9669433c930b8493", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231700.json b/tests/files/VMTests/RandomTests/201412231700.json new file mode 100644 index 000000000..d15f99283 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231700.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x633c7060a16b38441a3a428f6f5a5680", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x633c7060a16b38441a3a428f6f5a5680", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x633c7060a16b38441a3a428f6f5a5680", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231706.json b/tests/files/VMTests/RandomTests/201412231706.json new file mode 100644 index 000000000..19fd77e9f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231706.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6333557d6567168f658a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6333557d6567168f658a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6333557d6567168f658a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231707.json b/tests/files/VMTests/RandomTests/201412231707.json new file mode 100644 index 000000000..0dbe95db2 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231707.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x440b6b0716", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x440b6b0716", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231708.json b/tests/files/VMTests/RandomTests/201412231708.json new file mode 100644 index 000000000..f2f44c980 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231708.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x404342416670057b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9995", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x404342416670057b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x404342416670057b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231711.json b/tests/files/VMTests/RandomTests/201412231711.json new file mode 100644 index 000000000..086226a33 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231711.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x64836b3c80336d72433566867b570b76", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x64836b3c80336d72433566867b570b76", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x64836b3c80336d72433566867b570b76", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231712.json b/tests/files/VMTests/RandomTests/201412231712.json new file mode 100644 index 000000000..0e460d255 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231712.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x334160506964656e099f950258", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x334160506964656e099f950258", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x334160506964656e099f950258", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231714.json b/tests/files/VMTests/RandomTests/201412231714.json new file mode 100644 index 000000000..540d8aaec --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231714.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x683a017b5334920742625a69588483", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x683a017b5334920742625a69588483", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x683a017b5334920742625a69588483", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231715.json b/tests/files/VMTests/RandomTests/201412231715.json new file mode 100644 index 000000000..96662a212 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231715.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x628f190b6276399b5440647c3b7136", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9976", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x628f190b6276399b5440647c3b7136", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x628f190b6276399b5440647c3b7136", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231717.json b/tests/files/VMTests/RandomTests/201412231717.json new file mode 100644 index 000000000..46303f2e4 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231717.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x609b6c3a715134389e7d40301aff", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x609b6c3a715134389e7d40301aff", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x609b6c3a715134389e7d40301aff", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231723.json b/tests/files/VMTests/RandomTests/201412231723.json new file mode 100644 index 000000000..f00ef5239 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231723.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6911699262109b5982168768456836", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6911699262109b5982168768456836", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6911699262109b5982168768456836", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412231727.json b/tests/files/VMTests/RandomTests/201412231727.json new file mode 100644 index 000000000..3a20f94fe --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412231727.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66ff3c049d079833672059996fa1", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66ff3c049d079833672059996fa1", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66ff3c049d079833672059996fa1", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232225.json b/tests/files/VMTests/RandomTests/201412232225.json new file mode 100644 index 000000000..610e96357 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232225.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6431703c0aa36a6d9da05791", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6431703c0aa36a6d9da05791", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6431703c0aa36a6d9da05791", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232226.json b/tests/files/VMTests/RandomTests/201412232226.json new file mode 100644 index 000000000..dd49687bd --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232226.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x624314060b38", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x624314060b38", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232228.json b/tests/files/VMTests/RandomTests/201412232228.json new file mode 100644 index 000000000..f310618c5 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232228.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6565877c6056136a7e670967", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6565877c6056136a7e670967", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6565877c6056136a7e670967", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232230.json b/tests/files/VMTests/RandomTests/201412232230.json new file mode 100644 index 000000000..c692af1a3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232230.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x458010546b909b3b42049d2012", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9976", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x458010546b909b3b42049d2012", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x458010546b909b3b42049d2012", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232231.json b/tests/files/VMTests/RandomTests/201412232231.json new file mode 100644 index 000000000..a6f68ee38 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232231.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x621690786a6692556c510a8862107e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x621690786a6692556c510a8862107e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x621690786a6692556c510a8862107e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232232.json b/tests/files/VMTests/RandomTests/201412232232.json new file mode 100644 index 000000000..ced426ebf --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232232.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x698d99f10970f07020ff825063619317", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x698d99f10970f07020ff825063619317", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x698d99f10970f07020ff825063619317", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232233.json b/tests/files/VMTests/RandomTests/201412232233.json new file mode 100644 index 000000000..6f2685b55 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232233.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6341409a85368162177e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6341409a85368162177e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6341409a85368162177e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232234.json b/tests/files/VMTests/RandomTests/201412232234.json new file mode 100644 index 000000000..148480178 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232234.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4463190344", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4463190344", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4463190344", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232235.json b/tests/files/VMTests/RandomTests/201412232235.json new file mode 100644 index 000000000..24e84b4f6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232235.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4031620143", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9978", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4031620143", + "nonce" : "0", + "storage" : { + } + }, + "c63e079ee08998b6045136a8ce6635c7912ec0b6" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4031620143", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232236.json b/tests/files/VMTests/RandomTests/201412232236.json new file mode 100644 index 000000000..bd8cf6a8d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232236.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x33698b6f60084314598655", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33698b6f60084314598655", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33698b6f60084314598655", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232237.json b/tests/files/VMTests/RandomTests/201412232237.json new file mode 100644 index 000000000..7431224db --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232237.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6615431505719a756a803a9b03", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6615431505719a756a803a9b03", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6615431505719a756a803a9b03", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232238.json b/tests/files/VMTests/RandomTests/201412232238.json new file mode 100644 index 000000000..fe57fadc4 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232238.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x638f9f9b6c623412", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x638f9f9b6c623412", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x638f9f9b6c623412", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232239.json b/tests/files/VMTests/RandomTests/201412232239.json new file mode 100644 index 000000000..6954e5552 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232239.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3266049b39391235", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3266049b39391235", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3266049b39391235", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232240.json b/tests/files/VMTests/RandomTests/201412232240.json new file mode 100644 index 000000000..016007e5d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232240.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6354996306699a91179702", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6354996306699a91179702", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6354996306699a91179702", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232241.json b/tests/files/VMTests/RandomTests/201412232241.json new file mode 100644 index 000000000..e06f00256 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232241.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6667703417606679651a6f8e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6667703417606679651a6f8e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6667703417606679651a6f8e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232242.json b/tests/files/VMTests/RandomTests/201412232242.json new file mode 100644 index 000000000..187beecc9 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232242.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5a627678", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5a627678", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5a627678", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232243.json b/tests/files/VMTests/RandomTests/201412232243.json new file mode 100644 index 000000000..9c4debb69 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232243.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x32681550a4907a8e7305", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x32681550a4907a8e7305", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x32681550a4907a8e7305", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232244.json b/tests/files/VMTests/RandomTests/201412232244.json new file mode 100644 index 000000000..2221e2d09 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232244.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x32628c38", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x32628c38", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x32628c38", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232245.json b/tests/files/VMTests/RandomTests/201412232245.json new file mode 100644 index 000000000..744d0c09b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232245.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6b9371f376696fa17f15816789446e06", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b9371f376696fa17f15816789446e06", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b9371f376696fa17f15816789446e06", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232246.json b/tests/files/VMTests/RandomTests/201412232246.json new file mode 100644 index 000000000..10570bd09 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232246.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x627fa209666832659b6612", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x627fa209666832659b6612", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x627fa209666832659b6612", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232247.json b/tests/files/VMTests/RandomTests/201412232247.json new file mode 100644 index 000000000..5a4e4b8c8 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232247.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x65647255418f7f644408", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65647255418f7f644408", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65647255418f7f644408", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232248.json b/tests/files/VMTests/RandomTests/201412232248.json new file mode 100644 index 000000000..090cfd12b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232248.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6254938f669a177382456f", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6254938f669a177382456f", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6254938f669a177382456f", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232249.json b/tests/files/VMTests/RandomTests/201412232249.json new file mode 100644 index 000000000..dae482455 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232249.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5868f00502361950688f", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5868f00502361950688f", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5868f00502361950688f", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232250.json b/tests/files/VMTests/RandomTests/201412232250.json new file mode 100644 index 000000000..78ad03578 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232250.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x606262556d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x606262556d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x606262556d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232252.json b/tests/files/VMTests/RandomTests/201412232252.json new file mode 100644 index 000000000..6ec63467a --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232252.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x626c6f0a63f08d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x626c6f0a63f08d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x626c6f0a63f08d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232253.json b/tests/files/VMTests/RandomTests/201412232253.json new file mode 100644 index 000000000..2af0327d5 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232253.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6370199c7142383b4165196164", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9994", + "logs" : [ + ], + "out" : "0x", + "post" : { + "000000000000000000000000000000000000000d" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6370199c7142383b4165196164", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6370199c7142383b4165196164", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232254.json b/tests/files/VMTests/RandomTests/201412232254.json new file mode 100644 index 000000000..fd8167575 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232254.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x615833336c39a47d997244066a743740", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x615833336c39a47d997244066a743740", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x615833336c39a47d997244066a743740", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232255.json b/tests/files/VMTests/RandomTests/201412232255.json new file mode 100644 index 000000000..afdb01d7f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232255.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x426c343b76548989536320300175", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426c343b76548989536320300175", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426c343b76548989536320300175", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232256.json b/tests/files/VMTests/RandomTests/201412232256.json new file mode 100644 index 000000000..20ae3118b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232256.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3a609a316439f38370", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9977", + "logs" : [ + ], + "out" : "0x", + "post" : { + "000000000000000000000000000000000000009a" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a609a316439f38370", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a609a316439f38370", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232257.json b/tests/files/VMTests/RandomTests/201412232257.json new file mode 100644 index 000000000..c55291821 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232257.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63818808146c71949e8430744411", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63818808146c71949e8430744411", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63818808146c71949e8430744411", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232258.json b/tests/files/VMTests/RandomTests/201412232258.json new file mode 100644 index 000000000..446b11a8f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232258.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x336441839b081364091a9d03", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x336441839b081364091a9d03", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x336441839b081364091a9d03", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232300.json b/tests/files/VMTests/RandomTests/201412232300.json new file mode 100644 index 000000000..777dfdee6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232300.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x42336a98a03b816642831584", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x42336a98a03b816642831584", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x42336a98a03b816642831584", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232301.json b/tests/files/VMTests/RandomTests/201412232301.json new file mode 100644 index 000000000..1904566d8 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232301.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6a67189e8545a236998870a36d5792", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a67189e8545a236998870a36d5792", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a67189e8545a236998870a36d5792", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232303.json b/tests/files/VMTests/RandomTests/201412232303.json new file mode 100644 index 000000000..950cbdb9e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232303.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x669937456d60798d6b019b17f09a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x669937456d60798d6b019b17f09a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x669937456d60798d6b019b17f09a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232304.json b/tests/files/VMTests/RandomTests/201412232304.json new file mode 100644 index 000000000..ca840ed47 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232304.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x61191965ff3b07f0", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x61191965ff3b07f0", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x61191965ff3b07f0", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232305.json b/tests/files/VMTests/RandomTests/201412232305.json new file mode 100644 index 000000000..a18a42c3e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232305.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x38156d0978a30b33655113a245588992", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x38156d0978a30b33655113a245588992", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x38156d0978a30b33655113a245588992", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232306.json b/tests/files/VMTests/RandomTests/201412232306.json new file mode 100644 index 000000000..b565d84c0 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232306.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3a660739441536366e548167797b9e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9976", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a660739441536366e548167797b9e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a660739441536366e548167797b9e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232307.json b/tests/files/VMTests/RandomTests/201412232307.json new file mode 100644 index 000000000..12ceb63e4 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232307.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3a596596315259", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a596596315259", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a596596315259", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232308.json b/tests/files/VMTests/RandomTests/201412232308.json new file mode 100644 index 000000000..7e6a51511 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232308.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x68747b45999d950a1369688e6f6e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x68747b45999d950a1369688e6f6e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x68747b45999d950a1369688e6f6e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232309.json b/tests/files/VMTests/RandomTests/201412232309.json new file mode 100644 index 000000000..5dbbe3376 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232309.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5b6bf07aa4813b1389f0207e14", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6bf07aa4813b1389f0207e14", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6bf07aa4813b1389f0207e14", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232311.json b/tests/files/VMTests/RandomTests/201412232311.json new file mode 100644 index 000000000..4e2cca5dc --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232311.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3659608b0452638303", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9993", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3659608b0452638303", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3659608b0452638303", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232312.json b/tests/files/VMTests/RandomTests/201412232312.json new file mode 100644 index 000000000..d70461cfd --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232312.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5a0b73807b793b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5a0b73807b793b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232313.json b/tests/files/VMTests/RandomTests/201412232313.json new file mode 100644 index 000000000..19ee3e8b9 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232313.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x610b89336c956951a03597619d8801", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x610b89336c956951a03597619d8801", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x610b89336c956951a03597619d8801", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232314.json b/tests/files/VMTests/RandomTests/201412232314.json new file mode 100644 index 000000000..ac7c63297 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232314.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6244169d620b9e93690770", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6244169d620b9e93690770", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6244169d620b9e93690770", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232317.json b/tests/files/VMTests/RandomTests/201412232317.json new file mode 100644 index 000000000..b16ef5077 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232317.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3854627693", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9978", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3854627693", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3854627693", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232318.json b/tests/files/VMTests/RandomTests/201412232318.json new file mode 100644 index 000000000..9c227c2a6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232318.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x596b6e19676c0237f0a47f7b39", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x596b6e19676c0237f0a47f7b39", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x596b6e19676c0237f0a47f7b39", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232319.json b/tests/files/VMTests/RandomTests/201412232319.json new file mode 100644 index 000000000..53837b641 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232319.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x69853b20959c5af0838d3842663250", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69853b20959c5af0838d3842663250", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69853b20959c5af0838d3842663250", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232320.json b/tests/files/VMTests/RandomTests/201412232320.json new file mode 100644 index 000000000..87e41146f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232320.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x69637511458a923a99425b68993b6169", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69637511458a923a99425b68993b6169", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69637511458a923a99425b68993b6169", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232321.json b/tests/files/VMTests/RandomTests/201412232321.json new file mode 100644 index 000000000..b415205d6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232321.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3a0b7176", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a0b7176", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232323.json b/tests/files/VMTests/RandomTests/201412232323.json new file mode 100644 index 000000000..e089db936 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232323.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x653c8a5591898e6d3b4364806d023714", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x653c8a5591898e6d3b4364806d023714", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x653c8a5591898e6d3b4364806d023714", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232324.json b/tests/files/VMTests/RandomTests/201412232324.json new file mode 100644 index 000000000..29852711f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232324.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x64f187a10b95667b5a6a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x64f187a10b95667b5a6a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x64f187a10b95667b5a6a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232327.json b/tests/files/VMTests/RandomTests/201412232327.json new file mode 100644 index 000000000..f6ea120fb --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232327.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5b306a91608b949b07349c8951", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b306a91608b949b07349c8951", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b306a91608b949b07349c8951", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232328.json b/tests/files/VMTests/RandomTests/201412232328.json new file mode 100644 index 000000000..b5ed168d0 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232328.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x606c456e74418b673c39335159456af3", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x606c456e74418b673c39335159456af3", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x606c456e74418b673c39335159456af3", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232330.json b/tests/files/VMTests/RandomTests/201412232330.json new file mode 100644 index 000000000..c260f35ec --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232330.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x583830696d6d4398a35b86608e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x583830696d6d4398a35b86608e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x583830696d6d4398a35b86608e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232331.json b/tests/files/VMTests/RandomTests/201412232331.json new file mode 100644 index 000000000..ec4f5cf32 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232331.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x65635a9840643b6b6b30970536659786", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65635a9840643b6b6b30970536659786", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65635a9840643b6b6b30970536659786", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232335.json b/tests/files/VMTests/RandomTests/201412232335.json new file mode 100644 index 000000000..e9894c621 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232335.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x67f1821654409b73036481f36613", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x67f1821654409b73036481f36613", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x67f1821654409b73036481f36613", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232336.json b/tests/files/VMTests/RandomTests/201412232336.json new file mode 100644 index 000000000..6fd26bc5c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232336.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6a675a67316d869b93758b916191", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a675a67316d869b93758b916191", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6a675a67316d869b93758b916191", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232338.json b/tests/files/VMTests/RandomTests/201412232338.json new file mode 100644 index 000000000..07a4c3489 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232338.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x636664690267a085518b8f7986", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x636664690267a085518b8f7986", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x636664690267a085518b8f7986", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232341.json b/tests/files/VMTests/RandomTests/201412232341.json new file mode 100644 index 000000000..4979c0285 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232341.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x406d1732976170a436736f206104f1", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x406d1732976170a436736f206104f1", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x406d1732976170a436736f206104f1", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232342.json b/tests/files/VMTests/RandomTests/201412232342.json new file mode 100644 index 000000000..23122711d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232342.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x656b439a6e830b44106b43745411", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x656b439a6e830b44106b43745411", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x656b439a6e830b44106b43745411", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232343.json b/tests/files/VMTests/RandomTests/201412232343.json new file mode 100644 index 000000000..22f293187 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232343.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3264633c34545265f0a267916d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3264633c34545265f0a267916d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3264633c34545265f0a267916d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232345.json b/tests/files/VMTests/RandomTests/201412232345.json new file mode 100644 index 000000000..0a7ca313f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232345.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x33505b6b3240458e869237774370", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33505b6b3240458e869237774370", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x33505b6b3240458e869237774370", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232348.json b/tests/files/VMTests/RandomTests/201412232348.json new file mode 100644 index 000000000..6a630a206 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232348.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x400b40ff", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x400b40ff", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232349.json b/tests/files/VMTests/RandomTests/201412232349.json new file mode 100644 index 000000000..5abc60d57 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232349.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x621a8e7a698d209a9457993831f2", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x621a8e7a698d209a9457993831f2", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x621a8e7a698d209a9457993831f2", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232351.json b/tests/files/VMTests/RandomTests/201412232351.json new file mode 100644 index 000000000..c42707c04 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232351.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5b6c11303b937a750885a06d8bf1", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6c11303b937a750885a06d8bf1", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6c11303b937a750885a06d8bf1", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232352.json b/tests/files/VMTests/RandomTests/201412232352.json new file mode 100644 index 000000000..c91bab832 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232352.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x410b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x410b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232353.json b/tests/files/VMTests/RandomTests/201412232353.json new file mode 100644 index 000000000..2ddd8bb0e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232353.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63338b4367805a6d7691519d403c506b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63338b4367805a6d7691519d403c506b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63338b4367805a6d7691519d403c506b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232354.json b/tests/files/VMTests/RandomTests/201412232354.json new file mode 100644 index 000000000..2e3332259 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232354.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66895a35159e1242695377", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66895a35159e1242695377", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66895a35159e1242695377", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232355.json b/tests/files/VMTests/RandomTests/201412232355.json new file mode 100644 index 000000000..b7951de1e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232355.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x62868d685967a159076a39", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x62868d685967a159076a39", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x62868d685967a159076a39", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232356.json b/tests/files/VMTests/RandomTests/201412232356.json new file mode 100644 index 000000000..23f796d25 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232356.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x306ef08b8f387255096581203a6e3b5a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x306ef08b8f387255096581203a6e3b5a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x306ef08b8f387255096581203a6e3b5a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232357.json b/tests/files/VMTests/RandomTests/201412232357.json new file mode 100644 index 000000000..51a558885 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232357.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4563154564", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4563154564", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4563154564", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232358.json b/tests/files/VMTests/RandomTests/201412232358.json new file mode 100644 index 000000000..346a08a81 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232358.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x607467780a35a43c9b1a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x607467780a35a43c9b1a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x607467780a35a43c9b1a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412232359.json b/tests/files/VMTests/RandomTests/201412232359.json new file mode 100644 index 000000000..3a51d6cd8 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412232359.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63777703320b6d86f352", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63777703320b6d86f352", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240001.json b/tests/files/VMTests/RandomTests/201412240001.json new file mode 100644 index 000000000..4fc212c6c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240001.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4463446c3172666c318655", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4463446c3172666c318655", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4463446c3172666c318655", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240002.json b/tests/files/VMTests/RandomTests/201412240002.json new file mode 100644 index 000000000..7e65c1ee3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240002.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x42657d6e3b593c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x42657d6e3b593c", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x42657d6e3b593c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240004.json b/tests/files/VMTests/RandomTests/201412240004.json new file mode 100644 index 000000000..47b38fd28 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240004.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6153030b7b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6153030b7b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240005.json b/tests/files/VMTests/RandomTests/201412240005.json new file mode 100644 index 000000000..e387cce6b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240005.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5b6cf234675b5162730291176e01", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6cf234675b5162730291176e01", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b6cf234675b5162730291176e01", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240006.json b/tests/files/VMTests/RandomTests/201412240006.json new file mode 100644 index 000000000..aecb337ba --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240006.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x61864162457c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x61864162457c", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x61864162457c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240007.json b/tests/files/VMTests/RandomTests/201412240007.json new file mode 100644 index 000000000..85f6ace5e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240007.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6692a19ea30aa17e6a7b6351418c8e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6692a19ea30aa17e6a7b6351418c8e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6692a19ea30aa17e6a7b6351418c8e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240010.json b/tests/files/VMTests/RandomTests/201412240010.json new file mode 100644 index 000000000..add2acbee --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240010.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x583066060b85637c8e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x583066060b85637c8e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x583066060b85637c8e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240011.json b/tests/files/VMTests/RandomTests/201412240011.json new file mode 100644 index 000000000..1b4d8c88b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240011.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3836643095353652676d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3836643095353652676d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3836643095353652676d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240012.json b/tests/files/VMTests/RandomTests/201412240012.json new file mode 100644 index 000000000..0469b08ea --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240012.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6780a4019a829659446653510185f2", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6780a4019a829659446653510185f2", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6780a4019a829659446653510185f2", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240013.json b/tests/files/VMTests/RandomTests/201412240013.json new file mode 100644 index 000000000..249196e8d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240013.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x657da3560988606b777a77128f12", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x657da3560988606b777a77128f12", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x657da3560988606b777a77128f12", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240014.json b/tests/files/VMTests/RandomTests/201412240014.json new file mode 100644 index 000000000..c95992dcf --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240014.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x637a809755695692921272116d9d8b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x637a809755695692921272116d9d8b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x637a809755695692921272116d9d8b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240015.json b/tests/files/VMTests/RandomTests/201412240015.json new file mode 100644 index 000000000..0443ae12f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240015.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x596a6fa050678e6491885a95", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x596a6fa050678e6491885a95", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x596a6fa050678e6491885a95", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240016.json b/tests/files/VMTests/RandomTests/201412240016.json new file mode 100644 index 000000000..63534bf53 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240016.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x40406c30114210346a1a9b30721292", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x40406c30114210346a1a9b30721292", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x40406c30114210346a1a9b30721292", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240017.json b/tests/files/VMTests/RandomTests/201412240017.json new file mode 100644 index 000000000..bc9788543 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240017.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x648610a31a9d6330", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x648610a31a9d6330", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x648610a31a9d6330", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240019.json b/tests/files/VMTests/RandomTests/201412240019.json new file mode 100644 index 000000000..b9e91d6b5 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240019.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x636f93019840326887a4108f52", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x636f93019840326887a4108f52", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x636f93019840326887a4108f52", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240020.json b/tests/files/VMTests/RandomTests/201412240020.json new file mode 100644 index 000000000..469541b72 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240020.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x608268357e7d3308836d40", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x608268357e7d3308836d40", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x608268357e7d3308836d40", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240021.json b/tests/files/VMTests/RandomTests/201412240021.json new file mode 100644 index 000000000..f336bd0c6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240021.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x44506276", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44506276", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44506276", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240022.json b/tests/files/VMTests/RandomTests/201412240022.json new file mode 100644 index 000000000..34040d50b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240022.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x386a78800a30078e3132a207", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x386a78800a30078e3132a207", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x386a78800a30078e3132a207", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240023.json b/tests/files/VMTests/RandomTests/201412240023.json new file mode 100644 index 000000000..59ebb5276 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240023.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66587a629c69345a5465f1984532", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9978", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66587a629c69345a5465f1984532", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66587a629c69345a5465f1984532", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240024.json b/tests/files/VMTests/RandomTests/201412240024.json new file mode 100644 index 000000000..8a3848714 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240024.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x59649368198f", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x59649368198f", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x59649368198f", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240025.json b/tests/files/VMTests/RandomTests/201412240025.json new file mode 100644 index 000000000..224784e07 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240025.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5a64428f1789666655f0", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5a64428f1789666655f0", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5a64428f1789666655f0", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240026.json b/tests/files/VMTests/RandomTests/201412240026.json new file mode 100644 index 000000000..e3591cc05 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240026.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x676a16558b78588c886471", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x676a16558b78588c886471", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x676a16558b78588c886471", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240028.json b/tests/files/VMTests/RandomTests/201412240028.json new file mode 100644 index 000000000..1289b3189 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240028.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x689c098116ff14a4f1136c74379b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x689c098116ff14a4f1136c74379b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x689c098116ff14a4f1136c74379b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240030.json b/tests/files/VMTests/RandomTests/201412240030.json new file mode 100644 index 000000000..ea21a15a1 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240030.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x607e0b336d18533463", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x607e0b336d18533463", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240031.json b/tests/files/VMTests/RandomTests/201412240031.json new file mode 100644 index 000000000..a59e7139a --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240031.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6558838b0404595a1634676d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9995", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6558838b0404595a1634676d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6558838b0404595a1634676d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240032.json b/tests/files/VMTests/RandomTests/201412240032.json new file mode 100644 index 000000000..4f2ed4253 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240032.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x330b6b73", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x330b6b73", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240034.json b/tests/files/VMTests/RandomTests/201412240034.json new file mode 100644 index 000000000..0dc11d562 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240034.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4535416b597c9e0415a4320a9f44", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4535416b597c9e0415a4320a9f44", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4535416b597c9e0415a4320a9f44", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240035.json b/tests/files/VMTests/RandomTests/201412240035.json new file mode 100644 index 000000000..b1cdfaf49 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240035.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6698173681448d7b5b0b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6698173681448d7b5b0b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240037.json b/tests/files/VMTests/RandomTests/201412240037.json new file mode 100644 index 000000000..12a0c5017 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240037.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x659859849f9859681945", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659859849f9859681945", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659859849f9859681945", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240039.json b/tests/files/VMTests/RandomTests/201412240039.json new file mode 100644 index 000000000..949caeafd --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240039.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63316053033569836a065a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63316053033569836a065a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63316053033569836a065a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240040.json b/tests/files/VMTests/RandomTests/201412240040.json new file mode 100644 index 000000000..098b397f9 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240040.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66459e3511a39d1466868b1a7e5b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66459e3511a39d1466868b1a7e5b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66459e3511a39d1466868b1a7e5b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240041.json b/tests/files/VMTests/RandomTests/201412240041.json new file mode 100644 index 000000000..b4214c4ff --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240041.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x638536ff74683a076f7d648e5261", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x638536ff74683a076f7d648e5261", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x638536ff74683a076f7d648e5261", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240042.json b/tests/files/VMTests/RandomTests/201412240042.json new file mode 100644 index 000000000..7a7711682 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240042.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x626f8a571965155943", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x626f8a571965155943", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x626f8a571965155943", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240044.json b/tests/files/VMTests/RandomTests/201412240044.json new file mode 100644 index 000000000..fbb10dd94 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240044.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4569761168a085ff08527b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4569761168a085ff08527b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4569761168a085ff08527b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240045.json b/tests/files/VMTests/RandomTests/201412240045.json new file mode 100644 index 000000000..2c19c8667 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240045.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x440b7d521009763c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x440b7d521009763c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240047.json b/tests/files/VMTests/RandomTests/201412240047.json new file mode 100644 index 000000000..93210a712 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240047.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66350780181278f3675a5564a4a03b8d", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66350780181278f3675a5564a4a03b8d", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66350780181278f3675a5564a4a03b8d", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240051.json b/tests/files/VMTests/RandomTests/201412240051.json new file mode 100644 index 000000000..df5777d58 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240051.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x34687b343b1679186e09", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34687b343b1679186e09", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34687b343b1679186e09", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240052.json b/tests/files/VMTests/RandomTests/201412240052.json new file mode 100644 index 000000000..1b2dac5d6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240052.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x646e303b8f516b62715952a08143", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x646e303b8f516b62715952a08143", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x646e303b8f516b62715952a08143", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240053.json b/tests/files/VMTests/RandomTests/201412240053.json new file mode 100644 index 000000000..3bf5674f3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240053.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x43665a1935346e75", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x43665a1935346e75", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x43665a1935346e75", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240054.json b/tests/files/VMTests/RandomTests/201412240054.json new file mode 100644 index 000000000..d3d79807b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240054.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x62417cf166f27f169737789a6c9c0b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x62417cf166f27f169737789a6c9c0b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x62417cf166f27f169737789a6c9c0b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240055.json b/tests/files/VMTests/RandomTests/201412240055.json new file mode 100644 index 000000000..23101221b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240055.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x659f32357bf28c306b459d9395068a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659f32357bf28c306b459d9395068a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659f32357bf28c306b459d9395068a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240056.json b/tests/files/VMTests/RandomTests/201412240056.json new file mode 100644 index 000000000..16703dd22 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240056.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3067309a427d917340", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3067309a427d917340", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3067309a427d917340", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240058.json b/tests/files/VMTests/RandomTests/201412240058.json new file mode 100644 index 000000000..e503a1201 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240058.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x446a509893399956357f397c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x446a509893399956357f397c", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x446a509893399956357f397c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240059.json b/tests/files/VMTests/RandomTests/201412240059.json new file mode 100644 index 000000000..dc8704905 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240059.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x651994649651940b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x651994649651940b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240100.json b/tests/files/VMTests/RandomTests/201412240100.json new file mode 100644 index 000000000..cf7080e61 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240100.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6875f1151657436c6b9c690162", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6875f1151657436c6b9c690162", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6875f1151657436c6b9c690162", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240101.json b/tests/files/VMTests/RandomTests/201412240101.json new file mode 100644 index 000000000..121d7d20c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240101.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x689863403864640984ff6612046552", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x689863403864640984ff6612046552", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x689863403864640984ff6612046552", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240103.json b/tests/files/VMTests/RandomTests/201412240103.json new file mode 100644 index 000000000..48ed88b8d --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240103.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x646b6272f1386837a175019344", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x646b6272f1386837a175019344", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x646b6272f1386837a175019344", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240104.json b/tests/files/VMTests/RandomTests/201412240104.json new file mode 100644 index 000000000..51ae819e0 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240104.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x5b64808c6c94", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b64808c6c94", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5b64808c6c94", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240105.json b/tests/files/VMTests/RandomTests/201412240105.json new file mode 100644 index 000000000..1efb2ca7b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240105.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x30368013638a7e613350675b0b6552", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9993", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x30368013638a7e613350675b0b6552", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x30368013638a7e613350675b0b6552", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240106.json b/tests/files/VMTests/RandomTests/201412240106.json new file mode 100644 index 000000000..a4625e3a3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240106.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6aa0148488059a767a88828d6752", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6aa0148488059a767a88828d6752", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6aa0148488059a767a88828d6752", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240107.json b/tests/files/VMTests/RandomTests/201412240107.json new file mode 100644 index 000000000..cd84f56b0 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240107.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6b50533490793104f2923c68126858", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b50533490793104f2923c68126858", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b50533490793104f2923c68126858", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240110.json b/tests/files/VMTests/RandomTests/201412240110.json new file mode 100644 index 000000000..d817941a3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240110.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x44697507709b52f0835389", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44697507709b52f0835389", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44697507709b52f0835389", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240111.json b/tests/files/VMTests/RandomTests/201412240111.json new file mode 100644 index 000000000..0e5d2061e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240111.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x306e5af3368764706e1985938b928711", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x306e5af3368764706e1985938b928711", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x306e5af3368764706e1985938b928711", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240112.json b/tests/files/VMTests/RandomTests/201412240112.json new file mode 100644 index 000000000..bc76f4449 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240112.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6991a114026998746040f26c40536c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6991a114026998746040f26c40536c", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6991a114026998746040f26c40536c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240113.json b/tests/files/VMTests/RandomTests/201412240113.json new file mode 100644 index 000000000..224e2279a --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240113.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x34684076f38370533393", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34684076f38370533393", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34684076f38370533393", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240115.json b/tests/files/VMTests/RandomTests/201412240115.json new file mode 100644 index 000000000..c23b35808 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240115.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x34336a630542a1f34074139f90", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34336a630542a1f34074139f90", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34336a630542a1f34074139f90", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240116.json b/tests/files/VMTests/RandomTests/201412240116.json new file mode 100644 index 000000000..d6e9dcad9 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240116.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x416b77018c6a3b6085418f6a3a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x416b77018c6a3b6085418f6a3a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x416b77018c6a3b6085418f6a3a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240117.json b/tests/files/VMTests/RandomTests/201412240117.json new file mode 100644 index 000000000..c91bab832 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240117.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x410b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x410b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240119.json b/tests/files/VMTests/RandomTests/201412240119.json new file mode 100644 index 000000000..562864020 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240119.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x633207887d65508510", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x633207887d65508510", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x633207887d65508510", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240120.json b/tests/files/VMTests/RandomTests/201412240120.json new file mode 100644 index 000000000..d9bd81435 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240120.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x59156d8e8866166a03526fa040670296", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x59156d8e8866166a03526fa040670296", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x59156d8e8866166a03526fa040670296", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240121.json b/tests/files/VMTests/RandomTests/201412240121.json new file mode 100644 index 000000000..95faf8f00 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240121.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x58455a13326590", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9994", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x58455a13326590", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x58455a13326590", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240122.json b/tests/files/VMTests/RandomTests/201412240122.json new file mode 100644 index 000000000..6ccd3a9ae --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240122.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x659a573a376ef262059e590a4364a471", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9989", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659a573a376ef262059e590a4364a471", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659a573a376ef262059e590a4364a471", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240123.json b/tests/files/VMTests/RandomTests/201412240123.json new file mode 100644 index 000000000..9ddf2dffa --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240123.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x659e394455318d66389b386c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659e394455318d66389b386c", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x659e394455318d66389b386c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240124.json b/tests/files/VMTests/RandomTests/201412240124.json new file mode 100644 index 000000000..a29e0c49e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240124.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x440b7967049a94453c8d8077a16769", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x440b7967049a94453c8d8077a16769", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240125.json b/tests/files/VMTests/RandomTests/201412240125.json new file mode 100644 index 000000000..1b71caa61 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240125.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x627642376c8d87185a5406328950840a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x627642376c8d87185a5406328950840a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x627642376c8d87185a5406328950840a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240126.json b/tests/files/VMTests/RandomTests/201412240126.json new file mode 100644 index 000000000..fe4e1f751 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240126.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x386d5bf08365179b18898f58559776", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x386d5bf08365179b18898f58559776", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x386d5bf08365179b18898f58559776", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240127.json b/tests/files/VMTests/RandomTests/201412240127.json new file mode 100644 index 000000000..61f14cda7 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240127.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x34677d137f571a8450", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34677d137f571a8450", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x34677d137f571a8450", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240128.json b/tests/files/VMTests/RandomTests/201412240128.json new file mode 100644 index 000000000..2807e4420 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240128.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x44625056", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44625056", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x44625056", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240129.json b/tests/files/VMTests/RandomTests/201412240129.json new file mode 100644 index 000000000..eb993999e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240129.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x69388e2091a41aa4417055697442", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69388e2091a41aa4417055697442", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x69388e2091a41aa4417055697442", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240130.json b/tests/files/VMTests/RandomTests/201412240130.json new file mode 100644 index 000000000..df14911a9 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240130.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6991949e36033412978f906513890653", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6991949e36033412978f906513890653", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6991949e36033412978f906513890653", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240131.json b/tests/files/VMTests/RandomTests/201412240131.json new file mode 100644 index 000000000..1d393795b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240131.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x60550b7a689d617c666b113573140a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x60550b7a689d617c666b113573140a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240132.json b/tests/files/VMTests/RandomTests/201412240132.json new file mode 100644 index 000000000..996cceb38 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240132.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4030687074850654657477", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4030687074850654657477", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4030687074850654657477", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240133.json b/tests/files/VMTests/RandomTests/201412240133.json new file mode 100644 index 000000000..2ed09c308 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240133.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x664011374176203b65036770", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x664011374176203b65036770", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x664011374176203b65036770", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240134.json b/tests/files/VMTests/RandomTests/201412240134.json new file mode 100644 index 000000000..1b95fc356 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240134.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63336f042068628d417f7966", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63336f042068628d417f7966", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63336f042068628d417f7966", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240136.json b/tests/files/VMTests/RandomTests/201412240136.json new file mode 100644 index 000000000..1711a2518 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240136.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6698059a329a72900b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6698059a329a72900b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240137.json b/tests/files/VMTests/RandomTests/201412240137.json new file mode 100644 index 000000000..b71212363 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240137.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x32430268f380158b93517e", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x32430268f380158b93517e", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x32430268f380158b93517e", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240138.json b/tests/files/VMTests/RandomTests/201412240138.json new file mode 100644 index 000000000..13ee5245a --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240138.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x586738973b57f26b95", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x586738973b57f26b95", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x586738973b57f26b95", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240139.json b/tests/files/VMTests/RandomTests/201412240139.json new file mode 100644 index 000000000..ef5719cc2 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240139.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6018646d166ca3", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6018646d166ca3", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6018646d166ca3", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240140.json b/tests/files/VMTests/RandomTests/201412240140.json new file mode 100644 index 000000000..50af4ddb5 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240140.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4542687b369e528b4479", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4542687b369e528b4479", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4542687b369e528b4479", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240141.json b/tests/files/VMTests/RandomTests/201412240141.json new file mode 100644 index 000000000..d30c379a9 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240141.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x3a663bf314860414", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a663bf314860414", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x3a663bf314860414", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240142.json b/tests/files/VMTests/RandomTests/201412240142.json new file mode 100644 index 000000000..f0d652a41 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240142.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x426d16f1420890106a6164558c7551", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426d16f1420890106a6164558c7551", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426d16f1420890106a6164558c7551", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240148.json b/tests/files/VMTests/RandomTests/201412240148.json new file mode 100644 index 000000000..04ab40ea8 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240148.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x666e3994068640536445710b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x666e3994068640536445710b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x666e3994068640536445710b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240149.json b/tests/files/VMTests/RandomTests/201412240149.json new file mode 100644 index 000000000..6b6006f78 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240149.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x446c7e94116bf2168107398b1639", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x446c7e94116bf2168107398b1639", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x446c7e94116bf2168107398b1639", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240150.json b/tests/files/VMTests/RandomTests/201412240150.json new file mode 100644 index 000000000..d09871712 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240150.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x66516185a4ff78406d90057a819345", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66516185a4ff78406d90057a819345", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x66516185a4ff78406d90057a819345", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240151.json b/tests/files/VMTests/RandomTests/201412240151.json new file mode 100644 index 000000000..610739e5c --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240151.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6b6d8f998e8d739789868365766e408b", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b6d8f998e8d739789868365766e408b", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6b6d8f998e8d739789868365766e408b", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240152.json b/tests/files/VMTests/RandomTests/201412240152.json new file mode 100644 index 000000000..bb2942d65 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240152.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x63076f9d3866a17f41958939", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63076f9d3866a17f41958939", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x63076f9d3866a17f41958939", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240153.json b/tests/files/VMTests/RandomTests/201412240153.json new file mode 100644 index 000000000..b773adc8e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240153.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x40617b3c1668929167f3", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9996", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x40617b3c1668929167f3", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x40617b3c1668929167f3", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240154.json b/tests/files/VMTests/RandomTests/201412240154.json new file mode 100644 index 000000000..f22abf009 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240154.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x65a4f29b9d028b66959158", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65a4f29b9d028b66959158", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65a4f29b9d028b66959158", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240155.json b/tests/files/VMTests/RandomTests/201412240155.json new file mode 100644 index 000000000..c616e6e13 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240155.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x426b8d795802900176423a7a63", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426b8d795802900176423a7a63", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x426b8d795802900176423a7a63", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240156.json b/tests/files/VMTests/RandomTests/201412240156.json new file mode 100644 index 000000000..e5d7d42bc --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240156.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x595a65173745917f", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x595a65173745917f", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x595a65173745917f", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240157.json b/tests/files/VMTests/RandomTests/201412240157.json new file mode 100644 index 000000000..9760e6fae --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240157.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x699e52966c9a9175f17d1067813859", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x699e52966c9a9175f17d1067813859", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x699e52966c9a9175f17d1067813859", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240158.json b/tests/files/VMTests/RandomTests/201412240158.json new file mode 100644 index 000000000..dbcb6e1e3 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240158.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x677e6e5841a45096a215316a1601", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9977", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0000000000000000000000000000000000000000" : { + "balance" : "0", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x677e6e5841a45096a215316a1601", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x677e6e5841a45096a215316a1601", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240159.json b/tests/files/VMTests/RandomTests/201412240159.json new file mode 100644 index 000000000..99c475b29 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240159.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x68919c56988603750974666d6b098e5a", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x68919c56988603750974666d6b098e5a", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x68919c56988603750974666d6b098e5a", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240201.json b/tests/files/VMTests/RandomTests/201412240201.json new file mode 100644 index 000000000..f9b8c5439 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240201.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x343569541588518d719563f3", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x343569541588518d719563f3", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x343569541588518d719563f3", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240202.json b/tests/files/VMTests/RandomTests/201412240202.json new file mode 100644 index 000000000..aff74db9e --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240202.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x6292797167197b1205344281", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9998", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6292797167197b1205344281", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x6292797167197b1205344281", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201412240204.json b/tests/files/VMTests/RandomTests/201412240204.json new file mode 100644 index 000000000..27ae65712 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201412240204.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x65878e80f142515a65159511", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9997", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65878e80f142515a65159511", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x65878e80f142515a65159511", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/index.js b/tests/files/index.js index 34a03d8b2..99c19aa13 100644 --- a/tests/files/index.js +++ b/tests/files/index.js @@ -4,8 +4,11 @@ module.exports = { hexencode: require('./BasicTests/hexencodetest'), keyaddrtests: require('./BasicTests/keyaddrtest'), rlptest: require('./BasicTests/rlptest'), - trietest: require('./TrieTests/trietest'), - trietestnextprev: require('./TrieTests/trietestnextprev'), + trieTests: { + trietest: require('./TrieTests/trietest'), + trietestnextprev: require('./TrieTests/trietestnextprev'), + trieanyorder: require('./TrieTests/trieanyorder') + }, txtest: require('./BasicTests/txtest'), StateTests: { stExample: require('./StateTests/stExample.json'), @@ -13,6 +16,7 @@ module.exports = { stLogTests: require('./StateTests/stLogTests.json'), stPreCompiledContracts: require('./StateTests/stPreCompiledContracts'), stRecursiveCreate: require('./StateTests/stRecursiveCreate'), + stRefundTest: require('./StateTests/stRefundTest'), stSpecial: require('./StateTests/stSpecialTest'), stSystemOperationsTest: require('./StateTests/stSystemOperationsTest'), stTransactionTest: require('./StateTests/stTransactionTest') -- cgit v1.2.3 From 138ab26b8c29db00022fb6afbca153f3c1928d00 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 17:09:43 +0100 Subject: SIGNEXTEND missing from stack check --- vm/vm_debug.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 2ee13c516..a4e97ad48 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -140,7 +140,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * // Stack checks only case ISZERO, CALLDATALOAD, POP, JUMP, NOT: // 1 require(1) - case ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE: // 2 + case ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2 require(2) case ADDMOD, MULMOD: // 3 require(3) -- cgit v1.2.3 From 89244981a8a9f190a6afc74ec2c584692f04dcdd Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 17:09:54 +0100 Subject: Additional checking on gas --- cmd/ethtest/main.go | 11 ++++-- tests/files/VMTests/RandomTests/randomTest.json | 46 ------------------------- 2 files changed, 8 insertions(+), 49 deletions(-) delete mode 100644 tests/files/VMTests/RandomTests/randomTest.json diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index 94ab779db..96ef94e40 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -95,10 +95,15 @@ func RunVmTest(js string) (failed int) { failed = 1 } - gexp := ethutil.Big(test.Gas) - if gexp.Cmp(gas) != 0 { - log.Printf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + if len(test.Gas) == 0 && err == nil { + log.Printf("0 gas indicates error but no error given by VM") failed = 1 + } else { + gexp := ethutil.Big(test.Gas) + if gexp.Cmp(gas) != 0 { + log.Printf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + failed = 1 + } } for addr, account := range test.Post { diff --git a/tests/files/VMTests/RandomTests/randomTest.json b/tests/files/VMTests/RandomTests/randomTest.json deleted file mode 100644 index dad2ee4a2..000000000 --- a/tests/files/VMTests/RandomTests/randomTest.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "randomVMtest" : { - "callcreates" : [ - ], - "env" : { - "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", - "currentDifficulty" : "256", - "currentGasLimit" : "1000000", - "currentNumber" : "0", - "currentTimestamp" : "1", - "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" - }, - "exec" : { - "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", - "code" : "0x675545", - "data" : "0x", - "gas" : "10000", - "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", - "value" : "1000000000000000000" - }, - "gas" : "9999", - "logs" : [ - ], - "out" : "0x", - "post" : { - "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", - "code" : "0x675545", - "nonce" : "0", - "storage" : { - } - } - }, - "pre" : { - "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", - "code" : "0x675545", - "nonce" : "0", - "storage" : { - } - } - } - } -} \ No newline at end of file -- cgit v1.2.3 From 16460b0048b738b0474bc1556d0df469f64bcf26 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 17:16:28 +0100 Subject: Fixed gas check for vm test --- tests/vm/gh_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 1efda7fe0..e06b0ed82 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -107,7 +107,9 @@ func RunVmTest(p string, t *testing.T) { logs state.Logs ) - if len(test.Exec) > 0 { + isVmTest := len(test.Exec) > 0 + + if isVmTest { ret, logs, gas, err = helper.RunVm(statedb, env, test.Exec) } else { ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction) @@ -124,10 +126,14 @@ func RunVmTest(p string, t *testing.T) { t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) } - if len(test.Gas) > 0 { - gexp := ethutil.Big(test.Gas) - if gexp.Cmp(gas) != 0 { - t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + if isVmTest { + if len(test.Gas) == 0 && err == nil { + t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull") + } else { + gexp := ethutil.Big(test.Gas) + if gexp.Cmp(gas) != 0 { + t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + } } } -- cgit v1.2.3 From 4b4e0821027cb5a82eaa04dcd89b1cad4a05af4e Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 31 Dec 2014 10:32:53 +0100 Subject: JUMPI never 'require' checked. --- vm/vm_debug.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 933fb7b12..1e1b85e6d 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -140,7 +140,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * // Stack checks only case ISZERO, CALLDATALOAD, POP, JUMP, NOT: // 1 require(1) - case ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2 + case JUMPI, ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2 require(2) case ADDMOD, MULMOD: // 3 require(3) -- cgit v1.2.3 From 4547a05a689e6a0f29dd2d90e840e84de7f564f4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 31 Dec 2014 11:12:40 +0100 Subject: Minor improvements * Moved gas and mem size to its own function --- vm/stack.go | 6 ++ vm/vm_debug.go | 325 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 169 insertions(+), 162 deletions(-) diff --git a/vm/stack.go b/vm/stack.go index 6091479cb..b9eaa10cd 100644 --- a/vm/stack.go +++ b/vm/stack.go @@ -91,6 +91,12 @@ func (st *Stack) Get(amount *big.Int) []*big.Int { return nil } +func (st *Stack) require(n int) { + if st.Len() < n { + panic(fmt.Sprintf("stack underflow (%d <=> %d)", st.Len(), n)) + } +} + func (st *Stack) Print() { fmt.Println("### stack ###") if len(st.data) > 0 { diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 1e1b85e6d..8829a9de0 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -49,15 +49,11 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * }) closure := NewClosure(msg, caller, me, code, gas, price) - if p := Precompiled[string(me.Address())]; p != nil { - return self.RunPrecompiled(p, callData, closure) - } - if self.Recoverable { // Recover from any require exception defer func() { if r := recover(); r != nil { - self.Endl() + self.Printf(" %v", r).Endl() closure.UseGas(closure.Gas) @@ -69,6 +65,10 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * }() } + if p := Precompiled[string(me.Address())]; p != nil { + return self.RunPrecompiled(p, callData, closure) + } + var ( op OpCode @@ -79,11 +79,6 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * step = 0 prevStep = 0 statedb = self.env.State() - require = func(m int) { - if stack.Len() < m { - panic(fmt.Sprintf("%04v (%v) stack err size = %d, required = %d", pc, op, stack.Len(), m)) - } - } jump = func(from uint64, to *big.Int) { p := to.Uint64() @@ -124,160 +119,11 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * // Get the memory location of pc op = closure.GetOp(pc) - gas := new(big.Int) - addStepGasUsage := func(amount *big.Int) { - if amount.Cmp(ethutil.Big0) >= 0 { - gas.Add(gas, amount) - } - } - - addStepGasUsage(GasStep) - - var newMemSize *big.Int = ethutil.Big0 - var additionalGas *big.Int = new(big.Int) - // Stack Check, memory resize & gas phase - switch op { - // Stack checks only - case ISZERO, CALLDATALOAD, POP, JUMP, NOT: // 1 - require(1) - case JUMPI, ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2 - require(2) - case ADDMOD, MULMOD: // 3 - require(3) - case SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16: - n := int(op - SWAP1 + 2) - require(n) - case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: - n := int(op - DUP1 + 1) - require(n) - case LOG0, LOG1, LOG2, LOG3, LOG4: - n := int(op - LOG0) - require(n + 2) - - gas.Set(GasLog) - addStepGasUsage(new(big.Int).Mul(big.NewInt(int64(n)), GasLog)) - - mSize, mStart := stack.Peekn() - addStepGasUsage(mSize) - - newMemSize = calcMemSize(mStart, mSize) - case EXP: - require(2) - - gas.Set(big.NewInt(int64(len(stack.data[stack.Len()-2].Bytes()) + 1))) - // Gas only - case STOP: - gas.Set(ethutil.Big0) - case SUICIDE: - require(1) - - gas.Set(ethutil.Big0) - case SLOAD: - require(1) - - gas.Set(GasSLoad) - // Memory resize & Gas - case SSTORE: - require(2) - - var mult *big.Int - y, x := stack.Peekn() - val := statedb.GetState(closure.Address(), x.Bytes()) - if len(val) == 0 && len(y.Bytes()) > 0 { - // 0 => non 0 - mult = ethutil.Big3 - } else if len(val) > 0 && len(y.Bytes()) == 0 { - statedb.Refund(caller.Address(), GasSStoreRefund) - - mult = ethutil.Big0 - } else { - // non 0 => non 0 (or 0 => 0) - mult = ethutil.Big1 - } - gas.Set(new(big.Int).Mul(mult, GasSStore)) - case BALANCE: - require(1) - gas.Set(GasBalance) - case MSTORE: - require(2) - newMemSize = calcMemSize(stack.Peek(), u256(32)) - case MLOAD: - require(1) - - newMemSize = calcMemSize(stack.Peek(), u256(32)) - case MSTORE8: - require(2) - newMemSize = calcMemSize(stack.Peek(), u256(1)) - case RETURN: - require(2) - - newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2]) - case SHA3: - require(2) - gas.Set(GasSha) - newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2]) - additionalGas.Set(stack.data[stack.Len()-2]) - case CALLDATACOPY: - require(2) - - newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3]) - additionalGas.Set(stack.data[stack.Len()-3]) - case CODECOPY: - require(3) - - newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3]) - additionalGas.Set(stack.data[stack.Len()-3]) - case EXTCODECOPY: - require(4) - - newMemSize = calcMemSize(stack.data[stack.Len()-2], stack.data[stack.Len()-4]) - additionalGas.Set(stack.data[stack.Len()-4]) - case CALL, CALLCODE: - require(7) - gas.Set(GasCall) - addStepGasUsage(stack.data[stack.Len()-1]) - - x := calcMemSize(stack.data[stack.Len()-6], stack.data[stack.Len()-7]) - y := calcMemSize(stack.data[stack.Len()-4], stack.data[stack.Len()-5]) - - newMemSize = ethutil.BigMax(x, y) - case CREATE: - require(3) - gas.Set(GasCreate) - - newMemSize = calcMemSize(stack.data[stack.Len()-2], stack.data[stack.Len()-3]) - } - - switch op { - case CALLDATACOPY, CODECOPY, EXTCODECOPY: - additionalGas.Add(additionalGas, u256(31)) - additionalGas.Div(additionalGas, u256(32)) - addStepGasUsage(additionalGas) - case SHA3: - additionalGas.Add(additionalGas, u256(31)) - additionalGas.Div(additionalGas, u256(32)) - additionalGas.Mul(additionalGas, GasSha3Byte) - addStepGasUsage(additionalGas) - } - - if newMemSize.Cmp(ethutil.Big0) > 0 { - newMemSize.Add(newMemSize, u256(31)) - newMemSize.Div(newMemSize, u256(32)) - newMemSize.Mul(newMemSize, u256(32)) - - if newMemSize.Cmp(u256(int64(mem.Len()))) > 0 { - memGasUsage := new(big.Int).Sub(newMemSize, u256(int64(mem.Len()))) - memGasUsage.Mul(GasMemory, memGasUsage) - memGasUsage.Div(memGasUsage, u256(32)) - - addStepGasUsage(memGasUsage) + self.Printf("(pc) %-3d -o- %-14s (m) %-4d (s) %-4d ", pc, op.String(), mem.Len(), stack.Len()) - } - - } + newMemSize, gas := self.calculateGasAndSize(closure, caller, op, statedb, mem, stack) - self.Printf("(pc) %-3d -o- %-14s", pc, op.String()) - self.Printf(" (m) %-4d (s) %-4d (g) %-3v (%v)", mem.Len(), stack.Len(), gas, closure.Gas) + self.Printf("(g) %-3v (%v)", gas, closure.Gas) if !closure.UseGas(gas) { self.Endl() @@ -939,6 +785,161 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * } } +func (self *DebugVm) calculateGasAndSize(closure *Closure, caller ClosureRef, op OpCode, statedb *state.StateDB, mem *Memory, stack *Stack) (*big.Int, *big.Int) { + gas := new(big.Int) + addStepGasUsage := func(amount *big.Int) { + if amount.Cmp(ethutil.Big0) >= 0 { + gas.Add(gas, amount) + } + } + + addStepGasUsage(GasStep) + + var newMemSize *big.Int = ethutil.Big0 + var additionalGas *big.Int = new(big.Int) + // Stack Check, memory resize & gas phase + switch op { + // Stack checks only + case ISZERO, CALLDATALOAD, POP, JUMP, NOT: // 1 + stack.require(1) + case JUMPI, ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2 + stack.require(2) + case ADDMOD, MULMOD: // 3 + stack.require(3) + case SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16: + n := int(op - SWAP1 + 2) + stack.require(n) + case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: + n := int(op - DUP1 + 1) + stack.require(n) + case LOG0, LOG1, LOG2, LOG3, LOG4: + n := int(op - LOG0) + stack.require(n + 2) + + gas.Set(GasLog) + addStepGasUsage(new(big.Int).Mul(big.NewInt(int64(n)), GasLog)) + + mSize, mStart := stack.Peekn() + addStepGasUsage(mSize) + + newMemSize = calcMemSize(mStart, mSize) + case EXP: + stack.require(2) + + gas.Set(big.NewInt(int64(len(stack.data[stack.Len()-2].Bytes()) + 1))) + // Gas only + case STOP: + gas.Set(ethutil.Big0) + case SUICIDE: + stack.require(1) + + gas.Set(ethutil.Big0) + case SLOAD: + stack.require(1) + + gas.Set(GasSLoad) + // Memory resize & Gas + case SSTORE: + stack.require(2) + + var mult *big.Int + y, x := stack.Peekn() + val := statedb.GetState(closure.Address(), x.Bytes()) + if len(val) == 0 && len(y.Bytes()) > 0 { + // 0 => non 0 + mult = ethutil.Big3 + } else if len(val) > 0 && len(y.Bytes()) == 0 { + statedb.Refund(caller.Address(), GasSStoreRefund) + + mult = ethutil.Big0 + } else { + // non 0 => non 0 (or 0 => 0) + mult = ethutil.Big1 + } + gas.Set(new(big.Int).Mul(mult, GasSStore)) + case BALANCE: + stack.require(1) + gas.Set(GasBalance) + case MSTORE: + stack.require(2) + newMemSize = calcMemSize(stack.Peek(), u256(32)) + case MLOAD: + stack.require(1) + + newMemSize = calcMemSize(stack.Peek(), u256(32)) + case MSTORE8: + stack.require(2) + newMemSize = calcMemSize(stack.Peek(), u256(1)) + case RETURN: + stack.require(2) + + newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2]) + case SHA3: + stack.require(2) + gas.Set(GasSha) + newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2]) + additionalGas.Set(stack.data[stack.Len()-2]) + case CALLDATACOPY: + stack.require(2) + + newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3]) + additionalGas.Set(stack.data[stack.Len()-3]) + case CODECOPY: + stack.require(3) + + newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3]) + additionalGas.Set(stack.data[stack.Len()-3]) + case EXTCODECOPY: + stack.require(4) + + newMemSize = calcMemSize(stack.data[stack.Len()-2], stack.data[stack.Len()-4]) + additionalGas.Set(stack.data[stack.Len()-4]) + case CALL, CALLCODE: + stack.require(7) + gas.Set(GasCall) + addStepGasUsage(stack.data[stack.Len()-1]) + + x := calcMemSize(stack.data[stack.Len()-6], stack.data[stack.Len()-7]) + y := calcMemSize(stack.data[stack.Len()-4], stack.data[stack.Len()-5]) + + newMemSize = ethutil.BigMax(x, y) + case CREATE: + stack.require(3) + gas.Set(GasCreate) + + newMemSize = calcMemSize(stack.data[stack.Len()-2], stack.data[stack.Len()-3]) + } + + switch op { + case CALLDATACOPY, CODECOPY, EXTCODECOPY: + additionalGas.Add(additionalGas, u256(31)) + additionalGas.Div(additionalGas, u256(32)) + addStepGasUsage(additionalGas) + case SHA3: + additionalGas.Add(additionalGas, u256(31)) + additionalGas.Div(additionalGas, u256(32)) + additionalGas.Mul(additionalGas, GasSha3Byte) + addStepGasUsage(additionalGas) + } + + if newMemSize.Cmp(ethutil.Big0) > 0 { + newMemSize.Add(newMemSize, u256(31)) + newMemSize.Div(newMemSize, u256(32)) + newMemSize.Mul(newMemSize, u256(32)) + + if newMemSize.Cmp(u256(int64(mem.Len()))) > 0 { + memGasUsage := new(big.Int).Sub(newMemSize, u256(int64(mem.Len()))) + memGasUsage.Mul(GasMemory, memGasUsage) + memGasUsage.Div(memGasUsage, u256(32)) + + addStepGasUsage(memGasUsage) + } + + } + + return newMemSize, gas +} + func (self *DebugVm) RunPrecompiled(p *PrecompiledAccount, callData []byte, closure *Closure) (ret []byte, err error) { gas := p.Gas(len(callData)) if closure.UseGas(gas) { -- cgit v1.2.3 From a4dc12f12c7a06f5e28d5b1e760249875ef7a8c5 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 31 Dec 2014 11:21:39 +0100 Subject: Additional comments and added name to error output --- tests/vm/gh_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index e06b0ed82..f1e4d1acc 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -108,17 +108,16 @@ func RunVmTest(p string, t *testing.T) { ) isVmTest := len(test.Exec) > 0 - if isVmTest { ret, logs, gas, err = helper.RunVm(statedb, env, test.Exec) } else { ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction) } - // When an error is returned it doesn't always mean the tests fails. - // Have to come up with some conditional failing mechanism. + // Log the error if there is one. Error does not mean failing test. + // A test fails if err != nil and post params are specified in the test. if err != nil { - helper.Log.Infoln(err) + helper.Log.Infof("%s's: %v\n", name, err) } rexp := helper.FromHex(test.Out) @@ -160,7 +159,6 @@ func RunVmTest(p string, t *testing.T) { } if len(test.Logs) > 0 { - // Logs within the test itself aren't correct, missing empty fields (32 0s) for i, log := range test.Logs { genBloom := ethutil.LeftPadBytes(types.LogsBloom(state.Logs{logs[i]}).Bytes(), 64) if !bytes.Equal(genBloom, ethutil.Hex2Bytes(log.BloomF)) { -- cgit v1.2.3