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

docs(client): Update setFeeGranter and setFeePayer comments #22526

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

ziscky
Copy link
Contributor

@ziscky ziscky commented Nov 14, 2024

Description

Closes: #18886

See: #22311


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features
    • Introduced methods to specify the fee payer and fee granter for transactions, enhancing fee management capabilities.

Copy link
Contributor

coderabbitai bot commented Nov 14, 2024

📝 Walkthrough

Walkthrough

The pull request introduces two new methods to the TxBuilder interface in the client/tx_config.go file. The SetFeePayer method allows specifying the address responsible for paying transaction fees, while the SetFeeGranter method enables setting an address for a fee granter, who can pay fees on behalf of another account. Both methods clarify the signing requirements for transactions involving these addresses.

Changes

File Change Summary
client/tx_config.go Added SetFeePayer(feePayer sdk.AccAddress) and SetFeeGranter(feeGranter sdk.AccAddress) methods to the TxBuilder interface.

Assessment against linked issues

Objective Addressed Explanation
Clarification on SetFeePayer vs SetFeeGranter (18886)

Possibly related PRs

  • fix(x/tx): add feePayer as signer #22311: This PR directly relates to the main PR as it also involves the feePayer concept, specifically ensuring that the fee payer must sign the transaction, which aligns with the new methods added in the main PR for managing fee responsibilities.

Suggested labels

C:x/feegrant, C:x/tx

Suggested reviewers

  • julienrbrt
  • akhilkumarpilli
  • tac0turtle
  • testinginprod

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.

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.

@github-actions github-actions bot added the C:CLI label Nov 14, 2024
@ziscky ziscky marked this pull request as ready for review November 14, 2024 11:00
@ziscky ziscky requested review from julienrbrt, JulianToledano and a team as code owners November 14, 2024 11:00
Copy link
Contributor

@ziscky your pull request is missing a changelog!

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

Those are private methods, so it doesn't really makes sense imho to add it there. Why not directly in the client package?

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
client/tx_config.go (1)

50-52: Documentation looks good, but could be even more explicit

The documentation clearly states the purpose and signing requirement. However, to fully address the confusion mentioned in issue #18886, consider adding a brief example use case.

Consider expanding the documentation like this:

 // SetFeePayer sets the address of who will pay the fees for this transaction.
-// Note: The fee payer must sign the transaction in addition to any other required signers.
+// Note: The fee payer must sign the transaction in addition to any other required signers.
+// Use this when you want an account to directly pay for transaction fees, rather than
+// using the feegrant module for fee delegation.
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e74799e and f1e71d4.

📒 Files selected for processing (1)
  • client/tx_config.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
client/tx_config.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (2)
client/tx_config.go (2)

57-61: Excellent documentation that addresses the core issue

The documentation perfectly clarifies the fee granter's role and its relationship with the feegrant module. It explicitly addresses the distinction from the fee payer role and clearly states the signing requirements, which directly resolves the confusion raised in issue #18886.


50-61: Verify interface implementation consistency

Let's ensure all transaction builders implement these methods consistently.

✅ Verification successful

Based on the search results, I can now provide a final response:

Interface implementations are consistent across the codebase

The codebase shows consistent implementation of SetFeePayer and SetFeeGranter methods:

  • Main implementation in x/auth/tx/builder.go properly sets the fee payer and granter addresses
  • Legacy implementation in x/auth/migrations/legacytx/stdtx_builder.go explicitly handles backward compatibility
  • Usage patterns in CLI commands and tests demonstrate consistent behavior
  • All implementations follow the interface contract defined in client/tx_config.go
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all implementations of TxBuilder interface to verify consistent implementation
# of SetFeePayer and SetFeeGranter methods

# Search for TxBuilder implementations
ast-grep --pattern 'type $_ struct {
  $$$
}

func ($_ $_) SetFeePayer(feePayer sdk.AccAddress) {
  $$$
}'

# Also search for any existing usage patterns
rg "SetFeePayer|SetFeeGranter" -A 3 -B 3

Length of output: 5136

@julienrbrt julienrbrt changed the title feat(client): Update setFeeGranter and setFeePayer comments docs(client): Update setFeeGranter and setFeePayer comments Nov 20, 2024
@julienrbrt julienrbrt added backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release and removed backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release labels Nov 20, 2024
@julienrbrt julienrbrt enabled auto-merge November 20, 2024 08:42
@julienrbrt julienrbrt added this pull request to the merge queue Nov 20, 2024
Merged via the queue into main with commit 6351dc3 Nov 20, 2024
77 of 78 checks passed
@julienrbrt julienrbrt deleted the ziscky/18886-fee-payer-granter-doc branch November 20, 2024 10:25
mergify bot pushed a commit that referenced this pull request Nov 20, 2024
julienrbrt pushed a commit that referenced this pull request Nov 20, 2024
alpe added a commit that referenced this pull request Nov 21, 2024
* main:
  build(deps): Bump cosmossdk.io/math from 1.3.0 to 1.4.0 (#22580)
  fix(server/v2/api/telemetry): enable global metrics  (#22571)
  refactor(server/v2/cometbft): add `codec.Codec` and clean-up APIs (#22566)
  feat(core/coretesting): make memDB satisfy db.Db interface (#22570)
  Merge commit from fork
  fix(server(/v2)): fix fallback genesis path (#22564)
  fix: only overwrite context chainID when necessary (#22568)
  docs(client): Update setFeeGranter and setFeePayer comments (#22526)
  fix(baseapp): populate header info in `NewUncachedContext` (#22557)
  build(deps): Bump buf.build/gen/go/cometbft/cometbft/protocolbuffers/go from 1.35.1-20240701160653-fedbb9acfd2f.1 to 1.35.2-20240701160653-fedbb9acfd2f.1 in /api (#22551)
  build(deps): Bump github.com/creachadair/atomicfile from 0.3.5 to 0.3.6 in /tools/confix (#22552)
  docs: Update reference of Approximation (#22550)
  fix(server/v2/comebft): wire missing services + fix simulation (#21964)
  ci: fix permissions for GITHUB_TOKEN on dependabot workflows (#22547)
  ci: fix permissions for GITHUB_TOKEN in spell check workflow (#22545)
  build(deps): Bump google.golang.org/protobuf from 1.35.1 to 1.35.2 (#22537)
  fix(cosmovisor): premature upgrade on restart (#22528)
  fix(store/v2/pebble): handle version 0 in keys (#22524)
  refactor(server/v2/telemetry): swap redirects (#22520)
  docs: Update content in  CODE_OF_CONDUCT.md (#22518)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release C:CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarification on SetFeePayer vs SetFeeGranter
3 participants