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!: bypass-min-fee migration #2352

Merged
merged 70 commits into from
May 17, 2023
Merged

feat!: bypass-min-fee migration #2352

merged 70 commits into from
May 17, 2023

Conversation

yaruwangway
Copy link
Contributor

@yaruwangway yaruwangway commented Apr 3, 2023

Description

Create v10 upgrade handler and migration scripts adding bypass-min-fee-msg-types and MaxBypassMinFeeMsgGasUsage to the global fee module params.

  • query the params, chain inited by gaiad v9:
    gaiad q globalfee minimum-gas-prices
    curl http://localhost:1317/gaia/globalfee/v1beta1/minimum_gas_prices

  • query the params, chain inited by gaiad v10:

gaiad q globalfee params 

bypass_min_fee_msg_types:
- /ibc.core.channel.v1.MsgRecvPacket
- /ibc.core.channel.v1.MsgAcknowledgement
- /ibc.core.client.v1.MsgUpdateClient
- /ibc.core.channel.v1.MsgTimeout
- /ibc.core.channel.v1.MsgTimeoutOnClose
max_total_bypass_min_fee_msg_gas_usage: "1000000"
minimum_gas_prices:
- amount: ""
curl http://localhost:1317/gaia/globalfee/v1beta1/params
{
  "params": {
    "minimum_gas_prices": [
      {
        "denom": "stake",
        "amount": "0.002000000000000000"
      }
    ],
    "bypass_min_fee_msg_types": [
      "/ibc.core.channel.v1.MsgRecvPacket",
      "/ibc.core.channel.v1.MsgAcknowledgement",
      "/ibc.core.client.v1.MsgUpdateClient",
      "/ibc.core.channel.v1.MsgTimeout",
      "/ibc.core.channel.v1.MsgTimeoutOnClose"
    ],
    "max_total_bypass_min_fee_msg_gas_usage": "1000000"
  }
}%

This PR partially closes #2366 and closes #2457.


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 SDK 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

CHANGELOG.md Outdated
@@ -35,6 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
# Changelog

## [Unreleased]
* Add `bypass-min-fee-msg-types` and `maxTotalBypassMinFeeMsgGagUsage` to globalfee params (state breaking and API breaking!!!).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

add issue and pr link here

x/globalfee/types/params.go Outdated Show resolved Hide resolved
x/globalfee/migrations/v2/migration_test.go Outdated Show resolved Hide resolved
@yaruwangway yaruwangway changed the title bypass-min-fee migration feat: !(state-breaking) bypass-min-fee migration Apr 6, 2023
@yaruwangway yaruwangway marked this pull request as ready for review May 12, 2023 13:34
Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

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

Great work. Just some nits.

tests/e2e/query.go Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
contrib/single-node.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@p-offtermatt p-offtermatt left a comment

Choose a reason for hiding this comment

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

Great work! Don't think I have enough context to give an approval, but I looked over the changes and they look good to me. Just one tiny nitpick in a bash script.

MSalopek and others added 2 commits May 16, 2023 14:43
Fix nitpick

Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com>
Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

Most of the changes are due to updating the module version from cosmos/gaia/v9... to cosmos/gaia/v10.

Other than that, the actual migration logic is minimal.

Approval!

// "/ibc.core.channel.v1.MsgTimeout",
// "/ibc.core.channel.v1.MsgTimeoutOnClose"] as default and
// add MaxTotalBypassMinFeeMsgGasUsage that is set 1_000_000 as default.
func MigrateStore(ctx sdk.Context, globalfeeSubspace paramtypes.Subspace) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: this is the actual migration logic. Most of other files are boilerplate changes due to module renaming from cosmos/gaia/v9... to cosmos/gaia/v10

MaxTotalBypassMinFeeMsgGasUsage: defaultParams.MaxTotalBypassMinFeeMsgGasUsage,
}

if !globalfeeSubspace.HasKeyTable() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: if keytable does not exist - create it

@MSalopek MSalopek requested a review from mpoke May 16, 2023 13:48
Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

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

Approval

@yaruwangway yaruwangway merged commit d425834 into main May 17, 2023
@yaruwangway yaruwangway deleted the yaru/bypass-fee-migration branch May 17, 2023 09:45
@yaruwangway yaruwangway mentioned this pull request May 22, 2023
18 tasks
}

if !globalfeeSubspace.HasKeyTable() {
globalfeeSubspace.WithKeyTable(types.ParamKeyTable())
Copy link
Contributor

Choose a reason for hiding this comment

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

@yaruwangway @MSalopek I don't think this line does anything. Correct me if I'm wrong. WithKeyTable seems to return a modified subspace that is thrown out here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think it should already registered keytable, this is not necessary here. but it does not harm to recheck. keytable regissters the kv, and the validation methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the returned value tho right?

Suggested change
globalfeeSubspace.WithKeyTable(types.ParamKeyTable())
newSubspace := globalfeeSubspace.WithKeyTable(types.ParamKeyTable())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in this PR, thank you! #2524

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.

Test: upgrade test in CI Move bypassMinFeeMsgTypes and MaxTotalBypassMinFeeMsgGasUsage to params
6 participants