Skip to content

fix: align scheduled path check order with direct path - #666

Open
samjay8 wants to merge 1 commit into
Betta-Pay:mainfrom
samjay8:fix/issue-523
Open

fix: align scheduled path check order with direct path#666
samjay8 wants to merge 1 commit into
Betta-Pay:mainfrom
samjay8:fix/issue-523

Conversation

@samjay8

@samjay8 samjay8 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Closes #523

Summary

  • The scheduled (_set_settlement_rule) and direct (set_settlement_rule) paths enforced different validation orderings, causing the observable error to vary by path for the same invalid input.
  • Added missing validate_fee_against_governance to the scheduled path and reordered checks to match the canonical order: pause → governance fee → fee bounds → delay → merchant registration.
  • Added a matrix test that asserts error-code parity across both paths for every (paused, invalid-fee, missing-merchant) combination.

Error-precedence matrix (after fix)

paused invalid fee missing merchant Direct path error Scheduled path error
Paused (5) Paused (5)
Paused (5) Paused (5)
Paused (5) Paused (5)
Paused (5) Paused (5)
InvalidFeeBps (4) InvalidFeeBps (4)
InvalidFeeBps (4) InvalidFeeBps (4)
MerchantMissing (302) MerchantMissing (302)

Scope

Does not touch other _set_* functions, event emission, or storage TTL logic — limited to check ordering in _set_settlement_rule only.

Testing

Files changed

  • settlement_contract/src/admin.rs — added validate_fee_against_governance import and reordered checks in _set_settlement_rule
  • settlement_contract/src/tests/admin_tests.rs — added matrix test for check-order parity

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@samjay8 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

@freebuff-web
freebuff-web Bot force-pushed the fix/issue-523 branch 3 times, most recently from acd79a8 to c18baa6 Compare September 3, 2026 08:40
…ay#523)

Added validate_fee_against_governance to the scheduled path and reordered
checks to match the direct path. Canonical check order is now:
pause → governance fee → fee bounds → delay → merchant registration.
Added a matrix test that asserts error-code parity across both paths.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
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.

Settlement set_settlement_rule pauses after registering check ordering with the scheduled path

1 participant