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

Standardize connection versioning + channel versioning docs #6640

Merged
merged 37 commits into from
Jul 14, 2020

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Jul 8, 2020

Description

closes: #5846


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.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@colin-axner colin-axner mentioned this pull request Jul 8, 2020
9 tasks
@colin-axner
Copy link
Contributor Author

Should we add some way for application modules to register their own versions? Like I develop an application module and import 1.0 of TAO, but wanna include version X and Y for my app module. I guess this should be done on genesis?

@fedekunze
Copy link
Collaborator

but wanna include version X and Y for my app module

channel versions? are they your own app channel versions or the counterparty's channel version? I guess adding a parameter makes sense for the latter

@colin-axner
Copy link
Contributor Author

are they your own app channel versions or the counterparty's channel version?

they are the application versions being negotiated on during the channel handshake (version string stored in channel). I am referring to your own application version.

I think I have a general idea of how to approach it. I'm going to add in calls to ibc-transfer which registers its supported version in InitGenesis and will update channel handshake negotiation to match connection handshake negotiation expect using its own supported versions.

@colin-axner
Copy link
Contributor Author

oh nvm @fedekunze I realized this is simpler than connection versioning and I don't need to add too much extra since the channel version and counterparty version selection are happening off chain by the caller (application module). I just need to add in OpenAck verification that the selected feature set is entirely supported.

@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #6640 into master will increase coverage by 5.66%.
The diff coverage is 60.88%.

@@            Coverage Diff             @@
##           master    #6640      +/-   ##
==========================================
+ Coverage   55.60%   61.26%   +5.66%     
==========================================
  Files         457      385      -72     
  Lines       27440    23682    -3758     
==========================================
- Hits        15257    14509     -748     
+ Misses      11083     8127    -2956     
+ Partials     1100     1046      -54     

@@ -13,9 +13,6 @@ var (
_ exported.CounterpartyI = (*Counterparty)(nil)
)

// DefaultChannelVersion defines the default channel version used during handshake.
const DefaultChannelVersion = "1.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is no "channel version" only application versions for the associated channel.

@@ -238,6 +238,11 @@ func (k Keeper) ChanOpenAck(
panic("cannot find connection")
}

// verify that chainB's proposed version identifier is supported by chainA
if err := connectiontypes.VerifyProposedVersion(channel.Version, counterpartyVersion, nil); err != 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.

note: no support for disallowing nil feature sets. this is a little more tricky for channel version negotiation. I think it would require creating a channel keeper with the application version set inside a keeper field (perhaps a map). this seems like too much overhead for functionality that hasn't actually been requested yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I completely forgot there are ChanOpen callbacks. Applications can just throw an error on any version identifier/feature set they disagree with on ChanOpenAck.

@@ -52,7 +53,7 @@ func NewChannelOpenInitCmd() *cobra.Command {
},
}
cmd.Flags().Bool(FlagOrdered, true, "Pass flag for opening ordered channels")
cmd.Flags().String(FlagIBCVersion, types.DefaultChannelVersion, "supported IBC version")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this maybe should just be an argument, since the default depends on what application you are creating a channel for, follow up pr since there is a todo for fixing counterparty version as well

@colin-axner
Copy link
Contributor Author

colin-axner commented Jul 8, 2020

I'm realizing now the addition to the ChanOpenAck handshake is unnecessary because of the ChanOpenAck callback (forgot this even existed). I assume I should remove that (and the tests for them, since this now unnecessary)?

I guess this pr should just be adding the nil feature set addition for connection versions. I don't see any need to impose any restrictions on the application level version. I don't think it needs to follow the same scheme as connections since the negotiation happens off chain really and by the callbacks

@colin-axner colin-axner marked this pull request as draft July 8, 2020 15:50
@colin-axner colin-axner changed the title implement channel versioning support restricting nil feature sets for ibc version negotiation Jul 8, 2020
@colin-axner
Copy link
Contributor Author

Plans for this pr:

  • revert back to using strings as versions
  • parse the string into a standardized version string at the connection level that will match an ICS spec
  • update channel docs to discuss how version negotiation is to be handled
  • update ibc docs to give concrete examples of how apps could do their own versioning

@colin-axner colin-axner marked this pull request as ready for review July 13, 2020 15:23
Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

utACK

@colin-axner colin-axner changed the title Standarize connection versioning + channel versioning docs Standardize connection versioning + channel versioning docs Jul 13, 2020
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

utACK though see one minor comment for docs clarity

During `ChanOpenInit`, a version string is passed in and set in party A's
channel state.

During `ChanOpenTry`, a version string and counterparty version string are
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth noting that which chain is the counterparty switches between this and the next paragraph, it's a bit confusing to read, might be helpful to label them A/B

@colin-axner colin-axner added the A:automerge Automatically merge PR once all prerequisites pass. label Jul 14, 2020
@mergify mergify bot merged commit 5dfc4a2 into master Jul 14, 2020
@mergify mergify bot deleted the colin/5846-channel-versioning branch July 14, 2020 08:43
@ethanfrey
Copy link
Contributor

@colin-axner I just saw the notification on this PR, sorry for the late response.

The docs look great and I agree with the design.

A large part of this PR updates the connection versioning which is good.

As far as I can see no changes were made to channel versioning except the docs. ie. I see no implementation of the connection versioning in the ibc-transfer module when looking at the diff. I assumed to find these new ChannelInit etc callbacks handled there somewere to see and example that matches the docs.

On the other hand, if this PR does implementation for connection versioing and just docs for channel versioning (which the title implies), then please don't close #5846 yet. I assume closing that one will include a demo implementation of the spec on ibc-transfer at least. This does definitely close #5079 however

@colin-axner
Copy link
Contributor Author

@ethanfrey Channel Versioning happened to be already implemented for the required functionality.

  • channel handshake callbacks already existed
  • ICS20 already did basic string matching in these callbacks, see OnChanOpenInit

Since channel versioning is intended to be very abstract and left to application developers no modifications were needed for the handshake calls.

@ethanfrey
Copy link
Contributor

Okay, so this was just formalizing what was used for the string there.

And how apps could use that to make a more complex one.

I will try out a more complex workflow then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Channel-level versioning in ICS 4
5 participants