-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: adding Namespace to remaining endpoints #35
Conversation
WalkthroughThe recent updates involve enhancing the functionality related to retrieving IDs, creating commitments for Blobs, and submitting Blobs to the Data Availability layer by integrating a Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #35 +/- ##
=======================================
Coverage 79.77% 79.77%
=======================================
Files 3 3
Lines 178 178
=======================================
Hits 142 142
Misses 28 28
Partials 8 8 ☔ View full report in Codecov by Sentry. |
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.
Review Status
Actionable comments generated: 5
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
types/pb/da/da.pb.go
is excluded by:!**/*.pb.go
Files selected for processing (6)
- da.go (1 hunks)
- proto/da/da.proto (2 hunks)
- proxy/client.go (2 hunks)
- proxy/server.go (3 hunks)
- test/dummy.go (2 hunks)
- test/test_suite.go (3 hunks)
Additional comments: 9
da.go (2)
- 17-17: The
GetIDs
method now includes anamespace Namespace
parameter. Ensure that all implementations of theDA
interface are updated to accommodate this change.- 20-20: The
Commit
method now includes anamespace Namespace
parameter. Similar toGetIDs
, verify that all implementations of theDA
interface are updated to reflect this change.proxy/server.go (2)
- 41-41: The
GetIDs
method inproxySrv
now correctly passes thenamespace
parameter to the underlyingDA
implementation. Ensure that theNamespace
type is properly handled in theGetValue
method and that it is compatible with the expected type in theGetIDs
method of theDA
interface.Verification successful
The
GetValue
method on theNamespace
type has been found, and it correctly returns a[]byte
, which is consistent with the usage of theNamespace
type in theGetIDs
method of theDA
interface. The review comment has been successfully verified.* 51-51: The `Commit` method in `proxySrv` also correctly passes the `namespace` parameter. The same verification for the `Namespace` type handling applies here as it did for the `GetIDs` method.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the Namespace type is handled correctly in the GetValue method. ast-grep --lang go --pattern $'func ($_ Namespace) GetValue() $_ { $$$ }'Length of output: 76
Script:
#!/bin/bash # Attempt to find the GetValue method on the Namespace type with a broader pattern ast-grep --lang go --pattern $'func ($$$) GetValue() $$$'Length of output: 1292
Script:
#!/bin/bash # If the above fails, search for any method on the Namespace type ast-grep --lang go --pattern $'func ($$$ Namespace) $$$'Length of output: 57
Script:
#!/bin/bash # Additionally, look for any usage of the Namespace type to understand how its value is retrieved rg 'Namespace' --type goLength of output: 5735
Verification successful
The
GetValue
method is indeed present in the codebase and is associated with theNamespace
type as well as other types. The method checks if the receiver is notnil
and returns theValue
field, returningnil
if the receiver isnil
. This is a correct and safe way to handle potentiallynil
receivers in Go.Based on the output, the
GetValue
method for theNamespace
type is implemented as follows:func (m *Namespace) GetValue() []byte { if m != nil { return m.Value } return nil }This confirms that the
GetValue
method is correctly implemented for theNamespace
type, and thus the review comment is verified as accurate.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the Namespace type is handled correctly in the GetValue method. ast-grep --lang go --pattern $'func ($_ Namespace) GetValue() $_ { $$$ }'Length of output: 76
Script:
#!/bin/bash # Search for any GetValue method within the Go codebase to verify its handling. ast-grep --lang go --pattern $'func ($$$) GetValue() $_ { $$$ }'Length of output: 1301
proto/da/da.proto (2)
- 72-72: The
GetIDsRequest
message now includes aNamespace
field. This is a breaking change and requires all clients and servers that use this message to be updated accordingly.- 83-83: The
CommitRequest
message also includes aNamespace
field. As withGetIDsRequest
, verify that all usages ofCommitRequest
are updated to handle the new field.proxy/client.go (1)
- 67-68: The
GetIDs
method in theClient
struct now accepts anamespace
parameter and correctly constructs thepbda.GetIDsRequest
with it. Ensure that all calls toClient.GetIDs
are updated to provide thenamespace
argument.Verification successful
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for calls to Client.GetIDs to verify they include the namespace argument. ast-grep --lang go --pattern $'func ($_ *Client) GetIDs($_, $_, $_) $_ { $$$ }'Length of output: 577
Script:
#!/bin/bash # Search for usages of the Client.GetIDs method to verify if they include the namespace argument. rg --glob '!proxy/client.go' 'c\.GetIDs\('Length of output: 44
Script:
#!/bin/bash # Perform a more general search for usages of the GetIDs method, including within proxy/client.go rg 'GetIDs\('Length of output: 1436
Script:
#!/bin/bash # Verify if the calls in test/test_suite.go are to the Client.GetIDs method and if they include the namespace parameter. rg 'GetIDs\(ctx, i,' test/test_suite.goLength of output: 122
Script:
#!/bin/bash # Determine the type of the variable 'd' in test/test_suite.go to see if it's an instance of 'Client'. rg '^\s*\w+\s*d\s*=' test/test_suite.goLength of output: 78
Script:
#!/bin/bash # Attempt to find the declaration or instantiation of the variable 'd' in test/test_suite.go. rg 'd\s*[:=]\s*' test/test_suite.goLength of output: 130
Script:
#!/bin/bash # Search for the type that 'd' implements or any struct/interface declaration that could give us a hint about 'd's type. rg -A 3 'type DummyDA' test/dummy.goLength of output: 163
test/dummy.go (2)
- 82-82: The
GetIDs
method inDummyDA
now accepts anamespace
parameter. This change is consistent with the interface update. Ensure that thenamespace
parameter is used appropriately within the method if necessary.- 94-94: The
Commit
method inDummyDA
also accepts anamespace
parameter. As withGetIDs
, ensure that thenamespace
parameter is used appropriately within the method if necessary.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (5)
- da.go (1 hunks)
- proxy/client.go (3 hunks)
- proxy/server.go (4 hunks)
- test/dummy.go (3 hunks)
- test/test_suite.go (5 hunks)
Files skipped from review as they are similar to previous changes (4)
- da.go
- proxy/server.go
- test/dummy.go
- test/test_suite.go
Additional comments: 2
proxy/client.go (2)
- 67-68: The implementation of the
GetIDs
method correctly incorporates the additionalnamespace
parameter as described in the PR objectives. Thepbda.GetIDsRequest
struct is updated to include thenamespace
field, aligning with the intended changes.- 78-81: The
Commit
method has been successfully updated to accept an additionalnamespace
parameter, and thepbda.CommitRequest
struct is modified accordingly to include this parameter. This change is consistent with the PR's objectives to enhance namespace support in the DA layer's functionality.
@nashqueue and I are currently discussing if Validate really needs namespace - currently it is needed as part of the API to verify proofs in node (see: getByCommitment, blob.Included, nmt.Proof.VerifyInclusion). Will update this comment with results UPDATE: |
I would rather have get and validate have namespace than id getting namespace. |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
types/pb/da/da.pb.go
is excluded by:!**/*.pb.go
Files selected for processing (7)
- README.md (1 hunks)
- da.go (1 hunks)
- proto/da/da.proto (4 hunks)
- proxy/client.go (5 hunks)
- proxy/server.go (4 hunks)
- test/dummy.go (5 hunks)
- test/test_suite.go (6 hunks)
Files skipped from review as they are similar to previous changes (3)
- da.go
- proto/da/da.proto
- test/test_suite.go
Additional comments: 16
proxy/server.go (5)
- 36-36: The addition of
request.Namespace.GetValue()
as a parameter in theGet
method aligns with the PR objectives to enhance namespace support. This change correctly extends the method's functionality to include namespace handling.- 41-41: The
GetIDs
method correctly incorporates theNamespace
parameter, adhering to the PR's goal of improving data availability layer's interface with namespace support.- 51-51: The
Commit
method's update to includerequest.Namespace.GetValue()
as a parameter is consistent with the PR's objectives to enhance namespace functionality across the data availability layer.- 62-62: The
Submit
method's modification to acceptrequest.Namespace.GetValue()
as a parameter is in line with the PR's aim to extend namespace support, enhancing the data availability layer's capabilities.- 84-84: The
Validate
method now correctly includesrequest.Namespace.GetValue()
as a parameter, aligning with the PR's objectives to improve namespace handling in the data availability layer.README.md (1)
- 18-22: The README.md file accurately reflects the changes made to the DA Interface, including the addition of the
namespace
parameter to theGet
,GetIDs
,Commit
,Validate
methods, and the introduction of a newSubmit
method. This documentation update is crucial for users to understand the new interface requirements.proxy/client.go (5)
- 51-54: The
Get
method inproxy/client.go
has been correctly updated to include anamespace
parameter, aligning with the PR's objectives to enhance namespace support in the data availability layer.- 68-69: The
GetIDs
method now correctly accepts anamespace
parameter, reflecting the PR's aim to improve namespace functionality within the data availability layer.- 79-82: The
Commit
method's update to include anamespace
parameter is consistent with the PR's objectives. However, based on the existing comments, there's a need to verify that all calls toClient.Commit
in other parts of the codebase have been updated accordingly.- 94-98: The
Submit
method's modification to accept anamespace
parameter, along withgasPrice
, is in line with the PR's aim to extend namespace support, enhancing the data availability layer's capabilities.- 117-121: The
Validate
method now correctly includes anamespace
parameter, aligning with the PR's objectives to improve namespace handling in the data availability layer.test/dummy.go (5)
- 58-58: The
Get
method intest/dummy.go
has been updated to accept anamespace
parameter. This change is consistent with the PR's objectives to enhance namespace support across the data availability layer.- 82-82: The
GetIDs
method now correctly incorporates anamespace
parameter, adhering to the PR's goal of improving data availability layer's interface with namespace support.- 94-94: The
Commit
method's update to include anamespace
parameter is in line with the PR's objectives to enhance namespace functionality across the data availability layer.- 103-103: The
Submit
method's modification to accept anamespace
parameter, along withgasPrice
, reflects the PR's aim to extend namespace support, enhancing the data availability layer's capabilities.- 120-120: The
Validate
method now correctly includes anamespace
parameter, aligning with the PR's objectives to improve namespace handling in the data availability layer.
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.
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.
* adding namespaces * changing submitoptions to gasprice,ns * adding namespace to remaining endpoints * updating readme w note * nit: lint md013 - skip tables --------- Co-authored-by: Javed Khan <tuxcanfly@gmail.com> updating readme w note feat: GetProofs introduction updating readme
* adding namespaces * changing submitoptions to gasprice,ns * adding namespace to remaining endpoints * updating readme w note * nit: lint md013 - skip tables --------- Co-authored-by: Javed Khan <tuxcanfly@gmail.com> updating readme w note feat: GetProofs introduction updating readme
* feat!: adding Namespace to remaining endpoints (#35) * adding namespaces * changing submitoptions to gasprice,ns * adding namespace to remaining endpoints * updating readme w note * nit: lint md013 - skip tables --------- Co-authored-by: Javed Khan <tuxcanfly@gmail.com> updating readme w note feat: GetProofs introduction updating readme * nit * making GetProofs take da.ID slice instead of height
It turns out the previous addition of Namespace to Submit wasn't enough to allow for a native celestia-node implementation of go-da.
GetIDs and Commitment have been extended to use Namespaces for DA layers that support it.
Note that this assumes that namespace would land in the ID, which I'm not so sure about for the following reason:ID is supposed to represent what uniquely identifies a blob on the DA layer, but adding Namespace means ID represents the data you need to fetch a Blob uniquely from the DA layer. Also, changing the ID means that retrofitting existing op-stack rollups will break.
Whlie porting op-stack back to the blob module though, I realized that this change would only be necessary for using go-da. The id being only (height, commitment) is sufficient for fetching the data because you always know the namespace and can pass it into the blob endpoints directly.The alternative to making Namespace a part of ID is adding Namespace to Get and Validate as well.The signature for Submit has been changed again, thanks to a good catch from @tuxcanfly during review. We got rid of SubmitOptions again and pass Namespace as the last parameter, as in the other methods.
Now all methods take an optional Namespace as the last parameter, to avoid needing to modify ID.
Summary by CodeRabbit
Summary by CodeRabbit
DA Interface
table in the README.md to reflect changes in method parameters and the addition of a new method.