{"action":"created","comment":{"url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments/196884047","pull_request_review_id":130517880,"id":196884047,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Njg4NDA0Nw==","diff_hunk":"@@ -0,0 +1,245 @@\n+package lib\n+\n+import (\n+\t\"fmt\"\n+\t\"strconv\"\n+\n+\tsdk \"github.com/cosmos/cosmos-sdk/types\"\n+\twire \"github.com/cosmos/cosmos-sdk/wire\"\n+)\n+\n+// Linear defines a primitive mapper type\n+type Linear struct {\n+\tcdc   *wire.Codec\n+\tstore sdk.KVStore\n+}\n+\n+// List is a Linear interface that provides list-like functions\n+// It panics when the element type cannot be (un/)marshalled by the codec\n+type List interface {\n+\n+\t// Len() returns the length of the list\n+\t// The length is only increased by Push() and not decreased\n+\t// List dosen't check if an index is in bounds\n+\t// The user should check Len() before doing any actions\n+\tLen() uint64\n+\n+\t// Get() returns the element by its index\n+\tGet(uint64, interface{}) error\n+\n+\t// Set() stores the element to the given position\n+\t// Setting element out of range will break length counting\n+\t// Use Push() instead of Set() to append a new element\n+\tSet(uint64, interface{})\n+\n+\t// Delete() deletes the element in the given position\n+\t// Other elements' indices are preserved after deletion\n+\t// Panics when the index is out of range\n+\tDelete(uint64)\n+\n+\t// Push() inserts the element to the end of the list\n+\t// It will increase the length when it is called\n+\tPush(interface{})\n+\n+\t// Iterate*() is used to iterate over all existing elements in the list\n+\t// Return true in the continuation to break\n+\t// The second element of the continuation will indicate the position of the element\n+\t// Using it with Get() will return the same one with the provided element\n+\n+\t// CONTRACT: No writes may happen within a domain while iterating over it.\n+\tIterate(interface{}, func(uint64) bool)\n+}\n+\n+// NewList constructs new List\n+func NewList(cdc *wire.Codec, store sdk.KVStore) List {\n+\treturn Linear{\n+\t\tcdc:   cdc,\n+\t\tstore: store,\n+\t}\n+}\n+\n+// Key for the length of the list\n+func LengthKey() []byte {\n+\treturn []byte{0x00}\n+}\n+\n+// Key for the elements of the list\n+func ElemKey(index uint64) []byte {\n+\treturn append([]byte{0x01}, []byte(fmt.Sprintf(\"%020d\", index))...)\n+}\n+\n+// Len implements List\n+func (m Linear) Len() uint64 {","path":"types/lib/linear.go","position":72,"original_position":72,"commit_id":"835e3181f2480389e05cf51980328d88668f74ea","original_commit_id":"835e3181f2480389e05cf51980328d88668f74ea","user":{"login":"cwgoes","id":24760279,"node_id":"MDQ6VXNlcjI0NzYwMjc5","avatar_url":"https://avatars2.githubusercontent.com/u/24760279?v=4","gravatar_id":"","url":"https://api.github.com/users/cwgoes","html_url":"https://github.com/cwgoes","followers_url":"https://api.github.com/users/cwgoes/followers","following_url":"https://api.github.com/users/cwgoes/following{/other_user}","gists_url":"https://api.github.com/users/cwgoes/gists{/gist_id}","starred_url":"https://api.github.com/users/cwgoes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cwgoes/subscriptions","organizations_url":"https://api.github.com/users/cwgoes/orgs","repos_url":"https://api.github.com/users/cwgoes/repos","events_url":"https://api.github.com/users/cwgoes/events{/privacy}","received_events_url":"https://api.github.com/users/cwgoes/received_events","type":"User","site_admin":false},"body":"Can we set the length key in `NewList`?","created_at":"2018-06-20T17:47:46Z","updated_at":"2018-06-20T17:51:02Z","html_url":"https://github.com/cosmos/cosmos-sdk/pull/1254#discussion_r196884047","pull_request_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1254","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments/196884047"},"html":{"href":"https://github.com/cosmos/cosmos-sdk/pull/1254#discussion_r196884047"},"pull_request":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1254"}}},"pull_request":{"url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1254","id":194765475,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0NzY1NDc1","html_url":"https://github.com/cosmos/cosmos-sdk/pull/1254","diff_url":"https://github.com/cosmos/cosmos-sdk/pull/1254.diff","patch_url":"https://github.com/cosmos/cosmos-sdk/pull/1254.patch","issue_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/1254","number":1254,"state":"open","locked":false,"title":"Add prefixstore and lib refactor","user":{"login":"mossid","id":18329646,"node_id":"MDQ6VXNlcjE4MzI5NjQ2","avatar_url":"https://avatars0.githubusercontent.com/u/18329646?v=4","gravatar_id":"","url":"https://api.github.com/users/mossid","html_url":"https://github.com/mossid","followers_url":"https://api.github.com/users/mossid/followers","following_url":"https://api.github.com/users/mossid/following{/other_user}","gists_url":"https://api.github.com/users/mossid/gists{/gist_id}","starred_url":"https://api.github.com/users/mossid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mossid/subscriptions","organizations_url":"https://api.github.com/users/mossid/orgs","repos_url":"https://api.github.com/users/mossid/repos","events_url":"https://api.github.com/users/mossid/events{/privacy}","received_events_url":"https://api.github.com/users/mossid/received_events","type":"User","site_admin":false},"body":"Add prefixstore: Prefixstore wraps KVStore with a prefix\r\nLib refactor: lib types now uses KVStores instead of StoreKey directly\r\n\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* [ ] Updated Gaia/Examples\r\n* [x] Squashed all commits, uses message \"Merge pull request #XYZ: [title]\" ([coding standards](https://github.com/tendermint/coding/blob/master/README.md#merging-a-pr))\r\n","created_at":"2018-06-14T02:47:43Z","updated_at":"2018-06-20T17:51:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6072ee0f4476c34588381f8eed04fd92a5157055","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}],"milestone":null,"commits_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1254/commits","review_comments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1254/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/1254/comments","statuses_url":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/835e3181f2480389e05cf51980328d88668f74ea","head":{"label":"cosmos:joon/lib-refactor","ref":"joon/lib-refactor","sha":"835e3181f2480389e05cf51980328d88668f74ea","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-20T17:34:20Z","pushed_at":"2018-06-20T17:45:26Z","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":19365,"stargazers_count":429,"watchers_count":429,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":124,"mirror_url":null,"archived":false,"open_issues_count":241,"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":124,"open_issues":241,"watchers":429,"default_branch":"develop"}},"base":{"label":"cosmos:develop","ref":"develop","sha":"2a9bc2153a42bc7b22305903182753e64c6e024c","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-20T17:34:20Z","pushed_at":"2018-06-20T17:45:26Z","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":19365,"stargazers_count":429,"watchers_count":429,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":124,"mirror_url":null,"archived":false,"open_issues_count":241,"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":124,"open_issues":241,"watchers":429,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1254"},"html":{"href":"https://github.com/cosmos/cosmos-sdk/pull/1254"},"issue":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/1254"},"comments":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/1254/comments"},"review_comments":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/1254/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/1254/commits"},"statuses":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/835e3181f2480389e05cf51980328d88668f74ea"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cwgoes"}}