WorkFormal verificationExit Proof
Can you always
get it back?
Before a deposit, check who can change the contract and what supports the way out. Exit Proof brings Lean models, wasm replay and NEAR chain evidence into one account report.
NEAR · Public account scanner · Evidence by code hash
- 2
- proven exit, under stated assumptions
- 1
- a certified exit window
- 0
- dependence on a privileged power
- U
- the exit evidence is incomplete
The stages
Four answers. The evidence behind each.
An exit stage describes who can change the contract and what supports the user’s ability to withdraw. It concerns exits; it does not cover every economic, oracle or protocol risk.
2 / Proven exit
An exit theorem for the deployed code, under stated assumptions.
- No access key or code-change path.
- An exit theorem registered for the exact code hash by an accepted attestor.
- Deployment history covered by the proof; any condition on live state must still be checked.
1 / Exit window
A proved delay gives a user time to leave before new code takes effect.
- A certified upgrade plugin with a visible, positive delay.
- No other code-change path or power to stop withdrawals.
- The user’s exit must finish within the available window.
0 / Keyholder trust
A privileged path can change code, pause exits or move deposits.
- The report identifies the relevant power and how it is guarded.
- The guard may be a vote, multisig, another contract or a key.
- The user still depends on the party that controls that power.
U / Unproven
No code-change path was found, but the required exit evidence is missing.
- No applicable theorem for the code hash, or an uncovered key or history.
- Missing evidence is reported explicitly.
- Unproven is not a claim that the contract is safe or unsafe.
These are stage definitions, not a live verdict for an account. Read the full rules and assumptions.
Evidence
Proved, tested and read mean different things.
A theorem about a model, an execution against wasm and a reading from the chain answer different questions. Exit Proof keeps those levels visible instead of treating them as interchangeable.
- 01 / Proved
A Lean model
Theorems state exit or accounting properties with their assumptions. They are proofs about the model.
- 02 / Tested
The deployed wasm
Replay compares the model with the exact contract binary on nearcore’s runtime. Finite tests do not prove their equivalence.
- 03 / Read
The account now
The scanner reads keys, roles, code, deployment history and registry entries. Those observations can change.
- 04 / Attested
A code-hash record
A registry certificate records an attestor’s statement and a command to recheck it. The registry does not check the proof on chain.
theorem T1_ledger_covered (K : Cfg) (S : World)
(h : Reach K S) :
total S.L.bals ≤ bal S.c.accts K.meOne Intents theorem bounds the model’s ledger by its token holdings. Its scope excludes multi-token and NFT paths, the swap path and several other parts of the protocol. Inspect the proof and its assumptions.
Demonstration
Ask the chain before the deposit.
The browser scanner reads public NEAR RPC without signing a transaction. It reports the evidence for an account; when the chain cannot be read, it gives no verdict.
Reproduce
Read an account. Recheck a claim.
Use the command-line scanner for a current reading, or check the saved evidence offline. The claims document connects each statement to the proof, replay or chain observation that supports it.
git clone https://github.com/formalized-si/exit-proof
cd exit-proof
python3 tools/exitproof.py wrap.near
./check-all.sh --offlineResearch summary
- Problem
- Before interacting with a NEAR contract, what evidence shows who can change it and whether a user can withdraw under stated assumptions?
- Result
- The project combines Lean exit and accounting models, replay tests against exact contract wasm, a scanner and certificates keyed by code hash. Reports distinguish properties proved in a model, behaviour tested by replay and state read from the chain.
- How to check it
- Run ./check-all.sh --offline for saved evidence consistency, then the documented proof and replay commands for each subject. CLAIMS.md links statements to their assumptions and evidence; the scanner reads keys, roles, deployment history and registry records.
- Limits
- Random replay is not a proof that a Lean model matches wasm. Registry entries are attestor statements, not proofs checked on chain. Lower-stage reports partly trust method names and contract views. Stages concern exits, not every economic or protocol risk; no outside party audited the project.
- Research question
- Can the scanner derive code-change paths from wasm and extend the Intents model to multi-token and token_diff paths?
Exit Proof · Formalized · All work ↗