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(transfer)!: migrate transfer parameters to be self managed #3553

Merged
merged 116 commits into from
May 24, 2023

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented May 4, 2023

Description

With this PR:

  • The transfer app now self-manages its parameters.
  • Unit and integration tests have been added for the transfer app's parameters.
  • Migration code has been implemented for moving parameters from x/params' subspace to the transfer app's keeper.
  • Migration unit and integration tests have been added.
  • End to end tests have been updated.

closes: #3502

addresses: #2010

Changes:

  • A new message type, MsgUpdateParams, has been introduced, executed with an authority that is expected to be the x/gov module account.

Commit Message / Changelog Entry

feat(transfer)!: migrate transfer parameters to be self managed

see the guidelines for commit messages. (view raw markdown for examples)


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

srdtrk added 24 commits May 3, 2023 13:34
@codecov-commenter
Copy link

codecov-commenter commented May 4, 2023

Codecov Report

Merging #3553 (04b2591) into main (b5a613d) will increase coverage by 0.04%.
The diff coverage is 85.89%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3553      +/-   ##
==========================================
+ Coverage   78.75%   78.79%   +0.04%     
==========================================
  Files         186      186              
  Lines       12744    12773      +29     
==========================================
+ Hits        10036    10064      +28     
- Misses       2276     2278       +2     
+ Partials      432      431       -1     
Impacted Files Coverage Δ
modules/apps/transfer/keeper/relay.go 90.90% <0.00%> (ø)
modules/apps/transfer/types/genesis.go 54.54% <ø> (+6.54%) ⬆️
modules/apps/transfer/types/keys.go 84.61% <ø> (ø)
modules/apps/transfer/types/params.go 100.00% <ø> (+24.00%) ⬆️
modules/apps/transfer/module.go 52.63% <33.33%> (-1.92%) ⬇️
modules/apps/transfer/types/params_legacy.go 53.84% <53.84%> (ø)
modules/apps/transfer/types/msgs.go 92.98% <87.50%> (-2.14%) ⬇️
modules/apps/transfer/keeper/keeper.go 88.61% <100.00%> (+1.58%) ⬆️
modules/apps/transfer/keeper/migrations.go 96.15% <100.00%> (+0.69%) ⬆️
modules/apps/transfer/keeper/msg_server.go 100.00% <100.00%> (ø)
... and 1 more

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Last few nits from me, looking really good!

modules/apps/transfer/keeper/keeper.go Outdated Show resolved Hide resolved
modules/apps/transfer/keeper/msg_server.go Show resolved Hide resolved
modules/apps/transfer/keeper/msg_server_test.go Outdated Show resolved Hide resolved
modules/apps/transfer/types/genesis.go Show resolved Hide resolved
modules/apps/transfer/types/msgs_test.go Outdated Show resolved Hide resolved
Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Thanks @srdtrk, nice work! LGTM

Comment on lines 33 to 35
var transferSelfParamsFeatureReleases = semverutil.FeatureReleases{
MajorVersion: "v8",
}
Copy link
Member

Choose a reason for hiding this comment

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

feature release matrices are being grouped together in test values in #3558, just noting this for resolving merge conflicts

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

Great job with this! Just a few small comments but nothing major LGTM

e2e/tests/transfer/base_test.go Outdated Show resolved Hide resolved
// Transfer defines an rpc handler method for MsgTransfer.
func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

if !k.GetSendEnabled(ctx) {
if !k.GetParams(ctx).SendEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I prefer just accessing the fields directly from params rather than a getter which would include no additional logic. I don't think params needs to be anything more than just a struct of values.

modules/apps/transfer/keeper/msg_server_test.go Outdated Show resolved Hide resolved
@srdtrk srdtrk merged commit 55149ca into main May 24, 2023
@srdtrk srdtrk deleted the serdar/issue#3502-self-manage-transfer-params branch May 24, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Migrate transfer params to be self managed
5 participants