You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Covers cancel-then-accept: the later accept fails with InvalidStatus, no escrow/investment/funding state is created, and the cancelled bid is not returned by get_best_bid.
Covers accept-then-cancel: the later cancel returns false, while bid, invoice, escrow, investment, indexes, and token balances stay consistent.
One acceptance-note caveat: the issue asks for the losing operation to fail with QuickLendXError. The cancel-then-accept ordering does assert QuickLendXError::InvalidStatus. For the accept-then-cancel ordering, the existing public cancel_bid API returns bool, so this PR documents and asserts the current guard behavior: cancel_bid returns false once the bid is already Accepted, without mutating funded invoice, escrow, or investment state.
I kept this test-only rather than changing the public contract API.
CI is green on the latest push. The repository workflow runs cargo check, cargo test, WASM size checks, and coverage gates. It does not currently run cargo clippy; a whole-repo clippy run still hits pre-existing repo-wide lints outside this PR’s scoped changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Adds focused Soroban regression coverage for
cancel_bidversusaccept_bid_and_fundon the same bid.🔧 Changes Made
quicklendx-contracts/src/test_bid_cancel_accept_race.rs.InvalidStatus, no escrow/investment/funding state is created, and the cancelled bid is not returned byget_best_bid.false, while bid, invoice, escrow, investment, indexes, and token balances stay consistent.🧪 Testing
rustfmt --check --edition 2021 quicklendx-contracts/src/test_bid_cancel_accept_race.rsgit diff --checkcargo test/cargo clippy🔗 Related Issues
Closes #1302
🧪 How to Test
cd quicklendx-contractscargo test --features legacy-tests test_bid_cancel_accept_race -- --nocapture