Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed Nov 15, 2023
1 parent 7e436b7 commit 3ae52c2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion x/ccv/consumer/keeper/legacy_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// Legacy: used for migration only!
// GetConsumerParamsLegacy returns the params for the consumer ccv module from x/param subspace
// which will be depreacted soon
// which will be deprecated soon
func (k Keeper) GetConsumerParamsLegacy(ctx sdk.Context, paramSpace paramtypes.Subspace) ccvtypes.Params {
return ccvtypes.NewParams(
getEnabled(ctx, paramSpace),
Expand Down
6 changes: 1 addition & 5 deletions x/ccv/consumer/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"context"
"fmt"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -18,10 +17,7 @@ func (k Keeper) GetConsumerParams(ctx sdk.Context) ccvtypes.Params {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.ParametersKey())
var params ccvtypes.Params
err := k.cdc.Unmarshal(bz, &params)
if err != nil {
panic(fmt.Sprintf("error unmarshalling module parameters: %v:", err))
}
k.cdc.MustUnmarshal(bz, &params)
return params
}

Expand Down
3 changes: 2 additions & 1 deletion x/ccv/consumer/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const (
// SlashRecordByteKey is the single byte key storing the consumer's slash record.
SlashRecordByteKey

// ParametersKey is the is the single byte key for storing consumer's parameters.
// ParametersKey is the single byte key for storing consumer's parameters.
ParametersByteKey

// NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go
Expand All @@ -116,6 +116,7 @@ const (
// Fully defined key func section
//

// ParametersKey returns the key for the consumer parameters in the store
func ParametersKey() []byte {
return []byte{ParametersByteKey}
}
Expand Down
10 changes: 1 addition & 9 deletions x/ccv/provider/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,7 @@ func CmdProviderParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params [flags]",
Short: "Query values set as provider parameters",
/* Long: strings.TrimSpace(
fmt.Sprintf(`Returns the registered consumer reward denoms.
Example:
$ %s query provider registered-consumer-reward-denoms
`,
version.AppName,
),
), */
Args: cobra.NoArgs,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions x/ccv/provider/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ func (k Keeper) QueryThrottledConsumerPacketData(goCtx context.Context, req *typ
// getSlashPacketData fetches a slash packet data from the store using consumerChainId and ibcSeqNum (direct access)
// If the returned bytes do not unmarshal to SlashPacketData, the data is considered not found.
func (k Keeper) getSlashPacketData(ctx sdk.Context, consumerChainID string, ibcSeqNum uint64) (ccvtypes.SlashPacketData, bool) {
store := k.storeService.OpenKVStore(ctx)
bz, err := store.Get(types.ThrottledPacketDataKey(consumerChainID, ibcSeqNum))
if err != nil || len(bz) == 0 {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.ThrottledPacketDataKey(consumerChainID, ibcSeqNum))
if len(bz) == 0 {
return ccvtypes.SlashPacketData{}, false
}

Expand All @@ -241,7 +241,7 @@ func (k Keeper) getSlashPacketData(ctx sdk.Context, consumerChainID string, ibcS
}

packet := ccvtypes.SlashPacketData{}
err = packet.Unmarshal(bz[1:])
err := packet.Unmarshal(bz[1:])
if err != nil {
// If the data cannot be unmarshaled, it is considered not found
return ccvtypes.SlashPacketData{}, false
Expand Down
3 changes: 2 additions & 1 deletion x/ccv/provider/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const (
// handled in the current block
VSCMaturedHandledThisBlockBytePrefix

// ParametersKey is the is the single byte key for storing consumer's parameters.
// ParametersKey is the is the single byte key for storing provider's parameters.
ParametersByteKey

// NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go
Expand All @@ -148,6 +148,7 @@ const (
// Fully defined key func section
//

// ParametersKey returns the key for the parameters of the provider module in the store
func ParametersKey() []byte {
return []byte{ParametersByteKey}
}
Expand Down

0 comments on commit 3ae52c2

Please sign in to comment.