-
Notifications
You must be signed in to change notification settings - Fork 138
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
refactor!: Split out consumer genesis state #1324
Conversation
92d02bd
to
32ad930
Compare
The refactor looks good, thanks for the awesome work! What is a bit unclear to me is if we should maintain backward compatibility with regards to responses from the interchain-security-pd query provider consumer-genesis <chain-id> The structure returned by this query is an integral part of starting a consumer chain, so maybe we should address the issue of provider-consumer version compatibility. This is the scenario I'm trying to solve:
It seems to me that this issue can be solved by parsing the "old" genesis into the "new" genesis: interchain-security-cd parse-genesis v1 <path_to_v1_genesis>
# output of this cmd is a genesis that the consumer can process (ICS@latest) If the provider and consumer are on the same ICS version there are no compatibility issues. |
thanks @MSalopek for your comment. I'll look into that and provide migration code for my changes |
Matija's suggestion of creating a new parsing function sounds solid to me with appropriate docs for the procedure 👍 |
8c2a751
to
6731b7c
Compare
Rename NewRestartConsumerGenesisState to NewRestartGenesisState
ed13e20
to
9d7c31f
Compare
9d7c31f
to
8326811
Compare
// | ||
// Note: this type is only used on consumer side and references shared types with | ||
// provider | ||
message GenesisState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #1288 we renamed the consumer's GenesisState struct to ConsumerGenesisState
, is there a reason why we change it back in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We changed it in the shared type namespace to make it clear that it's consumer related. This type is the result of the split and resides in the consumer namespaces so no need to repeat that in the name. The shared one kept its name
app/consumer/genesis.go
Outdated
TransformationMap map[string]TransformationCallback | ||
) | ||
|
||
// Migration of consumer genesis content as it is exported from a provider version v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prob need some clarification on the use of "v2" and "v3" here, it seems like the term is applied to both consumer and provider. Are we referring to ICS major versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is the major version of ICS modules we refer here.
@bermuell docs are needed for the change to CLI. |
f8b2524
to
6d94ef8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
app/consumer/genesis.go
Outdated
cmd := &cobra.Command{ | ||
Use: "transform [genesis-file]", | ||
Short: "Transform CCV consumer genesis from an older provider version not supporting current format", | ||
Long: fmt.Sprintf(`Transform the consumer genesis file from a provider version v1,v2 or v3 to a version supported by this consumer. Result is printed to STDOUT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: perhaps add a strings.TrimSpace()
call here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! See my comment.
Refactor consumer genesis state * Split ConsumerGenesis datatype * Move other non-shared types to consumer * fix some protbuf lint issues * make proto-format * Rename PrivateConsumerGenesisState to GenesisState * Fix linter issues * Correct some proto buf * Protobuf use deprecated instead of reserved * Add genesis transformation command to interchain-security-cd * Remove unused field from test data * Added some basic checks * Fix linter warnings * Added test * Minor test fixes + lint warnings * Fix lint warning * Updated comment * Addressed comments * Update docs * Addressed comments
Description
Closes: #1214
Refacoring shared data between provider and consumer.
Note: This breaks json format used by augmenting Genesis files of consumer chains with consumer genesis content exported from provider chain. Consumer Genesis content exported from a provider chain using major version 1,2 or3 of the provider module needs to be transformed with the transformation command introduced by this PR:
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if state-machine breaking change (i.e., requires coordinated upgrade)CHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change