This page is the contributor map for Verity. It explains where a source feature enters the system, which proof layer owns it, which trust report should mention it, and which tests should fail if it regresses.
For the public user-facing version, see docs-site/content/architecture.mdx.
verity_contract source
-> macro elaboration
-> CompilationModel
-> IR
-> Yul
-> solc bytecode
| Stage | Main files | Owns | Proof / trust status |
|---|---|---|---|
| Source syntax and executable semantics | Verity/Core.lean, Verity/Macro/* |
Contract author surface, storage declarations, source helpers, executable Lean definitions | Layer 1 bridge to CompilationModel for the macro-lowered image |
| CompilationModel | Compiler/CompilationModel/*, Compiler/ECM.lean |
Declarative storage, params, statements, events, externals, ECMs, validation, trust-surface collection | Layer 2 source of truth; full model is wider than the proved fragment |
| IR generation and proofs | Compiler/Proofs/IRGeneration/* |
Supported-fragment witnesses, helper-aware source semantics, IR lowering correctness | Generic Layer 2 theorem for SupportedSpec |
| Yul generation and native bridge | Compiler/Codegen.lean, Compiler/Yul/*, Compiler/Proofs/YulGeneration/* |
Dispatcher, ABI loads, runtime helpers, Yul AST, EVMYulLean bridge | Layer 3 theorem surface plus explicit bridge hypotheses |
| Bytecode | solc --strict-assembly |
Final deployment artifact | Trusted boundary |
When adding a source-level feature, update the earliest layer that can express it
precisely. Avoid patching generated Yul when the feature has a stable source or
CompilationModel shape.
| Feature kind | Preferred owner | Examples | Notes |
|---|---|---|---|
| Ordinary source syntax | Verity/Macro/* |
internal source helpers, storage declarations, ABI-shaped parameters |
Must lower to ordinary CompilationModel fields/functions/statements. |
| Storage layout metadata | Verity/Macro/Translate.lean plus Compiler/CompilationModel/* |
MappingStruct, MappingStruct2, fixed arrays inside struct members |
Keep layout reviewable as named members and word offsets. |
| Reusable low-level mechanics | Compiler/Modules/* ECMs |
ERC-20 wrappers, callbacks, CREATE2, SSTORE2, precompiles | Must expose assumptions through axioms and trust reports. |
| New primitive mechanic | Compiler/CompilationModel/Types.lean and TrustSurface.lean |
create2, extcodecopy, codecopy |
Add deny-flag classification when the mechanic is outside the proof model. |
| Proof-complete widening | Compiler/Proofs/* and boundary catalogs |
New supported statement forms, helper-summary consumption | Do not claim full verification until the relevant theorem consumes the feature. |
These are easy to miss because they cross source syntax, layout, ECMs, and trust reporting:
- Source-level
internalfunctions compile as internal helper specs, are omitted from selector dispatch and ABI output, and must not be used forreceiveorfallbackentrypoints. MappingStructandMappingStruct2support fixed-array members by expanding them into stable member names such asroots[1]andproof[1][1]. The expanded names are the storage-access names used bystructMemberandsetStructMember.- Dynamic calldata structs and arrays are represented through the existing ABI head/element machinery. Do not add one-off Yul rewrites when a typed parameter-load path already exists.
- Callback helpers live in
Compiler.Modules.Callbacksand own the ABI frame for selector plus static arguments plus dynamic bytes. Protocol behavior of the callback target remains an assumption. - CREATE2 and SSTORE2-style code-as-data live in
Compiler.Modules.Create2SSTORE2. They lower the mechanics directly and surfacecreate2_initcode_layout,create2_address_derivation, andsstore2_pointer_code_layoutas assumptions.
If a feature uses a mechanic that the proof interpreters do not fully model, the compiler must make that visible.
- Add a typed
CompilationModelor ECM representation. - Classify the mechanic in
Compiler/CompilationModel/TrustSurface.lean. - Add or update
--deny-*behavior if users need a fail-closed gate. - Add a trust-report test in
Compiler/CompilationModelFeatureTest.lean. - Document the assumption in
docs/EXTERNAL_CALL_MODULES.md,docs/VERIFICATION_STATUS.md,docs-site/content/capabilities.mdx, or the narrower page for that surface.
- Source syntax or API documented in
docs-site/content/edsl-api-reference.mdxor the relevant guide. CompilationModelrepresentation is typed and validated; no ad hoc string patching of generated Yul.- Mutability, selector/ABI visibility, result binding, and local scoping are tested.
- Storage layout changes have smoke tests for resolved names and word offsets.
- Low-level mechanics are collected by
TrustSurface.leanand covered by--trust-report. - ECMs list every protocol assumption in
axioms. Compiler/CompilationModelFeatureTest.leancovers lowering and reports.Contracts/Smoke.leanor a focused contract test covers the source surface.- Generated Foundry/property fixtures are updated when the macro property surface changes.
- Public docs and repo docs name both the supported behavior and the remaining proof/trust boundary.
Use focused checks before the full suite:
lake build Verity.Macro.Translate
lake build Contracts.Smoke Compiler.CompilationModelFeatureTest
python3 scripts/check_macro_property_test_generation.py
python3 scripts/check_trust_surface_registry.pyThen run the full gate:
make check