Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jul 20, 2022
1 parent e167855 commit 7570419
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
10 changes: 6 additions & 4 deletions x/bank/keeper/migrations.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package keeper

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank/exported"
v2 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v2"
Expand Down Expand Up @@ -34,11 +32,15 @@ func (m Migrator) Migrate2to3(ctx sdk.Context) error {

// Migrate3to4 migrates x/bank storage from version 3 to 4.
func (m Migrator) Migrate3to4(ctx sdk.Context) error {
if err := v4.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc); err != nil {
return err
}

oldParams := m.keeper.GetParams(ctx)
m.keeper.SetAllSendEnabled(ctx, oldParams.GetSendEnabled())
if err := m.keeper.SetParams(ctx, banktypes.NewParams(oldParams.DefaultSendEnabled)); err != nil {
return fmt.Errorf("failed to set params: %w", err)
return err
}

return v4.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc)
return nil
}
7 changes: 1 addition & 6 deletions x/bank/keeper/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,8 @@ func (k BaseSendKeeper) SetParams(ctx sdk.Context, params types.Params) error {
return err
}

if len(params.SendEnabled) > 0 {
k.SetAllSendEnabled(ctx, params.SendEnabled)
}

p := types.NewParams(params.DefaultSendEnabled)
store := ctx.KVStore(k.storeKey)
bz, err := k.cdc.Marshal(&p)
bz, err := k.cdc.Marshal(&params)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion x/bank/spec/02_keepers.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type Keeper interface {
DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error
UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error

// GetAuthority Gets the address capable of executing governance proposal messages. Usually the gov module account.
// GetAuthority gets the address capable of executing governance proposal messages. Usually the gov module account.
GetAuthority() string

types.QueryServer
Expand Down
10 changes: 10 additions & 0 deletions x/bank/spec/03_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ The message will fail under the following conditions:
* Any of the `to` addresses are restricted
* Any of the coins are locked
* The inputs and outputs do not correctly correspond to one another

## MsgUpdateParams

The `bank` module params can be updated through `MsgUpdateParams`, which can be done using governance proposal. The signer will always be the `gov` module account address.

+++ https://github.com/cosmos/cosmos-sdk/blob/e167855c9b99c4e58c1455533c6f88af5ff78ae1/proto/cosmos/bank/v1beta1/tx.proto#L56-L69

The message handling can fail if:

* signer is not the gov module account address.
6 changes: 0 additions & 6 deletions x/bank/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ func ValidateInputsOutputs(input Input, outputs []Output) error {
return nil
}

// Route returns the MsgUpdateParams message route.
func (msg MsgUpdateParams) Route() string { return ModuleName }

// Type returns the MsgUpdateParams message type.
func (msg MsgUpdateParams) Type() string { return TypeMsgUpdateParams }

// GetSigners returns the signer addresses that are expected to sign the result
// of GetSignBytes.
func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
Expand Down

0 comments on commit 7570419

Please sign in to comment.