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

Consolidate channel upgrade message responses #3910

Closed
chatton opened this issue Jun 21, 2023 · 8 comments
Closed

Consolidate channel upgrade message responses #3910

chatton opened this issue Jun 21, 2023 · 8 comments
Assignees
Labels
channel-upgradability Channel upgradability feature

Comments

@chatton
Copy link
Contributor

chatton commented Jun 21, 2023

Summary

Currently, we make use of a ResultType to indicate if a response was successful or failure as a way of making sure an error receipt is written to state and to inform the relayers that an upgrade should be cancelled.

However some other message responses don't have this field such as MsgChannelUpgradeInitResponse and MsgChannelUpgradeCancelResponse.

While they do not require the result to work, it may be a good idea to make the API consistent across all messages.

@chatton chatton added needs discussion Issues that need discussion before they can be worked on channel-upgradability Channel upgradability feature labels Jun 21, 2023
@crodriguezvega crodriguezvega removed the needs discussion Issues that need discussion before they can be worked on label Jul 8, 2023
@crodriguezvega crodriguezvega moved this to In review in ibc-go Jul 8, 2023
@DimitrisJim DimitrisJim added the needs discussion Issues that need discussion before they can be worked on label Jul 20, 2023
@DimitrisJim
Copy link
Contributor

adding discussion label back, missed to talk about it in previous eng. call (see #4022 (comment))

@crodriguezvega
Copy link
Contributor

Use ResponseResultType in Ack and Confirm responses.

@crodriguezvega crodriguezvega removed the needs discussion Issues that need discussion before they can be worked on label Jul 31, 2023
@crodriguezvega crodriguezvega moved this from In review to Todo in ibc-go Jul 31, 2023
@DimitrisJim DimitrisJim moved this from Todo to In progress in ibc-go Dec 12, 2023
@DimitrisJim
Copy link
Contributor

DimitrisJim commented Dec 12, 2023

Hm, this currently exists in both Ack and Confirm. It exists in all upgrade handlers responses except Init, Open and Cancel (and for Cancel, adding this result type leads to more confusion as #4022 (comment) stated).

I guess these were added during the refactor. Will probably close after a revisit to re-check I'm not missing something.

@colin-axner
Copy link
Contributor

colin-axner commented Dec 13, 2023

Yea, I think the response result can only be success in the other upgrade handlers as a failure indicates a successful tx but a failed handshake step. If we find it useful to return information about the upgrade in the resposne, I'd recommend changing the result type to string and using enums which can be updated in post release to make the other handshake steps more useful:

type MsgChannelUpgradeTryResponse struct {
	ChannelId       string             `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
	Upgrade         Upgrade            `protobuf:"bytes,2,opt,name=upgrade,proto3" json:"upgrade"`
	UpgradeSequence uint64             `protobuf:"varint,3,opt,name=upgrade_sequence,json=upgradeSequence,proto3" json:"upgrade_sequence,omitempty"`
	Status          string `protobuf:"varint,4,opt,name=status,proto3,json:"result,omitempty"`
}
var (
    SUCCESS_UPGRADE_INIT = "SUCCESS_UPGRADE_INIT"
    SUCCESS_UPGRADE_FLUSHING = "SUCCESS_UPGRADE_FLUSHING"
    SUCCESS_UPGRADE_FLUSHCOMPLETE = "SUCCESS_UPGRADE_FLUSHCOMPLETE"
    SUCCESS_UPGRADE_COMPLETE = "SUCCESS_UPGRADE_COMPLETE"
    FAILURE_UPGRADE_CANCELLED = " FAILURE_UPGRADE_CANCELLED"
    FAILURE_COUNTERPARTY_OUT_OF_SYNC = "FAILURE_COUNTERPARTY_OUT_OF_SYNC"
)

I propose a string so that we aren't tied to a specific struct. That way we can just leave the success/failure as is but update to more descriptive responses if we so choose. Just a proposal though

This is similar to what I was ethereum do with one of their api's. They have a response status which is a string and then various string response values (valid, invalid, syncing)

@colin-axner
Copy link
Contributor

colin-axner commented Dec 13, 2023

The result type is only non-success in TRY, ACK, CONFIRM. We can remove from timeout if we want to be conservative. I would be in favour of that (and appears to be what we previously agreed by stating it for ack and confirm). @DimitrisJim want to remove it from the timeout msg?

@colin-axner
Copy link
Contributor

@DimitrisJim
Copy link
Contributor

I'd be in favor of overhauling the resp type to allow for more context. It is currently used in previous handlers which would also require updating (recv, ack, timeout, timeoutonclose as far as I could tell).

Opening PR now for dropping resp from timeout and channel from try resp.

@colin-axner
Copy link
Contributor

I'm calling this issue closed. I've opened a new issue for the idea I put out, but I don't think it's worth making any last minute changes for. If more descriptive result values are ever requested we can use the deprecate/new field approach

@github-project-automation github-project-automation bot moved this from In progress to Done in ibc-go Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
channel-upgradability Channel upgradability feature
Projects
Archived in project
Development

No branches or pull requests

4 participants