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

feat: add support for Blobstream API #3470

Merged
merged 59 commits into from
Jul 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
dda88ee
feat: add support for the Blobstream API in node
rach-id Jun 4, 2024
41bfd50
chore: add permissions to methods
rach-id Jun 4, 2024
a3a32f3
fix: use the share proofs to generate the commitment proofs
rach-id Jun 5, 2024
e5d2e1d
chore: gofumpt
rach-id Jun 5, 2024
cb6f660
chore: docs
rach-id Jun 5, 2024
8220364
Update nodebuilder/blobstream/service.go
rach-id Jun 5, 2024
4309614
Merge branch 'main' into blobstream--api
rach-id Jun 5, 2024
15b59dd
chore: go mod tidy
rach-id Jun 5, 2024
8231ade
Merge remote-tracking branch 'origin/blobstream--api' into blobstream…
rach-id Jun 5, 2024
d31ee83
chore: lint
rach-id Jun 5, 2024
a784be9
chore: lint
rach-id Jun 5, 2024
4463b4a
chore: gofumpt
rach-id Jun 5, 2024
1953fc5
chore: gofumpt
rach-id Jun 5, 2024
eb0b29e
chore: gofumpt
rach-id Jun 5, 2024
e4c5910
chore: lowercase import
rach-id Jun 7, 2024
f8a3066
chore: internal struct definition inside API
rach-id Jun 7, 2024
a409722
chore: fmt
rach-id Jun 20, 2024
44f17a1
chore: DataCommitment to GetDataCommitment as suggested by @vgonkivs
rach-id Jun 20, 2024
080101a
chore: DataCommitment to GetDataCommitment as suggested by @vgonkivs
rach-id Jun 20, 2024
5fc0203
chore: DataRootInclusionProof to GetDataRootInclusionProof as suggest…
rach-id Jun 20, 2024
350d950
chore: remove todo
rach-id Jun 20, 2024
411fc20
chore: commitment proof pointer receiver
rach-id Jun 20, 2024
9e48e55
fix: subtreeRootProofs instead of SubtreeRoots in error message
rach-id Jun 20, 2024
f24171e
chore: new line
rach-id Jun 20, 2024
9b79dba
chore: revert unnecessary changes
rach-id Jun 20, 2024
7db0ab9
Update nodebuilder/blobstream/service.go
rach-id Jun 20, 2024
02be8ac
chore: unwrap API types
rach-id Jul 3, 2024
68936af
chore: refactor the blobstream API
rach-id Jul 13, 2024
4ce631d
Merge branch 'main' into blobstream--api
rach-id Jul 13, 2024
576c077
chore: imports
rach-id Jul 13, 2024
1f2dba2
fix: wrap the get range return value
rach-id Jul 13, 2024
765240d
chore: lint
rach-id Jul 13, 2024
3b2680b
chore: update nmt dependency
rach-id Jul 16, 2024
8c56c74
chore: use a ErrHeightNegative
rach-id Jul 19, 2024
609e714
chore: rename to data root tuple root
rach-id Jul 19, 2024
4bc4d7d
chore: rename to data root tuple root
rach-id Jul 19, 2024
76a1aaf
chore: un-export data root tuple
rach-id Jul 19, 2024
2c53cb0
docs: document GetDataRootTupleInclusionProof and GetDataRootTupleRoot
rach-id Jul 19, 2024
8bc6a66
chore: use uint64 for heights
rach-id Jul 19, 2024
6917aa2
Update nodebuilder/header/service.go
rach-id Jul 19, 2024
d44ffdb
chore: regenerate api
rach-id Jul 19, 2024
18452f6
fix: remove call to network head
rach-id Jul 19, 2024
6a0b5cf
Merge remote-tracking branch 'origin/blobstream--api' into blobstream…
rach-id Jul 19, 2024
e5f6a05
docs: comment suggestion by @renaynay
rach-id Jul 19, 2024
e5d1719
docs: whitespace as suggested by @renaynay
rach-id Jul 19, 2024
f8a7354
docs: whitespace as suggested by @renaynay
rach-id Jul 19, 2024
9d46758
chore: use GetHeaderRange instead of manually getting the headers
rach-id Jul 19, 2024
b9d7da2
refactor: remove data root tuple type
rach-id Jul 19, 2024
3cfecc2
Merge branch 'main' into blobstream--api
rach-id Jul 19, 2024
8276e5a
chore: bump app version and remove unnecessary checks
rach-id Jul 19, 2024
fbc63b6
Merge remote-tracking branch 'origin/blobstream--api' into blobstream…
rach-id Jul 19, 2024
da27e8a
refactor: reintroduce the blobstream module
rach-id Jul 19, 2024
4b71f5b
fix: correctly register the blobstream module
rach-id Jul 19, 2024
e978706
Update nodebuilder/blobstream/data_root_tuple_root.go
rach-id Jul 22, 2024
644c279
fix: also include the initial header when encoding data root tuples
rach-id Jul 22, 2024
b8d7a44
docs: update to comment to reflect data root tuple blocks limit time
rach-id Jul 22, 2024
dc08265
chore: gofumpt
rach-id Jul 22, 2024
1183e46
chore: add array capacity
rach-id Jul 22, 2024
6384bcf
Merge branch 'main' into blobstream--api
renaynay Jul 23, 2024
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
29 changes: 12 additions & 17 deletions nodebuilder/header/data_root_tuple_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@ func proveDataRootTuples(tuples []dataRootTuple, height uint64) (*merkle.Proof,
if height == 0 {
return nil, ErrHeightZero
}
currentHeight := tuples[0].height - 1
for _, tuple := range tuples {
if tuple.height != currentHeight+1 {
return nil, fmt.Errorf("the provided tuples are not consecutive %d vs %d", currentHeight, tuple.height)
}
currentHeight++
}
dataRootEncodedTuples := make([][]byte, 0, len(tuples))
for _, tuple := range tuples {
encodedTuple, err := encodeDataRootTuple(
Expand All @@ -211,19 +204,21 @@ func proveDataRootTuples(tuples []dataRootTuple, height uint64) (*merkle.Proof,

// fetchDataRootTuples takes an end exclusive range of heights and fetches its
// corresponding data root tuples.
// end is not included in the range.
func (s *Service) fetchDataRootTuples(ctx context.Context, start, end uint64) ([]dataRootTuple, error) {
tuples := make([]dataRootTuple, 0, end-start)
for height := start; height < end; height++ {
block, err := s.GetByHeight(ctx, height)
if err != nil {
return nil, err
}
if block == nil {
return nil, fmt.Errorf("couldn't load block %d", height)
}
startHeader, err := s.GetByHeight(ctx, start)
if err != nil {
return nil, err
}
headerRange, err := s.GetRangeByHeight(ctx, startHeader, end)
if err != nil {
return nil, err
}
for _, header := range headerRange {
tuples = append(tuples, dataRootTuple{
height: block.Height(),
dataRoot: *(*[32]byte)(block.DataHash),
height: header.Height(),
dataRoot: *(*[32]byte)(header.DataHash),
rach-id marked this conversation as resolved.
Show resolved Hide resolved
})
}
return tuples, nil
Expand Down
Loading