Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transfer)!: migrate transfer parameters to be self managed (#3553)
* added 'UpdateParams' rpc endpoint and its messages to 'tx.proto' * ran 'make proto-gen' * implemented 'sdk.Msg' for 'MsgUpdateParams' in 'types/msgs.go' * 'msgs_test.go' updated - todo test tests + create a 'NewMsgUpdateParams' function and update tests * added 'NewMsgUpdateParams' function to 'types/msgs.go' * improved test styling and used helper functions more * added boilerplate 'UpdateParams' function to MsgServer - todo implement the custom logic * removed paramtypes and added authority to Keeper struct - todo Keeper functions need to be updated * updated Keeper functions - todo add ParamsKey to types + update keeper tests * deleted unneeded keeper/params.go as this should be managed in keeper.go * moved params test from params_test to keeper_test as this is where they should be managed now * added ParamsKey to 'types/keys.go' * replaced 'k.GetSendEnabled(ctx)' with 'k.GetParams(ctx).SendEnabled' in msg_server * replaced 'k.GetReceiveEnabled(ctx)' with 'k.GetParams(ctx).ReceiveEnabled' in 'relay.go' * added 'MsgUpdateParams' to InterfaceRegistry * implemented 'UpdateParams' in msg_server * added one more test case to msgs_test for ParamsValidation * wrote tests for 'TestUpdateParams' rpc handler * removed params subspace - todo: add subspaces back as legacy for migrations * removed test cases that didn't make sense * fixed the tests here * fixed typo in function comment * fixed keeper tests * ran 'golangci-lint' on 'transfer/types/...' * added validation to SetParams keeper method * handled the case where 'SetParams' returns an error 'InitGenesis' * fix: forgot to check value of '.SetParams' to ensure it is not an error * ran 'gofumpt' on 'transfer/keeper/' * split 'types/params.go' into a legacy part * created 'exported.go' for migration purposes * added migration code to 'keeper/migrations.go' * increased module.go version and registered param migration * passed legacySubspace to transfer for migration * allow tests to compile and pass by passing the subspace to the migrator - todo: add param migration tests * removed unneeded if statement * ran gofumpt * added integration tests for successful migration of params * fix: forgot to check if '.SetParams' returns an err * ran gofumpt * broken: this test is work in progress and will fail * uncommented the two lines in test * fixed an important error on params_legacy.go * initialize ParamKeyTable for ibctransfer in app.go now * finally a working version of the test * style changes on the test * ran 'gofumpt' * moved comment * updated GetParams function's comment * updated docs * e2e: changed x/params query to fallback behavior * e2e: changed x/params query to fallback behavior * e2e: dropped the fallback behavior * e2e: trying to use the new gov proposal v1 to change params * e2e: created 'isSelfManagingParams' function * e2e: created fallback behaviour for param update gov proposal * chore: e2e code cleanup * chore: ran 'gofumpt' in e2e * style(transfer/test): moved success case to top Co-authored-by: Damian Nolan <[email protected]> * style(transfer/test): replaced request with msg * refactor(transfer): moved MsgUpdateParams' registry to Interface Registry * style(transfer/test): ran gofumpt * style(transfer): moved UpdateParams function to the bottom of the file * imp(transfer): using 'ibcerrors.ErrInvalidAddress' instead of 'govtypes.ErrInvalidSigner' * refactor(transfer/test): used ibctesting constants instead of defining my own * feat(e2e/transfer): using semver to handle gov prop fallback instead of queries * style(e2e/transfer): renamed 'selfParamFeatureReleases' to 'transferSelfParamFeatureReleases' * feat(transfer): keeping paramSpace in keeper and removing exported to reduce mods to simapp * feat(simapp): reduced the modifications to app.go to only one * fix(transfer/test): updated migration tests * imp(transfer/test): improved the efficiency and style of the test * style(transfer): ran gofumpt * style(transfer): ParamsKey is now stored via a string rather than bytes * imp(transfer): retired the old validate function, and new one makes more sense * style(transfer): ran gofumpt * refactor(transfer): removed the validate function for params as it currently does nothing and reduces codecov * fix(transfer): refactored to not use validate * imp(transfer): GetParams now panics if params are not set * imp(transfer/test): added a new test case to test when Params are unset * style(transfer/test): updated the test messages * docs(transfer): added tracking issue for removing params_legacy.go * imp(transfer): added a new error type for invalid authority * style(e2e/transfer): fixed typo * style(transfer/test): stopped using field names in test case declaration * style(transfer/test): stopped using field names in test case declaration * style(transfer/test): renamed test case * imp(transfer): added more info to the error message * style(e2e/transfer): updated ordering of deps * imp(transfer/test): reduced the test size * style(transfer): changed the err message for 'ErrInvalidAuthority' * imp(transfer): removed ErrInvalidAuthority * style(transfer): using 'len(bz) == 0' instead of 'bz == nil' * style(transfer): removed unneeded comment * imp(transfer): switched back to using 'bz == nil' * revert: '7813b39d7835eec26a3655bcd77587198ae90bea' * revert: "style(transfer): changed the err message for 'ErrInvalidAuthority'" This reverts commit 7813b39. * revert: e5f3960 * revert: 4c163f0 * style(transfer): added code comment * docs(migrations): added migration docs for changes in app.go * imp(transfer): improved ValidateBasic err message * style(transfer/test): improved the styling of the test * style(transfer/test): improved the styling of the test * docs(transfer): added godoc for UpdateParams method * style(transfer): removed named return arg * imp(e2e/transfer): reduced code duplication * style(transfer/test): updated test case names * imp(transfer/test): added whitespace test case --------- Co-authored-by: Damian Nolan <[email protected]>
- Loading branch information