From d853a415f640624181662fe2c3c8fd50130dfe1b Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 23 Jan 2024 14:56:14 -0600 Subject: [PATCH] feat: adding SubmitOptions to Submit (#34) --- da.go | 12 +- proto/da/da.proto | 6 + proxy/client.go | 7 +- proxy/server.go | 5 +- test/dummy.go | 2 +- test/test_suite.go | 65 +++++---- types/pb/da/da.pb.go | 337 ++++++++++++++++++++++++++++++++++++------- 7 files changed, 348 insertions(+), 86 deletions(-) diff --git a/da.go b/da.go index bd2c874..82226dc 100644 --- a/da.go +++ b/da.go @@ -24,12 +24,22 @@ type DA interface { // 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) ([]ID, []Proof, error) + Submit(ctx context.Context, blobs []Blob, opts *SubmitOptions) ([]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 +} + +// Namespace is an optional parameter used to set the location a blob should be +// posted to, for DA layers supporting the functionality. +type Namespace = []byte + // Blob is the data submitted/received from DA interface. type Blob = []byte diff --git a/proto/da/da.proto b/proto/da/da.proto index 94c4551..3435bc1 100644 --- a/proto/da/da.proto +++ b/proto/da/da.proto @@ -22,6 +22,11 @@ service DAService { rpc Validate(ValidateRequest) returns (ValidateResponse) {} } +// Namespace is the location for the blob to be submitted to, if supported by the DA layer. +message Namespace { + bytes value = 1; +} + // Blob is the data submitted/received from DA interface. message Blob { bytes value = 1; @@ -85,6 +90,7 @@ message CommitResponse { message SubmitRequest { repeated Blob blobs = 1; double gas_price = 2; + Namespace namespace = 3; } // SubmitResponse is the response type for the Submit rpc method. diff --git a/proxy/client.go b/proxy/client.go index 3b332f6..928a9a0 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -89,10 +89,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, gasPrice float64) ([]da.ID, []da.Proof, error) { +func (c *Client) Submit(ctx context.Context, blobs []da.Blob, opts *da.SubmitOptions) ([]da.ID, []da.Proof, error) { req := &pbda.SubmitRequest{ - Blobs: blobsDA2PB(blobs), - GasPrice: gasPrice, + Blobs: blobsDA2PB(blobs), + GasPrice: opts.GasPrice, + Namespace: &pbda.Namespace{Value: opts.Namespace}, } resp, err := c.client.Submit(ctx, req) diff --git a/proxy/server.go b/proxy/server.go index 36fd425..640a720 100644 --- a/proxy/server.go +++ b/proxy/server.go @@ -57,7 +57,10 @@ 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, request.GasPrice) + ids, proofs, err := p.target.Submit(ctx, blobs, &da.SubmitOptions{ + GasPrice: request.GasPrice, + Namespace: request.Namespace.GetValue(), + }) if err != nil { return nil, err } diff --git a/test/dummy.go b/test/dummy.go index 170f0ea..8550015 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -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, gasPrice float64) ([]da.ID, []da.Proof, error) { +func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, opts *da.SubmitOptions) ([]da.ID, []da.Proof, error) { d.mu.Lock() defer d.mu.Unlock() ids := make([]da.ID, len(blobs)) diff --git a/test/test_suite.go b/test/test_suite.go index 75d48ee..7492675 100644 --- a/test/test_suite.go +++ b/test/test_suite.go @@ -28,31 +28,32 @@ func RunDATestSuite(t *testing.T, d da.DA) { }) } -// TODO(tzdybal): how to get rid of those aliases? - -// Blob is a type alias -type Blob = da.Blob - -// ID is a type alias -type ID = da.ID - // BasicDATest tests round trip of messages to DA and back. -func BasicDATest(t *testing.T, da da.DA) { +func BasicDATest(t *testing.T, d da.DA) { msg1 := []byte("message 1") msg2 := []byte("message 2") ctx := context.TODO() - id1, proof1, err := da.Submit(ctx, []Blob{msg1}, -1) + 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}, + }) assert.NoError(t, err) assert.NotEmpty(t, id1) assert.NotEmpty(t, proof1) - id2, proof2, err := da.Submit(ctx, []Blob{msg2}, -1) + 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}, + }) assert.NoError(t, err) assert.NotEmpty(t, id2) assert.NotEmpty(t, proof2) - id3, proof3, err := da.Submit(ctx, []Blob{msg1}, -1) + 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}, + }) assert.NoError(t, err) assert.NotEmpty(t, id3) assert.NotEmpty(t, proof3) @@ -60,40 +61,40 @@ func BasicDATest(t *testing.T, da da.DA) { assert.NotEqual(t, id1, id2) assert.NotEqual(t, id1, id3) - ret, err := da.Get(ctx, id1) + ret, err := d.Get(ctx, id1) assert.NoError(t, err) - assert.Equal(t, []Blob{msg1}, ret) + assert.Equal(t, []da.Blob{msg1}, ret) - commitment1, err := da.Commit(ctx, []Blob{msg1}) + commitment1, err := d.Commit(ctx, []da.Blob{msg1}) assert.NoError(t, err) assert.NotEmpty(t, commitment1) - commitment2, err := da.Commit(ctx, []Blob{msg2}) + commitment2, err := d.Commit(ctx, []da.Blob{msg2}) assert.NoError(t, err) assert.NotEmpty(t, commitment2) - oks, err := da.Validate(ctx, id1, proof1) + oks, err := d.Validate(ctx, id1, proof1) assert.NoError(t, err) assert.NotEmpty(t, oks) for _, ok := range oks { assert.True(t, ok) } - oks, err = da.Validate(ctx, id2, proof2) + oks, err = d.Validate(ctx, id2, proof2) assert.NoError(t, err) assert.NotEmpty(t, oks) for _, ok := range oks { assert.True(t, ok) } - oks, err = da.Validate(ctx, id1, proof2) + oks, err = d.Validate(ctx, id1, proof2) assert.NoError(t, err) assert.NotEmpty(t, oks) for _, ok := range oks { assert.False(t, ok) } - oks, err = da.Validate(ctx, id2, proof1) + oks, err = d.Validate(ctx, id2, proof1) assert.NoError(t, err) assert.NotEmpty(t, oks) for _, ok := range oks { @@ -102,19 +103,22 @@ func BasicDATest(t *testing.T, da da.DA) { } // CheckErrors ensures that errors are handled properly by DA. -func CheckErrors(t *testing.T, da da.DA) { +func CheckErrors(t *testing.T, d da.DA) { ctx := context.TODO() - blob, err := da.Get(ctx, []ID{[]byte("invalid")}) + blob, err := d.Get(ctx, []da.ID{[]byte("invalid")}) assert.Error(t, err) assert.Empty(t, blob) } // GetIDsTest tests iteration over DA -func GetIDsTest(t *testing.T, da da.DA) { +func GetIDsTest(t *testing.T, d da.DA) { msgs := [][]byte{[]byte("msg1"), []byte("msg2"), []byte("msg3")} ctx := context.TODO() - ids, proofs, err := da.Submit(ctx, msgs, -1) + ids, proofs, err := d.Submit(ctx, msgs, &da.SubmitOptions{ + GasPrice: 0, + Namespace: []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)) @@ -126,12 +130,12 @@ func GetIDsTest(t *testing.T, da 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 := da.GetIDs(ctx, i) + ret, err := d.GetIDs(ctx, i) if err != nil { t.Error("failed to get IDs:", err) } if len(ret) > 0 { - blobs, err := da.Get(ctx, ret) + blobs, err := d.Get(ctx, ret) assert.NoError(t, err) // Submit ensures atomicity of batch, so it makes sense to compare actual blobs (bodies) only when lengths @@ -151,7 +155,7 @@ func GetIDsTest(t *testing.T, da da.DA) { } // ConcurrentReadWriteTest tests the use of mutex lock in DummyDA by calling separate methods that use `d.data` and making sure there's no race conditions -func ConcurrentReadWriteTest(t *testing.T, da da.DA) { +func ConcurrentReadWriteTest(t *testing.T, d da.DA) { var wg sync.WaitGroup wg.Add(2) @@ -160,7 +164,7 @@ func ConcurrentReadWriteTest(t *testing.T, da da.DA) { go func() { defer wg.Done() for i := uint64(1); i <= 100; i++ { - _, err := da.GetIDs(ctx, i) + _, err := d.GetIDs(ctx, i) assert.NoError(t, err) } }() @@ -168,7 +172,10 @@ func ConcurrentReadWriteTest(t *testing.T, da da.DA) { go func() { defer wg.Done() for i := uint64(1); i <= 100; i++ { - _, _, err := da.Submit(ctx, [][]byte{[]byte("test")}, -1) + _, _, err := d.Submit(ctx, [][]byte{[]byte("test")}, &da.SubmitOptions{ + GasPrice: 0, + Namespace: []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 5da069a..ca0f16d 100644 --- a/types/pb/da/da.pb.go +++ b/types/pb/da/da.pb.go @@ -27,6 +27,51 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Namespace is the location for the blob to be submitted to, if supported by the DA layer. +type Namespace struct { + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *Namespace) Reset() { *m = Namespace{} } +func (m *Namespace) String() string { return proto.CompactTextString(m) } +func (*Namespace) ProtoMessage() {} +func (*Namespace) Descriptor() ([]byte, []int) { + return fileDescriptor_feb508392bc12c0f, []int{0} +} +func (m *Namespace) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Namespace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Namespace.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 *Namespace) XXX_Merge(src proto.Message) { + xxx_messageInfo_Namespace.Merge(m, src) +} +func (m *Namespace) XXX_Size() int { + return m.Size() +} +func (m *Namespace) XXX_DiscardUnknown() { + xxx_messageInfo_Namespace.DiscardUnknown(m) +} + +var xxx_messageInfo_Namespace proto.InternalMessageInfo + +func (m *Namespace) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + // Blob is the data submitted/received from DA interface. type Blob struct { Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` @@ -36,7 +81,7 @@ func (m *Blob) Reset() { *m = Blob{} } func (m *Blob) String() string { return proto.CompactTextString(m) } func (*Blob) ProtoMessage() {} func (*Blob) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{0} + return fileDescriptor_feb508392bc12c0f, []int{1} } func (m *Blob) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -81,7 +126,7 @@ func (m *ID) Reset() { *m = ID{} } func (m *ID) String() string { return proto.CompactTextString(m) } func (*ID) ProtoMessage() {} func (*ID) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{1} + return fileDescriptor_feb508392bc12c0f, []int{2} } func (m *ID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -126,7 +171,7 @@ func (m *Commitment) Reset() { *m = Commitment{} } func (m *Commitment) String() string { return proto.CompactTextString(m) } func (*Commitment) ProtoMessage() {} func (*Commitment) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{2} + return fileDescriptor_feb508392bc12c0f, []int{3} } func (m *Commitment) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -171,7 +216,7 @@ func (m *Proof) Reset() { *m = Proof{} } func (m *Proof) String() string { return proto.CompactTextString(m) } func (*Proof) ProtoMessage() {} func (*Proof) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{3} + return fileDescriptor_feb508392bc12c0f, []int{4} } func (m *Proof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -215,7 +260,7 @@ func (m *MaxBlobSizeRequest) Reset() { *m = MaxBlobSizeRequest{} } func (m *MaxBlobSizeRequest) String() string { return proto.CompactTextString(m) } func (*MaxBlobSizeRequest) ProtoMessage() {} func (*MaxBlobSizeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{4} + return fileDescriptor_feb508392bc12c0f, []int{5} } func (m *MaxBlobSizeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -253,7 +298,7 @@ func (m *MaxBlobSizeResponse) Reset() { *m = MaxBlobSizeResponse{} } func (m *MaxBlobSizeResponse) String() string { return proto.CompactTextString(m) } func (*MaxBlobSizeResponse) ProtoMessage() {} func (*MaxBlobSizeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{5} + return fileDescriptor_feb508392bc12c0f, []int{6} } func (m *MaxBlobSizeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -298,7 +343,7 @@ func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (*GetRequest) ProtoMessage() {} func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{6} + return fileDescriptor_feb508392bc12c0f, []int{7} } func (m *GetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -343,7 +388,7 @@ func (m *GetResponse) Reset() { *m = GetResponse{} } func (m *GetResponse) String() string { return proto.CompactTextString(m) } func (*GetResponse) ProtoMessage() {} func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{7} + return fileDescriptor_feb508392bc12c0f, []int{8} } func (m *GetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -388,7 +433,7 @@ func (m *GetIDsRequest) Reset() { *m = GetIDsRequest{} } func (m *GetIDsRequest) String() string { return proto.CompactTextString(m) } func (*GetIDsRequest) ProtoMessage() {} func (*GetIDsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{8} + return fileDescriptor_feb508392bc12c0f, []int{9} } func (m *GetIDsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -433,7 +478,7 @@ func (m *GetIDsResponse) Reset() { *m = GetIDsResponse{} } func (m *GetIDsResponse) String() string { return proto.CompactTextString(m) } func (*GetIDsResponse) ProtoMessage() {} func (*GetIDsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_feb508392bc12c0f, []int{9} + return fileDescriptor_feb508392bc12c0f, []int{10} } func (m *GetIDsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -478,7 +523,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{10} + return fileDescriptor_feb508392bc12c0f, []int{11} } func (m *CommitRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -523,7 +568,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{11} + return fileDescriptor_feb508392bc12c0f, []int{12} } func (m *CommitResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -561,15 +606,16 @@ func (m *CommitResponse) GetCommitments() []*Commitment { // SubmitRequest is the request type for the Submit rpc method. type SubmitRequest struct { - Blobs []*Blob `protobuf:"bytes,1,rep,name=blobs,proto3" json:"blobs,omitempty"` - GasPrice float64 `protobuf:"fixed64,2,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"` + Blobs []*Blob `protobuf:"bytes,1,rep,name=blobs,proto3" json:"blobs,omitempty"` + GasPrice float64 `protobuf:"fixed64,2,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"` + Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` } 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{12} + return fileDescriptor_feb508392bc12c0f, []int{13} } func (m *SubmitRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -612,6 +658,13 @@ func (m *SubmitRequest) GetGasPrice() float64 { return 0 } +func (m *SubmitRequest) GetNamespace() *Namespace { + if m != nil { + return m.Namespace + } + return nil +} + // 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"` @@ -622,7 +675,7 @@ 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{13} + return fileDescriptor_feb508392bc12c0f, []int{14} } func (m *SubmitResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -675,7 +728,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{14} + return fileDescriptor_feb508392bc12c0f, []int{15} } func (m *ValidateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -727,7 +780,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{15} + return fileDescriptor_feb508392bc12c0f, []int{16} } func (m *ValidateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -764,6 +817,7 @@ func (m *ValidateResponse) GetResults() []bool { } func init() { + proto.RegisterType((*Namespace)(nil), "da.Namespace") proto.RegisterType((*Blob)(nil), "da.Blob") proto.RegisterType((*ID)(nil), "da.ID") proto.RegisterType((*Commitment)(nil), "da.Commitment") @@ -785,39 +839,41 @@ func init() { func init() { proto.RegisterFile("da/da.proto", fileDescriptor_feb508392bc12c0f) } var fileDescriptor_feb508392bc12c0f = []byte{ - // 505 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xb5, 0xdd, 0xc6, 0x24, 0x63, 0x92, 0xc2, 0x36, 0x2a, 0x96, 0x01, 0x2b, 0xec, 0x01, 0x22, - 0x04, 0x29, 0x94, 0x03, 0xe2, 0x06, 0x21, 0x52, 0x14, 0x89, 0xa2, 0xca, 0x91, 0xb8, 0x46, 0xeb, - 0x78, 0x49, 0x2d, 0xd9, 0x75, 0xf0, 0x6e, 0xaa, 0xaa, 0x5f, 0xc1, 0x67, 0xc1, 0xad, 0x47, 0x8e, - 0x28, 0xf9, 0x11, 0xb4, 0xde, 0xdd, 0x38, 0xa6, 0x8a, 0xd2, 0xe3, 0xcc, 0xbc, 0xf7, 0x76, 0x3c, - 0xef, 0xc9, 0xe0, 0x44, 0xe4, 0x38, 0x22, 0xbd, 0x79, 0x9e, 0xf1,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20, 0xfe, 0xb3, 0xc7, 0x6b, 0x57, 0x9b, 0x9a, 0xd8, - 0x77, 0x7f, 0x2d, 0x7d, 0xf3, 0x66, 0xe9, 0x9b, 0x7f, 0x97, 0xbe, 0xf9, 0x73, 0xe5, 0x1b, 0x37, - 0x2b, 0xdf, 0xf8, 0xb3, 0xf2, 0x8d, 0xd0, 0x2e, 0x7e, 0x3d, 0xef, 0xfe, 0x05, 0x00, 0x00, 0xff, - 0xff, 0x7c, 0x98, 0xb0, 0x28, 0x89, 0x04, 0x00, 0x00, + // 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, 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53, 0x09, 0x47, 0xc6, 0xcf, + 0x8d, 0xa9, 0xdd, 0x6e, 0x4c, 0xed, 0xcf, 0xc6, 0xd4, 0x7e, 0x6c, 0xcd, 0xca, 0xed, 0xd6, 0xac, + 0xfc, 0xde, 0x9a, 0x15, 0xbb, 0x91, 0x7c, 0x65, 0xef, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0xdf, + 0x7a, 0x6f, 0x94, 0xd9, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1092,6 +1148,36 @@ var _DAService_serviceDesc = grpc.ServiceDesc{ Metadata: "da/da.proto", } +func (m *Namespace) 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 *Namespace) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Namespace) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintDa(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Blob) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1496,6 +1582,18 @@ func (m *SubmitRequest) 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 m.GasPrice != 0 { i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.GasPrice)))) @@ -1668,6 +1766,19 @@ func encodeVarintDa(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *Namespace) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovDa(uint64(l)) + } + return n +} + func (m *Blob) Size() (n int) { if m == nil { return 0 @@ -1843,6 +1954,10 @@ func (m *SubmitRequest) Size() (n int) { if m.GasPrice != 0 { n += 9 } + if m.Namespace != nil { + l = m.Namespace.Size() + n += 1 + l + sovDa(uint64(l)) + } return n } @@ -1906,6 +2021,90 @@ func sovDa(x uint64) (n int) { func sozDa(x uint64) (n int) { return sovDa(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *Namespace) 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: Namespace: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Namespace: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + 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 *Blob) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2924,6 +3123,42 @@ func (m *SubmitRequest) Unmarshal(dAtA []byte) error { v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 m.GasPrice = float64(math.Float64frombits(v)) + 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:])