Skip to content
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 SubmitOptions to Submit #34

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

distractedm1nd
Copy link
Collaborator

@distractedm1nd distractedm1nd commented Jan 19, 2024

Closes #33

Summary by CodeRabbit

  • New Features

    • Introduced a new SubmitOptions struct to provide additional configuration for blob submissions.
    • Added support for specifying a Namespace for blob submissions.
  • Refactor

    • Updated the Submit method signatures across multiple components to use the new SubmitOptions struct.
    • Altered the proxySrv logic to accommodate the changes in submission options.
  • Tests

    • Modified test suite to adapt to the new method signatures and usage of SubmitOptions.

Copy link

coderabbitai bot commented Jan 19, 2024

Walkthrough

A recent update in the codebase introduces SubmitOptions, a new struct that encapsulates parameters for blob submission, including a Namespace field. This allows for finer control over blob submission, enabling the use of different namespaces without the need for multiple client instances. The Submit method signatures across various interfaces and structs have been adjusted to accommodate this new struct, replacing the direct use of gasPrice and enhancing flexibility for future extensions.

Changes

File(s) Change Summary
da.go, .../client.go Replaced gasPrice with SubmitOptions in Submit method signatures. Introduced Namespace in options.
proto/da/da.proto Added Namespace message and included it in SubmitRequest.
proxy/server.go Updated Submit method to use SubmitOptions including GasPrice and Namespace.
test/dummy.go, test/test_suite.go Altered Submit method to accept SubmitOptions and updated test functions to use the modified interface.

Assessment against linked issues

