-
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 @@ 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, keyName keyName) ([]ID, error) | ||||||
|
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 @@ type DA interface { | |||||
| // posted to, for DA layers supporting the functionality. | ||||||
| type Namespace = []byte | ||||||
|
|
||||||
| // KeyName is an optional parameter used to set the keyring keyname for | ||||||
|
Member
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.
Member
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
Member
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -105,11 +105,16 @@ 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, 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}, | ||||||||||||||||||
| } | ||||||||||||||||||
|
||||||||||||||||||
| Namespace: &pbda.KeyName{Value: keyName}, | |
| } | |
| req := &pbda.SubmitRequest{ | |
| Blobs: blobsDA2PB(blobs), | |
| GasPrice: gasPrice, | |
| Namespace: &pbda.Namespace{Value: namespace}, | |
| KeyName: &pbda.KeyName{Value: keyName}, | |
| } |
Tools
golangci-lint
113-113: undefined: pbda.KeyName
(typecheck)
GitHub Check: lint / golangci-lint
[failure] 113-113:
undefined: pbda.KeyName (typecheck)
Outdated
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 incorrect field usage.
The field req.KeyName is incorrectly used, causing type errors and undefined field issues. Use the correct field name key_name.
Apply this diff to fix the issue:
if keyName != nil {
- req.KeyName = &pbda.KeyName{Value: *keyName}
+ req.key_name = &pbda.KeyName{Value: *keyName}
}Committable suggestion was skipped due to low confidence.
Tools
golangci-lint
117-117: req.KeyName undefined (type *da.SubmitRequest has no field or method KeyName)
(typecheck)
GitHub Check: lint / golangci-lint
[failure] 117-117:
req.KeyName undefined (type *da.SubmitRequest has no field or method KeyName) (typecheck)
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 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()) | ||
|
||
| 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
Submitmethod signature documentation. Ensure that the method signature is correctly documented.Apply this diff to fix the typo:
Committable suggestion
Tools
LanguageTool