Authority Predicates & Revocation
Versioned AuthorityMandate PDAs, deterministic predicate checks, rolling epoch accounting, and immediate 1-slot revocation.
Separating treasury ownership from agent execution
An autonomous agent needs to sign payment locks without human intervention, while the sponsor needs hard on-chain limits that survive prompt injection or runaway loops. Kalo resolves this with AuthorityMandate PDAs seeded by:
["authority_mandate", privacy_ring, agent_pubkey, version.to_le_bytes()]Only the privacy_ring.owner can call issue_mandate or revoke_mandate. Only mandate.agent_pubkey can sign lock_sealed_402 against that mandate.
Deterministic predicate checks
Every lock_sealed_402 instruction evaluates six predicates in order before creating SealedEscrow or deducting vault_balance:
- Ownership & binding: Anchor constraints verify
authority_mandate.ring == privacy_ring.key()andauthority_mandate.agent_pubkey == agent.key(). - Revocation:
require!(!mandate.revoked, KaloError::MandateRevoked). - Expiry:
require!(clock.unix_timestamp < mandate.expires_at, KaloError::MandateExpired). - Enclave liveness & category:
require!(enclave.active && clock.slot < enclave.expires_slot, KaloError::EnclaveInactive)andrequire!((mandate.category_mask & enclave.service_category) != 0, KaloError::CategoryForbidden). - Per-call cap:
require!(amount <= mandate.per_call_cap, KaloError::CapExceeded). - Epoch budget: After rolling the epoch window if needed,
require!(mandate.epoch_spent + amount <= mandate.epoch_budget, KaloError::CapExceeded).
Rolling epoch accounting
Each mandate stores epoch_budget (u64), epoch_spent (u64), epoch_duration_sec (i64, minimum 60), and epoch_start_ts (i64, initialized to clock.unix_timestamp at issue_mandate).
Inside lock_sealed_402:
if clock.unix_timestamp >= mandate.epoch_start_ts.saturating_add(mandate.epoch_duration_sec) {
mandate.epoch_spent = 0;
mandate.epoch_start_ts = clock.unix_timestamp;
}
let next_spent = mandate
.epoch_spent
.checked_add(amount)
.ok_or(KaloError::MathOverflow)?;
require!(next_spent <= mandate.epoch_budget, KaloError::CapExceeded);
mandate.epoch_spent = next_spent;No off-chain crank is required to reset an epoch. The first call after epoch_duration_sec elapses resets epoch_spent lazily on-chain.
Versioning and policy rotation
Because version (u32) is part of the PDA seeds, a sponsor can issue a replacement mandate (version + 1) for the same (privacy_ring, agent_pubkey) pair without closing or mutating prior records. Active agents switch to the new mandate address while the old version is revoked.
Single-slot revocation
revoke_mandate requires only two accounts (owner signer and authority_mandate PDA) and performs one state transition:
require!(!mandate.revoked, KaloError::MandateRevoked);
mandate.revoked = true;Once landed, revoked cannot be flipped back to false. Any in-flight or future lock_sealed_402 referencing that mandate fails immediately with MandateRevoked (6005). Existing Locked escrows created before revocation still settle or refund normally so providers are never cheated out of in-flight compute.
Sub-delegation and escalation tiers
In Kalo's road, Build 5 extends AuthorityMandate with parent-child sub-delegation (child caps and category masks strictly inside the parent's remaining epoch budget, with cascading revocation) and sponsor approval queues for over-cap HTTP 402 quotes.