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

ICS27 Updates #638

Closed
wants to merge 2 commits into from
Closed

ICS27 Updates #638

wants to merge 2 commits into from

Conversation

AdityaSripal
Copy link
Member

  • remove metadata from portID and move it to version
  • create structured JSON map for version and recommend as best practice for negotiating metadata
  • remove deleting active channel on channel closing

Comment on lines +212 to +213
"Encoding": ["supported encoding types", "..."],
"Tx_Types": ["supported transaction types", "..."],
Copy link
Member Author

Choose a reason for hiding this comment

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

I've included these two to be very explicit about any assumptions shared between the two chains. However, open to feedback on if we should standardize the encoding to all implementations.

Or if we should allow the tx_type to be implicit.

Note in the implementation there will only be one supported type for each

{
...
Encoding: protobuf,
Tx_Types: sdk_multi_msg,
}

@colin-axner
Copy link
Contributor

This is a lot to review at once. Is it possible to split up?

@seantking
Copy link
Contributor

This is a lot to review at once. Is it possible to split up?

I don't mean to be awkward but I agree with @colin-axner we should try to split up these IBC spec PRs a bit in the future.

@AdityaSripal
Copy link
Member Author

AdityaSripal commented Jan 19, 2022

I could move the active channel unsetting out since that is logically isolated, though that is only a small part of the PR.

The rest of the changes are tightly coupled. So I could make the port changes a separate PR, however that on its own would be incorrect without the changes to the version. So then separating these, in my opinion, makes correctness hard to track because the changes that would make interchain accounts secure are now in separate PRs and it is harder to verify that the changes together still create a correct specification. I'm open to a different opinion if reviewers still think it is worth separating these two. But I would want to make sure then that people are still considering both PRs in conjunction with each other and making sure that the changes make sense together.

{
"Version": "ics27-1",
"Encoding": ["supported encoding types", "..."],
"Tx_Types": ["supported transaction types", "..."],
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You don't use the _ in the other fields to separate words (e.g. ControllerConnectionId), so should it be TxTypes instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

These 2 fields are not part of the implementation in ibc-go, is that ok?

}
```

Comments: On the ChanOpenAck step, the ICS27 application on the controller chain must verify the version string chosen by the host chain on ChanOpenTry. The controller chain must verify that it can support the negotiated encoding and tx type selected by the host chain. If either is unsupported, then it must return an error and abort the handshake.
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
Comments: On the ChanOpenAck step, the ICS27 application on the controller chain must verify the version string chosen by the host chain on ChanOpenTry. The controller chain must verify that it can support the negotiated encoding and tx type selected by the host chain. If either is unsupported, then it must return an error and abort the handshake.
Comments: On the `OnChanOpenAck` step, the ICS-27 application on the controller chain must verify the version string chosen by the host chain on `OnChanOpenTry`. The controller chain must verify that it can support the negotiated encoding and tx type selected by the host chain. If either is unsupported, then it must return an error and abort the handshake.

metadata = {
"Version": "ics27-1",
"Encoding": encoding,
"TxType": txType,
Copy link
Contributor

@crodriguezvega crodriguezvega Jan 19, 2022

Choose a reason for hiding this comment

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

Should it be TxTypes or TxType?

"TxType": txType,
"ControllerConnectionId": cpMetadata.ControllerConnectionId,
"HostConnectionId": cpMetadata.HostConnectionId,
"Account": account,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be Address, right?

// state change to keep track of successfully registered interchain account
SetInterchainAccountAddress(portID, accAddr)
SetInterchainAccountAddress(portID, metadata.Account)
Copy link
Contributor

Choose a reason for hiding this comment

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

.Address instead, right?

@@ -81,7 +81,7 @@ This is a helper function to open a new channel.
This is a safety function in case of a channel closing and the controller chain needs to regain access to an interchain account on the host chain.

```typescript
function InitChannel(portId: string, connectionId: string) returns (nil){
function InitChannel(portId: string, connectionId: string) returns (nil) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this? We decided not to implement it for the time being in ibc-go and will instead leave it up to ica-auth application developers.

// checks to make sure the account has not already been registered
// creates a new address on chain
// creates a new address on chain deterministically given counterpartyPortId
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should probably also mention the connection-id based on colins issue yesterday? I think the grammar here needs an update either way.

AdityaSripal added a commit that referenced this pull request Jan 20, 2022
@AdityaSripal AdityaSripal mentioned this pull request Jan 20, 2022

ICS-04 allows for each channel version negotiation to be application-specific. In the case of interchain accounts, the channel version set during the `OnChanOpenInit` step (controller chain) must be `ics27-<version>` & the version set during the host chain `OnChanOpenTry` step will include the interchain account address that will be created ([see summary table below](#Version-negotiation-summary)). Note that the generation of this address is stateless, and can be generated in advance of the account creation.
ICS-27 takes advantage of [ICS-04 channel version negotiation](../../core/ics-004-channel-and-packet-semantics/README.md#versioning) to negotiate metadata and channel parameters during the channel handshake. The metadata will contain the encoding format along with the transaction type so that the counterparties can agree on the structure and encoding of the interchain transactions. The metadata sent from the host chain on the TRY step will also contain the interchain account address, so that it can be relayed to the controller chain. At the end of the channel handshake, both the controller and host chains will store a mapping of the controller chain portID to the newly registered interchain account address ([account registration flow](#Register-account-flow)).
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a big improvement. Nice

@AdityaSripal
Copy link
Member Author

Superceded by #641 and #642

@cwgoes cwgoes deleted the aditya/ics27-updates branch January 31, 2022 15:24
AdityaSripal added a commit that referenced this pull request Feb 9, 2022
* pull out just portID changes from #638

* Make metadata changes to ics27 and add json metadata as best practice in ICS4

* Update spec/app/ics-027-interchain-accounts/README.md

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* simplify encoding/tx_type negotiation and fix pseudocode formatting

* fix call of RegisterInterchainAccount

* Apply suggestions from code review

Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* remove plural

* fix try logic to no longer select encoding and tx type

* nits

* Apply suggestions from code review

Co-authored-by: Marius Poke <marius.poke@posteo.de>

* address mpoke suggestions

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Marius Poke <marius.poke@posteo.de>
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