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

lp-gateway: Add queue for outbound messages #1696

Merged
merged 7 commits into from
Jan 31, 2024

Conversation

cdamian
Copy link
Contributor

@cdamian cdamian commented Jan 17, 2024

Description

Fixes #1694

Changes and Descriptions

  • Added storage for outbound messages.
  • Added on-idle hook logic for processing outbound messages.
  • Added DispatchResultWithPostInfo to routers for retrieving weight.
  • Added storage for failed outbound messages.
  • Added extrinsics for manually executing messages.

Checklist:

  • I have added Rust doc comments to structs, enums, traits and functions
  • I have made corresponding changes to the documentation
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works

Copy link
Contributor

@lemunozm lemunozm left a comment

Choose a reason for hiding this comment

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

LGTM!

Just a question

pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
@cdamian cdamian force-pushed the 1694-feat-implement-queue-logic-for-outbound-queue branch from 3b7c6f7 to cdd9030 Compare January 17, 2024 19:27
@@ -257,7 +253,10 @@ where
true,
)?;

Ok(())
Ok(PostDispatchInfo {
actual_weight: Some(self.xcm_domain.overall_weight),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The above call to transact_through_sovereign returns a normal DispatchResult, meaning that we cannot get the weight of the call. If there is another way of retrieving the weight of that call, please let me know and I will adjust.

@cdamian cdamian self-assigned this Jan 17, 2024
Copy link
Collaborator

@mustermeiszer mustermeiszer left a comment

Choose a reason for hiding this comment

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

First look.

pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
@mustermeiszer
Copy link
Collaborator

@cdamian cdamian force-pushed the 1694-feat-implement-queue-logic-for-outbound-queue branch from cdd9030 to d4f41a8 Compare January 18, 2024 14:06
Copy link
Collaborator

@mustermeiszer mustermeiszer 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 good! Need to check the weights again in more detail. Probably need @wischli eyes on this too!

Should we add anymore test? I would like to bring this into the next RU if possible.

@gpmayorga
Copy link
Contributor

there was an error in the pipeline due to Gcloud permissions. It is fixed but it seems like Clippy is unhappy still

@wischli wischli added this to the Centrifuge 1025 milestone Jan 24, 2024
Copy link
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

Looks really good and clean! I have one minor, pedantic change request for the weight calculation because we are introducing an inherent here were being correct is important.

Apart from that, sorry about the large list of nits which can be ignored 🫠

runtime/altair/src/liquidity_pools.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Outdated Show resolved Hide resolved
@cdamian cdamian force-pushed the 1694-feat-implement-queue-logic-for-outbound-queue branch from d4f41a8 to 53c3df9 Compare January 29, 2024 13:37
wischli
wischli previously approved these changes Jan 30, 2024
Copy link
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

Thanks a lot for adhering to my pedantic nit picks 🫶. We only need to discuss the missing cleanup possibility of failure-safe messages, which IMO does not have to be part of this PR.

pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
@cdamian cdamian force-pushed the 1694-feat-implement-queue-logic-for-outbound-queue branch from 27b3abe to 564fb2c Compare January 30, 2024 10:56
/// `FailedOutboundMessages` storage.
#[pallet::weight(T::WeightInfo::process_outbound_message())]
#[pallet::call_index(6)]
pub fn process_outbound_message(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note how we always return Ok(()) here so that we can preserve the storage changes in case of errors.

/// Manually process a failed outbound message.
#[pallet::weight(T::WeightInfo::process_failed_outbound_message())]
#[pallet::call_index(7)]
pub fn process_failed_outbound_message(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note how we always return Ok(()) here so that we can preserve the storage changes in case of errors.

wischli
wischli previously approved these changes Jan 31, 2024
Copy link
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

Great test additions!

pallets/liquidity-pools-gateway/src/tests.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/tests.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway/src/lib.rs Show resolved Hide resolved
@cdamian cdamian force-pushed the 1694-feat-implement-queue-logic-for-outbound-queue branch from be88d26 to 9245f57 Compare January 31, 2024 09:39
@cdamian cdamian merged commit 70babe3 into main Jan 31, 2024
9 checks passed
@cdamian cdamian deleted the 1694-feat-implement-queue-logic-for-outbound-queue branch January 31, 2024 11:34
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.

Feat: Implement Queue Logic for Outbound-Queue
5 participants