refactor(x/crisis)!: remove Address.String() (#20043)
This commit is contained in:
parent
1adc1f0ca9
commit
63b4dbaffd
@ -119,6 +119,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
|
||||
|
||||
### API Breaking Changes
|
||||
|
||||
* (x/crisis) [#20043](https://github.com/cosmos/cosmos-sdk/pull/20043) Changed `NewMsgVerifyInvariant` to accept a string as argument instead of an `AccAddress`.
|
||||
* (x/genutil) [#19926](https://github.com/cosmos/cosmos-sdk/pull/19926) Removal of the Address.String() method and related changes:
|
||||
* Added an address codec as an argument to `CollectTxs`, `GenAppStateFromConfig`, and `AddGenesisAccount`.
|
||||
* Removed the `ValidatorAddressCodec` argument from `CollectGenTxsCmd`, now utilizing the context for this purpose.
|
||||
|
||||
@ -66,13 +66,18 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
|
||||
}
|
||||
|
||||
authorityAddr, err := in.AddressCodec.BytesToString(authority)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
k := keeper.NewKeeper(
|
||||
in.Codec,
|
||||
in.StoreService,
|
||||
invalidCheckPeriod,
|
||||
in.BankKeeper,
|
||||
feeCollectorName,
|
||||
authority.String(),
|
||||
authorityAddr,
|
||||
in.AddressCodec,
|
||||
)
|
||||
|
||||
|
||||
@ -39,7 +39,9 @@ func (s *KeeperTestSuite) SetupTest() {
|
||||
storeService := runtime.NewKVStoreService(key)
|
||||
testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, crisis.AppModule{})
|
||||
keeper := keeper.NewKeeper(encCfg.Codec, storeService, 5, supplyKeeper, "", sdk.AccAddress([]byte("addr1_______________")).String(), addresscodec.NewBech32Codec("cosmos"))
|
||||
addr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString([]byte("addr1_______________"))
|
||||
s.Require().NoError(err)
|
||||
keeper := keeper.NewKeeper(encCfg.Codec, storeService, 5, supplyKeeper, "", addr, addresscodec.NewBech32Codec("cosmos"))
|
||||
|
||||
s.ctx = testCtx.Ctx
|
||||
s.keeper = keeper
|
||||
@ -57,6 +59,8 @@ func (s *KeeperTestSuite) TestMsgVerifyInvariant() {
|
||||
testutil.CreateKeyringAccounts(s.T(), kr, 1)
|
||||
|
||||
sender := testutil.CreateKeyringAccounts(s.T(), kr, 1)[0]
|
||||
senderAddr, err := codectestutil.CodecOptions{}.GetAddressCodec().BytesToString(sender.Address)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.supplyKeeper.EXPECT().SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(2)
|
||||
s.keeper.RegisterRoute("bank", "total-supply", func(sdk.Context) (string, bool) { return "", false })
|
||||
@ -90,7 +94,7 @@ func (s *KeeperTestSuite) TestMsgVerifyInvariant() {
|
||||
{
|
||||
name: "unregistered invariant route",
|
||||
input: &types.MsgVerifyInvariant{
|
||||
Sender: sender.Address.String(),
|
||||
Sender: senderAddr,
|
||||
InvariantModuleName: "module",
|
||||
InvariantRoute: "invalidroute",
|
||||
},
|
||||
@ -100,7 +104,7 @@ func (s *KeeperTestSuite) TestMsgVerifyInvariant() {
|
||||
{
|
||||
name: "valid invariant",
|
||||
input: &types.MsgVerifyInvariant{
|
||||
Sender: sender.Address.String(),
|
||||
Sender: senderAddr,
|
||||
InvariantModuleName: "bank",
|
||||
InvariantRoute: "total-supply",
|
||||
},
|
||||
|
||||
@ -10,9 +10,9 @@ var (
|
||||
)
|
||||
|
||||
// NewMsgVerifyInvariant creates a new MsgVerifyInvariant object
|
||||
func NewMsgVerifyInvariant(sender sdk.AccAddress, invModeName, invRoute string) *MsgVerifyInvariant {
|
||||
func NewMsgVerifyInvariant(sender, invModeName, invRoute string) *MsgVerifyInvariant {
|
||||
return &MsgVerifyInvariant{
|
||||
Sender: sender.String(),
|
||||
Sender: sender,
|
||||
InvariantModuleName: invModeName,
|
||||
InvariantRoute: invRoute,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user