feat: bytecode immutables (#1992)#2027
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
| \n### CI Failure Hints\n\nFailed jobs: `build`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n``` |
# Conflicts: # PrintAxioms.lean # Verity/Core/Model/Types.lean # Verity/Macro/Translate.lean
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 343b051. Configure here.
Add a dedup check for spec.immutables in validateCompilationModel, mirroring the existing dedup checks for fields/events/internals, plus a compile-error regression test.
# Conflicts: # PrintAxioms.lean
Bugbot) ImmutableSpec.init is declarative-only and never emitted by codegen; deploy code only emits setimmutable from explicit Stmt.setImmutable statements. Without this check a declared immutable could go uninitialized and read garbage at runtime. validateImmutableInitialization rejects specs that declare immutables with no constructor, or leave any declared immutable unset.
# Conflicts: # PrintAxioms.lean
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.

Summary
Implements issue #1992 — Solidity-style bytecode immutables.
Expr.immutable,Stmt.setImmutable,ImmutableSpec, andCompilationModel.immutables.setImmutable.loadimmutable(...)reads and deploy-sidesetimmutable(dataoffset("runtime"), ...).Proofs
setImmutable.setImmutablewired through supported statement fragments, generic induction boundaries, end-to-end base cases, and generated transition summaries.Test plan
lake build Verity Contracts Compiler PrintAxioms→ "Build completed successfully."scripts/refresh_verification_artifacts.sh→ "[refresh] PASS"python3 scripts/check_proof_length.py→ passed (no proof > 50 lines)make check→ "All checks passed."Note
Medium Risk
Large compiler and proof surface change affecting generated contract bytecode; mitigated by strict validation and extensive tests, but incorrect lowering would affect all contracts using immutables.
Overview
Replaces the prior approach of hiding immutables in synthetic storage fields with Solidity-style bytecode immutables on
CompilationModel.immutables.The IR gains
Expr.immutableandStmt.setImmutable. Lowering emitsloadimmutablefor reads and deploy-sidesetimmutable(dataoffset("runtime"), …)for writes;setImmutableis rejected outside constructor/deploy (memory vs calldata dynamic source). Compile-time checks add duplicate immutable names, constructor-only initialization (every declared immutable must appear asStmt.setImmutablein the constructor), and scoped name validation for reads/writes in functions vs constructor.Layout reporting now includes an
immutablesarray (bytecodeImmutablekind, zero storage footprint). Macro smoke tests and compile-driver tests were updated to expect the new surface instead of__immutable_*storage slots.Formal semantics and proofs thread an
immutable : String → Uint256through runtime/denote state, prove denote/source agreement for immutable reads andsetImmutable, and extend supported fragments, scope discipline, transition summaries, and end-to-end proof cases accordingly.Reviewed by Cursor Bugbot for commit 1a19449. Bugbot is set up for automated code reviews on this repo. Configure here.