Skip to content

test: cover update_maturity_max_horizon bounds and downstream maturity validation#550

Merged
mikewheeleer merged 1 commit into
Liquifact:mainfrom
dotmantissa:test/contracts-maturity-max-horizon
Jun 28, 2026
Merged

test: cover update_maturity_max_horizon bounds and downstream maturity validation#550
mikewheeleer merged 1 commit into
Liquifact:mainfrom
dotmantissa:test/contracts-maturity-max-horizon

Conversation

@dotmantissa

Copy link
Copy Markdown
Contributor

Add focused tests in escrow/src/tests/admin.rs asserting the full behavioural contract of update_maturity_max_horizon and its interaction with update_maturity:

  • Admin gate: unauthorized callers are rejected (require_auth enforced)
  • Event emission: mtry_max event carries correct old and new horizon values
  • Default fallback: get_maturity_max_horizon returns DEFAULT_MATURITY_MAX_HORIZON_SECS when no explicit horizon has been stored
  • Security invariant: lowering the horizon does not retroactively invalidate an already-set maturity; the stored maturity remains unchanged after the horizon update
  • Rejection after lowering: a subsequent update_maturity targeting now + new_horizon + 1 is rejected, and the stored maturity stays intact after the failed call
  • Within-horizon success: an update_maturity within the lowered ceiling still succeeds

Also includes formatting fixes across several test modules to satisfy cargo fmt.

Closes #479

…y validation

Add focused tests in escrow/src/tests/admin.rs asserting the full behavioural
contract of update_maturity_max_horizon and its interaction with update_maturity:

- Admin gate: unauthorized callers are rejected (require_auth enforced)
- Event emission: mtry_max event carries correct old and new horizon values
- Default fallback: get_maturity_max_horizon returns DEFAULT_MATURITY_MAX_HORIZON_SECS
  when no explicit horizon has been stored
- Security invariant: lowering the horizon does not retroactively invalidate an
  already-set maturity; the stored maturity remains unchanged after the horizon update
- Rejection after lowering: a subsequent update_maturity targeting now + new_horizon + 1
  is rejected, and the stored maturity stays intact after the failed call
- Within-horizon success: an update_maturity within the lowered ceiling still succeeds

Also includes formatting fixes across several test modules to satisfy cargo fmt.
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

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

@mikewheeleer

Copy link
Copy Markdown
Contributor

looks good — in it goes 🚀

@mikewheeleer mikewheeleer merged commit ce0c7fc into Liquifact:main Jun 28, 2026
1 check failed
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.

Add tests for update_maturity_max_horizon bounds and its effect on later maturity updates

2 participants