Skip to content

Commit a71e034

Browse files
author
Robin Bryce
committed
updates for cose receipts algorithms
1 parent 77f2eb3 commit a71e034

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

go.mod

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,15 @@ go 1.22
55
require (
66
github.com/datatrails/go-datatrails-common v0.18.0
77
github.com/datatrails/go-datatrails-common-api-gen v0.4.5
8-
github.com/datatrails/go-datatrails-merklelog/massifs v0.1.1
9-
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2
8+
github.com/datatrails/go-datatrails-merklelog/massifs v0.2.0
9+
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.0
1010
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0
1111
github.com/datatrails/go-datatrails-simplehash v0.0.5
1212
github.com/stretchr/testify v1.9.0
1313
github.com/veraison/go-cose v1.1.0
1414
google.golang.org/protobuf v1.34.2
1515
)
1616

17-
replace (
18-
github.com/datatrails/go-datatrails-merklelog/massifs => ../go-datatrails-merklelog/massifs
19-
github.com/datatrails/go-datatrails-merklelog/mmr => ../go-datatrails-merklelog/mmr
20-
)
21-
2217
require (
2318
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
2419
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ github.com/datatrails/go-datatrails-common v0.18.0 h1:OeNP4EdIjhLHnE/mdN2/kp6Fq+
4444
github.com/datatrails/go-datatrails-common v0.18.0/go.mod h1:fBDqKHRLUYcictdWdLrIhKNhieKVE2r0II8vyETCuhM=
4545
github.com/datatrails/go-datatrails-common-api-gen v0.4.5 h1:QtxIFSdOEf6bhHZd7g/MfWdCWfPEtwTQNDz3K9u33+c=
4646
github.com/datatrails/go-datatrails-common-api-gen v0.4.5/go.mod h1:OQN91xvlW6xcWTFvwsM2Nn4PZwFAIOE52FG7yRl4QPQ=
47+
github.com/datatrails/go-datatrails-merklelog/massifs v0.2.0 h1:UK8SsH6X1a2MFSrKBCvSgwRGRy94ZDXsgXrAyBy6bDU=
48+
github.com/datatrails/go-datatrails-merklelog/massifs v0.2.0/go.mod h1:bISXyzOXbHJS2AANP1nc+07AJ+OlKDOs+wFP6oc2oSY=
49+
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.0 h1:DKHY1rgLQ+8JoVZfSrMOwPytgQy7+oyYQ8EWHryEXE4=
50+
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.0/go.mod h1:B/Kkz4joZTiTz0q/9FFAgHR+Tcn6UxtphMuCzamAc9Q=
4751
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0 h1:q9RXtAGydXKSJjARnFObNu743cbfIOfERTXiiVa2tF4=
4852
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0/go.mod h1:rWFjeK1NU7qnhl9+iKdjASpw/CkPwDAOPHsERYR7uEQ=
4953
github.com/datatrails/go-datatrails-simplehash v0.0.5 h1:igu4QRYO87RQXrJlqSm3fgMA2Q0F4jglWqBlfvKrXKQ=

integrationsupport/massifseal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func GenerateMassifSeal(t *testing.T, testContext mmrtesting.TestContext, lastEv
2525
require.Nil(t, err)
2626

2727
mmrSize := massifContext.RangeCount()
28-
peaks, err := mmr.PeakHashes(&massifContext, mmrSize)
28+
peaks, err := mmr.PeakHashes(&massifContext, mmrSize-1)
2929
require.Nil(t, err)
3030
id, epoch, err := massifs.SplitIDTimestampHex(lastEvent.MerklelogEntry.Commit.Idtimestamp)
3131
require.Nil(t, err)

logverification/proof.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func EventProof(verifiableEvent VerifiableEvent, massif *massifs.MassifContext)
1818
// Get the size of the complete tenant MMR
1919
mmrSize := massif.RangeCount()
2020

21-
proof, err := mmr.IndexProof(massif, mmrSize, verifiableEvent.MerkleLog.Commit.Index)
21+
proof, err := mmr.InclusionProof(massif, mmrSize-1, verifiableEvent.MerkleLog.Commit.Index)
2222
if err != nil {
2323
return nil, err
2424
}

logverification/seal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func SignedLogState(
4848
// of the data. If verification succeeds when this computed root is added to signedStateNow, then
4949
// we can be confident that DataTrails signed this state, and that the root matches your data.
5050

51-
logState.Peaks, err = mmr.PeakHashes(&massifContext, logState.MMRSize)
51+
logState.Peaks, err = mmr.PeakHashes(&massifContext, logState.MMRSize-1)
5252
if err != nil {
5353
return nil, fmt.Errorf("SignedLogState failed: unable to get root for massifContextNow: %w", err)
5454
}

logverification/verifylist.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func VerifyEventInList(
349349
// we can do an inclusion proof of the leaf node on the merkle log.
350350
mmrSize := massifContext.RangeCount()
351351

352-
inclusionProof, err := mmr.IndexProof(massifContext, mmrSize, leafMMRIndex)
352+
inclusionProof, err := mmr.InclusionProof(massifContext, mmrSize-1, leafMMRIndex)
353353
if err != nil {
354354
return Unknown, err
355355
}

0 commit comments

Comments
 (0)