-
Notifications
You must be signed in to change notification settings - Fork 23
feat: add keyName #89
Changes from all commits
1d6b911
483f494
fe2e2ee
de917c7
3f7312e
f22f875
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -26,7 +26,7 @@ | |||||
// | ||||||
// 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, keyName keyName) ([]ID, error) | ||||||
Check failure on line 29 in da.go
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix undefined The Apply this diff to fix the issue: - Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace, keyName keyName) ([]ID, error)
+ Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace, keyName KeyName) ([]ID, error) Committable suggestion
Suggested change
ToolsGitHub Check: test / Run Unit Tests
GitHub Check: lint / golangci-lint
|
||||||
|
||||||
// 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) | ||||||
|
@@ -36,6 +36,10 @@ | |||||
// posted to, for DA layers supporting the functionality. | ||||||
type Namespace = []byte | ||||||
|
||||||
// KeyName is an optional parameter used to set the keyring keyname for | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH it's not "optional" as you have to pass something in Go call. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make it actually optional, we should implement |
||||||
// the DA service. | ||||||
type KeyName = []byte | ||||||
|
||||||
// Blob is the data submitted/received from DA interface. | ||||||
type Blob = []byte | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -105,9 +105,14 @@ message CommitResponse { | |||||||||||||||||||
|
||||||||||||||||||||
// SubmitRequest is the request type for the Submit rpc method. | ||||||||||||||||||||
message SubmitRequest { | ||||||||||||||||||||
repeated Blob blobs = 1; | ||||||||||||||||||||
double gas_price = 2; | ||||||||||||||||||||
Namespace namespace = 3; | ||||||||||||||||||||
repeated Blob blobs = 1; | ||||||||||||||||||||
double gas_price = 2; | ||||||||||||||||||||
Namespace namespace = 3; | ||||||||||||||||||||
KeyName keyName = 4; | ||||||||||||||||||||
} | ||||||||||||||||||||
Comment on lines
+108
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use lower_snake_case for field names. The field name Apply this diff to fix the naming convention: message SubmitRequest {
repeated Blob blobs = 1;
double gas_price = 2;
Namespace namespace = 3;
- KeyName keyName = 4;
+ KeyName key_name = 4;
} Committable suggestion
Suggested change
Toolsbuf
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is perfectly valid point and should be reworked. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tzdybal, thanks for confirming! The change to lower_snake_case for the field name will ensure consistency with protobuf naming conventions. Let's proceed with reworking it as suggested. |
||||||||||||||||||||
|
||||||||||||||||||||
message KeyName { | ||||||||||||||||||||
bytes value = 1; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// SubmitResponse is the response type for the Submit rpc method. | ||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,7 +5,7 @@ | |||||||||||||||||
|
||||||||||||||||||
"google.golang.org/grpc" | ||||||||||||||||||
|
||||||||||||||||||
"github.com/rollkit/go-da" | ||||||||||||||||||
pbda "github.com/rollkit/go-da/types/pb/da" | ||||||||||||||||||
) | ||||||||||||||||||
|
||||||||||||||||||
|
@@ -48,7 +48,7 @@ | |||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
// Get returns Blob for each given ID, or an 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)), | ||||||||||||||||||
Namespace: &pbda.Namespace{Value: namespace}, | ||||||||||||||||||
|
@@ -65,7 +65,7 @@ | |||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
// GetIDs returns IDs of all Blobs located in DA at given 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 { | ||||||||||||||||||
|
@@ -105,11 +105,16 @@ | |||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
// 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, keyName da.KeyName) ([]da.ID, error) { | ||||||||||||||||||
req := &pbda.SubmitRequest{ | ||||||||||||||||||
Blobs: blobsDA2PB(blobs), | ||||||||||||||||||
GasPrice: gasPrice, | ||||||||||||||||||
Namespace: &pbda.Namespace{Value: namespace}, | ||||||||||||||||||
jcstein marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
Namespace: &pbda.KeyName{Value: keyName}, | ||||||||||||||||||
} | ||||||||||||||||||
Comment on lines
+113
to
+114
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix incorrect field usage. The field Apply this diff to fix the issue: req := &pbda.SubmitRequest{
Blobs: blobsDA2PB(blobs),
GasPrice: gasPrice,
Namespace: &pbda.Namespace{Value: namespace},
- Namespace: &pbda.KeyName{Value: keyName},
+ KeyName: &pbda.KeyName{Value: keyName},
} Committable suggestion
Suggested change
Toolsgolangci-lint
GitHub Check: lint / golangci-lint
|
||||||||||||||||||
|
||||||||||||||||||
if keyName != nil { | ||||||||||||||||||
req.KeyName = &pbda.KeyName{Value: *keyName} | ||||||||||||||||||
Comment on lines
+116
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix incorrect field usage. The field Apply this diff to fix the issue: if keyName != nil {
- req.KeyName = &pbda.KeyName{Value: *keyName}
+ req.key_name = &pbda.KeyName{Value: *keyName}
}
Toolsgolangci-lint
GitHub Check: lint / golangci-lint
|
||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
resp, err := c.client.Submit(ctx, req) | ||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
} | ||
|
||
type proxySrv struct { | ||
target da.DA | ||
} | ||
|
||
func (p *proxySrv) MaxBlobSize( | ||
|
@@ -69,7 +69,12 @@ | |
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 keyName da.KeyName | ||
if request.KeyName != nil { | ||
keyName = (da.KeyName)(&request.KeyName.Value) | ||
} | ||
|
||
ids, err := p.target.Submit(ctx, blobs, request.GasPrice, request.Namespace.GetValue(), request.KeyName.GetValue()) | ||
Comment on lines
+72
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix undefined The Apply this diff to define the // In the `pbda` package, update the `SubmitRequest` type definition to include the `KeyName` field.
type SubmitRequest struct {
// Other fields...
KeyName *KeyName `protobuf:"bytes,5,opt,name=keyName" json:"keyName,omitempty"`
}
Toolsgolangci-lint
GitHub Check: lint / golangci-lint
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix possible typo.
There is a possible typo in the
Submit
method signature documentation. Ensure that the method signature is correctly documented.Apply this diff to fix the typo:
Committable suggestion
Tools
LanguageTool