Skip to content

Commit

Permalink
set default consumer init params on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke committed Oct 16, 2024
1 parent 4126e56 commit b59ea38
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (k msgServer) CreateConsumer(goCtx context.Context, msg *types.MsgCreateCon

// initialization parameters are optional and hence could be nil;
// in that case, set the default
initializationParameters := types.ConsumerInitializationParameters{} // default params
initializationParameters := types.DefaultConsumerInitializationParameters() // default params
if msg.InitializationParameters != nil {
initializationParameters = *msg.InitializationParameters
}
Expand Down
28 changes: 28 additions & 0 deletions x/ccv/provider/types/provider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package types

import (
"time"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

ccv "github.com/cosmos/interchain-security/v6/x/ccv/types"
)

func DefaultConsumerInitializationParameters() ConsumerInitializationParameters {
return ConsumerInitializationParameters{
InitialHeight: clienttypes.Height{
RevisionNumber: 1,
RevisionHeight: 0,
},
GenesisHash: []byte{},
BinaryHash: []byte{},
SpawnTime: time.Time{},
UnbondingPeriod: ccv.DefaultConsumerUnbondingPeriod,
CcvTimeoutPeriod: ccv.DefaultCCVTimeoutPeriod,
TransferTimeoutPeriod: ccv.DefaultTransferTimeoutPeriod,
ConsumerRedistributionFraction: ccv.DefaultConsumerRedistributeFrac,
BlocksPerDistributionTransmission: ccv.DefaultBlocksPerDistributionTransmission,
HistoricalEntries: ccv.DefaultHistoricalEntries,
DistributionTransmissionChannel: "",
}
}
4 changes: 2 additions & 2 deletions x/ccv/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const (
// (and for consistency with other protobuf schemas defined for ccv).
DefaultHistoricalEntries = int64(stakingtypes.DefaultHistoricalEntries)

// In general, the default unbonding period on the consumer is one week less
// In general, the default unbonding period on the consumer is one day less
// than the default unbonding period on the provider, where the provider uses
// the staking module default.
DefaultConsumerUnbondingPeriod = stakingtypes.DefaultUnbondingTime - 7*24*time.Hour
DefaultConsumerUnbondingPeriod = stakingtypes.DefaultUnbondingTime - 24*time.Hour

// Default retry delay period is 1 hour.
DefaultRetryDelayPeriod = time.Hour
Expand Down

0 comments on commit b59ea38

Please sign in to comment.