Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ go-da defines a generic Data Availability interface for modular blockchains.
| `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` |
| `Submit` | `blobs []Blob, gasPrice float64, namespace Namespace`, keyringkeyname Keyringkeyname | `[]ID` |

NOTE: The `Namespace` parameter in the interface methods is optional and used
only on DA layers that support the functionality, for example Celestia
Expand Down
6 changes: 5 additions & 1 deletion da.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type DA interface {
//
// 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)
Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace, keyringkeyname *Keyringkeyname) ([]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)
Expand All @@ -36,6 +36,10 @@ type DA interface {
// posted to, for DA layers supporting the functionality.
type Namespace = []byte

// Keyringkeyname is an optional parameter used to set the keyring keyname for
// the DA service.
type Keyringkeyname = []byte
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeyName sounds less repetitive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I was just trying to match UX on node.


// Blob is the data submitted/received from DA interface.
type Blob = []byte

Expand Down
6 changes: 6 additions & 0 deletions proto/da/da.proto
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ message SubmitRequest {
repeated Blob blobs = 1;
double gas_price = 2;
Namespace namespace = 3;
Keyringkeyname keyringkeyname = 4;
}

// Keyringkeyname is the key name for the DA service (optional).
message Keyringkeyname {
bytes value = 1;
}

// SubmitResponse is the response type for the Submit rpc method.
Expand Down
6 changes: 5 additions & 1 deletion proxy/grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,17 @@ 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, error) {
func (c *Client) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace da.Namespace, keyringkeyname *da.Keyringkeyname) ([]da.ID, error) {
req := &pbda.SubmitRequest{
Blobs: blobsDA2PB(blobs),
GasPrice: gasPrice,
Namespace: &pbda.Namespace{Value: namespace},
}

if keyringkeyname != nil {
req.Keyringkeyname = &pbda.Keyringkeyname{Value: *keyringkeyname}
}

resp, err := c.client.Submit(ctx, req)
if err != nil {
return nil, err
Expand Down
7 changes: 6 additions & 1 deletion proxy/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ func (p *proxySrv) GetProofs(ctx context.Context, request *pbda.GetProofsRequest
func (p *proxySrv) Submit(ctx context.Context, request *pbda.SubmitRequest) (*pbda.SubmitResponse, error) {
blobs := blobsPB2DA(request.Blobs)

ids, err := p.target.Submit(ctx, blobs, request.GasPrice, request.Namespace.GetValue())
var keyringkeyname *da.Keyringkeyname
if request.Keyringkeyname != nil {
keyringkeyname = (*da.Keyringkeyname)(&request.Keyringkeyname.Value)
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix undefined request.Keyringkeyname.

The request.Keyringkeyname field is undefined. Ensure that the SubmitRequest type in the pbda package includes the Keyringkeyname field.

Apply this diff to define the Keyringkeyname field in the SubmitRequest type:

// In the `pbda` package, update the `SubmitRequest` type definition to include the `Keyringkeyname` field.
type SubmitRequest struct {
	// Other fields...
	Keyringkeyname *Keyringkeyname `protobuf:"bytes,5,opt,name=keyringkeyname" json:"keyringkeyname,omitempty"`
}

Committable suggestion was skipped due to low confidence.

Tools
GitHub Check: lint / golangci-lint

[failure] 73-73:
request.Keyringkeyname undefined (type *"github.com/rollkit/go-da/types/pb/da".SubmitRequest has no field or method Keyringkeyname)


[failure] 74-74:
request.Keyringkeyname undefined (type *"github.com/rollkit/go-da/types/pb/da".SubmitRequest has no field or method Keyringkeyname) (typecheck)


[failure] 73-73:
request.Keyringkeyname undefined (type *"github.com/rollkit/go-da/types/pb/da".SubmitRequest has no field or method Keyringkeyname)


[failure] 74-74:
request.Keyringkeyname undefined (type *"github.com/rollkit/go-da/types/pb/da".SubmitRequest has no field or method Keyringkeyname)) (typecheck)

GitHub Check: test / Run Unit Tests

[failure] 73-73:
request.Keyringkeyname undefined (type *"github.com/rollkit/go-da/types/pb/da".SubmitRequest has no field or method Keyringkeyname)


[failure] 74-74:
request.Keyringkeyname undefined (type *"github.com/rollkit/go-da/types/pb/da".SubmitRequest has no field or method Keyringkeyname)

ids, err := p.target.Submit(ctx, blobs, request.GasPrice, request.Namespace.GetValue(), keyringkeyname)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions proxy/jsonrpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type API struct {
GetProofs func(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Proof, error) `perm:"read"`
Commit func(ctx context.Context, blobs []da.Blob, ns da.Namespace) ([]da.Commitment, error) `perm:"read"`
Validate func(context.Context, []da.ID, []da.Proof, da.Namespace) ([]bool, error) `perm:"read"`
Submit func(context.Context, []da.Blob, float64, da.Namespace) ([]da.ID, error) `perm:"write"`
Submit func(context.Context, []da.Blob, float64, da.Namespace, *da.Keyringkeyname) ([]da.ID, error) `perm:"write"`
}
}

Expand Down Expand Up @@ -61,8 +61,8 @@ func (api *API) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof, ns
}

// Submit submits the Blobs to Data Availability layer.
func (api *API) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, ns da.Namespace) ([]da.ID, error) {
return api.Internal.Submit(ctx, blobs, gasPrice, ns)
func (api *API) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, ns da.Namespace, keyringkeyname *da.Keyringkeyname) ([]da.ID, error) {
return api.Internal.Submit(ctx, blobs, gasPrice, ns, keyringkeyname)
}

// Client is the jsonrpc client
Expand Down
2 changes: 1 addition & 1 deletion test/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,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, _ da.Namespace) ([]da.ID, error) {
func (d *DummyDA) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, _ da.Namespace, keyringkeyname *da.Keyringkeyname) ([]da.ID, error) {
d.mu.Lock()
defer d.mu.Unlock()
ids := make([]da.ID, len(blobs))
Expand Down
2 changes: 1 addition & 1 deletion test/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func BasicDATest(t *testing.T, d da.DA) {
msg2 := []byte("message 2")

ctx := context.TODO()
id1, err := d.Submit(ctx, []da.Blob{msg1}, 0, testNamespace)
id1, err := d.Submit(ctx, []da.Blob{msg1}, 0, testNamespace, nil)
assert.NoError(t, err)
assert.NotEmpty(t, id1)

Expand Down