Skip to content

refactor: remove go-da + fix golangcilint - #54

Merged
julienrbrt merged 2 commits into
mainfrom
julien/fix-lint-remove-da
Apr 23, 2025
Merged

refactor: remove go-da + fix golangcilint#54
julienrbrt merged 2 commits into
mainfrom
julien/fix-lint-remove-da

Conversation

@julienrbrt

@julienrbrt julienrbrt commented Apr 22, 2025

Copy link
Copy Markdown
Member
  • Removes go-da dependency (and use proxy/jsonrpc)
  • Fix golangci-lint file + run lint fix

Summary by CodeRabbit

  • New Features

    • Added a specific error message for when the transaction gossiper is not ready.
  • Bug Fixes

    • Corrected transaction and data hash assignment in block conversion to ensure proper placement in block structures.
  • Refactor

    • Simplified and updated data availability client integration.
    • Removed a temporary data availability adapter and related methods.
    • Updated dependency versions for improved compatibility.
    • Cleaned up and reorganized import statements across several files.
    • Simplified linting process to focus on Go code only.
  • Style

    • Improved formatting and readability in documentation and code (including whitespace and syntax highlighting).
  • Chores

    • Updated configuration files for linting and formatting tools.

@coderabbitai

coderabbitai Bot commented Apr 22, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This set of changes updates the project’s configuration, dependencies, and code organization. The .golangci.yml linter configuration is migrated to version 2 with a streamlined focus on key linters and formatters. The Makefile’s linting step is simplified to use only golangci-lint. Several Go source files have their import statements reordered for clarity and deduplication. The go.mod file updates dependencies to newer versions and removes an obsolete requirement. A new error variable is introduced in the p2p package. The DA client integration is refactored to use a direct client instead of a temporary adapter, which is deleted. Minor code cleanups and comments are also included.

Changes

File(s) Change Summary
.golangci.yml Migrated to version 2 schema, reorganized linter settings, enabled gci formatter, removed several linters/formatters, and simplified configuration structure.
Makefile Simplified lint target to run only golangci-lint --fix, removing markdown, Dockerfile, and YAML linting.
README.md Improved formatting and whitespace for readability; added newlines and syntax highlighting.
go.mod Updated github.com/rollkit/rollkit and submodules to newer commits; removed explicit github.com/rollkit/go-da requirement.
adapter/adapter.go, adapter/store.go, p2p/gossip.go, rpc/json/handler.go, rpc/json/service.go, rpc/json/ws.go, server/utils.go Reordered import statements for clarity, removed duplicate imports, and made minor whitespace adjustments.
p2p/errors.go Added new file defining var ErrNotReady = errors.New("tx gossiper is not ready").
rpc/rpc.go Cleaned up imports, removed client field from RPCServer, replaced generic error with execp2p.ErrNotReady, updated types in NetInfo, and added comments/TODOs for transaction proof generation.
rpc/utils.go Corrected assignment of transactions and data hash in ToABCIBlock to use correct cmtypes.Block fields.
server/start.go Switched DA client initialization from goda.NewClient to jsonrpc.NewClient, updated error handling, removed DA adapter, and passed DA client directly to rollkitda.NewDAClient.
server/tmp_adapter.go Deleted file; removed the temporary daAdapter type and all methods bridging goda.DA and coreda.DA interfaces.

Sequence Diagram(s)

sequenceDiagram
    participant StartNode
    participant DAClient as jsonrpc.NewClient
    participant RollkitDA as rollkitda.NewDAClient

    StartNode->>DAClient: Initialize DA client (jsonrpc.NewClient)
    DAClient-->>StartNode: Return DA client or error
    StartNode->>RollkitDA: Pass &daClient.DA to NewDAClient
    RollkitDA-->>StartNode: DA integration complete
Loading

Possibly related PRs

  • rollkit/go-execution-abci#41: Updates dependency versions in go.mod for github.com/rollkit/rollkit and submodules, similar to this PR's dependency changes.
  • rollkit/go-execution-abci#46: Reverts a previous dependency bump; both PRs involve dependency management in go.mod.
  • rollkit/go-execution-abci#34: Updates go.mod dependencies including github.com/rollkit/rollkit, related to this PR's updates.

Suggested reviewers

  • tac0turtle
  • facundomedica

Poem

In the warren where the code does hop,
Linters pruned, old adapters drop.
Imports tidied, errors new,
DA client now direct and true.
Dependencies fresh as clover dew—
This bunny’s proud of what we do!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

@julienrbrt
julienrbrt marked this pull request as ready for review April 22, 2025 22:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
p2p/errors.go (1)

1-5: Add package‑level sentinel error
Introducing ErrNotReady provides a clear, reusable sentinel error for the tx gossiper readiness check. Consider adding a Go doc comment above ErrNotReady to satisfy Go’s exported identifier documentation conventions and to explain its intended use.

rpc/rpc.go (2)

604-613: Flag this TODO for future implementation.

The nolint:staticcheck directive is appropriate for now, but make sure to track this TODO to implement transaction proof generation in the future.

Consider adding an issue to track these unimplemented proof functions for future implementation.


681-687: Flag this TODO for future implementation.

Similar to the earlier instance, this nolint:staticcheck directive suppresses warnings about unimplemented proof generation. Consider creating a unified approach to implement both these proofs together.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b6091f and c961903.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (16)
  • .golangci.yml (1 hunks)
  • Makefile (1 hunks)
  • README.md (4 hunks)
  • adapter/adapter.go (1 hunks)
  • adapter/store.go (1 hunks)
  • go.mod (1 hunks)
  • p2p/errors.go (1 hunks)
  • p2p/gossip.go (1 hunks)
  • rpc/json/handler.go (1 hunks)
  • rpc/json/service.go (1 hunks)
  • rpc/json/ws.go (1 hunks)
  • rpc/rpc.go (6 hunks)
  • rpc/utils.go (1 hunks)
  • server/start.go (4 hunks)
  • server/tmp_adapter.go (0 hunks)
  • server/utils.go (1 hunks)
