Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Jul 8, 2024
1 parent 023a47d commit 0e3e05e
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 84 deletions.
82 changes: 42 additions & 40 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,4 @@
# CHANGELOG
## v5.0.0

*The provider module should not be used with this version.*

*May 9, 2024*

### DEPENDENCIES

- Bump [ibc-go](https://github.com/cosmos/ibc-go) to
[v8.1.x](https://github.com/cosmos/ibc-go/releases/tag/v8.1.0).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [CometBFT](https://github.com/cometbft/cometbft) to
[v0.38.4\5](https://github.com/cometbft/cometbft/releases/tag/v0.38.5).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to
[v0.50.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.4)
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))

### FEATURES

- [Consumer](x/ccv/consumer)
- Add consumer `MsgUpdateParams` from [cosmos-sdk](https://github.com/cosmos/cosmos-sdk).
([\#1814](https://github.com/cosmos/interchain-security/pull/1814)).
- [Provider](x/ccv/provider)
- Add provider `MsgUpdateParams` from [cosmos-sdk](https://github.com/cosmos/cosmos-sdk).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698)).

### STATE BREAKING

- Bump [ibc-go](https://github.com/cosmos/ibc-go) to
[v8.1.x](https://github.com/cosmos/ibc-go/releases/tag/v8.1.0).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [CometBFT](https://github.com/cometbft/cometbft) to
[v0.38.4\5](https://github.com/cometbft/cometbft/releases/tag/v0.38.5).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to
[v0.50.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.4)
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Revert `PutUnbondingOnHold` behavior to ICS@v1
([\#1819](https://github.com/cosmos/interchain-security/pull/1819))

## v4.3.0

Expand Down Expand Up @@ -91,6 +51,48 @@
- Allow consumer chains to change their PSS parameters.
([\#1932](https://github.com/cosmos/interchain-security/pull/1932))

## v5.0.0

*The provider module should not be used with this version.*

*May 9, 2024*

### DEPENDENCIES

- Bump [ibc-go](https://github.com/cosmos/ibc-go) to
[v8.1.x](https://github.com/cosmos/ibc-go/releases/tag/v8.1.0).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [CometBFT](https://github.com/cometbft/cometbft) to
[v0.38.4\5](https://github.com/cometbft/cometbft/releases/tag/v0.38.5).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to
[v0.50.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.4)
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))

### FEATURES

- [Consumer](x/ccv/consumer)
- Add consumer `MsgUpdateParams` from [cosmos-sdk](https://github.com/cosmos/cosmos-sdk).
([\#1814](https://github.com/cosmos/interchain-security/pull/1814)).
- [Provider](x/ccv/provider)
- Add provider `MsgUpdateParams` from [cosmos-sdk](https://github.com/cosmos/cosmos-sdk).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698)).

### STATE BREAKING

- Bump [ibc-go](https://github.com/cosmos/ibc-go) to
[v8.1.x](https://github.com/cosmos/ibc-go/releases/tag/v8.1.0).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [CometBFT](https://github.com/cometbft/cometbft) to
[v0.38.4\5](https://github.com/cometbft/cometbft/releases/tag/v0.38.5).
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to
[v0.50.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.4)
([\#1698](https://github.com/cosmos/interchain-security/pull/1698))
- Revert `PutUnbondingOnHold` behavior to ICS@v1
([\#1819](https://github.com/cosmos/interchain-security/pull/1819))


## v4.2.0

May 17, 2024
Expand Down
2 changes: 1 addition & 1 deletion app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ func New(
},
)
if err != nil {
panic(fmt.Errorf("failed to create AnteHandler: %s", err))
panic(fmt.Errorf("failed to create AnteHandler: %w", err))
}
app.SetAnteHandler(anteHandler)

Expand Down
2 changes: 1 addition & 1 deletion app/consumer-democracy/proposals_whitelisting.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type legacyParamChangeKey struct {
Subspace, Key string
}

// these parameters don't exist in the consumer app -- keeping them as an
// these parameters don't exist in the consumer app -- keeping them as an example
var LegacyWhitelistedParams = map[legacyParamChangeKey]struct{}{
// add whitlisted legacy parameters here [cosmos-sdk <= 0.47]
// commented parameters are just an example - most params have been moved to their respecitve modules
Expand Down
2 changes: 1 addition & 1 deletion app/consumer/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ func New(
},
)
if err != nil {
panic(fmt.Errorf("failed to create AnteHandler: %s", err))
panic(fmt.Errorf("failed to create AnteHandler: %w", err))
}
app.SetAnteHandler(anteHandler)

Expand Down
2 changes: 1 addition & 1 deletion app/provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ func New(
},
)
if err != nil {
panic(fmt.Errorf("failed to create AnteHandler: %s", err))
panic(fmt.Errorf("failed to create AnteHandler: %w", err))
}

app.SetInitChainer(app.InitChainer)
Expand Down
2 changes: 1 addition & 1 deletion app/sovereign/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func New(
},
)
if err != nil {
panic(fmt.Errorf("failed to create AnteHandler: %s", err))
panic(fmt.Errorf("failed to create AnteHandler: %w", err))
}
app.SetAnteHandler(anteHandler)

Expand Down

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) {
err := k.BindPort(ctx, ccv.ProviderPortID)
if err != nil {
// If the binding fails, the chain MUST NOT start
panic(fmt.Errorf("could not claim port capability: %v", err))
panic(fmt.Errorf("could not claim port capability: %w", err))
}
}

Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/key_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ func (k Keeper) ValidatorConsensusKeyInUse(ctx sdk.Context, valAddr sdk.ValAddre
val, err := k.stakingKeeper.GetValidator(ctx, valAddr)
if err != nil {
// Abort TX, do NOT allow validator to be created
panic(fmt.Errorf("error finding newly created validator in staking module: %s", err))
panic(fmt.Errorf("error finding newly created validator in staking module: %w", err))
}

// Get the consensus address of the validator being added
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign
return &types.MsgAssignConsumerKeyResponse{}, nil
}

// ConsumerAddition defines a rpc handler method for MsgConsumerAddition
// ConsumerAddition defines an RPC handler method for MsgConsumerAddition
func (k msgServer) ConsumerAddition(goCtx context.Context, msg *types.MsgConsumerAddition) (*types.MsgConsumerAdditionResponse, error) {
if k.GetAuthority() != msg.Authority {
return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority)
Expand All @@ -97,7 +97,7 @@ func (k msgServer) ConsumerAddition(goCtx context.Context, msg *types.MsgConsume
return &types.MsgConsumerAdditionResponse{}, nil
}

// ConsumerRemoval defines a rpc handler method for MsgConsumerRemoval
// ConsumerRemoval defines an RPC handler method for MsgConsumerRemoval
func (k msgServer) ConsumerRemoval(
goCtx context.Context,
msg *types.MsgConsumerRemoval) (*types.MsgConsumerRemovalResponse, error) {
Expand Down
6 changes: 3 additions & 3 deletions x/ccv/provider/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string
}

// QueueVSCPackets queues latest validator updates for every registered consumer chain
// failing to GetLastValidators will cause a panic in EndBlock
// failing to GetLastBondedValidators will cause a panic in EndBlock

// TODO: decide if this func shouldn't return an error to be propagated to BeginBlocker
func (k Keeper) QueueVSCPackets(ctx sdk.Context) {
Expand Down Expand Up @@ -427,8 +427,8 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas

// Obtain validator from staking keeper
validator, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerConsAddr.ToSdkConsAddr())
if err != nil && errors.Is(err, stakingtypes.ErrNoValidatorFound) {
k.Logger(ctx).Error("validator not found", "validator", providerConsAddr.String())
if err != nil {
k.Logger(ctx).Error("validator not found", "validator", providerConsAddr.String(), "error", err)
return
}

Expand Down
15 changes: 11 additions & 4 deletions x/ccv/provider/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var (
_ sdk.Msg = (*MsgAssignConsumerKey)(nil)
_ sdk.Msg = (*MsgConsumerAddition)(nil)
_ sdk.Msg = (*MsgConsumerRemoval)(nil)
_ sdk.Msg = (*MsgConsumerModification)(nil)
_ sdk.Msg = (*MsgChangeRewardDenoms)(nil)
_ sdk.Msg = (*MsgSubmitConsumerMisbehaviour)(nil)
_ sdk.Msg = (*MsgSubmitConsumerDoubleVoting)(nil)
Expand All @@ -42,6 +43,7 @@ var (
_ sdk.HasValidateBasic = (*MsgAssignConsumerKey)(nil)
_ sdk.HasValidateBasic = (*MsgConsumerAddition)(nil)
_ sdk.HasValidateBasic = (*MsgConsumerRemoval)(nil)
_ sdk.HasValidateBasic = (*MsgConsumerModification)(nil)
_ sdk.HasValidateBasic = (*MsgChangeRewardDenoms)(nil)
_ sdk.HasValidateBasic = (*MsgSubmitConsumerMisbehaviour)(nil)
_ sdk.HasValidateBasic = (*MsgSubmitConsumerDoubleVoting)(nil)
Expand Down Expand Up @@ -244,10 +246,6 @@ func (msg *MsgConsumerAddition) ValidateBasic() error {
return ErrBlankConsumerChainID
}

if strings.TrimSpace(msg.ChainId) == "" {
return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "consumer chain id must not be blank")
}

if msg.InitialHeight.IsZero() {
return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "initial height cannot be zero")
}
Expand Down Expand Up @@ -306,6 +304,15 @@ func (msg *MsgConsumerRemoval) ValidateBasic() error {
return nil
}

// ValidateBasic implements the sdk.Msg interface.
func (msg *MsgConsumerModification) ValidateBasic() error {
if strings.TrimSpace(msg.ChainId) == "" {
return ErrBlankConsumerChainID
}

return nil
}

// NewMsgOptIn creates a new NewMsgOptIn instance.
func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, signer string) (*MsgOptIn, error) {
return &MsgOptIn{
Expand Down

0 comments on commit 0e3e05e

Please sign in to comment.