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: don't ignore valid deposits when another one fails #4165

Merged
merged 14 commits into from
Oct 31, 2023

Conversation

dandanlen
Copy link
Collaborator

@dandanlen dandanlen commented Oct 26, 2023

Pull Request

Closes: PRO-944

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

We can witness multiple deposits in a single extrinsic. Previously, if any of these deposits were invalid (because the channel had expired already), then all the witnessed deposits would fail. This change will cause every deposit witnessing extrinsic to succeed, but will emit a DepositIgnored event in case one of the deposits was invalid.

@linear
Copy link

linear bot commented Oct 26, 2023

PRO-944 [BUG] Deposits can be ignored

How to reproduce

Can the bug be reproduced? How? Ideally, provide a bouncer test or unit test that demonstrated the problem.

If we submit a deposit to a non-existent (or expired) channel, then the extrinsic aborts and fails, and any subsequent deposits in the same block are ignored.

Symptoms

How does the bug manifest? If it's not obvious, what behaviour did we expect?

Swaps can fail randomly due to other users submitting swaps too late.

Evidence

Please add any additional supporting metadata such as log output, stack traces, screenshots.

Failed btc deposit witness:

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fperseverance.chainflip.xyz#/explorer/query/784986

image.png

FAO

Tag some relevant people who can look into this.

@martin-chainflip martin-chainflip self-assigned this Oct 26, 2023
@martin-chainflip martin-chainflip marked this pull request as ready for review October 26, 2023 14:59
@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

Merging #4165 (1bd06d0) into main (b9e33be) will increase coverage by 0%.
The diff coverage is 97%.

@@          Coverage Diff          @@
##            main   #4165   +/-   ##
=====================================
  Coverage     72%     72%           
=====================================
  Files        379     379           
  Lines      61581   61594   +13     
  Branches   61581   61594   +13     
=====================================
+ Hits       44161   44176   +15     
- Misses     15122   15123    +1     
+ Partials    2298    2295    -3     
Files Coverage Δ
state-chain/pallets/cf-ingress-egress/src/tests.rs 99% <99%> (-<1%) ⬇️
state-chain/pallets/cf-ingress-egress/src/lib.rs 83% <86%> (-2%) ⬇️

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dandanlen
Copy link
Collaborator Author

Should be ready for re-review

assert_eq!(emitted.len(), 2);
assert!(emitted
.iter()
.filter(|e| matches!(
Copy link
Contributor

Choose a reason for hiding this comment

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

can use find instead of filter().next()

Copy link
Contributor

Choose a reason for hiding this comment

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

which I see you did in the last commit haha 👍 LGTM

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

... And then clippy told me to change it again 😿

@dandanlen dandanlen enabled auto-merge (squash) October 31, 2023 10:38
@dandanlen dandanlen merged commit 43a8e1c into main Oct 31, 2023
41 checks passed
@dandanlen dandanlen deleted the fix/dont-abort-deposits-if-one-fails branch October 31, 2023 11:24
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