💤 Files with no reviewable changes (1)
  • server/tmp_adapter.go
🧰 Additional context used
🧬 Code Graph Analysis (1)
rpc/rpc.go (1)
p2p/errors.go (1)
  • ErrNotReady (5-5)
🔇 Additional comments (24)
adapter/store.go (1)

10-10: Consistent import grouping
A blank line was added between the proto import and the internal store package to clearly separate third‑party imports from internal imports. This aligns with the project's import grouping conventions.

server/utils.go (1)

10-11: Maintain import grouping consistency
The blank line before the internal config import cleanly separates external dependencies from local packages, improving readability and aligning with the other import reorganizations in this PR.

go.mod (1)

8-10: Update and removal of obsolete dependencies
The module requirements for rollkit, rollkit/core, and rollkit/da have been bumped to the new commit and the go-da requirement has been removed. Please run go mod tidy to ensure there are no leftover references to go-da and that the module graph is clean.

README.md (4)

10-10: Improve list spacing
A blank line was added before the bullet list under “This adapter connects various components…” to enhance readability.


64-64: Enhance section separation
Adding a blank line before the “Dependencies” list visually separates sections and improves markdown structure.


232-232: Specify code block language
Changing the Project Structure snippet to use “```bash” enables proper syntax highlighting in supported renderers.


248-248: Ensure newline at EOF
Adding the missing newline at the end of the file adheres to POSIX text file conventions and avoids potential diffs in future edits.

server/start.go (3)

34-37: Import restructuring improves organization

The imports have been reorganized to replace go-da with direct usage of Rollkit's DA package. This aligns well with the PR objective of removing the go-da dependency.


370-374: DA client initialization simplified

The DA client creation has been refactored to use jsonrpc.NewClient directly instead of using goda.NewClient. The error handling has also been improved with a more descriptive error message.


377-377: Temporary adapter removal

The code no longer uses a temporary adapter between different DA client interfaces. Instead, it directly passes &daClient.DA to the rollkitda.NewDAClient, which simplifies the codebase.

.golangci.yml (3)

1-1: Updated golangci-lint to version 2

The configuration now explicitly specifies version "2", which aligns with current golangci-lint standards.


7-17: Improved linter configuration structure

The revive linter rules are now properly organized under linters.settings, which follows the correct structure for golangci-lint v2.


18-32: Added formatter configurations

The addition of the gci formatter and specific configurations for both goimports and gci will ensure consistent code formatting, particularly for import organization.

The defined sections and custom ordering for imports will create a standardized pattern:

  1. Standard library imports
  2. External dependencies
  3. Rollkit-specific imports
  4. Project-specific imports
Makefile (1)

39-39: Simplified linting process

The lint target now only runs golangci-lint run --fix, which streamlines the linting process. This change aligns with the updated golangci-lint configuration.

Note that markdown linting is still available in the separate fmt target, while the automated workflow now focuses on Go code linting and fixing.

p2p/gossip.go (1)

3-11: Import statement reordering

The import of cosmossdk.io/log has been moved above the libp2p-related imports, which improves code organization. This is a minor change that follows standard Go code style practices.

rpc/json/ws.go (1)

8-8: Import reorganization looks good.

The import statement for the log package has been moved to improve organization.

rpc/json/service.go (1)

13-13: Import cleanup looks good.

The log package import has been moved up to be grouped with other imports, removing a duplicate import.

rpc/json/handler.go (1)

15-15: Import reorganization looks good.

The log package import has been moved to a better position for consistency with other files.

adapter/adapter.go (1)

12-13: Import cleanup looks good.

The imports have been reorganized, improving code organization and removing duplicate imports.

Also applies to: 22-23

rpc/utils.go (1)

102-106: Fix for transaction and data hash assignment.

The changes correctly assign transactions to abciBlock.Txs instead of abciBlock.Data.Txs and the data hash to abciBlock.DataHash instead of abciBlock.Header.DataHash, which aligns with the proper structure of the cmtypes.Block type.

This fixes potential issues with data not being stored in the expected fields.

rpc/rpc.go (4)

13-38: Import organization looks clean and clear.

Nice job organizing and grouping the imports properly. The separation between standard library imports, third-party libraries, and internal packages improves readability.


515-515: Good use of centralized error constant.

Replacing the hardcoded error with the predefined execp2p.ErrNotReady constant from p2p/errors.go improves code maintainability and consistency.


721-721: Good variable scope limitation.

Limiting the scope of the end variable to the pagination block is a good practice. It prevents variable leakage and potential bugs.


869-871: Clean package-level adjustment for peer info.

Updated to use p2p.DefaultNodeInfo instead of the previous type, maintaining consistent usage of the p2p package throughout the codebase.

@julienrbrt
julienrbrt requested a review from tac0turtle April 22, 2025 22:32
@julienrbrt
julienrbrt merged commit d40c982 into main Apr 23, 2025
@julienrbrt
julienrbrt deleted the julien/fix-lint-remove-da branch April 23, 2025 06:53
@github-project-automation github-project-automation Bot moved this to Done in Evolve Apr 23, 2025
@tac0turtle tac0turtle removed this from Evolve Apr 24, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Apr 28, 2025
@coderabbitai coderabbitai Bot mentioned this pull request May 6, 2025
chatton pushed a commit that referenced this pull request Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants