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 Infinite Feegrant Bug #16097

Merged
merged 2 commits into from
May 11, 2023

Conversation

assafmo
Copy link
Contributor

@assafmo assafmo commented May 11, 2023

Description

EDIT: Fix the bug. The internal allowance update was never propagated to the parent AllowedMsgAllowance.

This test is designed to reproduce an infinite Feegrant bug that occurs when using AllowedMsgAllowance with an internal BasicAllowance.

I suspect that this line does not update the internal BasicAllowance after using part of the grant. This may be related to this line as well.

Thanks @DrPresident from Shade Protocol for initially reporting this issue.


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
  • added ! to 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
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • 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.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

This test is designed to reproduce an infinite Feegrant bug that occurs when using AllowedMsgAllowance with an internal BasicAllowance.

I suspect that this line (https://github.com/scrtlabs/cosmos-sdk/blob/61091b357e/x/feegrant/basic_fee.go#L31) does not update the internal BasicAllowance after using part of the grant. This may be related to this line (https://github.com/scrtlabs/cosmos-sdk/blob/61091b357e/x/feegrant/filtered_fee.go#L47) as well.
The internal allowance update in AllowedMsgAllowance was never propagated to the parent AllowedMsgAllowance.
@assafmo assafmo changed the title Infinite feegrant bug test Fix Infinite Feegrant Bug May 11, 2023
@assafmo
Copy link
Contributor Author

assafmo commented May 11, 2023

Now that I'm checking, looks like it's fixed in v0.46 (PR, code).

@julienrbrt
Copy link
Member

julienrbrt commented May 11, 2023

What is the impact of such bug? Given that v0.45.x is EOL, only security fixes are included in this branch.
edit: nvm, I see.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

LGTM.

nit: Changelog pls 🙏

@julienrbrt
Copy link
Member

I'll update the changelog when making the release notes, merging now, so we can prepare the release.

@julienrbrt julienrbrt merged commit d3370f2 into cosmos:release/v0.45.x May 11, 2023
@assafmo
Copy link
Contributor Author

assafmo commented May 11, 2023

LGTM.

nit: Changelog pls pray

Sorry, next time! 😬

@assafmo assafmo deleted the infinite-feegrant-bug branch May 11, 2023 18:05
@assafmo assafmo restored the infinite-feegrant-bug branch May 11, 2023 18:06
crypin pushed a commit to crescent-network/cosmos-sdk that referenced this pull request Jun 8, 2023
(cherry picked from commit d3370f2)
(cherry picked from commit 5b1bd64aaad9a679d5bc3d63f0770a4c64781cf5)
JeancarloBarrios pushed a commit to agoric-labs/cosmos-sdk that referenced this pull request Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants