xVault Docs
Security

On-chain invariants

The guarantees every xVault instruction must uphold, enforced via require! checks and exercised by test suites.

Every balance-moving ix in xVault re-verifies a small set of invariants before executing. These are the guarantees the protocol makes on-chain; they are enforced by require! checks in the Anchor programs and exercised by the Mocha/Bankrun test suite.

Core invariants

Every ix must hold these

Violation means the instruction reverts cleanly with a typed error code. No balance or weight is ever moved when an invariant fails.

  • NAV conservation: Σ raw_holdings_value_usd == vault_state.last_nav ± rounding epsilon.
  • Share accounting: vault_share_supply × nav_per_share == total_aum.
  • Weight sum: sum(target_weights) == 10_000 basis points.
  • Multiplier match: multiplier_on_chain == expected_multiplier before any transfer.
  • NAV freshness: now - oracle.updated_at ≤ MAX_STALE_SECS for NAV-sensitive ix (60 s market hours, 300 s off-hours).
  • Halt gate: for every asset in a vault, isAtomicTradingHalted == false or the vault is paused.
  • Corp-action gate: a pending corporate action of type SpinOff | *Merger | Redemption | WorthlessRemoval | RightsDistribution within 48 h of activation implies the vault is auto-paused. The gate follows the xStocks status lifecycle — Cancelled, Dismissed, and dropped events auto-clear the pause.

Threat model

AssetAttacker goalControl
Vault xStock holdingsDrain via malicious ixAnchor invariants, fuzz tests, audits
Oracle NAVManipulate to mint cheap sharesKeeper multisig, staleness guard, Pyth tertiary fallback, deviation cap
$VLT treasuryUnauthorized transferSquads v4 (3-of-5) multisig, 48 h timelock on param changes
Keeper private keysSign a rogue rebalanceHSM/KMS, per-slot tx cap, rate limits, canary alerts
FrontendPhishing / supply-chainSubresource integrity, pinned deps, CSP, signed releases
UserMEV sandwich on deposit/withdrawmin_shares_out / max_slip_bps, private-RPC opt-in

Error codes

Each program declares its own ErrorCode enum. Representative entries from programs/vault:

CodeWhen it fires
AssetHaltedAsset system status reports atomic trading halted and vault isn't paused.
StaleNavOracle snapshot older than MAX_STALE_SECS.
MultiplierMismatchOn-chain multiplier differs from the keeper-supplied expectation.
SlippageExceededRebalance leg delta exceeds the vault's rebalance_slippage_bps.
VaultPausedDeposit or rebalance attempted against a paused vault.
WeightSumInvalidProposed weights don't sum to 10 000 bps.
MinSharesOutNotMetUser's deposit slippage bound not satisfied.
MaxSlipBpsExceededUser's USDC-withdrawal slippage bound not satisfied.

Authority boundaries

ActorAllowed ix
Userdeposit, withdraw_in_kind, withdraw_usdc, stake, claim
Keeper (authorized set)rebalance_leg, distribute_epoch, NAV snapshot updates
Admin multisig (3-of-5)init_vault, set_paused, set_pause_flags, update_weights, update_keeper_set, program upgrades
  • Timelock: 48 h on weight changes, fee changes, keeper set changes, and program upgrades.
  • Pause: multisig-authorized; no timelock so emergency halts are fast.
  • Upgrades: program upgradability is planned to be renounced after 6 months of mainnet stability, via governance vote.

Audits

ScopeVendorStatus
vault programTBD (Neodyme / OtterSec / Zellic)Scheduled pre-mainnet
oracle + rewards programsSame + independent reviewerScheduled pre-mainnet
Keeper serviceInternal + one external reviewerBefore v1

Bug bounty

Hosted on Immunefi, up to $250 k for critical findings, starting post-audit. Scope covers all programs plus the keeper signing path.

Incident response

Pause the affected vault within 1 minute of alert (guardian role).
Post-mortem published on Discord and Mirror within 48 hours.
Migration vault with patched code if user funds are at risk — snapshot and migrate.
Bounty payout within 7 days post-incident, if applicable.

Data and privacy

  • No PII collected from users.
  • Analytics: self-hosted Plausible, no cookies.
  • Wallet addresses are logged server-side only for indexing; deleted on request (GDPR).

On this page