{"action":"created","comment":{"url":"https://api.github.com/repos/google/trillian/pulls/comments/88000651","pull_request_review_id":8579840,"id":88000651,"diff_hunk":"@@ -276,6 +293,55 @@ func checkLogRootHashMatches(logID int64, tree *merkle.InMemoryMerkleTree, clien\n \treturn nil\n }\n \n+// checkInclusionProofsAtIndex obtains and checks proofs at tree sizes from zero up to 2 x the sequencing\n+// batch size (or number of leaves queued if less). The log should only serve proofs for indices in a tree\n+// at least as big as the index where STHs where the index is a multiple of the sequencer batch size. All\n+// proofs returned should match ones computed by the alternate Merkle Tree implementation, which differs\n+// from what the log uses.\n+func checkInclusionProofsAtIndex(testIndex int64, logID int64, tree *merkle.InMemoryMerkleTree, client trillian.TrillianLogClient, params testParameters) error {\n+\tfor treeSize := int64(0); treeSize < min(params.leafCount, int64(2 * params.sequencerBatchSize)); treeSize++ {\n+\t\tctx, cancelFunc := getRPCDeadlineContext()\n+\t\tresp, err := client.GetInclusionProof(ctx, &trillian.GetInclusionProofRequest{LogId: logID, LeafIndex:testIndex, TreeSize:int64(treeSize)})\n+\t\tcancelFunc()\n+\n+\t\tif testIndex >= treeSize {\n+\t\t\t// Firstly, if the index is larger than the tree size we cannot have a valid proof\n+\t\t\tif err == nil {\n+\t\t\t\treturn fmt.Errorf(\"log returned proof for index: %d, tree is only size %d\", testIndex, treeSize)\n+\t\t\t}\n+\t\t} else {\n+\t\t\t// Secondly, if we're not at a valid STH tree size then we can't have a proof\n+\t\t\tif treeSize == 0 || (treeSize % int64(params.sequencerBatchSize)) != 0 {\n+\t\t\t\tif err == nil {\n+\t\t\t\t\treturn fmt.Errorf(\"log returned proof at non STH size: %d\", treeSize)\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\t// Otherwise we should have a proof, to be compared against our memory tree\n+\t\t\t\tif err != nil || resp.Status.StatusCode != trillian.TrillianApiStatusCode_OK {\n+\t\t\t\t\treturn fmt.Errorf(\"log returned no proof for index %d at size %d, which should have succeeded: %v\", testIndex, treeSize, err)\n+\t\t\t\t}\n+\n+\t\t\t\t// Remember that the in memory tree uses 1 based leaf indices\n+\t\t\t\tpath := tree.PathToRootAtSnapshot(int(testIndex + 1), int(treeSize))\n+\n+\t\t\t\t// Compare the proof lengths\n+\t\t\t\tif got, want := len(resp.Proof.GetProofNode()), len(path); got != want {\n+\t\t\t\t\treturn fmt.Errorf(\"proof s:%d l:%d differs in length: %d %d\", treeSize, testIndex, got, want)\n+\t\t\t\t}\n+\n+\t\t\t\t// Then the node hashes should all match\n+\t\t\t\tfor i := 0; i < len(path); i++ {\n+\t\t\t\t\tif got, want := base64.StdEncoding.EncodeToString(resp.Proof.GetProofNode()[i].NodeHash), base64.StdEncoding.EncodeToString(path[i].Value.Hash()); got != want {","path":"integration/log_integration_test.go","position":105,"original_position":105,"commit_id":"58b3066d69eef8753b1aad6089b16012d1c91c2f","original_commit_id":"58b3066d69eef8753b1aad6089b16012d1c91c2f","user":{"login":"daviddrysdale","id":457208,"avatar_url":"https://avatars.githubusercontent.com/u/457208?v=3","gravatar_id":"","url":"https://api.github.com/users/daviddrysdale","html_url":"https://github.com/daviddrysdale","followers_url":"https://api.github.com/users/daviddrysdale/followers","following_url":"https://api.github.com/users/daviddrysdale/following{/other_user}","gists_url":"https://api.github.com/users/daviddrysdale/gists{/gist_id}","starred_url":"https://api.github.com/users/daviddrysdale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daviddrysdale/subscriptions","organizations_url":"https://api.github.com/users/daviddrysdale/orgs","repos_url":"https://api.github.com/users/daviddrysdale/repos","events_url":"https://api.github.com/users/daviddrysdale/events{/privacy}","received_events_url":"https://api.github.com/users/daviddrysdale/received_events","type":"User","site_admin":false},"body":"Would comparing `hex.EncodeToString()` be more helpful for debugging?  ","created_at":"2016-11-15T11:49:47Z","updated_at":"2016-11-15T11:49:47Z","html_url":"https://github.com/google/trillian/pull/216#discussion_r88000651","pull_request_url":"https://api.github.com/repos/google/trillian/pulls/216","_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/comments/88000651"},"html":{"href":"https://github.com/google/trillian/pull/216#discussion_r88000651"},"pull_request":{"href":"https://api.github.com/repos/google/trillian/pulls/216"}}},"pull_request":{"url":"https://api.github.com/repos/google/trillian/pulls/216","id":92971150,"html_url":"https://github.com/google/trillian/pull/216","diff_url":"https://github.com/google/trillian/pull/216.diff","patch_url":"https://github.com/google/trillian/pull/216.patch","issue_url":"https://api.github.com/repos/google/trillian/issues/216","number":216,"state":"open","locked":false,"title":"Add a test for inclusion proofs","user":{"login":"Martin2112","id":13366863,"avatar_url":"https://avatars.githubusercontent.com/u/13366863?v=3","gravatar_id":"","url":"https://api.github.com/users/Martin2112","html_url":"https://github.com/Martin2112","followers_url":"https://api.github.com/users/Martin2112/followers","following_url":"https://api.github.com/users/Martin2112/following{/other_user}","gists_url":"https://api.github.com/users/Martin2112/gists{/gist_id}","starred_url":"https://api.github.com/users/Martin2112/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martin2112/subscriptions","organizations_url":"https://api.github.com/users/Martin2112/orgs","repos_url":"https://api.github.com/users/Martin2112/repos","events_url":"https://api.github.com/users/Martin2112/events{/privacy}","received_events_url":"https://api.github.com/users/Martin2112/received_events","type":"User","site_admin":false},"body":"It's deterministic and uses a few preset leaf indices. Can be extended later.","created_at":"2016-11-09T14:19:54Z","updated_at":"2016-11-15T11:51:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65480709bb56e90bad17a565b39a0388293c2bed","assignee":{"login":"daviddrysdale","id":457208,"avatar_url":"https://avatars.githubusercontent.com/u/457208?v=3","gravatar_id":"","url":"https://api.github.com/users/daviddrysdale","html_url":"https://github.com/daviddrysdale","followers_url":"https://api.github.com/users/daviddrysdale/followers","following_url":"https://api.github.com/users/daviddrysdale/following{/other_user}","gists_url":"https://api.github.com/users/daviddrysdale/gists{/gist_id}","starred_url":"https://api.github.com/users/daviddrysdale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daviddrysdale/subscriptions","organizations_url":"https://api.github.com/users/daviddrysdale/orgs","repos_url":"https://api.github.com/users/daviddrysdale/repos","events_url":"https://api.github.com/users/daviddrysdale/events{/privacy}","received_events_url":"https://api.github.com/users/daviddrysdale/received_events","type":"User","site_admin":false},"assignees":[{"login":"daviddrysdale","id":457208,"avatar_url":"https://avatars.githubusercontent.com/u/457208?v=3","gravatar_id":"","url":"https://api.github.com/users/daviddrysdale","html_url":"https://github.com/daviddrysdale","followers_url":"https://api.github.com/users/daviddrysdale/followers","following_url":"https://api.github.com/users/daviddrysdale/following{/other_user}","gists_url":"https://api.github.com/users/daviddrysdale/gists{/gist_id}","starred_url":"https://api.github.com/users/daviddrysdale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daviddrysdale/subscriptions","organizations_url":"https://api.github.com/users/daviddrysdale/orgs","repos_url":"https://api.github.com/users/daviddrysdale/repos","events_url":"https://api.github.com/users/daviddrysdale/events{/privacy}","received_events_url":"https://api.github.com/users/daviddrysdale/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/google/trillian/milestones/8","html_url":"https://github.com/google/trillian/milestones/Log%20M5","labels_url":"https://api.github.com/repos/google/trillian/milestones/8/labels","id":2121972,"number":8,"title":"Log M5","description":"More unit and integration tests for proofs. Separate leaf / Merkle hashes in client API.","creator":{"login":"Martin2112","id":13366863,"avatar_url":"https://avatars.githubusercontent.com/u/13366863?v=3","gravatar_id":"","url":"https://api.github.com/users/Martin2112","html_url":"https://github.com/Martin2112","followers_url":"https://api.github.com/users/Martin2112/followers","following_url":"https://api.github.com/users/Martin2112/following{/other_user}","gists_url":"https://api.github.com/users/Martin2112/gists{/gist_id}","starred_url":"https://api.github.com/users/Martin2112/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martin2112/subscriptions","organizations_url":"https://api.github.com/users/Martin2112/orgs","repos_url":"https://api.github.com/users/Martin2112/repos","events_url":"https://api.github.com/users/Martin2112/events{/privacy}","received_events_url":"https://api.github.com/users/Martin2112/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":3,"state":"open","created_at":"2016-11-08T14:14:51Z","updated_at":"2016-11-15T11:44:27Z","due_on":"2016-11-30T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/google/trillian/pulls/216/commits","review_comments_url":"https://api.github.com/repos/google/trillian/pulls/216/comments","review_comment_url":"https://api.github.com/repos/google/trillian/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/trillian/issues/216/comments","statuses_url":"https://api.github.com/repos/google/trillian/statuses/58b3066d69eef8753b1aad6089b16012d1c91c2f","head":{"label":"Martin2112:integration_inc_proof","ref":"integration_inc_proof","sha":"58b3066d69eef8753b1aad6089b16012d1c91c2f","user":{"login":"Martin2112","id":13366863,"avatar_url":"https://avatars.githubusercontent.com/u/13366863?v=3","gravatar_id":"","url":"https://api.github.com/users/Martin2112","html_url":"https://github.com/Martin2112","followers_url":"https://api.github.com/users/Martin2112/followers","following_url":"https://api.github.com/users/Martin2112/following{/other_user}","gists_url":"https://api.github.com/users/Martin2112/gists{/gist_id}","starred_url":"https://api.github.com/users/Martin2112/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martin2112/subscriptions","organizations_url":"https://api.github.com/users/Martin2112/orgs","repos_url":"https://api.github.com/users/Martin2112/repos","events_url":"https://api.github.com/users/Martin2112/events{/privacy}","received_events_url":"https://api.github.com/users/Martin2112/received_events","type":"User","site_admin":false},"repo":{"id":60082567,"name":"trillian","full_name":"Martin2112/trillian","owner":{"login":"Martin2112","id":13366863,"avatar_url":"https://avatars.githubusercontent.com/u/13366863?v=3","gravatar_id":"","url":"https://api.github.com/users/Martin2112","html_url":"https://github.com/Martin2112","followers_url":"https://api.github.com/users/Martin2112/followers","following_url":"https://api.github.com/users/Martin2112/following{/other_user}","gists_url":"https://api.github.com/users/Martin2112/gists{/gist_id}","starred_url":"https://api.github.com/users/Martin2112/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martin2112/subscriptions","organizations_url":"https://api.github.com/users/Martin2112/orgs","repos_url":"https://api.github.com/users/Martin2112/repos","events_url":"https://api.github.com/users/Martin2112/events{/privacy}","received_events_url":"https://api.github.com/users/Martin2112/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Martin2112/trillian","description":null,"fork":true,"url":"https://api.github.com/repos/Martin2112/trillian","forks_url":"https://api.github.com/repos/Martin2112/trillian/forks","keys_url":"https://api.github.com/repos/Martin2112/trillian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Martin2112/trillian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Martin2112/trillian/teams","hooks_url":"https://api.github.com/repos/Martin2112/trillian/hooks","issue_events_url":"https://api.github.com/repos/Martin2112/trillian/issues/events{/number}","events_url":"https://api.github.com/repos/Martin2112/trillian/events","assignees_url":"https://api.github.com/repos/Martin2112/trillian/assignees{/user}","branches_url":"https://api.github.com/repos/Martin2112/trillian/branches{/branch}","tags_url":"https://api.github.com/repos/Martin2112/trillian/tags","blobs_url":"https://api.github.com/repos/Martin2112/trillian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Martin2112/trillian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Martin2112/trillian/git/refs{/sha}","trees_url":"https://api.github.com/repos/Martin2112/trillian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Martin2112/trillian/statuses/{sha}","languages_url":"https://api.github.com/repos/Martin2112/trillian/languages","stargazers_url":"https://api.github.com/repos/Martin2112/trillian/stargazers","contributors_url":"https://api.github.com/repos/Martin2112/trillian/contributors","subscribers_url":"https://api.github.com/repos/Martin2112/trillian/subscribers","subscription_url":"https://api.github.com/repos/Martin2112/trillian/subscription","commits_url":"https://api.github.com/repos/Martin2112/trillian/commits{/sha}","git_commits_url":"https://api.github.com/repos/Martin2112/trillian/git/commits{/sha}","comments_url":"https://api.github.com/repos/Martin2112/trillian/comments{/number}","issue_comment_url":"https://api.github.com/repos/Martin2112/trillian/issues/comments{/number}","contents_url":"https://api.github.com/repos/Martin2112/trillian/contents/{+path}","compare_url":"https://api.github.com/repos/Martin2112/trillian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Martin2112/trillian/merges","archive_url":"https://api.github.com/repos/Martin2112/trillian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Martin2112/trillian/downloads","issues_url":"https://api.github.com/repos/Martin2112/trillian/issues{/number}","pulls_url":"https://api.github.com/repos/Martin2112/trillian/pulls{/number}","milestones_url":"https://api.github.com/repos/Martin2112/trillian/milestones{/number}","notifications_url":"https://api.github.com/repos/Martin2112/trillian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Martin2112/trillian/labels{/name}","releases_url":"https://api.github.com/repos/Martin2112/trillian/releases{/id}","deployments_url":"https://api.github.com/repos/Martin2112/trillian/deployments","created_at":"2016-05-31T11:07:09Z","updated_at":"2016-05-31T11:07:10Z","pushed_at":"2016-11-15T11:43:46Z","git_url":"git://github.com/Martin2112/trillian.git","ssh_url":"git@github.com:Martin2112/trillian.git","clone_url":"https://github.com/Martin2112/trillian.git","svn_url":"https://github.com/Martin2112/trillian","homepage":null,"size":1352,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"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":"b470aff8de49a3ede5cf5ced7a87ddff2220de26","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.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://avatars.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":null,"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":"2016-11-14T15:52:17Z","pushed_at":"2016-11-15T11:44:17Z","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":null,"size":1652,"stargazers_count":100,"watchers_count":100,"language":"Go","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":16,"forks":15,"open_issues":16,"watchers":100,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/216"},"html":{"href":"https://github.com/google/trillian/pull/216"},"issue":{"href":"https://api.github.com/repos/google/trillian/issues/216"},"comments":{"href":"https://api.github.com/repos/google/trillian/issues/216/comments"},"review_comments":{"href":"https://api.github.com/repos/google/trillian/pulls/216/comments"},"review_comment":{"href":"https://api.github.com/repos/google/trillian/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/trillian/pulls/216/commits"},"statuses":{"href":"https://api.github.com/repos/google/trillian/statuses/58b3066d69eef8753b1aad6089b16012d1c91c2f"}}}}
{"actor":{"display_login":"daviddrysdale"}}