{"action":"created","comment":{"url":"https://api.github.com/repos/tendermint/tendermint/pulls/comments/158339909","pull_request_review_id":85137257,"id":158339909,"diff_hunk":"@@ -251,24 +254,76 @@ func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader typ\n \t// Update validator accums and set state variables\n \tnextValSet.IncrementAccum(1)\n \n+\tnextParams := applyUpdates(s.Params,\n+\t\tabciResponses.EndBlock.ConsensusParamUpdates)\n+\terr := nextParams.Validate()\n+\tif err != nil {\n+\t\ts.logger.Error(\"Error updating consensus params\", \"err\", err)\n+\t\t// TODO: err or carry on?\n+\t\tnextParams = s.Params\n+\t}\n+\n \ts.setBlockAndValidators(header.Height,\n \t\theader.NumTxs,\n \t\ttypes.BlockID{header.Hash(), blockPartsHeader},\n \t\theader.Time,\n-\t\tprevValSet, nextValSet)\n+\t\tprevValSet, nextValSet,\n+\t\tnextParams)\n+\n+}\n \n+// applyUpdates returns new ConsensusParams\n+// whose fields are set to any non-zero fields of c.\n+// If c is nil, it returns p unmodified, as it was passed in.\n+func applyUpdates(p types.ConsensusParams,\n+\tc *abci.ConsensusParams) types.ConsensusParams {\n+\n+\tif c == nil {\n+\t\treturn p\n+\t}\n+\tres := p\n+\t// we must defensively consider any structs may be nil\n+\tif c.BlockSize != nil {\n+\n+\t\tif c.BlockSize.MaxBytes != 0 {\n+\t\t\tres.BlockSize.MaxBytes = int(c.BlockSize.MaxBytes)","path":"state/state.go","position":65,"original_position":65,"commit_id":"0ffd60b8cfb758859a3308a20673cb1d7e56525e","original_commit_id":"0ffd60b8cfb758859a3308a20673cb1d7e56525e","user":{"login":"melekes","id":1282182,"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},"body":"should we check this is greater than `0`?","created_at":"2017-12-21T17:57:28Z","updated_at":"2017-12-21T17:57:28Z","html_url":"https://github.com/tendermint/tendermint/pull/972#discussion_r158339909","pull_request_url":"https://api.github.com/repos/tendermint/tendermint/pulls/972","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/comments/158339909"},"html":{"href":"https://github.com/tendermint/tendermint/pull/972#discussion_r158339909"},"pull_request":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/972"}}},"pull_request":{"url":"https://api.github.com/repos/tendermint/tendermint/pulls/972","id":158152377,"html_url":"https://github.com/tendermint/tendermint/pull/972","diff_url":"https://github.com/tendermint/tendermint/pull/972.diff","patch_url":"https://github.com/tendermint/tendermint/pull/972.patch","issue_url":"https://api.github.com/repos/tendermint/tendermint/issues/972","number":972,"state":"open","locked":false,"title":"Update EndBlock parameters","user":{"login":"ethanfrey","id":5689864,"avatar_url":"https://avatars3.githubusercontent.com/u/5689864?v=4","gravatar_id":"","url":"https://api.github.com/users/ethanfrey","html_url":"https://github.com/ethanfrey","followers_url":"https://api.github.com/users/ethanfrey/followers","following_url":"https://api.github.com/users/ethanfrey/following{/other_user}","gists_url":"https://api.github.com/users/ethanfrey/gists{/gist_id}","starred_url":"https://api.github.com/users/ethanfrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethanfrey/subscriptions","organizations_url":"https://api.github.com/users/ethanfrey/orgs","repos_url":"https://api.github.com/users/ethanfrey/repos","events_url":"https://api.github.com/users/ethanfrey/events{/privacy}","received_events_url":"https://api.github.com/users/ethanfrey/received_events","type":"User","site_admin":false},"body":"* Update abci dependencies\r\n* Modify references from Diffs to Changes\r\n* Fixes issues #924\r\n* Partial fix for #952 \r\n  * Updates consensus parameter upon EndBlock\r\n  * Add Hash for ConsensusParams to block headers\r\n  * State maintains LastConsensusHash to verify blocks\r\n","created_at":"2017-12-13T17:11:11Z","updated_at":"2017-12-21T17:57:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"047eb75e7bb0241ce21d17be95a2d7dca135bf61","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ebuchman","id":2300911,"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}],"milestone":null,"commits_url":"https://api.github.com/repos/tendermint/tendermint/pulls/972/commits","review_comments_url":"https://api.github.com/repos/tendermint/tendermint/pulls/972/comments","review_comment_url":"https://api.github.com/repos/tendermint/tendermint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tendermint/tendermint/issues/972/comments","statuses_url":"https://api.github.com/repos/tendermint/tendermint/statuses/0ffd60b8cfb758859a3308a20673cb1d7e56525e","head":{"label":"tendermint:feature/enhance-endblock","ref":"feature/enhance-endblock","sha":"0ffd60b8cfb758859a3308a20673cb1d7e56525e","user":{"login":"tendermint","id":7572940,"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,"name":"tendermint","full_name":"tendermint/tendermint","owner":{"login":"tendermint","id":7572940,"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},"private":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":"2017-12-21T17:27:29Z","pushed_at":"2017-12-21T17:52:58Z","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":31179,"stargazers_count":1022,"watchers_count":1022,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":197,"mirror_url":null,"archived":false,"open_issues_count":128,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":197,"open_issues":128,"watchers":1022,"default_branch":"master"}},"base":{"label":"tendermint:develop","ref":"develop","sha":"652d1e3de8a3f216299ca66c595cc66504930d28","user":{"login":"tendermint","id":7572940,"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,"name":"tendermint","full_name":"tendermint/tendermint","owner":{"login":"tendermint","id":7572940,"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},"private":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":"2017-12-21T17:27:29Z","pushed_at":"2017-12-21T17:52:58Z","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":31179,"stargazers_count":1022,"watchers_count":1022,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":197,"mirror_url":null,"archived":false,"open_issues_count":128,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":197,"open_issues":128,"watchers":1022,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/972"},"html":{"href":"https://github.com/tendermint/tendermint/pull/972"},"issue":{"href":"https://api.github.com/repos/tendermint/tendermint/issues/972"},"comments":{"href":"https://api.github.com/repos/tendermint/tendermint/issues/972/comments"},"review_comments":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/972/comments"},"review_comment":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tendermint/tendermint/pulls/972/commits"},"statuses":{"href":"https://api.github.com/repos/tendermint/tendermint/statuses/0ffd60b8cfb758859a3308a20673cb1d7e56525e"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"melekes"}}