diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 6369b8d..67c73d3 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,6 +1,7 @@ default: true MD010: code_blocks: false -MD013: false +MD013: + tables: false MD024: allow_different_nesting: true diff --git a/README.md b/README.md index 909a4ea..907d302 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,18 @@ go-da defines a generic Data Availability interface for modular blockchains. ## DA Interface -| Method | Params | Return | -| ----------- |-------------------------------| -------------| -| `MaxBlobSize` | | `uint64` | -| `Get` | `ids []ID` | `[]Blobs` | -| `GetIDs` | `height uint64` | `[]ID` | -| `Commit` | `blobs []Blob` | `[]Commitment` | -| `Validate` | `ids []Blob, proofs []Proof` | `[]bool` | +| Method | Params | Return | +| ------------- | -------------------------------------------------------- | --------------- | +| `MaxBlobSize` | | `uint64` | +| `Get` | `ids []ID, namespace Namespace` | `[]Blobs` | +| `GetIDs` | `height uint64, namespace Namespace` | `[]ID` | +| `Commit` | `blobs []Blob, namespace Namespace` | `[]Commitment` | +| `Validate` | `ids []Blob, proofs []Proof, namespace Namespace` | `[]bool` | +| `Submit` | `blobs []Blob, gasPrice float64, namespace Namespace` | `[]ID, []Proof` | + +NOTE: The `Namespace` parameter in the interface methods is optional and used +only on DA layers that support the functionality, for example Celestia +namespaces and Avail AppIDs. ## Implementations diff --git a/da.go b/da.go index 82226dc..08d6414 100644 --- a/da.go +++ b/da.go @@ -11,29 +11,23 @@ type DA interface { // // Error should be returned if ID is not formatted properly, there is no Blob for given ID or any other client-level // error occurred (dropped connection, timeout, etc). - Get(ctx context.Context, ids []ID) ([]Blob, error) + Get(ctx context.Context, ids []ID, namespace Namespace) ([]Blob, error) // GetIDs returns IDs of all Blobs located in DA at given height. - GetIDs(ctx context.Context, height uint64) ([]ID, error) + GetIDs(ctx context.Context, height uint64, namespace Namespace) ([]ID, error) // Commit creates a Commitment for each given Blob. - Commit(ctx context.Context, blobs []Blob) ([]Commitment, error) + 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, opts *SubmitOptions) ([]ID, []Proof, error) + Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace) ([]ID, []Proof, error) // Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs. - Validate(ctx context.Context, ids []ID, proofs []Proof) ([]bool, error) -} - -// SubmitOptions are the parameters used for blob submission. -type SubmitOptions struct { - GasPrice float64 - Namespace Namespace + Validate(ctx context.Context, ids []ID, proofs []Proof, namespace Namespace) ([]bool, error) } // Namespace is an optional parameter used to set the location a blob should be diff --git a/proto/da/da.proto b/proto/da/da.proto index 3435bc1..f0391b7 100644 --- a/proto/da/da.proto +++ b/proto/da/da.proto @@ -59,6 +59,7 @@ message MaxBlobSizeResponse { // GetRequest is the request type for the Get rpc method. message GetRequest { repeated ID ids = 1; + Namespace namespace = 2; } // GetResponse is the response type for the Get rpc method. @@ -69,6 +70,7 @@ message GetResponse { // GetIDsRequest is the request type for the GetIDs rpc method. message GetIDsRequest { uint64 height = 1; + Namespace namespace = 2; } // GetIDsResponse is the response type for the GetIDs rpc method. @@ -79,6 +81,7 @@ message GetIDsResponse { // CommitRequest is the request type for the Commit rpc method. message CommitRequest { repeated Blob blobs = 1; + Namespace namespace = 2; } // CommitResponse is the response type for the Commit rpc method. @@ -103,6 +106,7 @@ message SubmitResponse { message ValidateRequest { repeated ID ids = 1; repeated Proof proofs = 2; + Namespace namespace = 3; } // ValidateResponse is the response type for the Validate rpc method. diff --git a/proxy/client.go b/proxy/client.go index 928a9a0..f637909 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -48,9 +48,10 @@ func (c *Client) MaxBlobSize(ctx context.Context) (uint64, error) { } // Get returns Blob for each given ID, or an error. -func (c *Client) Get(ctx context.Context, ids []da.ID) ([]da.Blob, error) { +func (c *Client) Get(ctx context.Context, ids []da.ID, namespace da.Namespace) ([]da.Blob, error) { req := &pbda.GetRequest{ - Ids: make([]*pbda.ID, len(ids)), + Ids: make([]*pbda.ID, len(ids)), + Namespace: &pbda.Namespace{Value: namespace}, } for i := range ids { req.Ids[i] = &pbda.ID{Value: ids[i]} @@ -64,8 +65,8 @@ func (c *Client) Get(ctx context.Context, ids []da.ID) ([]da.Blob, error) { } // GetIDs returns IDs of all Blobs located in DA at given height. -func (c *Client) GetIDs(ctx context.Context, height uint64) ([]da.ID, error) { - req := &pbda.GetIDsRequest{Height: height} +func (c *Client) GetIDs(ctx context.Context, height uint64, namespace da.Namespace) ([]da.ID, error) { + req := &pbda.GetIDsRequest{Height: height, Namespace: &pbda.Namespace{Value: namespace}} resp, err := c.client.GetIDs(ctx, req) if err != nil { return nil, err @@ -75,9 +76,10 @@ func (c *Client) GetIDs(ctx context.Context, height uint64) ([]da.ID, error) { } // Commit creates a Commitment for each given Blob. -func (c *Client) Commit(ctx context.Context, blobs []da.Blob) ([]da.Commitment, error) { +func (c *Client) Commit(ctx context.Context, blobs []da.Blob, namespace da.Namespace) ([]da.Commitment, error) { req := &pbda.CommitRequest{ - Blobs: blobsDA2PB(blobs), + Blobs: blobsDA2PB(blobs), + Namespace: &pbda.Namespace{Value: namespace}, } resp, err := c.client.Commit(ctx, req) @@ -89,11 +91,11 @@ func (c *Client) Commit(ctx context.Context, blobs []da.Blob) ([]da.Commitment, } // Submit submits the Blobs to Data Availability layer. -func (c *Client) Submit(ctx context.Context, blobs []da.Blob, opts *da.SubmitOptions) ([]da.ID, []da.Proof, error) { +func (c *Client) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace) ([]da.ID, []da.Proof, error) { req := &pbda.SubmitRequest{ Blobs: blobsDA2PB(blobs), - GasPrice: opts.GasPrice, - Namespace: &pbda.Namespace{Value: opts.Namespace}, + GasPrice: gasPrice, + Namespace: &pbda.Namespace{Value: namespace}, } resp, err := c.client.Submit(ctx, req) @@ -112,10 +114,11 @@ func (c *Client) Submit(ctx context.Context, blobs []da.Blob, opts *da.SubmitOpt } // Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs. -func (c *Client) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof) ([]bool, error) { +func (c *Client) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof, namespace da.Namespace) ([]bool, error) { req := &pbda.ValidateRequest{ - Ids: idsDA2PB(ids), - Proofs: proofsDA2PB(proofs), + Ids: idsDA2PB(ids), + Proofs: proofsDA2PB(proofs), + Namespace: &pbda.Namespace{Value: namespace}, } resp, err := c.client.Validate(ctx, req) return resp.Results, err diff --git a/proxy/server.go b/proxy/server.go index 640a720..9ebef14 100644 --- a/proxy/server.go +++ b/proxy/server.go @@ -24,19 +24,21 @@ type proxySrv struct { target da.DA } -func (p *proxySrv) MaxBlobSize(ctx context.Context, request *pbda.MaxBlobSizeRequest) (*pbda.MaxBlobSizeResponse, error) { +func (p *proxySrv) MaxBlobSize( + ctx context.Context, request *pbda.MaxBlobSizeRequest, +) (*pbda.MaxBlobSizeResponse, error) { maxBlobSize, err := p.target.MaxBlobSize(ctx) return &pbda.MaxBlobSizeResponse{MaxBlobSize: maxBlobSize}, err } func (p *proxySrv) Get(ctx context.Context, request *pbda.GetRequest) (*pbda.GetResponse, error) { ids := idsPB2DA(request.Ids) - blobs, err := p.target.Get(ctx, ids) + blobs, err := p.target.Get(ctx, ids, request.Namespace.GetValue()) return &pbda.GetResponse{Blobs: blobsDA2PB(blobs)}, err } func (p *proxySrv) GetIDs(ctx context.Context, request *pbda.GetIDsRequest) (*pbda.GetIDsResponse, error) { - ids, err := p.target.GetIDs(ctx, request.Height) + ids, err := p.target.GetIDs(ctx, request.Height, request.Namespace.GetValue()) if err != nil { return nil, err } @@ -46,7 +48,7 @@ func (p *proxySrv) GetIDs(ctx context.Context, request *pbda.GetIDsRequest) (*pb func (p *proxySrv) Commit(ctx context.Context, request *pbda.CommitRequest) (*pbda.CommitResponse, error) { blobs := blobsPB2DA(request.Blobs) - commits, err := p.target.Commit(ctx, blobs) + commits, err := p.target.Commit(ctx, blobs, request.Namespace.GetValue()) if err != nil { return nil, err } @@ -57,10 +59,7 @@ func (p *proxySrv) Commit(ctx context.Context, request *pbda.CommitRequest) (*pb 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, &da.SubmitOptions{ - GasPrice: request.GasPrice, - Namespace: request.Namespace.GetValue(), - }) + ids, proofs, err := p.target.Submit(ctx, blobs, request.GasPrice, request.Namespace.GetValue()) if err != nil { return nil, err } @@ -82,7 +81,7 @@ func (p *proxySrv) Validate(ctx context.Context, request *pbda.ValidateRequest) ids := idsPB2DA(request.Ids) proofs := proofsPB2DA(request.Proofs) //TODO implement me - validity, err := p.target.Validate(ctx, ids, proofs) + validity, err := p.target.Validate(ctx, ids, proofs, request.Namespace.GetValue()) if err != nil { return nil, err } diff --git a/test/dummy.go b/test/dummy.go index 8550015..7636dfb 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -55,7 +55,7 @@ func (d *DummyDA) MaxBlobSize(ctx context.Context) (uint64, error) { } // Get returns Blobs for given IDs. -func (d *DummyDA) Get(ctx context.Context, ids []da.ID) ([]da.Blob, error) { +func (d *DummyDA) Get(ctx context.Context, ids []da.ID, _ da.Namespace) ([]da.Blob, error) { d.mu.Lock() defer d.mu.Unlock() blobs := make([]da.Blob, len(ids)) @@ -79,7 +79,7 @@ func (d *DummyDA) Get(ctx context.Context, ids []da.ID) ([]da.Blob, error) { } // GetIDs returns IDs of Blobs at given DA height. -func (d *DummyDA) GetIDs(ctx context.Context, height uint64) ([]da.ID, error) { +func (d *DummyDA) GetIDs(ctx context.Context, height uint64, _ da.Namespace) ([]da.ID, error) { d.mu.Lock() defer d.mu.Unlock() kvps := d.data[height] @@ -91,7 +91,7 @@ func (d *DummyDA) GetIDs(ctx context.Context, height uint64) ([]da.ID, error) { } // Commit returns cryptographic Commitments for given blobs. -func (d *DummyDA) Commit(ctx context.Context, blobs []da.Blob) ([]da.Commitment, error) { +func (d *DummyDA) Commit(ctx context.Context, blobs []da.Blob, _ da.Namespace) ([]da.Commitment, error) { commits := make([]da.Commitment, len(blobs)) for i, blob := range blobs { commits[i] = d.getHash(blob) @@ -100,7 +100,7 @@ func (d *DummyDA) Commit(ctx context.Context, blobs []da.Blob) ([]da.Commitment, } // Submit stores blobs in DA layer. -func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, opts *da.SubmitOptions) ([]da.ID, []da.Proof, error) { +func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace) ([]da.ID, []da.Proof, error) { d.mu.Lock() defer d.mu.Unlock() ids := make([]da.ID, len(blobs)) @@ -117,7 +117,7 @@ func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, opts *da.SubmitOp } // Validate checks the Proofs for given IDs. -func (d *DummyDA) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof) ([]bool, error) { +func (d *DummyDA) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof, _ da.Namespace) ([]bool, error) { if len(ids) != len(proofs) { return nil, errors.New("number of IDs doesn't equal to number of proofs") } diff --git a/test/test_suite.go b/test/test_suite.go index 7492675..e17bf1f 100644 --- a/test/test_suite.go +++ b/test/test_suite.go @@ -12,6 +12,8 @@ import ( "github.com/rollkit/go-da" ) +var testNamespace = da.Namespace([]byte("test")) + // RunDATestSuite runs all tests against given DA func RunDATestSuite(t *testing.T, d da.DA) { t.Run("Basic DA test", func(t *testing.T) { @@ -34,26 +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}, &da.SubmitOptions{ - GasPrice: 0, - Namespace: []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, - }) + id1, proof1, 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}, &da.SubmitOptions{ - GasPrice: 0, - Namespace: []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, - }) + id2, proof2, 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}, &da.SubmitOptions{ - GasPrice: 0, - Namespace: []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, - }) + id3, proof3, err := d.Submit(ctx, []da.Blob{msg1}, 0, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, id3) assert.NotEmpty(t, proof3) @@ -61,40 +54,40 @@ func BasicDATest(t *testing.T, d da.DA) { assert.NotEqual(t, id1, id2) assert.NotEqual(t, id1, id3) - ret, err := d.Get(ctx, id1) + ret, err := d.Get(ctx, id1, testNamespace) assert.NoError(t, err) assert.Equal(t, []da.Blob{msg1}, ret) - commitment1, err := d.Commit(ctx, []da.Blob{msg1}) + commitment1, err := d.Commit(ctx, []da.Blob{msg1}, []byte{}) assert.NoError(t, err) assert.NotEmpty(t, commitment1) - commitment2, err := d.Commit(ctx, []da.Blob{msg2}) + commitment2, err := d.Commit(ctx, []da.Blob{msg2}, []byte{}) assert.NoError(t, err) assert.NotEmpty(t, commitment2) - oks, err := d.Validate(ctx, id1, proof1) + oks, err := d.Validate(ctx, id1, proof1, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, oks) for _, ok := range oks { assert.True(t, ok) } - oks, err = d.Validate(ctx, id2, 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) + 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) + oks, err = d.Validate(ctx, id2, proof1, testNamespace) assert.NoError(t, err) assert.NotEmpty(t, oks) for _, ok := range oks { @@ -105,7 +98,7 @@ func BasicDATest(t *testing.T, d da.DA) { // CheckErrors ensures that errors are handled properly by DA. func CheckErrors(t *testing.T, d da.DA) { ctx := context.TODO() - blob, err := d.Get(ctx, []da.ID{[]byte("invalid")}) + blob, err := d.Get(ctx, []da.ID{[]byte("invalid")}, testNamespace) assert.Error(t, err) assert.Empty(t, blob) } @@ -115,10 +108,7 @@ 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, &da.SubmitOptions{ - GasPrice: 0, - Namespace: []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, - }) + ids, proofs, err := d.Submit(ctx, msgs, 0, []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}) assert.NoError(t, err) assert.Len(t, ids, len(msgs)) assert.Len(t, proofs, len(msgs)) @@ -130,12 +120,12 @@ func GetIDsTest(t *testing.T, d da.DA) { // As we're the only user, we don't need to handle external data (that could be submitted in real world). // There is no notion of height, so we need to scan the DA to get test data back. for i := uint64(1); !found && !time.Now().After(end); i++ { - ret, err := d.GetIDs(ctx, i) + ret, err := d.GetIDs(ctx, i, []byte{}) if err != nil { t.Error("failed to get IDs:", err) } if len(ret) > 0 { - blobs, err := d.Get(ctx, ret) + blobs, err := d.Get(ctx, ret, testNamespace) assert.NoError(t, err) // Submit ensures atomicity of batch, so it makes sense to compare actual blobs (bodies) only when lengths @@ -164,7 +154,7 @@ func ConcurrentReadWriteTest(t *testing.T, d da.DA) { go func() { defer wg.Done() for i := uint64(1); i <= 100; i++ { - _, err := d.GetIDs(ctx, i) + _, err := d.GetIDs(ctx, i, []byte{}) assert.NoError(t, err) } }() @@ -172,10 +162,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")}, &da.SubmitOptions{ - GasPrice: 0, - Namespace: []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, - }) + _, _, err := d.Submit(ctx, [][]byte{[]byte("test")}, 0, []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}) assert.NoError(t, err) } }() diff --git a/types/pb/da/da.pb.go b/types/pb/da/da.pb.go index ca0f16d..d58572f 100644 --- a/types/pb/da/da.pb.go +++ b/types/pb/da/da.pb.go @@ -336,7 +336,8 @@ func (m *MaxBlobSizeResponse) GetMaxBlobSize() uint64 { // GetRequest is the request type for the Get rpc method. type GetRequest struct { - Ids []*ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,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"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -379,6 +380,13 @@ func (m *GetRequest) GetIds() []*ID { return nil } +func (m *GetRequest) GetNamespace() *Namespace { + if m != nil { + return m.Namespace + } + return nil +} + // GetResponse is the response type for the Get rpc method. type GetResponse struct { Blobs []*Blob `protobuf:"bytes,1,rep,name=blobs,proto3" json:"blobs,omitempty"` @@ -426,7 +434,8 @@ func (m *GetResponse) GetBlobs() []*Blob { // GetIDsRequest is the request type for the GetIDs rpc method. type GetIDsRequest struct { - Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + 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 *GetIDsRequest) Reset() { *m = GetIDsRequest{} } @@ -469,6 +478,13 @@ func (m *GetIDsRequest) GetHeight() uint64 { return 0 } +func (m *GetIDsRequest) GetNamespace() *Namespace { + if m != nil { + return m.Namespace + } + return nil +} + // GetIDsResponse is the response type for the GetIDs rpc method. type GetIDsResponse struct { Ids []*ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` @@ -516,7 +532,8 @@ func (m *GetIDsResponse) GetIds() []*ID { // 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"` + Blobs []*Blob `protobuf:"bytes,1,rep,name=blobs,proto3" json:"blobs,omitempty"` + Namespace *Namespace `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` } func (m *CommitRequest) Reset() { *m = CommitRequest{} } @@ -559,6 +576,13 @@ func (m *CommitRequest) GetBlobs() []*Blob { return nil } +func (m *CommitRequest) GetNamespace() *Namespace { + if m != nil { + return m.Namespace + } + return nil +} + // CommitResponse is the response type for the Commit rpc method. type CommitResponse struct { Commitments []*Commitment `protobuf:"bytes,1,rep,name=commitments,proto3" json:"commitments,omitempty"` @@ -720,8 +744,9 @@ func (m *SubmitResponse) GetProofs() []*Proof { // 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"` - Proofs []*Proof `protobuf:"bytes,2,rep,name=proofs,proto3" json:"proofs,omitempty"` + Ids []*ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + Proofs []*Proof `protobuf:"bytes,2,rep,name=proofs,proto3" json:"proofs,omitempty"` + Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` } func (m *ValidateRequest) Reset() { *m = ValidateRequest{} } @@ -771,6 +796,13 @@ func (m *ValidateRequest) GetProofs() []*Proof { return nil } +func (m *ValidateRequest) GetNamespace() *Namespace { + if m != nil { + return m.Namespace + } + return nil +} + // ValidateResponse is the response type for the Validate rpc method. type ValidateResponse struct { Results []bool `protobuf:"varint,1,rep,packed,name=results,proto3" json:"results,omitempty"` @@ -839,41 +871,42 @@ func init() { func init() { proto.RegisterFile("da/da.proto", fileDescriptor_feb508392bc12c0f) } var fileDescriptor_feb508392bc12c0f = []byte{ - // 535 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0x8e, 0x93, 0x26, 0x6f, 0x32, 0x7e, 0x93, 0xc2, 0x36, 0x2a, 0x56, 0x00, 0x2b, 0xdd, 0x03, - 0x58, 0x7c, 0xa4, 0x10, 0x0e, 0x88, 0x1b, 0x84, 0x48, 0x51, 0x0e, 0xad, 0xaa, 0x8d, 0xc4, 0x35, - 0x5a, 0xc7, 0x4b, 0x6a, 0xc9, 0x8e, 0x8d, 0xd7, 0xa9, 0x4a, 0x7f, 0x05, 0x3f, 0x0b, 0x6e, 0x3d, - 0x72, 0x44, 0xc9, 0x1f, 0x41, 0xeb, 0xf5, 0xda, 0x31, 0x95, 0x95, 0x1e, 0x67, 0x9e, 0x8f, 0x1d, - 0xcd, 0x3c, 0x5a, 0xd0, 0x1d, 0x7a, 0xea, 0xd0, 0x41, 0x18, 0x05, 0x71, 0x80, 0xaa, 0x0e, 0xc5, - 0x27, 0xd0, 0x3a, 0xa7, 0x3e, 0xe3, 0x21, 0x5d, 0x30, 0xd4, 0x85, 0xfa, 0x15, 0xf5, 0xd6, 0xcc, - 0xd0, 0xfa, 0x9a, 0xf5, 0x3f, 0x91, 0x05, 0x7e, 0x02, 0x07, 0x23, 0x2f, 0xb0, 0x4b, 0xd0, 0x1e, - 0x54, 0xa7, 0xe3, 0x12, 0x0c, 0x03, 0x7c, 0x0e, 0x7c, 0xdf, 0x8d, 0x7d, 0xb6, 0x8a, 0x4b, 0x38, - 0x4f, 0xa1, 0x7e, 0x11, 0x05, 0xc1, 0xd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x15, 0xbb, 0x91, 0x7c, 0x65, 0xef, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0xdf, - 0x7a, 0x6f, 0x94, 0xd9, 0x04, 0x00, 0x00, + // 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,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, 0xfe, 0x6c, 0xed, 0xd2, + 0xbc, 0x16, 0xff, 0x7e, 0x5f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x58, 0xff, 0xeb, 0x8d, + 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1369,6 +1402,18 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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 len(m.Ids) > 0 { for iNdEx := len(m.Ids) - 1; iNdEx >= 0; iNdEx-- { { @@ -1443,6 +1488,18 @@ func (m *GetIDsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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-- @@ -1508,6 +1565,18 @@ func (m *CommitRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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 len(m.Blobs) > 0 { for iNdEx := len(m.Blobs) - 1; iNdEx >= 0; iNdEx-- { { @@ -1688,6 +1757,18 @@ func (m *ValidateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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] = 0x1a + } if len(m.Proofs) > 0 { for iNdEx := len(m.Proofs) - 1; iNdEx >= 0; iNdEx-- { { @@ -1864,6 +1945,10 @@ func (m *GetRequest) Size() (n int) { n += 1 + l + sovDa(uint64(l)) } } + if m.Namespace != nil { + l = m.Namespace.Size() + n += 1 + l + sovDa(uint64(l)) + } return n } @@ -1891,6 +1976,10 @@ func (m *GetIDsRequest) Size() (n int) { 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 } @@ -1921,6 +2010,10 @@ func (m *CommitRequest) Size() (n int) { n += 1 + l + sovDa(uint64(l)) } } + if m.Namespace != nil { + l = m.Namespace.Size() + n += 1 + l + sovDa(uint64(l)) + } return n } @@ -2000,6 +2093,10 @@ func (m *ValidateRequest) Size() (n int) { n += 1 + l + sovDa(uint64(l)) } } + if m.Namespace != nil { + l = m.Namespace.Size() + n += 1 + l + sovDa(uint64(l)) + } return n } @@ -2623,6 +2720,42 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + 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:]) @@ -2776,6 +2909,42 @@ func (m *GetIDsRequest) Unmarshal(dAtA []byte) error { 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:]) @@ -2944,6 +3113,42 @@ func (m *CommitRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + 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:]) @@ -3395,6 +3600,42 @@ func (m *ValidateRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + 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:])