Merge pull request #216 from ethereum/develop

Update tests branch from develop
This commit is contained in:
Taylor Gerring 2014-12-21 11:42:32 -06:00
commit 1360f027d9
115 changed files with 20448 additions and 8399 deletions

BIN
_data/chain1 Executable file

Binary file not shown.

BIN
_data/chain2 Executable file

Binary file not shown.

View File

@ -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 {
@ -88,7 +88,7 @@ func (self *BlockPool) FetchHashes(peer *Peer) bool {
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.Debugf("Found better suitable peer (%v vs %v)\n", self.td, peer.td)
poollogger.Infof("Found better suitable peer (%v vs %v)\n", self.td, peer.td)
if self.peer != nil {
self.peer.doneFetchingHashes = true
@ -99,11 +99,7 @@ func (self *BlockPool) FetchHashes(peer *Peer) bool {
self.td = peer.td
if !self.HasLatestHash() {
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)}))
self.fetchHashes()
}
return true
@ -112,6 +108,16 @@ func (self *BlockPool) FetchHashes(peer *Peer) bool {
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()
@ -148,7 +154,7 @@ func (self *BlockPool) addBlock(b *types.Block, peer *Peer, newBlock bool) {
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 {
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)}))
}
@ -259,6 +265,13 @@ out:
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()

View File

@ -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")

View File

@ -30,7 +30,7 @@ import (
const (
ClientIdentifier = "Ethereum(G)"
Version = "0.7.7"
Version = "0.7.10"
)
var clilogger = logger.NewLogger("CLI")
@ -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 {

View File

@ -133,7 +133,7 @@ func (self *VMEnv) Value() *big.Int { return self.value }
func (self *VMEnv) GasLimit() *big.Int { return big.NewInt(1000000000) }
func (self *VMEnv) Depth() int { return 0 }
func (self *VMEnv) SetDepth(i int) { self.depth = i }
func (self *VMEnv) AddLog(log *state.Log) {
func (self *VMEnv) AddLog(log state.Log) {
self.state.AddLog(log)
}
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
@ -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) {

View File

@ -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: "<h2>Mist (0.6.5)</h2><h4>Amalthea</h4><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br><h3>Building</h3>Maran Hidskes"
text: "<h2>Mist (0.7.10)</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br>Felix Lange<br>Taylor Gerring<br>Daniel Nagy<br><h3>UX</h3>Alex van de Sande<br>"
}
}

View File

@ -148,17 +148,21 @@ Rectangle {
id: txTableView
anchors.fill : parent
TableViewColumn{ role: "num" ; title: "#" ; width: 30 }
TableViewColumn{ role: "from" ; title: "From" ; width: 280 }
TableViewColumn{ role: "to" ; title: "To" ; width: 280 }
TableViewColumn{ role: "from" ; title: "From" ; width: 340 }
TableViewColumn{ role: "to" ; title: "To" ; width: 340 }
TableViewColumn{ role: "value" ; title: "Amount" ; width: 100 }
model: ListModel {
id: txModel
Component.onCompleted: {
var filter = ethx.watch({latest: -1, from: eth.key().address});
filter.changed(addTxs)
var me = eth.key().address;
var filterTo = ethx.watch({latest: -1, to: me});
var filterFrom = ethx.watch({latest: -1, from: me});
filterTo.changed(addTxs)
filterFrom.changed(addTxs)
addTxs(filter.messages())
addTxs(filterTo.messages())
addTxs(filterFrom.messages())
}
function addTxs(messages) {
@ -167,7 +171,12 @@ Rectangle {
for(var i = 0; i < messages.length; i++) {
var message = messages.get(i);
var to = eth.lookupName(message.to);
var from = eth.lookupName(message.from);
var from;
if(message.from.length == 0) {
from = "- MINED -";
} else {
from = eth.lookupName(message.from);
}
txModel.insert(0, {num: txModel.count, from: from, to: to, value: eth.numberToHuman(message.value)})
}
}

View File

@ -103,7 +103,7 @@ func (self *Gui) DumpState(hash, path string) {
var stateDump []byte
if len(hash) == 0 {
stateDump = self.eth.BlockManager().CurrentState().Dump()
stateDump = self.eth.ChainManager().State().Dump()
} else {
var block *types.Block
if hash[0] == '#' {

View File

@ -141,15 +141,15 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
keyPair = self.lib.eth.KeyManager().KeyPair()
)
statedb := self.lib.eth.BlockManager().TransState()
account := self.lib.eth.BlockManager().TransState().GetAccount(keyPair.Address())
statedb := self.lib.eth.ChainManager().TransState()
account := self.lib.eth.ChainManager().TransState().GetAccount(keyPair.Address())
contract := statedb.NewStateObject([]byte{0})
contract.SetCode(script)
contract.SetBalance(value)
self.SetAsm(script)
block := self.lib.eth.ChainManager().CurrentBlock
block := self.lib.eth.ChainManager().CurrentBlock()
env := utils.NewEnv(statedb, block, account.Address(), value)

View File

@ -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")

View File

@ -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
@ -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()))
if core.MessageCreatesContract(tx) {
rec = nameReg.Storage(core.AddressFromMessage(tx))
}
if send.Len() != 0 {
@ -322,10 +322,10 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
if rec.Len() != 0 {
r = strings.Trim(rec.Str(), "\x00")
} else {
if tx.CreatesContract() {
r = ethutil.Bytes2Hex(tx.CreationAddress(pipe.World().State()))
if core.MessageCreatesContract(tx) {
r = ethutil.Bytes2Hex(core.AddressFromMessage(tx))
} else {
r = ethutil.Bytes2Hex(tx.Recipient)
r = ethutil.Bytes2Hex(tx.To())
}
}
ptx.Sender = s
@ -389,7 +389,6 @@ func (gui *Gui) update() {
gui.loadAddressBook()
gui.loadMergedMiningOptions()
gui.setPeerInfo()
//gui.readPreviousTransactions()
}()
for _, plugin := range gui.plugins {
@ -402,9 +401,8 @@ func (gui *Gui) update() {
generalUpdateTicker := time.NewTicker(500 * time.Millisecond)
statsUpdateTicker := time.NewTicker(5 * time.Second)
state := gui.eth.BlockManager().TransState()
state := gui.eth.ChainManager().TransState()
unconfirmedFunds := new(big.Int)
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance())))
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
@ -418,9 +416,6 @@ func (gui *Gui) update() {
core.TxPostEvent{},
)
// nameReg := gui.pipe.World().Config().Get("NameReg")
// mux.Subscribe("object:"+string(nameReg.Address()), objectChan)
go func() {
defer events.Unsubscribe()
for {
@ -433,20 +428,20 @@ func (gui *Gui) update() {
case core.NewBlockEvent:
gui.processBlock(ev.Block, false)
if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 {
gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil)
gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil)
}
case core.TxPreEvent:
tx := ev.Tx
object := state.GetAccount(gui.address())
if bytes.Compare(tx.Sender(), gui.address()) == 0 {
unconfirmedFunds.Sub(unconfirmedFunds, tx.Value)
} else if bytes.Compare(tx.Recipient, gui.address()) == 0 {
unconfirmedFunds.Add(unconfirmedFunds, tx.Value)
}
tstate := gui.eth.ChainManager().TransState()
cstate := gui.eth.ChainManager().State()
gui.setWalletValue(object.Balance(), unconfirmedFunds)
taccount := tstate.GetAccount(gui.address())
caccount := cstate.GetAccount(gui.address())
unconfirmedFunds := new(big.Int).Sub(taccount.Balance(), caccount.Balance())
gui.setWalletValue(taccount.Balance(), unconfirmedFunds)
gui.insertTransaction("pre", tx)
case core.TxPostEvent:
@ -454,40 +449,26 @@ 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.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "send")
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.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "recv")
gui.txDb.Put(tx.Hash(), tx.RlpEncode())
}
gui.setWalletValue(object.Balance(), nil)
state.UpdateStateObject(object)
// case object:
// gui.loadAddressBook()
case eth.PeerListEvent:
gui.setPeerInfo()
/*
case miner.Event:
if ev.Type == miner.Started {
gui.miner = ev.Miner
} else {
gui.miner = nil
}
*/
}
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")

View File

@ -31,7 +31,7 @@ import (
const (
ClientIdentifier = "Mist"
Version = "0.7.7"
Version = "0.7.10"
)
var ethereum *eth.Ethereum

View File

@ -200,7 +200,7 @@ func (ui *UiLib) AssetPath(p string) string {
func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
dbWindow := NewDebuggerWindow(self)
object := self.eth.BlockManager().CurrentState().GetStateObject(ethutil.Hex2Bytes(contractHash))
object := self.eth.ChainManager().State().GetStateObject(ethutil.Hex2Bytes(contractHash))
if len(object.Code) > 0 {
dbWindow.SetCode("0x" + ethutil.Bytes2Hex(object.Code))
}

40
cmd/peerserver/main.go Normal file
View File

@ -0,0 +1,40 @@
package main
import (
"crypto/elliptic"
"fmt"
"log"
"net"
"os"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
)
func main() {
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel))
key, _ := crypto.GenerateKey()
marshaled := elliptic.Marshal(crypto.S256(), key.PublicKey.X, key.PublicKey.Y)
srv := p2p.Server{
MaxPeers: 10,
Identity: p2p.NewSimpleClientIdentity("Ethereum(G)", "0.1", "Peer Server Two", string(marshaled)),
ListenAddr: ":30301",
NAT: p2p.UPNP(),
}
if err := srv.Start(); err != nil {
fmt.Println("could not start server:", err)
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 {}
}

View File

@ -145,7 +145,6 @@ func NewDatabase() ethutil.Database {
}
func NewClientIdentity(clientIdentifier, version, customIdentifier string) *wire.SimpleClientIdentity {
clilogger.Infoln("identity created")
return wire.NewSimpleClientIdentity(clientIdentifier, version, customIdentifier)
}
@ -240,6 +239,7 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre
exit(err)
}
}
clilogger.Infof("Main address %x\n", keyManager.Address())
}
func StartRpc(ethereum *eth.Ethereum, RpcPort int) {

View File

@ -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) {

View File

@ -14,6 +14,8 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"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"
)
@ -55,17 +57,9 @@ type BlockManager struct {
// non-persistent key/value memory storage
mem map[string]*big.Int
// Proof of work used for validating
Pow PoW
// The ethereum manager interface
eth EthManager
// The managed states
// Transiently state. The trans state isn't ever saved, validated and
// it could be used for setting account nonces without effecting
// the main states.
transState *state.StateDB
// Mining state. The mining state is used purely and solely by the mining
// operation.
miningState *state.StateDB
Pow pow.PoW
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
@ -73,57 +67,28 @@ type BlockManager struct {
lastAttemptedBlock *types.Block
events event.Subscription
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: &EasyPow{},
eth: ethereum,
bc: ethereum.ChainManager(),
mem: make(map[string]*big.Int),
Pow: ezp.New(),
bc: chainManager,
eventMux: eventMux,
txpool: txpool,
}
sm.transState = ethereum.ChainManager().CurrentBlock.State().Copy()
sm.miningState = ethereum.ChainManager().CurrentBlock.State().Copy()
return sm
}
func (self *BlockManager) Start() {
statelogger.Debugln("Starting block manager")
}
func (self *BlockManager) Stop() {
statelogger.Debugln("Stopping state manager")
}
func (sm *BlockManager) CurrentState() *state.StateDB {
return sm.eth.ChainManager().CurrentBlock.State()
}
func (sm *BlockManager) TransState() *state.StateDB {
return sm.transState
}
func (sm *BlockManager) MiningState() *state.StateDB {
return sm.miningState
}
func (sm *BlockManager) NewMiningState() *state.StateDB {
sm.miningState = sm.eth.ChainManager().CurrentBlock.State().Copy()
return sm.miningState
}
func (sm *BlockManager) ChainManager() *ChainManager {
return sm.bc
}
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))
// Process the transactions on to current block
receipts, _, _, _, err = sm.ProcessTransactions(coinbase, statedb, block, parent, block.Transactions())
receipts, _, _, _, err = sm.ApplyTransactions(coinbase, statedb, block, block.Transactions(), false)
if err != nil {
return nil, err
}
@ -131,7 +96,7 @@ func (sm *BlockManager) TransitionState(statedb *state.StateDB, parent, block *t
return receipts, nil
}
func (self *BlockManager) ProcessTransactions(coinbase *state.StateObject, state *state.StateDB, block, parent *types.Block, txs types.Transactions) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error) {
func (self *BlockManager) ApplyTransactions(coinbase *state.StateObject, state *state.StateDB, block *types.Block, txs types.Transactions, transientProcess bool) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error) {
var (
receipts types.Receipts
handled, unhandled types.Transactions
@ -146,11 +111,11 @@ 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)
err = st.TransitionState()
_, err = st.TransitionState()
if err != nil {
switch {
case IsNonceErr(err):
@ -164,12 +129,11 @@ done:
statelogger.Infoln(err)
erroneous = append(erroneous, tx)
err = nil
continue
}
}
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)
@ -178,9 +142,12 @@ done:
receipt := types.NewReceipt(state.Root(), cumulative)
receipt.SetLogs(state.Logs())
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
chainlogger.Debugln(receipt)
// Notify all subscribers
go self.eth.EventMux().Post(TxPostEvent{tx})
if !transientProcess {
go self.eventMux.Post(TxPostEvent{tx})
}
receipts = append(receipts, receipt)
handled = append(handled, tx)
@ -229,38 +196,35 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I
return
}
_, err = sm.TransitionState(state, parent, block)
receipts, err := sm.TransitionState(state, parent, block)
if err != nil {
return
}
rbloom := types.CreateBloom(receipts)
if bytes.Compare(rbloom, block.LogsBloom) != 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)
return
}
/*
receiptSha := types.DeriveSha(receipts)
if bytes.Compare(receiptSha, block.ReceiptSha) != 0 {
err = fmt.Errorf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha)
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)
return
}
if err = sm.AccumelateRewards(state, block, parent); err != nil {
return
}
/*
//block.receipts = receipts // although this isn't necessary it be in the future
rbloom := types.CreateBloom(receipts)
if bytes.Compare(rbloom, block.LogsBloom) != 0 {
err = fmt.Errorf("unable to replicate block's bloom=%x", rbloom)
return
}
*/
state.Update(ethutil.Big0)
if !block.State().Cmp(state) {
@ -278,9 +242,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.transState = state.Copy()
sm.eth.TxPool().RemoveSet(block.Transactions())
sm.txpool.RemoveSet(block.Transactions())
return td, messages, nil
} else {
@ -296,12 +258,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
}
@ -319,7 +281,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
@ -330,7 +292,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.HashNoNonce(), block.Difficulty, block.Nonce) {
if !sm.Pow.Verify(block /*block.HashNoNonce(), block.Difficulty, block.Nonce*/) {
return ValidationError("Block's nonce is invalid (= %v)", ethutil.Bytes2Hex(block.Nonce))
}
@ -378,7 +340,7 @@ func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent
account.AddAmount(reward)
statedb.Manifest().AddMessage(&state.Message{
To: block.Coinbase, From: block.Coinbase,
To: block.Coinbase,
Input: nil,
Origin: nil,
Block: block.Hash(), Timestamp: block.Time, Coinbase: block.Coinbase, Number: block.Number,

View File

@ -3,11 +3,13 @@ package core
import (
"fmt"
"math/big"
"sync"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
)
var chainlogger = logger.NewLogger("CHAIN")
@ -49,12 +51,41 @@ 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()
return self.td
}
func (self *ChainManager) LastBlockNumber() uint64 {
self.mu.RLock()
defer self.mu.RUnlock()
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()
return self.currentBlock
}
func NewChainManager(mux *event.TypeMux) *ChainManager {
@ -64,6 +95,8 @@ func NewChainManager(mux *event.TypeMux) *ChainManager {
bc.setLastBlock()
bc.transState = bc.State().Copy()
return bc
}
@ -71,6 +104,14 @@ func (self *ChainManager) SetProcessor(proc types.BlockProcessor) {
self.processor = proc
}
func (self *ChainManager) State() *state.StateDB {
return self.CurrentBlock().State()
}
func (self *ChainManager) TransState() *state.StateDB {
return self.transState
}
func (bc *ChainManager) setLastBlock() {
data, _ := ethutil.Config.Db.Get([]byte("LastBlock"))
if len(data) != 0 {
@ -78,27 +119,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(
@ -109,11 +153,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)
}
@ -121,31 +165,49 @@ 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.add(bc.genesisBlock)
bc.CurrentBlock = bc.genesisBlock
bc.write(bc.genesisBlock)
bc.insert(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())
}
// Add a block to the chain and record addition information
func (bc *ChainManager) add(block *types.Block) {
bc.writeBlockInfo(block)
func (self *ChainManager) Export() []byte {
self.mu.RLock()
defer self.mu.RUnlock()
bc.CurrentBlock = block
bc.LastBlockHash = block.Hash()
chainlogger.Infof("exporting %v blocks...\n", self.currentBlock.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
}
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()
}
func (bc *ChainManager) write(block *types.Block) {
bc.writeBlockInfo(block)
encodedBlock := block.RlpEncode()
ethutil.Config.Db.Put(block.Hash(), encodedBlock)
ethutil.Config.Db.Put([]byte("LastBlock"), encodedBlock)
//chainlogger.Infof("Imported block #%d (%x...)\n", block.Number, block.Hash()[0:4])
}
// Accessors
@ -167,7 +229,6 @@ func (self *ChainManager) GetChainHashesFromHash(hash []byte, max uint64) (chain
// XXX Could be optimised by using a different database which only holds hashes (i.e., linked list)
for i := uint64(0); i < max; i++ {
chain = append(chain, block.Hash())
if block.Number.Cmp(ethutil.Big0) <= 0 {
@ -190,7 +251,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
@ -204,9 +268,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) {
@ -239,8 +303,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())
@ -266,8 +330,23 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
return err
}
self.add(block)
self.SetTotalDifficulty(td)
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.mu.Unlock()
self.eventMux.Post(NewBlockEvent{block})
self.eventMux.Post(messages)
}

View File

@ -2,115 +2,76 @@ package core
import (
"fmt"
"math/big"
"path"
"runtime"
"testing"
"time"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/event"
//logpkg "github.com/ethereum/go-ethereum/logger"
)
var TD *big.Int
//var Logger logpkg.LogSystem
//var Log = logpkg.NewLogger("TEST")
func init() {
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
ethutil.Config.Db, _ = ethdb.NewMemDatabase()
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
}
type fakeproc struct {
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()
}
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 (self fakeproc) ProcessWithParent(a, b *types.Block) (*big.Int, state.Messages, error) {
TD = new(big.Int).Add(TD, big.NewInt(1))
return TD, nil, nil
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 makechain(cman *ChainManager, max int) *BlockChain {
blocks := make(types.Blocks, max)
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++ {
addr := ethutil.LeftPadBytes([]byte{byte(i)}, 20)
block := cman.NewBlock(addr)
if i != 0 {
cman.CurrentBlock = blocks[i-1]
}
blocks[i] = block
<-done
}
return NewChain(blocks)
}
func TestLongerFork(t *testing.T) {
cman := NewChainManager()
cman.SetProcessor(fakeproc{})
TD = big.NewInt(1)
chainA := makechain(cman, 5)
TD = big.NewInt(1)
chainB := makechain(cman, 10)
td, err := cman.TestChain(chainA)
if err != nil {
t.Error("unable to create new TD from chainA:", err)
}
cman.TD = td
_, err = cman.TestChain(chainB)
if err != nil {
t.Error("expected chainB not to give errors:", err)
}
}
func TestEqualFork(t *testing.T) {
cman := NewChainManager()
cman.SetProcessor(fakeproc{})
TD = big.NewInt(1)
chainA := makechain(cman, 5)
TD = big.NewInt(2)
chainB := makechain(cman, 5)
td, err := cman.TestChain(chainA)
if err != nil {
t.Error("unable to create new TD from chainA:", err)
}
cman.TD = td
_, err = cman.TestChain(chainB)
if err != nil {
t.Error("expected chainB not to give errors:", err)
}
}
func TestBrokenChain(t *testing.T) {
cman := NewChainManager()
cman.SetProcessor(fakeproc{})
TD = big.NewInt(1)
chain := makechain(cman, 5)
chain.Remove(chain.Front())
_, err := cman.TestChain(chain)
if err == nil {
t.Error("expected broken chain to return error")
}
}
func BenchmarkChainTesting(b *testing.B) {
const chainlen = 1000
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
ethutil.Config.Db, _ = ethdb.NewMemDatabase()
cman := NewChainManager()
cman.SetProcessor(fakeproc{})
TD = big.NewInt(1)
chain := makechain(cman, chainlen)
stime := time.Now()
cman.TestChain(chain)
fmt.Println(chainlen, "took", time.Since(stime))
fmt.Println(chainMan.CurrentBlock())
}

View File

@ -6,8 +6,6 @@ import (
"math/rand"
"time"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/obscuren/sha3"
@ -15,89 +13,6 @@ import (
var powlogger = logger.NewLogger("POW")
type PoW interface {
Search(block *types.Block, stop <-chan struct{}) []byte
Verify(hash []byte, diff *big.Int, nonce []byte) bool
GetHashrate() int64
Turbo(bool)
}
type EasyPow struct {
hash *big.Int
HashRate int64
turbo bool
}
func (pow *EasyPow) GetHashrate() int64 {
return pow.HashRate
}
func (pow *EasyPow) Turbo(on bool) {
pow.turbo = on
}
func (pow *EasyPow) Search(block *types.Block, stop <-chan struct{}) []byte {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
hash := block.HashNoNonce()
diff := block.Difficulty
i := int64(0)
start := time.Now().UnixNano()
t := time.Now()
for {
select {
case <-stop:
powlogger.Infoln("Breaking from mining")
pow.HashRate = 0
return nil
default:
i++
if time.Since(t) > (1 * time.Second) {
elapsed := time.Now().UnixNano() - start
hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000
pow.HashRate = int64(hashes)
powlogger.Infoln("Hashing @", pow.HashRate, "khash")
t = time.Now()
}
sha := crypto.Sha3(big.NewInt(r.Int63()).Bytes())
if pow.Verify(hash, diff, sha) {
return sha
}
}
if !pow.turbo {
time.Sleep(20 * time.Microsecond)
}
}
return nil
}
func (pow *EasyPow) Verify(hash []byte, diff *big.Int, nonce []byte) bool {
sha := sha3.NewKeccak256()
d := append(hash, nonce...)
sha.Write(d)
verification := new(big.Int).Div(ethutil.BigPow(2, 256), diff)
res := ethutil.U256(ethutil.BigD(sha.Sum(nil)))
/*
fmt.Printf("hash w/o nonce %x\n", hash)
fmt.Printf("2**256 / %v = %v\n", diff, verification)
fmt.Printf("%v <= %v\n", res, verification)
fmt.Printf("vlen: %d rlen: %d\n", len(verification.Bytes()), len(res.Bytes()))
*/
return res.Cmp(verification) <= 0
}
func (pow *EasyPow) SetHash(hash *big.Int) {
}
type Dagger struct {
hash *big.Int
xn *big.Int

View File

@ -3,22 +3,21 @@ package core
import (
"fmt"
"math/big"
"time"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
type Execution struct {
vm vm.VirtualMachine
env vm.Environment
address, input []byte
Gas, price, value *big.Int
object *state.StateObject
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 {
return &Execution{env: env, address: address, input: input, Gas: gas, price: gasPrice, value: value}
}
func (self *Execution) Addr() []byte {
@ -27,54 +26,46 @@ 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, caddr []byte, caller vm.ClosureRef) (ret []byte, err error) {
env := self.vm.Env()
func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret []byte, err error) {
env := self.env
evm := vm.New(env, vm.DebugVmTy)
chainlogger.Debugf("pre state %x\n", env.State().Root())
snapshot := env.State().Copy()
defer func() {
if vm.IsDepthErr(err) || vm.IsOOGErr(err) {
env.State().Set(snapshot)
}
chainlogger.Debugf("post 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{}
}
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 {
err = env.Transfer(from, to, self.value)
}
if err != nil {
caller.ReturnGas(self.Gas, self.price)
if err != nil {
caller.ReturnGas(self.Gas, self.price)
err = fmt.Errorf("Insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance)
} else {
self.object = to
// Pre-compiled contracts (address.go) 1, 2 & 3.
naddr := ethutil.BigD(caddr).Uint64()
if p := vm.Precompiled[naddr]; p != nil {
if self.Gas.Cmp(p.Gas) >= 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)
err = fmt.Errorf("Insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance)
return
}
}
snapshot := env.State().Copy()
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
}
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
}

View File

@ -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 (

View File

@ -1,7 +1 @@
package core
// import "testing"
// func TestFilter(t *testing.T) {
// NewFilter(NewTestManager())
// }

1
core/simple_pow.go Normal file
View File

@ -0,0 +1 @@
package core

View File

@ -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,48 +29,69 @@ import (
*/
type StateTransition struct {
coinbase, receiver []byte
tx *types.Transaction
msg Message
gas, gasPrice *big.Int
initialGas *big.Int
value *big.Int
data []byte
state *state.StateDB
block *types.Block
cb, rec, sen *state.StateObject
Env vm.Environment
}
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}
type Message interface {
Hash() []byte
From() []byte
To() []byte
GasPrice() *big.Int
Gas() *big.Int
Value() *big.Int
Nonce() uint64
Data() []byte
}
func AddressFromMessage(msg Message) []byte {
// Generate a new address
return crypto.Sha3(ethutil.NewValue([]interface{}{msg.From(), msg.Nonce()}).Encode())[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()), new(big.Int), 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 {
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) Sender() *state.StateObject {
if self.sen != nil {
return self.sen
}
self.sen = self.state.GetOrNewStateObject(self.tx.Sender())
return self.sen
func (self *StateTransition) From() *state.StateObject {
return self.state.GetOrNewStateObject(self.msg.From())
}
func (self *StateTransition) Receiver() *state.StateObject {
if self.tx != nil && self.tx.CreatesContract() {
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.tx.Recipient)
return self.rec
return self.state.GetOrNewStateObject(self.msg.To())
}
func (self *StateTransition) UseGas(amount *big.Int) error {
@ -87,41 +110,33 @@ 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(MessageGasValue(self.msg)) < 0 {
return fmt.Errorf("insufficient ETH for gas (%x). Req %v, has %v", sender.Address()[:4], MessageGasValue(self.msg), 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())
self.initialGas.Set(self.msg.Gas())
sender.SubAmount(MessageGasValue(self.msg))
return nil
}
func (self *StateTransition) RefundGas() {
coinbase, sender := self.Coinbase(), self.Sender()
coinbase.RefundGas(self.gas, self.tx.GasPrice)
// Return remaining gas
remaining := new(big.Int).Mul(self.gas, self.tx.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
@ -132,8 +147,8 @@ func (self *StateTransition) preCheck() (err error) {
return nil
}
func (self *StateTransition) TransitionState() (err error) {
statelogger.Debugf("(~) %x\n", self.tx.Hash())
func (self *StateTransition) TransitionState() (ret []byte, err error) {
statelogger.Debugf("(~) %x\n", self.msg.Hash())
// XXX Transactions after this point are considered valid.
if err = self.preCheck(); err != nil {
@ -141,8 +156,8 @@ func (self *StateTransition) TransitionState() (err error) {
}
var (
tx = self.tx
sender = self.Sender()
msg = self.msg
sender = self.From()
)
defer self.RefundGas()
@ -168,30 +183,56 @@ func (self *StateTransition) TransitionState() (err error) {
return
}
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)
ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.tx.Data, self.gas, self.gasPrice, self.value)
ref.SetCode(ret)
if MessageCreatesContract(msg) {
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)
}
}
} 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)
self.UseGas(self.gas)
}
return
}
// 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
}
func (self *StateTransition) RefundGas() {
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)
self.gas.Add(self.gas, refund)
self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice()))
}
coinbase.RefundGas(self.gas, self.msg.GasPrice())
}
func (self *StateTransition) GasUsed() *big.Int {
return new(big.Int).Sub(self.initialGas, self.gas)
}

View File

@ -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,20 +100,20 @@ 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")
}
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()
@ -115,24 +121,14 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
return fmt.Errorf("tx.v != (28 || 27)")
}
if tx.GasPrice.Cmp(MinGasPrice) < 0 {
return fmt.Errorf("Gas price to low. Require %v > Got %v", MinGasPrice, tx.GasPrice)
}
// Get the sender
sender := pool.Ethereum.BlockManager().CurrentState().GetAccount(tx.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())
}
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)
}
return fmt.Errorf("Insufficient amount in sender's (%x) account", tx.From())
}
// Increment the nonce making each tx valid only once to prevent replay
@ -158,17 +154,18 @@ 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
self.Ethereum.EventMux().Post(TxPreEvent{tx})
go self.eventMux.Post(TxPreEvent{tx})
return nil
}
func (self *TxPool) Size() int {
return self.pool.Len()
}
func (pool *TxPool) CurrentTransactions() []*types.Transaction {
pool.mutex.Lock()
defer pool.mutex.Unlock()
@ -194,7 +191,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)
}
}

