{"action":"created","comment":{"url":"https://api.github.com/repos/ethcore/parity/pulls/comments/65247841","id":65247841,"diff_hunk":"@@ -19,211 +19,332 @@ use std::collections::HashMap;\n use std::sync::Arc;\n use std::str::FromStr;\n \n-use ethcore::client::{BlockChainClient, Client, ClientConfig};\n-use ethcore::spec::Genesis;\n+use ethcore::ids::BlockID;\n+use ethcore::client::{Client, BlockChainClient, ClientConfig};\n+use ethcore::spec::{Genesis, Spec};\n use ethcore::block::Block;\n+use ethcore::views::BlockView;\n use ethcore::ethereum;\n-use ethcore::transaction::{Transaction, Action};\n-use ethminer::{MinerService, ExternalMiner};\n+use ethminer::{Miner, MinerService, ExternalMiner};\n use devtools::RandomTempPath;\n+use util::Hashable;\n use util::io::IoChannel;\n-use util::hash::Address;\n-use util::numbers::{Uint, U256};\n+use util::hash::{Address, H256};\n+use util::numbers::U256;\n use util::keys::{AccountProvider, TestAccount, TestAccountProvider};\n use jsonrpc_core::IoHandler;\n use ethjson::blockchain::BlockChain;\n \n use v1::traits::eth::Eth;\n use v1::impls::EthClient;\n-use v1::tests::helpers::{TestSyncProvider, Config, TestMinerService};\n+use v1::tests::helpers::{TestSyncProvider, Config};\n+\n+fn account_provider() -> Arc<TestAccountProvider> {\n+\tlet mut accounts = HashMap::new();\n+\taccounts.insert(Address::from(1), TestAccount::new(\"test\"));\n+\tlet ap = TestAccountProvider::new(accounts);\n+\tArc::new(ap)\n+}\n+\n+fn sync_provider() -> Arc<TestSyncProvider> {\n+\tArc::new(TestSyncProvider::new(Config {\n+\t\tnetwork_id: U256::from(3),\n+\t\tnum_peers: 120,\n+\t}))\n+}\n+\n+fn miner_service(spec: Spec, accounts: Arc<AccountProvider>) -> Arc<Miner> {\n+\tMiner::with_accounts(true, spec, accounts)\n+}\n+\n+fn make_spec(chain: &BlockChain) -> Spec {\n+\tlet genesis = Genesis::from(chain.genesis());\n+\tlet mut spec = ethereum::new_frontier_test();\n+\tlet state = chain.pre_state.clone().into();\n+\tspec.set_genesis_state(state);\n+\tspec.overwrite_genesis_params(genesis);\n+\tassert!(spec.is_state_root_valid());\n+\tspec\n+}\n \n struct EthTester {\n-\t_client: Arc<BlockChainClient>,\n \t_miner: Arc<MinerService>,\n+\tclient: Arc<Client>,\n \taccounts: Arc<TestAccountProvider>,\n \thandler: IoHandler,\n }\n \n+impl EthTester {\n+\tfn from_chain(chain: &BlockChain) -> Self {\n+\t\tlet tester = Self::from_spec_provider(|| make_spec(chain));\n+\n+\t\tfor b in &chain.blocks_rlp() {\n+\t\t\tif Block::is_good(&b) {\n+\t\t\t\tlet _ = tester.client.import_block(b.clone());\n+\t\t\t\ttester.client.flush_queue();\n+\t\t\t\ttester.client.import_verified_blocks(&IoChannel::disconnected());\n+\t\t\t}\n+\t\t}\n+\n+\t\ttester.client.flush_queue();\n+\n+\t\tassert!(tester.client.chain_info().best_block_hash == chain.best_block.clone().into());\n+\t\ttester\n+\t}\n+\n+\tfn from_spec_provider<F>(spec_provider: F) -> Self\n+\t\twhere F: Fn() -> Spec {\n+\n+\t\tlet dir = RandomTempPath::new();\n+\t\tlet client = Client::new(ClientConfig::default(), spec_provider(), dir.as_path(), IoChannel::disconnected()).unwrap();\n+\t\tlet sync_provider = sync_provider();\n+\t\tlet account_provider = account_provider();\n+\t\tlet miner_service = miner_service(spec_provider(), account_provider.clone());\n+\t\tlet external_miner = Arc::new(ExternalMiner::default());\n+\n+\t\tlet eth_client = EthClient::new(&client, &sync_provider, &account_provider,","path":"rpc/src/v1/tests/eth.rs","position":95,"original_position":95,"commit_id":"c81e4e24b303a765120fefe15600705918aa9afe","original_commit_id":"c81e4e24b303a765120fefe15600705918aa9afe","user":{"login":"gavofyork","id":138296,"avatar_url":"https://avatars.githubusercontent.com/u/138296?v=3","gravatar_id":"","url":"https://api.github.com/users/gavofyork","html_url":"https://github.com/gavofyork","followers_url":"https://api.github.com/users/gavofyork/followers","following_url":"https://api.github.com/users/gavofyork/following{/other_user}","gists_url":"https://api.github.com/users/gavofyork/gists{/gist_id}","starred_url":"https://api.github.com/users/gavofyork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavofyork/subscriptions","organizations_url":"https://api.github.com/users/gavofyork/orgs","repos_url":"https://api.github.com/users/gavofyork/repos","events_url":"https://api.github.com/users/gavofyork/events{/privacy}","received_events_url":"https://api.github.com/users/gavofyork/received_events","type":"User","site_admin":false},"body":"none or all is our convention. e.g.:\r\n\r\n```\r\nlet eth_client = EthClient::new(\r\n\t&client,\r\n\t&sync_provider,\r\n\t&account_provider,\r\n\t&miner_service,\r\n\t&external_miner\r\n);","created_at":"2016-05-31T19:33:04Z","updated_at":"2016-05-31T19:33:04Z","html_url":"https://github.com/ethcore/parity/pull/1196#discussion_r65247841","pull_request_url":"https://api.github.com/repos/ethcore/parity/pulls/1196","_links":{"self":{"href":"https://api.github.com/repos/ethcore/parity/pulls/comments/65247841"},"html":{"href":"https://github.com/ethcore/parity/pull/1196#discussion_r65247841"},"pull_request":{"href":"https://api.github.com/repos/ethcore/parity/pulls/1196"}}},"pull_request":{"url":"https://api.github.com/repos/ethcore/parity/pulls/1196","id":72058265,"html_url":"https://github.com/ethcore/parity/pull/1196","diff_url":"https://github.com/ethcore/parity/pull/1196.diff","patch_url":"https://github.com/ethcore/parity/pull/1196.patch","issue_url":"https://api.github.com/repos/ethcore/parity/issues/1196","number":1196,"state":"open","locked":false,"title":"transaction count verifier tests","user":{"login":"rphmeier","id":10121380,"avatar_url":"https://avatars.githubusercontent.com/u/10121380?v=3","gravatar_id":"","url":"https://api.github.com/users/rphmeier","html_url":"https://github.com/rphmeier","followers_url":"https://api.github.com/users/rphmeier/followers","following_url":"https://api.github.com/users/rphmeier/following{/other_user}","gists_url":"https://api.github.com/users/rphmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/rphmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rphmeier/subscriptions","organizations_url":"https://api.github.com/users/rphmeier/orgs","repos_url":"https://api.github.com/users/rphmeier/repos","events_url":"https://api.github.com/users/rphmeier/events{/privacy}","received_events_url":"https://api.github.com/users/rphmeier/received_events","type":"User","site_admin":false},"body":"also includes some minor (miner) refactoring","created_at":"2016-05-31T17:53:54Z","updated_at":"2016-05-31T19:33:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27a40fb7982c165bcbb8d21c8efaf1214a68cce7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ethcore/parity/pulls/1196/commits","review_comments_url":"https://api.github.com/repos/ethcore/parity/pulls/1196/comments","review_comment_url":"https://api.github.com/repos/ethcore/parity/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethcore/parity/issues/1196/comments","statuses_url":"https://api.github.com/repos/ethcore/parity/statuses/c81e4e24b303a765120fefe15600705918aa9afe","head":{"label":"rphmeier:rpc-tests","ref":"rpc-tests","sha":"c81e4e24b303a765120fefe15600705918aa9afe","user":{"login":"rphmeier","id":10121380,"avatar_url":"https://avatars.githubusercontent.com/u/10121380?v=3","gravatar_id":"","url":"https://api.github.com/users/rphmeier","html_url":"https://github.com/rphmeier","followers_url":"https://api.github.com/users/rphmeier/followers","following_url":"https://api.github.com/users/rphmeier/following{/other_user}","gists_url":"https://api.github.com/users/rphmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/rphmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rphmeier/subscriptions","organizations_url":"https://api.github.com/users/rphmeier/orgs","repos_url":"https://api.github.com/users/rphmeier/repos","events_url":"https://api.github.com/users/rphmeier/events{/privacy}","received_events_url":"https://api.github.com/users/rphmeier/received_events","type":"User","site_admin":false},"repo":{"id":55021204,"name":"parity","full_name":"rphmeier/parity","owner":{"login":"rphmeier","id":10121380,"avatar_url":"https://avatars.githubusercontent.com/u/10121380?v=3","gravatar_id":"","url":"https://api.github.com/users/rphmeier","html_url":"https://github.com/rphmeier","followers_url":"https://api.github.com/users/rphmeier/followers","following_url":"https://api.github.com/users/rphmeier/following{/other_user}","gists_url":"https://api.github.com/users/rphmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/rphmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rphmeier/subscriptions","organizations_url":"https://api.github.com/users/rphmeier/orgs","repos_url":"https://api.github.com/users/rphmeier/repos","events_url":"https://api.github.com/users/rphmeier/events{/privacy}","received_events_url":"https://api.github.com/users/rphmeier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rphmeier/parity","description":"Fast, light, robust Ethereum implementation","fork":true,"url":"https://api.github.com/repos/rphmeier/parity","forks_url":"https://api.github.com/repos/rphmeier/parity/forks","keys_url":"https://api.github.com/repos/rphmeier/parity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rphmeier/parity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rphmeier/parity/teams","hooks_url":"https://api.github.com/repos/rphmeier/parity/hooks","issue_events_url":"https://api.github.com/repos/rphmeier/parity/issues/events{/number}","events_url":"https://api.github.com/repos/rphmeier/parity/events","assignees_url":"https://api.github.com/repos/rphmeier/parity/assignees{/user}","branches_url":"https://api.github.com/repos/rphmeier/parity/branches{/branch}","tags_url":"https://api.github.com/repos/rphmeier/parity/tags","blobs_url":"https://api.github.com/repos/rphmeier/parity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rphmeier/parity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rphmeier/parity/git/refs{/sha}","trees_url":"https://api.github.com/repos/rphmeier/parity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rphmeier/parity/statuses/{sha}","languages_url":"https://api.github.com/repos/rphmeier/parity/languages","stargazers_url":"https://api.github.com/repos/rphmeier/parity/stargazers","contributors_url":"https://api.github.com/repos/rphmeier/parity/contributors","subscribers_url":"https://api.github.com/repos/rphmeier/parity/subscribers","subscription_url":"https://api.github.com/repos/rphmeier/parity/subscription","commits_url":"https://api.github.com/repos/rphmeier/parity/commits{/sha}","git_commits_url":"https://api.github.com/repos/rphmeier/parity/git/commits{/sha}","comments_url":"https://api.github.com/repos/rphmeier/parity/comments{/number}","issue_comment_url":"https://api.github.com/repos/rphmeier/parity/issues/comments{/number}","contents_url":"https://api.github.com/repos/rphmeier/parity/contents/{+path}","compare_url":"https://api.github.com/repos/rphmeier/parity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rphmeier/parity/merges","archive_url":"https://api.github.com/repos/rphmeier/parity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rphmeier/parity/downloads","issues_url":"https://api.github.com/repos/rphmeier/parity/issues{/number}","pulls_url":"https://api.github.com/repos/rphmeier/parity/pulls{/number}","milestones_url":"https://api.github.com/repos/rphmeier/parity/milestones{/number}","notifications_url":"https://api.github.com/repos/rphmeier/parity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rphmeier/parity/labels{/name}","releases_url":"https://api.github.com/repos/rphmeier/parity/releases{/id}","deployments_url":"https://api.github.com/repos/rphmeier/parity/deployments","created_at":"2016-03-30T00:59:11Z","updated_at":"2016-03-30T00:59:13Z","pushed_at":"2016-05-31T17:51:30Z","git_url":"git://github.com/rphmeier/parity.git","ssh_url":"git@github.com:rphmeier/parity.git","clone_url":"https://github.com/rphmeier/parity.git","svn_url":"https://github.com/rphmeier/parity","homepage":"","size":8698,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ethcore:master","ref":"master","sha":"3dd642abe990296a9f21e9f691fa1fe828916c9f","user":{"login":"ethcore","id":14176906,"avatar_url":"https://avatars.githubusercontent.com/u/14176906?v=3","gravatar_id":"","url":"https://api.github.com/users/ethcore","html_url":"https://github.com/ethcore","followers_url":"https://api.github.com/users/ethcore/followers","following_url":"https://api.github.com/users/ethcore/following{/other_user}","gists_url":"https://api.github.com/users/ethcore/gists{/gist_id}","starred_url":"https://api.github.com/users/ethcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethcore/subscriptions","organizations_url":"https://api.github.com/users/ethcore/orgs","repos_url":"https://api.github.com/users/ethcore/repos","events_url":"https://api.github.com/users/ethcore/events{/privacy}","received_events_url":"https://api.github.com/users/ethcore/received_events","type":"Organization","site_admin":false},"repo":{"id":46714939,"name":"parity","full_name":"ethcore/parity","owner":{"login":"ethcore","id":14176906,"avatar_url":"https://avatars.githubusercontent.com/u/14176906?v=3","gravatar_id":"","url":"https://api.github.com/users/ethcore","html_url":"https://github.com/ethcore","followers_url":"https://api.github.com/users/ethcore/followers","following_url":"https://api.github.com/users/ethcore/following{/other_user}","gists_url":"https://api.github.com/users/ethcore/gists{/gist_id}","starred_url":"https://api.github.com/users/ethcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethcore/subscriptions","organizations_url":"https://api.github.com/users/ethcore/orgs","repos_url":"https://api.github.com/users/ethcore/repos","events_url":"https://api.github.com/users/ethcore/events{/privacy}","received_events_url":"https://api.github.com/users/ethcore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethcore/parity","description":"Fast, light, robust Ethereum implementation","fork":false,"url":"https://api.github.com/repos/ethcore/parity","forks_url":"https://api.github.com/repos/ethcore/parity/forks","keys_url":"https://api.github.com/repos/ethcore/parity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethcore/parity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethcore/parity/teams","hooks_url":"https://api.github.com/repos/ethcore/parity/hooks","issue_events_url":"https://api.github.com/repos/ethcore/parity/issues/events{/number}","events_url":"https://api.github.com/repos/ethcore/parity/events","assignees_url":"https://api.github.com/repos/ethcore/parity/assignees{/user}","branches_url":"https://api.github.com/repos/ethcore/parity/branches{/branch}","tags_url":"https://api.github.com/repos/ethcore/parity/tags","blobs_url":"https://api.github.com/repos/ethcore/parity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethcore/parity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethcore/parity/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethcore/parity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethcore/parity/statuses/{sha}","languages_url":"https://api.github.com/repos/ethcore/parity/languages","stargazers_url":"https://api.github.com/repos/ethcore/parity/stargazers","contributors_url":"https://api.github.com/repos/ethcore/parity/contributors","subscribers_url":"https://api.github.com/repos/ethcore/parity/subscribers","subscription_url":"https://api.github.com/repos/ethcore/parity/subscription","commits_url":"https://api.github.com/repos/ethcore/parity/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethcore/parity/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethcore/parity/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethcore/parity/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethcore/parity/contents/{+path}","compare_url":"https://api.github.com/repos/ethcore/parity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethcore/parity/merges","archive_url":"https://api.github.com/repos/ethcore/parity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethcore/parity/downloads","issues_url":"https://api.github.com/repos/ethcore/parity/issues{/number}","pulls_url":"https://api.github.com/repos/ethcore/parity/pulls{/number}","milestones_url":"https://api.github.com/repos/ethcore/parity/milestones{/number}","notifications_url":"https://api.github.com/repos/ethcore/parity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethcore/parity/labels{/name}","releases_url":"https://api.github.com/repos/ethcore/parity/releases{/id}","deployments_url":"https://api.github.com/repos/ethcore/parity/deployments","created_at":"2015-11-23T11:07:32Z","updated_at":"2016-05-30T07:23:35Z","pushed_at":"2016-05-31T19:31:50Z","git_url":"git://github.com/ethcore/parity.git","ssh_url":"git@github.com:ethcore/parity.git","clone_url":"https://github.com/ethcore/parity.git","svn_url":"https://github.com/ethcore/parity","homepage":"","size":15083,"stargazers_count":343,"watchers_count":343,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":45,"mirror_url":null,"open_issues_count":100,"forks":45,"open_issues":100,"watchers":343,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethcore/parity/pulls/1196"},"html":{"href":"https://github.com/ethcore/parity/pull/1196"},"issue":{"href":"https://api.github.com/repos/ethcore/parity/issues/1196"},"comments":{"href":"https://api.github.com/repos/ethcore/parity/issues/1196/comments"},"review_comments":{"href":"https://api.github.com/repos/ethcore/parity/pulls/1196/comments"},"review_comment":{"href":"https://api.github.com/repos/ethcore/parity/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethcore/parity/pulls/1196/commits"},"statuses":{"href":"https://api.github.com/repos/ethcore/parity/statuses/c81e4e24b303a765120fefe15600705918aa9afe"}}}}
{"actor":{"display_login":"gavofyork"}}