Section C• Last verified November 2026
Budget Management & Reservations
Mathematical accounting: spent vs reserved vs available budget, and concurrent spending defense.
Two-Phase Budget Reservations
To prevent two concurrent agents from simultaneously spending the same available balance, Mandate uses a two-phase reservation protocol in PostgreSQL:
- Phase 1 (Reserve): Atomically verify availability and lock the exact amount in
mandate_reservationsusingSELECT ... FOR UPDATE. - Phase 2 (Settle or Release): Once the NEAR transaction confirms onchain, convert the reservation into a permanent settled expenditure. If the transaction fails, release the reservation back to available budget immediately.
Preventing Race Conditions & Double-Spending
Even under adversarial concurrency tests with 50+ simultaneous agent proposals, Mandate's reservation engine guarantees that total settled + reserved yoctoNEAR never exceeds authorized budget by even 1 yoctoNEAR.