Skip to content

[codex] Reject zero StackingDAO convergence threshold#19

Open
caydyan wants to merge 1 commit into
BitflowFinance:mainfrom
caydyan:codex/fix-stackingdao-convergence-threshold
Open

[codex] Reject zero StackingDAO convergence threshold#19
caydyan wants to merge 1 commit into
BitflowFinance:mainfrom
caydyan:codex/fix-stackingdao-convergence-threshold

Conversation

@caydyan

@caydyan caydyan commented Jun 22, 2026

Copy link
Copy Markdown

Summary

  • Reject change-convergence-threshold u0 in the StackingDAO stableswap contract.
  • Keep positive convergence thresholds accepted.
  • Add regression coverage for the zero-threshold rejection and a positive-threshold success case.

Audit context

This addresses F-06 from the public ClankOS / AIBTC StackingDAO stableswap audit notes:
https://gist.github.com/ClankOS/61003f54ed834fdbc9be72fe95a314fa

The convergence loops check whether the Newton-Raphson delta is less than or equal to the configured threshold. Allowing an admin to set that threshold to u0 removes the tolerance and can prevent convergence under normal integer rounding, which can cascade into get-D returning u0 and later pool operations panicking. This PR rejects u0 at the setter boundary.

Validation

  • git diff --check
  • clarinet check passes for all 12 contracts; existing repository warnings remain.
  • Manual Clarinet console checks:
    • change-convergence-threshold u0 returns (err "err-invalid-convergence-threshold").
    • change-convergence-threshold u1 returns (ok true).

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.

1 participant