# An attestation is wrong

> What to do when an attested sub-account reports a wrong value, from invalidating it at once to fixing the attesters and re-anchoring.

Source: https://docs.trusslabs.io/vaults/guides/bad-attestation

An attested sub-account is valued by a figure its attesters post, rather than by price feeds. The account refuses a
value that falls too far below its last one on its own. A wrong value inside its allowed band is used, until the
NavGuardian invalidates it.

> **Key points**
>
> - Invalidating is immediate, and stops new capital into the account.
> - While the account is invalidated, the whole vault's NAV is stale, so settlement and instant withdrawals stop.
> - Re-anchoring accepts the latest attestation as the account's value at once, so check that value first.
> - Replacing a NAV provider waits CRITICAL.

## What the account does on its own

Each attestation is placed against a band around the account's last value, moved by what was pushed or returned
since. A value inside the band is used. A value above it is ignored, and the last accepted value stands. A value
below it makes the account invalidated, as if the NavGuardian had acted. See
[Attested sub-accounts](https://docs.trusslabs.io/vaults/architecture/attested-sub-accounts.md).

## Steps

1. Invalidate the value. The NavGuardian or the VaultAdmin calls `invalidateNav()` on the account. From then
   on no attestation counts, however recent, so an attester who keeps posting cannot lift it. Pushes are refused
   and returns send nothing, but the account's permitted calls still run, so positions can be reduced.
2. Find the cause. It may be the attestation service, a NavManager key, or the custodian or venue the value is
   read from.
3. Fix the attesters.
   - The NavAdmin removes a bad NavManager with `setNavManager(key, false)` on the account's NAV provider.
   - If the provider or its NavAdmin is the problem, the VaultAdmin moves the account to a new provider with
     `setNavProvider(provider)` (CRITICAL). The account accepts only a provider bound to it that can be read.
4. Post a correct value. A NavManager calls `attest(assets, observedAt)` on the provider. Check the figure
   against an independent source before going on.
5. Re-anchor. The NavGuardian or the VaultAdmin calls `anchorDeviationToLatestAttestation(expectedAssets,
   expectedObservedAt)`, naming the attestation it checked. The call refuses any other reading, one posted before
   the account's last flow or call, and one older than the account's NAV heartbeat. The account takes that value at
   once, opens a new band around it, and ends the invalidation.
6. Record the new share price. Settle, or turn accrued fees into shares, once the re-anchor lands. Until then
   the vault's share-price views still show the price from before.

## What holders see meanwhile

While the account waits to be re-anchored, settlement and instant withdrawals stop, and the vault's share-price
views refuse to answer rather than give a price known to be wrong. Requests can still be made, cancelled and claimed.
A re-anchor cannot undo a settlement or an instant withdrawal already paid at the wrong value; that loss or gain
stays with the holders who were in the vault.

## A leaked attester or guardian key

A leaked NavManager can post wrong values, which the band limits and invalidation stops. A leaked NavGuardian can
re-anchor to whatever was last posted, so the VaultAdmin revokes it at once if an attester key may also be leaked.
See [A key has leaked](https://docs.trusslabs.io/vaults/guides/leaked-key.md).

## Where to read more

| Page | What it covers |
|---|---|
| [Attested sub-accounts](https://docs.trusslabs.io/vaults/architecture/attested-sub-accounts.md) | How the band, heartbeat and window work |
| [NAV parameters](https://docs.trusslabs.io/vaults/overview/nav-parameters.md) | The attestation settings fixed at deployment |
| [Rotate a key](https://docs.trusslabs.io/vaults/guides/rotate-a-key.md) | Replacing a NavManager or NavAdmin |
| [Emergency controls](https://docs.trusslabs.io/vaults/guides/emergency-controls.md) | Every control that acts at once |
