Skip to content

fix: enforce max lockout - #134

Merged
SWvheerden merged 2 commits into
tari-project:mainfrom
SWvheerden:sw_max_lockout
Jul 31, 2026
Merged

SWvheerden merged 2 commits into
tari-project:mainfrom
SWvheerden:sw_max_lockout

Conversation

@SWvheerden

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens UTXO locking by enforcing a maximum lock duration (365 days) and replacing potentially panicking chrono arithmetic with checked, total helpers—preventing mutex poisoning and process-wide lockout outages from untrusted inputs.

Changes:

  • Introduces MAX_SECONDS_TO_LOCK_UTXOS with validation + a checked lock_expiry_at(..) helper and adds tests for bounds and poison recovery.
  • Validates lock duration at API boundaries (and within the locker) and maps invalid durations to HTTP 400.
  • Updates OpenAPI to document/enforce the maximum lock duration.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openapi.json Adds maximum constraints and updates descriptions for lock-duration fields in the published OpenAPI spec.
minotari/src/transactions/manager.rs Switches to checked lock-expiry computation to avoid chrono overflow panics.
minotari/src/transactions/fund_locker.rs Adds max-duration enforcement, total expiry calculation, poison-recovery behavior, and tests covering the new guarantees.
minotari/src/api/error.rs Maps InvalidLockDuration into a client-facing 400 Bad Request.
minotari/src/api/accounts/params.rs Centralizes request default constants and clarifies serde-default behavior when null is provided.
minotari/src/api/accounts/fund_lock.rs Validates lock duration early, handles explicit null defaults safely, and documents maximum via schema annotations.
minotari/src/api/accounts/burn.rs Validates lock duration for burn requests and documents maximum via schema annotations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread minotari/src/api/accounts/burn.rs Outdated
Comment thread openapi.json
Comment thread minotari/src/api/accounts/fund_lock.rs
@SWvheerden
SWvheerden merged commit 60a45c2 into tari-project:main Jul 31, 2026
2 checks passed
@SWvheerden
SWvheerden deleted the sw_max_lockout branch July 31, 2026 13:47
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.

2 participants