View File

@ -409,5 +409,8 @@ 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
func (self *Block) N() []byte { return self.Nonce }

View File

@ -20,18 +20,16 @@ func CreateBloom(receipts Receipts) []byte {
func LogsBloom(logs state.Logs) *big.Int {
bin := new(big.Int)
for _, log := range logs {
data := [][]byte{log.Address()}
for _, topic := range log.Topics() {
data = append(data, topic)
data := make([][]byte, len(log.Topics())+1)
data[0] = log.Address()
for i, topic := range log.Topics() {
data[i+1] = topic
}
for _, b := range data {
bin.Or(bin, ethutil.BigD(bloom9(crypto.Sha3(b)).Bytes()))
}
//if log.Data != nil {
// data = append(data, log.Data)
//}
}
return bin

View File

@ -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{})
}

View File

@ -64,5 +64,18 @@ func (self *Receipt) String() string {
type Receipts []*Receipt
func (self Receipts) RlpData() interface{} {
data := make([]interface{}, len(self))
for i, receipt := range self {
data[i] = receipt.RlpData()
}
return data
}
func (self Receipts) RlpEncode() []byte {
return ethutil.Encode(self.RlpData())
}
func (self Receipts) Len() int { return len(self) }
func (self Receipts) GetRlp(i int) []byte { return ethutil.Rlp(self[i]) }

View File

@ -6,37 +6,30 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"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 {
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
// 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 {
@ -53,33 +46,42 @@ 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}
data := []interface{}{tx.nonce, tx.gasPrice, tx.gas, tx.recipient, tx.value, tx.data}
return crypto.Sha3(ethutil.NewValue(data).Encode())
}
func (tx *Transaction) CreatesContract() bool {
return tx.contractCreation
func (self *Transaction) Data() []byte {
return self.data
}
/* Deprecated */
func (tx *Transaction) IsContract() bool {
return tx.CreatesContract()
func (self *Transaction) Gas() *big.Int {
return self.gas
}
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 (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) Curve() (v byte, r []byte, s []byte) {
@ -106,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
}
@ -136,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())
}
@ -156,20 +156,16 @@ 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) {
tx.contractCreation = true
}
}
func (tx *Transaction) String() string {
@ -186,19 +182,22 @@ func (tx *Transaction) String() string {
V: 0x%x
R: 0x%x
S: 0x%x
Hex: %x
`,
tx.Hash(),
len(tx.Recipient) == 0,
len(tx.recipient) == 0,
tx.Sender(),
tx.Recipient,
tx.Nonce,
tx.GasPrice,
tx.Gas,
tx.Value,
tx.Data,
tx.recipient,
tx.nonce,
tx.gasPrice,
tx.gas,
tx.value,
tx.data,
tx.v,
tx.r,
tx.s)
tx.s,
ethutil.Encode(tx),
)
}
// Transaction slice type for basic sorting
@ -221,5 +220,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
}

View File

@ -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 }
@ -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) {

View File

@ -1,15 +1,23 @@
package crypto
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/sha256"
"code.google.com/p/go.crypto/ripemd160"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/obscuren/ecies"
"github.com/obscuren/secp256k1-go"
"github.com/obscuren/sha3"
)
// TODO refactor, remove (bin)
func init() {
// specify the params for the s256 curve
ecies.AddParamsForCurve(S256(), ecies.ECIES_AES128_SHA256)
}
func Sha3(data []byte) []byte {
d := sha3.NewKeccak256()
d.Write(data)
@ -45,3 +53,63 @@ func Ecrecover(data []byte) []byte {
return r
}
// New methods using proper ecdsa keys from the stdlib
func ToECDSA(prv []byte) *ecdsa.PrivateKey {
if len(prv) == 0 {
return nil
}
priv := new(ecdsa.PrivateKey)
priv.PublicKey.Curve = S256()
priv.D = ethutil.BigD(prv)
priv.PublicKey.X, priv.PublicKey.Y = S256().ScalarBaseMult(prv)
return priv
}
func FromECDSA(prv *ecdsa.PrivateKey) []byte {
if prv == nil {
return nil
}
return prv.D.Bytes()
}
func ToECDSAPub(pub []byte) *ecdsa.PublicKey {
if len(pub) == 0 {
return nil
}
x, y := elliptic.Unmarshal(S256(), pub)
return &ecdsa.PublicKey{S256(), x, y}
}
func FromECDSAPub(pub *ecdsa.PublicKey) []byte {
if pub == nil {
return nil
}
return elliptic.Marshal(S256(), pub.X, pub.Y)
}
func GenerateKey() (*ecdsa.PrivateKey, error) {
return ecdsa.GenerateKey(S256(), rand.Reader)
}
func SigToPub(hash, sig []byte) *ecdsa.PublicKey {
s := Ecrecover(append(hash, sig...))
x, y := elliptic.Unmarshal(S256(), s)
return &ecdsa.PublicKey{S256(), x, y}
}
func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error) {
sig, err = secp256k1.Sign(hash, prv.D.Bytes())
return
}
func Encrypt(pub *ecdsa.PublicKey, message []byte) ([]byte, error) {
return ecies.Encrypt(rand.Reader, ecies.ImportECDSAPublic(pub), message, nil, nil)
}
func Decrypt(prv *ecdsa.PrivateKey, ct []byte) ([]byte, error) {
key := ecies.ImportECDSA(prv)
return key.Decrypt(rand.Reader, ct, nil, nil)
}

363
crypto/curve.go Normal file
View File

@ -0,0 +1,363 @@
package crypto
// Copyright 2010 The Go Authors. All rights reserved.
// Copyright 2011 ThePiachu. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package bitelliptic implements several Koblitz elliptic curves over prime
// fields.
// This package operates, internally, on Jacobian coordinates. For a given
// (x, y) position on the curve, the Jacobian coordinates are (x1, y1, z1)
// where x = x1/z1² and y = y1/z1³. The greatest speedups come when the whole
// calculation can be performed within the transform (as in ScalarMult and
// ScalarBaseMult). But even for Add and Double, it's faster to apply and
// reverse the transform than to operate in affine coordinates.
import (
"crypto/elliptic"
"io"
"math/big"
"sync"
)
// A BitCurve represents a Koblitz Curve with a=0.
// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
type BitCurve struct {
P *big.Int // the order of the underlying field
N *big.Int // the order of the base point
B *big.Int // the constant of the BitCurve equation
Gx, Gy *big.Int // (x,y) of the base point
BitSize int // the size of the underlying field
}
func (BitCurve *BitCurve) Params() *elliptic.CurveParams {
return &elliptic.CurveParams{BitCurve.P, BitCurve.N, BitCurve.B, BitCurve.Gx, BitCurve.Gy, BitCurve.BitSize}
}
// IsOnBitCurve returns true if the given (x,y) lies on the BitCurve.
func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool {
// y² = x³ + b
y2 := new(big.Int).Mul(y, y) //y²
y2.Mod(y2, BitCurve.P) //y²%P
x3 := new(big.Int).Mul(x, x) //x²
x3.Mul(x3, x) //x³
x3.Add(x3, BitCurve.B) //x³+B
x3.Mod(x3, BitCurve.P) //(x³+B)%P
return x3.Cmp(y2) == 0
}
//TODO: double check if the function is okay
// affineFromJacobian reverses the Jacobian transform. See the comment at the
// top of the file.
func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) {
zinv := new(big.Int).ModInverse(z, BitCurve.P)
zinvsq := new(big.Int).Mul(zinv, zinv)
xOut = new(big.Int).Mul(x, zinvsq)
xOut.Mod(xOut, BitCurve.P)
zinvsq.Mul(zinvsq, zinv)
yOut = new(big.Int).Mul(y, zinvsq)
yOut.Mod(yOut, BitCurve.P)
return
}
// Add returns the sum of (x1,y1) and (x2,y2)
func (BitCurve *BitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
z := new(big.Int).SetInt64(1)
return BitCurve.affineFromJacobian(BitCurve.addJacobian(x1, y1, z, x2, y2, z))
}
// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and
// (x2, y2, z2) and returns their sum, also in Jacobian form.
func (BitCurve *BitCurve) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) {
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
z1z1 := new(big.Int).Mul(z1, z1)
z1z1.Mod(z1z1, BitCurve.P)
z2z2 := new(big.Int).Mul(z2, z2)
z2z2.Mod(z2z2, BitCurve.P)
u1 := new(big.Int).Mul(x1, z2z2)
u1.Mod(u1, BitCurve.P)
u2 := new(big.Int).Mul(x2, z1z1)
u2.Mod(u2, BitCurve.P)
h := new(big.Int).Sub(u2, u1)
if h.Sign() == -1 {
h.Add(h, BitCurve.P)
}
i := new(big.Int).Lsh(h, 1)
i.Mul(i, i)
j := new(big.Int).Mul(h, i)
s1 := new(big.Int).Mul(y1, z2)
s1.Mul(s1, z2z2)
s1.Mod(s1, BitCurve.P)
s2 := new(big.Int).Mul(y2, z1)
s2.Mul(s2, z1z1)
s2.Mod(s2, BitCurve.P)
r := new(big.Int).Sub(s2, s1)
if r.Sign() == -1 {
r.Add(r, BitCurve.P)
}
r.Lsh(r, 1)
v := new(big.Int).Mul(u1, i)
x3 := new(big.Int).Set(r)
x3.Mul(x3, x3)
x3.Sub(x3, j)
x3.Sub(x3, v)
x3.Sub(x3, v)
x3.Mod(x3, BitCurve.P)
y3 := new(big.Int).Set(r)
v.Sub(v, x3)
y3.Mul(y3, v)
s1.Mul(s1, j)
s1.Lsh(s1, 1)
y3.Sub(y3, s1)
y3.Mod(y3, BitCurve.P)
z3 := new(big.Int).Add(z1, z2)
z3.Mul(z3, z3)
z3.Sub(z3, z1z1)
if z3.Sign() == -1 {
z3.Add(z3, BitCurve.P)
}
z3.Sub(z3, z2z2)
if z3.Sign() == -1 {
z3.Add(z3, BitCurve.P)
}
z3.Mul(z3, h)
z3.Mod(z3, BitCurve.P)
return x3, y3, z3
}
// Double returns 2*(x,y)
func (BitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
z1 := new(big.Int).SetInt64(1)
return BitCurve.affineFromJacobian(BitCurve.doubleJacobian(x1, y1, z1))
}
// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and
// returns its double, also in Jacobian form.
func (BitCurve *BitCurve) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) {
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
a := new(big.Int).Mul(x, x) //X1²
b := new(big.Int).Mul(y, y) //Y1²
c := new(big.Int).Mul(b, b) //B²
d := new(big.Int).Add(x, b) //X1+B
d.Mul(d, d) //(X1+B)²
d.Sub(d, a) //(X1+B)²-A
d.Sub(d, c) //(X1+B)²-A-C
d.Mul(d, big.NewInt(2)) //2*((X1+B)²-A-C)
e := new(big.Int).Mul(big.NewInt(3), a) //3*A
f := new(big.Int).Mul(e, e) //E²
x3 := new(big.Int).Mul(big.NewInt(2), d) //2*D
x3.Sub(f, x3) //F-2*D
x3.Mod(x3, BitCurve.P)
y3 := new(big.Int).Sub(d, x3) //D-X3
y3.Mul(e, y3) //E*(D-X3)
y3.Sub(y3, new(big.Int).Mul(big.NewInt(8), c)) //E*(D-X3)-8*C
y3.Mod(y3, BitCurve.P)
z3 := new(big.Int).Mul(y, z) //Y1*Z1
z3.Mul(big.NewInt(2), z3) //3*Y1*Z1
z3.Mod(z3, BitCurve.P)
return x3, y3, z3
}
//TODO: double check if it is okay
// ScalarMult returns k*(Bx,By) where k is a number in big-endian form.
func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) {
// We have a slight problem in that the identity of the group (the
// point at infinity) cannot be represented in (x, y) form on a finite
// machine. Thus the standard add/double algorithm has to be tweaked
// slightly: our initial state is not the identity, but x, and we
// ignore the first true bit in |k|. If we don't find any true bits in
// |k|, then we return nil, nil, because we cannot return the identity
// element.
Bz := new(big.Int).SetInt64(1)
x := Bx
y := By
z := Bz
seenFirstTrue := false
for _, byte := range k {
for bitNum := 0; bitNum < 8; bitNum++ {
if seenFirstTrue {
x, y, z = BitCurve.doubleJacobian(x, y, z)
}
if byte&0x80 == 0x80 {
if !seenFirstTrue {
seenFirstTrue = true
} else {
x, y, z = BitCurve.addJacobian(Bx, By, Bz, x, y, z)
}
}
byte <<= 1
}
}
if !seenFirstTrue {
return nil, nil
}
return BitCurve.affineFromJacobian(x, y, z)
}
// ScalarBaseMult returns k*G, where G is the base point of the group and k is
// an integer in big-endian form.
func (BitCurve *BitCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) {
return BitCurve.ScalarMult(BitCurve.Gx, BitCurve.Gy, k)
}
var mask = []byte{0xff, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f}
//TODO: double check if it is okay
// GenerateKey returns a public/private key pair. The private key is generated
// using the given reader, which must return random data.
func (BitCurve *BitCurve) GenerateKey(rand io.Reader) (priv []byte, x, y *big.Int, err error) {
byteLen := (BitCurve.BitSize + 7) >> 3
priv = make([]byte, byteLen)
for x == nil {
_, err = io.ReadFull(rand, priv)
if err != nil {
return
}
// We have to mask off any excess bits in the case that the size of the
// underlying field is not a whole number of bytes.
priv[0] &= mask[BitCurve.BitSize%8]
// This is because, in tests, rand will return all zeros and we don't
// want to get the point at infinity and loop forever.
priv[1] ^= 0x42
x, y = BitCurve.ScalarBaseMult(priv)
}
return
}
// Marshal converts a point into the form specified in section 4.3.6 of ANSI
// X9.62.
func (BitCurve *BitCurve) Marshal(x, y *big.Int) []byte {
byteLen := (BitCurve.BitSize + 7) >> 3
ret := make([]byte, 1+2*byteLen)
ret[0] = 4 // uncompressed point
xBytes := x.Bytes()
copy(ret[1+byteLen-len(xBytes):], xBytes)
yBytes := y.Bytes()
copy(ret[1+2*byteLen-len(yBytes):], yBytes)
return ret
}
// Unmarshal converts a point, serialised by Marshal, into an x, y pair. On
// error, x = nil.
func (BitCurve *BitCurve) Unmarshal(data []byte) (x, y *big.Int) {
byteLen := (BitCurve.BitSize + 7) >> 3
if len(data) != 1+2*byteLen {
return
}
if data[0] != 4 { // uncompressed form
return
}
x = new(big.Int).SetBytes(data[1 : 1+byteLen])
y = new(big.Int).SetBytes(data[1+byteLen:])
return
}
//curve parameters taken from:
//http://www.secg.org/collateral/sec2_final.pdf
var initonce sync.Once
var ecp160k1 *BitCurve
var ecp192k1 *BitCurve
var ecp224k1 *BitCurve
var ecp256k1 *BitCurve
func initAll() {
initS160()
initS192()
initS224()
initS256()
}
func initS160() {
// See SEC 2 section 2.4.1
ecp160k1 = new(BitCurve)
ecp160k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", 16)
ecp160k1.N, _ = new(big.Int).SetString("0100000000000000000001B8FA16DFAB9ACA16B6B3", 16)
ecp160k1.B, _ = new(big.Int).SetString("0000000000000000000000000000000000000007", 16)
ecp160k1.Gx, _ = new(big.Int).SetString("3B4C382CE37AA192A4019E763036F4F5DD4D7EBB", 16)
ecp160k1.Gy, _ = new(big.Int).SetString("938CF935318FDCED6BC28286531733C3F03C4FEE", 16)
ecp160k1.BitSize = 160
}
func initS192() {
// See SEC 2 section 2.5.1
ecp192k1 = new(BitCurve)
ecp192k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37", 16)
ecp192k1.N, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D", 16)
ecp192k1.B, _ = new(big.Int).SetString("000000000000000000000000000000000000000000000003", 16)
ecp192k1.Gx, _ = new(big.Int).SetString("DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D", 16)
ecp192k1.Gy, _ = new(big.Int).SetString("9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D", 16)
ecp192k1.BitSize = 192
}
func initS224() {
// See SEC 2 section 2.6.1
ecp224k1 = new(BitCurve)
ecp224k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D", 16)
ecp224k1.N, _ = new(big.Int).SetString("010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7", 16)
ecp224k1.B, _ = new(big.Int).SetString("00000000000000000000000000000000000000000000000000000005", 16)
ecp224k1.Gx, _ = new(big.Int).SetString("A1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C", 16)
ecp224k1.Gy, _ = new(big.Int).SetString("7E089FED7FBA344282CAFBD6F7E319F7C0B0BD59E2CA4BDB556D61A5", 16)
ecp224k1.BitSize = 224
}
func initS256() {
// See SEC 2 section 2.7.1
ecp256k1 = new(BitCurve)
ecp256k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16)
ecp256k1.N, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16)
ecp256k1.B, _ = new(big.Int).SetString("0000000000000000000000000000000000000000000000000000000000000007", 16)
ecp256k1.Gx, _ = new(big.Int).SetString("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 16)
ecp256k1.Gy, _ = new(big.Int).SetString("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 16)
ecp256k1.BitSize = 256
}
// S160 returns a BitCurve which implements secp160k1 (see SEC 2 section 2.4.1)
func S160() *BitCurve {
initonce.Do(initAll)
return ecp160k1
}
// S192 returns a BitCurve which implements secp192k1 (see SEC 2 section 2.5.1)
func S192() *BitCurve {
initonce.Do(initAll)
return ecp192k1
}
// S224 returns a BitCurve which implements secp224k1 (see SEC 2 section 2.6.1)
func S224() *BitCurve {
initonce.Do(initAll)
return ecp224k1
}
// S256 returns a BitCurve which implements secp256k1 (see SEC 2 section 2.7.1)
func S256() *BitCurve {
initonce.Do(initAll)
return ecp256k1
}

View File

@ -0,0 +1,40 @@
package crypto
import (
"bytes"
"fmt"
"testing"
"github.com/ethereum/go-ethereum/ethutil"
)
func TestBox(t *testing.T) {
prv1 := ToECDSA(ethutil.Hex2Bytes("4b50fa71f5c3eeb8fdc452224b2395af2fcc3d125e06c32c82e048c0559db03f"))
prv2 := ToECDSA(ethutil.Hex2Bytes("d0b043b4c5d657670778242d82d68a29d25d7d711127d17b8e299f156dad361a"))
pub2 := ToECDSAPub(ethutil.Hex2Bytes("04bd27a63c91fe3233c5777e6d3d7b39204d398c8f92655947eb5a373d46e1688f022a1632d264725cbc7dc43ee1cfebde42fa0a86d08b55d2acfbb5e9b3b48dc5"))
message := []byte("Hello, world.")
ct, err := Encrypt(pub2, message)
if err != nil {
fmt.Println(err.Error())
t.FailNow()
}
pt, err := Decrypt(prv2, ct)
if err != nil {
fmt.Println(err.Error())
t.FailNow()
}
if !bytes.Equal(pt, message) {
fmt.Println("ecies: plaintext doesn't match message")
t.FailNow()
}
_, err = Decrypt(prv1, pt)
if err == nil {
fmt.Println("ecies: encryption should not have succeeded")
t.FailNow()
}
}

View File

@ -5,8 +5,11 @@ import (
"sync"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
)
var keylogger = logger.NewLogger("KEY")
type KeyManager struct {
keyRing *KeyRing
session string
@ -104,6 +107,7 @@ func (k *KeyManager) Init(session string, cursor int, force bool) error {
}
if keyRing == nil {
keyRing = NewGeneratedKeyRing(1)
keylogger.Infof("Created keypair. Private key: %x\n", keyRing.keys[0].PrivateKey)
}
return k.reset(session, cursor, keyRing)
}

View File

@ -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
@ -393,7 +393,6 @@ func (s *Ethereum) reapDeadPeerHandler() {
// Start the ethereum
func (s *Ethereum) Start(seed bool) {
s.blockPool.Start()
s.blockManager.Start()
// Bind to addr and port
ln, err := net.Listen("tcp", ":"+s.Port)
@ -517,7 +516,6 @@ func (s *Ethereum) Stop() {
s.RpcServer.Stop()
}
s.txPool.Stop()
s.blockManager.Stop()
s.blockPool.Stop()
loggerger.Infoln("Server stopped")

View File

@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"math/big"
"reflect"
)
type RlpEncode interface {
@ -97,6 +98,14 @@ var (
zeroRlp = big.NewInt(0x0)
)
func intlen(i int64) (length int) {
for i > 0 {
i = i >> 8
length++
}
return
}
func Encode(object interface{}) []byte {
var buff bytes.Buffer
@ -168,6 +177,31 @@ func Encode(object interface{}) []byte {
}
WriteSliceHeader(len(b.Bytes()))
buff.Write(b.Bytes())
default:
// This is how it should have been from the start
// needs refactoring (@fjl)
v := reflect.ValueOf(t)
switch v.Kind() {
case reflect.Slice:
var b bytes.Buffer
for i := 0; i < v.Len(); i++ {
b.Write(Encode(v.Index(i).Interface()))
}
blen := b.Len()
if blen < 56 {
buff.WriteByte(byte(blen) + 0xc0)
} else {
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)
}
}
} else {
// Empty list for nil

View File

@ -7,6 +7,16 @@ import (
"testing"
)
func TestNonInterfaceSlice(t *testing.T) {
vala := []string{"value1", "value2", "value3"}
valb := []interface{}{"value1", "value2", "value3"}
resa := Encode(vala)
resb := Encode(valb)
if !bytes.Equal(resa, resb) {
t.Errorf("expected []string & []interface{} to be equal")
}
}
func TestRlpValueEncoding(t *testing.T) {
val := EmptyValue()
val.AppendList().Append(1).Append(2).Append(3)

View File

@ -2,47 +2,17 @@
package ethutil
import (
"fmt"
"strings"
"github.com/ethereum/serpent-go"
"github.com/obscuren/mutan"
"github.com/obscuren/mutan/backends"
)
import "github.com/ethereum/serpent-go"
// General compile function
func Compile(script string, silent bool) (ret []byte, err error) {
if len(script) > 2 {
line := strings.Split(script, "\n")[0]
if len(line) > 1 && line[0:2] == "#!" {
switch line {
case "#!serpent":
byteCode, err := serpent.Compile(script)
if err != nil {
return nil, err
}
return byteCode, nil
}
} else {
compiler := mutan.NewCompiler(backend.NewEthereumBackend())
compiler.Silent = silent
byteCode, errors := compiler.Compile(strings.NewReader(script))
if len(errors) > 0 {
var errs string
for _, er := range errors {
if er != nil {
errs += er.Error()
}
}
return nil, fmt.Errorf("%v", errs)
}
return byteCode, nil
byteCode, err := serpent.Compile(script)
if err != nil {
return nil, err
}
return byteCode, nil
}
return nil, nil

View File

@ -2,31 +2,10 @@
package ethutil
import (
"fmt"
"strings"
"github.com/obscuren/mutan"
"github.com/obscuren/mutan/backends"
)
// General compile function
func Compile(script string, silent bool) (ret []byte, err error) {
if len(script) > 2 {
compiler := mutan.NewCompiler(backend.NewEthereumBackend())
compiler.Silent = silent
byteCode, errors := compiler.Compile(strings.NewReader(script))
if len(errors) > 0 {
var errs string
for _, er := range errors {
if er != nil {
errs += er.Error()
}
}
return nil, fmt.Errorf("%v", errs)
}
return byteCode, nil
return nil, nil
}
return nil, nil

View File

@ -397,5 +397,5 @@ func (it *ValueIterator) Value() *Value {
}
func (it *ValueIterator) Idx() int {
return it.idx
return it.idx - 1
}

70
event/filter/filter.go Normal file
View File

@ -0,0 +1,70 @@
package filter
import "reflect"
type Filter interface {
Compare(Filter) bool
Trigger(data interface{})
}
type FilterEvent struct {
filter Filter
data interface{}
}
type Filters struct {
id int
watchers map[int]Filter
ch chan FilterEvent
quit chan struct{}
}
func New() *Filters {
return &Filters{
ch: make(chan FilterEvent),
watchers: make(map[int]Filter),
quit: make(chan struct{}),
}
}
func (self *Filters) Start() {
go self.loop()
}
func (self *Filters) Stop() {
close(self.quit)
}
func (self *Filters) Notify(filter Filter, data interface{}) {
self.ch <- FilterEvent{filter, data}
}
func (self *Filters) Install(watcher Filter) int {
self.watchers[self.id] = watcher
self.id++
return self.id - 1
}
func (self *Filters) Uninstall(id int) {
delete(self.watchers, id)
}
func (self *Filters) loop() {
out:
for {
select {
case <-self.quit:
break out
case event := <-self.ch:
for _, watcher := range self.watchers {
if reflect.TypeOf(watcher) == reflect.TypeOf(event.filter) {
if watcher.Compare(event.filter) {
watcher.Trigger(event.data)
}
}
}
}
}
}

View File

@ -0,0 +1,34 @@
package filter
import "testing"
func TestFilters(t *testing.T) {
var success bool
var failure bool
fm := New()
fm.Start()
fm.Install(Generic{
Str1: "hello",
Fn: func(data interface{}) {
success = data.(bool)
},
})
fm.Install(Generic{
Str1: "hello1",
Str2: "hello",
Fn: func(data interface{}) {
failure = true
},
})
fm.Notify(Generic{Str1: "hello"}, true)
fm.Stop()
if !success {
t.Error("expected 'hello' to be posted")
}
if failure {
t.Error("hello1 was triggered")
}
}

View File

@ -0,0 +1,22 @@
package filter
type Generic struct {
Str1, Str2, Str3 string
Fn func(data interface{})
}
func (self Generic) Compare(f Filter) bool {
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
}
return false
}
func (self Generic) Trigger(data interface{}) {
self.Fn(data)
}

View File

@ -121,6 +121,7 @@ func (self *JSRE) initStdFuncs() {
eth.Set("startMining", self.startMining)
eth.Set("execBlock", self.execBlock)
eth.Set("dump", self.dump)
eth.Set("export", self.export)
}
/*
@ -150,7 +151,7 @@ func (self *JSRE) dump(call otto.FunctionCall) otto.Value {
state = block.State()
} else {
state = self.ethereum.BlockManager().CurrentState()
state = self.ethereum.ChainManager().State()
}
v, _ := self.Vm.ToValue(state.Dump())
@ -236,3 +237,20 @@ func (self *JSRE) execBlock(call otto.FunctionCall) otto.Value {
return otto.TrueValue()
}
func (self *JSRE) export(call otto.FunctionCall) otto.Value {
fn, err := call.Argument(0).ToString()
if err != nil {
fmt.Println(err)
return otto.FalseValue()
}
data := self.ethereum.ChainManager().Export()
if err := ethutil.WriteFile(fn, data); err != nil {
fmt.Println(err)
return otto.FalseValue()
}
return otto.TrueValue()
}

View File

@ -29,6 +29,8 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/pow/ezp"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
@ -59,7 +61,7 @@ type Miner struct {
localTxs map[int]*LocalTx
localTxId int
pow core.PoW
pow pow.PoW
quitCh chan struct{}
powQuitCh chan struct{}
@ -74,7 +76,7 @@ func New(coinbase []byte, eth *eth.Ethereum) *Miner {
return &Miner{
eth: eth,
powQuitCh: make(chan struct{}),
pow: &core.EasyPow{},
pow: ezp.New(),
mining: false,
localTxs: make(map[int]*LocalTx),
MinAcceptedGasPrice: big.NewInt(10000000000000),
@ -82,7 +84,7 @@ func New(coinbase []byte, eth *eth.Ethereum) *Miner {
}
}
func (self *Miner) GetPow() core.PoW {
func (self *Miner) GetPow() pow.PoW {
return self.pow
}
@ -167,7 +169,6 @@ out:
}
func (self *Miner) reset() {
println("reset")
close(self.powQuitCh)
self.powQuitCh = make(chan struct{})
}
@ -192,7 +193,7 @@ func (self *Miner) mine() {
// 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.ProcessTransactions(coinbase, block.State(), block, block, transactions)
receipts, txs, _, erroneous, err := blockManager.ApplyTransactions(coinbase, block.State(), block, transactions, true)
if err != nil {
minerlogger.Debugln(err)
}
@ -228,23 +229,33 @@ func (self *Miner) mine() {
func (self *Miner) finiliseTxs() types.Transactions {
// Sort the transactions by nonce in case of odd network propagation
var txs types.Transactions
actualSize := len(self.localTxs) // See copy below
txs := make(types.Transactions, actualSize+self.eth.TxPool().Size())
state := self.eth.BlockManager().TransState()
state := self.eth.ChainManager().TransState()
// XXX This has to change. Coinbase is, for new, same as key.
key := self.eth.KeyManager()
for _, ltx := range self.localTxs {
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())
txs = append(txs, tx)
txs[i] = tx
}
txs = append(txs, self.eth.TxPool().CurrentTransactions()...)
sort.Sort(types.TxByNonce{txs})
// Faster than append
for _, tx := range self.eth.TxPool().CurrentTransactions() {
if tx.GasPrice().Cmp(self.MinAcceptedGasPrice) >= 0 {
txs[actualSize] = tx
actualSize++
}
}
return txs
newTransactions := make(types.Transactions, actualSize)
copy(newTransactions, txs[:actualSize])
sort.Sort(types.TxByNonce{newTransactions})
return newTransactions
}

View File

@ -3,9 +3,11 @@ package p2p
import (
"bytes"
"encoding/binary"
"errors"
"io"
"io/ioutil"
"math/big"
"sync/atomic"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/rlp"
@ -153,3 +155,78 @@ func (r *postrack) ReadByte() (byte, error) {
}
return b, err
}
// MsgPipe creates a message pipe. Reads on one end are matched
// with writes on the other. The pipe is full-duplex, both ends
// implement MsgReadWriter.
func MsgPipe() (*MsgPipeRW, *MsgPipeRW) {
var (
c1, c2 = make(chan Msg), make(chan Msg)
closing = make(chan struct{})
closed = new(int32)
rw1 = &MsgPipeRW{c1, c2, closing, closed}
rw2 = &MsgPipeRW{c2, c1, closing, closed}
)
return rw1, rw2
}
// ErrPipeClosed is returned from pipe operations after the
// pipe has been closed.
var ErrPipeClosed = errors.New("p2p: read or write on closed message pipe")
// MsgPipeRW is an endpoint of a MsgReadWriter pipe.
type MsgPipeRW struct {
w chan<- Msg
r <-chan Msg
closing chan struct{}
closed *int32
}
// WriteMsg sends a messsage on the pipe.
// It blocks until the receiver has consumed the message payload.
func (p *MsgPipeRW) WriteMsg(msg Msg) error {
if atomic.LoadInt32(p.closed) == 0 {
consumed := make(chan struct{}, 1)
msg.Payload = &eofSignal{msg.Payload, int64(msg.Size), consumed}
select {
case p.w <- msg:
if msg.Size > 0 {
// wait for payload read or discard
<-consumed
}
return nil
case <-p.closing:
}
}
return ErrPipeClosed
}
// EncodeMsg is a convenient shorthand for sending an RLP-encoded message.
func (p *MsgPipeRW) EncodeMsg(code uint64, data ...interface{}) error {
return p.WriteMsg(NewMsg(code, data...))
}
// ReadMsg returns a message sent on the other end of the pipe.
func (p *MsgPipeRW) ReadMsg() (Msg, error) {
if atomic.LoadInt32(p.closed) == 0 {
select {
case msg := <-p.r:
return msg, nil
case <-p.closing:
}
}
return Msg{}, ErrPipeClosed
}
// Close unblocks any pending ReadMsg and WriteMsg calls on both ends
// of the pipe. They will return ErrPipeClosed. Note that Close does
// not interrupt any reads from a message payload.
func (p *MsgPipeRW) Close() error {
if atomic.AddInt32(p.closed, 1) != 1 {
// someone else is already closing
atomic.StoreInt32(p.closed, 1) // avoid overflow
return nil
}
close(p.closing)
return nil
}

View File

@ -2,8 +2,11 @@ package p2p
import (
"bytes"
"fmt"
"io/ioutil"
"runtime"
"testing"
"time"
"github.com/ethereum/go-ethereum/ethutil"
)
@ -43,7 +46,7 @@ func TestEncodeDecodeMsg(t *testing.T) {
}
var data struct {
I int
I uint
S string
}
if err := decmsg.Decode(&data); err != nil {
@ -68,3 +71,63 @@ func TestDecodeRealMsg(t *testing.T) {
t.Errorf("incorrect code %d, want %d", msg.Code, 0)
}
}
func ExampleMsgPipe() {
rw1, rw2 := MsgPipe()
go func() {
rw1.EncodeMsg(8, []byte{0, 0})
rw1.EncodeMsg(5, []byte{1, 1})
rw1.Close()
}()
for {
msg, err := rw2.ReadMsg()
if err != nil {
break
}
var data [1][]byte
msg.Decode(&data)
fmt.Printf("msg: %d, %x\n", msg.Code, data[0])
}
// Output:
// msg: 8, 0000
// msg: 5, 0101
}
func TestMsgPipeUnblockWrite(t *testing.T) {
loop:
for i := 0; i < 100; i++ {
rw1, rw2 := MsgPipe()
done := make(chan struct{})
go func() {
if err := rw1.EncodeMsg(1); err == nil {
t.Error("EncodeMsg returned nil error")
} else if err != ErrPipeClosed {
t.Error("EncodeMsg returned wrong error: got %v, want %v", err, ErrPipeClosed)
}
close(done)
}()
// this call should ensure that EncodeMsg is waiting to
// deliver sometimes. if this isn't done, Close is likely to
// be executed before EncodeMsg starts and then we won't test
// all the cases.
runtime.Gosched()
rw2.Close()
select {
case <-done:
case <-time.After(200 * time.Millisecond):
t.Errorf("write didn't unblock")
break loop
}
}
}
// This test should panic if concurrent close isn't implemented correctly.
func TestMsgPipeConcurrentClose(t *testing.T) {
rw1, _ := MsgPipe()
for i := 0; i < 10; i++ {
go rw1.Close()
}
}

View File

@ -300,7 +300,7 @@ func (p *Peer) dispatch(msg Msg, protoDone chan struct{}) (wait bool, err error)
proto.in <- msg
} else {
wait = true
pr := &eofSignal{msg.Payload, protoDone}
pr := &eofSignal{msg.Payload, int64(msg.Size), protoDone}
msg.Payload = pr
proto.in <- msg
}
@ -438,18 +438,25 @@ func (rw *proto) ReadMsg() (Msg, error) {
return msg, nil
}
// eofSignal wraps a reader with eof signaling.
// the eof channel is closed when the wrapped reader
// reaches EOF.
// eofSignal wraps a reader with eof signaling. the eof channel is
// closed when the wrapped reader returns an error or when count bytes
// have been read.
//
type eofSignal struct {
wrapped io.Reader
count int64
eof chan<- struct{}
}
// note: when using eofSignal to detect whether a message payload
// has been read, Read might not be called for zero sized messages.
func (r *eofSignal) Read(buf []byte) (int, error) {
n, err := r.wrapped.Read(buf)
if err != nil {
r.count -= int64(n)
if (err != nil || r.count <= 0) && r.eof != nil {
r.eof <- struct{}{} // tell Peer that msg has been consumed
r.eof = nil
}
return n, err
}

View File

@ -100,7 +100,16 @@ func (d DiscReason) String() string {
return discReasonToString[d]
}
type discRequestedError DiscReason
func (err discRequestedError) Error() string {
return fmt.Sprintf("disconnect requested: %v", DiscReason(err))
}
func discReasonForError(err error) DiscReason {
if reason, ok := err.(discRequestedError); ok {
return DiscReason(reason)
}
peerError, ok := err.(*peerError)
if !ok {
return DiscSubprotocolError

View File

@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"encoding/hex"
"io"
"io/ioutil"
"net"
"reflect"
@ -237,3 +238,58 @@ func TestNewPeer(t *testing.T) {
// Should not hang.
p.Disconnect(DiscAlreadyConnected)
}
func TestEOFSignal(t *testing.T) {
rb := make([]byte, 10)
// empty reader
eof := make(chan struct{}, 1)
sig := &eofSignal{new(bytes.Buffer), 0, eof}
if n, err := sig.Read(rb); n != 0 || err != io.EOF {
t.Errorf("Read returned unexpected values: (%v, %v)", n, err)
}
select {
case <-eof:
default:
t.Error("EOF chan not signaled")
}
// count before error
eof = make(chan struct{}, 1)
sig = &eofSignal{bytes.NewBufferString("aaaaaaaa"), 4, eof}
if n, err := sig.Read(rb); n != 8 || err != nil {
t.Errorf("Read returned unexpected values: (%v, %v)", n, err)
}
select {
case <-eof:
default:
t.Error("EOF chan not signaled")
}
// error before count
eof = make(chan struct{}, 1)
sig = &eofSignal{bytes.NewBufferString("aaaa"), 999, eof}
if n, err := sig.Read(rb); n != 4 || err != nil {
t.Errorf("Read returned unexpected values: (%v, %v)", n, err)
}
if n, err := sig.Read(rb); n != 0 || err != io.EOF {
t.Errorf("Read returned unexpected values: (%v, %v)", n, err)
}
select {
case <-eof:
default:
t.Error("EOF chan not signaled")
}
// no signal if neither occurs
eof = make(chan struct{}, 1)
sig = &eofSignal{bytes.NewBufferString("aaaaaaaaaaaaaaaaaaaaa"), 999, eof}
if n, err := sig.Read(rb); n != 10 || err != nil {
t.Errorf("Read returned unexpected values: (%v, %v)", n, err)
}
select {
case <-eof:
t.Error("unexpected EOF signal")
default:
}
}

View File

@ -154,12 +154,11 @@ func (bp *baseProtocol) handle(rw MsgReadWriter) error {
return newPeerError(errProtocolBreach, "extra handshake received")
case discMsg:
var reason DiscReason
var reason [1]DiscReason
if err := msg.Decode(&reason); err != nil {
return err
}
bp.peer.Disconnect(reason)
return nil
return discRequestedError(reason[0])
case pingMsg:
return bp.rw.EncodeMsg(pongMsg)

58
p2p/protocol_test.go Normal file
View File

@ -0,0 +1,58 @@
package p2p
import (
"fmt"
"testing"
)
func TestBaseProtocolDisconnect(t *testing.T) {
peer := NewPeer(NewSimpleClientIdentity("p1", "", "", "foo"), nil)
peer.ourID = NewSimpleClientIdentity("p2", "", "", "bar")
peer.pubkeyHook = func(*peerAddr) error { return nil }
rw1, rw2 := MsgPipe()
done := make(chan struct{})
go func() {
if err := expectMsg(rw2, handshakeMsg); err != nil {
t.Error(err)
}
err := rw2.EncodeMsg(handshakeMsg,
baseProtocolVersion,
"",
[]interface{}{},
0,
make([]byte, 64),
)
if err != nil {
t.Error(err)
}
if err := expectMsg(rw2, getPeersMsg); err != nil {
t.Error(err)
}
if err := rw2.EncodeMsg(discMsg, DiscQuitting); err != nil {
t.Error(err)
}
close(done)
}()
if err := runBaseProtocol(peer, rw1); err == nil {
t.Errorf("base protocol returned without error")
} else if reason, ok := err.(discRequestedError); !ok || reason != DiscQuitting {
t.Errorf("base protocol returned wrong error: %v", err)
}
<-done
}
func expectMsg(r MsgReader, code uint64) error {
msg, err := r.ReadMsg()
if err != nil {
return err
}
if err := msg.Discard(); err != nil {
return err
}
if msg.Code != code {
return fmt.Errorf("wrong message code: got %d, expected %d", msg.Code, code)
}
return nil
}

44
peer.go
View File

@ -24,7 +24,7 @@ const (
// The size of the output buffer for writing messages
outputBufferSize = 50
// Current protocol version
ProtocolVersion = 47
ProtocolVersion = 49
// Current P2P version
P2PVersion = 2
// Ethereum network version
@ -129,9 +129,11 @@ type Peer struct {
statusKnown bool
// Last received pong message
lastPong int64
lastBlockReceived time.Time
doneFetchingHashes bool
lastPong int64
lastBlockReceived time.Time
doneFetchingHashes bool
lastHashAt time.Time
lastHashRequestedAt time.Time
host []byte
port uint16
@ -327,19 +329,16 @@ out:
}
}
switch msg.Type {
case wire.MsgGetBlockHashesTy:
p.lastHashRequestedAt = time.Now()
}
p.writeMessage(msg)
p.lastSend = time.Now()
// Ping timer
case <-pingTimer.C:
/*
timeSince := time.Since(time.Unix(p.lastPong, 0))
if !p.pingStartTime.IsZero() && p.lastPong != 0 && timeSince > (pingPongTimer+30*time.Second) {
peerlogger.Infof("Peer did not respond to latest pong fast enough, it took %s, disconnecting.\n", timeSince)
p.Stop()
return
}
*/
p.writeMessage(wire.NewMessage(wire.MsgPingTy, ""))
p.pingStartTime = time.Now()
@ -462,18 +461,6 @@ func (p *Peer) HandleInbound() {
// TMP
if p.statusKnown {
switch msg.Type {
/*
case wire.MsgGetTxsTy:
// Get the current transactions of the pool
txs := p.ethereum.TxPool().CurrentTransactions()
// Get the RlpData values from the txs
txsInterface := make([]interface{}, len(txs))
for i, tx := range txs {
txsInterface[i] = tx.RlpData()
}
// Broadcast it back to the peer
p.QueueMessage(wire.NewMessage(wire.MsgTxTy, txsInterface))
*/
case wire.MsgGetBlockHashesTy:
if msg.Data.Len() < 2 {
@ -508,6 +495,7 @@ func (p *Peer) HandleInbound() {
blockPool := p.ethereum.blockPool
foundCommonHash := false
p.lastHashAt = time.Now()
it := msg.Data.NewIterator()
for it.Next() {
@ -524,9 +512,6 @@ func (p *Peer) HandleInbound() {
}
if !foundCommonHash {
//if !p.FetchHashes() {
// p.doneFetchingHashes = true
//}
p.FetchHashes()
} else {
peerlogger.Infof("Found common hash (%x...)\n", p.lastReceivedHash[0:4])
@ -681,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(),
})
@ -756,7 +741,6 @@ func (p *Peer) handleHandshake(msg *wire.Msg) {
// Check correctness of p2p protocol version
if p2pVersion != P2PVersion {
fmt.Println(p)
peerlogger.Debugf("Invalid P2P version. Require protocol %d, received %d\n", P2PVersion, p2pVersion)
p.Stop()
return

9
pow/block.go Normal file
View File

@ -0,0 +1,9 @@
package pow
import "math/big"
type Block interface {
Diff() *big.Int
HashNoNonce() []byte
N() []byte
}

89
pow/ezp/pow.go Normal file
View File

@ -0,0 +1,89 @@
package ezp
import (
"math/big"
"math/rand"
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/pow"
"github.com/obscuren/sha3"
)
var powlogger = logger.NewLogger("POW")
type EasyPow struct {
hash *big.Int
HashRate int64
turbo bool
}
func New() *EasyPow {
return &EasyPow{turbo: true}
}
func (pow *EasyPow) GetHashrate() int64 {
return pow.HashRate
}
func (pow *EasyPow) Turbo(on bool) {
pow.turbo = on
}
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()
i := int64(0)
start := time.Now().UnixNano()
t := time.Now()
for {
select {
case <-stop:
powlogger.Infoln("Breaking from mining")
pow.HashRate = 0
return nil
default:
i++
if time.Since(t) > (1 * time.Second) {
elapsed := time.Now().UnixNano() - start
hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000
pow.HashRate = int64(hashes)
powlogger.Infoln("Hashing @", pow.HashRate, "khash")
t = time.Now()
}
sha := crypto.Sha3(big.NewInt(r.Int63()).Bytes())
if pow.verify(hash, diff, sha) {
return sha
}
}
if !pow.turbo {
time.Sleep(20 * time.Microsecond)
}
}
return nil
}
func (pow *EasyPow) verify(hash []byte, diff *big.Int, nonce []byte) bool {
sha := sha3.NewKeccak256()
d := append(hash, nonce...)
sha.Write(d)
verification := new(big.Int).Div(ethutil.BigPow(2, 256), diff)
res := ethutil.U256(ethutil.BigD(sha.Sum(nil)))
return res.Cmp(verification) <= 0
}
func (pow *EasyPow) Verify(block pow.Block) bool {
return pow.verify(block.HashNoNonce(), block.Diff(), block.N())
}

8
pow/pow.go Normal file
View File

@ -0,0 +1,8 @@
package pow
type PoW interface {
Search(block Block, stop <-chan struct{}) []byte
Verify(block Block) bool
GetHashrate() int64
Turbo(bool)
}

View File

@ -54,7 +54,7 @@ type Decoder interface {
// To decode into a Go string, the input must be an RLP string. The
// bytes are taken as-is and will not necessarily be valid UTF-8.
//
// To decode into an integer type, the input must also be an RLP
// To decode into an unsigned integer type, the input must also be an RLP
// string. The bytes are interpreted as a big endian representation of
// the integer. If the RLP string is larger than the bit size of the
// type, Decode will return an error. Decode also supports *big.Int.
@ -66,8 +66,9 @@ type Decoder interface {
// []interface{}, for RLP lists
// []byte, for RLP strings
//
// Non-empty interface types are not supported, nor are bool, float32,
// float64, maps, channel types and functions.
// Non-empty interface types are not supported, nor are booleans,
// signed integers, floating point numbers, maps, channels and
// functions.
func Decode(r io.Reader, val interface{}) error {
return NewStream(r).Decode(val)
}
@ -81,37 +82,58 @@ func (err decodeError) Error() string {
return fmt.Sprintf("rlp: %s for %v", err.msg, err.typ)
}
func makeNumDecoder(typ reflect.Type) decoder {
kind := typ.Kind()
switch {
case kind <= reflect.Int64:
return decodeInt
case kind <= reflect.Uint64:
return decodeUint
default:
panic("fallthrough")
func wrapStreamError(err error, typ reflect.Type) error {
switch err {
case ErrExpectedList:
return decodeError{"expected input list", typ}
case ErrExpectedString:
return decodeError{"expected input string or byte", typ}
case errUintOverflow:
return decodeError{"input string too long", typ}
case errNotAtEOL:
return decodeError{"input list has too many elements", typ}
}
return err
}
func decodeInt(s *Stream, val reflect.Value) error {
typ := val.Type()
num, err := s.uint(typ.Bits())
if err == errUintOverflow {
return decodeError{"input string too long", typ}
} else if err != nil {
return err
var (
decoderInterface = reflect.TypeOf(new(Decoder)).Elem()
bigInt = reflect.TypeOf(big.Int{})
)
func makeDecoder(typ reflect.Type) (dec decoder, err error) {
kind := typ.Kind()
switch {
case typ.Implements(decoderInterface):
return decodeDecoder, nil
case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(decoderInterface):
return decodeDecoderNoPtr, nil
case typ.AssignableTo(reflect.PtrTo(bigInt)):
return decodeBigInt, nil
case typ.AssignableTo(bigInt):
return decodeBigIntNoPtr, nil
case isUint(kind):
return decodeUint, nil
case kind == reflect.String:
return decodeString, nil
case kind == reflect.Slice || kind == reflect.Array:
return makeListDecoder(typ)
case kind == reflect.Struct:
return makeStructDecoder(typ)
case kind == reflect.Ptr:
return makePtrDecoder(typ)
case kind == reflect.Interface && typ.NumMethod() == 0:
return decodeInterface, nil
default:
return nil, fmt.Errorf("rlp: type %v is not RLP-serializable", typ)
}
val.SetInt(int64(num))
return nil
}
func decodeUint(s *Stream, val reflect.Value) error {
typ := val.Type()
num, err := s.uint(typ.Bits())
if err == errUintOverflow {
return decodeError{"input string too big", typ}
} else if err != nil {
return err
if err != nil {
return wrapStreamError(err, val.Type())
}
val.SetUint(num)
return nil
@ -120,7 +142,7 @@ func decodeUint(s *Stream, val reflect.Value) error {
func decodeString(s *Stream, val reflect.Value) error {
b, err := s.Bytes()
if err != nil {
return err
return wrapStreamError(err, val.Type())
}
val.SetString(string(b))
return nil
@ -133,7 +155,7 @@ func decodeBigIntNoPtr(s *Stream, val reflect.Value) error {
func decodeBigInt(s *Stream, val reflect.Value) error {
b, err := s.Bytes()
if err != nil {
return err
return wrapStreamError(err, val.Type())
}
i := val.Interface().(*big.Int)
if i == nil {
@ -144,8 +166,6 @@ func decodeBigInt(s *Stream, val reflect.Value) error {
return nil
}
const maxInt = int(^uint(0) >> 1)
func makeListDecoder(typ reflect.Type) (decoder, error) {
etype := typ.Elem()
if etype.Kind() == reflect.Uint8 && !reflect.PtrTo(etype).Implements(decoderInterface) {
@ -159,55 +179,41 @@ func makeListDecoder(typ reflect.Type) (decoder, error) {
if err != nil {
return nil, err
}
var maxLen = maxInt
if typ.Kind() == reflect.Array {
maxLen = typ.Len()
return func(s *Stream, val reflect.Value) error {
return decodeListArray(s, val, etypeinfo.decoder)
}, nil
}
dec := func(s *Stream, val reflect.Value) error {
return decodeList(s, val, etypeinfo.decoder, maxLen)
}
return dec, nil
return func(s *Stream, val reflect.Value) error {
return decodeListSlice(s, val, etypeinfo.decoder)
}, nil
}
// decodeList decodes RLP list elements into slices and arrays.
//
// The approach here is stolen from package json, although we differ
// in the semantics for arrays. package json discards remaining
// elements that would not fit into the array. We generate an error in
// this case because we'd be losing information.
func decodeList(s *Stream, val reflect.Value, elemdec decoder, maxelem int) error {
func decodeListSlice(s *Stream, val reflect.Value, elemdec decoder) error {
size, err := s.List()
if err != nil {
return err
return wrapStreamError(err, val.Type())
}
if size == 0 {
if val.Kind() == reflect.Slice {
val.Set(reflect.MakeSlice(val.Type(), 0, 0))
} else {
zero(val, 0)
}
val.Set(reflect.MakeSlice(val.Type(), 0, 0))
return s.ListEnd()
}
i := 0
for {
if i > maxelem {
return decodeError{"input list has too many elements", val.Type()}
for ; ; i++ {
// grow slice if necessary
if i >= val.Cap() {
newcap := val.Cap() + val.Cap()/2
if newcap < 4 {
newcap = 4
}
newv := reflect.MakeSlice(val.Type(), val.Len(), newcap)
reflect.Copy(newv, val)
val.Set(newv)
}
if val.Kind() == reflect.Slice {
// grow slice if necessary
if i >= val.Cap() {
newcap := val.Cap() + val.Cap()/2
if newcap < 4 {
newcap = 4
}
newv := reflect.MakeSlice(val.Type(), val.Len(), newcap)
reflect.Copy(newv, val)
val.Set(newv)
}
if i >= val.Len() {
val.SetLen(i + 1)
}
if i >= val.Len() {
val.SetLen(i + 1)
}
// decode into element
if err := elemdec(s, val.Index(i)); err == EOL {
@ -215,26 +221,49 @@ func decodeList(s *Stream, val reflect.Value, elemdec decoder, maxelem int) erro
} else if err != nil {
return err
}
i++
}
if i < val.Len() {
if val.Kind() == reflect.Array {
// zero the rest of the array.
zero(val, i)
} else {
val.SetLen(i)
}
val.SetLen(i)
}
return s.ListEnd()
}
func decodeListArray(s *Stream, val reflect.Value, elemdec decoder) error {
size, err := s.List()
if err != nil {
return err
}
if size == 0 {
zero(val, 0)
return s.ListEnd()
}
// The approach here is stolen from package json, although we differ
// in the semantics for arrays. package json discards remaining
// elements that would not fit into the array. We generate an error in
// this case because we'd be losing information.
vlen := val.Len()
i := 0
for ; i < vlen; i++ {
if err := elemdec(s, val.Index(i)); err == EOL {
break
} else if err != nil {
return err
}
}
if i < vlen {
zero(val, i)
}
return wrapStreamError(s.ListEnd(), val.Type())
}
func decodeByteSlice(s *Stream, val reflect.Value) error {
kind, _, err := s.Kind()
if err != nil {
return err
}
if kind == List {
return decodeList(s, val, decodeUint, maxInt)
return decodeListSlice(s, val, decodeUint)
}
b, err := s.Bytes()
if err == nil {
@ -251,14 +280,14 @@ func decodeByteArray(s *Stream, val reflect.Value) error {
switch kind {
case Byte:
if val.Len() == 0 {
return decodeError{"input string too big", val.Type()}
return decodeError{"input string too long", val.Type()}
}
bv, _ := s.Uint()
val.Index(0).SetUint(bv)
zero(val, 1)
case String:
if uint64(val.Len()) < size {
return decodeError{"input string too big", val.Type()}
return decodeError{"input string too long", val.Type()}
}
slice := val.Slice(0, int(size)).Interface().([]byte)
if err := s.readFull(slice); err != nil {
@ -266,14 +295,15 @@ func decodeByteArray(s *Stream, val reflect.Value) error {
}
zero(val, int(size))
case List:
return decodeList(s, val, decodeUint, val.Len())
return decodeListArray(s, val, decodeUint)
}
return nil
}
func zero(val reflect.Value, start int) {
z := reflect.Zero(val.Type().Elem())
for i := start; i < val.Len(); i++ {
end := val.Len()
for i := start; i < end; i++ {
val.Index(i).Set(z)
}
}
@ -296,7 +326,7 @@ func makeStructDecoder(typ reflect.Type) (decoder, error) {
}
dec := func(s *Stream, val reflect.Value) (err error) {
if _, err = s.List(); err != nil {
return err
return wrapStreamError(err, typ)
}
for _, f := range fields {
err = f.info.decoder(s, val.Field(f.index))
@ -307,10 +337,7 @@ func makeStructDecoder(typ reflect.Type) (decoder, error) {
return err
}
}
if err = s.ListEnd(); err == errNotAtEOL {
err = decodeError{"input list has too many elements", typ}
}
return err
return wrapStreamError(s.ListEnd(), typ)
}
return dec, nil
}
@ -348,7 +375,7 @@ func decodeInterface(s *Stream, val reflect.Value) error {
}
if kind == List {
slice := reflect.New(ifsliceType).Elem()
if err := decodeList(s, slice, decodeInterface, maxInt); err != nil {
if err := decodeListSlice(s, slice, decodeInterface); err != nil {
return err
}
val.Set(slice)

View File

@ -171,7 +171,7 @@ func TestDecodeErrors(t *testing.T) {
t.Errorf("Decode(r, new(chan bool)) error mismatch, got %q, want %q", err, expectErr)
}
if err := Decode(r, new(int)); err != io.EOF {
if err := Decode(r, new(uint)); err != io.EOF {
t.Errorf("Decode(r, new(int)) error mismatch, got %q, want %q", err, io.EOF)
}
}
@ -184,12 +184,12 @@ type decodeTest struct {
}
type simplestruct struct {
A int
A uint
B string
}
type recstruct struct {
I int
I uint
Child *recstruct
}
@ -202,7 +202,7 @@ var (
var (
sharedByteArray [5]byte
sharedPtr = new(*int)
sharedPtr = new(*uint)
)
var decodeTests = []decodeTest{
@ -213,17 +213,17 @@ var decodeTests = []decodeTest{
{input: "820505", ptr: new(uint32), value: uint32(0x0505)},
{input: "83050505", ptr: new(uint32), value: uint32(0x050505)},
{input: "8405050505", ptr: new(uint32), value: uint32(0x05050505)},
{input: "850505050505", ptr: new(uint32), error: "rlp: input string too big for uint32"},
{input: "C0", ptr: new(uint32), error: ErrExpectedString.Error()},
{input: "850505050505", ptr: new(uint32), error: "rlp: input string too long for uint32"},
{input: "C0", ptr: new(uint32), error: "rlp: expected input string or byte for uint32"},
// slices
{input: "C0", ptr: new([]int), value: []int{}},
{input: "C80102030405060708", ptr: new([]int), value: []int{1, 2, 3, 4, 5, 6, 7, 8}},
{input: "C0", ptr: new([]uint), value: []uint{}},
{input: "C80102030405060708", ptr: new([]uint), value: []uint{1, 2, 3, 4, 5, 6, 7, 8}},
// arrays
{input: "C0", ptr: new([5]int), value: [5]int{}},
{input: "C50102030405", ptr: new([5]int), value: [5]int{1, 2, 3, 4, 5}},
{input: "C6010203040506", ptr: new([5]int), error: "rlp: input list has too many elements for [5]int"},
{input: "C0", ptr: new([5]uint), value: [5]uint{}},
{input: "C50102030405", ptr: new([5]uint), value: [5]uint{1, 2, 3, 4, 5}},
{input: "C6010203040506", ptr: new([5]uint), error: "rlp: input list has too many elements for [5]uint"},
// byte slices
{input: "01", ptr: new([]byte), value: []byte{1}},
@ -231,7 +231,7 @@ var decodeTests = []decodeTest{
{input: "8D6162636465666768696A6B6C6D", ptr: new([]byte), value: []byte("abcdefghijklm")},
{input: "C0", ptr: new([]byte), value: []byte{}},
{input: "C3010203", ptr: new([]byte), value: []byte{1, 2, 3}},
{input: "C3820102", ptr: new([]byte), error: "rlp: input string too big for uint8"},
{input: "C3820102", ptr: new([]byte), error: "rlp: input string too long for uint8"},
// byte arrays
{input: "01", ptr: new([5]byte), value: [5]byte{1}},
@ -239,8 +239,8 @@ var decodeTests = []decodeTest{
{input: "850102030405", ptr: new([5]byte), value: [5]byte{1, 2, 3, 4, 5}},
{input: "C0", ptr: new([5]byte), value: [5]byte{}},
{input: "C3010203", ptr: new([5]byte), value: [5]byte{1, 2, 3, 0, 0}},
{input: "C3820102", ptr: new([5]byte), error: "rlp: input string too big for uint8"},
{input: "86010203040506", ptr: new([5]byte), error: "rlp: input string too big for [5]uint8"},
{input: "C3820102", ptr: new([5]byte), error: "rlp: input string too long for uint8"},
{input: "86010203040506", ptr: new([5]byte), error: "rlp: input string too long for [5]uint8"},
{input: "850101", ptr: new([5]byte), error: io.ErrUnexpectedEOF.Error()},
// byte array reuse (should be zeroed)
@ -254,19 +254,19 @@ var decodeTests = []decodeTest{
// zero sized byte arrays
{input: "80", ptr: new([0]byte), value: [0]byte{}},
{input: "C0", ptr: new([0]byte), value: [0]byte{}},
{input: "01", ptr: new([0]byte), error: "rlp: input string too big for [0]uint8"},
{input: "8101", ptr: new([0]byte), error: "rlp: input string too big for [0]uint8"},
{input: "01", ptr: new([0]byte), error: "rlp: input string too long for [0]uint8"},
{input: "8101", ptr: new([0]byte), error: "rlp: input string too long for [0]uint8"},
// strings
{input: "00", ptr: new(string), value: "\000"},
{input: "8D6162636465666768696A6B6C6D", ptr: new(string), value: "abcdefghijklm"},
{input: "C0", ptr: new(string), error: ErrExpectedString.Error()},
{input: "C0", ptr: new(string), error: "rlp: expected input string or byte for string"},
// big ints
{input: "01", ptr: new(*big.Int), value: big.NewInt(1)},
{input: "89FFFFFFFFFFFFFFFFFF", ptr: new(*big.Int), value: veryBigInt},
{input: "10", ptr: new(big.Int), value: *big.NewInt(16)}, // non-pointer also works
{input: "C0", ptr: new(*big.Int), error: ErrExpectedString.Error()},
{input: "C0", ptr: new(*big.Int), error: "rlp: expected input string or byte for *big.Int"},
// structs
{input: "C0", ptr: new(simplestruct), value: simplestruct{0, ""}},
@ -280,17 +280,17 @@ var decodeTests = []decodeTest{
},
// pointers
{input: "00", ptr: new(*int), value: (*int)(nil)},
{input: "80", ptr: new(*int), value: (*int)(nil)},
{input: "C0", ptr: new(*int), value: (*int)(nil)},
{input: "07", ptr: new(*int), value: intp(7)},
{input: "8108", ptr: new(*int), value: intp(8)},
{input: "C109", ptr: new(*[]int), value: &[]int{9}},
{input: "00", ptr: new(*uint), value: (*uint)(nil)},
{input: "80", ptr: new(*uint), value: (*uint)(nil)},
{input: "C0", ptr: new(*uint), value: (*uint)(nil)},
{input: "07", ptr: new(*uint), value: uintp(7)},
{input: "8108", ptr: new(*uint), value: uintp(8)},
{input: "C109", ptr: new(*[]uint), value: &[]uint{9}},
{input: "C58403030303", ptr: new(*[][]byte), value: &[][]byte{{3, 3, 3, 3}}},
// pointer should be reset to nil
{input: "05", ptr: sharedPtr, value: intp(5)},
{input: "80", ptr: sharedPtr, value: (*int)(nil)},
{input: "05", ptr: sharedPtr, value: uintp(5)},
{input: "80", ptr: sharedPtr, value: (*uint)(nil)},
// interface{}
{input: "00", ptr: new(interface{}), value: []byte{0}},
@ -301,7 +301,7 @@ var decodeTests = []decodeTest{
{input: "C50183040404", ptr: new(interface{}), value: []interface{}{[]byte{1}, []byte{4, 4, 4}}},
}
func intp(i int) *int { return &i }
func uintp(i uint) *uint { return &i }
func runTests(t *testing.T, decode func([]byte, interface{}) error) {
for i, test := range decodeTests {
@ -434,8 +434,8 @@ func ExampleDecode() {
input, _ := hex.DecodeString("C90A1486666F6F626172")
type example struct {
A, B int
private int // private fields are ignored
A, B uint
private uint // private fields are ignored
String string
}
@ -447,7 +447,7 @@ func ExampleDecode() {
fmt.Printf("Decoded value: %#v\n", s)
}
// Output:
// Decoded value: rlp.example{A:10, B:20, private:0, String:"foobar"}
// Decoded value: rlp.example{A:0xa, B:0x14, private:0x0, String:"foobar"}
}
func ExampleStream() {

View File

@ -1,8 +1,6 @@
package rlp
import (
"fmt"
"math/big"
"reflect"
"sync"
)
@ -51,41 +49,14 @@ func cachedTypeInfo1(typ reflect.Type) (*typeinfo, error) {
return typeCache[typ], err
}
var (
decoderInterface = reflect.TypeOf(new(Decoder)).Elem()
bigInt = reflect.TypeOf(big.Int{})
)
func genTypeInfo(typ reflect.Type) (info *typeinfo, err error) {
info = new(typeinfo)
kind := typ.Kind()
switch {
case typ.Implements(decoderInterface):
info.decoder = decodeDecoder
case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(decoderInterface):
info.decoder = decodeDecoderNoPtr
case typ.AssignableTo(reflect.PtrTo(bigInt)):
info.decoder = decodeBigInt
case typ.AssignableTo(bigInt):
info.decoder = decodeBigIntNoPtr
case isInteger(kind):
info.decoder = makeNumDecoder(typ)
case kind == reflect.String:
info.decoder = decodeString
case kind == reflect.Slice || kind == reflect.Array:
info.decoder, err = makeListDecoder(typ)
case kind == reflect.Struct:
info.decoder, err = makeStructDecoder(typ)
case kind == reflect.Ptr:
info.decoder, err = makePtrDecoder(typ)
case kind == reflect.Interface && typ.NumMethod() == 0:
info.decoder = decodeInterface
default:
err = fmt.Errorf("rlp: type %v is not RLP-serializable", typ)
if info.decoder, err = makeDecoder(typ); err != nil {
return nil, err
}
return info, err
return info, nil
}
func isInteger(k reflect.Kind) bool {
return k >= reflect.Int && k <= reflect.Uintptr
func isUint(k reflect.Kind) bool {
return k >= reflect.Uint && k <= reflect.Uintptr
}

View File

@ -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,11 @@ 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) {
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) {
@ -95,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 {
@ -211,7 +217,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))
@ -273,23 +279,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 {

View File

@ -9,7 +9,7 @@ import (
)
type StateSuite struct {
state *State
state *StateDB
}
var _ = checker.Suite(&StateSuite{})

View File

@ -8,8 +8,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {

View File

@ -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"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -79,8 +79,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -148,8 +148,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -216,8 +216,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -286,8 +286,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -348,6 +348,77 @@
"value" : "100000"
}
},
"CallEcrecover0_overlappingInputOutput" : {
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "10000000",
"currentNumber" : "0",
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
"balance" : "0",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "20100000",
"code" : "0x7f18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c600052601c6020527f73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f6040527feeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c45496060526020604060806000600060016103e8f160025560a060020a604051066000556000543214600155",
"nonce" : "0",
"storage" : {
"0x" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"0x01" : "0x01",
"0x02" : "0x01"
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1976",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898024",
"code" : "0x",
"nonce" : "1",
"storage" : {
}
}
},
"pre" : {
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "20000000",
"code" : "0x7f18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c600052601c6020527f73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f6040527feeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c45496060526020604060806000600060016103e8f160025560a060020a604051066000556000543214600155",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "1000000000000000000",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
}
},
"transaction" : {
"data" : "",
"gasLimit" : "365224",
"gasPrice" : "1",
"nonce" : "0",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value" : "100000"
}
},
"CallEcrecover1" : {
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
@ -357,8 +428,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -426,8 +497,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -495,8 +566,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000001" : {
@ -565,8 +636,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000003" : {
@ -634,8 +705,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000003" : {
@ -655,14 +726,14 @@
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1232",
"balance" : "1182",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898768",
"balance" : "999999999999898818",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -704,8 +775,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000003" : {
@ -725,14 +796,14 @@
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1236",
"balance" : "1286",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898764",
"balance" : "999999999999898714",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -774,8 +845,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000003" : {
@ -795,14 +866,14 @@
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1236",
"balance" : "1286",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898764",
"balance" : "999999999999898714",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -844,8 +915,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000003" : {
@ -914,8 +985,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000003" : {
@ -983,8 +1054,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000003" : {
@ -999,19 +1070,18 @@
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000620f42406000600060036101f4f1600255600051600055",
"nonce" : "0",
"storage" : {
"0x" : "0x953450193f7389363135b31dc0f371f22f3947db",
"0x02" : "0x01"
"0x" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "32484",
"balance" : "32684",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999867516",
"balance" : "999999999999867316",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -1053,8 +1123,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1122,8 +1192,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1143,14 +1213,14 @@
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1232",
"balance" : "1182",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898768",
"balance" : "999999999999898818",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -1192,8 +1262,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1213,14 +1283,14 @@
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1232",
"balance" : "1182",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898768",
"balance" : "999999999999898818",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -1262,8 +1332,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1283,14 +1353,14 @@
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1236",
"balance" : "1286",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898764",
"balance" : "999999999999898714",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -1332,8 +1402,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1353,14 +1423,14 @@
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "1236",
"balance" : "1286",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999898764",
"balance" : "999999999999898714",
"code" : "0x",
"nonce" : "1",
"storage" : {
@ -1402,8 +1472,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1472,8 +1542,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1541,8 +1611,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0000000000000000000000000000000000000002" : {
@ -1557,19 +1627,18 @@
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000620f42406000600060026101f4f1600255600051600055",
"nonce" : "0",
"storage" : {
"0x" : "0x739d5000bbe364e92a2fe28d62c17a6dfd4f32105420c30b97ec0180300a2dae",
"0x02" : "0x01"
"0x" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
},
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "32484",
"balance" : "32684",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "999999999999867516",
"balance" : "999999999999867316",
"code" : "0x",
"nonce" : "1",
"storage" : {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,523 @@
{
"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",
"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"
}
}
}

View File

@ -8,8 +8,8 @@
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {

File diff suppressed because it is too large Load Diff

View File

@ -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"
}
}
}

View File

@ -0,0 +1,55 @@
{
"singleItem": {
"in": {
"A": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"root": "0xd23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab"
},
"dogs": {
"in": {
"doe": "reindeer",
"dog": "puppy",
"dogglesworth": "cat"
},
"root": "0x8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3"
},
"puppy": {
"in": {
"do": "verb",
"horse": "stallion",
"doge": "coin",
"dog": "puppy"
},
"root": "0x5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84"
},
"foo": {
"in": {
"foo": "bar",
"food": "bat",
"food": "bass"
},
"root": "0x17beaa1648bafa633cda809c90c04af50fc8aed3cb40d16efbddee6fdf63c4c3"
},
"smallValues": {
"in": {
"be": "e",
"dog": "puppy",
"bed": "d"
},
"root": "0x3f67c7a47520f79faa29255d2d3c084a7a6df0453116ed7232ff10277a8be68b"
},
"testy": {
"in": {
"test": "test",
"te": "testy"
},
"root": "0x8452568af70d8d140f58d941338542f645fcca50094b20f3c3d8c3df49337928"
},
"hex": {
"in": {
"0x0045": "0x0123456789",
"0x4500": "0x9876543210"
},
"root": "0x285505fcabe84badc8aa310e2aae17eddc7d120aabec8a476902c8184b3a3503"
}
}

View File

@ -1,27 +1,4 @@
{
"singleItem": {
"in": [
["A", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
],
"root": "0xd23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab"
},
"dogs": {
"in": [
["doe", "reindeer"],
["dog", "puppy"],
["dogglesworth", "cat"]
],
"root": "0x8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3"
},
"puppy": {
"in": [
["do", "verb"],
["horse", "stallion"],
["doge", "coin"],
["dog", "puppy"]
],
"root": "0x5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84"
},
"emptyValues": {
"in": [
["do", "verb"],
@ -29,42 +6,12 @@
["horse", "stallion"],
["shaman", "horse"],
["doge", "coin"],
["ether", ""],
["ether", null],
["dog", "puppy"],
["shaman", ""]
["shaman", null]
],
"root": "0x5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84"
},
"foo": {
"in": [
["foo", "bar"],
["food", "bat"],
["food", "bass"]
],
"root": "0x17beaa1648bafa633cda809c90c04af50fc8aed3cb40d16efbddee6fdf63c4c3"
},
"smallValues": {
"in": [
["be", "e"],
["dog", "puppy"],
["bed", "d"]
],
"root": "0x3f67c7a47520f79faa29255d2d3c084a7a6df0453116ed7232ff10277a8be68b"
},
"testy": {
"in": [
["test", "test"],
["te", "testy"]
],
"root": "0x8452568af70d8d140f58d941338542f645fcca50094b20f3c3d8c3df49337928"
},
"hex": {
"in": [
["0x0045", "0x0123456789"],
["0x4500", "0x9876543210"]
],
"root": "0x285505fcabe84badc8aa310e2aae17eddc7d120aabec8a476902c8184b3a3503"
},
"jeff": {
"in": [
["0x0000000000000000000000000000000000000000000000000000000000000045", "0x22b224a1420a802ab51d326e29fa98e34c4f24ea"],
@ -75,7 +22,7 @@
["0x000000000000000000000000ec4f34c97e43fbb2816cfd95e388353c7181dab1", "0x4e616d6552656700000000000000000000000000000000000000000000000000"],
["0x4655474156000000000000000000000000000000000000000000000000000000", "0x7ef9e639e2733cb34e4dfc576d4b23f72db776b2"],
["0x4e616d6552656700000000000000000000000000000000000000000000000000", "0xec4f34c97e43fbb2816cfd95e388353c7181dab1"],
["0x0000000000000000000000000000000000000000000000000000001234567890", ""],
["0x0000000000000000000000000000000000000000000000000000001234567890", null],
["0x000000000000000000000000697c7b8c961b56f675d570498424ac8de1a918f6", "0x6f6f6f6820736f2067726561742c207265616c6c6c793f000000000000000000"],
["0x6f6f6f6820736f2067726561742c207265616c6c6c793f000000000000000000", "0x697c7b8c961b56f675d570498424ac8de1a918f6"]
],

View File

@ -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" : "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" : {
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -21,8 +21,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -66,8 +66,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -110,8 +110,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -155,8 +155,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -200,8 +200,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -245,8 +245,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -290,8 +290,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -335,8 +335,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -380,8 +380,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -424,8 +424,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -468,8 +468,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -513,8 +513,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -558,8 +558,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -603,8 +603,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -648,8 +648,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -693,8 +693,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -738,8 +738,8 @@
"value" : "1000000000000000000"
},
"gas" : "9894",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -782,8 +782,8 @@
"value" : "1000000000000000000"
},
"gas" : "9894",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -826,8 +826,8 @@
"value" : "1000000000000000000"
},
"gas" : "9892",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -870,8 +870,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -915,8 +915,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -960,8 +960,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1005,8 +1005,8 @@
"value" : "1000000000000000000"
},
"gas" : "9894",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1049,8 +1049,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1094,8 +1094,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1138,8 +1138,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1183,8 +1183,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1228,8 +1228,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1273,8 +1273,8 @@
"value" : "1000000000000000000"
},
"gas" : "9894",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1317,8 +1317,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1362,8 +1362,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1406,8 +1406,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1451,8 +1451,8 @@
"value" : "1000000000000000000"
},
"gas" : "9697",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1496,8 +1496,8 @@
"value" : "1000000000000000000"
},
"gas" : "9897",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1540,8 +1540,8 @@
"value" : "1000000000000000000"
},
"gas" : "9897",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1584,8 +1584,8 @@
"value" : "1000000000000000000"
},
"gas" : "9895",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1628,8 +1628,8 @@
"value" : "1000000000000000000"
},
"gas" : "9895",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1672,8 +1672,8 @@
"value" : "1000000000000000000"
},
"gas" : "9695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1717,8 +1717,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1762,8 +1762,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1807,8 +1807,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1852,8 +1852,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1897,8 +1897,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1942,8 +1942,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1987,8 +1987,8 @@
"value" : "1000000000000000000"
},
"gas" : "9894",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2031,8 +2031,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2076,8 +2076,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2120,8 +2120,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2165,8 +2165,8 @@
"value" : "1000000000000000000"
},
"gas" : "9892",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2209,8 +2209,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2254,8 +2254,8 @@
"value" : "1000000000000000000"
},
"gas" : "9894",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2298,8 +2298,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2343,8 +2343,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2387,8 +2387,8 @@
"value" : "1000000000000000000"
},
"gas" : "9692",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2432,8 +2432,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2476,8 +2476,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2521,8 +2521,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2566,8 +2566,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2611,8 +2611,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2656,8 +2656,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -21,8 +21,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -66,8 +66,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -111,8 +111,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -156,8 +156,8 @@
"value" : "1000000000000000000"
},
"gas" : "9898",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -200,8 +200,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -245,8 +245,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -21,8 +21,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -66,8 +66,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
@ -111,8 +111,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999878",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -162,8 +162,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999678",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -207,8 +207,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999656",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -252,8 +252,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999656",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -304,8 +304,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999691",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -349,8 +349,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999691",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -394,8 +394,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999892",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -416,6 +416,94 @@
}
}
},
"calldatacopy_DataIndexTooHigh" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x60ff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600037600051600055",
"data" : "0x01234567890abcdef01234567890abcdef",
"gas" : "100000000000",
"gasPrice" : "1000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "99999999877",
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60ff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600037600051600055",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60ff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600037600051600055",
"nonce" : "0",
"storage" : {
}
}
}
},
"calldatacopy_DataIndexTooHigh2" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x60097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600037600051600055",
"data" : "0x01234567890abcdef01234567890abcdef",
"gas" : "100000000000",
"gasPrice" : "1000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "99999999891",
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600037600051600055",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600037600051600055",
"nonce" : "0",
"storage" : {
}
}
}
},
"calldataload0" : {
"callcreates" : [
],
@ -438,8 +526,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999697",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -483,8 +571,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999697",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -528,8 +616,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999697",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -551,6 +639,50 @@
}
}
},
"calldataloadSizeTooHigh" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa35600055",
"data" : "0x0123456789abcdef0000000000000000000000000000000000000000000000000024",
"gas" : "100000000000",
"gasPrice" : "1000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "99999999897",
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa35600055",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa35600055",
"nonce" : "0",
"storage" : {
}
}
}
},
"calldatasize0" : {
"callcreates" : [
],
@ -573,8 +705,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -618,8 +750,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -663,8 +795,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -708,8 +840,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -753,8 +885,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -798,8 +930,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999691",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -843,8 +975,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999691",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -866,6 +998,50 @@
}
}
},
"codecopy_DataIndexTooHigh" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x60087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600039600051600055",
"data" : "0x01234567890abcdef01234567890abcdef",
"gas" : "100000000000",
"gasPrice" : "1000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "99999999891",
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600039600051600055",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa600039600051600055",
"nonce" : "0",
"storage" : {
}
}
}
},
"codesize" : {
"callcreates" : [
],
@ -888,8 +1064,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -933,8 +1109,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999689",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -970,6 +1146,50 @@
}
}
},
"extcodecopy_DataIndexTooHigh" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x60087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa6000303c600051600055",
"data" : "0x01234567890abcdef01234567890abcdef",
"gas" : "100000000000",
"gasPrice" : "1000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "99999999890",
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa6000303c600051600055",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x60087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa6000303c600051600055",
"nonce" : "0",
"storage" : {
}
}
}
},
"extcodesize0" : {
"callcreates" : [
],
@ -992,8 +1212,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1051,8 +1271,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999697",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1110,8 +1330,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1155,8 +1375,8 @@
"value" : "1000000000000000000"
},
"gas" : "99999999698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -21,8 +21,8 @@
"value" : "1000000000000000000"
},
"gas" : "9695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -66,8 +66,8 @@
"value" : "1000000000000000000"
},
"gas" : "9688",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -111,8 +111,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -156,8 +156,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -230,8 +230,8 @@
"value" : "1000000000000000000"
},
"gas" : "9695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -275,8 +275,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -320,8 +320,8 @@
"value" : "1000000000000000000"
},
"gas" : "9693",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -423,8 +423,8 @@
"value" : "1000000000000000000"
},
"gas" : "9695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -468,8 +468,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -513,8 +513,8 @@
"value" : "1000000000000000000"
},
"gas" : "9695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -558,8 +558,8 @@
"value" : "1000000000000000000"
},
"gas" : "9997",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -602,8 +602,8 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -646,8 +646,8 @@
"value" : "1000000000000000000"
},
"gas" : "9892",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -719,8 +719,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -764,8 +764,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -809,8 +809,8 @@
"value" : "1000000000000000000"
},
"gas" : "9690",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -854,8 +854,8 @@
"value" : "1000000000000000000"
},
"gas" : "9688",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -899,8 +899,8 @@
"value" : "1000000000000000000"
},
"gas" : "9692",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -944,8 +944,8 @@
"value" : "1000000000000000000"
},
"gas" : "9690",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -989,8 +989,8 @@
"value" : "1000000000000000000"
},
"gas" : "10000",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1033,8 +1033,8 @@
"value" : "1000000000000000000"
},
"gas" : "9692",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1078,8 +1078,8 @@
"value" : "1000000000000000000"
},
"gas" : "9690",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1123,8 +1123,8 @@
"value" : "1000000000000000000"
},
"gas" : "10000",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1167,8 +1167,8 @@
"value" : "1000000000000000000"
},
"gas" : "9693",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1212,8 +1212,8 @@
"value" : "1000000000000000000"
},
"gas" : "9898",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1256,8 +1256,8 @@
"value" : "1000000000000000000"
},
"gas" : "9596",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1301,8 +1301,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1375,8 +1375,8 @@
"value" : "1000000000000000000"
},
"gas" : "9074",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1422,8 +1422,8 @@
"value" : "1000000000000000000"
},
"gas" : "9274",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1468,8 +1468,8 @@
"value" : "1000000000000000000"
},
"gas" : "8450",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -21,14 +21,15 @@
"value" : "1000000000000000000"
},
"gas" : "9966",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0x",
"topics" : [
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -129,14 +130,15 @@
"value" : "1000000000000000000"
},
"gas" : "9962",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0x",
"topics" : [
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -179,14 +181,15 @@
"value" : "1000000000000000000"
},
"gas" : "9930",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"topics" : [
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -229,14 +232,15 @@
"value" : "1000000000000000000"
},
"gas" : "9961",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0xaa",
"topics" : [
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -279,14 +283,15 @@
"value" : "1000000000000000000"
},
"gas" : "9961",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0xdd",
"topics" : [
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -329,15 +334,16 @@
"value" : "1000000000000000000"
},
"gas" : "9897",
"logs" : {
"00000000000008000000808100000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000008000000808100000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
"topics" : [
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -380,15 +386,16 @@
"value" : "1000000000000000000"
},
"gas" : "9897",
"logs" : {
"00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
"topics" : [
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -431,15 +438,16 @@
"value" : "1000000000000000000"
},
"gas" : "9933",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -540,15 +548,16 @@
"value" : "1000000000000000000"
},
"gas" : "9929",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -591,15 +600,16 @@
"value" : "1000000000000000000"
},
"gas" : "9897",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -642,15 +652,16 @@
"value" : "1000000000000000000"
},
"gas" : "9928",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xaa",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -693,15 +704,16 @@
"value" : "1000000000000000000"
},
"gas" : "9928",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xdd",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -744,16 +756,17 @@
"value" : "1000000000000000000"
},
"gas" : "9864",
"logs" : {
"00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -796,15 +809,17 @@
"value" : "1000000000000000000"
},
"gas" : "9864",
"logs" : {
"00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
"topics" : [
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -847,15 +862,17 @@
"value" : "1000000000000000000"
},
"gas" : "9900",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -956,15 +973,17 @@
"value" : "1000000000000000000"
},
"gas" : "9896",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1007,15 +1026,17 @@
"value" : "1000000000000000000"
},
"gas" : "9864",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1058,15 +1079,17 @@
"value" : "1000000000000000000"
},
"gas" : "9895",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xaa",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1109,15 +1132,17 @@
"value" : "1000000000000000000"
},
"gas" : "9895",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xdd",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1160,16 +1185,18 @@
"value" : "1000000000000000000"
},
"gas" : "9831",
"logs" : {
"00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1212,15 +1239,18 @@
"value" : "1000000000000000000"
},
"gas" : "9831",
"logs" : {
"00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
"topics" : [
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1263,17 +1293,18 @@
"value" : "1000000000000000000"
},
"gas" : "9831",
"logs" : {
"00003004000000000000800000000010000008000000000000000980000000000000000000000000000000000000000000001000000400000000000800000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00003004000000000000800000000010000008000000000000000980000000000000000000000000000000000000000000001000000400000000000800000000",
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000005",
"0000000000000000000000000000000000000000000000000000000000000007",
"0000000000000000000000000000000000000000000000000000000000000006",
"0000000000000000000000000000000000000000000000000000000000000007"
"0000000000000000000000000000000000000000000000000000000000000005"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1316,15 +1347,18 @@
"value" : "1000000000000000000"
},
"gas" : "9867",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1425,15 +1459,18 @@
"value" : "1000000000000000000"
},
"gas" : "9863",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1476,15 +1513,18 @@
"value" : "1000000000000000000"
},
"gas" : "9831",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1527,15 +1567,18 @@
"value" : "1000000000000000000"
},
"gas" : "9862",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xaa",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1578,15 +1621,18 @@
"value" : "1000000000000000000"
},
"gas" : "9862",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xdd",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1629,8 +1675,8 @@
"value" : "1000000000000000000"
},
"gas" : "10000",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1673,15 +1719,19 @@
"value" : "1000000000000000000"
},
"gas" : "9798",
"logs" : {
"00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
"topics" : [
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1724,8 +1774,8 @@
"value" : "1000000000000000000"
},
"gas" : "10000",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1768,15 +1818,19 @@
"value" : "1000000000000000000"
},
"gas" : "9834",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1877,15 +1931,19 @@
"value" : "1000000000000000000"
},
"gas" : "9830",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0x",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1928,15 +1986,19 @@
"value" : "1000000000000000000"
},
"gas" : "9798",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1979,15 +2041,19 @@
"value" : "1000000000000000000"
},
"gas" : "9829",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xaa",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2030,15 +2096,19 @@
"value" : "1000000000000000000"
},
"gas" : "9829",
"logs" : {
"00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000" : {
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
"data" : "0xdd",
"topics" : [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
]
}
},
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2058,5 +2128,63 @@
}
}
}
},
"log_2logs" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000a060106002a0",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9880",
"logs" : [
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"topics" : [
]
},
{
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
"data" : "0xffffffffffffffffffffffffffffffff",
"topics" : [
]
}
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000a060106002a0",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000a060106002a0",
"nonce" : "0",
"storage" : {
}
}
}
}
}

View File

@ -21,8 +21,8 @@
"value" : "1000000000000000000"
},
"gas" : "9697",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -66,8 +66,8 @@
"value" : "1000000000000000000"
},
"gas" : "9688",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -111,8 +111,8 @@
"value" : "1000000000000000000"
},
"gas" : "9687",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -156,8 +156,8 @@
"value" : "1000000000000000000"
},
"gas" : "9686",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -201,8 +201,8 @@
"value" : "1000000000000000000"
},
"gas" : "9685",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -246,8 +246,8 @@
"value" : "1000000000000000000"
},
"gas" : "9684",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -291,8 +291,8 @@
"value" : "1000000000000000000"
},
"gas" : "9683",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -336,8 +336,8 @@
"value" : "1000000000000000000"
},
"gas" : "9682",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -381,8 +381,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -455,8 +455,8 @@
"value" : "1000000000000000000"
},
"gas" : "9695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -500,8 +500,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -545,8 +545,8 @@
"value" : "1000000000000000000"
},
"gas" : "9693",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -590,8 +590,8 @@
"value" : "1000000000000000000"
},
"gas" : "9692",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -635,8 +635,8 @@
"value" : "1000000000000000000"
},
"gas" : "9691",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -680,8 +680,8 @@
"value" : "1000000000000000000"
},
"gas" : "9690",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -725,8 +725,8 @@
"value" : "1000000000000000000"
},
"gas" : "9689",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -770,8 +770,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -815,8 +815,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -860,8 +860,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -905,8 +905,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -950,8 +950,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -995,8 +995,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1040,8 +1040,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1085,8 +1085,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1130,8 +1130,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1175,8 +1175,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1220,8 +1220,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1265,8 +1265,8 @@
"value" : "1000000000000000000"
},
"gas" : "9999",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1309,8 +1309,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1354,8 +1354,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1399,8 +1399,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1444,8 +1444,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1489,8 +1489,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1534,8 +1534,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1579,8 +1579,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1624,8 +1624,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1669,8 +1669,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1714,8 +1714,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1759,8 +1759,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1804,8 +1804,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1849,8 +1849,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1894,8 +1894,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1939,8 +1939,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -1984,8 +1984,8 @@
"value" : "1000000000000000000"
},
"gas" : "9999",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"bbccddeeff00112233445566778899aabbccddee" : {
@ -2028,8 +2028,8 @@
"value" : "1000000000000000000"
},
"gas" : "9999",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2072,8 +2072,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2117,8 +2117,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2162,8 +2162,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2207,8 +2207,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2252,8 +2252,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2297,8 +2297,8 @@
"value" : "1000000000000000000"
},
"gas" : "9698",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2342,8 +2342,8 @@
"value" : "1000000000000000000"
},
"gas" : "9697",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2387,8 +2387,8 @@
"value" : "1000000000000000000"
},
"gas" : "9688",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2432,8 +2432,8 @@
"value" : "1000000000000000000"
},
"gas" : "9687",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2477,8 +2477,8 @@
"value" : "1000000000000000000"
},
"gas" : "9686",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2522,8 +2522,8 @@
"value" : "1000000000000000000"
},
"gas" : "9685",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2567,8 +2567,8 @@
"value" : "1000000000000000000"
},
"gas" : "9684",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2612,8 +2612,8 @@
"value" : "1000000000000000000"
},
"gas" : "9683",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2657,8 +2657,8 @@
"value" : "1000000000000000000"
},
"gas" : "9682",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2702,8 +2702,8 @@
"value" : "1000000000000000000"
},
"gas" : "9696",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2776,8 +2776,8 @@
"value" : "1000000000000000000"
},
"gas" : "9695",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2821,8 +2821,8 @@
"value" : "1000000000000000000"
},
"gas" : "9694",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2866,8 +2866,8 @@
"value" : "1000000000000000000"
},
"gas" : "9693",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2911,8 +2911,8 @@
"value" : "1000000000000000000"
},
"gas" : "9692",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -2956,8 +2956,8 @@
"value" : "1000000000000000000"
},
"gas" : "9691",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -3001,8 +3001,8 @@
"value" : "1000000000000000000"
},
"gas" : "9690",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -3046,8 +3046,8 @@
"value" : "1000000000000000000"
},
"gas" : "9689",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -20,9 +20,9 @@
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "99999999677",
"logs" : {
},
"gas" : "99999999687",
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -66,8 +66,8 @@
"value" : "1000000000000000000"
},
"gas" : "9676",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -111,8 +111,8 @@
"value" : "1000000000000000000"
},
"gas" : "9676",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {

View File

@ -27,8 +27,8 @@
"value" : "1000000000000000000"
},
"gas" : "9949",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -95,8 +95,8 @@
"value" : "1000000000000000000"
},
"gas" : "9824",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -145,8 +145,8 @@
"value" : "1000000000000000000"
},
"gas" : "9971",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
@ -189,8 +189,8 @@
"value" : "1000000000000000000"
},
"gas" : "9999",
"logs" : {
},
"logs" : [
],
"out" : "0x",
"post" : {
"cd1722f3947def4cf144679da39c4c32bdc35681" : {

View File

@ -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')
}
};

View File

@ -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
}
@ -67,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
@ -110,7 +110,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 +118,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 }

View File

@ -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"
)
@ -20,9 +21,21 @@ type Account struct {
}
type Log struct {
Address string
Data string
Topics []string
AddressF string `json:"address"`
DataF string `json:"data"`
TopicsF []string `json:"topics"`
BloomF string `json:"bloom"`
}
func (self Log) Address() []byte { return ethutil.Hex2Bytes(self.AddressF) }
func (self Log) Data() []byte { return ethutil.Hex2Bytes(self.DataF) }
func (self Log) RlpData() interface{} { return nil }
func (self Log) Topics() [][]byte {
t := make([][]byte, len(self.TopicsF))
for i, topic := range self.TopicsF {
t[i] = ethutil.Hex2Bytes(topic)
}
return t
}
func StateObjectFromAccount(addr string, account Account) *state.StateObject {
@ -53,7 +66,7 @@ type VmTest struct {
Env Env
Exec map[string]string
Transaction map[string]string
Logs map[string]Log
Logs []Log
Gas string
Out string
Post map[string]Account
@ -69,6 +82,9 @@ func RunVmTest(p string, t *testing.T) {
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...
@ -117,6 +133,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)
@ -128,15 +154,16 @@ func RunVmTest(p string, t *testing.T) {
}
if len(test.Logs) > 0 {
genBloom := ethutil.LeftPadBytes(types.LogsBloom(logs).Bytes(), 64)
// Logs within the test itself aren't correct, missing empty fields (32 0s)
for bloom /*logs*/, _ := range test.Logs {
if !bytes.Equal(genBloom, ethutil.Hex2Bytes(bloom)) {
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)) {
t.Errorf("bloom mismatch")
}
}
}
}
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.
@ -200,7 +227,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)
}

70
ui/qt/qwhisper/whisper.go Normal file
View File

@ -0,0 +1,70 @@
package qwhisper
import (
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/whisper"
)
func fromHex(s string) []byte {
if len(s) > 1 {
return ethutil.Hex2Bytes(s[2:])
}
return nil
}
func toHex(b []byte) string { return "0x" + ethutil.Bytes2Hex(b) }
type Whisper struct {
*whisper.Whisper
}
func New(w *whisper.Whisper) *Whisper {
return &Whisper{w}
}
func (self *Whisper) Post(data string, pow, ttl uint32, to, from string) {
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)),
})
if err != nil {
// handle error
return
}
if err := self.Whisper.Send(envelope); err != nil {
// handle error
return
}
}
func (self *Whisper) NewIdentity() string {
return toHex(self.Whisper.NewIdentity().D.Bytes())
}
func (self *Whisper) HasIdentify(key string) bool {
return self.Whisper.HasIdentity(crypto.ToECDSA(fromHex(key)))
}
func (self *Whisper) Watch(opts map[string]interface{}) {
filter := filterFromMap(opts)
filter.Fn = func(msg *whisper.Message) {
// TODO POST TO QT WINDOW
}
self.Whisper.Watch(filter)
}
func filterFromMap(opts map[string]interface{}) (f whisper.Filter) {
if to, ok := opts["to"].(string); ok {
f.To = crypto.ToECDSA(fromHex(to))
}
if from, ok := opts["from"].(string); ok {
f.From = crypto.ToECDSAPub(fromHex(from))
}
return
}

View File

@ -11,19 +11,29 @@ type Address interface {
Call(in []byte) []byte
}
type PrecompiledAddress struct {
Gas *big.Int
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{big.NewInt(500), ecrecoverFunc},
2: &PrecompiledAddress{big.NewInt(100), sha256Func},
3: &PrecompiledAddress{big.NewInt(100), ripemd160Func},
var Precompiled = map[string]*PrecompiledAccount{
string(ethutil.LeftPadBytes([]byte{1}, 20)): &PrecompiledAccount{func(l int) *big.Int {
return GasEcrecover
}, ecrecoverFunc},
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},
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
}, ripemd160Func},
}
func sha256Func(in []byte) []byte {

View File

@ -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)
return nil
}
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 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()
}

View File

@ -20,17 +20,24 @@ const (
var (
GasStep = big.NewInt(1)
GasSha = big.NewInt(20)
GasSha = big.NewInt(10)
GasSLoad = big.NewInt(20)
GasSStore = big.NewInt(100)
GasSStoreRefund = big.NewInt(100)
GasBalance = big.NewInt(20)
GasCreate = big.NewInt(100)
GasCall = big.NewInt(20)
GasCreateByte = big.NewInt(5)
GasSha3Byte = big.NewInt(10)
GasSha256Byte = big.NewInt(50)
GasRipemdByte = big.NewInt(50)
GasMemory = big.NewInt(1)
GasData = big.NewInt(5)
GasTx = big.NewInt(500)
GasLog = big.NewInt(32)
GasSha256 = big.NewInt(50)
GasRipemd = big.NewInt(50)
GasEcrecover = big.NewInt(500)
Pow256 = ethutil.BigPow(2, 256)
@ -41,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 {

View File

@ -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)
}

View File

@ -111,10 +111,10 @@ func NewMemory() *Memory {
return &Memory{nil}
}
func (m *Memory) Set(offset, size int64, value []byte) {
func (m *Memory) Set(offset, size uint64, value []byte) {
if len(value) > 0 {
totSize := offset + size
lenSize := int64(len(m.store) - 1)
lenSize := uint64(len(m.store) - 1)
if totSize > lenSize {
// Calculate the diff between the sizes
diff := totSize - lenSize

View File

@ -5,7 +5,6 @@ import "math/big"
type VirtualMachine interface {
Env() Environment
Run(me, caller ClosureRef, code []byte, value, gas, price *big.Int, data []byte) ([]byte, error)
Depth() int
Printf(string, ...interface{}) VirtualMachine
Endl() VirtualMachine
}

View File

@ -21,7 +21,7 @@ func New(env Environment, typ Type) VirtualMachine {
}
func (self *Vm) Run(me, caller ClosureRef, code []byte, value, gas, price *big.Int, data []byte) (ret []byte, err error) {
return nil, nil
panic("not implemented")
}
func (self *Vm) Env() Environment {

View File

@ -2,6 +2,7 @@ package vm
import (
"fmt"
"math"
"math/big"
"github.com/ethereum/go-ethereum/crypto"
@ -25,8 +26,6 @@ type DebugVm struct {
Fn string
Recoverable bool
depth int
}
func NewDebugVm(env Environment) *DebugVm {
@ -50,10 +49,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 {
@ -98,7 +95,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
} else {
nop := OpCode(closure.GetOp(p))
if !(nop == JUMPDEST || destinations[from] != nil) {
panic(fmt.Sprintf("JUMP missed JUMPDEST (%v) %v", nop, p))
panic(fmt.Sprintf("invalid jump destination (%v) %v", nop, p))
} else if nop == JUMP || nop == JUMPI {
panic(fmt.Sprintf("not allowed to JUMP(I) in to JUMP"))
}
@ -111,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 gas: %v (d) %x\n", self.depth, closure.Address(), closure.Gas, callData)
for {
prevStep = step
// The base for all big integer arithmetic
@ -137,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
@ -166,13 +164,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
case EXP:
require(2)
exp := new(big.Int).Set(stack.data[stack.Len()-2])
nbytes := 0
for exp.Cmp(ethutil.Big0) > 0 {
nbytes += 1
exp.Rsh(exp, 8)
}
gas.Set(big.NewInt(int64(nbytes + 1)))
gas.Set(big.NewInt(int64(len(stack.data[stack.Len()-2].Bytes()) + 1)))
// Gas only
case STOP:
gas.Set(ethutil.Big0)
@ -190,16 +182,16 @@ 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 := 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 {
statedb.Refund(closure.caller.Address(), GasSStoreRefund, closure.Price)
} else if len(val) > 0 && len(y.Bytes()) == 0 {
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))
@ -222,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)
@ -254,17 +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 {
// Additional gas usage on *CODPY
case CALLDATACOPY, CODECOPY, EXTCODECOPY:
addStepGasUsage(new(big.Int).Div(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)
@ -614,10 +614,10 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
self.Printf(" => %d", l)
case CALLDATACOPY:
var (
size = int64(len(callData))
mOff = stack.Pop().Int64()
cOff = stack.Pop().Int64()
l = stack.Pop().Int64()
size = uint64(len(callData))
mOff = stack.Pop().Uint64()
cOff = stack.Pop().Uint64()
l = stack.Pop().Uint64()
)
if cOff > size {
@ -649,32 +649,29 @@ 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
}
var (
size = int64(len(code))
mOff = stack.Pop().Int64()
cOff = stack.Pop().Int64()
l = stack.Pop().Int64()
size = uint64(len(code))
mOff = stack.Pop().Uint64()
cOff = stack.Pop().Uint64()
l = stack.Pop().Uint64()
)
if cOff > size {
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]
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)
@ -719,8 +716,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
@ -728,7 +724,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:
@ -744,12 +740,12 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
case LOG0, LOG1, LOG2, LOG3, LOG4:
n := int(op - LOG0)
topics := make([][]byte, n)
mSize, mStart := stack.Pop().Int64(), stack.Pop().Int64()
data := mem.Geti(mStart, mSize)
mSize, mStart := stack.Popn()
for i := 0; i < n; i++ {
topics[i] = ethutil.LeftPadBytes(stack.Pop().Bytes(), 32)
}
data := mem.Geti(mStart.Int64(), mSize.Int64())
log := &Log{closure.Address(), topics, data}
self.env.AddLog(log)
@ -763,7 +759,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
case MSTORE: // Store the value at stack top-1 in to memory at location stack top
// Pop value of the stack
val, mStart := stack.Popn()
mem.Set(mStart.Int64(), 32, ethutil.BigToBytes(val, 256))
mem.Set(mStart.Uint64(), 32, ethutil.BigToBytes(val, 256))
self.Printf(" => 0x%x", val)
case MSTORE8:
@ -783,10 +779,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:
@ -839,8 +832,13 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
self.Printf("CREATE err %v", err)
} else {
ref.SetCode(ret)
msg.Output = ret
// gas < len(ret) * CreateDataGas == NO_CODE
dataGas := big.NewInt(int64(len(ret)))
dataGas.Mul(dataGas, GasCreateByte)
if closure.UseGas(dataGas) {
ref.SetCode(ret)
msg.Output = ret
}
stack.Push(ethutil.BigD(addr))
}
@ -865,14 +863,16 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
// Get the arguments from the memory
args := mem.Get(inOffset.Int64(), inSize.Int64())
var executeAddr []byte
var (
ret []byte
err error
)
if op == CALLCODE {
executeAddr = closure.Address()
ret, err = self.env.CallCode(closure, addr.Bytes(), args, gas, price, value)
} else {
executeAddr = addr.Bytes()
ret, err = self.env.Call(closure, addr.Bytes(), args, gas, price, value)
}
ret, err := self.env.Call(closure, executeAddr, args, gas, price, value)
if err != nil {
stack.Push(ethutil.BigFalse)
@ -881,9 +881,9 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
stack.Push(ethutil.BigTrue)
msg.Output = ret
mem.Set(retOffset.Int64(), retSize.Int64(), ret)
mem.Set(retOffset.Uint64(), retSize.Uint64(), ret)
}
self.Printf("resume %x", closure.Address())
self.Printf("resume %x (%v)", closure.Address(), closure.Gas)
// Debug hook
if self.Dbg != nil {
@ -894,14 +894,16 @@ 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:
receiver := statedb.GetOrNewStateObject(stack.Pop().Bytes())
balance := statedb.GetBalance(closure.Address())
receiver.AddAmount(statedb.GetBalance(closure.Address()))
self.Printf(" => (%x) %v", receiver.Address()[:4], balance)
receiver.AddAmount(balance)
statedb.Delete(closure.Address())
fallthrough
@ -912,7 +914,6 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
default:
vmlogger.Debugf("(pc) %-3v Invalid opcode %x\n", pc, op)
//panic(fmt.Sprintf("Invalid opcode %x", op))
closure.ReturnGas(big.NewInt(1), nil)
return closure.Return(nil), fmt.Errorf("Invalid opcode %x", op)
@ -941,6 +942,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...)
@ -961,7 +981,3 @@ func (self *DebugVm) Endl() VirtualMachine {
func (self *DebugVm) Env() Environment {
return self.env
}
func (self *DebugVm) Depth() int {
return self.depth
}

View File

@ -1,181 +1,3 @@
package vm
import (
"fmt"
"io/ioutil"
"log"
"math/big"
"os"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/trie"
checker "gopkg.in/check.v1"
// "github.com/obscuren/mutan"
)
type VmSuite struct{}
var _ = checker.Suite(&VmSuite{})
var big9 = ethutil.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000009")
const mutcode = `
var x = 0;
for i := 0; i < 10; i++ {
x = i
}
return x`
type TestEnv struct{}
func (TestEnv) Origin() []byte { return nil }
func (TestEnv) BlockNumber() *big.Int { return nil }
func (TestEnv) BlockHash() []byte { return nil }
func (TestEnv) PrevHash() []byte { return nil }
func (TestEnv) Coinbase() []byte { return nil }
func (TestEnv) Time() int64 { return 0 }
func (TestEnv) GasLimit() *big.Int { return nil }
func (TestEnv) Difficulty() *big.Int { return nil }
func (TestEnv) Value() *big.Int { return nil }
func (TestEnv) AddLog(*state.Log) {}
func (TestEnv) Transfer(from, to Account, amount *big.Int) error {
return nil
}
// This is likely to fail if anything ever gets looked up in the state trie :-)
func (TestEnv) State() *state.State {
return state.New(trie.New(nil, ""))
}
func setup(level logger.LogLevel, typ Type) (*Closure, VirtualMachine) {
code, err := ethutil.Compile(mutcode, true)
if err != nil {
log.Fatal(err)
}
// Pipe output to /dev/null
logger.AddLogSystem(logger.NewStdLogSystem(ioutil.Discard, log.LstdFlags, level))
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'})
callerClosure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0))
return callerClosure, New(TestEnv{}, typ)
}
func (s *VmSuite) TestDebugVm(c *checker.C) {
// if mutan.Version < "0.6" {
// t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
// }
closure, vm := setup(logger.DebugLevel, DebugVmTy)
ret, _, e := closure.Call(vm, nil)
c.Assert(e, checker.NotNil)
c.Skip("Depends on mutan")
c.Assert(ret, checker.DeepEquals, big9)
}
func (s *VmSuite) TestVm(c *checker.C) {
// if mutan.Version < "0.6" {
// t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
// }
closure, vm := setup(logger.DebugLevel, StandardVmTy)
ret, _, e := closure.Call(vm, nil)
c.Assert(e, checker.NotNil)
c.Skip("Depends on mutan")
c.Assert(ret, checker.DeepEquals, big9)
}
func (s *VmSuite) BenchmarkDebugVm(c *checker.C) {
closure, vm := setup(logger.InfoLevel, StandardVmTy)
c.ResetTimer()
for i := 0; i < c.N; i++ {
closure.Call(vm, nil)
}
}
func (s *VmSuite) BenchmarkVm(c *checker.C) {
closure, vm := setup(logger.InfoLevel, DebugVmTy)
c.ResetTimer()
for i := 0; i < c.N; i++ {
closure.Call(vm, nil)
}
}
func RunCode(mutCode string, typ Type) []byte {
code, err := ethutil.Compile(mutCode, true)
if err != nil {
log.Fatal(err)
}
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel))
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'})
closure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0))
vm := New(TestEnv{}, typ)
ret, _, e := closure.Call(vm, nil)
if e != nil {
fmt.Println(e)
}
return ret
}
func (s *VmSuite) TestBuildInSha256(c *checker.C) {
ret := RunCode(`
var in = 42
var out = 0
call(0x2, 0, 10000, in, out)
return out
`, DebugVmTy)
exp := crypto.Sha256(ethutil.LeftPadBytes([]byte{42}, 32))
c.Skip("Depends on mutan")
c.Assert(ret, checker.DeepEquals, exp)
}
func (s *VmSuite) TestBuildInRipemd(c *checker.C) {
ret := RunCode(`
var in = 42
var out = 0
call(0x3, 0, 10000, in, out)
return out
`, DebugVmTy)
exp := ethutil.RightPadBytes(crypto.Ripemd160(ethutil.LeftPadBytes([]byte{42}, 32)), 32)
c.Skip("Depends on mutan")
c.Assert(ret, checker.DeepEquals, exp)
}
func (s *VmSuite) TestOog(c *checker.C) {
// This tests takes a long time and will eventually run out of gas
// t.Skip()
c.Skip("This tests takes a long time and will eventually run out of gas")
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel))
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'})
closure := NewClosure(nil, stateObject, stateObject, ethutil.Hex2Bytes("60ff60ff600057"), big.NewInt(1000000), big.NewInt(0))
vm := New(TestEnv{}, DebugVmTy)
_, _, e := closure.Call(vm, nil)
if e != nil {
fmt.Println(e)
}
}
// Tests have been removed in favour of general tests. If anything implementation specific needs testing, put it here

121
whisper/envelope.go Normal file
View File

@ -0,0 +1,121 @@
package whisper
import (
"bytes"
"crypto/ecdsa"
"encoding/binary"
"fmt"
"io"
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/rlp"
)
const (
DefaultPow = 50 * time.Millisecond
)
type Envelope struct {
Expiry uint32 // Whisper protocol specifies int32, really should be int64
Ttl uint32 // ^^^^^^
Topics [][]byte
Data []byte
Nonce uint32
hash Hash
}
func NewEnvelopeFromReader(reader io.Reader) (*Envelope, error) {
var envelope Envelope
buf := new(bytes.Buffer)
buf.ReadFrom(reader)
h := H(crypto.Sha3(buf.Bytes()))
if err := rlp.Decode(buf, &envelope); err != nil {
return nil, err
}
envelope.hash = h
return &envelope, nil
}
func (self *Envelope) Hash() Hash {
if self.hash == EmptyHash {
self.hash = H(crypto.Sha3(ethutil.Encode(self)))
}
return self.hash
}
func NewEnvelope(ttl time.Duration, topics [][]byte, data *Message) *Envelope {
exp := time.Now().Add(ttl)
return &Envelope{uint32(exp.Unix()), uint32(ttl.Seconds()), topics, data.Bytes(), 0, Hash{}}
}
func (self *Envelope) Seal(pow time.Duration) {
self.proveWork(pow)
}
func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error) {
data := self.Data
var message Message
dataStart := 1
if data[0] > 0 {
if len(data) < 66 {
return nil, fmt.Errorf("unable to open envelope. First bit set but len(data) < 66")
}
dataStart = 66
message.Flags = data[0]
message.Signature = data[1:66]
}
message.Payload = data[dataStart:]
if prv != nil {
message.Payload, err = crypto.Decrypt(prv, message.Payload)
if err != nil {
return nil, fmt.Errorf("unable to open envelope. Decrypt failed: %v", err)
}
}
return &message, nil
}
func (self *Envelope) proveWork(dura time.Duration) {
var bestBit int
d := make([]byte, 64)
copy(d[:32], ethutil.Encode(self.withoutNonce()))
then := time.Now().Add(dura).UnixNano()
for n := uint32(0); time.Now().UnixNano() < then; {
for i := 0; i < 1024; i++ {
binary.BigEndian.PutUint32(d[60:], n)
fbs := ethutil.FirstBitSet(ethutil.BigD(crypto.Sha3(d)))
if fbs > bestBit {
bestBit = fbs
self.Nonce = n
}
n++
}
}
}
func (self *Envelope) valid() bool {
d := make([]byte, 64)
copy(d[:32], ethutil.Encode(self.withoutNonce()))
binary.BigEndian.PutUint32(d[60:], self.Nonce)
return ethutil.FirstBitSet(ethutil.BigD(crypto.Sha3(d))) > 0
}
func (self *Envelope) withoutNonce() interface{} {
return []interface{}{self.Expiry, self.Ttl, ethutil.ByteSliceToInterface(self.Topics), self.Data}
}
func (self *Envelope) RlpData() interface{} {
return []interface{}{self.Expiry, self.Ttl, ethutil.ByteSliceToInterface(self.Topics), self.Data, self.Nonce}
}

10
whisper/filter.go Normal file
View File

@ -0,0 +1,10 @@
package whisper
import "crypto/ecdsa"
type Filter struct {
To *ecdsa.PrivateKey
From *ecdsa.PublicKey
Topics [][]byte
Fn func(*Message)
}

Some files were not shown because too many files have changed in this diff Show More