Skip to content

feat: Fee granting [WiP]#412

Closed
MissingNO57 wants to merge 8 commits into
mainfrom
feat/fee_grant
Closed

feat: Fee granting [WiP]#412
MissingNO57 wants to merge 8 commits into
mainfrom
feat/fee_grant

Conversation

@MissingNO57

Copy link
Copy Markdown
Contributor

Proposed Changes

[describe the changes here...]

Linked Issues

[if applicable, add links to issues resolved by this PR]

Types of changes

What type of change does this pull request make (put an x in the boxes that apply)?

  • Bug fix (non-breaking change that fixes an issue).
  • New feature added (non-breaking change that adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to stop working as expected).
  • Documentation update.
  • Something else (e.g., tests, scripts, example, deployment, infrastructure).

Checklist

Put an x in the boxes that apply:

  • I have read the CONTRIBUTING guide
  • Checks and tests pass locally

If applicable

  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that code coverage does not decrease
  • I have added/updated the documentation

Further comments

[if this is a relatively large or complex change, kick off a discussion by explaining why you chose the solution you did, what alternatives you considered, etc...]

@MissingNO57 MissingNO57 requested review from jrriehl and pbukva as code owners May 8, 2025 13:16

@jrriehl jrriehl 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.

LGTM, although it would probably make sense to include these in some test cases.

@github-actions

github-actions Bot commented May 9, 2025

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 1a0e099):

https://fetch-docs-preview--pr412-feat-fee-grant-wpthqm1d.web.app

(expires Sun, 11 May 2025 11:53:24 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f2de39fd4e81249941960b74fbab0a62d90d69f8

Comment thread cosmpy/aerial/client/utils.py Outdated
Fee(
amount=parse_coins(amount),
gas_limit=gas_limit,
granter=granter,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

granter can be None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will have to double check this, it was None in previous implementation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Granter is the external wallet with funds, so payer can be None. Payer is namedgrantee in newer verision of CosmosSDK.

Comment thread cosmpy/aerial/client/utils.py Outdated
return (
Fee(
amount=parse_coins(amount),
gas_limit=gas_limit,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gas_limit can be None
previous code was gracefully handling None case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've reworked the code, it is much cleaner now and fixes that problem.

amount: Optional[str] = None,
gas_limit: Optional[int] = None,
granter: Optional[Address] = None,
account: Optional["Account"] = None, # type: ignore # noqa: F821

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question out of ignorance: what is the difference between account and sender? Thanks
I can see below that account can be set from sender

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Account carries sequence and account_id and needs to be queried from node, that's why I am avoiding to re-query it.

Comment thread cosmpy/aerial/client/utils.py Outdated
granter=granter,
payer=sender.address(),
),
account,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is it ok for the account inside the Fee to be None?
Otherwise, I can see that the account for signing transaction will be set correctly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like previously it was None, I think this would apply only for multi-msg transactions from different wallets where you need to specify which wallet will be paying.

@MissingNO57

Copy link
Copy Markdown
Contributor Author

Closed in favour of #413

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