Midnight.Passport.Properties
Security properties of the Midnight Passport architecture, stated against the
machine semantics of Midnight.Passport.Semantics. The headline result is
preservation of value:
Run the whole passport system from its genesis state. If the account custody contract keeps correct books, and the architecture faithfully routes transactions and balance queries between the user and the contract, then no balance the system ever reports exceeds the true balance and the true balance is always observable.
1. Concrete channels
A Channel is a pair of types of messages, one for each direction. A
convenient way to define them is via the simpleChannel idiom: we
first define a Mode-indexed family of types, where the Mode of a
constructor gives the direction the message travels. simpleChannel
then assembles this into an actual Channel.
The account interface JUBJUB-SCHNORR refines the C5-C6 spec with the
balance query: the account custody contract issues signing challenges and
answers balance queries; the passport key returns signatures and asks for the
balance. Balances are per-account state of accountCustody and observable
only through this query.
We are mostly interested in user-facing properties. These are
typically of the form that under reasonable assumptions, for all
execution traces, a certain property that the user can observe is
satisfied. The things the user can observe are modeled as the Userᶜ
channel, so in particular there aren't properties about the states of
any individual subsystem. We might still prove such properties, but
they are typically intermediate results, to be used in proving a
user-facing property.
passportKey is expected to answer it with the balance accountCustody
exposes.
The remaining channels stay mostly abstract for now, they will be instantiated later.
2. The preservation of value property
The only way to change the balance is via in/outgoing transactions,
stated over traces of the whole system from a distinguished
genesis state. Transactions are events on the CHAIN boundary wire;
txValue (the impact a transaction has on the balance) stays a
parameter while the transaction vocabulary is not concrete. The real
balance after a run is then defined to be the genesis balance plus the
net flow of the run.
Only adopted transactions carry value: a ChainEvent reports what the
chain adopted, and
that is the moment the balance changes. Submitting a transaction (a
LedgerWrite) has no effect by itself. It may or may not be adopted,
and accounting at submission would force rollback machinery for the
transactions that don't make it.
A queried balance may lag the real one: adopted transactions can sit unread (one can receive funds without checking the wallet, no network connectivity, etc.), so answers may under-report. The property is therefore a pair:
- soundness — an observed balance never exceeds the real one (no value is created); no eventuality is needed for this half;
- eventual accuracy — after any run, the system can take a transaction-free continuation whose result is exactly the real balance.
The pair is meaningful for any machine whose channel exposes a balance query,
so it is factored out once and instantiated twice: globally at the system
boundary (user-facing), and locally at accountCustody.
We can now instantiate this to the two variants:
3. Proof machinery: from the whole system to the account contract
We're working in a generic setting, so we need some extra hypotheses:
FlowPreserving— a global step'stxValueis thetxValueᴬ-flow of its image: transactions crossing theCHAINboundary reachaccountCustodywith the same value, and no other value moves;QuerySound/QueryComplete— the two directions of the balances exposed at theUserboundary and byaccountCustodyagree:G.Answers s a ⇔ L.Answers (π s) a.
The local lemma feeding the eventual-accuracy half is PromptlyAccurate,
not EventuallyAccurate: accountCustody has already received every
delivered chain event as one of its own steps, so its answer needs no
syncing continuation — the "eventually" belongs only to the global
statement, where an answer may take routing steps. This is what lets the
bridge avoid a trace-lifting hypothesis (lifting an arbitrary local
continuation into the composite is generally unprovable: it may take steps
the surrounding context never drives).
Given these, both halves of the global statement follow in a few lines.
QuerySound/QueryComplete remain behavioral assumptions on
⟦passportKey⟧ (the model's machines are parameters, so they cannot be
proved unconditionally).
4. The preservation of value theorem
Combinators for extracting data out of messages.
Fix the data of a deployment: an implementation of every component (mm), the
balance impact of each adopted transaction (txval), and where the system
starts (s₀, b₀).
Five hypotheses: The first two say the account custody contract keeps correct books, considered on its own; the last three say the architecture wires it up faithfully. Under those hypotheses, the whole system is sound and eventually accurate.