Skip to content

Commit

Permalink
fix: cli for consumer genesis transformation (#1458)
Browse files Browse the repository at this point in the history
Fix consumer genesis transformation cli for retry_delay_period
  • Loading branch information
bermuell committed Nov 28, 2023
1 parent 11b5858 commit 91d804a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/consumer/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ func transform(jsonRaw []byte, ctx client.Context) (json.RawMessage, error) {
return nil, fmt.Errorf("invalid source version. Unexpected element 'provider.consensus_state'")
}

// Use DefaultRetryDelayPeriod if not set
if oldConsumerGenesis.Params.RetryDelayPeriod == 0 {
oldConsumerGenesis.Params.RetryDelayPeriod = types.DefaultRetryDelayPeriod
}

// Version 2 of provider genesis data fills up deprecated fields
// ProviderClientState, ConsensusState and InitialValSet
newGenesis := types.ConsumerGenesisState{
Expand Down
2 changes: 2 additions & 0 deletions app/consumer/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

app "github.com/cosmos/interchain-security/v3/app/consumer"
consumerTypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types"
)

// Testdata mapping consumer genesis exports to a provider module version as
Expand Down Expand Up @@ -210,4 +211,5 @@ func TestConsumerGenesisTransformationV2(t *testing.T) {

require.Empty(t, consumerGenesis.InitialValSet)
require.NotEmpty(t, consumerGenesis.Provider.InitialValSet)
require.Equal(t, consumerGenesis.Params.RetryDelayPeriod, ccvtypes.DefaultRetryDelayPeriod)
}

0 comments on commit 91d804a

Please sign in to comment.