flowchart LR
classDef pkg fill:#d5e8d4,stroke:#82b366;
classDef dead fill:#f8cecc,stroke:#b85450;
classDef chk fill:#dae8fc,stroke:#6c8ebf;
classDef st fill:#fff2cc,stroke:#d6b656;
P0["P0 — first package
prevPkgDigest = 0"]:::pkg -->|"revote consumes P0"| P1["P1 — live package
references pkgDigest(P0)"]:::pkg
P1 -->|"revote consumes P1"| P2["P2 — live package"]:::pkg
P0 -.->|"after consumption"| D0["P0 consumed (dead):
its E removed from A"]:::dead
subgraph STARK["checked in the voter's ballot STARK"]
S1["knows opening of prev package
(same slot, same sk)"]:::chk
S2["NULL = PRF(sk, prevPkgDigest)"]:::chk
end
subgraph BATCH["checked by the batch program"]
B1["prev admitted:
voteID → pkgDigest inclusion
proof under current root"]:::chk
B2["NULL not in nullifier tree
→ insert (once ever)"]:::chk
B3["empty slot → first package only;
occupied slot → must consume
exactly one predecessor"]:::chk
end
P1 --- STARK
P1 --- BATCH
N["nullifier tree (depth-256 SMT)
public, unlinkable keys"]:::st
B2 --> N