Skip to content

Commit

Permalink
Dev/robin/8241 accumulator prove and verify (#22)
Browse files Browse the repository at this point in the history
COSE Receipt MMRIVER draft alignment changes

The primary change here is to make our consistency proofs and inclusion proofs work in terms of the accumulator defined in the paper referenced by the COSE Receipts MMRIVER [draft](https://www.ietf.org/archive/id/draft-bryce-cose-merkle-mountain-range-proofs-00.html). And generaly include full support for [COSE Recieipts](https://cose-wg.github.io/draft-ietf-cose-merkle-tree-proofs/draft-ietf-cose-merkle-tree-proofs.html)

It also cleans up various algorithm implementations and checks that the draft algorithm implmentations and our go lang immplementation both meet the test vectors published by the draft.

Because it remains useful to be able to do so, I have retained the original variants of algorithms that worked with mmr "bagged" peaks. Some algorithm implementations I think we can remove altogether, but in this pr have not been deleted. Instead they are used in tests which show the "old" versions match the "new" versions

So in summary

* <file>bagged.go means a file that has things only relevant for MMR bagged peaks
* <file>old.go means a file that has things that are retained for compatibility testing but which are now "depricated"
* <func>Bagged() means the function is only relevant for working with MMR bagged peaks
* <func>Old() means the function is depricated, retained for compatibility testing

* clean up proof generation and align with  likely rfc alog destription
* verification from generic accumulator proof, helpers and tests
* simplification for AddHashedLeaf
* test: add various tests showing alignment with the mmr draft
* fix: log base 2 32 bit variant off by one
* Pre-signed receipts attached as seal headers
* Add guard to IndexProof where the requested index is greater than the
  MMRSize limit
* mmrIndex vs mmrSize bug in BuildReceipt

---------

Signed-off-by: robinbryce <[email protected]>
Co-authored-by: Robin Bryce <[email protected]>
Co-authored-by: Joe Gough <[email protected]>
  • Loading branch information
3 people authored Oct 30, 2024
1 parent ca5d457 commit d214f3f
Show file tree
Hide file tree
Showing 62 changed files with 4,002 additions and 1,630 deletions.
56 changes: 24 additions & 32 deletions massifs/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,63 @@ module github.com/datatrails/go-datatrails-merklelog/massifs

go 1.22

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

require (
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0
)

require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1
github.com/datatrails/go-datatrails-common v0.15.1
github.com/datatrails/go-datatrails-common v0.18.0
github.com/google/uuid v1.6.0
github.com/stretchr/testify v1.9.0
github.com/veraison/go-cose v1.1.0
)

require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.4.0 // indirect
github.com/Azure/go-amqp v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.7.1 // indirect
github.com/Azure/go-amqp v1.0.5 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.22 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.13 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/KimMachineGun/automemlimit v0.3.0 // indirect
github.com/cilium/ebpf v0.12.3 // indirect
github.com/containerd/cgroups/v3 v3.0.2 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fxamacker/cbor/v2 v2.5.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/fxamacker/cbor v1.5.1
github.com/fxamacker/cbor/v2 v2.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/ldclabs/cose/go v0.0.0-20221214142927-d22c1cfc2154 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/opencontainers/runtime-spec v1.1.0 // indirect
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
github.com/opentracing-contrib/go-stdlib v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0 // indirect
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/automaxprocs v1.5.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit d214f3f

Please sign in to comment.