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

ICS26: Add previous version to upgrade callbacks #806

Merged
merged 4 commits into from
Aug 1, 2022

Conversation

AdityaSripal
Copy link
Member

No description provided.

@@ -86,7 +83,8 @@ function onChanUpgradeTry(
channelIdentifier: Identifier,
counterpartyPortIdentifier: Identifier,
counterpartyChannelIdentifier: Identifier,
counterpartyVersion: string) => (version: string, err: Error) {
counterpartyVersion: string,
previousVersion: string) => (version: string, err: Error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be previousCounterpartyVersion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, counterpartyVersion is the new version the counterparty is proposing to upgrade to

previousVersion is the current version of our chain before the upgrade. Maybe we should rename to current version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, thanks, sounds good to me!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think previousVersion makes sense for naming, but maybe we could have previousVersion come before counterpartyVersion in the list of args? Would it makes more sense for the "self" to be stated before the counterparty. It doesn't make too much of a difference to me either way

to the default version which MAY be a new default from when the channel was first initiated.
If there is no default version string for the application,
it should return an error if provided version is empty string.
The callback is provided both the previous version of the channel and the new proposed version. It may perform the necessary logic and state changes necessary to upgrade the channel from the previous version to the new version. If upgrading the application from the previous version to the new version is not supported, it must return an error.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So including the previous channel version is intended such that an application cannot jump versions??
For example: ics20-1 cannot be upgraded to ics20-3, is that correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, certainly some applications could choose to make that restriction

But perhaps ics20-1 -> ics20-3` requires state changes A

But ics20-2 -> ics20-3 require a different sequence of state changes B.

Knowing what version you are upgrading from gives you the information you need to decide if the upgrade is allowed and if allowed, what changes to make.

THis information could be stored in the app state itself, but we pass it in here to be explicit

Comment on lines +57 to +58
version: string,
previousVersion: string) => (version: string, err: Error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on reordering these so that previousVersion comes before version?

@AdityaSripal AdityaSripal merged commit bb068ad into main Aug 1, 2022
@AdityaSripal AdityaSripal deleted the aditya/add-prev-version-to-cb branch August 1, 2022 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

3 participants