TrussDocs

Architecture

Rate limits

How Truss vaults limit how fast money can move into sub-accounts, through swaps, into lending and out through instant withdrawals, and which limits can change.

A rate limit caps how much can move in a period of time. It means one bad key, bad price or bad venue cannot move everything at once. A Truss vault meters money going into sub-accounts, through swaps, into lending venues and out through instant withdrawals. Each limit is set when the vault is deployed and can change later.

Key points

  • Every rate limit is a bucket with a capacity that refills at a fixed rate each second.
  • A bucket starts at zero, which refuses that flow until it is raised.
  • Raising a limit waits the HIGH tier; lowering one is immediate.
  • Limits slow a flow down. They do not decide whether the flow is a good idea.

How a bucket works

A bucket has a capacity and a refill rate per second. Each flow uses up part of the capacity, which refills over time back up to the full amount. A flow larger than what is available is refused with RateLimited, and nothing moves. A bucket at zero refuses every flow.

Because a full bucket can be drained and then matched by its refill, the most a flow can take in one refill period is about twice the capacity. Lowering a capacity also lowers what is left to use. A bucket can be set to unlimited, with no refill rate, which turns it off.

What can be limited

FlowBucketUnit
Pushes into a sub-accountOne per sub-accountUSDC
SwapsOne in and one out, per sub-account and tokenThat token
Supply to a lending venueOne per sub-account and venueThe venue's asset
Instant withdrawalsOne window per vaultA share of net assets

Each sub-account also has a cap on its net deployed principal: what the vault pushed in, less what came back. It counts principal, not value, so a sub-account that performs well is not capped out.

A swap is metered after it runs, on what the sub-account measured: what left counts against the outbound bucket of that token, and what arrived against the inbound bucket of the other. Withdrawing from a lending venue is never metered, so a limit never keeps a vault from leaving a venue.

The instant window is charged each instant withdrawal's share of net assets, rounded up, so a run of small withdrawals cannot take more than the window holds.

For example, the committed preprod Base config gives its sub-account a push bucket and a supply bucket per venue of 5,000 USDC, each refilling over one day, and starts the instant window at zero.

Deposits and withdrawals

Deposits are limited by the deposit cap, which caps the total net principal settled into the vault. It is a cap, not a bucket, so it does not refill. Settled redemptions are not rate-limited, and bringing capital back from a sub-account with returnAssetsToVault is never limited either. The instant path has its own window, above.

The levers

LimitRaised by, after HIGHLowered at once by
Push buckets and sub-account capsVaultAdminSentry, VaultAdmin
Swap bucketsVaultAdminSentry, VaultAdmin
Lending supply bucketsVaultAdminSentry, VaultAdmin
Instant windowVaultAdminVault managers, Sentry, VaultAdmin
Deposit capVaultAdminVault managers, Sentry, VaultAdmin

Each bucket's capacity and refill rate are separate levers. The deployer sets every bucket and cap when the vault is deployed, and the factory caps the highest any sub-account cap and the deposit cap can ever be raised to.

Where to read more

PageWhat it covers
Sub-account policiesWhere each bucket is checked
What can change after deploymentEvery lever and its tier
Instant withdrawalsHow the instant window is used
Deployment parametersThe factory's limits