{"action":"created","comment":{"url":"https://api.github.com/repos/cryptape/cita-common/pulls/comments/187824407","pull_request_review_id":119679706,"id":187824407,"diff_hunk":"@@ -0,0 +1,193 @@\n+// CITA\n+// Copyright 2016-2018 Cryptape Technologies LLC.\n+\n+// This program is free software: you can redistribute it\n+// and/or modify it under the terms of the GNU General Public\n+// License as published by the Free Software Foundation,\n+// either version 3 of the License, or (at your option) any\n+// later version.\n+\n+// This program is distributed in the hope that it will be\n+// useful, but WITHOUT ANY WARRANTY; without even the implied\n+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n+// PURPOSE. See the GNU General Public License for more details.\n+\n+// You should have received a copy of the GNU General Public License\n+// along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+\n+use std::str::FromStr;\n+\n+use super::{Bloom, BloomInput};\n+use super::{H1024, H128, H160, H256, H264, H32, H512, H520, H64};\n+use super::{U1024, U128, U256, U512, U64};\n+use super::{clean_0x, delete_left0, pad_left0};\n+\n+pub trait LowerHex {\n+    fn lower_hex(&self) -> String;\n+    fn lower_hex_with_0x(&self) -> String;\n+}\n+\n+pub trait ConvertType\n+where\n+    Self: ::std::marker::Sized,\n+{\n+    fn from_unaligned(&str) -> Option<Self>;\n+}\n+\n+fn convert_u8_to_char(u: u8) -> char {\n+    match u {\n+        u if u < 10 => ('0' as u8 + u) as char,\n+        u if 10 <= u && u < 16 => ('a' as u8 + (u - 10)) as char,\n+        _ => panic!(\"{} not bwtween 0 and 15\", u),\n+    }\n+}\n+\n+impl<'a> LowerHex for &'a [u8] {\n+    fn lower_hex(&self) -> String {\n+        let sz = self.len();\n+        let mut s = vec![0u8 as char; sz * 2];\n+        for i in 0..sz {\n+            s[i * 2] = convert_u8_to_char(self[i] / 16);\n+            s[i * 2 + 1] = convert_u8_to_char(self[i] % 16);\n+        }\n+        s.into_iter().collect()\n+    }\n+\n+    fn lower_hex_with_0x(&self) -> String {\n+        let sz = self.len();\n+        let mut s = vec![0u8 as char; sz * 2 + 2];\n+        s[0] = '0';\n+        s[1] = 'x';\n+        for i in 0..sz {\n+            s[i * 2 + 2] = convert_u8_to_char(self[i] / 16);\n+            s[i * 2 + 3] = convert_u8_to_char(self[i] % 16);\n+        }\n+        s.into_iter().collect()\n+    }\n+}\n+\n+impl LowerHex for Vec<u8> {\n+    fn lower_hex(&self) -> String {\n+        let s = self as &[u8];\n+        s.lower_hex()\n+    }\n+    fn lower_hex_with_0x(&self) -> String {\n+        let s = self as &[u8];\n+        s.lower_hex_with_0x()\n+    }\n+}\n+\n+macro_rules! add_cita_funcs {\n+    ([$( ($name:ident, $bits:expr) ),+ ,]) => {\n+        add_cita_funcs!([ $( ($name, $bits) ),+ ]);\n+    };\n+    ([$( ($name:ident, $bits:expr) ),+]) => {\n+        $( add_cita_funcs!($name, $bits); )+\n+    };\n+    ($name:ident, $bits:expr) => {\n+        impl LowerHex for $name {\n+            #[inline]\n+            fn lower_hex(&self) -> String {\n+                format!(\"{:x}\", self)\n+            }\n+\n+            #[inline]\n+            fn lower_hex_with_0x(&self) -> String {\n+                format!(\"{:#x}\", self)\n+            }\n+        }\n+\n+        impl ConvertType for $name {\n+            #[inline]\n+            fn from_unaligned<'a>(s: &'a str) -> Option<Self> {\n+                $name::from_str(\n+                    pad_left0(\n+                        delete_left0(clean_0x(s)), $bits/4usize).as_str())\n+                    .ok()\n+            }\n+        }\n+    }\n+}\n+\n+add_cita_funcs!([","path":"cita-types/src/traits.rs","position":112,"original_position":112,"commit_id":"4e9c1cedffe78fcd4e4de6020eaf91489bf0ad50","original_commit_id":"4e9c1cedffe78fcd4e4de6020eaf91489bf0ad50","user":{"login":"kaikai1024","id":8768261,"avatar_url":"https://avatars0.githubusercontent.com/u/8768261?v=4","gravatar_id":"","url":"https://api.github.com/users/kaikai1024","html_url":"https://github.com/kaikai1024","followers_url":"https://api.github.com/users/kaikai1024/followers","following_url":"https://api.github.com/users/kaikai1024/following{/other_user}","gists_url":"https://api.github.com/users/kaikai1024/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikai1024/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikai1024/subscriptions","organizations_url":"https://api.github.com/users/kaikai1024/orgs","repos_url":"https://api.github.com/users/kaikai1024/repos","events_url":"https://api.github.com/users/kaikai1024/events{/privacy}","received_events_url":"https://api.github.com/users/kaikai1024/received_events","type":"User","site_admin":false},"body":"add cita types?","created_at":"2018-05-14T02:17:38Z","updated_at":"2018-05-14T02:17:55Z","html_url":"https://github.com/cryptape/cita-common/pull/76#discussion_r187824407","pull_request_url":"https://api.github.com/repos/cryptape/cita-common/pulls/76","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/cryptape/cita-common/pulls/comments/187824407"},"html":{"href":"https://github.com/cryptape/cita-common/pull/76#discussion_r187824407"},"pull_request":{"href":"https://api.github.com/repos/cryptape/cita-common/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/cryptape/cita-common/pulls/76","id":187617624,"html_url":"https://github.com/cryptape/cita-common/pull/76","diff_url":"https://github.com/cryptape/cita-common/pull/76.diff","patch_url":"https://github.com/cryptape/cita-common/pull/76.patch","issue_url":"https://api.github.com/repos/cryptape/cita-common/issues/76","number":76,"state":"open","locked":false,"title":"Replace bigint by cita-types and remove bloomable.","user":{"login":"yangby-cryptape","id":30993023,"avatar_url":"https://avatars1.githubusercontent.com/u/30993023?v=4","gravatar_id":"","url":"https://api.github.com/users/yangby-cryptape","html_url":"https://github.com/yangby-cryptape","followers_url":"https://api.github.com/users/yangby-cryptape/followers","following_url":"https://api.github.com/users/yangby-cryptape/following{/other_user}","gists_url":"https://api.github.com/users/yangby-cryptape/gists{/gist_id}","starred_url":"https://api.github.com/users/yangby-cryptape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangby-cryptape/subscriptions","organizations_url":"https://api.github.com/users/yangby-cryptape/orgs","repos_url":"https://api.github.com/users/yangby-cryptape/repos","events_url":"https://api.github.com/users/yangby-cryptape/events{/privacy}","received_events_url":"https://api.github.com/users/yangby-cryptape/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-12T11:45:36Z","updated_at":"2018-05-14T02:17:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2330d9b15b413ab5d12c5cbe5b3a4339fc2f65a3","assignee":null,"assignees":[],"requested_reviewers":[{"login":"rink1969","id":1633038,"avatar_url":"https://avatars1.githubusercontent.com/u/1633038?v=4","gravatar_id":"","url":"https://api.github.com/users/rink1969","html_url":"https://github.com/rink1969","followers_url":"https://api.github.com/users/rink1969/followers","following_url":"https://api.github.com/users/rink1969/following{/other_user}","gists_url":"https://api.github.com/users/rink1969/gists{/gist_id}","starred_url":"https://api.github.com/users/rink1969/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rink1969/subscriptions","organizations_url":"https://api.github.com/users/rink1969/orgs","repos_url":"https://api.github.com/users/rink1969/repos","events_url":"https://api.github.com/users/rink1969/events{/privacy}","received_events_url":"https://api.github.com/users/rink1969/received_events","type":"User","site_admin":false},{"login":"EighteenZi","id":31607114,"avatar_url":"https://avatars3.githubusercontent.com/u/31607114?v=4","gravatar_id":"","url":"https://api.github.com/users/EighteenZi","html_url":"https://github.com/EighteenZi","followers_url":"https://api.github.com/users/EighteenZi/followers","following_url":"https://api.github.com/users/EighteenZi/following{/other_user}","gists_url":"https://api.github.com/users/EighteenZi/gists{/gist_id}","starred_url":"https://api.github.com/users/EighteenZi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EighteenZi/subscriptions","organizations_url":"https://api.github.com/users/EighteenZi/orgs","repos_url":"https://api.github.com/users/EighteenZi/repos","events_url":"https://api.github.com/users/EighteenZi/events{/privacy}","received_events_url":"https://api.github.com/users/EighteenZi/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":930795849,"url":"https://api.github.com/repos/cryptape/cita-common/labels/do%20not%20merge","name":"do not merge","color":"d3c119","default":false},{"id":930796108,"url":"https://api.github.com/repos/cryptape/cita-common/labels/reviewers%20wanted","name":"reviewers wanted","color":"cccfff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cryptape/cita-common/pulls/76/commits","review_comments_url":"https://api.github.com/repos/cryptape/cita-common/pulls/76/comments","review_comment_url":"https://api.github.com/repos/cryptape/cita-common/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cryptape/cita-common/issues/76/comments","statuses_url":"https://api.github.com/repos/cryptape/cita-common/statuses/4e9c1cedffe78fcd4e4de6020eaf91489bf0ad50","head":{"label":"yangby-cryptape:add_cita_types","ref":"add_cita_types","sha":"4e9c1cedffe78fcd4e4de6020eaf91489bf0ad50","user":{"login":"yangby-cryptape","id":30993023,"avatar_url":"https://avatars1.githubusercontent.com/u/30993023?v=4","gravatar_id":"","url":"https://api.github.com/users/yangby-cryptape","html_url":"https://github.com/yangby-cryptape","followers_url":"https://api.github.com/users/yangby-cryptape/followers","following_url":"https://api.github.com/users/yangby-cryptape/following{/other_user}","gists_url":"https://api.github.com/users/yangby-cryptape/gists{/gist_id}","starred_url":"https://api.github.com/users/yangby-cryptape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangby-cryptape/subscriptions","organizations_url":"https://api.github.com/users/yangby-cryptape/orgs","repos_url":"https://api.github.com/users/yangby-cryptape/repos","events_url":"https://api.github.com/users/yangby-cryptape/events{/privacy}","received_events_url":"https://api.github.com/users/yangby-cryptape/received_events","type":"User","site_admin":false},"repo":{"id":117657122,"name":"cita-common","full_name":"yangby-cryptape/cita-common","owner":{"login":"yangby-cryptape","id":30993023,"avatar_url":"https://avatars1.githubusercontent.com/u/30993023?v=4","gravatar_id":"","url":"https://api.github.com/users/yangby-cryptape","html_url":"https://github.com/yangby-cryptape","followers_url":"https://api.github.com/users/yangby-cryptape/followers","following_url":"https://api.github.com/users/yangby-cryptape/following{/other_user}","gists_url":"https://api.github.com/users/yangby-cryptape/gists{/gist_id}","starred_url":"https://api.github.com/users/yangby-cryptape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangby-cryptape/subscriptions","organizations_url":"https://api.github.com/users/yangby-cryptape/orgs","repos_url":"https://api.github.com/users/yangby-cryptape/repos","events_url":"https://api.github.com/users/yangby-cryptape/events{/privacy}","received_events_url":"https://api.github.com/users/yangby-cryptape/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yangby-cryptape/cita-common","description":"Libraries for CITA (https://github.com/cryptape/cita)","fork":true,"url":"https://api.github.com/repos/yangby-cryptape/cita-common","forks_url":"https://api.github.com/repos/yangby-cryptape/cita-common/forks","keys_url":"https://api.github.com/repos/yangby-cryptape/cita-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yangby-cryptape/cita-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yangby-cryptape/cita-common/teams","hooks_url":"https://api.github.com/repos/yangby-cryptape/cita-common/hooks","issue_events_url":"https://api.github.com/repos/yangby-cryptape/cita-common/issues/events{/number}","events_url":"https://api.github.com/repos/yangby-cryptape/cita-common/events","assignees_url":"https://api.github.com/repos/yangby-cryptape/cita-common/assignees{/user}","branches_url":"https://api.github.com/repos/yangby-cryptape/cita-common/branches{/branch}","tags_url":"https://api.github.com/repos/yangby-cryptape/cita-common/tags","blobs_url":"https://api.github.com/repos/yangby-cryptape/cita-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yangby-cryptape/cita-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yangby-cryptape/cita-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/yangby-cryptape/cita-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yangby-cryptape/cita-common/statuses/{sha}","languages_url":"https://api.github.com/repos/yangby-cryptape/cita-common/languages","stargazers_url":"https://api.github.com/repos/yangby-cryptape/cita-common/stargazers","contributors_url":"https://api.github.com/repos/yangby-cryptape/cita-common/contributors","subscribers_url":"https://api.github.com/repos/yangby-cryptape/cita-common/subscribers","subscription_url":"https://api.github.com/repos/yangby-cryptape/cita-common/subscription","commits_url":"https://api.github.com/repos/yangby-cryptape/cita-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/yangby-cryptape/cita-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/yangby-cryptape/cita-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/yangby-cryptape/cita-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/yangby-cryptape/cita-common/contents/{+path}","compare_url":"https://api.github.com/repos/yangby-cryptape/cita-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yangby-cryptape/cita-common/merges","archive_url":"https://api.github.com/repos/yangby-cryptape/cita-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yangby-cryptape/cita-common/downloads","issues_url":"https://api.github.com/repos/yangby-cryptape/cita-common/issues{/number}","pulls_url":"https://api.github.com/repos/yangby-cryptape/cita-common/pulls{/number}","milestones_url":"https://api.github.com/repos/yangby-cryptape/cita-common/milestones{/number}","notifications_url":"https://api.github.com/repos/yangby-cryptape/cita-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yangby-cryptape/cita-common/labels{/name}","releases_url":"https://api.github.com/repos/yangby-cryptape/cita-common/releases{/id}","deployments_url":"https://api.github.com/repos/yangby-cryptape/cita-common/deployments","created_at":"2018-01-16T08:41:00Z","updated_at":"2018-05-11T13:09:53Z","pushed_at":"2018-05-14T02:05:49Z","git_url":"git://github.com/yangby-cryptape/cita-common.git","ssh_url":"git@github.com:yangby-cryptape/cita-common.git","clone_url":"https://github.com/yangby-cryptape/cita-common.git","svn_url":"https://github.com/yangby-cryptape/cita-common","homepage":"","size":1248,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"cryptape:develop","ref":"develop","sha":"040a6ec70e916dd8d44c1b7fcc1184b9ebd6e88f","user":{"login":"cryptape","id":17726310,"avatar_url":"https://avatars0.githubusercontent.com/u/17726310?v=4","gravatar_id":"","url":"https://api.github.com/users/cryptape","html_url":"https://github.com/cryptape","followers_url":"https://api.github.com/users/cryptape/followers","following_url":"https://api.github.com/users/cryptape/following{/other_user}","gists_url":"https://api.github.com/users/cryptape/gists{/gist_id}","starred_url":"https://api.github.com/users/cryptape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryptape/subscriptions","organizations_url":"https://api.github.com/users/cryptape/orgs","repos_url":"https://api.github.com/users/cryptape/repos","events_url":"https://api.github.com/users/cryptape/events{/privacy}","received_events_url":"https://api.github.com/users/cryptape/received_events","type":"Organization","site_admin":false},"repo":{"id":114739609,"name":"cita-common","full_name":"cryptape/cita-common","owner":{"login":"cryptape","id":17726310,"avatar_url":"https://avatars0.githubusercontent.com/u/17726310?v=4","gravatar_id":"","url":"https://api.github.com/users/cryptape","html_url":"https://github.com/cryptape","followers_url":"https://api.github.com/users/cryptape/followers","following_url":"https://api.github.com/users/cryptape/following{/other_user}","gists_url":"https://api.github.com/users/cryptape/gists{/gist_id}","starred_url":"https://api.github.com/users/cryptape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryptape/subscriptions","organizations_url":"https://api.github.com/users/cryptape/orgs","repos_url":"https://api.github.com/users/cryptape/repos","events_url":"https://api.github.com/users/cryptape/events{/privacy}","received_events_url":"https://api.github.com/users/cryptape/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cryptape/cita-common","description":"Libraries for CITA (https://github.com/cryptape/cita)","fork":false,"url":"https://api.github.com/repos/cryptape/cita-common","forks_url":"https://api.github.com/repos/cryptape/cita-common/forks","keys_url":"https://api.github.com/repos/cryptape/cita-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cryptape/cita-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cryptape/cita-common/teams","hooks_url":"https://api.github.com/repos/cryptape/cita-common/hooks","issue_events_url":"https://api.github.com/repos/cryptape/cita-common/issues/events{/number}","events_url":"https://api.github.com/repos/cryptape/cita-common/events","assignees_url":"https://api.github.com/repos/cryptape/cita-common/assignees{/user}","branches_url":"https://api.github.com/repos/cryptape/cita-common/branches{/branch}","tags_url":"https://api.github.com/repos/cryptape/cita-common/tags","blobs_url":"https://api.github.com/repos/cryptape/cita-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cryptape/cita-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cryptape/cita-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/cryptape/cita-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cryptape/cita-common/statuses/{sha}","languages_url":"https://api.github.com/repos/cryptape/cita-common/languages","stargazers_url":"https://api.github.com/repos/cryptape/cita-common/stargazers","contributors_url":"https://api.github.com/repos/cryptape/cita-common/contributors","subscribers_url":"https://api.github.com/repos/cryptape/cita-common/subscribers","subscription_url":"https://api.github.com/repos/cryptape/cita-common/subscription","commits_url":"https://api.github.com/repos/cryptape/cita-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/cryptape/cita-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/cryptape/cita-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/cryptape/cita-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/cryptape/cita-common/contents/{+path}","compare_url":"https://api.github.com/repos/cryptape/cita-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cryptape/cita-common/merges","archive_url":"https://api.github.com/repos/cryptape/cita-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cryptape/cita-common/downloads","issues_url":"https://api.github.com/repos/cryptape/cita-common/issues{/number}","pulls_url":"https://api.github.com/repos/cryptape/cita-common/pulls{/number}","milestones_url":"https://api.github.com/repos/cryptape/cita-common/milestones{/number}","notifications_url":"https://api.github.com/repos/cryptape/cita-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cryptape/cita-common/labels{/name}","releases_url":"https://api.github.com/repos/cryptape/cita-common/releases{/id}","deployments_url":"https://api.github.com/repos/cryptape/cita-common/deployments","created_at":"2017-12-19T08:34:21Z","updated_at":"2018-05-11T10:27:33Z","pushed_at":"2018-05-14T02:05:51Z","git_url":"git://github.com/cryptape/cita-common.git","ssh_url":"git@github.com:cryptape/cita-common.git","clone_url":"https://github.com/cryptape/cita-common.git","svn_url":"https://github.com/cryptape/cita-common","homepage":"","size":1226,"stargazers_count":2,"watchers_count":2,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":8,"open_issues":1,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cryptape/cita-common/pulls/76"},"html":{"href":"https://github.com/cryptape/cita-common/pull/76"},"issue":{"href":"https://api.github.com/repos/cryptape/cita-common/issues/76"},"comments":{"href":"https://api.github.com/repos/cryptape/cita-common/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/cryptape/cita-common/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/cryptape/cita-common/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cryptape/cita-common/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/cryptape/cita-common/statuses/4e9c1cedffe78fcd4e4de6020eaf91489bf0ad50"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kaikai1024"}}