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: add SubmitWithOptions method to the API #95

Merged
merged 4 commits into from
Sep 17, 2024
Merged

Conversation

tzdybal
Copy link
Member

@tzdybal tzdybal commented Sep 9, 2024

Overview

Resolves #93

Summary by CodeRabbit

  • New Features

    • Introduced a new method, SubmitWithOptions, allowing users to submit blobs with additional options.
    • Enhanced the SubmitRequest message to include an optional field for extra configuration data.
  • Bug Fixes

    • Updated the existing Submit method to accommodate the new options parameter, improving its functionality.

@tzdybal tzdybal added the enhancement New feature or request label Sep 9, 2024
@tzdybal tzdybal requested review from tuxcanfly and a team September 9, 2024 13:49
@tzdybal tzdybal self-assigned this Sep 9, 2024
@tzdybal tzdybal requested review from yarikbratashchuk and MSevey and removed request for a team September 9, 2024 13:49
Copy link

coderabbitai bot commented Sep 9, 2024

Walkthrough

The pull request introduces a new method, SubmitWithOptions, across multiple files to enhance the Data Availability (DA) interface and its implementations. This method allows the submission of blobs with additional options specified as a byte slice. The existing Submit method is modified to accommodate these changes. Updates include changes to the Protocol Buffers definition and client implementations, supporting more flexible configurations for blob submissions.

Changes

Files Change Summary
da.go, proto/da/da.proto Added SubmitWithOptions method to the DA interface and modified the Submit method. Added bytes options to SubmitRequest message.
proxy/grpc/client.go, proxy/jsonrpc/client.go Introduced SubmitWithOptions method to Client and API structs to support blob submission with options.
test/dummy.go, test/test_suite.go Added SubmitWithOptions method to DummyDA struct and modified the Submit method. Updated tests to call SubmitWithOptions.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant DA
    participant gRPC
    participant JSONRPC

    Client->>DA: SubmitWithOptions(blobs, gasPrice, namespace, options)
    DA->>gRPC: Send SubmitRequest(blobs, gasPrice, namespace, options)
    gRPC-->>DA: Response with IDs
    DA-->>Client: Return IDs
Loading

Assessment against linked issues

Objective Addressed Explanation
Enable submission of blobs with additional options (#[93])
Support multi-account functionality by allowing key specification (#[93]) The implementation does not directly address key specification in the options.

Poem

🐰 In the meadow where options bloom,
New methods sprout, dispelling gloom.
SubmitWithOptions hops along,
With blobs and choices, it sings a song.
A dance of data, bright and free,
In the world of DA, joyfully! 🌼

Tip

OpenAI O1 model for chat
  • We have deployed OpenAI's latest O1 model for chat.
  • OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model.
  • Please share any feedback with us in the discussions post.

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 testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@RollkitBot RollkitBot requested a review from a team September 9, 2024 13:50
@tzdybal tzdybal mentioned this pull request Sep 9, 2024
5 tasks
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.

Actionable comments posted: 3

Outside diff range, codebase verification and nitpick comments (2)
da.go (1)

31-35: Approve the addition of SubmitWithOptions method.

The method SubmitWithOptions has been correctly added to the DA interface, aligning with the PR objectives to enhance flexibility for multi-account support. The method signature is consistent and clear.

However, consider using a more structured type than []byte for options to improve type safety and clarity on what the options can include, such as using a struct or predefined constants.

proxy/jsonrpc/client.go (1)

69-72: Approve the addition of SubmitWithOptions.

The implementation of SubmitWithOptions in the API struct is straightforward and aligns with the PR's objectives to enhance flexibility. Consider adding more detailed documentation or examples in the code comments to illustrate how clients can utilize this new method effectively.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2dafc50 and e1830d7.

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 (1 hunks)
  • proxy/grpc/client.go (1 hunks)
  • proxy/jsonrpc/client.go (2 hunks)
  • test/dummy.go (1 hunks)
  • test/test_suite.go (1 hunks)
Additional context used
golangci-lint
test/dummy.go

[warning] 135-135: exported: exported method DummyDA.SubmitWithOptions should have comment or be unexported

(revive)

GitHub Check: lint / golangci-lint
test/dummy.go

[failure] 135-135:
exported: exported method DummyDA.SubmitWithOptions should have comment or be unexported (revive)

Additional comments not posted (1)
proto/da/da.proto (1)

111-111: Approve the addition of options field with a note on compatibility.

The addition of the options field to the SubmitRequest message is a good enhancement, aligning with the PR objectives to allow for more flexible submissions.

However, please verify the use of optional in proto3, as it requires field presence to be enabled in the protobuf version used. If not supported, consider using a default value or a wrapper type.

@tzdybal tzdybal enabled auto-merge September 10, 2024 12:09
@tzdybal tzdybal marked this pull request as draft September 10, 2024 12:21
auto-merge was automatically disabled September 10, 2024 12:21

Pull request was converted to draft

This commit introduces a new method `SubmitWithOptions` for submitting blobs with additional options.
@tzdybal tzdybal marked this pull request as ready for review September 13, 2024 08:49
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.

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
proxy/grpc/server.go (1)

72-72: Update the method documentation.

Consider adding a TODO comment to update the Submit method documentation to reflect the new behavior and the additional options parameter.

+// TODO: Update the method documentation to reflect the new behavior and the additional `options` parameter.
 func (p *proxySrv) Submit(ctx context.Context, request *pbda.SubmitRequest) (*pbda.SubmitResponse, error) {
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 581f23e and 4521f9a.

Files ignored due to path filters (1)
  • types/pb/da/da.pb.go is excluded by !**/*.pb.go
Files selected for processing (7)
  • da.go (1 hunks)
  • proto/da/da.proto (1 hunks)
  • proxy/grpc/client.go (1 hunks)
  • proxy/grpc/server.go (1 hunks)
  • proxy/jsonrpc/client.go (2 hunks)
  • test/dummy.go (1 hunks)
  • test/test_suite.go (1 hunks)
Files skipped from review as they are similar to previous changes (5)
  • da.go
  • proxy/grpc/client.go
  • proxy/jsonrpc/client.go
  • test/dummy.go
  • test/test_suite.go
Additional comments not posted (2)
proxy/grpc/server.go (1)

72-72: Verify the implementation of the SubmitWithOptions method.

The change to call the SubmitWithOptions method aligns with the PR objective of supporting multi-account scenarios. However, it's important to verify the implementation and behavior of this new method.

Run the following script to verify the SubmitWithOptions method:

Verification successful

The SubmitWithOptions method is correctly implemented and used.

The verification process confirms that the SubmitWithOptions method is properly defined in the da package interface and consistently implemented across the codebase. The change in proxy/grpc/server.go correctly calls this method with all required parameters, including the new request.Options. The method is also being used in test files, which helps ensure its correct behavior.

While the DummyDA implementation ignores the options parameter, this is acceptable for a test implementation. However, it's worth noting that real implementations should make proper use of this parameter to support multi-account scenarios as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of the `SubmitWithOptions` method.

# Test: Search for the method declaration. Expect: The method should be defined in the `da` package.
rg --type go $'func \(d \*[a-zA-Z]+\) SubmitWithOptions\('

# Test: Search for the method usage. Expect: The method should be called with the correct parameters.
rg --type go -A 5 $'SubmitWithOptions\('

Length of output: 2686

proto/da/da.proto (1)

111-111: LGTM!

The addition of the bytes options field to the SubmitRequest message aligns with the PR objective of introducing a new method called SubmitWithOptions to enable users to pass additional options, including key names. The bytes type is a generic type that can be used to pass various options, which is one of the potential solutions outlined in the linked issue. The field name options clearly conveys its purpose of carrying optional data, and the field number 4 follows the existing field numbering sequence in the message.

@tzdybal tzdybal enabled auto-merge September 13, 2024 11:25
Copy link
Contributor

@yarikbratashchuk yarikbratashchuk left a comment

Choose a reason for hiding this comment

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

Looks alright to me

@gupadhyaya gupadhyaya self-requested a review September 17, 2024 11:25
@tzdybal tzdybal added this pull request to the merge queue Sep 17, 2024
Merged via the queue into main with commit f10ca0b Sep 17, 2024
14 checks passed
@tzdybal tzdybal deleted the tzdybal/new_api branch September 17, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Enable go-da to utilize multi accounts support from celestia-node
4 participants