Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

fix: review sov-ibc-transfer implementation and apply fixes #133

Merged
merged 12 commits into from
Apr 11, 2024

Conversation

Farhad-Shabani
Copy link
Member

@Farhad-Shabani Farhad-Shabani commented Apr 10, 2024

Closes: #132

Description

Along with this PR:

  • Removed now redundant escrowed_token state field.
  • With TokenId, we can directly get its String representation, eliminating the need to rely on memo.
  • Introduced a new minted_token_id_to_name to disallow using the TokenId of an IBC-minted token as the denomination for sending back to the source chain. (Brought up in discussions with @rnbguy)
  • Enforced context object for the token creation in the minting process to use the ibc_transfer address as the sender.

PR author checklist

  • Linked to GitHub issue.
  • Added tests.
  • Updated code comments and documentation (e.g., docs/).

@Farhad-Shabani Farhad-Shabani changed the title fix: remove now redundant escrowed_token + move away from base64-encoded memo fix: remove redundant escrowed_token + move away from base64-encoded memo Apr 10, 2024
@Farhad-Shabani Farhad-Shabani requested a review from rnbguy April 10, 2024 05:03
Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks, Farhad!

Comment on lines 149 to 153
if !memo.as_ref().is_empty() {
return Err(TokenTransferError::Other(
"Memo must be empty when burning tokens".to_string(),
));
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain why this is required?

Copy link
Member Author

@Farhad-Shabani Farhad-Shabani Apr 10, 2024

Choose a reason for hiding this comment

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

Just a safety check and disallowing someone to pass a huge memo that might overload the system. This perhaps should be taken care at ibc-rs ( I mean the memo size), then we can drop it here.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes. But this may prevent users from using the ibc-middleware hooks in counterparty chains.

Copy link
Member

Choose a reason for hiding this comment

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

Can you please add some comments about this situation?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

The new changes look awesome ! 👍

Added new comments.

mocks/src/sovereign/runner.rs Outdated Show resolved Hide resolved
modules/sov-ibc-transfer/src/context.rs Outdated Show resolved Hide resolved
modules/sov-ibc-transfer/src/context.rs Outdated Show resolved Hide resolved
modules/sov-ibc-transfer/src/rpc.rs Show resolved Hide resolved
modules/sov-ibc-transfer/src/lib.rs Show resolved Hide resolved
modules/sov-ibc-transfer/src/context.rs Outdated Show resolved Hide resolved
@Farhad-Shabani Farhad-Shabani changed the title fix: remove redundant escrowed_token + move away from base64-encoded memo fix: review sov-ibc-transfer implementation and apply fixes Apr 10, 2024
Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

I added some last comments. Otherwise, the PR looks solid 🪨

Thanks, @Farhad-Shabani ! ✨

modules/sov-ibc-transfer/src/context.rs Outdated Show resolved Hide resolved
Comment on lines 149 to 153
if !memo.as_ref().is_empty() {
return Err(TokenTransferError::Other(
"Memo must be empty when burning tokens".to_string(),
));
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add some comments about this situation?

modules/sov-ibc-transfer/src/context.rs Outdated Show resolved Hide resolved
modules/sov-ibc-transfer/src/context.rs Outdated Show resolved Hide resolved
modules/sov-ibc-transfer/src/rpc.rs Outdated Show resolved Hide resolved
modules/sov-ibc-transfer/src/rpc.rs Show resolved Hide resolved
modules/sov-ibc-transfer/src/rpc.rs Show resolved Hide resolved
@Farhad-Shabani Farhad-Shabani merged commit 4e37dc4 into main Apr 11, 2024
11 checks passed
@Farhad-Shabani Farhad-Shabani deleted the farhad/simplify-ibc-transfer-impl branch April 11, 2024 02:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Remove now redundant escrowed_token state
2 participants