Skip to content

docs: document solvency invariant design + add PoC repro (closes #16)#17

Merged
andsav merged 1 commit into
qmrkt:mainfrom
Tusharkhadde:bounty/issue-16-solvency-lock-poc
Apr 26, 2026
Merged

docs: document solvency invariant design + add PoC repro (closes #16)#17
andsav merged 1 commit into
qmrkt:mainfrom
Tusharkhadde:bounty/issue-16-solvency-lock-poc

Conversation

@Tusharkhadde
Copy link
Copy Markdown
Contributor

Closes #16

Per @andsav's request — submitting as the deliverable for the partial bounty award.

Changes (no logic modified):

  • Added design rationale comment to _assert_invariants() explaining why STATUS_DISPUTED is gated behind pool >= total_cost_basis
  • Added tests/repro_solvency_lock.py — PoC confirming the guard fires correctly under pool-depletion conditions
  • Added audit/bug13_solvency_lock_dispute.txt — original report as audit trail

Thanks again for the thorough review on #13.

…epro (closes qmrkt#16)

- Add detailed DESIGN NOTE comment to _assert_invariants() explaining why
  STATUS_DISPUTED is intentionally gated behind pool >= total_cost_basis.
  This was flagged as poorly documented in the qmrkt#13 review thread.

- Add tests/repro_solvency_lock.py: a documented reproduction test that
  demonstrates the pool-depletion condition and confirms the guard fires
  correctly. Includes assertion that the market is NOT stuck — it remains
  in STATUS_RESOLUTION_PROPOSED and can still be finalised.

- Add audit/bug13_solvency_lock_dispute.txt: security report artifact for
  the audit trail (originally submitted as qmrkt#13 bug bounty report).

No contract logic is changed. The invariant check is preserved as-is.

Closes qmrkt#16
@andsav
Copy link
Copy Markdown
Collaborator

andsav commented Apr 26, 2026

Thank you for adding the clarifying comment there.

As mentioned, I will revise this mechanism and ideally enable cancel/dispute. Contract size limit is an issue currently, so a larger refactor might be necessary.

@andsav andsav merged commit f4db01a into qmrkt:main Apr 26, 2026
1 check 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.

question.market bug bounty - partial reward

2 participants