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

fix(sequencer): fix ibc prefix conversion #1065

Merged
merged 6 commits into from
May 13, 2024
Merged

fix(sequencer): fix ibc prefix conversion #1065

merged 6 commits into from
May 13, 2024

Conversation

noot
Copy link
Collaborator

@noot noot commented May 11, 2024

Summary

prefixes were not being converted correctly for bridge locks, i refactored the ibc prefix conversion to be in its own function and added unit tests for all cases.

Background

found while testing incoming ibc transfers to a bridge account, the denom was not being prefixed before being compared to the allowed asset ID for the bridge account.

Changes

  • put all conversion from packet denom -> converted ibc'd denom into its own convert_denomination function
  • this is now called before everything else in execute_ics20_transfer, so the correct converted denom should be used

Testing

unit tests + tested it with a bridge lock via ibc

@noot noot requested a review from a team as a code owner May 11, 2024 01:51
@noot noot requested a review from Fraser999 May 11, 2024 01:51
@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label May 11, 2024
Copy link
Member

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

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

lgtm

I have to note that it's difficult for me to understand how this fits into ibc because I lack background knowledge.

@@ -244,7 +244,13 @@ impl AppHandlerExecute for Ics20Transfer {
.await
{
Ok(()) => TokenTransferAcknowledgement::success(),
Err(e) => TokenTransferAcknowledgement::Error(e.to_string()),
Err(e) => {
tracing::debug!(
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this should be elevated to info!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

probably not, as we could potentially see this often, users can trigger this by sending invalid transfers to astria

dest_port: &PortId,
dest_channel: &ChannelId,
is_refund: bool,
) -> Denom {
Copy link
Member

Choose a reason for hiding this comment

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

looking at how you use this this might be a use case for Cow<'a, Denom> with Cow::Borrowed(&'a Denom) if is_refund and Cow::Owned(Denom) otherwise.

@noot noot enabled auto-merge May 13, 2024 18:47
@noot noot added this pull request to the merge queue May 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 13, 2024
@noot noot added this pull request to the merge queue May 13, 2024
Merged via the queue into main with commit a393f3a May 13, 2024
36 checks passed
@noot noot deleted the noot/ibc-prefix-fix branch May 13, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants