Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cli for consumer genesis transformation #1458

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading