From f86c61f91e01b1aef81db0ab76d516008b26d375 Mon Sep 17 00:00:00 2001 From: bernd-m <43466467+bermuell@users.noreply.github.com> Date: Thu, 14 Dec 2023 17:16:41 +0100 Subject: [PATCH] fix: missing transformation for field 'new_chain' in ccv consumer genesis (#1509) Fix missing transformation for field 'new_chain' + testing --- app/consumer/genesis.go | 1 + app/consumer/genesis_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/app/consumer/genesis.go b/app/consumer/genesis.go index f6641f45a7..11f008fb7a 100644 --- a/app/consumer/genesis.go +++ b/app/consumer/genesis.go @@ -64,6 +64,7 @@ func transform(jsonRaw []byte, ctx client.Context) (json.RawMessage, error) { ConsensusState: oldConsumerGenesis.ProviderConsensusState, InitialValSet: oldConsumerGenesis.InitialValSet, }, + NewChain: oldConsumerGenesis.NewChain, } newJson, err := ctx.Codec.MarshalJSON(&newGenesis) diff --git a/app/consumer/genesis_test.go b/app/consumer/genesis_test.go index 82292fbdbb..2ab5be2061 100644 --- a/app/consumer/genesis_test.go +++ b/app/consumer/genesis_test.go @@ -3,6 +3,7 @@ package app_test import ( "bytes" "context" + "encoding/json" "io/fs" "os" "path/filepath" @@ -192,6 +193,10 @@ func TestConsumerGenesisTransformationV2(t *testing.T) { _, err = cmd.ExecuteC() require.NoError(t, err) + var oldConsumerGenesis map[string]interface{} + err = json.Unmarshal([]byte(consumerGenesisStates[version]), &oldConsumerGenesis) + require.NoError(t, err, "Error parsing old version of ccv genesis content for consumer") + consumerGenesis := consumerTypes.GenesisState{} bz := output.Bytes() @@ -212,4 +217,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) + require.Equal(t, consumerGenesis.NewChain, oldConsumerGenesis["new_chain"]) }