pango

Concepts

The guard account

Where the snapshot lives, and why it cannot be reused.

Each owner has one guard account, a PDA of the program with the seeds ["guard", owner]. It is created once (init) and holds 1968 bytes: a header and up to ten snapshots of 192 bytes.

Layout

OffsetField
0version
1armed (1 between Begin and End)
2number of watched accounts
3bump
8owner (32 bytes)
40slot of the snapshot
48 + 192 ientry i: key, kind, flags, lamports, amount, program, token owner, delegate, delegated amount, close authority

Why a snapshot cannot be replayed

  • End requires armed = 1 and the snapshot slot equal to the current slot.
  • End reads the Instructions sysvar and requires a Begin for this guard earlier in the same transaction.
  • End must be the last instruction, so nothing can be added after the check.
  • Only the owner can use their guard: the owner must sign and the PDA is derived from their address.

Rent

The account keeps about 0.0146 SOL. Close returns it to the owner.