{"action":"created","comment":{"url":"https://api.github.com/repos/rchain/rchain/pulls/comments/193487035","pull_request_review_id":126468680,"id":193487035,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzQ4NzAzNQ==","diff_hunk":"@@ -257,14 +262,11 @@ object ProcNormalizeMatcher {\n                           p.proc_2,\n                           ProcVisitInputs(VectorPar(), input.env, leftResult.knownFree))\n           lp = leftResult.par\n-          resultConnective = if (lp.sends.isEmpty && lp.receives.isEmpty && lp.news.isEmpty && lp.exprs.isEmpty && lp.matches.isEmpty && lp.bundles.isEmpty) {\n-            lp.connectives match {\n-              case List(Connective(ConnAndBody(ConnectiveBody(ps)))) =>\n-                Connective(ConnAndBody(ConnectiveBody(ps :+ rightResult.par)))\n-              case _ => Connective(ConnAndBody(ConnectiveBody(Vector(lp, rightResult.par))))\n-            }\n-          } else {\n-            Connective(ConnAndBody(ConnectiveBody(Vector(lp, rightResult.par))))\n+          resultConnective = lp.onlyConnectives() match {","path":"rholang/src/main/scala/coop/rchain/rholang/interpreter/normalize.scala","position":69,"original_position":69,"commit_id":"b3ea2b56e5d16a45683c22567fff0b3d4db3137e","original_commit_id":"b3ea2b56e5d16a45683c22567fff0b3d4db3137e","user":{"login":"goral09","id":5120801,"node_id":"MDQ6VXNlcjUxMjA4MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5120801?v=4","gravatar_id":"","url":"https://api.github.com/users/goral09","html_url":"https://github.com/goral09","followers_url":"https://api.github.com/users/goral09/followers","following_url":"https://api.github.com/users/goral09/following{/other_user}","gists_url":"https://api.github.com/users/goral09/gists{/gist_id}","starred_url":"https://api.github.com/users/goral09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goral09/subscriptions","organizations_url":"https://api.github.com/users/goral09/orgs","repos_url":"https://api.github.com/users/goral09/repos","events_url":"https://api.github.com/users/goral09/events{/privacy}","received_events_url":"https://api.github.com/users/goral09/received_events","type":"User","site_admin":false},"body":"I've extracted the `if(…)` condition to [helper function](https://github.com/goral09/rchain/blob/29f7a6a60d18bbbcd88c2484057c9f60da9d317d/models/src/main/scala/coop/rchain/models/rholang/implicits.scala#L250)","created_at":"2018-06-06T17:05:07Z","updated_at":"2018-06-06T17:05:07Z","html_url":"https://github.com/rchain/rchain/pull/897#discussion_r193487035","pull_request_url":"https://api.github.com/repos/rchain/rchain/pulls/897","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/rchain/rchain/pulls/comments/193487035"},"html":{"href":"https://github.com/rchain/rchain/pull/897#discussion_r193487035"},"pull_request":{"href":"https://api.github.com/repos/rchain/rchain/pulls/897"}}},"pull_request":{"url":"https://api.github.com/repos/rchain/rchain/pulls/897","id":193077730,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMDc3NzMw","html_url":"https://github.com/rchain/rchain/pull/897","diff_url":"https://github.com/rchain/rchain/pull/897.diff","patch_url":"https://github.com/rchain/rchain/pull/897.patch","issue_url":"https://api.github.com/repos/rchain/rchain/issues/897","number":897,"state":"open","locked":false,"title":"RHOL-366 Add custom protobuf Set type","user":{"login":"goral09","id":5120801,"node_id":"MDQ6VXNlcjUxMjA4MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5120801?v=4","gravatar_id":"","url":"https://api.github.com/users/goral09","html_url":"https://github.com/goral09","followers_url":"https://api.github.com/users/goral09/followers","following_url":"https://api.github.com/users/goral09/following{/other_user}","gists_url":"https://api.github.com/users/goral09/gists{/gist_id}","starred_url":"https://api.github.com/users/goral09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goral09/subscriptions","organizations_url":"https://api.github.com/users/goral09/orgs","repos_url":"https://api.github.com/users/goral09/repos","events_url":"https://api.github.com/users/goral09/events{/privacy}","received_events_url":"https://api.github.com/users/goral09/received_events","type":"User","site_admin":false},"body":"## Overview\r\nAdds custom collection used by protobuf for `ESet`. [SortedHashSet](https://github.com/goral09/rchain/blob/b3ea2b56e5d16a45683c22567fff0b3d4db3137e/models/src/main/scala/coop/rchain/models/SortedHashSet.scala) is a wrapper for `scala.collection.immutable.HashSet` ( which is using a hash trie ). Access to the raw hash set is `private` and [only sorted version is exposed](https://github.com/goral09/rchain/blob/b3ea2b56e5d16a45683c22567fff0b3d4db3137e/models/src/main/scala/coop/rchain/models/SortedHashSet.scala#L14). Sorting is done [using `ParSortMatcher`](https://github.com/goral09/rchain/blob/b3ea2b56e5d16a45683c22567fff0b3d4db3137e/models/src/main/scala/coop/rchain/models/rholang/sort/ordering.scala#L6). `SortedHashSet` implements methods required by scalapb for protobuf serialization, [`foreach`](https://github.com/goral09/rchain/blob/b3ea2b56e5d16a45683c22567fff0b3d4db3137e/models/src/main/scala/coop/rchain/models/SortedHashSet.scala#L19) is when instances are serialized so `foreach` uses sorted version. `SortedHashSet` extends [`Set` interfaces](https://github.com/goral09/rchain/blob/b3ea2b56e5d16a45683c22567fff0b3d4db3137e/models/src/main/scala/coop/rchain/models/SortedHashSet.scala#L11) so it's easy to add operations on `Set`s in Rholang. I haven't yet wrapped the whole `ESet` into separate class that does clever things with `locallyFree` and I'm still [recomputing them](https://github.com/goral09/rchain/blob/b3ea2b56e5d16a45683c22567fff0b3d4db3137e/rholang/src/main/scala/coop/rchain/rholang/interpreter/Reduce.scala#L484) during Reduce phase.\r\n\r\nThis PR contains a lot of refactoring which was necessary to make use of `*SortMatcher`s in the `models` submodule because `SortedHashSet` required [implicit `Ordering[Par]` in scope](https://github.com/goral09/rchain/blob/b3ea2b56e5d16a45683c22567fff0b3d4db3137e/models/src/main/protobuf/RhoTypes.proto#L9) during generating protobuf classes. I will try to mark all the places that haven't changed.\r\n\r\nAnother necessary change was to remove effect type from `*SortMatcher` and return just `Either[Throwable, ScoredTerm[…]]` instead of using `MonadError[M, InterpreterError]` because that would require moving interpreter errors to `models` module which seemed wrong for me. Now sort match errors are lifted to proper error type in the substitute phase, [example](https://github.com/goral09/rchain/blob/29f7a6a60d18bbbcd88c2484057c9f60da9d317d/rholang/src/main/scala/coop/rchain/rholang/interpreter/Substitute.scala#L112).\r\n\r\n\r\n### Does this PR relate to an RChain JIRA issue? \r\nIf applicable, add link to corresponding JIRA issue.\r\n\r\n### Complete this checklist before you submit the PR\r\n- [ ] This PR contains no more than 200 lines of code, excluding test code.\r\n- [ ] This PR meets [RChain development coding standards](https://rchain.atlassian.net/wiki/spaces/DOC/pages/28082177/Coding+Standards).\r\n- [ ] You have someone in mind to assign for review. Make this assignment after submitting the PR.\r\n\r\n### Notes\r\nOptional. Add any notes on caveats, approaches you tried that didn't work, or anything else.\r\n","created_at":"2018-06-06T16:52:44Z","updated_at":"2018-06-06T17:05:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5d8a030660f91487e66bb84289452d86567a556","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":758279618,"node_id":"MDU6TGFiZWw3NTgyNzk2MTg=","url":"https://api.github.com/repos/rchain/rchain/labels/don't-merge-yet","name":"don't-merge-yet","color":"fc7674","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rchain/rchain/pulls/897/commits","review_comments_url":"https://api.github.com/repos/rchain/rchain/pulls/897/comments","review_comment_url":"https://api.github.com/repos/rchain/rchain/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rchain/rchain/issues/897/comments","statuses_url":"https://api.github.com/repos/rchain/rchain/statuses/b3ea2b56e5d16a45683c22567fff0b3d4db3137e","head":{"label":"goral09:RHOL-366_Set_protobuf","ref":"RHOL-366_Set_protobuf","sha":"b3ea2b56e5d16a45683c22567fff0b3d4db3137e","user":{"login":"goral09","id":5120801,"node_id":"MDQ6VXNlcjUxMjA4MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5120801?v=4","gravatar_id":"","url":"https://api.github.com/users/goral09","html_url":"https://github.com/goral09","followers_url":"https://api.github.com/users/goral09/followers","following_url":"https://api.github.com/users/goral09/following{/other_user}","gists_url":"https://api.github.com/users/goral09/gists{/gist_id}","starred_url":"https://api.github.com/users/goral09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goral09/subscriptions","organizations_url":"https://api.github.com/users/goral09/orgs","repos_url":"https://api.github.com/users/goral09/repos","events_url":"https://api.github.com/users/goral09/events{/privacy}","received_events_url":"https://api.github.com/users/goral09/received_events","type":"User","site_admin":false},"repo":{"id":129659641,"node_id":"MDEwOlJlcG9zaXRvcnkxMjk2NTk2NDE=","name":"rchain","full_name":"goral09/rchain","owner":{"login":"goral09","id":5120801,"node_id":"MDQ6VXNlcjUxMjA4MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5120801?v=4","gravatar_id":"","url":"https://api.github.com/users/goral09","html_url":"https://github.com/goral09","followers_url":"https://api.github.com/users/goral09/followers","following_url":"https://api.github.com/users/goral09/following{/other_user}","gists_url":"https://api.github.com/users/goral09/gists{/gist_id}","starred_url":"https://api.github.com/users/goral09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goral09/subscriptions","organizations_url":"https://api.github.com/users/goral09/orgs","repos_url":"https://api.github.com/users/goral09/repos","events_url":"https://api.github.com/users/goral09/events{/privacy}","received_events_url":"https://api.github.com/users/goral09/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/goral09/rchain","description":null,"fork":true,"url":"https://api.github.com/repos/goral09/rchain","forks_url":"https://api.github.com/repos/goral09/rchain/forks","keys_url":"https://api.github.com/repos/goral09/rchain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/goral09/rchain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/goral09/rchain/teams","hooks_url":"https://api.github.com/repos/goral09/rchain/hooks","issue_events_url":"https://api.github.com/repos/goral09/rchain/issues/events{/number}","events_url":"https://api.github.com/repos/goral09/rchain/events","assignees_url":"https://api.github.com/repos/goral09/rchain/assignees{/user}","branches_url":"https://api.github.com/repos/goral09/rchain/branches{/branch}","tags_url":"https://api.github.com/repos/goral09/rchain/tags","blobs_url":"https://api.github.com/repos/goral09/rchain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/goral09/rchain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/goral09/rchain/git/refs{/sha}","trees_url":"https://api.github.com/repos/goral09/rchain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/goral09/rchain/statuses/{sha}","languages_url":"https://api.github.com/repos/goral09/rchain/languages","stargazers_url":"https://api.github.com/repos/goral09/rchain/stargazers","contributors_url":"https://api.github.com/repos/goral09/rchain/contributors","subscribers_url":"https://api.github.com/repos/goral09/rchain/subscribers","subscription_url":"https://api.github.com/repos/goral09/rchain/subscription","commits_url":"https://api.github.com/repos/goral09/rchain/commits{/sha}","git_commits_url":"https://api.github.com/repos/goral09/rchain/git/commits{/sha}","comments_url":"https://api.github.com/repos/goral09/rchain/comments{/number}","issue_comment_url":"https://api.github.com/repos/goral09/rchain/issues/comments{/number}","contents_url":"https://api.github.com/repos/goral09/rchain/contents/{+path}","compare_url":"https://api.github.com/repos/goral09/rchain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/goral09/rchain/merges","archive_url":"https://api.github.com/repos/goral09/rchain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/goral09/rchain/downloads","issues_url":"https://api.github.com/repos/goral09/rchain/issues{/number}","pulls_url":"https://api.github.com/repos/goral09/rchain/pulls{/number}","milestones_url":"https://api.github.com/repos/goral09/rchain/milestones{/number}","notifications_url":"https://api.github.com/repos/goral09/rchain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/goral09/rchain/labels{/name}","releases_url":"https://api.github.com/repos/goral09/rchain/releases{/id}","deployments_url":"https://api.github.com/repos/goral09/rchain/deployments","created_at":"2018-04-15T23:24:40Z","updated_at":"2018-04-25T19:11:17Z","pushed_at":"2018-06-06T16:17:33Z","git_url":"git://github.com/goral09/rchain.git","ssh_url":"git@github.com:goral09/rchain.git","clone_url":"https://github.com/goral09/rchain.git","svn_url":"https://github.com/goral09/rchain","homepage":null,"size":10592,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rchain:dev","ref":"dev","sha":"c4c82ae19d67f4f4d056f6c2a5f1bfefbe4f64f9","user":{"login":"rchain","id":20671765,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNjcxNzY1","avatar_url":"https://avatars0.githubusercontent.com/u/20671765?v=4","gravatar_id":"","url":"https://api.github.com/users/rchain","html_url":"https://github.com/rchain","followers_url":"https://api.github.com/users/rchain/followers","following_url":"https://api.github.com/users/rchain/following{/other_user}","gists_url":"https://api.github.com/users/rchain/gists{/gist_id}","starred_url":"https://api.github.com/users/rchain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchain/subscriptions","organizations_url":"https://api.github.com/users/rchain/orgs","repos_url":"https://api.github.com/users/rchain/repos","events_url":"https://api.github.com/users/rchain/events{/privacy}","received_events_url":"https://api.github.com/users/rchain/received_events","type":"Organization","site_admin":false},"repo":{"id":84493691,"node_id":"MDEwOlJlcG9zaXRvcnk4NDQ5MzY5MQ==","name":"rchain","full_name":"rchain/rchain","owner":{"login":"rchain","id":20671765,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNjcxNzY1","avatar_url":"https://avatars0.githubusercontent.com/u/20671765?v=4","gravatar_id":"","url":"https://api.github.com/users/rchain","html_url":"https://github.com/rchain","followers_url":"https://api.github.com/users/rchain/followers","following_url":"https://api.github.com/users/rchain/following{/other_user}","gists_url":"https://api.github.com/users/rchain/gists{/gist_id}","starred_url":"https://api.github.com/users/rchain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchain/subscriptions","organizations_url":"https://api.github.com/users/rchain/orgs","repos_url":"https://api.github.com/users/rchain/repos","events_url":"https://api.github.com/users/rchain/events{/privacy}","received_events_url":"https://api.github.com/users/rchain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rchain/rchain","description":null,"fork":false,"url":"https://api.github.com/repos/rchain/rchain","forks_url":"https://api.github.com/repos/rchain/rchain/forks","keys_url":"https://api.github.com/repos/rchain/rchain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rchain/rchain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rchain/rchain/teams","hooks_url":"https://api.github.com/repos/rchain/rchain/hooks","issue_events_url":"https://api.github.com/repos/rchain/rchain/issues/events{/number}","events_url":"https://api.github.com/repos/rchain/rchain/events","assignees_url":"https://api.github.com/repos/rchain/rchain/assignees{/user}","branches_url":"https://api.github.com/repos/rchain/rchain/branches{/branch}","tags_url":"https://api.github.com/repos/rchain/rchain/tags","blobs_url":"https://api.github.com/repos/rchain/rchain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rchain/rchain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rchain/rchain/git/refs{/sha}","trees_url":"https://api.github.com/repos/rchain/rchain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rchain/rchain/statuses/{sha}","languages_url":"https://api.github.com/repos/rchain/rchain/languages","stargazers_url":"https://api.github.com/repos/rchain/rchain/stargazers","contributors_url":"https://api.github.com/repos/rchain/rchain/contributors","subscribers_url":"https://api.github.com/repos/rchain/rchain/subscribers","subscription_url":"https://api.github.com/repos/rchain/rchain/subscription","commits_url":"https://api.github.com/repos/rchain/rchain/commits{/sha}","git_commits_url":"https://api.github.com/repos/rchain/rchain/git/commits{/sha}","comments_url":"https://api.github.com/repos/rchain/rchain/comments{/number}","issue_comment_url":"https://api.github.com/repos/rchain/rchain/issues/comments{/number}","contents_url":"https://api.github.com/repos/rchain/rchain/contents/{+path}","compare_url":"https://api.github.com/repos/rchain/rchain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rchain/rchain/merges","archive_url":"https://api.github.com/repos/rchain/rchain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rchain/rchain/downloads","issues_url":"https://api.github.com/repos/rchain/rchain/issues{/number}","pulls_url":"https://api.github.com/repos/rchain/rchain/pulls{/number}","milestones_url":"https://api.github.com/repos/rchain/rchain/milestones{/number}","notifications_url":"https://api.github.com/repos/rchain/rchain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rchain/rchain/labels{/name}","releases_url":"https://api.github.com/repos/rchain/rchain/releases{/id}","deployments_url":"https://api.github.com/repos/rchain/rchain/deployments","created_at":"2017-03-09T22:15:35Z","updated_at":"2018-06-05T06:36:51Z","pushed_at":"2018-06-06T16:52:45Z","git_url":"git://github.com/rchain/rchain.git","ssh_url":"git@github.com:rchain/rchain.git","clone_url":"https://github.com/rchain/rchain.git","svn_url":"https://github.com/rchain/rchain","homepage":null,"size":10565,"stargazers_count":339,"watchers_count":339,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":100,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":100,"open_issues":15,"watchers":339,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rchain/rchain/pulls/897"},"html":{"href":"https://github.com/rchain/rchain/pull/897"},"issue":{"href":"https://api.github.com/repos/rchain/rchain/issues/897"},"comments":{"href":"https://api.github.com/repos/rchain/rchain/issues/897/comments"},"review_comments":{"href":"https://api.github.com/repos/rchain/rchain/pulls/897/comments"},"review_comment":{"href":"https://api.github.com/repos/rchain/rchain/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rchain/rchain/pulls/897/commits"},"statuses":{"href":"https://api.github.com/repos/rchain/rchain/statuses/b3ea2b56e5d16a45683c22567fff0b3d4db3137e"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"goral09"}}