{"action":"created","comment":{"url":"https://api.github.com/repos/google/trillian/pulls/comments/126656056","pull_request_review_id":49153819,"id":126656056,"diff_hunk":"@@ -0,0 +1,123 @@\n+// Copyright 2017 Google Inc. All Rights Reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package integration\n+\n+import (\n+\t\"context\"\n+\t\"encoding/hex\"\n+\t\"fmt\"\n+\t\"testing\"\n+\n+\t\"github.com/google/trillian\"\n+\t\"github.com/google/trillian/merkle\"\n+\t_ \"github.com/google/trillian/merkle/coniks\" // Register\n+\t\"github.com/google/trillian/merkle/hashers\"\n+\t_ \"github.com/google/trillian/merkle/maphasher\" // Register\n+\t\"github.com/google/trillian/testonly\"\n+\t\"github.com/google/trillian/testonly/integration\"\n+)\n+\n+// createHashKV returns a []*trillian.MapLeaf formed by the mapping of index, value ...\n+// createHashKV panics if len(iv) is odd. Duplicate i/v pairs get over written.\n+func createMapLeaves(iv ...[]byte) []*trillian.MapLeaf {\n+\tif len(iv)%2 != 0 {\n+\t\tpanic(fmt.Sprintf(\"integration: createMapLeaves got odd number of iv pairs: %v\", len(iv)))\n+\t}\n+\tr := []*trillian.MapLeaf{}\n+\tvar index []byte\n+\tfor i, b := range iv {\n+\t\tif i%2 == 0 {\n+\t\t\tindex = b\n+\t\t\tcontinue\n+\t\t}\n+\t\tr = append(r, &trillian.MapLeaf{\n+\t\t\tIndex:     index,\n+\t\t\tLeafValue: b,\n+\t\t})\n+\t}\n+\treturn r\n+}\n+\n+func TestInclusionWithEnv(t *testing.T) {\n+\tctx := context.Background()\n+\tenv, err := integration.NewMapEnv(ctx, \"TestInclusionWithEnv\")\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\tdefer env.Close()\n+\tfor _, tc := range []struct {\n+\t\ttrillian.HashStrategy\n+\t\tindex []byte\n+\t\tvalue []byte\n+\t}{\n+\t\t{trillian.HashStrategy_TEST_MAP_HASHER, testonly.TransparentHash(\"A\"), []byte(\"A\")},\n+\t} {\n+\t\ttree, err := env.CreateMap(tc.HashStrategy)\n+\t\tif err != nil {\n+\t\t\tt.Errorf(\"CreateMap(): %v\", err)\n+\t\t\tcontinue\n+\t\t}\n+\t\tmapID := tree.TreeId\n+\t\thasher, err := hashers.NewMapHasher(tree.HashStrategy)\n+\t\tif err != nil {\n+\t\t\tt.Errorf(\"NewMapHasher(): %v\", err)\n+\t\t\tcontinue\n+\t\t}\n+\t\tclient := trillian.NewTrillianMapClient(env.ClientConn)","path":"integration/map_test.go","position":78,"original_position":78,"commit_id":"d3f203a2de05100692cfa291faa1be94a34df924","original_commit_id":"d3f203a2de05100692cfa291faa1be94a34df924","user":{"login":"codingllama","id":12500300,"avatar_url":"https://avatars0.githubusercontent.com/u/12500300?v=3","gravatar_id":"","url":"https://api.github.com/users/codingllama","html_url":"https://github.com/codingllama","followers_url":"https://api.github.com/users/codingllama/followers","following_url":"https://api.github.com/users/codingllama/following{/other_user}","gists_url":"https://api.github.com/users/codingllama/gists{/gist_id}","starred_url":"https://api.github.com/users/codingllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codingllama/subscriptions","organizations_url":"https://api.github.com/users/codingllama/orgs","repos_url":"https://api.github.com/users/codingllama/repos","events_url":"https://api.github.com/users/codingllama/events{/privacy}","received_events_url":"https://api.github.com/users/codingllama/received_events","type":"User","site_admin":false},"body":"Have you considered providing a MapClient within MapEnv? I expect all usages of MapEnv to need a MapClient.","created_at":"2017-07-11T10:53:34Z","updated_at":"2017-07-11T10:59:15Z","html_url":"https://github.com/google/trillian/pull/732#discussion_r126656056","pull_request_url":"https://api.github.com/repos/google/trillian/pulls/732","_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/comments/126656056"},"html":{"href":"https://github.com/google/trillian/pull/732#discussion_r126656056"},"pull_request":{"href":"https://api.github.com/repos/google/trillian/pulls/732"}}},"pull_request":{"url":"https://api.github.com/repos/google/trillian/pulls/732","id":129859705,"html_url":"https://github.com/google/trillian/pull/732","diff_url":"https://github.com/google/trillian/pull/732.diff","patch_url":"https://github.com/google/trillian/pull/732.patch","issue_url":"https://api.github.com/repos/google/trillian/issues/732","number":732,"state":"open","locked":false,"title":"NewMapEnv() for map integration test matrix","user":{"login":"gdbelvin","id":198478,"avatar_url":"https://avatars2.githubusercontent.com/u/198478?v=3","gravatar_id":"","url":"https://api.github.com/users/gdbelvin","html_url":"https://github.com/gdbelvin","followers_url":"https://api.github.com/users/gdbelvin/followers","following_url":"https://api.github.com/users/gdbelvin/following{/other_user}","gists_url":"https://api.github.com/users/gdbelvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gdbelvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdbelvin/subscriptions","organizations_url":"https://api.github.com/users/gdbelvin/orgs","repos_url":"https://api.github.com/users/gdbelvin/repos","events_url":"https://api.github.com/users/gdbelvin/events{/privacy}","received_events_url":"https://api.github.com/users/gdbelvin/received_events","type":"User","site_admin":false},"body":"This PR creates a MapEnv, similar to LogEnv to support pure go\r\nintegration tests for the map.\r\n\r\nThis supports targeted testing of round-trip AddMapLeaf /\r\nVerifyMapInclusionProof operations for each of the map hashers.\r\n\r\nAt this time, the TEST_MAP_HASHER is the only one that is known to work.\r\n\r\nAlso included:\r\n- Added function names along error return paths in the map.","created_at":"2017-07-11T09:18:25Z","updated_at":"2017-07-11T10:59:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9150ce0b9f034ce17bbea1f7f8157549c9dc74d8","assignee":{"login":"codingllama","id":12500300,"avatar_url":"https://avatars0.githubusercontent.com/u/12500300?v=3","gravatar_id":"","url":"https://api.github.com/users/codingllama","html_url":"https://github.com/codingllama","followers_url":"https://api.github.com/users/codingllama/followers","following_url":"https://api.github.com/users/codingllama/following{/other_user}","gists_url":"https://api.github.com/users/codingllama/gists{/gist_id}","starred_url":"https://api.github.com/users/codingllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codingllama/subscriptions","organizations_url":"https://api.github.com/users/codingllama/orgs","repos_url":"https://api.github.com/users/codingllama/repos","events_url":"https://api.github.com/users/codingllama/events{/privacy}","received_events_url":"https://api.github.com/users/codingllama/received_events","type":"User","site_admin":false},"assignees":[{"login":"codingllama","id":12500300,"avatar_url":"https://avatars0.githubusercontent.com/u/12500300?v=3","gravatar_id":"","url":"https://api.github.com/users/codingllama","html_url":"https://github.com/codingllama","followers_url":"https://api.github.com/users/codingllama/followers","following_url":"https://api.github.com/users/codingllama/following{/other_user}","gists_url":"https://api.github.com/users/codingllama/gists{/gist_id}","starred_url":"https://api.github.com/users/codingllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codingllama/subscriptions","organizations_url":"https://api.github.com/users/codingllama/orgs","repos_url":"https://api.github.com/users/codingllama/repos","events_url":"https://api.github.com/users/codingllama/events{/privacy}","received_events_url":"https://api.github.com/users/codingllama/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/google/trillian/pulls/732/commits","review_comments_url":"https://api.github.com/repos/google/trillian/pulls/732/comments","review_comment_url":"https://api.github.com/repos/google/trillian/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/trillian/issues/732/comments","statuses_url":"https://api.github.com/repos/google/trillian/statuses/d3f203a2de05100692cfa291faa1be94a34df924","head":{"label":"gdbelvin:map_test","ref":"map_test","sha":"d3f203a2de05100692cfa291faa1be94a34df924","user":{"login":"gdbelvin","id":198478,"avatar_url":"https://avatars2.githubusercontent.com/u/198478?v=3","gravatar_id":"","url":"https://api.github.com/users/gdbelvin","html_url":"https://github.com/gdbelvin","followers_url":"https://api.github.com/users/gdbelvin/followers","following_url":"https://api.github.com/users/gdbelvin/following{/other_user}","gists_url":"https://api.github.com/users/gdbelvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gdbelvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdbelvin/subscriptions","organizations_url":"https://api.github.com/users/gdbelvin/orgs","repos_url":"https://api.github.com/users/gdbelvin/repos","events_url":"https://api.github.com/users/gdbelvin/events{/privacy}","received_events_url":"https://api.github.com/users/gdbelvin/received_events","type":"User","site_admin":false},"repo":{"id":79220930,"name":"trillian","full_name":"gdbelvin/trillian","owner":{"login":"gdbelvin","id":198478,"avatar_url":"https://avatars2.githubusercontent.com/u/198478?v=3","gravatar_id":"","url":"https://api.github.com/users/gdbelvin","html_url":"https://github.com/gdbelvin","followers_url":"https://api.github.com/users/gdbelvin/followers","following_url":"https://api.github.com/users/gdbelvin/following{/other_user}","gists_url":"https://api.github.com/users/gdbelvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gdbelvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdbelvin/subscriptions","organizations_url":"https://api.github.com/users/gdbelvin/orgs","repos_url":"https://api.github.com/users/gdbelvin/repos","events_url":"https://api.github.com/users/gdbelvin/events{/privacy}","received_events_url":"https://api.github.com/users/gdbelvin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gdbelvin/trillian","description":null,"fork":true,"url":"https://api.github.com/repos/gdbelvin/trillian","forks_url":"https://api.github.com/repos/gdbelvin/trillian/forks","keys_url":"https://api.github.com/repos/gdbelvin/trillian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gdbelvin/trillian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gdbelvin/trillian/teams","hooks_url":"https://api.github.com/repos/gdbelvin/trillian/hooks","issue_events_url":"https://api.github.com/repos/gdbelvin/trillian/issues/events{/number}","events_url":"https://api.github.com/repos/gdbelvin/trillian/events","assignees_url":"https://api.github.com/repos/gdbelvin/trillian/assignees{/user}","branches_url":"https://api.github.com/repos/gdbelvin/trillian/branches{/branch}","tags_url":"https://api.github.com/repos/gdbelvin/trillian/tags","blobs_url":"https://api.github.com/repos/gdbelvin/trillian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gdbelvin/trillian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gdbelvin/trillian/git/refs{/sha}","trees_url":"https://api.github.com/repos/gdbelvin/trillian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gdbelvin/trillian/statuses/{sha}","languages_url":"https://api.github.com/repos/gdbelvin/trillian/languages","stargazers_url":"https://api.github.com/repos/gdbelvin/trillian/stargazers","contributors_url":"https://api.github.com/repos/gdbelvin/trillian/contributors","subscribers_url":"https://api.github.com/repos/gdbelvin/trillian/subscribers","subscription_url":"https://api.github.com/repos/gdbelvin/trillian/subscription","commits_url":"https://api.github.com/repos/gdbelvin/trillian/commits{/sha}","git_commits_url":"https://api.github.com/repos/gdbelvin/trillian/git/commits{/sha}","comments_url":"https://api.github.com/repos/gdbelvin/trillian/comments{/number}","issue_comment_url":"https://api.github.com/repos/gdbelvin/trillian/issues/comments{/number}","contents_url":"https://api.github.com/repos/gdbelvin/trillian/contents/{+path}","compare_url":"https://api.github.com/repos/gdbelvin/trillian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gdbelvin/trillian/merges","archive_url":"https://api.github.com/repos/gdbelvin/trillian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gdbelvin/trillian/downloads","issues_url":"https://api.github.com/repos/gdbelvin/trillian/issues{/number}","pulls_url":"https://api.github.com/repos/gdbelvin/trillian/pulls{/number}","milestones_url":"https://api.github.com/repos/gdbelvin/trillian/milestones{/number}","notifications_url":"https://api.github.com/repos/gdbelvin/trillian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gdbelvin/trillian/labels{/name}","releases_url":"https://api.github.com/repos/gdbelvin/trillian/releases{/id}","deployments_url":"https://api.github.com/repos/gdbelvin/trillian/deployments","created_at":"2017-01-17T11:27:31Z","updated_at":"2017-01-17T11:27:34Z","pushed_at":"2017-07-11T09:18:12Z","git_url":"git://github.com/gdbelvin/trillian.git","ssh_url":"git@github.com:gdbelvin/trillian.git","clone_url":"https://github.com/gdbelvin/trillian.git","svn_url":"https://github.com/gdbelvin/trillian","homepage":null,"size":6908,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"abaf7abc48b131cfe4d58e124404748259ae50ea","user":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":58654489,"name":"trillian","full_name":"google/trillian","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/trillian","description":"Trillian implements a Merkle tree whose contents are served from a data storage layer, to allow scalability to extremely large trees.","fork":false,"url":"https://api.github.com/repos/google/trillian","forks_url":"https://api.github.com/repos/google/trillian/forks","keys_url":"https://api.github.com/repos/google/trillian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/trillian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/trillian/teams","hooks_url":"https://api.github.com/repos/google/trillian/hooks","issue_events_url":"https://api.github.com/repos/google/trillian/issues/events{/number}","events_url":"https://api.github.com/repos/google/trillian/events","assignees_url":"https://api.github.com/repos/google/trillian/assignees{/user}","branches_url":"https://api.github.com/repos/google/trillian/branches{/branch}","tags_url":"https://api.github.com/repos/google/trillian/tags","blobs_url":"https://api.github.com/repos/google/trillian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/trillian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/trillian/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/trillian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/trillian/statuses/{sha}","languages_url":"https://api.github.com/repos/google/trillian/languages","stargazers_url":"https://api.github.com/repos/google/trillian/stargazers","contributors_url":"https://api.github.com/repos/google/trillian/contributors","subscribers_url":"https://api.github.com/repos/google/trillian/subscribers","subscription_url":"https://api.github.com/repos/google/trillian/subscription","commits_url":"https://api.github.com/repos/google/trillian/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/trillian/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/trillian/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/trillian/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/trillian/contents/{+path}","compare_url":"https://api.github.com/repos/google/trillian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/trillian/merges","archive_url":"https://api.github.com/repos/google/trillian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/trillian/downloads","issues_url":"https://api.github.com/repos/google/trillian/issues{/number}","pulls_url":"https://api.github.com/repos/google/trillian/pulls{/number}","milestones_url":"https://api.github.com/repos/google/trillian/milestones{/number}","notifications_url":"https://api.github.com/repos/google/trillian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/trillian/labels{/name}","releases_url":"https://api.github.com/repos/google/trillian/releases{/id}","deployments_url":"https://api.github.com/repos/google/trillian/deployments","created_at":"2016-05-12T15:37:35Z","updated_at":"2017-07-10T10:01:15Z","pushed_at":"2017-07-11T09:18:26Z","git_url":"git://github.com/google/trillian.git","ssh_url":"git@github.com:google/trillian.git","clone_url":"https://github.com/google/trillian.git","svn_url":"https://github.com/google/trillian","homepage":"","size":6845,"stargazers_count":564,"watchers_count":564,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":43,"forks":80,"open_issues":43,"watchers":564,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/732"},"html":{"href":"https://github.com/google/trillian/pull/732"},"issue":{"href":"https://api.github.com/repos/google/trillian/issues/732"},"comments":{"href":"https://api.github.com/repos/google/trillian/issues/732/comments"},"review_comments":{"href":"https://api.github.com/repos/google/trillian/pulls/732/comments"},"review_comment":{"href":"https://api.github.com/repos/google/trillian/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/trillian/pulls/732/commits"},"statuses":{"href":"https://api.github.com/repos/google/trillian/statuses/d3f203a2de05100692cfa291faa1be94a34df924"}}}}
{"actor":{"display_login":"codingllama"}}