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: improve tooling, include ledger build flag #418

Merged
merged 5 commits into from
Nov 1, 2024
Merged

Conversation

boojamya
Copy link
Member

@boojamya boojamya commented Oct 29, 2024

This PR:

  • adds ledger support and checks to ensure that ledger is supported given the users build environment
  • adds the netgo build flag which helps with static builds of Noble
  • simplifies version

@boojamya boojamya requested a review from a team as a code owner October 29, 2024 17:11
Copy link

coderabbitai bot commented Oct 29, 2024

Warning

Rate limit exceeded

@johnletey has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8bc7a3f and 892f072.

Walkthrough

The Makefile has been updated to introduce a new versioning mechanism and conditional build tags for ledger support. A new variable VERSION captures the current version from git tags, while LEDGER_ENABLED is introduced to control the inclusion of ledger support. The logic for determining VERSION has been streamlined, and the build tags are processed conditionally based on the LEDGER_ENABLED variable. Adjustments have been made to the ldflags and BUILD_FLAGS variables to incorporate these changes during the build process.

Changes

File Change Summary
Makefile Introduced VERSION and LEDGER_ENABLED variables; updated ldflags to include -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"; modified BUILD_FLAGS to include -tags "$(build_tags)".

Poem

In the garden where we play,
A new tag joins the fray,
With ledger now in sight,
Our builds will shine so bright!
Hop along, let’s celebrate,
Changes made, oh, isn’t it great? 🐇✨


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>, 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 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.

Co-authored-by: John Letey <john@noble.xyz>
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: 1

🧹 Outside diff range and nitpick comments (1)
Makefile (1)

19-20: LGTM with suggestions for improvement.

While adding the ledger build tag is correct, consider making it more flexible and complete:

  1. The ledger tag could be made configurable through a variable
  2. Ledger support typically requires additional build tags for proper functionality

Consider this improvement:

+# Default to ledger support, can be disabled by setting LEDGER_ENABLED=false
+LEDGER_ENABLED ?= true
+
 ldflags := $(LDFLAGS)
 ldflags += -X github.com/cosmos/cosmos-sdk/version.Name=Noble \
 	-X github.com/cosmos/cosmos-sdk/version.AppName=nobled \
 	-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
 	-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-	-X github.com/cosmos/cosmos-sdk/version.BuildTags='ledger'
+	-X github.com/cosmos/cosmos-sdk/version.BuildTags=$(if $(filter true,$(LEDGER_ENABLED)),'ledger','')
 
 BUILD_FLAGS := -ldflags '$(ldflags)'
+BUILD_TAGS := $(if $(filter true,$(LEDGER_ENABLED)),ledger,)
+
+BUILD_FLAGS += $(if $(BUILD_TAGS),-tags $(BUILD_TAGS),)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7d282f5 and b65b66a.

📒 Files selected for processing (1)
  • Makefile (1 hunks)

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@boojamya boojamya marked this pull request as draft October 30, 2024 23:32
@boojamya boojamya changed the title feat: add ledger build flag feat: update makefile, ledger support Oct 31, 2024
@boojamya boojamya marked this pull request as ready for review October 31, 2024 23:48
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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b65b66a and 8bc7a3f.

📒 Files selected for processing (1)
  • Makefile (3 hunks)
🔇 Additional comments (3)
Makefile (3)

6-7: LGTM: netgo flag added as requested

The addition of the netgo build tag addresses the previous feedback and will enable static builds.


57-57: LGTM: Consistent use of BUILD_FLAGS

The build command correctly uses the configured BUILD_FLAGS with all the new tags and ldflags.


8-28: Enhance ledger support verification

While the gcc detection is more robust now, additional checks might be needed for a complete ledger support verification:

  1. Required header files (like usb.h)
  2. USB library dependencies
  3. Proper udev rules on Linux systems

Let's verify the current ledger implementation:

Consider adding a make ledger-deps target that verifies and installs all required dependencies for ledger support.

Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
@johnletey johnletey changed the title feat: update makefile, ledger support feat: improve tooling, include ledger build flag Nov 1, 2024
@johnletey johnletey merged commit 9946d6b into main Nov 1, 2024
35 checks passed
@johnletey johnletey deleted the dan/ledger-flag branch November 1, 2024 11:02
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.

2 participants