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

fix(da): update to go-da v0.4.0; add namespace flag #1542

Merged
merged 8 commits into from
Feb 15, 2024

Conversation

tuxcanfly
Copy link
Contributor

@tuxcanfly tuxcanfly commented Feb 12, 2024

Overview

This PR updates go-da to v0.4.0; since it requires namespace to be passed to methods, a namespace flag is added.

This makes rollkit compatible with celestia-da v0.13.0 which also integrates go-da v0.4.0.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

Summary by CodeRabbit

  • New Features
    • Introduced a new configuration flag for specifying a namespace in Rollkit node configurations, enhancing the flexibility and control over data access and manipulation.
  • Enhancements
    • Updated default configuration values for better alignment and usability.
    • Enhanced data access client functionality by incorporating namespace support, allowing for more targeted data operations.
  • Tests
    • Expanded testing to cover new namespace functionality, ensuring robustness and reliability of the feature.

Copy link
Contributor

coderabbitai bot commented Feb 12, 2024

Walkthrough

The recent update introduces a new configuration parameter, flagDANamespace, to the Rollkit node configuration, enhancing namespace support within the DAClient and node initialization processes. This addition allows for more precise data access and manipulation by including a namespace field across various structures and methods, ensuring better organized and more secure data handling within decentralized applications.

Changes

Files Change Summary
config/config.go Added flagDANamespace and DANamespace to NodeConfig. Updated GetViperConfig and AddFlags.
config/defaults.go Set default DANamespace, reordered DAAddress and DAGasPrice.
da/da.go, da/da_test.go Updated DAClient and MockDA to include Namespace. Modified method parameters and returns.
node/full.go, .../helpers_test.go Added namespace decoding functionality.
node/..._test.go, rpc/json/helpers_test.go Updated tests and setups with DANamespace.

A whimsical ode by a digital hare,
To celebrate code that's both fair and square.
🎩🐰
"In the realm of code, where data flies,
A namespace now neatly lies.
With a hop, skip, and a digital leap,
Secure and organized, our blocks we keep."
🚀🌌

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.

@tuxcanfly tuxcanfly marked this pull request as ready for review February 13, 2024 14:19
Copy link
Contributor

@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: 6

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b5c85d1 and 34782ba.
Files ignored due to path filters (2)
  • go.mod is excluded by: !**/*.mod
  • go.sum is excluded by: !**/*.sum
Files selected for processing (11)
  • config/config.go (4 hunks)
  • config/defaults.go (1 hunks)
  • da/da.go (4 hunks)
  • da/da_test.go (1 hunks)
  • node/full.go (2 hunks)
  • node/full_client_test.go (7 hunks)
  • node/full_node_integration_test.go (5 hunks)
  • node/full_node_test.go (1 hunks)
  • node/helpers_test.go (3 hunks)
  • node/node_test.go (2 hunks)
  • rpc/json/helpers_test.go (2 hunks)
Additional comments: 26
node/helpers_test.go (1)
  • 21-25: The implementation of hex decoding in getMockDA correctly handles the conversion of MockNamespace to a byte slice. However, ensure that MockNamespace is always a valid hex string to prevent runtime errors during tests.
node/node_test.go (2)
  • 21-21: The addition of MockNamespace as a global variable is appropriate for testing the namespace functionality. Ensure that its value aligns with expected formats and use cases in tests.
  • 50-50: The inclusion of DANamespace: MockNamespace in the config declaration within newTestNode correctly integrates the namespace into node configuration for tests. This change is consistent with the PR objectives.
rpc/json/helpers_test.go (2)
  • 35-35: The introduction of MockNamespace with the value "deadbeef" for RPC testing is appropriate. Ensure that this mock value is suitable for all test scenarios where a namespace is required.
  • 82-82: Updating the NewNode function call to include DANamespace: MockNamespace correctly integrates the namespace into the node configuration for RPC tests. This ensures that the namespace functionality is adequately tested in RPC scenarios.
config/config.go (4)
  • 22-22: The introduction of flagDANamespace as a constant for the namespace configuration flag is correctly implemented. This constant is essential for consistent flag usage across the configuration handling.
  • 41-41: Adding DANamespace to the NodeConfig struct is appropriate for storing the namespace configuration. This addition is crucial for integrating the namespace functionality into the node's configuration.
  • 99-99: The update to GetViperConfig to read the namespace configuration from Viper using flagDANamespace is correctly implemented. This ensures that the namespace configuration can be loaded from external configuration sources.
  • 114-114: The addition of the namespace configuration flag to the command-line interface in AddFlags using flagDANamespace is correctly implemented. This allows users to specify the namespace configuration via command-line flags.
da/da.go (4)
  • 78-81: The addition of the Namespace field to the DAClient struct is correctly implemented. This field is essential for storing the namespace configuration and using it in DA operations.
  • 126-126: Passing dac.Namespace as an additional parameter in the Submit method call is correctly implemented. This ensures that the namespace is utilized in block submission operations.
  • 156-156: Passing dac.Namespace as an additional parameter in the GetIDs method call is correctly implemented. This ensures that the namespace is utilized in block retrieval operations.
  • 178-178: Passing dac.Namespace as an additional parameter in the Get method call is correctly implemented. This ensures that the namespace is utilized in blob retrieval operations.
node/full_node_test.go (1)
  • 114-114: Modifying the getMockDA function call to include the t parameter in TestInvalidBlocksIgnored is correctly implemented. This adjustment likely improves error handling or logging within the test setup.
da/da_test.go (5)
  • 54-54: Adding the ns da.Namespace parameter to the Get method in the MockDA struct is correctly implemented. This change is necessary for testing the namespace functionality in data retrieval operations.
  • 59-59: Adding the ns da.Namespace parameter to the GetIDs method in the MockDA struct is correctly implemented. This change is necessary for testing the namespace functionality in ID retrieval operations.
  • 64-64: Adding the ns da.Namespace parameter to the Commit method in the MockDA struct is correctly implemented. This change is necessary for testing the namespace functionality in commit operations.
  • 69-75: Updating the Submit method in the MockDA struct to include the ns da.Namespace parameter and changing its return type to only include []da.ID and an error is correctly implemented. This aligns with the updated interface for the Submit method, focusing on ID return values.
  • 79-84: Adding the ns da.Namespace parameter to the GetProofs and Validate methods in the MockDA struct is correctly implemented. These changes are necessary for testing the namespace functionality in proof retrieval and validation operations.
node/full_node_integration_test.go (5)
  • 62-62: The MockNamespace variable used as the DANamespace parameter is not defined within this file. Ensure it is properly defined and accessible in the test context.
  • 187-187: Similar to the previous comment, verify that MockNamespace is appropriately defined and accessible for use as the DANamespace parameter in the NewNode function call.
  • 545-545: In the testSingleAggregatorSingleFullNodeSingleLightNode function, the getMockDA function is called but not defined within this file. Ensure that this function is correctly implemented and accessible in the test context.
  • 642-642: The getMockDA function is called again without being defined in this file. Verify its implementation and accessibility.
  • 710-710: Ensure that MockNamespace is defined and accessible for use in the NewNode function call within the createNode function.
node/full_client_test.go (2)
  • 181-181: The addition of DANamespace in the NodeConfig struct is consistent with the PR objectives. However, verify that MockNamespace is appropriately defined and represents a realistic namespace value for testing.
  • 933-934: The configuration of DANamespace in NodeConfig is appropriate for the test context. Double-check that the namespace used here does not conflict with namespaces used in parallel tests or requires specific setup in the mock environment.

node/full.go Outdated Show resolved Hide resolved
node/full_client_test.go Show resolved Hide resolved
node/full_client_test.go Show resolved Hide resolved
node/full_client_test.go Show resolved Hide resolved
node/full_client_test.go Show resolved Hide resolved
config/defaults.go Outdated Show resolved Hide resolved
Copy link
Contributor

@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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 34782ba and cba6ccd.
Files selected for processing (1)
  • node/full.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • node/full.go

Copy link
Contributor

@MSevey MSevey left a comment

Choose a reason for hiding this comment

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

utack

@MSevey MSevey added this pull request to the merge queue Feb 15, 2024
Merged via the queue into main with commit 013a055 Feb 15, 2024
17 checks passed
@MSevey MSevey deleted the tux/celestia-node-v0.13.0 branch February 15, 2024 08:51
@tuxcanfly tuxcanfly restored the tux/celestia-node-v0.13.0 branch February 27, 2024 18:31
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.

None yet

4 participants