Skip to content

G29: executable constructor for ordinary verity_contract (verity#2465) - #2470

Merged
Th0rgal merged 11 commits into
mainfrom
fix/pareto-g29-ctor
Oct 6, 2026
Merged

Th0rgal merged 11 commits into
mainfrom
fix/pareto-g29-ctor

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Pareto G29 (verity#2465), executable-constructor part. Stacked on #2469: once #2469 merges, retarget this PR to main.

CI status: all checks green at a02b60fa69 (2026-10-05). The first run of compiler-regressions hit the 10-minute step timeout in "Compare Solidity, Denote and compiled models" with no mismatch reported (the differential runs it printed all passed). The rerun is green. Verity main's latest "Verify proofs" run (98533b7) is green, so no pre-existing failure is waived. Commit a02b60f fixes the earlier "Check Lean warning non-regression" failure (unused-parameter lint on the generated constructor).

Exact semantics change

  • Every ordinary (non-mixin, no includes) verity_contract with a constructor block now also elaborates C.constructor : <params> → Contract Unit (Verity/Macro/Elaborate.lean). Its body is generated the same way as the existing mixin/include-host executable constructor (mkConstructorDefCommandPublic). Before this change, ordinary contracts only had the compilation-model constructor.
  • This is best effort. If the generated def throws or logs a new error (for example, a body with no executable lowering), the elaboration state is restored. The contract then keeps exactly its previous declarations, so no existing contract newly fails.
  • The generated binders carry synthetic source info. The unused-parameter linter therefore does not re-report constructor parameters on user source; that had caused 4 new warnings and the "Check Lean warning non-regression" step failed.
  • String parameters are accepted (the tranche-shaped constructor (name, symbol)).
  • Contracts/ERC721/ERC721.lean: the handwritten «constructor» (same body) is removed in favour of the generated one.
  • Downstream note: a project that hand-defines C.constructor after its contract now gets "already declared". The fix is to delete the handwritten copy. lfglabs-dev/pareto-credit-vault-proof-closure has no such definitions; it uses _constructor.

Soundness argument

This change only adds a definition and changes no existing definition or compiler output. The generated body uses the same executable translation as every function and as the mixin constructors, so it carries the same fidelity story. The fallback path can only remove the new def; it cannot alter anything else. ERC721's generated constructor has the same body as the deleted handwritten one.

Tests

  • Contracts/Smoke/ConstructorExecutable.lean: CtorExec.constructor sets minter := msg.sender and supply := 77 (decide +kernel).
  • CtorWithStrings.constructor : String → String → Contract Unit runs (decide +kernel).
  • Foundry: PropertyCtorExec.t.sol, PropertyCtorWithStrings.t.sol.

Remaining assumptions (out of scope, written up on #2465)

  • CREATE address derivation (keccak(rlp(sender, nonce))) is not modelled, and neither is new C(...) CREATE lowering. Consumers must assume deployment addresses are fresh and distinct from every existing contract, that the code at those addresses is the generated contract, and that CREATE does not fail.
  • Metadata strings: String storage and String helper params/results (_concat) are unsupported. Name and symbol are accepted as constructor params but not stored, and no guarantee may depend on them.

No sorry/admit/axiom/native_decide is added.

🤖 Generated with Claude Code

Th0rgal and others added 7 commits October 5, 2026 09:37
…-20 hop lemmas (G14)

- getStorage on an Int256 field binds an Int256 (ofUint256 of the word), so
  addPanic/subPanic on it resolve to the signed checked instance, matching the
  compilation model. Previously the word was Uint256 and Int256 operands were
  coerced, so int256 += with a negative operand panicked spuriously.
- Core: hopCall_success_of_ne, hopCall_scoped_callee, hopCallView_getMapping,
  hopCallView_getMapping2.
- Smoke: Int256 regression witnesses; Erc20BalanceHop (generated ERC-20 read
  and transfer through linked_contracts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…moke state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ty#2465, G29 part)

Ordinary contracts now get an executable `constructor` definition, like
mixins and include hosts already did, so a deployment boundary can run the
generated constructor body. Best effort: if the body has no executable
lowering, elaboration state is restored and only the compilation-model
constructor is kept (no new failures for existing contracts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roperty artifacts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Th0rgal
Th0rgal force-pushed the fix/pareto-g29-ctor branch from f6e2d4b to e46bfba Compare October 5, 2026 08:43
@Th0rgal
Th0rgal changed the base branch from fix/pareto-g28-g14-g2 to main October 5, 2026 08:44
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
\n### CI Failure Hints\n\nFailed jobs: `compiler-regressions`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n```

Th0rgal and others added 2 commits October 5, 2026 10:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uctor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Th0rgal
Th0rgal marked this pull request as ready for review October 5, 2026 14:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a02b60fa69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Verity/Macro/Elaborate.lean
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T14:59:00.054733Z a02b60f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Th0rgal
Th0rgal merged commit d420191 into main Oct 6, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant