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

Add upgrade type verification function #3453

Conversation

chatton
Copy link
Contributor

@chatton chatton commented Apr 13, 2023

Description

closes: #3446

Commit Message / Changelog Entry

N/A feature branch


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

Thank you, @chatton. Can we then remove VerifyChannelUpgradeTimeout and VerifyChannelUpgradeSequence` functions?

expPass: false,
},
{
name: "fails with bad client id",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: "fails with bad client id",
name: "fails with invalid client id",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we bave "bad client id" for all other tests doing this check, if we want to change it we should probably do it everywhere (I think not in this PR though!)

)

// NewUpgrade creates a new Upgrade instance.
func NewUpgrade(modifiableFields ModifiableUpgradeFields, timeout UpgradeTimeout, lastPacketSent uint64) *Upgrade {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func NewUpgrade(modifiableFields ModifiableUpgradeFields, timeout UpgradeTimeout, lastPacketSent uint64) *Upgrade {
func NewUpgrade(upgradeFields UpgradeFields, timeout UpgradeTimeout, lastPacketSent uint64) *Upgrade {

expPass: false,
},
{
name: "verification fails when the ordering is different",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: "verification fails when the ordering is different",
name: "fails when the upgrade field is different",

upgrade = channeltypes.NewUpgrade(
channeltypes.NewModifiableUpgradeFields(channeltypes.UNORDERED, []string{path.EndpointA.ConnectionID}, "v1.0.0"),
channeltypes.NewUpgradeTimeout(clienttypes.ZeroHeight(), 100000),
0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
0,
1,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should last packet sent be 1 if we have not sent any packets?

Base automatically changed from cian/issue#3445-add-verifiable-upgrade-type-and-validate-basic-functions to 04-channel-upgrades April 18, 2023 08:35
@chatton chatton marked this pull request as ready for review April 18, 2023 08:45
@@ -364,16 +364,15 @@ func (k Keeper) VerifyNextSequenceRecv(
return nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the diff in this file is quite confusing, the following functions were removed

  • VerifyChannelUpgradeSequence
  • VerifyChannelUpgradeTimeout

Copy link
Contributor

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

ACK

Comment on lines 21 to 22
// NewModifiableUpgradeFields returns a new ModifiableUpgradeFields instance.
func NewModifiableUpgradeFields(ordering Order, connectionHops []string, version string) UpgradeFields {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove "Modifiable" here I guess?

@chatton chatton merged commit e62634d into 04-channel-upgrades Apr 18, 2023
@chatton chatton deleted the cian/issue#3451-add-verifiable-upgrade-type-and-validate-basic-functions branch April 18, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants