{"action":"created","comment":{"url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments/181712226","pull_request_review_id":112386871,"id":181712226,"diff_hunk":"@@ -0,0 +1,39 @@\n+package types\n+\n+// Codespacer is a simple struct to track reserved codespaces\n+type Codespacer struct {\n+\tnext     CodespaceType\n+\treserved map[CodespaceType]bool\n+}\n+\n+// NewCodespacer generates a new Codespacer with the starting codespace\n+func NewCodespacer() *Codespacer {\n+\treturn &Codespacer{\n+\t\tnext:     CodespaceType(1),\n+\t\treserved: make(map[CodespaceType]bool),\n+\t}\n+}\n+\n+// reserve reserves a specified codespace\n+func (c *Codespacer) reserve(codespace CodespaceType) {\n+\tif codespace == c.next {\n+\t\tc.next++\n+\t} else if codespace < c.next || c.reserved[codespace] {\n+\t\tpanic(\"Cannot reserve codespace - already taken!\")\n+\t} else {\n+\t\tc.reserved[codespace] = true\n+\t}\n+}\n+\n+// Register registers a provided codespace and returns it\n+func (c *Codespacer) Register(codespace CodespaceType) CodespaceType {\n+\tc.reserve(codespace)\n+\treturn codespace\n+}\n+\n+// RegisterDefault registers and returns the next available codespace\n+func (c *Codespacer) RegisterDefault() CodespaceType {","path":"types/codespacer.go","position":35,"original_position":35,"commit_id":"3f703f71bd7b064926441d0d28ea7e71a6f8ab68","original_commit_id":"3f703f71bd7b064926441d0d28ea7e71a6f8ab68","user":{"login":"jaekwon","id":53785,"avatar_url":"https://avatars1.githubusercontent.com/u/53785?v=4","gravatar_id":"","url":"https://api.github.com/users/jaekwon","html_url":"https://github.com/jaekwon","followers_url":"https://api.github.com/users/jaekwon/followers","following_url":"https://api.github.com/users/jaekwon/following{/other_user}","gists_url":"https://api.github.com/users/jaekwon/gists{/gist_id}","starred_url":"https://api.github.com/users/jaekwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaekwon/subscriptions","organizations_url":"https://api.github.com/users/jaekwon/orgs","repos_url":"https://api.github.com/users/jaekwon/repos","events_url":"https://api.github.com/users/jaekwon/events{/privacy}","received_events_url":"https://api.github.com/users/jaekwon/received_events","type":"User","site_admin":false},"body":"RegisterNext","created_at":"2018-04-16T12:13:42Z","updated_at":"2018-04-16T12:13:42Z","html_url":"https://github.com/cosmos/cosmos-sdk/pull/809#discussion_r181712226","pull_request_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/809","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/comments/181712226"},"html":{"href":"https://github.com/cosmos/cosmos-sdk/pull/809#discussion_r181712226"},"pull_request":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/809"}}},"pull_request":{"url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/809","id":179962738,"html_url":"https://github.com/cosmos/cosmos-sdk/pull/809","diff_url":"https://github.com/cosmos/cosmos-sdk/pull/809.diff","patch_url":"https://github.com/cosmos/cosmos-sdk/pull/809.patch","issue_url":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/809","number":809,"state":"open","locked":false,"title":"Error codespacing","user":{"login":"cwgoes","id":24760279,"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":"Ref https://github.com/cosmos/cosmos-sdk/issues/766\r\n\r\nImplements the proposal as best I understand it.\r\n\r\nI'm not a huge fan of this system as implemented at the moment, for the following reasons:\r\n1. ~~Unwieldy for modules, which have to thread error codespaces (an abstraction unrelated to the module) through keepers/functions~~\r\n2. ~~msg.ValidateBasic() has to use `sdk.CodespaceRoot` since it doesn't know the codespace, which is just changed later by `baseapp` - this is confusing~~\r\n3. ~~No obvious way to associate codespaces with keepers when keepers are passed to different handlers (see https://github.com/cosmos/cosmos-sdk/issues/766#issuecomment-379249987) - maybe I misunderstand the proposal here?~~\r\n4. Clients wishing to implement error handling for modules which may be used by different SDK applications must know the particular codespace mappings of the application in question\r\n5. ~~Codespaces are added to routes, which seems like a mismatch, since they have nothing to do with which module should handle which message~~\r\n\r\nFrom the perspective of the SDK, it would be much cleaner to alter the ABCI specification to allow a string error, in which case modules could prefix their error enums with a globally unique identifier and clients would only need to handle errors with that globally unique identifier - no one would need to worry about dynamic codespacing. I don't have a lot of perspective on the general design goals of ABCI; there may be other reasons for a numerical error code.","created_at":"2018-04-06T14:21:11Z","updated_at":"2018-04-16T12:13:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2a71c51f6a8a97fe7f650816ef45608a5c1589d3","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},{"login":"rigelrozanski","id":20132176,"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}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/809/commits","review_comments_url":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/809/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/809/comments","statuses_url":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/3f703f71bd7b064926441d0d28ea7e71a6f8ab68","head":{"label":"cosmos:cwgoes/error-codespacing","ref":"cwgoes/error-codespacing","sha":"3f703f71bd7b064926441d0d28ea7e71a6f8ab68","user":{"login":"cosmos","id":228843,"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,"name":"cosmos-sdk","full_name":"cosmos/cosmos-sdk","owner":{"login":"cosmos","id":228843,"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-04-15T08:41:10Z","pushed_at":"2018-04-16T12:01:22Z","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://tendermint.com","size":5356,"stargazers_count":323,"watchers_count":323,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":167,"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":90,"open_issues":167,"watchers":323,"default_branch":"master"}},"base":{"label":"cosmos:develop","ref":"develop","sha":"b846559ac1843852bcae74735486176610278437","user":{"login":"cosmos","id":228843,"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,"name":"cosmos-sdk","full_name":"cosmos/cosmos-sdk","owner":{"login":"cosmos","id":228843,"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-04-15T08:41:10Z","pushed_at":"2018-04-16T12:01:22Z","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://tendermint.com","size":5356,"stargazers_count":323,"watchers_count":323,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":167,"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":90,"open_issues":167,"watchers":323,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/809"},"html":{"href":"https://github.com/cosmos/cosmos-sdk/pull/809"},"issue":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/809"},"comments":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/issues/809/comments"},"review_comments":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/pulls/809/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/809/commits"},"statuses":{"href":"https://api.github.com/repos/cosmos/cosmos-sdk/statuses/3f703f71bd7b064926441d0d28ea7e71a6f8ab68"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jaekwon"}}