Skip to content

Commit

Permalink
Use correct log index in inclusion proof (#1599)
Browse files Browse the repository at this point in the history
* Use correct log index in inclusion proof

Signed-off-by: Ceridwen Coghlan <cdriskill@google.com>

* updating tests

Signed-off-by: Ceridwen Coghlan <cdriskill@google.com>

* clarifying comments

Signed-off-by: Ceridwen Coghlan <cdriskill@google.com>

---------

Signed-off-by: Ceridwen Coghlan <cdriskill@google.com>
  • Loading branch information
Ceridwen Coghlan authored Jul 26, 2023
1 parent 2bd83da commit 87dd2cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/tle/tle.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func GenerateTransparencyLogEntry(anon models.LogEntryAnon) (*rekor_pb.Transpare
}

return &rekor_pb.TransparencyLogEntry{
LogIndex: *anon.LogIndex,
LogIndex: *anon.LogIndex, // the global log index
LogId: &rekor_pb_common.LogId{
KeyId: logIDHash,
},
Expand All @@ -78,7 +78,7 @@ func GenerateTransparencyLogEntry(anon models.LogEntryAnon) (*rekor_pb.Transpare
SignedEntryTimestamp: anon.Verification.SignedEntryTimestamp,
},
InclusionProof: &rekor_pb.InclusionProof{
LogIndex: *anon.LogIndex,
LogIndex: *anon.Verification.InclusionProof.LogIndex, // relative to the specific tree the entry is found in
RootHash: rootHash,
TreeSize: *anon.Verification.InclusionProof.TreeSize,
Hashes: inclusionProofHashes,
Expand Down
4 changes: 2 additions & 2 deletions pkg/tle/tle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestGenerateTransparencyLogEntry(t *testing.T) {
Body: "eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiI2MmQwOGYyOGM2OWNhZGE3YjQyYTQ1Nzk0YjQ3ZWU2YzgxYTdkZmE3M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NlpGQUtRV3BDYVhwR2NHZEVMelJzWW5aa1NuRnplWE5HYlVSeU1TdFNNSGhKWjI1S1N5c3JaWGROYmtKaVMxQkVMemd3VTNJelFYTTVMMWxxV1U5M05EVjRkUXA2ZVdzOUNpMHRMUzB0UlU1RUlFTkZVbFJKUmtsRFFWUkZMUzB0TFMwSyJ9fX19",
IntegratedTime: swag.Int64(123),
LogID: swag.String("deadbeef"),
LogIndex: swag.Int64(1),
LogIndex: swag.Int64(2),
Verification: &models.LogEntryAnonVerification{
InclusionProof: &models.InclusionProof{
Checkpoint: swag.String("checkpoint"),
Expand All @@ -64,7 +64,7 @@ func TestGenerateTransparencyLogEntry(t *testing.T) {
},
},
want: &rekor_pb.TransparencyLogEntry{
LogIndex: 1,
LogIndex: 2,
LogId: &rekor_pb_common.LogId{
KeyId: deadbeefBytes,
},
Expand Down

0 comments on commit 87dd2cd

Please sign in to comment.