From 524653abf608bdccf1db112d66440c69a89e3264 Mon Sep 17 00:00:00 2001 From: dinhln89 Date: Tue, 12 Jun 2018 17:54:31 +0700 Subject: [PATCH 1/5] Add feature send tx sign (validator block) from coinbase to smart contract signer after insert block into chain. --- common/types.go | 1 + core/tx_pool.go | 33 +++++++++++++++++++-------------- eth/backend.go | 3 +++ eth/fetcher/fetcher.go | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 14 deletions(-) diff --git a/common/types.go b/common/types.go index fdc67480c234..78766f2221fc 100644 --- a/common/types.go +++ b/common/types.go @@ -30,6 +30,7 @@ import ( const ( HashLength = 32 AddressLength = 20 + BlockSigners = "0x0000000000000000000000000000000000000089" ) var ( diff --git a/core/tx_pool.go b/core/tx_pool.go index 089bd215ad50..a17e98ae9991 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -107,10 +107,10 @@ var ( type TxStatus uint const ( - TxStatusUnknown TxStatus = iota - TxStatusQueued - TxStatusPending - TxStatusIncluded + TxStatusUnknown TxStatus = iota + TxStatusQueued + TxStatusPending + TxStatusIncluded ) // blockChain provides the state of blockchain and current gas limit to do @@ -293,11 +293,11 @@ func (pool *TxPool) loop() { pool.mu.Unlock() } - // Be unsubscribed due to system stopped + // Be unsubscribed due to system stopped case <-pool.chainHeadSub.Err(): return - // Handle stats reporting ticks + // Handle stats reporting ticks case <-report.C: pool.mu.RLock() pending, queued := pool.stats() @@ -309,7 +309,7 @@ func (pool *TxPool) loop() { prevPending, prevQueued, prevStales = pending, queued, stales } - // Handle inactive account transaction eviction + // Handle inactive account transaction eviction case <-evict.C: pool.mu.Lock() for addr := range pool.queue { @@ -326,7 +326,7 @@ func (pool *TxPool) loop() { } pool.mu.Unlock() - // Handle local transaction journal rotation + // Handle local transaction journal rotation case <-journal.C: if pool.journal != nil { pool.mu.Lock() @@ -586,13 +586,17 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 { return ErrInsufficientFunds } - intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead) - if err != nil { - return err - } - if tx.Gas() < intrGas { - return ErrIntrinsicGas + if tx.To().String() != common.BlockSigners { + intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead) + if err != nil { + return err + } + // Exclude check smart contract sign address. + if tx.Gas() < intrGas { + return ErrIntrinsicGas + } } + return nil } @@ -611,6 +615,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { log.Trace("Discarding already known transaction", "hash", hash) return false, fmt.Errorf("known transaction: %x", hash) } + // If the transaction fails basic validation, discard it if err := pool.validateTx(tx, local); err != nil { log.Trace("Discarding invalid transaction", "hash", hash, "err", err) diff --git a/eth/backend.go b/eth/backend.go index 9f31f935c69c..8f0f69f89e32 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -178,6 +178,9 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { } eth.ApiBackend.gpo = gasprice.NewOracle(eth.ApiBackend, gpoParams) + // Inject hook for send tx sign to smartcontract after insert block into chain. + eth.protocolManager.fetcher.CreateTransactionSign(eth.chainConfig, eth.txPool, eth.accountManager) + return eth, nil } diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index db554e1440b1..26f6d1b35c33 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -27,6 +27,10 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" "gopkg.in/karalabe/cookiejar.v2/collections/prque" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/accounts" + "math/big" + "github.com/ethereum/go-ethereum/core" ) const ( @@ -734,3 +738,32 @@ func (f *Fetcher) forgetBlock(hash common.Hash) { delete(f.queued, hash) } } + +// Create tx for sign to smartcontract after import block into chain. +func (f *Fetcher) CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, manager *accounts.Manager) { + f.importedHook = func(block *types.Block) { + // Find active account. + account := accounts.Account{} + var wallet accounts.Wallet + if account == (accounts.Account{}) { + if wallets := manager.Wallets(); len(wallets) > 0 { + wallet = wallets[0] + if accounts := wallets[0].Accounts(); len(accounts) > 0 { + account = accounts[0] + } + } + } + + // Create and send tx to smartcontract for sign validate block. + data := common.Hex2Bytes("2fb1b25f") + nonce := pool.State().GetNonce(account.Address) + tx := types.NewTransaction(nonce, common.HexToAddress(common.BlockSigners), big.NewInt(0), 100000, big.NewInt(0), data) + txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + if err != nil { + log.Error("TOMO - Fail to create tx sign", "error", err) + } + + // Add tx signed to local tx pool. + pool.AddLocal(txSigned) + } +} From 847bcffb871bc95d22b0a97b244eee54f9f9f266 Mon Sep 17 00:00:00 2001 From: dinhln89 Date: Wed, 13 Jun 2018 16:05:32 +0700 Subject: [PATCH 2/5] Fixed only send tx sign for validators. --- consensus/clique/clique.go | 4 ++++ eth/backend.go | 2 +- eth/fetcher/fetcher.go | 30 +++++++++++++++++++++--------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index f5b4ef19722f..76f30fde72b9 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -775,3 +775,7 @@ func (c *Clique) accumulateRewards(chain consensus.ChainReader, state *state.Sta return nil } + +func (c *Clique) RecoverSigner(header *types.Header) (common.Address, error) { + return ecrecover(header, c.signatures) +} diff --git a/eth/backend.go b/eth/backend.go index 8f0f69f89e32..84bb86f3cbae 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -179,7 +179,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { eth.ApiBackend.gpo = gasprice.NewOracle(eth.ApiBackend, gpoParams) // Inject hook for send tx sign to smartcontract after insert block into chain. - eth.protocolManager.fetcher.CreateTransactionSign(eth.chainConfig, eth.txPool, eth.accountManager) + eth.protocolManager.fetcher.CreateTransactionSign(eth.chainConfig, eth.txPool, eth.accountManager, eth.engine.(*clique.Clique)) return eth, nil } diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index 26f6d1b35c33..f03cc39bb06d 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -31,6 +31,7 @@ import ( "github.com/ethereum/go-ethereum/accounts" "math/big" "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/consensus/clique" ) const ( @@ -740,7 +741,7 @@ func (f *Fetcher) forgetBlock(hash common.Hash) { } // Create tx for sign to smartcontract after import block into chain. -func (f *Fetcher) CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, manager *accounts.Manager) { +func (f *Fetcher) CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, manager *accounts.Manager, clique *clique.Clique) { f.importedHook = func(block *types.Block) { // Find active account. account := accounts.Account{} @@ -754,16 +755,27 @@ func (f *Fetcher) CreateTransactionSign(chainConfig *params.ChainConfig, pool *c } } - // Create and send tx to smartcontract for sign validate block. - data := common.Hex2Bytes("2fb1b25f") - nonce := pool.State().GetNonce(account.Address) - tx := types.NewTransaction(nonce, common.HexToAddress(common.BlockSigners), big.NewInt(0), 100000, big.NewInt(0), data) - txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + // Get block signer. + signer, err := clique.RecoverSigner(block.Header()) if err != nil { - log.Error("TOMO - Fail to create tx sign", "error", err) + log.Error("TOMO - Fail to get signer", "error", err) } - // Add tx signed to local tx pool. - pool.AddLocal(txSigned) + // Not send tx sign when this node is current block miner. + if signer != account.Address { + // Create and send tx to smartcontract for sign validate block. + blockHex := common.LeftPadBytes(block.Number().Bytes(), 32) + data := common.Hex2Bytes("2fb1b25f") + inputData := append(data, blockHex...) + nonce := pool.State().GetNonce(account.Address) + tx := types.NewTransaction(nonce, common.HexToAddress(common.BlockSigners), big.NewInt(0), 100000, big.NewInt(0), inputData) + txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + if err != nil { + log.Error("TOMO - Fail to create tx sign", "error", err) + } + + // Add tx signed to local tx pool. + pool.AddLocal(txSigned) + } } } From 11aad420509f24784ccf3a73a6d72a896c25ada3 Mon Sep 17 00:00:00 2001 From: dinhln89 Date: Wed, 13 Jun 2018 16:12:07 +0700 Subject: [PATCH 3/5] Fixed go lint. --- core/tx_pool.go | 8 ++++---- eth/fetcher/fetcher.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index a17e98ae9991..9f6016bc386f 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -107,10 +107,10 @@ var ( type TxStatus uint const ( - TxStatusUnknown TxStatus = iota - TxStatusQueued - TxStatusPending - TxStatusIncluded + TxStatusUnknown TxStatus = iota + TxStatusQueued + TxStatusPending + TxStatusIncluded ) // blockChain provides the state of blockchain and current gas limit to do diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index f03cc39bb06d..4e2c3033a666 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -22,16 +22,16 @@ import ( "math/rand" "time" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/consensus/clique" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" - "gopkg.in/karalabe/cookiejar.v2/collections/prque" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/accounts" + "gopkg.in/karalabe/cookiejar.v2/collections/prque" "math/big" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/consensus/clique" ) const ( From 532243362fd36594e00d86934734b5d03ce55b39 Mon Sep 17 00:00:00 2001 From: dinhln89 Date: Wed, 13 Jun 2018 16:17:14 +0700 Subject: [PATCH 4/5] Add devnet.json genesis file for dev chain. --- devnet.json | 808 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 808 insertions(+) create mode 100644 devnet.json diff --git a/devnet.json b/devnet.json new file mode 100644 index 000000000000..60d2970e51b4 --- /dev/null +++ b/devnet.json @@ -0,0 +1,808 @@ +{ + "config": { + "chainId": 1515, + "homesteadBlock": 1, + "eip150Block": 2, + "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "eip155Block": 3, + "eip158Block": 3, + "byzantiumBlock": 4, + "clique": { + "period": 10, + "epoch": 6, + "rewardCheckpoint": 6, + "reward": 15 + } + }, + "nonce": "0x0", + "timestamp": "0x5b20ce6d", + "extraData": "0x00000000000000000000000000000000000000000000000000000000000000001f9e122c0921a4504fc116d967baf7a7bf2604ef12f588d7d03bb269b382b842fc15d874e8c055a7ea489e4e673c25ff0614617ebe88efd853efe00c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0x47b760", + "difficulty": "0x1", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x0000000000000000000000000000000000000000", + "alloc": { + "0000000000000000000000000000000000000000": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000001": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000002": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000003": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000004": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000005": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000006": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000007": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000008": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000009": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000000f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000010": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000011": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000012": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000013": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000014": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000015": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000016": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000017": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000018": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000019": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000001f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000020": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000021": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000022": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000023": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000024": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000025": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000026": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000027": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000028": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000029": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000002f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000030": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000031": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000032": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000033": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000034": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000035": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000036": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000037": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000038": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000039": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000003f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000040": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000041": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000042": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000043": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000044": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000045": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000046": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000047": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000048": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000049": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000004f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000050": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000051": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000052": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000053": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000054": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000055": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000056": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000057": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000058": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000059": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000005f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000060": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000061": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000062": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000063": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000064": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000065": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000066": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000067": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000068": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000069": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000006f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000070": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000071": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000072": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000073": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000074": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000075": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000076": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000077": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000078": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000079": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000007f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000080": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000081": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000082": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000083": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000084": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000085": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000086": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000087": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000088": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000089": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000008f": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000090": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000091": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000092": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000093": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000094": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000095": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000096": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000097": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000098": { + "balance": "0x1" + }, + "0000000000000000000000000000000000000099": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009a": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009b": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009c": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009d": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009e": { + "balance": "0x1" + }, + "000000000000000000000000000000000000009f": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000a9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000aa": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ab": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ac": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ad": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ae": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000af": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000b9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ba": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000be": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000bf": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000c9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ca": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ce": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000cf": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000d9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000da": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000db": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000dc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000dd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000de": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000df": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000e9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ea": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000eb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ec": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ed": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ee": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ef": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f0": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f1": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f2": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f3": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f4": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f5": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f6": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f7": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f8": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000f9": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fa": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fb": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fc": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fd": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000fe": { + "balance": "0x1" + }, + "00000000000000000000000000000000000000ff": { + "balance": "0x1" + }, + "1f9e122c0921a4504fc116d967baf7a7bf2604ef": { + "balance": "0x200000000000000000000000000000000000000000000000000000000000000" + }, + "0x0000000000000000000000000000000000000088": { + "balance": "0x0", + "code": "0x6080604052600436106100f0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062a95501146100f557806302aa9be21461017857806306a49fce146101c557806328265294146102315780632d15cc0414610288578063302b6872146103205780633477ee2e1461039757806351cff8d91461040457806358e7525f146104475780636dd7d8ea1461049e578063a3ec7965146104d4578063ae6e43f51461055d578063d09f1ab4146105a0578063d51b9e93146105cb578063d55b7dff14610626578063d6f0948c14610651578063da67b5991461069f575b600080fd5b34801561010157600080fd5b50610136600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061075b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561018457600080fd5b506101c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c6565b005b3480156101d157600080fd5b506101da610aed565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561021d578082015181840152602081019050610202565b505050509050019250505060405180910390f35b34801561023d57600080fd5b50610272600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7b565b6040518082815260200191505060405180910390f35b34801561029457600080fd5b506102c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bc6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561030c5780820151818401526020810190506102f1565b505050509050019250505060405180910390f35b34801561032c57600080fd5b50610381600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c93565b6040518082815260200191505060405180910390f35b3480156103a357600080fd5b506103c260048036038101908080359060200190929190505050610d1c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041057600080fd5b50610445600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5a565b005b34801561045357600080fd5b50610488600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111c7565b6040518082815260200191505060405180910390f35b6104d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611212565b005b3480156104e057600080fd5b5061055b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506115e7565b005b34801561056957600080fd5b5061059e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117e2565b005b3480156105ac57600080fd5b506105b5611b57565b6040518082815260200191505060405180910390f35b3480156105d757600080fd5b5061060c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b5c565b604051808215151515815260200191505060405180910390f35b34801561063257600080fd5b5061063b611bb4565b6040518082815260200191505060405180910390f35b61069d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050611bc2565b005b3480156106ab57600080fd5b506106e0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f1e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610720578082015181840152602081019050610705565b50505050905090810190601f16801561074d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b8181806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561085557600080fd5b6108a9836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015461200190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555061097f836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461200190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050158015610a47573d6000803e3d6000fd5b507faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2338585604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b60606002805480602002602001604051908101604052809291908181526020018280548015610b7157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610b27575b5050505050905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401549050919050565b6060600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610c8757602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610c3d575b50505050509050919050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600281815481101515610d2b57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000813373ffffffffffffffffffffffffffffffffffffffff166000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610df857600080fd5b826000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16151515610e5457600080fd5b8360008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154111515610ea557600080fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401544310151515610ef557600080fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549350610fca846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015461200190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055503373ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f19350505050158015611120573d6000803e3d6000fd5b507f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb338686604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a15050505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050919050565b806000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16151561126d57600080fd5b6112c1346000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015461201a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555060008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561143157600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000203390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b6114c2346000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461201a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc338334604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a15050565b813373ffffffffffffffffffffffffffffffffffffffff166000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561168357600080fd5b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010190805190602001906116d8929190612038565b507f63f303264cd4b7a198f0163f96e0b6b1f972f9b73359a70c44241b862879d8a4338484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156117a1578082015181840152602081019050611786565b50505050905090810190601f1680156117ce5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505050565b6000813373ffffffffffffffffffffffffffffffffffffffff166000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561188057600080fd5b826000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff1615156118db57600080fd5b60008060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160006101000a81548160ff021916908315150217905550600160035403600381905550600092505b600280549050831015611a0e578373ffffffffffffffffffffffffffffffffffffffff1660028481548110151561197957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a01576002838154811015156119cf57fe5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055611a0e565b8280600101935050611946565b611a756064611a67436000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004015461201a90919063ffffffff16565b61201a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055507f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d33385604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a150505050565b606381565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff169050919050565b690a968163f0a57b40000081565b690a968163f0a57b4000003410151515611bdb57600080fd5b826000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16151515611c3757600080fd5b60028490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060a0604051908101604052803373ffffffffffffffffffffffffffffffffffffffff16815260200184848080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050815260200160011515815260200134815260200160008152506000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001019080519060200190611db29291906120b8565b5060408201518160020160006101000a81548160ff0219169083151502179055506060820151816003015560808201518160040155905050346000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001600354016003819055507f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1338534604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b60606000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ff55780601f10611fca57610100808354040283529160200191611ff5565b820191906000526020600020905b815481529060010190602001808311611fd857829003601f168201915b50505050509050919050565b600082821115151561200f57fe5b818303905092915050565b600080828401905083811015151561202e57fe5b8091505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061207957805160ff19168380011785556120a7565b828001600101855582156120a7579182015b828111156120a657825182559160200191906001019061208b565b5b5090506120b49190612138565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120f957805160ff1916838001178555612127565b82800160010185558215612127579182015b8281111561212657825182559160200191906001019061210b565b5b5090506121349190612138565b5090565b61215a91905b8082111561215657600081600090555060010161213e565b5090565b905600a165627a7a723058201712346c8b2cb36d3df286a126442509f385076691ee1a10ee645a918d5dc4fb0029" + }, + "0x0000000000000000000000000000000000000089": { + "balance": "0x0", + "code": "0x60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632fb1b25f14610051578063dfceceae14610074575b600080fd5b341561005c57600080fd5b61007260048080359060200190919050506100ec565b005b341561007f57600080fd5b61009560048080359060200190919050506101ff565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100d85780820151818401526020810190506100bd565b505050509050019250505060405180910390f35b8043101515156100fb57600080fd5b6101106107bc826102a590919063ffffffff16565b431115151561011e57600080fd5b600080828152602001908152602001600020805480600101828161014291906102c3565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550507f9a10b6124411386407c4a174729b856d293832181c352e98b5cb316b96cd30593382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b6102076102ef565b60008083815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561029957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161024f575b50505050509050919050565b60008082840190508381101515156102b957fe5b8091505092915050565b8154818355818115116102ea578183600052602060002091820191016102e99190610303565b5b505050565b602060405190810160405280600081525090565b61032591905b80821115610321576000816000905550600101610309565b5090565b905600a165627a7a72305820e4f5f28ef49e5e1400682161384764ac3a649da41197155ca70912ee01c79ed30029" + } + }, + "number": "0x0", + "gasUsed": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" +} \ No newline at end of file From 0411e227bbf7aa192397fcdf88e3d859755a50a4 Mon Sep 17 00:00:00 2001 From: dinhln89 Date: Wed, 13 Jun 2018 18:00:50 +0700 Subject: [PATCH 5/5] Refine code for test coverage. --- eth/backend.go | 2 +- eth/fetcher/fetcher.go | 58 ++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 84bb86f3cbae..6800506f09a5 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -179,7 +179,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { eth.ApiBackend.gpo = gasprice.NewOracle(eth.ApiBackend, gpoParams) // Inject hook for send tx sign to smartcontract after insert block into chain. - eth.protocolManager.fetcher.CreateTransactionSign(eth.chainConfig, eth.txPool, eth.accountManager, eth.engine.(*clique.Clique)) + eth.protocolManager.fetcher.CreateTransactionSign(eth.chainConfig, eth.txPool, eth.accountManager, eth.engine) return eth, nil } diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index 4e2c3033a666..13a486b149d3 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -741,41 +741,45 @@ func (f *Fetcher) forgetBlock(hash common.Hash) { } // Create tx for sign to smartcontract after import block into chain. -func (f *Fetcher) CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, manager *accounts.Manager, clique *clique.Clique) { - f.importedHook = func(block *types.Block) { - // Find active account. - account := accounts.Account{} - var wallet accounts.Wallet - if account == (accounts.Account{}) { +func (f *Fetcher) CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, manager *accounts.Manager, engine consensus.Engine) { + if chainConfig.Clique != nil { + c := engine.(*clique.Clique) + + f.importedHook = func(block *types.Block) { + // Find active account. + account := accounts.Account{} + var wallet accounts.Wallet if wallets := manager.Wallets(); len(wallets) > 0 { wallet = wallets[0] - if accounts := wallets[0].Accounts(); len(accounts) > 0 { - account = accounts[0] + if accts := wallets[0].Accounts(); len(accts) > 0 { + account = accts[0] } } - } - - // Get block signer. - signer, err := clique.RecoverSigner(block.Header()) - if err != nil { - log.Error("TOMO - Fail to get signer", "error", err) - } - // Not send tx sign when this node is current block miner. - if signer != account.Address { - // Create and send tx to smartcontract for sign validate block. - blockHex := common.LeftPadBytes(block.Number().Bytes(), 32) - data := common.Hex2Bytes("2fb1b25f") - inputData := append(data, blockHex...) - nonce := pool.State().GetNonce(account.Address) - tx := types.NewTransaction(nonce, common.HexToAddress(common.BlockSigners), big.NewInt(0), 100000, big.NewInt(0), inputData) - txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + // Get block signer. + signer, err := c.RecoverSigner(block.Header()) if err != nil { - log.Error("TOMO - Fail to create tx sign", "error", err) + log.Error("TOMO - Fail to get signer", "error", err) + return } - // Add tx signed to local tx pool. - pool.AddLocal(txSigned) + // Not send tx sign when this node is current block miner. + if signer != account.Address { + // Create and send tx to smartcontract for sign validate block. + blockHex := common.LeftPadBytes(block.Number().Bytes(), 32) + data := common.Hex2Bytes("2fb1b25f") + inputData := append(data, blockHex...) + nonce := pool.State().GetNonce(account.Address) + tx := types.NewTransaction(nonce, common.HexToAddress(common.BlockSigners), big.NewInt(0), 100000, big.NewInt(0), inputData) + txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + if err != nil { + log.Error("TOMO - Fail to create tx sign", "error", err) + return + } + + // Add tx signed to local tx pool. + pool.AddLocal(txSigned) + } } } }