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

add Argo revert_outbound_transfer extrinsic #5158

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

kdembler
Copy link
Member

@kdembler kdembler commented Jun 2, 2024

Based on #5155

Adds a new revert_outbound_transfer extrinsic. Functionally, the new extrinsic is almost the same as finalize_inbound_transfer:

  1. It verifies that the caller is the operator
  2. It checks mint allowance
  3. It mints new tokens

The only difference is in input arguments and the emitted event.

Todo:

  • Add proper benchmarks and weights

@kdembler kdembler changed the title WIP: argo bridge add Argo revert_outbound_transfer extrinsic Jun 2, 2024
@kdembler kdembler mentioned this pull request Jun 2, 2024
Copy link
Contributor

@freakstatic freakstatic left a comment

Choose a reason for hiding this comment

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

LGTM!
@kdembler do you want me to handle the benchmark tests for this or are you gonna do that as well?

@kdembler
Copy link
Member Author

kdembler commented Jun 2, 2024

@freakstatic if you could do that, that'd be great

Copy link
Contributor

@ignazio-bovo ignazio-bovo left a comment

Choose a reason for hiding this comment

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

Logic looks ok, I have just left a few points

#[weight = WeightInfoArgo::<T>::finalize_inbound_transfer()]
pub fn revert_outbound_transfer(
origin,
transfer_id: TransferId,
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that this is an identifier whose validity is already confirmed by the squid.
Given that there are no checks on this...

Copy link
Contributor

Choose a reason for hiding this comment

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

Namely the extr. assumes that transfer_id will refer to a pending transfer outbound request queued in the argo-squid

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, likewise we don't check it any way when calling finaliza_inbound_transfer. It all assumes that the operator is acting correctly

let caller = ensure_signed(origin)?;
ensure!(caller == Self::operator_account().unwrap(), Error::<T>::NotOperatorAccount);

ensure!(Self::status() == BridgeStatus::Active, Error::<T>::BridgeNotActive);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be present?
I am thinking about the following scenario:

  1. Transaction outbound exists
  2. Bridge is paused
  3. User tries to revert transaction

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, when the bridge is paused, nothing should be callable. Also it's not user that reverts the transaction, it's the operator

));
});
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Despite my previous comment I will point this out :
transfer revert failing test case for bridge status not active is missing

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we should add this as well. Let me do this in next PR though, at this branch there are small issues with bridge status that I fixed on my next branch

@ignazio-bovo ignazio-bovo self-requested a review June 4, 2024 12:48
Copy link
Contributor

@ignazio-bovo ignazio-bovo left a comment

Choose a reason for hiding this comment

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

LGTM

@kdembler kdembler merged commit e193904 into Joystream:petra Jun 4, 2024
16 of 24 checks passed
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.

None yet

3 participants