Skip to content

Commit

Permalink
updates for cose receipts algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Bryce committed Oct 30, 2024
1 parent 77f2eb3 commit a71e034
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
9 changes: 2 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@ go 1.22
require (
github.com/datatrails/go-datatrails-common v0.18.0
github.com/datatrails/go-datatrails-common-api-gen v0.4.5
github.com/datatrails/go-datatrails-merklelog/massifs v0.1.1
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2
github.com/datatrails/go-datatrails-merklelog/massifs v0.2.0
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.0
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0
github.com/datatrails/go-datatrails-simplehash v0.0.5
github.com/stretchr/testify v1.9.0
github.com/veraison/go-cose v1.1.0
google.golang.org/protobuf v1.34.2
)

replace (
github.com/datatrails/go-datatrails-merklelog/massifs => ../go-datatrails-merklelog/massifs
github.com/datatrails/go-datatrails-merklelog/mmr => ../go-datatrails-merklelog/mmr
)

require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ github.com/datatrails/go-datatrails-common v0.18.0 h1:OeNP4EdIjhLHnE/mdN2/kp6Fq+
github.com/datatrails/go-datatrails-common v0.18.0/go.mod h1:fBDqKHRLUYcictdWdLrIhKNhieKVE2r0II8vyETCuhM=
github.com/datatrails/go-datatrails-common-api-gen v0.4.5 h1:QtxIFSdOEf6bhHZd7g/MfWdCWfPEtwTQNDz3K9u33+c=
github.com/datatrails/go-datatrails-common-api-gen v0.4.5/go.mod h1:OQN91xvlW6xcWTFvwsM2Nn4PZwFAIOE52FG7yRl4QPQ=
github.com/datatrails/go-datatrails-merklelog/massifs v0.2.0 h1:UK8SsH6X1a2MFSrKBCvSgwRGRy94ZDXsgXrAyBy6bDU=
github.com/datatrails/go-datatrails-merklelog/massifs v0.2.0/go.mod h1:bISXyzOXbHJS2AANP1nc+07AJ+OlKDOs+wFP6oc2oSY=
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.0 h1:DKHY1rgLQ+8JoVZfSrMOwPytgQy7+oyYQ8EWHryEXE4=
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.0/go.mod h1:B/Kkz4joZTiTz0q/9FFAgHR+Tcn6UxtphMuCzamAc9Q=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0 h1:q9RXtAGydXKSJjARnFObNu743cbfIOfERTXiiVa2tF4=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0/go.mod h1:rWFjeK1NU7qnhl9+iKdjASpw/CkPwDAOPHsERYR7uEQ=
github.com/datatrails/go-datatrails-simplehash v0.0.5 h1:igu4QRYO87RQXrJlqSm3fgMA2Q0F4jglWqBlfvKrXKQ=
Expand Down
2 changes: 1 addition & 1 deletion integrationsupport/massifseal.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func GenerateMassifSeal(t *testing.T, testContext mmrtesting.TestContext, lastEv
require.Nil(t, err)

mmrSize := massifContext.RangeCount()
peaks, err := mmr.PeakHashes(&massifContext, mmrSize)
peaks, err := mmr.PeakHashes(&massifContext, mmrSize-1)
require.Nil(t, err)
id, epoch, err := massifs.SplitIDTimestampHex(lastEvent.MerklelogEntry.Commit.Idtimestamp)
require.Nil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion logverification/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func EventProof(verifiableEvent VerifiableEvent, massif *massifs.MassifContext)
// Get the size of the complete tenant MMR
mmrSize := massif.RangeCount()

proof, err := mmr.IndexProof(massif, mmrSize, verifiableEvent.MerkleLog.Commit.Index)
proof, err := mmr.InclusionProof(massif, mmrSize-1, verifiableEvent.MerkleLog.Commit.Index)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion logverification/seal.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func SignedLogState(
// of the data. If verification succeeds when this computed root is added to signedStateNow, then
// we can be confident that DataTrails signed this state, and that the root matches your data.

logState.Peaks, err = mmr.PeakHashes(&massifContext, logState.MMRSize)
logState.Peaks, err = mmr.PeakHashes(&massifContext, logState.MMRSize-1)
if err != nil {
return nil, fmt.Errorf("SignedLogState failed: unable to get root for massifContextNow: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion logverification/verifylist.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func VerifyEventInList(
// we can do an inclusion proof of the leaf node on the merkle log.
mmrSize := massifContext.RangeCount()

inclusionProof, err := mmr.IndexProof(massifContext, mmrSize, leafMMRIndex)
inclusionProof, err := mmr.InclusionProof(massifContext, mmrSize-1, leafMMRIndex)
if err != nil {
return Unknown, err
}
Expand Down

0 comments on commit a71e034

Please sign in to comment.