Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: take the LeafIndex changes from mmr and use it #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions completeness/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ require (
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/datatrails/go-datatrails-common-api-gen v0.4.8 // indirect
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7 // indirect
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1 // indirect
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9 // indirect
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2 // indirect
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1 // indirect
github.com/datatrails/go-datatrails-simplehash v0.0.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions completeness/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ github.com/datatrails/go-datatrails-common-api-gen v0.4.8 h1:IzrhGHi9TyEASjk06Qj
github.com/datatrails/go-datatrails-common-api-gen v0.4.8/go.mod h1:zlwFPJXYAK7yqgLtxKUgkF5gw9ddxoqWS+Ruhf+Ksw0=
github.com/datatrails/go-datatrails-demos/logverification v0.0.3 h1:P8DU8ZSVqOmMkm37LWhxpWXrBPwhExuGSXpJ+306LyE=
github.com/datatrails/go-datatrails-demos/logverification v0.0.3/go.mod h1:5uMSYrfH8l3RNtiu934BXhwym9TorhSp375O188MJrM=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7 h1:844V2QxLhVmSkOISu00qHMxs4+XpGU2tHQ433S3akHY=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7/go.mod h1:eNMW+ZfyGT4ttj/vAE56Ut1uWfdc9zW1W7yIIl2XF1k=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1 h1:XggMVejsJ72cAL/msjPhQUSQNeElSh/O1zZcvX4d4JU=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1/go.mod h1:+Oz8O6bns0rF6gr03xJzKTBzUzyskZ8Gics8/qeNzYk=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9 h1:89ma+ZM2UllHdBGOzjye8MXiizpJWZbCthhESyO84tY=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9/go.mod h1:5o8k+btUoxenGw9sy7x85q2qdzsmu9v2ALMk13RTpG4=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2 h1:Jxov4/onoFiCISLQNSPy/nyt3USAEvUZpEjlScHJYKI=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2/go.mod h1:+Oz8O6bns0rF6gr03xJzKTBzUzyskZ8Gics8/qeNzYk=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1 h1:sIyXWKTadqmVEsPj66RlKwRKzNQ7hK9SH1fRjZFDCa8=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1/go.mod h1:KGdkOtamWG48EN4AXtTHPv6C0jJKrj840IMSkrD+egk=
github.com/datatrails/go-datatrails-simplehash v0.0.3 h1:H4zNsdB9d2KMZ3EqM6n6AMGYB/RquEjANqcNrUlZtp8=
Expand Down
4 changes: 2 additions & 2 deletions integrity/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ require (
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/datatrails/go-datatrails-common-api-gen v0.4.8 // indirect
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7 // indirect
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1 // indirect
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9 // indirect
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2 // indirect
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1 // indirect
github.com/datatrails/go-datatrails-simplehash v0.0.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions integrity/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ github.com/datatrails/go-datatrails-common-api-gen v0.4.8 h1:IzrhGHi9TyEASjk06Qj
github.com/datatrails/go-datatrails-common-api-gen v0.4.8/go.mod h1:zlwFPJXYAK7yqgLtxKUgkF5gw9ddxoqWS+Ruhf+Ksw0=
github.com/datatrails/go-datatrails-demos/logverification v0.0.3 h1:P8DU8ZSVqOmMkm37LWhxpWXrBPwhExuGSXpJ+306LyE=
github.com/datatrails/go-datatrails-demos/logverification v0.0.3/go.mod h1:5uMSYrfH8l3RNtiu934BXhwym9TorhSp375O188MJrM=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7 h1:844V2QxLhVmSkOISu00qHMxs4+XpGU2tHQ433S3akHY=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7/go.mod h1:eNMW+ZfyGT4ttj/vAE56Ut1uWfdc9zW1W7yIIl2XF1k=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1 h1:XggMVejsJ72cAL/msjPhQUSQNeElSh/O1zZcvX4d4JU=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1/go.mod h1:+Oz8O6bns0rF6gr03xJzKTBzUzyskZ8Gics8/qeNzYk=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9 h1:89ma+ZM2UllHdBGOzjye8MXiizpJWZbCthhESyO84tY=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9/go.mod h1:5o8k+btUoxenGw9sy7x85q2qdzsmu9v2ALMk13RTpG4=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2 h1:Jxov4/onoFiCISLQNSPy/nyt3USAEvUZpEjlScHJYKI=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2/go.mod h1:+Oz8O6bns0rF6gr03xJzKTBzUzyskZ8Gics8/qeNzYk=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1 h1:sIyXWKTadqmVEsPj66RlKwRKzNQ7hK9SH1fRjZFDCa8=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1/go.mod h1:KGdkOtamWG48EN4AXtTHPv6C0jJKrj840IMSkrD+egk=
github.com/datatrails/go-datatrails-simplehash v0.0.3 h1:H4zNsdB9d2KMZ3EqM6n6AMGYB/RquEjANqcNrUlZtp8=
Expand Down
4 changes: 2 additions & 2 deletions logverification/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.22
require (
github.com/datatrails/go-datatrails-common v0.16.1
github.com/datatrails/go-datatrails-common-api-gen v0.4.5
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2
github.com/datatrails/go-datatrails-simplehash v0.0.3
github.com/stretchr/testify v1.9.0
google.golang.org/protobuf v1.34.1
Expand Down
8 changes: 4 additions & 4 deletions logverification/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ github.com/datatrails/go-datatrails-common v0.16.1 h1:kaNOwyu8EmBbIR44daWDiUZxBt
github.com/datatrails/go-datatrails-common v0.16.1/go.mod h1:IEcuwUaFl+bI1tt30r+Ov2+nvpcAZH/kXmAPGFjkwT4=
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.0.7 h1:844V2QxLhVmSkOISu00qHMxs4+XpGU2tHQ433S3akHY=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.7/go.mod h1:eNMW+ZfyGT4ttj/vAE56Ut1uWfdc9zW1W7yIIl2XF1k=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1 h1:XggMVejsJ72cAL/msjPhQUSQNeElSh/O1zZcvX4d4JU=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.1/go.mod h1:+Oz8O6bns0rF6gr03xJzKTBzUzyskZ8Gics8/qeNzYk=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9 h1:89ma+ZM2UllHdBGOzjye8MXiizpJWZbCthhESyO84tY=
github.com/datatrails/go-datatrails-merklelog/massifs v0.0.9/go.mod h1:5o8k+btUoxenGw9sy7x85q2qdzsmu9v2ALMk13RTpG4=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2 h1:Jxov4/onoFiCISLQNSPy/nyt3USAEvUZpEjlScHJYKI=
github.com/datatrails/go-datatrails-merklelog/mmr v0.0.2/go.mod h1:+Oz8O6bns0rF6gr03xJzKTBzUzyskZ8Gics8/qeNzYk=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1 h1:sIyXWKTadqmVEsPj66RlKwRKzNQ7hK9SH1fRjZFDCa8=
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.0.1/go.mod h1:KGdkOtamWG48EN4AXtTHPv6C0jJKrj840IMSkrD+egk=
github.com/datatrails/go-datatrails-simplehash v0.0.3 h1:H4zNsdB9d2KMZ3EqM6n6AMGYB/RquEjANqcNrUlZtp8=
Expand Down
4 changes: 2 additions & 2 deletions logverification/leafrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import "github.com/datatrails/go-datatrails-merklelog/mmr"
func LeafRange(sortedEvents []EventDetails) (uint64, uint64) {

lowerBoundMMRIndex := sortedEvents[0].MerkleLog.Commit.Index
lowerBoundLeafIndex := mmr.LeafCount(lowerBoundMMRIndex+1) - 1 // Note: LeafCount takes an mmrIndex here not a size
lowerBoundLeafIndex := mmr.LeafIndex(lowerBoundMMRIndex)

upperBoundMMRIndex := sortedEvents[len(sortedEvents)-1].MerkleLog.Commit.Index
upperBoundLeafIndex := mmr.LeafCount(upperBoundMMRIndex+1) - 1 // Note: LeafCount takes an mmrIndex here not a size
upperBoundLeafIndex := mmr.LeafIndex(upperBoundMMRIndex)

return lowerBoundLeafIndex, upperBoundLeafIndex

Expand Down
Loading