Skip to content

Commit b432a67

Browse files
authored
Merge pull request #1 from rach-id/fixing-proofs-query
fix: proofs conversions
2 parents 902081c + 860e2f9 commit b432a67

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Diff for: client/convert.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func toNamespaceMerkleMultiProofs(proofs []*tmproto.NMTProof) []shareloader.Name
3131
func minNamespace(innerNode []byte) *shareloader.Namespace {
3232
version := innerNode[0]
3333
var id [28]byte
34-
for i, b := range innerNode[1:28] {
34+
for i, b := range innerNode[1:29] {
3535
id[i] = b
3636
}
3737
return &shareloader.Namespace{
@@ -66,12 +66,9 @@ func toNamespaceNode(node []byte) *shareloader.NamespaceNode {
6666
}
6767
}
6868

69-
func namespace(namespaceID []byte) *shareloader.Namespace {
70-
version := namespaceID[0]
69+
func namespace(namespaceID []byte, version uint8) *shareloader.Namespace {
7170
var id [28]byte
72-
for i, b := range namespaceID[1:] {
73-
id[i] = b
74-
}
71+
copy(id[:], namespaceID)
7572
return &shareloader.Namespace{
7673
Version: [1]byte{version},
7774
Id: id,

Diff for: client/proof.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func GetShareProof(eth *ethclient.Client, trpc *http.HTTP, sp *SharePointer) (*s
5454
return &shareloader.SharesProof{
5555
Data: shareProof.Data,
5656
ShareProofs: toNamespaceMerkleMultiProofs(shareProof.ShareProofs),
57-
Namespace: *namespace(shareProof.NamespaceID),
57+
Namespace: *namespace(shareProof.NamespaceID, uint8(shareProof.NamespaceVersion)),
5858
RowRoots: toRowRoots(shareProof.RowProof.RowRoots),
5959
RowProofs: toRowProofs(shareProof.RowProof.Proofs),
6060
AttestationProof: toAttestationProof(nonce, height, blockDataRoot, dcProof.Proof),

0 commit comments

Comments
 (0)