• Reading the docs…
Start trading

Concepts

Commit

A Commit closes a Crossing: the Coprocessor posts the new Ledger root under its enclave signature, and the Pool program stores it only after checking that signature, the chain of roots, everything the Crossing recorded on chain and the conservation of every asset it touched. The same instruction pays the Crossing’s fees to the fee recipient.

What a Commit posts#

A Commit is one transaction: an idempotent creation of the fee recipient’s token account for each asset it carries, then an Ed25519 signature-verification instruction that carries the Commit message MkM_k and the enclave’s signature over it, directly followed by commit, which has no payload of its own. Three earlier stages of the Crossing leave on chain what the Commit is checked against: open_crossing records the verified mids, route_residual records each Residual fill, and log_diff posts the ciphertext diff.

math
Mk=privium/commit/v1 ∥ idprog ∥ e ∥ k ∥ ρ(k−1) ∥ ρ(k) ∥ bodykM_k = \texttt{privium/commit/v1} \,\|\, \mathsf{id}_{\mathrm{prog}} \,\|\, e \,\|\, k \,\|\, \rho^{(k-1)} \,\|\, \rho^{(k)} \,\|\, \mathsf{body}_k

ee is the signing key’s epoch, kk the Crossing index, and the two roots are the prior and the new one. The domain tag and program id keep a signature made for a route, an open or another deployment from passing as a Commit. The body holds:

Field Meaning
δk\delta_k the data availability accumulator over the Crossing’s diff
E(k)E^{(k)}, nEn_E the root and count of the Exits this Commit lists
hmh_m, hFh_F the hashes of the mids and of the Residual fills recorded for Crossing kk
hDh_D the digest of the deposit chain hashes at the new cuts
per touched asset the mint; the Ledger total TaT_a; the Exits added ΔXa\Delta X_a; the fees ΔFa\Delta F_a; the deposits credited from each shard; the commitment delta ΔΓa\Delta\Gamma_a; the aggregate opening RaR_a

Nothing in MkM_k names a trader, a balance or an order: every field is a root, a hash, a count or a per-asset aggregate. The byte layout is in Signed messages.

A heartbeat Commit, which the Coprocessor sends when nothing has settled for 750 slots (The batch), carries no asset: its message lists zero asset entries, the transaction creates no token account, and the program runs every check below except the per-asset ones.

What the program checks#

The program stores the new root only if every check below passes; any failure reverts the whole transaction.

Check Holds when
Enclave signature the instruction just before commit verifies one signature over MkM_k under a key the Registry admits, within that key’s validity interval
No Escape the Escape is not active
Order and prior root kk is the stored index plus one, and ρ(k−1)\rho^{(k-1)} equals the stored root
Opener the signing key opened Crossing kk; only that key commits it until the Crossing’s lease passes (Coprocessor)
Mids hmh_m equals the hash open_crossing stored over the Pyth prices it verified
Fills hFh_F equals the fills route_residual recorded, and the Commit carries every mint a fill or a consolidate_vault of Crossing kk moved
Data availability δk\delta_k equals the log_diff accumulator, which is then sealed (Ledger)
Conservation for each touched asset, the vault identity and the commitment equation hold
Deposits each shard’s cut lies between the stored cut and the queue’s head, and hDh_D matches the chain hashes the program wrote at the cuts

Enclave signature by instruction introspection#

A Solana program cannot call the Ed25519 precompile. It learns that a signature was checked by reading the transaction’s instructions through the Instructions sysvar. A precompile instruction may verify a signature over bytes taken from any instruction, so the Pool accepts one shape only: the instruction directly before commit belongs to the Ed25519 program, verifies exactly one signature, and points every offset into itself at fixed positions (signature, key, then the message to the end). The program reads MkM_k from there, finds the key in the Registry and checks the current slot against its validity interval.

The Registry admits a key only after register_enclave has verified the enclave’s attestation, which binds the key to a published measurement (Attestation and reproducible builds). Because MkM_k includes kk and the prior root, a signature authorizes one root and never a later one.

Conservation per asset#

For each asset it touches, the Commit applies its deltas and checks two equations. The first is in base units: the vault identity, under which the shards hold exactly the attested Ledger total TaT_a, the committed Exits not yet released and the deposits not yet credited.

The second ties the Ledger’s commitments to that total. The program keeps Γa\Gamma_a, the sum of every asset-aa leaf commitment, and the Commit supplies the change ΔΓa\Delta\Gamma_a and the sum RaR_a of the asset’s openings. With weights zaz_a hashed from H(Mk)\mathsf{H}(M_k), the asset’s index and TaT_a, every carried asset is checked in one multiscalar multiplication over ristretto255:

math
∑aza(Γa+ΔΓa)−(∑azaTa)G−(∑azaRa)H=O(4.7)\sum_{a} z_a \big(\Gamma_a + \Delta\Gamma_a\big) - \Big(\sum_{a} z_a T_a\Big) G - \Big(\sum_{a} z_a R_a\Big) H = O \tag{4.7}

A Commit with any asset out of balance passes with probability at most q/ℓq/\ell for an adversary making qq hash queries, below 2−1722^{-172} for q≤280q \le 2^{80}. Any watcher runs the remaining check from the diff: each ΔΓa\Delta\Gamma_a is the sum of the rewritten leaves’ commitment changes, with a range proof for every leaf and a validity proof for the batch. Together these give committed conservation: every in-range opening of an asset’s leaves sums to TaT_a, and the Council’s decryption of each leaf equals its balance, so the claims an Escape can pay against a root total exactly TaT_a.

The fee payment#

The same commit instruction pays the Crossing’s fees ΔFa\Delta F_a, in each pair’s quote asset (SOL or USDC), from vault shard 0 to the token accounts of the fee recipient that the Pool’s configuration names. The amounts are the ones the signed message states, and they leave the vault in the transaction that attests them, so no fee stays in the Pool between Commits. What each fill pays is in Fees; Fees and $PRV follows the fees from the fee recipient on.

What a Commit changes#

On success the program stores:

  • in the Ledger root account: kk, ρ(k)\rho^{(k)}, δk\delta_k, hmh_m, the Commit’s slot, and E(k)E^{(k)} in a ring of the last 64 exits roots;
  • in each touched asset’s state: the new TaT_a and Γa\Gamma_a, ΔXa\Delta X_a added to the committed Exits awaiting release, and the new cut of each shard;
  • in the Crossing’s state account: the sealed accumulator.

From then on the deposits up to the cuts are credited, each listed Exit can be paid by a permissionless release_exit that proves its inclusion under E(k)E^{(k)}, and each trader’s new leaves verify against ρ(k)\rho^{(k)}. The Commit’s slot starts the liveness window: if no Commit follows within W=9,000W = 9{,}000 slots (about 30 minutes), anyone can open the Escape. A live Coprocessor commits each Crossing that settles something and sends a heartbeat 750 slots after the last Commit otherwise, so the gap stays near 750 slots at most, a twelfth of that window.

Atomicity#

Every Commit writes the Ledger root account, so Sealevel runs Commits one at a time, while deposits, which do not write it, run alongside. A Commit that fails a check reverts in full: the root stays at ρ(k−1)\rho^{(k-1)}, and the Coprocessor resubmits with the fills already on chain, so no swap repeats and the Ledger credits exactly the fills the program recorded. A second copy of a Commit that has landed fails the order check, which the relayer reads as confirmation.