-
Notifications
You must be signed in to change notification settings - Fork 398
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
ICS27 Updates #638
Conversation
AdityaSripal
commented
Jan 17, 2022
- 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
"Encoding": ["supported encoding types", "..."], | ||
"Tx_Types": ["supported transaction types", "..."], |
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.
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,
}
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. |
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", "..."], |
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: You don't use the _
in the other fields to separate words (e.g. ControllerConnectionId
), so should it be TxTypes
instead?
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.
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. |
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.
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, |
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.
Should it be TxTypes
or TxType
?
"TxType": txType, | ||
"ControllerConnectionId": cpMetadata.ControllerConnectionId, | ||
"HostConnectionId": cpMetadata.HostConnectionId, | ||
"Account": account, |
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.
This should be Address
, right?
// state change to keep track of successfully registered interchain account | ||
SetInterchainAccountAddress(portID, accAddr) | ||
SetInterchainAccountAddress(portID, metadata.Account) |
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.
.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) { |
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.
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 |
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.
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.
|
||
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)). |
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.
This is a big improvement. Nice
* 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>