{"action":"created","comment":{"url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments/197364744","pull_request_review_id":131095084,"id":197364744,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzM2NDc0NA==","diff_hunk":"@@ -0,0 +1,230 @@\n+package keeper\n+\n+import (\n+\t\"bytes\"\n+\n+\tsdk \"github.com/cosmos/cosmos-sdk/types\"\n+\t\"github.com/cosmos/cosmos-sdk/x/stake/types\"\n+)\n+\n+// load a delegation\n+func (k Keeper) GetDelegation(ctx sdk.Context,\n+\tdelegatorAddr, validatorAddr sdk.Address) (delegation types.Delegation, found bool) {\n+\n+\tstore := ctx.KVStore(k.storeKey)\n+\tdelegatorBytes := store.Get(GetDelegationKey(delegatorAddr, validatorAddr, k.cdc))\n+\tif delegatorBytes == nil {\n+\t\treturn delegation, false\n+\t}\n+\n+\tk.cdc.MustUnmarshalBinary(delegatorBytes, &delegation)\n+\treturn delegation, true\n+}\n+\n+// load all delegations used during genesis dump\n+func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegation) {\n+\tstore := ctx.KVStore(k.storeKey)\n+\titerator := sdk.KVStorePrefixIterator(store, DelegationKey)\n+\n+\ti := 0\n+\tfor ; ; i++ {\n+\t\tif !iterator.Valid() {\n+\t\t\titerator.Close()","path":"x/stake/keeper/delegation.go","position":32,"original_position":32,"commit_id":"ad9da64c11fd544e3b89b7afce2767d525de2816","original_commit_id":"ad9da64c11fd544e3b89b7afce2767d525de2816","user":{"login":"ValarDragon","id":6440154,"node_id":"MDQ6VXNlcjY0NDAxNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6440154?v=4","gravatar_id":"","url":"https://api.github.com/users/ValarDragon","html_url":"https://github.com/ValarDragon","followers_url":"https://api.github.com/users/ValarDragon/followers","following_url":"https://api.github.com/users/ValarDragon/following{/other_user}","gists_url":"https://api.github.com/users/ValarDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/ValarDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ValarDragon/subscriptions","organizations_url":"https://api.github.com/users/ValarDragon/orgs","repos_url":"https://api.github.com/users/ValarDragon/repos","events_url":"https://api.github.com/users/ValarDragon/events{/privacy}","received_events_url":"https://api.github.com/users/ValarDragon/received_events","type":"User","site_admin":false},"body":"Can this be closed outside of the loop, per #1125 ","created_at":"2018-06-22T07:45:42Z","updated_at":"2018-06-22T07:49:14Z","html_url":"https://github.com/cosmos/cosmos-sdk/pull/1119#discussion_r197364744","pull_request_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments/197364744"},"html":{"href":"https://github.com/cosmos/cosmos-sdk/pull/1119#discussion_r197364744"},"pull_request":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119"}}},"pull_request":{"url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119","id":192171823,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMTcxODIz","html_url":"https://github.com/cosmos/cosmos-sdk/pull/1119","diff_url":"https://github.com/cosmos/cosmos-sdk/pull/1119.diff","patch_url":"https://github.com/cosmos/cosmos-sdk/pull/1119.patch","issue_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/1119","number":1119,"state":"open","locked":false,"title":"WIP Unbonding, Redelegation","user":{"login":"rigelrozanski","id":20132176,"node_id":"MDQ6VXNlcjIwMTMyMTc2","avatar_url":"https://avatars1.githubusercontent.com/u/20132176?v=4","gravatar_id":"","url":"https://api.github.com/users/rigelrozanski","html_url":"https://github.com/rigelrozanski","followers_url":"https://api.github.com/users/rigelrozanski/followers","following_url":"https://api.github.com/users/rigelrozanski/following{/other_user}","gists_url":"https://api.github.com/users/rigelrozanski/gists{/gist_id}","starred_url":"https://api.github.com/users/rigelrozanski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rigelrozanski/subscriptions","organizations_url":"https://api.github.com/users/rigelrozanski/orgs","repos_url":"https://api.github.com/users/rigelrozanski/repos","events_url":"https://api.github.com/users/rigelrozanski/events{/privacy}","received_events_url":"https://api.github.com/users/rigelrozanski/received_events","type":"User","site_admin":false},"body":"Closes #992 \r\nCloses #1122\r\n\r\n- Only Active Slashing for both redelegation and unbonding\r\n* [ ] Address https://github.com/cosmos/cosmos-sdk/issues/1215\r\n* [ ] Updated all relevant documentation in docs\r\n* [ ] Updated all code comments where relevant\r\n* [x] Wrote tests\r\n* [ ] Updated CHANGELOG.md\r\n","created_at":"2018-06-02T01:18:41Z","updated_at":"2018-06-22T07:49:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5de0ee1708b05d23766123f368f2c8055fc75d5a","assignee":null,"assignees":[],"requested_reviewers":[{"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":[{"id":965477209,"node_id":"MDU6TGFiZWw5NjU0NzcyMDk=","url":"https://api.github.com/repos/cosmos/cosmos-sdk/labels/ready-for-review","name":"ready-for-review","color":"e6fad2","default":false},{"id":851620486,"node_id":"MDU6TGFiZWw4NTE2MjA0ODY=","url":"https://api.github.com/repos/cosmos/cosmos-sdk/labels/staking","name":"staking","color":"fce0ab","default":false},{"id":965477353,"node_id":"MDU6TGFiZWw5NjU0NzczNTM=","url":"https://api.github.com/repos/cosmos/cosmos-sdk/labels/wip","name":"wip","color":"fafad2","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119/commits","review_comments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119/comments","review_comment_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/1119/comments","statuses_url":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/ad9da64c11fd544e3b89b7afce2767d525de2816","head":{"label":"cosmos:rigel/unbonding","ref":"rigel/unbonding","sha":"ad9da64c11fd544e3b89b7afce2767d525de2816","user":{"login":"cosmos","id":228843,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODg0Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/228843?v=4","gravatar_id":"","url":"https://api.github.com/users/cosmos","html_url":"https://github.com/cosmos","followers_url":"https://api.github.com/users/cosmos/followers","following_url":"https://api.github.com/users/cosmos/following{/other_user}","gists_url":"https://api.github.com/users/cosmos/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmos/subscriptions","organizations_url":"https://api.github.com/users/cosmos/orgs","repos_url":"https://api.github.com/users/cosmos/repos","events_url":"https://api.github.com/users/cosmos/events{/privacy}","received_events_url":"https://api.github.com/users/cosmos/received_events","type":"Organization","site_admin":false},"repo":{"id":51193526,"node_id":"MDEwOlJlcG9zaXRvcnk1MTE5MzUyNg==","name":"cosmos-sdk","full_name":"cosmos/cosmos-sdk","owner":{"login":"cosmos","id":228843,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODg0Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/228843?v=4","gravatar_id":"","url":"https://api.github.com/users/cosmos","html_url":"https://github.com/cosmos","followers_url":"https://api.github.com/users/cosmos/followers","following_url":"https://api.github.com/users/cosmos/following{/other_user}","gists_url":"https://api.github.com/users/cosmos/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmos/subscriptions","organizations_url":"https://api.github.com/users/cosmos/orgs","repos_url":"https://api.github.com/users/cosmos/repos","events_url":"https://api.github.com/users/cosmos/events{/privacy}","received_events_url":"https://api.github.com/users/cosmos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cosmos/cosmos-sdk","description":"Secure Blockchain Framework","fork":false,"url":"https://api.github.com/repos/cosmos/cosmos-sdk","forks_url":"https://api.github.com/repos/cosmos/cosmos-sdk/forks","keys_url":"https://api.github.com/repos/cosmos/cosmos-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cosmos/cosmos-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cosmos/cosmos-sdk/teams","hooks_url":"https://api.github.com/repos/cosmos/cosmos-sdk/hooks","issue_events_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/cosmos/cosmos-sdk/events","assignees_url":"https://api.github.com/repos/cosmos/cosmos-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/cosmos/cosmos-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/cosmos/cosmos-sdk/tags","blobs_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/cosmos/cosmos-sdk/languages","stargazers_url":"https://api.github.com/repos/cosmos/cosmos-sdk/stargazers","contributors_url":"https://api.github.com/repos/cosmos/cosmos-sdk/contributors","subscribers_url":"https://api.github.com/repos/cosmos/cosmos-sdk/subscribers","subscription_url":"https://api.github.com/repos/cosmos/cosmos-sdk/subscription","commits_url":"https://api.github.com/repos/cosmos/cosmos-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/cosmos/cosmos-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/cosmos/cosmos-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cosmos/cosmos-sdk/merges","archive_url":"https://api.github.com/repos/cosmos/cosmos-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cosmos/cosmos-sdk/downloads","issues_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/cosmos/cosmos-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/cosmos/cosmos-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cosmos/cosmos-sdk/labels{/name}","releases_url":"https://api.github.com/repos/cosmos/cosmos-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/deployments","created_at":"2016-02-06T07:15:53Z","updated_at":"2018-06-22T06:15:31Z","pushed_at":"2018-06-22T07:40:12Z","git_url":"git://github.com/cosmos/cosmos-sdk.git","ssh_url":"git@github.com:cosmos/cosmos-sdk.git","clone_url":"https://github.com/cosmos/cosmos-sdk.git","svn_url":"https://github.com/cosmos/cosmos-sdk","homepage":"https://cosmos.network/","size":14212,"stargazers_count":435,"watchers_count":435,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":125,"mirror_url":null,"archived":false,"open_issues_count":236,"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":125,"open_issues":236,"watchers":435,"default_branch":"develop"}},"base":{"label":"cosmos:develop","ref":"develop","sha":"4884747662768d0325c86e5f10f8dc7f508e0d60","user":{"login":"cosmos","id":228843,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODg0Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/228843?v=4","gravatar_id":"","url":"https://api.github.com/users/cosmos","html_url":"https://github.com/cosmos","followers_url":"https://api.github.com/users/cosmos/followers","following_url":"https://api.github.com/users/cosmos/following{/other_user}","gists_url":"https://api.github.com/users/cosmos/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmos/subscriptions","organizations_url":"https://api.github.com/users/cosmos/orgs","repos_url":"https://api.github.com/users/cosmos/repos","events_url":"https://api.github.com/users/cosmos/events{/privacy}","received_events_url":"https://api.github.com/users/cosmos/received_events","type":"Organization","site_admin":false},"repo":{"id":51193526,"node_id":"MDEwOlJlcG9zaXRvcnk1MTE5MzUyNg==","name":"cosmos-sdk","full_name":"cosmos/cosmos-sdk","owner":{"login":"cosmos","id":228843,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODg0Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/228843?v=4","gravatar_id":"","url":"https://api.github.com/users/cosmos","html_url":"https://github.com/cosmos","followers_url":"https://api.github.com/users/cosmos/followers","following_url":"https://api.github.com/users/cosmos/following{/other_user}","gists_url":"https://api.github.com/users/cosmos/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmos/subscriptions","organizations_url":"https://api.github.com/users/cosmos/orgs","repos_url":"https://api.github.com/users/cosmos/repos","events_url":"https://api.github.com/users/cosmos/events{/privacy}","received_events_url":"https://api.github.com/users/cosmos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cosmos/cosmos-sdk","description":"Secure Blockchain Framework","fork":false,"url":"https://api.github.com/repos/cosmos/cosmos-sdk","forks_url":"https://api.github.com/repos/cosmos/cosmos-sdk/forks","keys_url":"https://api.github.com/repos/cosmos/cosmos-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cosmos/cosmos-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cosmos/cosmos-sdk/teams","hooks_url":"https://api.github.com/repos/cosmos/cosmos-sdk/hooks","issue_events_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/cosmos/cosmos-sdk/events","assignees_url":"https://api.github.com/repos/cosmos/cosmos-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/cosmos/cosmos-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/cosmos/cosmos-sdk/tags","blobs_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/cosmos/cosmos-sdk/languages","stargazers_url":"https://api.github.com/repos/cosmos/cosmos-sdk/stargazers","contributors_url":"https://api.github.com/repos/cosmos/cosmos-sdk/contributors","subscribers_url":"https://api.github.com/repos/cosmos/cosmos-sdk/subscribers","subscription_url":"https://api.github.com/repos/cosmos/cosmos-sdk/subscription","commits_url":"https://api.github.com/repos/cosmos/cosmos-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/cosmos/cosmos-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/cosmos/cosmos-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/cosmos/cosmos-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cosmos/cosmos-sdk/merges","archive_url":"https://api.github.com/repos/cosmos/cosmos-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cosmos/cosmos-sdk/downloads","issues_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/cosmos/cosmos-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/cosmos/cosmos-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cosmos/cosmos-sdk/labels{/name}","releases_url":"https://api.github.com/repos/cosmos/cosmos-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/deployments","created_at":"2016-02-06T07:15:53Z","updated_at":"2018-06-22T06:15:31Z","pushed_at":"2018-06-22T07:40:12Z","git_url":"git://github.com/cosmos/cosmos-sdk.git","ssh_url":"git@github.com:cosmos/cosmos-sdk.git","clone_url":"https://github.com/cosmos/cosmos-sdk.git","svn_url":"https://github.com/cosmos/cosmos-sdk","homepage":"https://cosmos.network/","size":14212,"stargazers_count":435,"watchers_count":435,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":125,"mirror_url":null,"archived":false,"open_issues_count":236,"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":125,"open_issues":236,"watchers":435,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119"},"html":{"href":"https://github.com/cosmos/cosmos-sdk/pull/1119"},"issue":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/1119"},"comments":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/1119/comments"},"review_comments":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119/comments"},"review_comment":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1119/commits"},"statuses":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/ad9da64c11fd544e3b89b7afce2767d525de2816"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ValarDragon"}}