Skip to content

Add source-level internal function visibility#1945

Merged
Th0rgal merged 4 commits into
mainfrom
midnight-internal-function-visibility
Jun 3, 2026
Merged

Add source-level internal function visibility#1945
Th0rgal merged 4 commits into
mainfrom
midnight-internal-function-visibility

Conversation

@Th0rgal
Copy link
Copy Markdown
Member

@Th0rgal Th0rgal commented Jun 3, 2026

Summary

Extends the open Midnight source-fidelity PR beyond internal function visibility and removes the need for downstream Yul patching for the next Morpho Midnight blockers.

This now covers:

  • source-level internal function modifiers, excluded from selector dispatch and ABI JSON;
  • fixed arrays inside MappingStruct / MappingStruct2 members by expanding them into stable word-addressed struct members such as roots[1] and proof[1][1];
  • source-level CREATE2 and SSTORE2-style code-as-data ECMs in Compiler.Modules.Create2SSTORE2;
  • callback ABI smoke coverage through the existing callback ECM surface;
  • trust-report documentation for the CREATE2/SSTORE2 assumptions and low-level mechanics.

Dynamic calldata struct and array ABI support already existed in Verity through the dynamic ABI head/element machinery, so this PR does not duplicate that feature; it adds smoke coverage around the remaining source-level gaps instead.

Verification

  • lake build Verity.Macro.Translate
  • lake build Contracts.InternalVisibilitySmoke Contracts.Smoke Compiler.CompilationModelFeatureTest
  • python3 scripts/check_macro_property_test_generation.py
  • python3 scripts/check_trust_surface_registry.py
  • make check

Notes

The CREATE2/SSTORE2 helpers intentionally keep protocol-specific obligations in the ECM trust surface: callers still own initcode layout, CREATE2 address derivation, and pointer bytecode layout proofs or assumptions. The compiler surface now emits the needed low-level mechanics directly, so downstream projects should not rewrite generated Midnight Yul for these operations.


Note

Medium Risk
Touches EVM deployment and external-code copy mechanics with explicit trust assumptions; macro storage layout expansion affects mapping struct addressing across generated Yul.

Overview
Adds CREATE2 deployment and SSTORE2-style code reads as first-class ECMs (create2Deploy, sstore2ReadCode) that lower to create2 and extcodecopy, with trust-report assumptions for initcode layout, address derivation, and pointer bytecode layout.

Extends the compilation model and trust surface with codecopy, extcodecopy, and create2 as typed low-level mechanics (including intrinsic expression collection and --deny-low-level-mechanics / unsafe-boundary / linear-memory classification).

MappingStruct / MappingStruct2 members can now use fixed arrays: macro elaboration expands them into stable indexed member names (e.g. roots[1], proof[1][1]) with computed word offsets, plus smoke coverage and generated property tests.

Adds callback ABI and CREATE2/SSTORE2 smoke contracts with Yul and trust-report regression tests; documents architecture/contributor checklists and updates capabilities/docs for the new trust boundaries.

Reviewed by Cursor Bugbot for commit 7f69bda. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
verity Ready Ready Preview, Comment Jun 3, 2026 2:51pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

\n### CI Failure Hints\n\nFailed jobs: `checks`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n```

Comment thread Verity/Macro/Translate.lean Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7f69bda. Configure here.

Comment thread Compiler/CompilationModel/TrustSurface.lean
@Th0rgal Th0rgal merged commit fc0dcca into main Jun 3, 2026
15 of 21 checks passed
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