{"action":"created","comment":{"url":"https://api.github.com/repos/ethcore/parity/pulls/comments/61421399","id":61421399,"diff_hunk":"@@ -0,0 +1,589 @@\n+// Copyright 2015, 2016 Ethcore (UK) Ltd.\n+// This file is part of Parity.\n+\n+// Parity is free software: you can redistribute it and/or modify\n+// it under the terms of the GNU General Public License as published by\n+// the Free Software Foundation, either version 3 of the License, or\n+// (at your option) any later version.\n+\n+// Parity is distributed in the hope that it will be useful,\n+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+// GNU General Public License for more details.\n+\n+// You should have received a copy of the GNU General Public License\n+// along with Parity.  If not, see <http://www.gnu.org/licenses/>.\n+\n+//! Fat database.\n+use std::ptr;\n+use std::ops::Deref;\n+use std::collections::HashMap;\n+use std::sync::{RwLock, Arc};\n+use std::path::Path;\n+use bloomchain::Number;\n+use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};\n+use util::{FixedHash, H256, H264, Database, DBTransaction};\n+use header::BlockNumber;\n+use trace::{BlockTraces, LocalizedTrace, Config, Switch, Filter, Database as TraceDatabase, ImportRequest,\n+DatabaseExtras};\n+use db::{Key, Writable, Readable, CacheUpdatePolicy};\n+use super::bloom::{TraceGroupPosition, BlockTracesBloom, BlockTracesBloomGroup};\n+use super::flat::{FlatTrace, FlatBlockTraces, FlatTransactionTraces};\n+\n+const TRACE_DB_VER: &'static [u8] = b\"1.0\";\n+\n+#[derive(Debug, Copy, Clone)]\n+pub enum TracedbIndex {\n+\t/// Block traces index.\n+\tBlockTraces = 0,\n+\t/// Trace bloom group index.\n+\tBlockTracesBloomGroups = 1,\n+}\n+\n+impl Key<BlockTraces> for H256 {\n+\ttype Target = H264;\n+\n+\tfn key(&self) -> H264 {\n+\t\tlet mut result = H264::default();\n+\t\tresult[0] = TracedbIndex::BlockTraces as u8;\n+\t\tunsafe {\n+\t\t\tptr::copy(self.as_ptr(), result.as_mut_ptr().offset(1), 32);\n+\t\t}\n+\t\tresult\n+\t}\n+}\n+\n+/// Helper data structure created cause [u8; 6] does not implement Deref to &[u8].\n+pub struct TraceGroupKey([u8; 6]);\n+\n+impl Deref for TraceGroupKey {\n+\ttype Target = [u8];\n+\n+\tfn deref(&self) -> &Self::Target {\n+\t\t&self.0\n+\t}\n+}\n+\n+impl Key<BlockTracesBloomGroup> for TraceGroupPosition {\n+\ttype Target = TraceGroupKey;\n+\n+\tfn key(&self) -> Self::Target {\n+\t\tlet mut result = [0u8; 6];\n+\t\tresult[0] = TracedbIndex::BlockTracesBloomGroups as u8;\n+\t\tresult[1] = self.level;\n+\t\tunsafe {\n+\t\t\tptr::copy(&[self.index] as *const u32 as *const u8, result.as_mut_ptr().offset(2), 4);\n+\t\t}\n+\t\tTraceGroupKey(result)\n+\t}\n+}\n+\n+/// Fat database.","path":"ethcore/src/trace/db.rs","position":81,"original_position":81,"commit_id":"225b3ff96c65ba458b4a80a8248d8dc20455d83b","original_commit_id":"225b3ff96c65ba458b4a80a8248d8dc20455d83b","user":{"login":"debris","id":2613714,"avatar_url":"https://avatars.githubusercontent.com/u/2613714?v=3","gravatar_id":"","url":"https://api.github.com/users/debris","html_url":"https://github.com/debris","followers_url":"https://api.github.com/users/debris/followers","following_url":"https://api.github.com/users/debris/following{/other_user}","gists_url":"https://api.github.com/users/debris/gists{/gist_id}","starred_url":"https://api.github.com/users/debris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debris/subscriptions","organizations_url":"https://api.github.com/users/debris/orgs","repos_url":"https://api.github.com/users/debris/repos","events_url":"https://api.github.com/users/debris/events{/privacy}","received_events_url":"https://api.github.com/users/debris/received_events","type":"User","site_admin":false},"body":"This is obsolete comment. will fix it","created_at":"2016-04-28T12:53:35Z","updated_at":"2016-04-28T12:53:35Z","html_url":"https://github.com/ethcore/parity/pull/996#discussion_r61421399","pull_request_url":"https://api.github.com/repos/ethcore/parity/pulls/996","_links":{"self":{"href":"https://api.github.com/repos/ethcore/parity/pulls/comments/61421399"},"html":{"href":"https://github.com/ethcore/parity/pull/996#discussion_r61421399"},"pull_request":{"href":"https://api.github.com/repos/ethcore/parity/pulls/996"}}},"pull_request":{"url":"https://api.github.com/repos/ethcore/parity/pulls/996","id":67645330,"html_url":"https://github.com/ethcore/parity/pull/996","diff_url":"https://github.com/ethcore/parity/pull/996.diff","patch_url":"https://github.com/ethcore/parity/pull/996.patch","issue_url":"https://api.github.com/repos/ethcore/parity/issues/996","number":996,"state":"open","locked":false,"title":"Core tracedb functionality.","user":{"login":"debris","id":2613714,"avatar_url":"https://avatars.githubusercontent.com/u/2613714?v=3","gravatar_id":"","url":"https://api.github.com/users/debris","html_url":"https://github.com/debris","followers_url":"https://api.github.com/users/debris/followers","following_url":"https://api.github.com/users/debris/following{/other_user}","gists_url":"https://api.github.com/users/debris/gists{/gist_id}","starred_url":"https://api.github.com/users/debris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debris/subscriptions","organizations_url":"https://api.github.com/users/debris/orgs","repos_url":"https://api.github.com/users/debris/repos","events_url":"https://api.github.com/users/debris/events{/privacy}","received_events_url":"https://api.github.com/users/debris/received_events","type":"User","site_admin":false},"body":"separated core tracedb functionality from pr #924.\r\n\r\n99% of this pr is a new code. Removed lines are mostly variables/functions renaming. Most of the new code is added to `ethcore/trace` module. Changes in this pr won't store traces in the database, but they provide everything that is required to do so.\r\n\r\n#### this pr includes:\r\n\r\n- fixed encoding of `0u8` (#992 ,merged)\r\n- import route contains ommited blocks (#994 ,merged)\r\n- `trace::ExecutiveTracer` and `trace::NoopTracer` moved to separate files\r\n- traces rlp encoding / decoding\r\n- traces bloom\r\n- traces filter\r\n- tracedb\r\n- tracedb config\r\n- removed `have_tracing` from blockchain\r\n- blockchain bloom filtering is done using external crate [bloomchain](https://github.com/debris/bloomchain)\r\n- turned on tracing of transactions to builtins. It simplifies querying traces, cause number of traces is always equal to number of transactions in given block.\r\n\r\n#### this pr does not include:\r\n\r\n- client api for tracing\r\n- actual storing traces in database\r\n- tracing cli\r\n- traces rpc","created_at":"2016-04-24T18:25:02Z","updated_at":"2016-04-28T12:53:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12e8cbfe1a8ae2b0fb1ce03e57879acde33aa443","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ethcore/parity/pulls/996/commits","review_comments_url":"https://api.github.com/repos/ethcore/parity/pulls/996/comments","review_comment_url":"https://api.github.com/repos/ethcore/parity/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethcore/parity/issues/996/comments","statuses_url":"https://api.github.com/repos/ethcore/parity/statuses/225b3ff96c65ba458b4a80a8248d8dc20455d83b","head":{"label":"ethcore:tracedb","ref":"tracedb","sha":"225b3ff96c65ba458b4a80a8248d8dc20455d83b","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-04-28T09:20:51Z","pushed_at":"2016-04-28T12:47:25Z","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":9210,"stargazers_count":307,"watchers_count":307,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":39,"mirror_url":null,"open_issues_count":83,"forks":39,"open_issues":83,"watchers":307,"default_branch":"master"}},"base":{"label":"ethcore:master","ref":"master","sha":"b16fa5cc34aa3ba9c19613b4d3c5e5d6a77807d4","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-04-28T09:20:51Z","pushed_at":"2016-04-28T12:47:25Z","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":9210,"stargazers_count":307,"watchers_count":307,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":39,"mirror_url":null,"open_issues_count":83,"forks":39,"open_issues":83,"watchers":307,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethcore/parity/pulls/996"},"html":{"href":"https://github.com/ethcore/parity/pull/996"},"issue":{"href":"https://api.github.com/repos/ethcore/parity/issues/996"},"comments":{"href":"https://api.github.com/repos/ethcore/parity/issues/996/comments"},"review_comments":{"href":"https://api.github.com/repos/ethcore/parity/pulls/996/comments"},"review_comment":{"href":"https://api.github.com/repos/ethcore/parity/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethcore/parity/pulls/996/commits"},"statuses":{"href":"https://api.github.com/repos/ethcore/parity/statuses/225b3ff96c65ba458b4a80a8248d8dc20455d83b"}}}}