feat: named storage view for VaultFromSolidity - #2408
Merged
Merged
Conversation
…eorems - check_spec_named_storage: reject every raw ContractState accessor (read from Verity/Core.lean), storage fields, direct ContractState mentions, positional projections and knownAddresses, instead of a positional numeric-literal regex that missed readMapUint/readTransient/continuation lines and misfired on numeric arguments after named handles. - ExecutionProof: *_meets_spec now assert the call succeeds and are proved directly, so a reverting implementation cannot satisfy them and a Vault.sol behaviour change breaks them independently of the exact-state lemmas. - solidity_importer_test: behaviour mutations must break both proof layers; three Spec.lean mutations must fail inside their *_meets_spec theorem. - Sync AUDIT.md, TRUST_ASSUMPTIONS.md, scripts/REFERENCE.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Answers Quentin's (Morpho) review on #2407: "referencing mapping names instead of slots would make it easier to read".
What changes
The Lean importer now also registers a read-only, named storage view for the imported contract, and
Spec.leanis rewritten on top of it:Storage(a definition equal toContractState)Storage.<var>, one reader per state variable, reading through the solc-derived<var>Slothandleview : ContractState → StorageThese are safe transparent
defnDecls registered through the existingregisterpath, so kernel checking, collision checks, and rollback all still apply.Storageandvieware reserved Solidity names.Before
After
Details
Proofs/Execution.leanis renamed toProofs/ExecutionProof.lean. The five public theorem names are kept and restated over the named spec. They are derived from three new exact-state lemmas:deposit_exact_state,withdraw_exact_state, andbalance_exact_state.accountingStatenow lives in the proof file and uses slot handles rather than numbers.spec_named_storagelean_lint rule, run inmake check: opted-in spec files (currentlyContracts/VaultFromSolidity/Spec.lean) must not use numeric slot literals orknownAddresses.#printprobes for the viewtotalAssets/totalSupplymoves the solc slots[0,1,2] → [1,0,2], and all proofs still buildtotalAssets → assetsTotalmakesSpec.leanfail to elaborateStorageis rejected with its source positionTRUST_ASSUMPTIONS.md,AUDIT.md,AXIOMS.md, andREADME.mdare updated.PrintAxioms.leanand the verification status files are regenerated (VaultFromSolidity: 5 → 8 theorems).Evidence
lake build VaultFromSolidity: passes.python3 Contracts/VaultFromSolidity/Importer/scripts/solidity_importer_test.py: all 55 checks pass. The 8 audited theorems depend only onpropextandQuot.sound.make check: passes. Addings.readSlot 0toSpec.leanmakesspec_named_storagefail.Out of scope: named views for handwritten
verity_contractcontracts; structs, nested mappings, and packed slots.