# Immutability and upgradeability

> Why no Truss vault contract can be upgraded, what can still be swapped or added after launch, and when a new vault is the only way to change something.

Source: https://docs.trusslabs.io/vaults/immutability

No contract in a Truss vault can be upgraded. Each one is a copy of a fixed implementation, or is deployed
directly, and none has an upgrade path. What changes after launch is configuration: which contracts are bound to
the vault, and the limits around them. Holders can rely on the code they see for the vault's whole life.

> **Key points**
>
> - No contract's code can change after it is deployed.
> - Some parts can be swapped for other contracts, and each swap waits its tier.
> - A vault grows by adding sub-accounts, assets, modules and call shapes, within limits fixed at deployment.
> - Changing anything fixed at deployment means deploying a new vault.

## No upgradeable code

The vault, its price oracle, asset registry and policies, its sub-accounts, modules, call verifiers and NAV
providers are minimal clones. A minimal clone is a tiny contract that runs one implementation's code, and it can
never point at another. The NAV oracle and the operator multicalls are deployed directly, and the vault creates its
deposit silo itself. There are no upgradeable proxies.

Each clone is initialized in the same transaction that creates it, so no one else can initialize it first. The
implementations refuse to be initialized. A factory's implementations are fixed when the factory is deployed.

## What the access manager's admin can still change

The VaultAdmin holds the access manager's admin role, and each admin action waits the CRITICAL tier. With it, the
VaultAdmin can:

- map a function to a different role;
- close a contract to every restricted call;
- move a contract to another access manager with `updateAuthority`;
- change who administers a role, and its grant delay.

None of these change code, but they change who can call it. With timelocks on, each is scheduled first, so
holders see it before it runs. The vault checks that a policy or sub-account answers to its own access manager only when binding it. A
contract moved alone stays bound, but its restricted functions then answer to the other access manager.

## Swap, extend or migrate

| Way | What it means | Page |
|---|---|---|
| Swap | Replace a bound contract with another | [Contracts that can be swapped](https://docs.trusslabs.io/vaults/immutability/swappable.md) |
| Extend | Add sub-accounts, assets, modules or call shapes | [Extending a vault](https://docs.trusslabs.io/vaults/immutability/extending.md) |
| Migrate | Deploy a new vault and move to it | Below |

A live vault checks a new sub-account, module or policy only against its own bindings, not against an
implementation. So it can take one built from a newer release, if that contract passes the checks made when it is
bound.

## When a new vault is needed

A new vault is the only way to change what [What is immutable](https://docs.trusslabs.io/vaults/immutability/immutable.md) lists, such as the underlying, the
fee ceilings, the vault's limits or forced transfers. It is also the only way to run a newer version of the vault
contract itself. The contracts have no migration function. Holders move by redeeming from the old vault and
depositing into the new one.

## Where to read more

| Page | What it covers |
|---|---|
| [What is immutable](https://docs.trusslabs.io/vaults/immutability/immutable.md) | Every setting fixed for good, and where to read it |
| [Contracts that can be swapped](https://docs.trusslabs.io/vaults/immutability/swappable.md) | What can be replaced after launch, at which tier |
| [Extending a vault](https://docs.trusslabs.io/vaults/immutability/extending.md) | Adding sub-accounts, assets, modules and call shapes |
| [What can change after deployment](https://docs.trusslabs.io/vaults/overview/what-can-change.md) | Every lever and its effect |
