From 7d0c728242c0a2c1d110011b0982541610b9dfcf Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 31 Jan 2024 10:36:43 +0100 Subject: [PATCH 1/3] feat!: adding Namespace to remaining endpoints (#35) * adding namespaces * changing submitoptions to gasprice,ns * adding namespace to remaining endpoints * updating readme w note * nit: lint md013 - skip tables --------- Co-authored-by: Javed Khan updating readme w note feat: GetProofs introduction updating readme --- README.md | 4 +- da.go | 10 +- proto/da/da.proto | 15 +- proxy/client.go | 19 +- proxy/server.go | 15 +- test/dummy.go | 18 +- test/test_suite.go | 20 +- types/pb/da/da.pb.go | 585 +++++++++++++++++++++++++++++++++++-------- 8 files changed, 553 insertions(+), 133 deletions(-) diff --git a/README.md b/README.md index 907d302..dc65979 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,11 @@ go-da defines a generic Data Availability interface for modular blockchains. | `MaxBlobSize` | | `uint64` | | `Get` | `ids []ID, namespace Namespace` | `[]Blobs` | | `GetIDs` | `height uint64, namespace Namespace` | `[]ID` | +| `GetProofs` | `height uint64, namespace Namespace` | `[]Proof` | | `Commit` | `blobs []Blob, namespace Namespace` | `[]Commitment` | | `Validate` | `ids []Blob, proofs []Proof, namespace Namespace` | `[]bool` | -| `Submit` | `blobs []Blob, gasPrice float64, namespace Namespace` | `[]ID, []Proof` | +| `Submit` | `blobs []Blob, gasPrice float64, namespace Namespace` | `[]ID` | +>>>>>>> 7e98847 (feat!: adding Namespace to remaining endpoints (#35)) NOTE: The `Namespace` parameter in the interface methods is optional and used only on DA layers that support the functionality, for example Celestia diff --git a/da.go b/da.go index 08d6414..41eece9 100644 --- a/da.go +++ b/da.go @@ -16,15 +16,17 @@ type DA interface { // GetIDs returns IDs of all Blobs located in DA at given height. GetIDs(ctx context.Context, height uint64, namespace Namespace) ([]ID, error) + // GetProofs returns inclusion Proofs for all Blobs located in DA at given height. + GetProofs(ctx context.Context, height uint64, namespace Namespace) ([]Proof, error) + // Commit creates a Commitment for each given Blob. Commit(ctx context.Context, blobs []Blob, namespace Namespace) ([]Commitment, error) // Submit submits the Blobs to Data Availability layer. // - // This method is synchronous. Upon successful submission to Data Availability layer, it returns ID identifying blob - // in DA and Proof of inclusion. - // If options is nil, default options are used. - Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace) ([]ID, []Proof, error) + // This method is synchronous. Upon successful submission to Data Availability layer, it returns the IDs identifying blobs + // in DA. + Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace) ([]ID, error) // Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs. Validate(ctx context.Context, ids []ID, proofs []Proof, namespace Namespace) ([]bool, error) diff --git a/proto/da/da.proto b/proto/da/da.proto index f0391b7..1ba27cf 100644 --- a/proto/da/da.proto +++ b/proto/da/da.proto @@ -12,6 +12,9 @@ service DAService { // GetIDs returns IDs of all Blobs located in DA at given height. rpc GetIDs(GetIDsRequest) returns (GetIDsResponse) {} + // GetProofs returns inclusion Proofs for all Blobs located in DA at given height. + rpc GetProofs(GetProofsRequest) returns (GetProofsResponse) {} + // Commit creates a Commitment for each given Blob. rpc Commit(CommitRequest) returns (CommitResponse) {} @@ -78,6 +81,17 @@ message GetIDsResponse { repeated ID ids = 1; } +// GetProofsRequest is the request type for the GetProofs rpc method. +message GetProofsRequest { + uint64 height = 1; + Namespace namespace = 2; +} + +// GetProofsResponse is the response type for the GetProofs rpc method. +message GetProofsResponse { + repeated Proof proofs = 1; +} + // CommitRequest is the request type for the Commit rpc method. message CommitRequest { repeated Blob blobs = 1; @@ -99,7 +113,6 @@ message SubmitRequest { // SubmitResponse is the response type for the Submit rpc method. message SubmitResponse { repeated ID ids = 1; - repeated Proof proofs = 2; } // ValidateRequest is the request type for the Validate rpc method. diff --git a/proxy/client.go b/proxy/client.go index f637909..79f117d 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -75,6 +75,17 @@ func (c *Client) GetIDs(ctx context.Context, height uint64, namespace da.Namespa return idsPB2DA(resp.Ids), nil } +// GetProofs returns inclusion Proofs for all Blobs located in DA at given height. +func (c *Client) GetProofs(ctx context.Context, height uint64, namespace da.Namespace) ([]da.Proof, error) { + req := &pbda.GetProofsRequest{Height: height, Namespace: &pbda.Namespace{Value: namespace}} + resp, err := c.client.GetProofs(ctx, req) + if err != nil { + return nil, err + } + + return proofsPB2DA(resp.Proofs), nil +} + // Commit creates a Commitment for each given Blob. func (c *Client) Commit(ctx context.Context, blobs []da.Blob, namespace da.Namespace) ([]da.Commitment, error) { req := &pbda.CommitRequest{ @@ -91,7 +102,7 @@ func (c *Client) Commit(ctx context.Context, blobs []da.Blob, namespace da.Names } // Submit submits the Blobs to Data Availability layer. -func (c *Client) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace) ([]da.ID, []da.Proof, error) { +func (c *Client) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace) ([]da.ID, error) { req := &pbda.SubmitRequest{ Blobs: blobsDA2PB(blobs), GasPrice: gasPrice, @@ -100,17 +111,15 @@ func (c *Client) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, resp, err := c.client.Submit(ctx, req) if err != nil { - return nil, nil, err + return nil, err } ids := make([]da.ID, len(resp.Ids)) - proofs := make([]da.Proof, len(resp.Proofs)) for i := range resp.Ids { ids[i] = resp.Ids[i].Value - proofs[i] = resp.Proofs[i].Value } - return ids, proofs, nil + return ids, nil } // Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs. diff --git a/proxy/server.go b/proxy/server.go index 9ebef14..a48661a 100644 --- a/proxy/server.go +++ b/proxy/server.go @@ -56,22 +56,29 @@ func (p *proxySrv) Commit(ctx context.Context, request *pbda.CommitRequest) (*pb return &pbda.CommitResponse{Commitments: commitsDA2PB(commits)}, nil } +func (p *proxySrv) GetProofs(ctx context.Context, request *pbda.GetProofsRequest) (*pbda.GetProofsResponse, error) { + proofs, err := p.target.GetProofs(ctx, request.Height, request.Namespace.GetValue()) + if err != nil { + return nil, err + } + + return &pbda.GetProofsResponse{Proofs: proofsDA2PB(proofs)}, nil +} + func (p *proxySrv) Submit(ctx context.Context, request *pbda.SubmitRequest) (*pbda.SubmitResponse, error) { blobs := blobsPB2DA(request.Blobs) - ids, proofs, err := p.target.Submit(ctx, blobs, request.GasPrice, request.Namespace.GetValue()) + ids, err := p.target.Submit(ctx, blobs, request.GasPrice, request.Namespace.GetValue()) if err != nil { return nil, err } resp := &pbda.SubmitResponse{ - Ids: make([]*pbda.ID, len(ids)), - Proofs: make([]*pbda.Proof, len(proofs)), + Ids: make([]*pbda.ID, len(ids)), } for i := range ids { resp.Ids[i] = &pbda.ID{Value: ids[i]} - resp.Proofs[i] = &pbda.Proof{Value: proofs[i]} } return resp, nil diff --git a/test/dummy.go b/test/dummy.go index 7636dfb..02e672e 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -90,6 +90,18 @@ func (d *DummyDA) GetIDs(ctx context.Context, height uint64, _ da.Namespace) ([] return ids, nil } +// GetProofs returns inclusion Proofs for all Blobs located in DA at given height. +func (d *DummyDA) GetProofs(ctx context.Context, height uint64, _ da.Namespace) ([]da.ID, error) { + d.mu.Lock() + defer d.mu.Unlock() + kvps := d.data[height] + proofs := make([]da.Proof, len(kvps)) + for i, kv := range kvps { + proofs[i] = d.getProof(kv.key, kv.value) + } + return proofs, nil +} + // Commit returns cryptographic Commitments for given blobs. func (d *DummyDA) Commit(ctx context.Context, blobs []da.Blob, _ da.Namespace) ([]da.Commitment, error) { commits := make([]da.Commitment, len(blobs)) @@ -100,20 +112,18 @@ func (d *DummyDA) Commit(ctx context.Context, blobs []da.Blob, _ da.Namespace) ( } // Submit stores blobs in DA layer. -func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace) ([]da.ID, []da.Proof, error) { +func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace) ([]da.ID, error) { d.mu.Lock() defer d.mu.Unlock() ids := make([]da.ID, len(blobs)) - proofs := make([]da.Proof, len(blobs)) d.height += 1 for i, blob := range blobs { ids[i] = append(d.nextID(), d.getHash(blob)...) - proofs[i] = d.getProof(ids[i], blob) d.data[d.height] = append(d.data[d.height], kvp{ids[i], blob}) } - return ids, proofs, nil + return ids, nil } // Validate checks the Proofs for given IDs. diff --git a/test/test_suite.go b/test/test_suite.go index e17bf1f..568a066 100644 --- a/test/test_suite.go +++ b/test/test_suite.go @@ -36,20 +36,17 @@ func BasicDATest(t *testing.T, d da.DA) { msg2 := []byte("message 2") ctx := context.TODO() - id1, proof1, err := d.Submit(ctx, []da.Blob{msg1}, 0, testNamespace) + id1, err := d.Submit(ctx, []da.Blob{msg1}, 0, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, id1) - assert.NotEmpty(t, proof1) - id2, proof2, err := d.Submit(ctx, []da.Blob{msg2}, 0, testNamespace) + id2, err := d.Submit(ctx, []da.Blob{msg2}, 0, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, id2) - assert.NotEmpty(t, proof2) - id3, proof3, err := d.Submit(ctx, []da.Blob{msg1}, 0, testNamespace) + id3, err := d.Submit(ctx, []da.Blob{msg1}, 0, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, id3) - assert.NotEmpty(t, proof3) assert.NotEqual(t, id1, id2) assert.NotEqual(t, id1, id3) @@ -66,6 +63,9 @@ func BasicDATest(t *testing.T, d da.DA) { assert.NoError(t, err) assert.NotEmpty(t, commitment2) + proof1, err := d.GetProofs(ctx, 1, testNamespace) + assert.NoError(t, err) + assert.NotEmpty(t, proof1) oks, err := d.Validate(ctx, id1, proof1, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, oks) @@ -73,6 +73,9 @@ func BasicDATest(t *testing.T, d da.DA) { assert.True(t, ok) } + proof2, err := d.GetProofs(ctx, 2, testNamespace) + assert.NoError(t, err) + assert.NotEmpty(t, proof2) oks, err = d.Validate(ctx, id2, proof2, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, oks) @@ -108,10 +111,9 @@ func GetIDsTest(t *testing.T, d da.DA) { msgs := [][]byte{[]byte("msg1"), []byte("msg2"), []byte("msg3")} ctx := context.TODO() - ids, proofs, err := d.Submit(ctx, msgs, 0, []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}) + ids, err := d.Submit(ctx, msgs, 0, testNamespace) assert.NoError(t, err) assert.Len(t, ids, len(msgs)) - assert.Len(t, proofs, len(msgs)) found := false end := time.Now().Add(1 * time.Second) @@ -162,7 +164,7 @@ func ConcurrentReadWriteTest(t *testing.T, d da.DA) { go func() { defer wg.Done() for i := uint64(1); i <= 100; i++ { - _, _, err := d.Submit(ctx, [][]byte{[]byte("test")}, 0, []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}) + _, err := d.Submit(ctx, [][]byte{[]byte("test")}, 0, testNamespace) assert.NoError(t, err) } }() diff --git a/types/pb/da/da.pb.go b/types/pb/da/da.pb.go index d58572f..13646f2 100644 --- a/types/pb/da/da.pb.go +++ b/types/pb/da/da.pb.go @@ -530,6 +530,104 @@ func (m *GetIDsResponse) GetIds() []*ID { return nil } +// GetProofsRequest is the request type for the GetProofs rpc method. +type GetProofsRequest struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Namespace *Namespace `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` +} + +func (m *GetProofsRequest) Reset() { *m = GetProofsRequest{} } +func (m *GetProofsRequest) String() string { return proto.CompactTextString(m) } +func (*GetProofsRequest) ProtoMessage() {} +func (*GetProofsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_feb508392bc12c0f, []int{11} +} +func (m *GetProofsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetProofsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetProofsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetProofsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetProofsRequest.Merge(m, src) +} +func (m *GetProofsRequest) XXX_Size() int { + return m.Size() +} +func (m *GetProofsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetProofsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetProofsRequest proto.InternalMessageInfo + +func (m *GetProofsRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *GetProofsRequest) GetNamespace() *Namespace { + if m != nil { + return m.Namespace + } + return nil +} + +// GetProofsResponse is the response type for the GetProofs rpc method. +type GetProofsResponse struct { + Proofs []*Proof `protobuf:"bytes,1,rep,name=proofs,proto3" json:"proofs,omitempty"` +} + +func (m *GetProofsResponse) Reset() { *m = GetProofsResponse{} } +func (m *GetProofsResponse) String() string { return proto.CompactTextString(m) } +func (*GetProofsResponse) ProtoMessage() {} +func (*GetProofsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_feb508392bc12c0f, []int{12} +} +func (m *GetProofsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetProofsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetProofsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetProofsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetProofsResponse.Merge(m, src) +} +func (m *GetProofsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetProofsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetProofsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetProofsResponse proto.InternalMessageInfo + +func (m *GetProofsResponse) GetProofs() []*Proof { + if m != nil { + return m.Proofs + } + return nil +} + // CommitRequest is the request type for the Commit rpc method. type CommitRequest struct { Blobs []*Blob `protobuf:"bytes,1,rep,name=blobs,proto3" json:"blobs,omitempty"` @@ -540,7 +638,7 @@ func (m *CommitRequest) Reset() { *m = CommitRequest{} } func (m *CommitRequest) String() string { return proto.CompactTextString(m) } func (*CommitRequest) ProtoMessage() {} func (*CommitRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{11} + return fileDescriptor_feb508392bc12c0f, []int{13} } func (m *CommitRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -592,7 +690,7 @@ func (m *CommitResponse) Reset() { *m = CommitResponse{} } func (m *CommitResponse) String() string { return proto.CompactTextString(m) } func (*CommitResponse) ProtoMessage() {} func (*CommitResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{12} + return fileDescriptor_feb508392bc12c0f, []int{14} } func (m *CommitResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -639,7 +737,7 @@ func (m *SubmitRequest) Reset() { *m = SubmitRequest{} } func (m *SubmitRequest) String() string { return proto.CompactTextString(m) } func (*SubmitRequest) ProtoMessage() {} func (*SubmitRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{13} + return fileDescriptor_feb508392bc12c0f, []int{15} } func (m *SubmitRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -691,15 +789,14 @@ func (m *SubmitRequest) GetNamespace() *Namespace { // SubmitResponse is the response type for the Submit rpc method. type SubmitResponse struct { - Ids []*ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` - Proofs []*Proof `protobuf:"bytes,2,rep,name=proofs,proto3" json:"proofs,omitempty"` + Ids []*ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` } func (m *SubmitResponse) Reset() { *m = SubmitResponse{} } func (m *SubmitResponse) String() string { return proto.CompactTextString(m) } func (*SubmitResponse) ProtoMessage() {} func (*SubmitResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{14} + return fileDescriptor_feb508392bc12c0f, []int{16} } func (m *SubmitResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -735,13 +832,6 @@ func (m *SubmitResponse) GetIds() []*ID { return nil } -func (m *SubmitResponse) GetProofs() []*Proof { - if m != nil { - return m.Proofs - } - return nil -} - // ValidateRequest is the request type for the Validate rpc method. type ValidateRequest struct { Ids []*ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` @@ -753,7 +843,7 @@ func (m *ValidateRequest) Reset() { *m = ValidateRequest{} } func (m *ValidateRequest) String() string { return proto.CompactTextString(m) } func (*ValidateRequest) ProtoMessage() {} func (*ValidateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{15} + return fileDescriptor_feb508392bc12c0f, []int{17} } func (m *ValidateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -812,7 +902,7 @@ func (m *ValidateResponse) Reset() { *m = ValidateResponse{} } func (m *ValidateResponse) String() string { return proto.CompactTextString(m) } func (*ValidateResponse) ProtoMessage() {} func (*ValidateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{16} + return fileDescriptor_feb508392bc12c0f, []int{18} } func (m *ValidateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -860,6 +950,8 @@ func init() { proto.RegisterType((*GetResponse)(nil), "da.GetResponse") proto.RegisterType((*GetIDsRequest)(nil), "da.GetIDsRequest") proto.RegisterType((*GetIDsResponse)(nil), "da.GetIDsResponse") + proto.RegisterType((*GetProofsRequest)(nil), "da.GetProofsRequest") + proto.RegisterType((*GetProofsResponse)(nil), "da.GetProofsResponse") proto.RegisterType((*CommitRequest)(nil), "da.CommitRequest") proto.RegisterType((*CommitResponse)(nil), "da.CommitResponse") proto.RegisterType((*SubmitRequest)(nil), "da.SubmitRequest") @@ -871,42 +963,44 @@ func init() { func init() { proto.RegisterFile("da/da.proto", fileDescriptor_feb508392bc12c0f) } var fileDescriptor_feb508392bc12c0f = []byte{ - // 547 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x8f, 0xd2, 0x40, - 0x14, 0xa6, 0xb0, 0x20, 0xbc, 0x0a, 0xab, 0xb3, 0x64, 0x6d, 0x50, 0x1b, 0x76, 0x4e, 0xc4, 0x1f, - 0xa8, 0x78, 0x30, 0xde, 0x14, 0x49, 0x08, 0x87, 0x35, 0x9b, 0xc1, 0x78, 0x32, 0x21, 0xc3, 0x76, - 0x64, 0x9b, 0x50, 0x5a, 0x3b, 0x65, 0xb3, 0xae, 0xff, 0x84, 0x7f, 0x96, 0xde, 0xf6, 0xe8, 0xd1, - 0xc0, 0x3f, 0x62, 0xa6, 0x33, 0xd3, 0x52, 0x37, 0x4d, 0xc3, 0xf1, 0xbd, 0xef, 0xbd, 0xef, 0x7d, - 0x7d, 0xef, 0x9b, 0x82, 0xe9, 0xd0, 0x17, 0x0e, 0xed, 0x07, 0xa1, 0x1f, 0xf9, 0xa8, 0xec, 0x50, - 0x7c, 0x02, 0x8d, 0x8f, 0xd4, 0x63, 0x3c, 0xa0, 0xe7, 0x0c, 0xb5, 0xa1, 0x7a, 0x49, 0x97, 0x6b, - 0x66, 0x19, 0x5d, 0xa3, 0x77, 0x97, 0xc8, 0x00, 0x3f, 0x82, 0x83, 0xe1, 0xd2, 0x9f, 0xe7, 0xa0, - 0x1d, 0x28, 0x4f, 0x46, 0x39, 0x18, 0x06, 0xf8, 0xe0, 0x7b, 0x9e, 0x1b, 0x79, 0x6c, 0x15, 0xe5, - 0xd4, 0x3c, 0x86, 0xea, 0x59, 0xe8, 0xfb, 0x5f, 0x73, 0xe0, 0x36, 0xa0, 0x53, 0x7a, 0x25, 0xe6, - 0x4f, 0xdd, 0x6b, 0x46, 0xd8, 0xb7, 0x35, 0xe3, 0x11, 0x7e, 0x0b, 0x47, 0x99, 0x2c, 0x0f, 0xfc,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x58, 0xff, 0xeb, 0x8d, - 0x05, 0x00, 0x00, + // 579 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcf, 0x6f, 0x12, 0x41, + 0x14, 0xc7, 0x59, 0x28, 0xc8, 0xbe, 0x15, 0xda, 0x4e, 0xb1, 0x92, 0x55, 0x37, 0x74, 0x4e, 0xc4, + 0x1f, 0xa8, 0x98, 0x68, 0xf4, 0xa4, 0x48, 0x42, 0x38, 0x68, 0x9a, 0xc5, 0xe8, 0xc5, 0x84, 0x0c, + 0xdd, 0x91, 0x6e, 0xc2, 0xb2, 0xc8, 0x0c, 0x4d, 0xad, 0x67, 0xef, 0xfe, 0x59, 0x1e, 0x7b, 0xf4, + 0x68, 0xe0, 0x1f, 0x31, 0xb3, 0x33, 0xb3, 0xcb, 0xb6, 0xd9, 0x10, 0x92, 0x1e, 0xe7, 0xfd, 0xfc, + 0xec, 0x7b, 0xdf, 0x97, 0x05, 0xcb, 0x23, 0x4f, 0x3d, 0xd2, 0x9a, 0xcd, 0x43, 0x1e, 0xa2, 0xbc, + 0x47, 0xf0, 0x11, 0x98, 0x1f, 0x49, 0x40, 0xd9, 0x8c, 0x9c, 0x50, 0x54, 0x83, 0xe2, 0x19, 0x99, + 0x2c, 0x68, 0xdd, 0x68, 0x18, 0xcd, 0xdb, 0xae, 0x7c, 0xe0, 0xfb, 0xb0, 0xd3, 0x99, 0x84, 0xa3, + 0x0c, 0xaf, 0x0d, 0xf9, 0x7e, 0x37, 0xc3, 0x87, 0x01, 0xde, 0x87, 0x41, 0xe0, 0xf3, 0x80, 0x4e, + 0x79, 0x46, 0xcc, 0x03, 0x28, 0x1e, 0xcf, 0xc3, 0xf0, 0x5b, 0x86, 0xbb, 0x06, 0xe8, 0x03, 0x39, + 0x17, 0xfd, 0x07, 0xfe, 0x05, 0x75, 0xe9, 0xf7, 0x05, 0x65, 0x1c, 0xbf, 0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0xec, 0xd4, 0xff, 0x2c, 0x1d, 0xe3, 0x72, 0xe9, + 0x18, 0xff, 0x96, 0x8e, 0xf1, 0x7b, 0xe5, 0xe4, 0x2e, 0x57, 0x4e, 0xee, 0xef, 0xca, 0xc9, 0x8d, + 0x4a, 0xd1, 0x8f, 0xe2, 0xc5, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x8b, 0xd4, 0x65, 0x37, + 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -927,6 +1021,8 @@ type DAServiceClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // GetIDs returns IDs of all Blobs located in DA at given height. GetIDs(ctx context.Context, in *GetIDsRequest, opts ...grpc.CallOption) (*GetIDsResponse, error) + // GetProofs returns inclusion Proofs for all Blobs located in DA at given height. + GetProofs(ctx context.Context, in *GetProofsRequest, opts ...grpc.CallOption) (*GetProofsResponse, error) // Commit creates a Commitment for each given Blob. Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitResponse, error) // Submit submits the given Blobs to Data Availability layer. @@ -970,6 +1066,15 @@ func (c *dAServiceClient) GetIDs(ctx context.Context, in *GetIDsRequest, opts .. return out, nil } +func (c *dAServiceClient) GetProofs(ctx context.Context, in *GetProofsRequest, opts ...grpc.CallOption) (*GetProofsResponse, error) { + out := new(GetProofsResponse) + err := c.cc.Invoke(ctx, "/da.DAService/GetProofs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *dAServiceClient) Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitResponse, error) { out := new(CommitResponse) err := c.cc.Invoke(ctx, "/da.DAService/Commit", in, out, opts...) @@ -1005,6 +1110,8 @@ type DAServiceServer interface { Get(context.Context, *GetRequest) (*GetResponse, error) // GetIDs returns IDs of all Blobs located in DA at given height. GetIDs(context.Context, *GetIDsRequest) (*GetIDsResponse, error) + // GetProofs returns inclusion Proofs for all Blobs located in DA at given height. + GetProofs(context.Context, *GetProofsRequest) (*GetProofsResponse, error) // Commit creates a Commitment for each given Blob. Commit(context.Context, *CommitRequest) (*CommitResponse, error) // Submit submits the given Blobs to Data Availability layer. @@ -1026,6 +1133,9 @@ func (*UnimplementedDAServiceServer) Get(ctx context.Context, req *GetRequest) ( func (*UnimplementedDAServiceServer) GetIDs(ctx context.Context, req *GetIDsRequest) (*GetIDsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetIDs not implemented") } +func (*UnimplementedDAServiceServer) GetProofs(ctx context.Context, req *GetProofsRequest) (*GetProofsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProofs not implemented") +} func (*UnimplementedDAServiceServer) Commit(ctx context.Context, req *CommitRequest) (*CommitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Commit not implemented") } @@ -1094,6 +1204,24 @@ func _DAService_GetIDs_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _DAService_GetProofs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProofsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DAServiceServer).GetProofs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/da.DAService/GetProofs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DAServiceServer).GetProofs(ctx, req.(*GetProofsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _DAService_Commit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CommitRequest) if err := dec(in); err != nil { @@ -1164,6 +1292,10 @@ var _DAService_serviceDesc = grpc.ServiceDesc{ MethodName: "GetIDs", Handler: _DAService_GetIDs_Handler, }, + { + MethodName: "GetProofs", + Handler: _DAService_GetProofs_Handler, + }, { MethodName: "Commit", Handler: _DAService_Commit_Handler, @@ -1545,6 +1677,83 @@ func (m *GetIDsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GetProofsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetProofsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetProofsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Namespace != nil { + { + size, err := m.Namespace.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintDa(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetProofsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetProofsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetProofsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proofs) > 0 { + for iNdEx := len(m.Proofs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Proofs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *CommitRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1706,20 +1915,6 @@ func (m *SubmitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Proofs) > 0 { - for iNdEx := len(m.Proofs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Proofs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintDa(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } if len(m.Ids) > 0 { for iNdEx := len(m.Ids) - 1; iNdEx >= 0; iNdEx-- { { @@ -1998,6 +2193,37 @@ func (m *GetIDsResponse) Size() (n int) { return n } +func (m *GetProofsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovDa(uint64(m.Height)) + } + if m.Namespace != nil { + l = m.Namespace.Size() + n += 1 + l + sovDa(uint64(l)) + } + return n +} + +func (m *GetProofsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Proofs) > 0 { + for _, e := range m.Proofs { + l = e.Size() + n += 1 + l + sovDa(uint64(l)) + } + } + return n +} + func (m *CommitRequest) Size() (n int) { if m == nil { return 0 @@ -2066,12 +2292,6 @@ func (m *SubmitResponse) Size() (n int) { n += 1 + l + sovDa(uint64(l)) } } - if len(m.Proofs) > 0 { - for _, e := range m.Proofs { - l = e.Size() - n += 1 + l + sovDa(uint64(l)) - } - } return n } @@ -3050,6 +3270,195 @@ func (m *GetIDsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *GetProofsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetProofsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetProofsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Namespace == nil { + m.Namespace = &Namespace{} + } + if err := m.Namespace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetProofsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetProofsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetProofsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proofs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proofs = append(m.Proofs, &Proof{}) + if err := m.Proofs[len(m.Proofs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *CommitRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3448,40 +3857,6 @@ func (m *SubmitResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proofs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDa - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDa - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDa - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proofs = append(m.Proofs, &Proof{}) - if err := m.Proofs[len(m.Proofs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDa(dAtA[iNdEx:]) From 760dfcf70b4f23749ba9c0c7b0a1a8bd5408e64b Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 31 Jan 2024 22:55:17 +0100 Subject: [PATCH 2/3] nit --- test/dummy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dummy.go b/test/dummy.go index 02e672e..9382626 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -112,7 +112,7 @@ func (d *DummyDA) Commit(ctx context.Context, blobs []da.Blob, _ da.Namespace) ( } // Submit stores blobs in DA layer. -func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace) ([]da.ID, error) { +func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, _ da.Namespace) ([]da.ID, error) { d.mu.Lock() defer d.mu.Unlock() ids := make([]da.ID, len(blobs)) From 45451c364b68af8321f17f4f608ecde8feaa0f23 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 1 Feb 2024 00:44:12 +0100 Subject: [PATCH 3/3] making GetProofs take da.ID slice instead of height --- README.md | 3 +- da.go | 2 +- proto/da/da.proto | 2 +- proxy/client.go | 7 ++- proxy/server.go | 3 +- test/dummy.go | 14 +++-- test/test_suite.go | 31 ++-------- types/pb/da/da.pb.go | 131 ++++++++++++++++++++++++++----------------- 8 files changed, 102 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index dc65979..0cfcd07 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,10 @@ go-da defines a generic Data Availability interface for modular blockchains. | `MaxBlobSize` | | `uint64` | | `Get` | `ids []ID, namespace Namespace` | `[]Blobs` | | `GetIDs` | `height uint64, namespace Namespace` | `[]ID` | -| `GetProofs` | `height uint64, namespace Namespace` | `[]Proof` | +| `GetProofs` | `ids []id, namespace Namespace` | `[]Proof` | | `Commit` | `blobs []Blob, namespace Namespace` | `[]Commitment` | | `Validate` | `ids []Blob, proofs []Proof, namespace Namespace` | `[]bool` | | `Submit` | `blobs []Blob, gasPrice float64, namespace Namespace` | `[]ID` | ->>>>>>> 7e98847 (feat!: adding Namespace to remaining endpoints (#35)) NOTE: The `Namespace` parameter in the interface methods is optional and used only on DA layers that support the functionality, for example Celestia diff --git a/da.go b/da.go index 41eece9..1a82048 100644 --- a/da.go +++ b/da.go @@ -17,7 +17,7 @@ type DA interface { GetIDs(ctx context.Context, height uint64, namespace Namespace) ([]ID, error) // GetProofs returns inclusion Proofs for all Blobs located in DA at given height. - GetProofs(ctx context.Context, height uint64, namespace Namespace) ([]Proof, error) + GetProofs(ctx context.Context, ids []ID, namespace Namespace) ([]Proof, error) // Commit creates a Commitment for each given Blob. Commit(ctx context.Context, blobs []Blob, namespace Namespace) ([]Commitment, error) diff --git a/proto/da/da.proto b/proto/da/da.proto index 1ba27cf..e28f83f 100644 --- a/proto/da/da.proto +++ b/proto/da/da.proto @@ -83,7 +83,7 @@ message GetIDsResponse { // GetProofsRequest is the request type for the GetProofs rpc method. message GetProofsRequest { - uint64 height = 1; + repeated ID ids = 1; Namespace namespace = 2; } diff --git a/proxy/client.go b/proxy/client.go index 79f117d..1f9e967 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -76,8 +76,11 @@ func (c *Client) GetIDs(ctx context.Context, height uint64, namespace da.Namespa } // GetProofs returns inclusion Proofs for all Blobs located in DA at given height. -func (c *Client) GetProofs(ctx context.Context, height uint64, namespace da.Namespace) ([]da.Proof, error) { - req := &pbda.GetProofsRequest{Height: height, Namespace: &pbda.Namespace{Value: namespace}} +func (c *Client) GetProofs(ctx context.Context, ids []da.ID, namespace da.Namespace) ([]da.Proof, error) { + req := &pbda.GetProofsRequest{Ids: make([]*pbda.ID, len(ids)), Namespace: &pbda.Namespace{Value: namespace}} + for i := range ids { + req.Ids[i] = &pbda.ID{Value: ids[i]} + } resp, err := c.client.GetProofs(ctx, req) if err != nil { return nil, err diff --git a/proxy/server.go b/proxy/server.go index a48661a..048bf40 100644 --- a/proxy/server.go +++ b/proxy/server.go @@ -57,7 +57,8 @@ func (p *proxySrv) Commit(ctx context.Context, request *pbda.CommitRequest) (*pb } func (p *proxySrv) GetProofs(ctx context.Context, request *pbda.GetProofsRequest) (*pbda.GetProofsResponse, error) { - proofs, err := p.target.GetProofs(ctx, request.Height, request.Namespace.GetValue()) + ids := idsPB2DA(request.Ids) + proofs, err := p.target.GetProofs(ctx, ids, request.Namespace.GetValue()) if err != nil { return nil, err } diff --git a/test/dummy.go b/test/dummy.go index 9382626..1cf8548 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -91,13 +91,17 @@ func (d *DummyDA) GetIDs(ctx context.Context, height uint64, _ da.Namespace) ([] } // GetProofs returns inclusion Proofs for all Blobs located in DA at given height. -func (d *DummyDA) GetProofs(ctx context.Context, height uint64, _ da.Namespace) ([]da.ID, error) { +func (d *DummyDA) GetProofs(ctx context.Context, ids []da.ID, _ da.Namespace) ([]da.Proof, error) { + blobs, err := d.Get(ctx, ids, nil) + d.mu.Lock() defer d.mu.Unlock() - kvps := d.data[height] - proofs := make([]da.Proof, len(kvps)) - for i, kv := range kvps { - proofs[i] = d.getProof(kv.key, kv.value) + if err != nil { + return nil, err + } + proofs := make([]da.Proof, len(blobs)) + for i, blob := range blobs { + proofs[i] = d.getProof(ids[i], blob) } return proofs, nil } diff --git a/test/test_suite.go b/test/test_suite.go index 568a066..22853ec 100644 --- a/test/test_suite.go +++ b/test/test_suite.go @@ -63,39 +63,16 @@ func BasicDATest(t *testing.T, d da.DA) { assert.NoError(t, err) assert.NotEmpty(t, commitment2) - proof1, err := d.GetProofs(ctx, 1, testNamespace) + ids := [][]byte{id1[0], id2[0], id3[0]} + proofs, err := d.GetProofs(ctx, ids, testNamespace) assert.NoError(t, err) - assert.NotEmpty(t, proof1) - oks, err := d.Validate(ctx, id1, proof1, testNamespace) + assert.NotEmpty(t, proofs) + oks, err := d.Validate(ctx, ids, proofs, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, oks) for _, ok := range oks { assert.True(t, ok) } - - proof2, err := d.GetProofs(ctx, 2, testNamespace) - assert.NoError(t, err) - assert.NotEmpty(t, proof2) - oks, err = d.Validate(ctx, id2, proof2, testNamespace) - assert.NoError(t, err) - assert.NotEmpty(t, oks) - for _, ok := range oks { - assert.True(t, ok) - } - - oks, err = d.Validate(ctx, id1, proof2, testNamespace) - assert.NoError(t, err) - assert.NotEmpty(t, oks) - for _, ok := range oks { - assert.False(t, ok) - } - - oks, err = d.Validate(ctx, id2, proof1, testNamespace) - assert.NoError(t, err) - assert.NotEmpty(t, oks) - for _, ok := range oks { - assert.False(t, ok) - } } // CheckErrors ensures that errors are handled properly by DA. diff --git a/types/pb/da/da.pb.go b/types/pb/da/da.pb.go index 13646f2..4e29ab5 100644 --- a/types/pb/da/da.pb.go +++ b/types/pb/da/da.pb.go @@ -532,7 +532,7 @@ func (m *GetIDsResponse) GetIds() []*ID { // GetProofsRequest is the request type for the GetProofs rpc method. type GetProofsRequest struct { - Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Ids []*ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` Namespace *Namespace `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` } @@ -569,11 +569,11 @@ func (m *GetProofsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetProofsRequest proto.InternalMessageInfo -func (m *GetProofsRequest) GetHeight() uint64 { +func (m *GetProofsRequest) GetIds() []*ID { if m != nil { - return m.Height + return m.Ids } - return 0 + return nil } func (m *GetProofsRequest) GetNamespace() *Namespace { @@ -963,44 +963,44 @@ func init() { func init() { proto.RegisterFile("da/da.proto", fileDescriptor_feb508392bc12c0f) } var fileDescriptor_feb508392bc12c0f = []byte{ - // 579 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcf, 0x6f, 0x12, 0x41, - 0x14, 0xc7, 0x59, 0x28, 0xc8, 0xbe, 0x15, 0xda, 0x4e, 0xb1, 0x92, 0x55, 0x37, 0x74, 0x4e, 0xc4, - 0x1f, 0xa8, 0x98, 0x68, 0xf4, 0xa4, 0x48, 0x42, 0x38, 0x68, 0x9a, 0xc5, 0xe8, 0xc5, 0x84, 0x0c, - 0xdd, 0x91, 0x6e, 0xc2, 0xb2, 0xc8, 0x0c, 0x4d, 0xad, 0x67, 0xef, 0xfe, 0x59, 0x1e, 0x7b, 0xf4, - 0x68, 0xe0, 0x1f, 0x31, 0xb3, 0x33, 0xb3, 0xcb, 0xb6, 0xd9, 0x10, 0x92, 0x1e, 0xe7, 0xfd, 0xfc, - 0xec, 0x7b, 0xdf, 0x97, 0x05, 0xcb, 0x23, 0x4f, 0x3d, 0xd2, 0x9a, 0xcd, 0x43, 0x1e, 0xa2, 0xbc, - 0x47, 0xf0, 0x11, 0x98, 0x1f, 0x49, 0x40, 0xd9, 0x8c, 0x9c, 0x50, 0x54, 0x83, 0xe2, 0x19, 0x99, - 0x2c, 0x68, 0xdd, 0x68, 0x18, 0xcd, 0xdb, 0xae, 0x7c, 0xe0, 0xfb, 0xb0, 0xd3, 0x99, 0x84, 0xa3, - 0x0c, 0xaf, 0x0d, 0xf9, 0x7e, 0x37, 0xc3, 0x87, 0x01, 0xde, 0x87, 0x41, 0xe0, 0xf3, 0x80, 0x4e, - 0x79, 0x46, 0xcc, 0x03, 0x28, 0x1e, 0xcf, 0xc3, 0xf0, 0x5b, 0x86, 0xbb, 0x06, 0xe8, 0x03, 0x39, - 0x17, 0xfd, 0x07, 0xfe, 0x05, 0x75, 0xe9, 0xf7, 0x05, 0x65, 0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0xa3, 0x4e, 0xec, 0xd4, 0xff, 0x2c, 0x1d, 0xe3, 0x72, 0xe9, - 0x18, 0xff, 0x96, 0x8e, 0xf1, 0x7b, 0xe5, 0xe4, 0x2e, 0x57, 0x4e, 0xee, 0xef, 0xca, 0xc9, 0x8d, - 0x4a, 0xd1, 0x8f, 0xe2, 0xc5, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x8b, 0xd4, 0x65, 0x37, - 0x06, 0x00, 0x00, + // 581 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x6f, 0x12, 0x41, + 0x14, 0x66, 0xa1, 0x20, 0xfb, 0x56, 0x68, 0x3b, 0xc5, 0x4a, 0x56, 0xdd, 0xd0, 0x39, 0x11, 0x7f, + 0xa0, 0x62, 0xa2, 0xd1, 0x93, 0x22, 0x09, 0xe1, 0xa0, 0x69, 0x16, 0x63, 0x62, 0x62, 0x42, 0x86, + 0xee, 0x48, 0x37, 0x61, 0x59, 0x64, 0x86, 0xa6, 0xd6, 0xb3, 0x77, 0xff, 0x2c, 0x8f, 0x3d, 0x7a, + 0x34, 0xf0, 0x8f, 0x98, 0xd9, 0x99, 0xd9, 0x65, 0xdb, 0x6c, 0x08, 0x49, 0x8f, 0xf3, 0x7e, 0x7c, + 0xdf, 0xb7, 0xef, 0x7d, 0x2f, 0x0b, 0x96, 0x47, 0x9e, 0x7a, 0xa4, 0x35, 0x9b, 0x87, 0x3c, 0x44, + 0x79, 0x8f, 0xe0, 0x23, 0x30, 0x3f, 0x92, 0x80, 0xb2, 0x19, 0x39, 0xa1, 0xa8, 0x06, 0xc5, 0x33, + 0x32, 0x59, 0xd0, 0xba, 0xd1, 0x30, 0x9a, 0xb7, 0x5d, 0xf9, 0xc0, 0xf7, 0x61, 0xa7, 0x33, 0x09, + 0x47, 0x19, 0x59, 0x1b, 0xf2, 0xfd, 0x6e, 0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a, 0xe9, 0x2a, 0x49, 0x97, 0x32, 0xba, 0xa4, 0x4b, 0xbb, 0x53, 0xb6, 0xc8, + 0x95, 0xcb, 0x96, 0x94, 0xf3, 0x64, 0x4b, 0xda, 0x11, 0x38, 0x87, 0x5e, 0x41, 0x59, 0x0f, 0x1f, + 0x1d, 0x88, 0x8a, 0x2b, 0x3e, 0xb0, 0x6b, 0xe9, 0xa0, 0x6e, 0xec, 0xd4, 0xff, 0x2c, 0x1d, 0xe3, + 0x72, 0xe9, 0x18, 0xff, 0x96, 0x8e, 0xf1, 0x7b, 0xe5, 0xe4, 0x2e, 0x57, 0x4e, 0xee, 0xef, 0xca, + 0xc9, 0x8d, 0x4a, 0xd1, 0xaf, 0xe2, 0xc5, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x76, 0xfd, + 0x5b, 0x39, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1709,10 +1709,19 @@ func (m *GetProofsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if m.Height != 0 { - i = encodeVarintDa(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 + if len(m.Ids) > 0 { + for iNdEx := len(m.Ids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -2199,8 +2208,11 @@ func (m *GetProofsRequest) Size() (n int) { } var l int _ = l - if m.Height != 0 { - n += 1 + sovDa(uint64(m.Height)) + if len(m.Ids) > 0 { + for _, e := range m.Ids { + l = e.Size() + n += 1 + l + sovDa(uint64(l)) + } } if m.Namespace != nil { l = m.Namespace.Size() @@ -3300,10 +3312,10 @@ func (m *GetProofsRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) } - m.Height = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDa @@ -3313,11 +3325,26 @@ func (m *GetProofsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ids = append(m.Ids, &ID{}) + if err := m.Ids[len(m.Ids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType)