Skip to content

Commit

Permalink
fix: missing transformation for field 'new_chain' in ccv consumer gen…
Browse files Browse the repository at this point in the history
…esis (#1509)

Fix missing transformation for field 'new_chain' + testing

(cherry picked from commit f86c61f)

# Conflicts:
#	app/consumer/genesis_test.go
  • Loading branch information
bermuell authored and mergify[bot] committed Dec 14, 2023
1 parent 7618827 commit 85a4af6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/consumer/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,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)
Expand Down
10 changes: 10 additions & 0 deletions app/consumer/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app_test
import (
"bytes"
"context"
"encoding/json"
"io/fs"
"os"
"path/filepath"
Expand Down Expand Up @@ -191,6 +192,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()
Expand All @@ -210,4 +215,9 @@ func TestConsumerGenesisTransformationV2(t *testing.T) {

require.Empty(t, consumerGenesis.InitialValSet)
require.NotEmpty(t, consumerGenesis.Provider.InitialValSet)
<<<<<<< HEAD

Check failure on line 218 in app/consumer/genesis_test.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected <<, expected }

Check failure on line 218 in app/consumer/genesis_test.go

View workflow job for this annotation

GitHub Actions / lint

expected statement, found '<<' (typecheck)

Check failure on line 218 in app/consumer/genesis_test.go

View workflow job for this annotation

GitHub Actions / tests

expected statement, found '<<'
=======
require.Equal(t, consumerGenesis.Params.RetryDelayPeriod, ccvtypes.DefaultRetryDelayPeriod)
require.Equal(t, consumerGenesis.NewChain, oldConsumerGenesis["new_chain"])
>>>>>>> f86c61f (fix: missing transformation for field 'new_chain' in ccv consumer genesis (#1509))

Check failure on line 222 in app/consumer/genesis_test.go

View workflow job for this annotation

GitHub Actions / lint

more than one character in rune literal

Check failure on line 222 in app/consumer/genesis_test.go

View workflow job for this annotation

GitHub Actions / lint

invalid character U+0023 '#' (typecheck)

Check failure on line 222 in app/consumer/genesis_test.go

View workflow job for this annotation

GitHub Actions / lint

illegal rune literal (typecheck)
}

Check failure on line 223 in app/consumer/genesis_test.go

View workflow job for this annotation

GitHub Actions / lint

expected '}', found 'EOF' (typecheck)

0 comments on commit 85a4af6

Please sign in to comment.