{"action":"created","comment":{"url":"https://api.github.com/repos/tendermint/tendermint/pulls/comments/217947976","pull_request_review_id":155780335,"id":217947976,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzk0Nzk3Ng==","diff_hunk":"@@ -56,7 +65,38 @@ func (ic *DynamicVerifier) ChainID() string {\n // ic.trusted and ic.source to prove the new validators.  On success, it will\n // try to store the SignedHeader in ic.trusted if the next\n // validator can be sourced.\n-func (ic *DynamicVerifier) Certify(shdr types.SignedHeader) error {\n+func (ic *DynamicVerifier) Verify(shdr types.SignedHeader) error {\n+\n+\t// Performs synchronization for multi-threads verification at the same height.\n+\tic.mtx.Lock()\n+\tif pending := ic.pendingVerifications[shdr.Height]; pending != nil {\n+\t\tic.mtx.Unlock()\n+\t\t<-pending // pending is chan struct{}\n+\t} else {\n+\t\tpending := make(chan struct{})\n+\t\tic.pendingVerifications[shdr.Height] = pending\n+\t\tdefer func() {\n+\t\t\tclose(pending)\n+\t\t\tic.mtx.Lock()\n+\t\t\tdelete(ic.pendingVerifications, shdr.Height)\n+\t\t\tic.mtx.Unlock()\n+\t\t}()\n+\t\tic.mtx.Unlock()\n+\t}\n+\t//Get the exact trusted commit for h, and if it is\n+\t// equal to shdr, then don't even verify it,\n+\t// and just return nil.\n+\ttrustedFCSameHeight, err := ic.trusted.LatestFullCommit(ic.chainID, shdr.Height, shdr.Height)","path":"lite/dynamic_verifier.go","position":66,"original_position":66,"commit_id":"5f1af3961e7a65bae5515c338fbb9630e24b80ba","original_commit_id":"5f1af3961e7a65bae5515c338fbb9630e24b80ba","user":{"login":"HaoyangLiu","id":2945006,"node_id":"MDQ6VXNlcjI5NDUwMDY=","avatar_url":"https://avatars0.githubusercontent.com/u/2945006?v=4","gravatar_id":"","url":"https://api.github.com/users/HaoyangLiu","html_url":"https://github.com/HaoyangLiu","followers_url":"https://api.github.com/users/HaoyangLiu/followers","following_url":"https://api.github.com/users/HaoyangLiu/following{/other_user}","gists_url":"https://api.github.com/users/HaoyangLiu/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoyangLiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoyangLiu/subscriptions","organizations_url":"https://api.github.com/users/HaoyangLiu/orgs","repos_url":"https://api.github.com/users/HaoyangLiu/repos","events_url":"https://api.github.com/users/HaoyangLiu/events{/privacy}","received_events_url":"https://api.github.com/users/HaoyangLiu/received_events","type":"User","site_admin":false},"body":"Both of them will store the commits. Here we create disk db and memory db to cache the verified commits:\r\nhttps://github.com/tendermint/tendermint/blob/d419fffe18531317c28c29a292ad7d253f6cafdf/lite/proxy/verifier.go#L16\r\n\r\nActually, I have changed the [test](https://github.com/HaoyangLiu/tendermint/blob/5f1af3961e7a65bae5515c338fbb9630e24b80ba/lite/dynamic_verifier_test.go#L130) to cover the new code. Next I will create a new test to simulate concurrent requests.","created_at":"2018-09-17T04:43:34Z","updated_at":"2018-09-17T04:43:34Z","html_url":"https://github.com/tendermint/tendermint/pull/2396#discussion_r217947976","pull_request_url":"https://api.github.com/repos/tendermint/tendermint/pulls/2396","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/comments/217947976"},"html":{"href":"https://github.com/tendermint/tendermint/pull/2396#discussion_r217947976"},"pull_request":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/2396"}},"in_reply_to_id":217946387},"pull_request":{"url":"https://api.github.com/repos/tendermint/tendermint/pulls/2396","id":215475332,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NDc1MzMy","html_url":"https://github.com/tendermint/tendermint/pull/2396","diff_url":"https://github.com/tendermint/tendermint/pull/2396.diff","patch_url":"https://github.com/tendermint/tendermint/pull/2396.patch","issue_url":"https://api.github.com/repos/tendermint/tendermint/issues/2396","number":2396,"state":"open","locked":false,"title":"WIP: Add synchronization in lite verify","user":{"login":"HaoyangLiu","id":2945006,"node_id":"MDQ6VXNlcjI5NDUwMDY=","avatar_url":"https://avatars0.githubusercontent.com/u/2945006?v=4","gravatar_id":"","url":"https://api.github.com/users/HaoyangLiu","html_url":"https://github.com/HaoyangLiu","followers_url":"https://api.github.com/users/HaoyangLiu/followers","following_url":"https://api.github.com/users/HaoyangLiu/following{/other_user}","gists_url":"https://api.github.com/users/HaoyangLiu/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoyangLiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoyangLiu/subscriptions","organizations_url":"https://api.github.com/users/HaoyangLiu/orgs","repos_url":"https://api.github.com/users/HaoyangLiu/repos","events_url":"https://api.github.com/users/HaoyangLiu/events{/privacy}","received_events_url":"https://api.github.com/users/HaoyangLiu/received_events","type":"User","site_admin":false},"body":"Implement the idea in https://github.com/tendermint/tendermint/issues/2386\r\n* Add synchronization in lite verify \r\n* Change `Certify` to `Verify`","created_at":"2018-09-14T04:00:11Z","updated_at":"2018-09-17T04:43:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc0ac828fba23613bb72502df41b6d5942084265","assignee":null,"assignees":[],"requested_reviewers":[{"login":"xla","id":1585,"node_id":"MDQ6VXNlcjE1ODU=","avatar_url":"https://avatars1.githubusercontent.com/u/1585?v=4","gravatar_id":"","url":"https://api.github.com/users/xla","html_url":"https://github.com/xla","followers_url":"https://api.github.com/users/xla/followers","following_url":"https://api.github.com/users/xla/following{/other_user}","gists_url":"https://api.github.com/users/xla/gists{/gist_id}","starred_url":"https://api.github.com/users/xla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xla/subscriptions","organizations_url":"https://api.github.com/users/xla/orgs","repos_url":"https://api.github.com/users/xla/repos","events_url":"https://api.github.com/users/xla/events{/privacy}","received_events_url":"https://api.github.com/users/xla/received_events","type":"User","site_admin":false},{"login":"melekes","id":1282182,"node_id":"MDQ6VXNlcjEyODIxODI=","avatar_url":"https://avatars2.githubusercontent.com/u/1282182?v=4","gravatar_id":"","url":"https://api.github.com/users/melekes","html_url":"https://github.com/melekes","followers_url":"https://api.github.com/users/melekes/followers","following_url":"https://api.github.com/users/melekes/following{/other_user}","gists_url":"https://api.github.com/users/melekes/gists{/gist_id}","starred_url":"https://api.github.com/users/melekes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melekes/subscriptions","organizations_url":"https://api.github.com/users/melekes/orgs","repos_url":"https://api.github.com/users/melekes/repos","events_url":"https://api.github.com/users/melekes/events{/privacy}","received_events_url":"https://api.github.com/users/melekes/received_events","type":"User","site_admin":false},{"login":"ebuchman","id":2300911,"node_id":"MDQ6VXNlcjIzMDA5MTE=","avatar_url":"https://avatars3.githubusercontent.com/u/2300911?v=4","gravatar_id":"","url":"https://api.github.com/users/ebuchman","html_url":"https://github.com/ebuchman","followers_url":"https://api.github.com/users/ebuchman/followers","following_url":"https://api.github.com/users/ebuchman/following{/other_user}","gists_url":"https://api.github.com/users/ebuchman/gists{/gist_id}","starred_url":"https://api.github.com/users/ebuchman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebuchman/subscriptions","organizations_url":"https://api.github.com/users/ebuchman/orgs","repos_url":"https://api.github.com/users/ebuchman/repos","events_url":"https://api.github.com/users/ebuchman/events{/privacy}","received_events_url":"https://api.github.com/users/ebuchman/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tendermint/tendermint/pulls/2396/commits","review_comments_url":"https://api.github.com/repos/tendermint/tendermint/pulls/2396/comments","review_comment_url":"https://api.github.com/repos/tendermint/tendermint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tendermint/tendermint/issues/2396/comments","statuses_url":"https://api.github.com/repos/tendermint/tendermint/statuses/5f1af3961e7a65bae5515c338fbb9630e24b80ba","head":{"label":"HaoyangLiu:bianjie/improve-lite","ref":"bianjie/improve-lite","sha":"5f1af3961e7a65bae5515c338fbb9630e24b80ba","user":{"login":"HaoyangLiu","id":2945006,"node_id":"MDQ6VXNlcjI5NDUwMDY=","avatar_url":"https://avatars0.githubusercontent.com/u/2945006?v=4","gravatar_id":"","url":"https://api.github.com/users/HaoyangLiu","html_url":"https://github.com/HaoyangLiu","followers_url":"https://api.github.com/users/HaoyangLiu/followers","following_url":"https://api.github.com/users/HaoyangLiu/following{/other_user}","gists_url":"https://api.github.com/users/HaoyangLiu/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoyangLiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoyangLiu/subscriptions","organizations_url":"https://api.github.com/users/HaoyangLiu/orgs","repos_url":"https://api.github.com/users/HaoyangLiu/repos","events_url":"https://api.github.com/users/HaoyangLiu/events{/privacy}","received_events_url":"https://api.github.com/users/HaoyangLiu/received_events","type":"User","site_admin":false},"repo":{"id":142951543,"node_id":"MDEwOlJlcG9zaXRvcnkxNDI5NTE1NDM=","name":"tendermint","full_name":"HaoyangLiu/tendermint","private":false,"owner":{"login":"HaoyangLiu","id":2945006,"node_id":"MDQ6VXNlcjI5NDUwMDY=","avatar_url":"https://avatars0.githubusercontent.com/u/2945006?v=4","gravatar_id":"","url":"https://api.github.com/users/HaoyangLiu","html_url":"https://github.com/HaoyangLiu","followers_url":"https://api.github.com/users/HaoyangLiu/followers","following_url":"https://api.github.com/users/HaoyangLiu/following{/other_user}","gists_url":"https://api.github.com/users/HaoyangLiu/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoyangLiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoyangLiu/subscriptions","organizations_url":"https://api.github.com/users/HaoyangLiu/orgs","repos_url":"https://api.github.com/users/HaoyangLiu/repos","events_url":"https://api.github.com/users/HaoyangLiu/events{/privacy}","received_events_url":"https://api.github.com/users/HaoyangLiu/received_events","type":"User","site_admin":false},"html_url":"https://github.com/HaoyangLiu/tendermint","description":"⟁ Tendermint Core (BFT Consensus) in Go","fork":true,"url":"https://api.github.com/repos/HaoyangLiu/tendermint","forks_url":"https://api.github.com/repos/HaoyangLiu/tendermint/forks","keys_url":"https://api.github.com/repos/HaoyangLiu/tendermint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HaoyangLiu/tendermint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HaoyangLiu/tendermint/teams","hooks_url":"https://api.github.com/repos/HaoyangLiu/tendermint/hooks","issue_events_url":"https://api.github.com/repos/HaoyangLiu/tendermint/issues/events{/number}","events_url":"https://api.github.com/repos/HaoyangLiu/tendermint/events","assignees_url":"https://api.github.com/repos/HaoyangLiu/tendermint/assignees{/user}","branches_url":"https://api.github.com/repos/HaoyangLiu/tendermint/branches{/branch}","tags_url":"https://api.github.com/repos/HaoyangLiu/tendermint/tags","blobs_url":"https://api.github.com/repos/HaoyangLiu/tendermint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HaoyangLiu/tendermint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HaoyangLiu/tendermint/git/refs{/sha}","trees_url":"https://api.github.com/repos/HaoyangLiu/tendermint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HaoyangLiu/tendermint/statuses/{sha}","languages_url":"https://api.github.com/repos/HaoyangLiu/tendermint/languages","stargazers_url":"https://api.github.com/repos/HaoyangLiu/tendermint/stargazers","contributors_url":"https://api.github.com/repos/HaoyangLiu/tendermint/contributors","subscribers_url":"https://api.github.com/repos/HaoyangLiu/tendermint/subscribers","subscription_url":"https://api.github.com/repos/HaoyangLiu/tendermint/subscription","commits_url":"https://api.github.com/repos/HaoyangLiu/tendermint/commits{/sha}","git_commits_url":"https://api.github.com/repos/HaoyangLiu/tendermint/git/commits{/sha}","comments_url":"https://api.github.com/repos/HaoyangLiu/tendermint/comments{/number}","issue_comment_url":"https://api.github.com/repos/HaoyangLiu/tendermint/issues/comments{/number}","contents_url":"https://api.github.com/repos/HaoyangLiu/tendermint/contents/{+path}","compare_url":"https://api.github.com/repos/HaoyangLiu/tendermint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HaoyangLiu/tendermint/merges","archive_url":"https://api.github.com/repos/HaoyangLiu/tendermint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HaoyangLiu/tendermint/downloads","issues_url":"https://api.github.com/repos/HaoyangLiu/tendermint/issues{/number}","pulls_url":"https://api.github.com/repos/HaoyangLiu/tendermint/pulls{/number}","milestones_url":"https://api.github.com/repos/HaoyangLiu/tendermint/milestones{/number}","notifications_url":"https://api.github.com/repos/HaoyangLiu/tendermint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HaoyangLiu/tendermint/labels{/name}","releases_url":"https://api.github.com/repos/HaoyangLiu/tendermint/releases{/id}","deployments_url":"https://api.github.com/repos/HaoyangLiu/tendermint/deployments","created_at":"2018-07-31T02:25:06Z","updated_at":"2018-08-13T02:06:02Z","pushed_at":"2018-09-14T05:21:51Z","git_url":"git://github.com/HaoyangLiu/tendermint.git","ssh_url":"git@github.com:HaoyangLiu/tendermint.git","clone_url":"https://github.com/HaoyangLiu/tendermint.git","svn_url":"https://github.com/HaoyangLiu/tendermint","homepage":"https://tendermint.com/","size":51167,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tendermint:develop","ref":"develop","sha":"e3e3c13741acd4dbedb2d03e3f5cff42891cfaa4","user":{"login":"tendermint","id":7572940,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1NzI5NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/7572940?v=4","gravatar_id":"","url":"https://api.github.com/users/tendermint","html_url":"https://github.com/tendermint","followers_url":"https://api.github.com/users/tendermint/followers","following_url":"https://api.github.com/users/tendermint/following{/other_user}","gists_url":"https://api.github.com/users/tendermint/gists{/gist_id}","starred_url":"https://api.github.com/users/tendermint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tendermint/subscriptions","organizations_url":"https://api.github.com/users/tendermint/orgs","repos_url":"https://api.github.com/users/tendermint/repos","events_url":"https://api.github.com/users/tendermint/events{/privacy}","received_events_url":"https://api.github.com/users/tendermint/received_events","type":"Organization","site_admin":false},"repo":{"id":19799491,"node_id":"MDEwOlJlcG9zaXRvcnkxOTc5OTQ5MQ==","name":"tendermint","full_name":"tendermint/tendermint","private":false,"owner":{"login":"tendermint","id":7572940,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1NzI5NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/7572940?v=4","gravatar_id":"","url":"https://api.github.com/users/tendermint","html_url":"https://github.com/tendermint","followers_url":"https://api.github.com/users/tendermint/followers","following_url":"https://api.github.com/users/tendermint/following{/other_user}","gists_url":"https://api.github.com/users/tendermint/gists{/gist_id}","starred_url":"https://api.github.com/users/tendermint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tendermint/subscriptions","organizations_url":"https://api.github.com/users/tendermint/orgs","repos_url":"https://api.github.com/users/tendermint/repos","events_url":"https://api.github.com/users/tendermint/events{/privacy}","received_events_url":"https://api.github.com/users/tendermint/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tendermint/tendermint","description":"⟁ Tendermint Core (BFT Consensus) in Go","fork":false,"url":"https://api.github.com/repos/tendermint/tendermint","forks_url":"https://api.github.com/repos/tendermint/tendermint/forks","keys_url":"https://api.github.com/repos/tendermint/tendermint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tendermint/tendermint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tendermint/tendermint/teams","hooks_url":"https://api.github.com/repos/tendermint/tendermint/hooks","issue_events_url":"https://api.github.com/repos/tendermint/tendermint/issues/events{/number}","events_url":"https://api.github.com/repos/tendermint/tendermint/events","assignees_url":"https://api.github.com/repos/tendermint/tendermint/assignees{/user}","branches_url":"https://api.github.com/repos/tendermint/tendermint/branches{/branch}","tags_url":"https://api.github.com/repos/tendermint/tendermint/tags","blobs_url":"https://api.github.com/repos/tendermint/tendermint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tendermint/tendermint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tendermint/tendermint/git/refs{/sha}","trees_url":"https://api.github.com/repos/tendermint/tendermint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tendermint/tendermint/statuses/{sha}","languages_url":"https://api.github.com/repos/tendermint/tendermint/languages","stargazers_url":"https://api.github.com/repos/tendermint/tendermint/stargazers","contributors_url":"https://api.github.com/repos/tendermint/tendermint/contributors","subscribers_url":"https://api.github.com/repos/tendermint/tendermint/subscribers","subscription_url":"https://api.github.com/repos/tendermint/tendermint/subscription","commits_url":"https://api.github.com/repos/tendermint/tendermint/commits{/sha}","git_commits_url":"https://api.github.com/repos/tendermint/tendermint/git/commits{/sha}","comments_url":"https://api.github.com/repos/tendermint/tendermint/comments{/number}","issue_comment_url":"https://api.github.com/repos/tendermint/tendermint/issues/comments{/number}","contents_url":"https://api.github.com/repos/tendermint/tendermint/contents/{+path}","compare_url":"https://api.github.com/repos/tendermint/tendermint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tendermint/tendermint/merges","archive_url":"https://api.github.com/repos/tendermint/tendermint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tendermint/tendermint/downloads","issues_url":"https://api.github.com/repos/tendermint/tendermint/issues{/number}","pulls_url":"https://api.github.com/repos/tendermint/tendermint/pulls{/number}","milestones_url":"https://api.github.com/repos/tendermint/tendermint/milestones{/number}","notifications_url":"https://api.github.com/repos/tendermint/tendermint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tendermint/tendermint/labels{/name}","releases_url":"https://api.github.com/repos/tendermint/tendermint/releases{/id}","deployments_url":"https://api.github.com/repos/tendermint/tendermint/deployments","created_at":"2014-05-14T23:21:35Z","updated_at":"2018-09-17T02:42:48Z","pushed_at":"2018-09-16T09:49:55Z","git_url":"git://github.com/tendermint/tendermint.git","ssh_url":"git@github.com:tendermint/tendermint.git","clone_url":"https://github.com/tendermint/tendermint.git","svn_url":"https://github.com/tendermint/tendermint","homepage":"https://tendermint.com/","size":51433,"stargazers_count":2303,"watchers_count":2303,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":552,"mirror_url":null,"archived":false,"open_issues_count":326,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":552,"open_issues":326,"watchers":2303,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/2396"},"html":{"href":"https://github.com/tendermint/tendermint/pull/2396"},"issue":{"href":"https://api.github.com/repos/tendermint/tendermint/issues/2396"},"comments":{"href":"https://api.github.com/repos/tendermint/tendermint/issues/2396/comments"},"review_comments":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/2396/comments"},"review_comment":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/2396/commits"},"statuses":{"href":"https://api.github.com/repos/tendermint/tendermint/statuses/5f1af3961e7a65bae5515c338fbb9630e24b80ba"}},"author_association":"NONE"}}
{"actor":{"display_login":"HaoyangLiu"}}