Skip to content

test: add auction double closure regression#351

Merged
Yunusabdul38 merged 2 commits intoAgora-Events:mainfrom
David-patrick-chuks:fix/issue-212-auction-double-finalization-guard
Mar 29, 2026
Merged

test: add auction double closure regression#351
Yunusabdul38 merged 2 commits intoAgora-Events:mainfrom
David-patrick-chuks:fix/issue-212-auction-double-finalization-guard

Conversation

@David-patrick-chuks
Copy link
Copy Markdown
Contributor

Overview

This PR verifies the auction double-finalization guard in close_auction and adds regression coverage to ensure an auction cannot be closed more than once. The new test exercises a successful auction close followed by a second close attempt, which must be rejected.

Related Issue

Closes #212

Changes

⚙️ Auction Finalization Guard

  • [VERIFY] contract/contracts/ticket_payment/src/contract.rs
    • Confirmed close_auction checks is_auction_closed before finalizing the auction.
    • Confirmed a second closure attempt returns TicketPaymentError::AuctionEnded.

🧪 Unit Tests

  • [MODIFY] contract/contracts/ticket_payment/src/test.rs
    • Added test_close_auction_rejects_double_closure.
    • Covers a real auction flow: place bid, close auction successfully once, then reject a second close attempt.
    • Verifies the first payment remains confirmed and no second payment record is created.

Verification Results

Acceptance Criteria Status
close_auction prevents double finalization
Double closure attempt is covered by unit tests
Local cargo test passes
Local cargo clippy --all-targets --all-features -- -D warnings passes

How to Test

# 1. Confirm you're on the branch
git branch --show-current

# 2. Run the full contract test suite
cd contract
cargo test
<img width="596" height="351" alt="image" src="https://github.com/user-attachments/assets/73de3e9e-474f-4ed9-9914-9ec05f1dca0c" />

# 3. Run clippy with warnings denied
cargo clippy --all-targets --all-features -- -D warnings
<img width="574" height="65" alt="image" src="https://github.com/user-attachments/assets/ea41140b-5b0c-4c59-a3cd-3166d84dad30" />

# 4. Optional: inspect the relevant test change
git diff -- contract/contracts/ticket_payment/src/test.rs

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

@David-patrick-chuks is attempting to deploy a commit to the oseh-svg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@David-patrick-chuks Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Yunusabdul38
Copy link
Copy Markdown
Contributor

@David-patrick-chuks fix ci error

@David-patrick-chuks
Copy link
Copy Markdown
Contributor Author

@Yunusabdul38 FIXED

@Yunusabdul38 Yunusabdul38 merged commit 265540e into Agora-Events:main Mar 29, 2026
3 of 4 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.

Auction Double Finalization Guard

2 participants