Repository navigation
Capability ledger: feature docs generated from tested facts - #27
Open
evertonfraga wants to merge 9 commits into
Open
evertonfraga wants to merge 9 commits into
evertonfraga wants to merge 9 commits into
Conversation
An annotation line such as
/// @Custom:strata ensures x == v // ✅ the stored value
stopped the translation of the whole file ("Unexpected tokens after spec
expression: [✅AA, the, stored, val]"). The guide's own examples use that
form (contract_invariants.md, limitations.md, mappings.md).
- SpecParser: the text of an annotation ends at the first `//`
(`stripSpecComment`); no spec expression contains `//`. A keyword
followed only by a comment has no body and is reported as before.
- SpecParser: the tokenizer scans characters instead of byte positions.
It indexed the string by byte but stepped and stopped by character
count, so a multi-byte character produced `A` filler characters and
cut the following tokens short. Tabs and no-break spaces now separate
tokens.
- ContractTranslator: `sum(m)` detection ignores the comment too.
- Tests: tokenizer and annotation cases in SpecParserTest;
test/examples/spec_comments.sol (true and false properties with
comments after requires, ensures and modifies).
Fixtures that the capability ledger cites as evidence, each with intent
comments.
- Verified features without a fixture so far, each with a true and a
false property: `old()` in a loop invariant (function entry, not loop
entry), `msg.sender` in a constructor, `push` (length, value, earlier
elements), `delete` of integers, addresses and mapping entries, hashes
as mapping keys (and that collisions are not excluded).
- Facts Solidity guarantees that are not assumed, each reported as a
spurious failure: enum ranges, array index ranges, `msg.value == 0` in
a non-payable function (incomplete_assumptions.sol); a two-index
`modifies` key, whose frame is not checked (modifies_nested_key.sol).
- gap_*.sol: one fixture per construct that is rejected or fails to
translate (`pop`, `revert("…")`, library calls, strings, positional
struct constructors, tuple assignment, a constructor calling `_mint`,
…). Their golden files pin the current error, so supporting one
changes its golden file.
- Appended to existing fixtures: an `exists` whose witness z3 finds, a
callee without a specification (its result is unknown), a lemma
annotation (reported), a sum invariant broken by `mint` (unknown), a
false property over `$` identifiers.
The golden suite passes with z3 4.15.4 and 4.8.12.
docs/capabilities.toml lists every feature with its status (verified, partly verified, unknown values, not verified, rejected, fails), notes, the baseline GAP it concerns, and witnesses: obligations of test/examples fixtures as their golden files report them, translation errors, warnings, or tests that CI runs. It also lists the annotations, the command-line options and the baseline gaps with their status now. scripts/capabilities.py checks the ledger and renders views of it: - every witness holds in the golden files, which test/run_tests.sh compares with the binary; - the witnesses fit the status (a verified entry has a proven obligation and a refuted or unproven one, or a test; a rejected one an error; a skipped one a warning); - a gap marked closed is cited only by verified entries, and an open or narrowed one by an entry that is not verified; - the options listed are those StrataSolidityMain.lean reads, and the annotations those SpecParser.lean reads; - the sections between `<!-- capabilities:begin VIEW -->` and `<!-- capabilities:end VIEW -->` markers in the docs equal what the ledger renders (with --check; without it, they are rewritten). CI runs `python3 scripts/capabilities.py --check` after the docs build.
Generated from docs/capabilities.toml (scripts/capabilities.py): - LIMITATIONS.md: the status legend and every feature with its status, by area. The "Supported Patterns", "Not Yet Supported" and "Storage References" sections it replaces said that `old()` in loop invariants and `msg.sender` in constructors do not work (they do), that `pop` is "not modeled" (it stops the translation of the file), and that struct fields through mappings fail only in specifications (a function using a struct-valued mapping is not verified at all). - docs/guide supported_features.md and limitations.md: what is verified, and what is not, by area. They had contradicted each other and the binary (counterexamples listed as a gap, `push` as not modelled, `**` without the restriction to constants). - README.md: the annotation table (it listed `forall` and `exists` as annotations, which the binary ignores with a warning), a short list of what works and what does not, and the option table; also in first_verification.md, which lacked `--strict`'s effect on unknown results. - FAQ.md: the summary of the project's state. - Landing page: the annotation table and the two status lists, rendered by build.py. Corrected by hand in the same files: - README.md: z3 is the only solver (cvc5 was listed); the plain-text output shown is the binary's (the old one had another format); deleting `totalSupply += amount` makes the invariant unprovable (❓), not refuted; the directory layout and test commands include the golden suite and the ledger check. - FAQ.md: the pipeline is solc's JSON AST parsed in Lean, in one binary (not Python and Ion); the tag is `@custom:strata`; the translator is six files, not one; Solidity has aliasing through storage references and memory values; the repository is in strata-org.
Each changed example was run, and verifies as the page now says. - overview, pre_and_postconditions, old_expressions: the `transfer` examples require `to != msg.sender`; without it both postconditions are refuted (a self-transfer leaves the balance unchanged), which the pages now say. - mappings: `transferFrom` uses `modifies allowance[from], balances[from], balances[to]`. Its `modifies allowance[from][msg.sender]` was not read (a two-index key), so the frame of `allowance` was not checked, and the `balances` it writes were missing. The page explains one-index keys, and that a function using a struct-valued mapping is not verified at all. - loop_invariants: the constant is inside its contract (outside, the file failed to translate); a section on `old()` in loop invariants (function entry) and on loops that write state. - old_expressions: `old()` works in loop invariants (it was listed as unsupported) and is rejected in invariants. - quantifiers: a true `exists` is often unknown; the variable ranges over its type. modifies: `modifies` and the `forall` frame are not equivalent (`modifies` also frames the other variables). - annotation_reference: `//` comments, one line per annotation, one-index `modifies` keys, specification arithmetic, and the operators and conversions specifications do not have. - contract_invariants: what the CLI reports per function, instead of the markers of an IDE extension that is not in this repository. - output_formats: four formats; ❌ means refuted (it said "could not be proven", which is ❓); the errors section, the not-verified line, `--pipeline-json`, and the exit status of each format. - sarif: the workflow builds StrataSolidity, installs solc and z3, asks for `security-events: write`, and uploads only a SARIF document the run wrote (it used a wrapper that does not exist in a user's repository). - examples: overflow_token.sol wraps in `unchecked`, so it fails as its table row says (it was proven); the table gives each file's result and says that CI does not run these.
strata-solidity-next/requirements.md, besides Requirement 1 (inheritance): - Requirement 2: the soundness corrections (invariants over msg.*, require's message, quantifier ranges, bitwise results, constant expressions, unchecked division and powers, specification division, storage parameters, halting calls, struct copies, storage references), with the baseline IDs each modifies. - Requirement 3: annotation text ends at `//`; the tokenizer reads characters. - Requirement 4: the input, the options (the ledger's list, checked against the code), the exit status per format (REQ-CLI-050/051 and REQ-PBT-007 hold only in plain text), and the plain-text errors section and not-verified line. - Requirement 5: a decision record of the in-Lean frontend that replaced the Python/Ion one, superseding REQ-PY-* and the wrapper and CLI requirements that described it, and what was kept on purpose (the Ion reader, the shell harnesses). - Requirement 6: documented capabilities are generated from the ledger and checked in CI; gap fixtures replace the XFAIL registry. - Requirement 7: the status of GAP-001..012, generated from the ledger (003 and 006 closed, 011 obsolete, 001, 007, 008 and 009 narrowed), and the limitations found since, by capability id. specs/README.md no longer says the baseline is tagged (it never was) and current; baseline tasks.md marks group 5 (publish and tag the baseline) as superseded.
- Adds PRs #3 and #5–#14 (not verified annotations reported, --strict, SARIF verdicts, names in user terms, internal-call arguments, and the soundness fixes to statements, loops, assembly, evaluation order, aliasing, integer semantics, modifiers and re-entrancy), with a Soundness subsection. - Adds this branch: the capability ledger, the gap fixtures, `//` comments in annotations, and the documentation corrections. - Marks the 2026-03 feature list as first reported (several items no longer hold), the corpus numbers as measured outside the repository, and the pin's upstream tag as nightly-20261009.
… are - CONTRIBUTING.md: a section on the capability ledger (what to update when behavior changes, and what `--check` enforces); the branch workflow says what the repository does (rebased branches, stacked pull requests merged with merge commits, no merge method enforced) instead of claiming that only "Rebase and merge" is allowed; PR links cite REQ-NEXT-* instead of REQ-FEIL-* from an untracked spec; "Where else to look" points to LIMITATIONS.md, the next-spec's gap table and the annotation reference. - STRATA_REFERENCE.md removed: an eight-line fragment about struct fields through mappings, which CONTRIBUTING described as the annotation reference; docs/guide/src/annotation_reference.md is that reference. - upstream-strata-migration-plan.md: the pin is tagged nightly-20261009 upstream (not 20261008); a status per phase; the pre-existing gaps it lists are marked resolved; array theory is the default.
- SolcAstParser.lean called itself a scaffold with TODO stubs (it is the frontend of every .sol input) and laid out a migration plan that is done; SolcRunner.lean said the parser was a scaffold. Both, and DialectSummary.lean and test/Runner.lean, cited `.kiro/specs/pipeline-language-rationalization/`, which is not in the repository; they now cite strata-solidity-next's Requirement 5. - DialectSummary.lean pointed to the deleted base_dialect.py; test/Runner.lean says it is not built and partly obsolete. - lakefile.lean named StrataSolidity/SolidityDialectLean.lean and a snapshots/ directory, neither of which exists. No code changes.
This branch has not been deployed
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.
Stack: based on
feat/inheritance(#21) · merge after #21Summary
Capability ledger
docs/capabilities.toml: every feature (87 entries, by area) with its status (verified, partly verified, unknown values, not verified, rejected, fails), notes, the baseline GAP it concerns, and witnesses: obligations oftest/examples/fixtures as their golden files report them, translation errors, warnings, or tests that CI runs. It also lists the annotations, the command-line options and the baseline gaps.scripts/capabilities.py: checks that every witness holds in the golden files, that the witnesses fit the status, that gap statuses agree with the entries citing them, and that the option and annotation lists matchStrataSolidityMain.leanandSpecParser.lean; renders the generated sections (<!-- capabilities:begin VIEW -->…end).--checkfails on any mismatch or stale section.python3 scripts/capabilities.py --check.Generated from the ledger
LIMITATIONS.md: the status legend and the full feature table, replacing the hand-written tables.supported_features.mdandlimitations.md(by area), the option table infirst_verification.md.README.md: the annotation table (withoutforall/exists, which are expressions), a works / not-yet list, the option table.FAQ.md: the project-state summary. Landing page: the annotation table and the two status lists, rendered bybuild.py.Translator (
SpecParser.lean)//, soensures x == v // noteworks. Such a line stopped the translation of the whole file, including the guide's own examples.✅,é) had produced filler characters and cut the following tokens short. Tabs and no-break spaces separate tokens.Fixtures (
test/examples/)spec_comments.sol, plus true/false pairs for features that had no fixture:old()in loop invariants,msg.senderin constructors,push,delete, hash keys.incomplete_assumptions.solandmodifies_nested_key.sol: facts that are not assumed, and a frame that is not checked.gap_*.solfiles, one per construct that is rejected or fails to translate. Each golden file pins the current error.Documentation corrections
@custom:strata; translator size; aliasing through storage references; hosting in strata-org.to != msg.sender.transferFromhas a frame that is actually checked; the loop-invariant constant is inside its contract.old()in loop invariants is supported.existscaveats;modifiesis not equivalent to aforallframe; specification operators.--pipeline-json.examples/:overflow_token.solnow fails, as its README row says.STRATA_REFERENCE.mdremoved (a stale 8-line fragment)..kiro/specs/README.mdno longer claims a baseline tag.Not supported
The ledger lists these, each with a fixture:
pop,revert("…"), library calls, strings and dynamicbytes, positional struct constructors, tuple assignment, a constructor calling an internal function that uses state,deleteof non-integers,if/elsebranches assigning different types, overloads differing only between integer and address parameters, a local namedresult, type conversions and bitwise operators in specifications, and others. Each stops the translation of the whole file.Known issues
lake build gen-dialect-summaryfails to compile (Invalid dotted identifier notation: .syncat), also before this branch. It is not a default target.LIMITATIONS.md;Configfile.Testing
lake build strataSolidity,lake test,python3 -m pytest Tools/Solidity/test(15 passed),lake run pbt-determinism.CI=true bash test/run_tests.sh 15: 106 passed with z3 4.15.4, and 106 passed with z3 4.8.12.python3 scripts/capabilities.py --check: 87 entries, every witness holds.python3 docs/site/_src/capture_outputs.py && python3 docs/site/_src/build.py: the landing outputs are unchanged.Notes
Expect small merge conflicts after Deploy the site on every push to main #22, Make CI's REQ-PBT-002/004/008 checks check what they say #24 and Pin z3 4.15.4 on CI #26 merge:
README.md(the CI list, the z3 prerequisite line);.github/workflows/ci.yml(adjacent steps);lakefile.lean(a comment next to Make CI's REQ-PBT-002/004/008 checks check what they say #24's change).Keep both sides. Once Pin z3 4.15.4 on CI #26 is in, the README's z3 line can name the pinned version.
After Deploy the site on every push to main #22 merges, add
docs/capabilities.tomlto the path filter of the Pages deploy. Otherwise a change to the landing lists alone does not redeploy the site.To change what is documented as supported: update the fixtures, then the ledger entry, then run
python3 scripts/capabilities.py. CONTRIBUTING.md has the steps.