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

PathProcessor/Provider - separate proof queries from message assembly #835

Merged
merged 4 commits into from
Jul 11, 2022

Conversation

agouin
Copy link
Member

@agouin agouin commented Jul 8, 2022

Previously, methods such as MsgRecvPacket in the CosmosChainProvider would both query for the tendermint proof and assemble the message for the counterparty. This will only work if the counterparty is a cosmos chain. In preparation for third party chains, this separates the proof queries into the following methods:

// PacketCommitment queries for proof that a MsgTransfer has been committed on the chain.
PacketCommitment(ctx context.Context, msgTransfer PacketInfo, latest LatestBlock) (PacketProof, error)

// PacketAcknowledgement queries for proof that a MsgRecvPacket has been committed on the chain.
PacketAcknowledgement(ctx context.Context, msgRecvPacket PacketInfo, latest LatestBlock) (PacketProof, error)

// PacketReceipt queries for proof that a MsgRecvPacket has not been committed to the chain.
PacketReceipt(ctx context.Context, msgTransfer PacketInfo, latest LatestBlock) (PacketProof, error)

They all have a common signature, returning the proof as []byte and the height as clienttypes.Height ibc-go type. This information can then be passed into the message assembly function for the destination chain instead of the source chain, which can construct the message as needed for the destination chain.

@agouin agouin marked this pull request as ready for review July 8, 2022 21:34
Copy link
Member

@mark-rushakoff mark-rushakoff left a comment

Choose a reason for hiding this comment

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

🚢

Comment on lines +585 to +586
var packetProof func(context.Context, provider.PacketInfo, provider.LatestBlock) (provider.PacketProof, error)
var assembleMessage func(provider.PacketInfo, provider.PacketProof) (provider.RelayerMessage, error)
Copy link
Member

Choose a reason for hiding this comment

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

Two function variables are fine, but at three I would probably pull out a struct or interface for this.

relayer/provider/provider.go Outdated Show resolved Hide resolved
relayer/provider/provider.go Outdated Show resolved Hide resolved
@agouin agouin enabled auto-merge (squash) July 11, 2022 15:45
@agouin agouin merged commit 11388d0 into main Jul 11, 2022
@agouin agouin deleted the andrew/separate_proofs_from_assembly branch July 11, 2022 15:56
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.

2 participants