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-queue: Ensure messages are processed in order #1992

Conversation

cdamian
Copy link
Contributor

@cdamian cdamian commented Sep 20, 2024

Addressing the comment regarding LP gateway queue message processing:
#1991 (comment)

@cdamian cdamian mentioned this pull request Sep 20, 2024
4 tasks
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.

Seems to be an appropriate solution to the comment

pallets/liquidity-pools-gateway-queue/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway-queue/src/lib.rs Outdated Show resolved Hide resolved
pallets/liquidity-pools-gateway-queue/src/lib.rs Outdated Show resolved Hide resolved
@cdamian cdamian marked this pull request as ready for review October 6, 2024 09:40
Copy link

codecov bot commented Oct 6, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 48.37%. Comparing base (ef843b2) to head (571bd9e).
Report is 1 commits behind head on fix/gateway-message-processing.

Files with missing lines Patch % Lines
pallets/liquidity-pools-gateway-queue/src/lib.rs 80.00% 5 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                       @@
##           fix/gateway-message-processing    #1992   +/-   ##
===============================================================
  Coverage                           48.36%   48.37%           
===============================================================
  Files                                 183      183           
  Lines                               13398    13412   +14     
===============================================================
+ Hits                                 6480     6488    +8     
- Misses                               6918     6924    +6     
Flag Coverage Δ
?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cdamian cdamian force-pushed the fix/lp-gateway-queue-ordered-processing branch from d173b9c to 571bd9e Compare October 6, 2024 10:42
.last()
.expect("Queue triggered evm tx.")
.clone();

// The sender is the sender account on the gateway
assert_eq!(T::Sender::get().h160(), status.from);
assert_eq!(status.to.unwrap().0, to.0);
assert!(!receipt_ok(receipt));
Copy link
Contributor Author

@cdamian cdamian Oct 6, 2024

Choose a reason for hiding this comment

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

Note - given that the message processor implementation of the LP gateway is transactional, this check is no longer required.

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.

Thanks Cosmin, I think now it works fine in all scenarios!

Comment on lines +241 to +246
LastProcessedNonce::<T>::set(last_processed_nonce);

// 1 write for setting the last processed nonce
weight_used.saturating_accrue(T::DbWeight::get().writes(1));

continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! I think this fixes the issue of having "holes" in the queue.

@cdamian cdamian merged commit a437056 into fix/gateway-message-processing Oct 7, 2024
12 of 13 checks passed
@cdamian cdamian deleted the fix/lp-gateway-queue-ordered-processing branch October 7, 2024 12:11
cdamian added a commit that referenced this pull request Oct 9, 2024
* lp-gateway: Update message recovery comment

* lp-gateway: Use transactional in MessageProcessor implementation

* lp-gateway: Iterate over inbound sub-messages only during execution

* lp-gateway: Add session ID check for message entries

* lp-gateway: Use defensive weight during message recovery

* lp-gateway: Make MessageProcessor implementation transactional

* lp-gateway-queue: Use  when checking servicing weight

* lp-gateway: Move import

* lp-gateway-queue: Remove extra weight check

* lp-gateway-queue: Get ordered MessageQueue keys and iterate over them

* lp-gateway: Add session ID change tests

* lp-gateway: Drop support for inbound batch messages

* lp-gateway-queue: Ensure messages are processed in order (#1992)

* lp-gateway-queue: Ensure messages are processed in order

* lp-gateway-queue: Ensure processed messages are skipped

* integration-tests: Remove receipt check

* pallet: Rename event
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.

3 participants