Objective Addressed Explanation
Add namespace/appID as an optional parameter to the Submit function (#33) The introduction of Namespace in SubmitOptions and its integration into the Submit method signatures fulfills this requirement.

Poem

In the warren, deep in code, 🐇💻
A rabbit hopped on the refactor road.
Namespaces now in their right place,
With SubmitOptions, we embrace the pace! 🚀✨

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (82f5296) 79.31% compared to head (f01293c) 79.77%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   79.31%   79.77%   +0.46%     
==========================================
  Files           3        3              
  Lines         174      178       +4     
==========================================
+ Hits          138      142       +4     
  Misses         28       28              
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a 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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between fd02dcb and f01293c.
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 (1 hunks)
  • proxy/server.go (1 hunks)
  • test/dummy.go (1 hunks)
  • test/test_suite.go (5 hunks)
Additional comments: 10
da.go (3)
  • 27-27: The Submit method has been updated to accept a pointer to SubmitOptions instead of a gasPrice. Ensure all implementations of the DA interface are updated accordingly.
  • 34-37: The SubmitOptions struct has been introduced with a GasPrice and a Namespace. Ensure that the Namespace is being used appropriately wherever SubmitOptions is instantiated.
  • 39-41: The Namespace type is defined as a byte slice alias. Confirm that this type is used consistently across the codebase and that its usage aligns with the intended design for namespaces.
Verification successful

The Namespace type is consistently used across the codebase, including in protocol buffer definitions, server and client logic, and test suites, aligning with the intended design for namespaces as described in the PR objectives.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for usage of Namespace type to ensure consistency.
ast-grep --lang go --pattern $'Namespace($_)'

Length of output: 46



Script:

#!/bin/bash
# Search for usage of Namespace type across the codebase using ripgrep
rg "Namespace"

Length of output: 3413

proxy/server.go (1)
  • 60-63: The Submit method in proxySrv now uses SubmitOptions to pass GasPrice and Namespace. Ensure that the Namespace field is being handled correctly by the target.Submit method.
Verification successful

The Submit method in both da.go and proxy/client.go has been reviewed. The Submit method in da.go accepts a SubmitOptions pointer, which includes GasPrice and Namespace. The Namespace is defined as a type alias for a byte slice, which is a common way to handle arbitrary data in Go, such as strings or binary data.

In proxy/client.go, the Submit method constructs a pbda.SubmitRequest, which includes the GasPrice and Namespace. The Namespace is wrapped in a pbda.Namespace struct, which suggests that the Namespace field is being correctly handled as part of the SubmitOptions struct when making a gRPC call.

Based on the provided code snippets, it can be concluded that the Namespace field within the SubmitOptions struct is being correctly utilized in the Submit method implementations in both da.go and proxy/client.go. The proxySrv struct's Submit method, as seen in the proxy/server.go file, is consistent with these implementations.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for the target.Submit method to ensure it handles Namespace correctly.
ast-grep --lang go --pattern $'func ($_ *$_) Submit($_, $_, &SubmitOptions{GasPrice: $_, Namespace: $_}) { $$$ }'

Length of output: 114



Script:

#!/bin/bash
# Search for the definition of the Submit method to examine how it handles the Namespace field.
ast-grep --lang go --pattern $'func ($_ *$_) Submit($$$) { $$$ }'

Length of output: 66



Script:

#!/bin/bash
# Broaden the search to find any method that uses the SubmitOptions struct.
ast-grep --lang go --pattern $'func ($_ *$_) $_($$$, &SubmitOptions{$$$}) { $$$ }'

Length of output: 83



Script:

#!/bin/bash
# Use ripgrep to search for the SubmitOptions struct in the Go files.
rg 'SubmitOptions' --type go

Length of output: 1015



Script:

#!/bin/bash
# Examine the implementation of the Submit method in da.go and proxy/client.go.
cat da.go
cat proxy/client.go

Length of output: 5041

proxy/client.go (1)
  • 92-96: The Submit function in the Client type now accepts a SubmitOptions struct pointer. Ensure that the Namespace field is being correctly converted to the protobuf Namespace type.
Verification successful

The conversion of the Namespace field from the SubmitOptions struct to the protobuf Namespace type is correctly implemented in the proxy/client.go file, as confirmed by the script output.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for the conversion of Namespace to the protobuf Namespace type to ensure correctness.
ast-grep --lang go --pattern $'&pbda.Namespace{Value: $_.Namespace}'

Length of output: 143

proto/da/da.proto (2)
  • 26-28: A new Namespace message has been introduced. Verify that this message is being used correctly in all SubmitRequest messages across the codebase.
Verification successful

---


The search results indicate that the SubmitRequest message is defined in the proto/da/da.proto file. However, the output does not provide the full context of the SubmitRequest message definition, which is necessary to verify the correct usage of the Namespace message within it.

To ensure a thorough verification, we need to view the contents of the SubmitRequest message definition in the proto/da/da.proto file.


---


The output from the script confirms that the SubmitRequest message in the proto/da/da.proto file includes the Namespace field as intended. The Namespace message is correctly used within the SubmitRequest message definition, as shown by the line Namespace namespace = 3;.

Based on this information, the review comment regarding the verification of the Namespace message being used correctly in all SubmitRequest messages across the codebase is addressed, and the usage is confirmed to be correct in the proto/da/da.proto file.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for the usage of Namespace message in SubmitRequest messages.
ast-grep --lang proto --pattern $'SubmitRequest { $$$ Namespace $_ $$$ }'

Length of output: 185



Script:

#!/bin/bash
# Since ast-grep does not support proto files, we will use ripgrep to search for the usage of Namespace message in SubmitRequest messages.
rg 'SubmitRequest' --type proto

Length of output: 61



Script:

#!/bin/bash
# Adjusting the search to find instances of SubmitRequest without specifying file type, as 'proto' is not recognized by ripgrep.
rg 'SubmitRequest' -g '*.proto'

Length of output: 228



Script:

#!/bin/bash
# Display the contents of the SubmitRequest message definition in the da.proto file.
rg 'message SubmitRequest {.*}' -A 10 -g 'proto/da/da.proto'

Length of output: 192



Script:

#!/bin/bash
# Correcting the regex pattern to match the SubmitRequest message definition in the da.proto file.
rg 'message SubmitRequest' -A 10 -g 'proto/da/da.proto'

Length of output: 498

* 93-93: The `SubmitRequest` message now includes a `Namespace` field. Confirm that all `SubmitRequest` messages are being constructed with the `Namespace` field where required.
Verification successful

The provided script outputs show the construction of SubmitRequest messages in both proxy/server.go and proxy/client.go. In both instances, the Namespace field is being set:

  • In proxy/server.go, the Namespace field is set with request.Namespace.GetValue().
  • In proxy/client.go, the Namespace field is set with &pbda.Namespace{Value: opts.Namespace}.

This confirms that the Namespace field is being included in the construction of SubmitRequest messages where required, as per the changes in the proto/da/da.proto file.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for the construction of SubmitRequest messages to ensure the Namespace field is included.
ast-grep --lang proto --pattern $'SubmitRequest { $$$ Namespace: $_ $$$ }'

Length of output: 186



Script:

#!/bin/bash
# Search for the construction of SubmitRequest messages to ensure the Namespace field is included.
rg 'SubmitRequest.*namespace'

Length of output: 31



Script:

#!/bin/bash
# Broaden the search to find any instances of SubmitRequest being constructed.
rg 'SubmitRequest'

Length of output: 3055



Script:

#!/bin/bash
# Extract the relevant sections from proxy/server.go and proxy/client.go where SubmitRequest is being constructed.
rg -C 10 'SubmitRequest' proxy/server.go
rg -C 10 'SubmitRequest' proxy/client.go

Length of output: 1241

test/dummy.go (1)
  • 103-103: The Submit function in DummyDA now accepts a SubmitOptions struct pointer. Ensure that the opts parameter is being used correctly within the function.
test/test_suite.go (2)
  • 32-56: The test functions have been updated to use SubmitOptions when calling Submit. Verify that the Namespace field is being set correctly in all test cases.
Verification successful

The verification process has confirmed that the Namespace field is being set correctly in all test cases within test/test_suite.go. The Namespace is consistently set to the byte slice []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0} in each instance where SubmitOptions is used.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for the setting of Namespace field in test cases.
ast-grep --lang go --pattern $'&da.SubmitOptions{GasPrice: $_, Namespace: $_}'

Length of output: 1506

* 164-181: > 📝 **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [158-178]

The ConcurrentReadWriteTest function is designed to test for race conditions. Ensure that the DummyDA implementation is thread-safe and that the test is effective in detecting concurrency issues.

test/test_suite.go Show resolved Hide resolved
@Manav-Aggarwal Manav-Aggarwal added T:enhancement and removed enhancement New feature or request labels Jan 23, 2024
@nashqueue nashqueue merged commit d853a41 into rollkit:main Jan 23, 2024
20 of 21 checks passed
@distractedm1nd distractedm1nd deleted the submit-opts branch January 23, 2024 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add namespace / appID as optional parameter to Submit function
5 participants