-
Notifications
You must be signed in to change notification settings - Fork 9
Language design axes: full implementation (25 steps across 6 axes) #1731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
f5cac28
docs: add language design axes implementation plan
claude b4a13f8
feat(axis3): step 1a — auto-generate _is_view theorem for @[view] fun…
claude 405f491
feat(axis3): step 1b — add modifies(...) annotation with _frame theorem
claude deca050
feat(axis3): step 1c — add no_external_calls annotation with _no_call…
claude d639daa
feat(axis3): step 1d — annotation composition with _effects conjuncti…
claude 9fff4b4
feat(axis2): step 2a — CEI static analysis with allow_post_interactio…
claude b1fd6e3
feat(axis2): step 2b — CEI escalation ladder with nonreentrant and ce…
claude d3a5e48
feat(axis2): step 2c — requires(role) access control with _requires_r…
claude dc4b40d
feat(axis1): step 3a — types section for semantic newtypes
claude 5581d65
feat(axis4): step 4a — storage namespace computation via kernel Keccak
claude 6eb3ac1
feat(axis4): step 4b — opt-in storage_namespace slot offsetting
claude 708472b
feat(axis4): step 4d — ABI + tooling integration for storage namespace
claude 50e054d
feat(axis6): step 6a — unsafe "reason" do block syntax
claude e03fabe
feat(axis6): step 6b — restricted operation gating outside unsafe blocks
claude dc5aa48
feat(axis6): step 6c — trust report unsafe block entries + --deny-uns…
claude 2f00daf
feat(axis1): step 5a — inductive section in grammar for ADT declarations
claude 81ea925
feat(axis1): step 5b — ADT IR structures in compilation model
claude d2bd23b
feat(axis1): steps 5c+5d — ADT storage encoding + Yul lowering
claude 8b0ffde
feat(axis1): step 5e — ADT ABI encoding as (uint8, uint256...) tuple
claude 6024326
feat(axis4): step 4c — custom namespace override via storage_namespac…
claude f221af1
feat(axis1): step 5f — tryExternalCall for non-reverting external calls
claude fd384e5
feat(axis3): steps 3b+3c — ParamType.newtypeOf + ValueType.newtype wi…
claude a7cd308
fix: resolve pre-existing build failures in Smoke.lean + IRInterprete…
claude 23f3fbf
feat(axis1): wire ADT type definitions from syntax to ContractSpec (#…
claude e47cfbd
fix: address PR review bugs from Codex and Bugbot (#1731)
claude 940ff7a
fix: address round 2 review bugs (ADT dispatch, match validation, nam…
claude 14a9375
fix: address round 3 review bugs (CEI false positive, ABI components,…
claude d254c20
test: add 14 stress-test contracts + fix ADT storage bug
claude 933b6de
fix: address round 4 review bugs (IRInterpreter proof, ABI newtypes, …
claude 01507da
fix: add ADT expr cases to exprBoundNames (ExprCore.lean)
claude d3ec7a5
fix: extend SupportedSpec proof infrastructure for ADT/unsafe/tryExte…
claude de34a5b
fix: address remaining Bugbot review issues (round 5)
claude 962d000
fix: update proof infrastructure for adtTypes parameter in compilatio…
claude a677c37
feat: widen compile-core fragment with mstore/tstore statement support
claude 7ace9cc
fix: close soundness gaps in modifies() and no_external_calls validation
claude 1dc7cc8
feat: generalize GenericInduction proofs from empty events/errors to …
claude f3514a8
fix: close newtype storage write gaps and harden CEI validation
claude d1058a1
feat: complete mstore/tstore proof cases across 4 FunctionBody theorems
claude 107d2c5
fix: address round 6 review bugs (CEI matchAdt, ADT errors/externals,…
claude cd6181f
fix: add missing mstore/tstore alternatives in scope-widening proof t…
claude bfc3b59
fix: generalize compileStmtList_cons_ok_inv for arbitrary events/erro…
claude 6e0a8df
fix: exclude intentionally-invalid CEI contracts from round-trip fuzz…
claude 9b9a3d5
fix: harden CEI validation to treat internal calls as potential stora…
claude 11817c3
Merge main into language design axes
claude ef8d0e0
chore: auto-refresh derived artifacts
github-actions[bot] a64fac3
fix: close remaining local PR1731 validation gaps
claude 50431a0
fix: harden language axes validation gaps
claude c8da981
fix: cover ADT fields in source semantics array scans
claude 56daaba
fix: reject unsupported ADT expression construction
claude db0ad8d
fix: close latest language axes review findings
claude f96dee2
refactor: use shared ADT storage helpers
claude f04ed78
fix: bound ADT variant tags
claude 14230a2
chore: refresh macro property artifact
claude 7ffa44d
feat: add native evmyullean lowering scaffold
claude 33bf07f
fix: encode ADT event payloads
claude 4436753
fix: close ADT storage and CEI review gaps
claude f8a2ffd
chore: auto-refresh derived artifacts
github-actions[bot] c5f815d
fix: repair native harness proof integration
claude 1c9ab6a
chore: auto-refresh derived artifacts
github-actions[bot] 0db2ac9
fix: close ADT alias and payload-local review gaps
claude 586db31
fix: validate namespace and nonreentrant annotations
claude b7e90f8
fix: project native evmyullean runtime observables
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /- | ||
| Compiler.CompilationModel.AdtStorageLayout: Storage layout helpers for ADTs | ||
|
|
||
| ADT storage encoding uses a tagged-union layout: | ||
| - Slot 0 (relative): tag byte (uint8, identifies the variant) | ||
| - Slots 1..N (relative): max-width fields in consecutive slots | ||
|
|
||
| The total storage footprint is 1 + max(variant field counts). | ||
| All variants share the same field slots — unused trailing slots | ||
| are simply not read/written for shorter variants. | ||
|
|
||
| (#1727, Phase 5 Steps 5c+5d) | ||
| -/ | ||
| import Compiler.CompilationModel.Types | ||
|
|
||
| namespace Compiler.CompilationModel | ||
|
|
||
| open Compiler.Yul | ||
|
|
||
| /-- Look up an ADT type definition by name. -/ | ||
| def lookupAdtTypeDef (adtTypes : List AdtTypeDef) (name : String) : | ||
| Except String AdtTypeDef := | ||
| match adtTypes.find? (·.name == name) with | ||
| | some def_ => pure def_ | ||
| | none => throw s!"Compilation error: unknown ADT type '{name}'" | ||
|
|
||
| /-- Look up a variant within an ADT type definition by name. -/ | ||
| def lookupAdtVariant (def_ : AdtTypeDef) (variantName : String) : | ||
| Except String AdtVariant := | ||
| match def_.variants.find? (·.name == variantName) with | ||
| | some v => pure v | ||
| | none => throw s!"Compilation error: unknown variant '{variantName}' in ADT '{def_.name}'" | ||
|
|
||
| /-- Maximum number of field slots across all variants. -/ | ||
| def adtMaxFieldSlots (def_ : AdtTypeDef) : Nat := | ||
| def_.variants.foldl (fun acc v => max acc v.fields.length) 0 | ||
|
|
||
| /-! ### Yul compilation helpers for ADT storage operations | ||
|
|
||
| These generate Yul AST fragments for reading/writing ADT values | ||
| stored in contract storage. The caller provides the base slot | ||
| (resolved from the contract's field list) and the ADT type info. | ||
| -/ | ||
|
|
||
| /-- Read the tag byte from an ADT's storage slot. | ||
| `baseSlot` is the Yul expression for the ADT field's first slot. -/ | ||
| def compileAdtTagRead (baseSlot : YulExpr) : YulExpr := | ||
| -- Tag is stored as a full word in the base slot (mask to uint8) | ||
| YulExpr.call "and" [ | ||
| YulExpr.call "sload" [baseSlot], | ||
| YulExpr.lit 0xFF | ||
| ] | ||
|
|
||
| /-- Write the tag byte to an ADT's storage base slot. -/ | ||
| def compileAdtTagWrite (baseSlot : YulExpr) (tagValue : Nat) : YulStmt := | ||
| YulStmt.expr (YulExpr.call "sstore" [baseSlot, YulExpr.lit tagValue]) | ||
|
|
||
| /-- Read a field from an ADT variant in storage. | ||
| `baseSlot` is the ADT's first slot, `fieldIndex` is 0-based within the variant. | ||
| Fields occupy slots base+1, base+2, ... -/ | ||
| def compileAdtFieldRead (baseSlot : YulExpr) (fieldIndex : Nat) : YulExpr := | ||
| YulExpr.call "sload" [ | ||
| YulExpr.call "add" [baseSlot, YulExpr.lit (fieldIndex + 1)] | ||
| ] | ||
|
|
||
| /-- Write a field value into an ADT variant's storage slot. | ||
| `baseSlot` is the ADT's first slot, `fieldIndex` is 0-based. -/ | ||
| def compileAdtFieldWrite (baseSlot : YulExpr) (fieldIndex : Nat) | ||
| (valueExpr : YulExpr) : YulStmt := | ||
| YulStmt.expr (YulExpr.call "sstore" [ | ||
| YulExpr.call "add" [baseSlot, YulExpr.lit (fieldIndex + 1)], | ||
| valueExpr | ||
| ]) | ||
|
cursor[bot] marked this conversation as resolved.
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| end Compiler.CompilationModel | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.