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

IBC packet forward middleware support from memo field #1488

Closed
wants to merge 2 commits into from

Conversation

luckychess
Copy link

Hi everyone,

I tried recently to use relayer for IBC packet forwarding and faced an interesting issue. As the doc says, to forward IBC transactions a memo field should be filled with the forwarding data. But it's incompatible with how relayer operates at the moment.
There are 2 key points here:

  1. Relayer appends rly(vx.y.z) string to every memo which is clearly not a valid json which packet forward middleware app expects.
  2. When doing rly tx transfer, the memo field of MsgTransfer message is not actually set, making packet forward middleware to think there is no forward data.

This PR is mostly a proposal since it changes the way how the relayer deals with memo field. Still, this fix was tested with locally deployed chains and it works.

Please tell me if I was not clear enough or some additional details are needed.

Cheers,
Konstantin.

@luckychess luckychess requested a review from a team as a code owner August 26, 2024 19:36
@Reecepbcups
Copy link
Member

@luckychess IBC has 2 memos: 1 is the user facing memo / note, and 1 is the IBC packet memo field.

You have to set the IBC packet memo to packet forward, not the note memo. It's a bit confusing from the IBC spec

@Reecepbcups
Copy link
Member

Reecepbcups commented Aug 26, 2024

Here is how to generate a packet in typescript using the proper format

https://github.com/Reecepbcups/ibc-anywhere-webapp/blob/main/src/routes/%2Bpage.svelte#L441-L455

			let pfm_memo: string = `{ "forward": {"receiver": "${pfmWalletAddr}","port":"transfer","channel":"${to_final_channel}"}}`
			console.log(pfm_memo)

			const transferMsg: MsgTransferEncodeObject = {
				typeUrl: "/ibc.applications.transfer.v1.MsgTransfer",
				value: MsgTransfer.fromPartial({
					sourcePort: port_id,
					sourceChannel: channel_id,
					sender: addr,
					receiver: to_wallet_addr,
					token: { denom: ibc_denom, amount: actual_amount.toString() },					
					timeoutTimestamp: timeoutTimestampNanoseconds,
					memo: pfm_memo,
				}),
			};
			console.log(transferMsg)

NOTE: MsgTransfer.memo is not the transaction memo/note, which is why this is succesful

@Reecepbcups
Copy link
Member

Closing this PR as this change can't / wont work here with the go relayer due to the underlying IBC spec. Happy continue to answer questions here though if you have any :)

@luckychess
Copy link
Author

@Reecepbcups thanks for your reply! I clearly did not notice the difference between 2 different memos. Am I correct that as a CLI tool relayer can only set the user facing memo but not the IBC memo?

@Reecepbcups
Copy link
Member

@luckychess Correct

Only users have to set the packet metadata info. The relayer just moves packets regardless of what the memo is.

What makes it even more confusing:

  • the --memo / --note in the standard appd CLI is parsed by ibc-go to add the memo to the PacketMetadata, and hides it from the real memo.

if that at all confused you just ignore. It's just reallyyyy bad UX all around, we agree

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