Skip to content

Commit 9c5cf72

Browse files
committed
Canonicalize Osaka intrinsic fork
1 parent 858bc08 commit 9c5cf72

12 files changed

Lines changed: 53 additions & 48 deletions

File tree

AXIOMS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ its own `AXIOMS.md` or equivalent trust-boundary document.
204204
For example, a Tamago CLZ intrinsic should document the consumer-side
205205
`clz_matches_eip7939` assumption: the Lean `semantics` function used by Tamago
206206
proofs matches the EIP-7939 opcode emitted as `verbatim_1i_1o(hex"1e", x)` on
207-
Fusaka-or-later chains.
207+
chains that support Osaka-or-later execution semantics.
208208

209209
These obligations are outside this registry because they are not axioms in the
210210
Verity project. Future consumer trust reports should surface them

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ in this repository should add generic intrinsic mechanics, not opcode-specific
6767
business logic. The consumer repository must document any generated obligation
6868
in its own `AXIOMS.md` or trust-boundary document. Set `min_fork` to the first
6969
fork where the emitted opcode is valid; Verity accepts `cancun`, `prague`, and
70-
`fusaka` (`osaka` is parsed as the Fusaka execution-layer alias) and enforces
70+
`osaka` (`fusaka` is parsed as the Ethereum combined-upgrade alias) and enforces
7171
the declaration against `--target-fork`.
7272

7373
See [docs/INTRINSICS.md](docs/INTRINSICS.md) for the declaration format,

Compiler/CompileDriverTest.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private def futureForkIntrinsicSpec : CompilationModel := {
8080
Stmt.return
8181
(Expr.intrinsic "futureIntrinsic"
8282
(Verity.Core.Intrinsics.YulLowering.verbatim 1 1 "1e")
83-
Verity.Core.Intrinsics.HardFork.fusaka
83+
Verity.Core.Intrinsics.HardFork.osaka
8484
[Expr.param "x"])
8585
]
8686
}
@@ -1155,10 +1155,10 @@ unsafe def runTests : IO Unit := do
11551155
(compileSpecsWithOptions [futureForkIntrinsicSpec]
11561156
s!"/tmp/verity-compile-driver-test-{nonce}-future-intrinsic-fail"
11571157
false [] {} none none none none)
1158-
"requires min_fork=fusaka, but target_fork=cancun"
1158+
"requires min_fork=osaka, but target_fork=cancun"
11591159
compileSpecsWithOptions [futureForkIntrinsicSpec]
11601160
s!"/tmp/verity-compile-driver-test-{nonce}-future-intrinsic-ok"
1161-
false [] { targetFork := Verity.Core.Intrinsics.HardFork.fusaka } none none none none
1161+
false [] { targetFork := Verity.Core.Intrinsics.HardFork.osaka } none none none none
11621162
IO.println "✓ compileSpecsWithOptions accepts intrinsic at matching target fork"
11631163
compileSpecsWithOptions [futureForkIntrinsicSpec]
11641164
s!"/tmp/verity-compile-driver-test-{nonce}-future-intrinsic-override"

Compiler/MainDriver.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private def parseArgs (args : List String) : IO CLIArgs := do
7373
IO.println " --manifest <path> Manifest file with one Lean module per line"
7474
IO.println " --module <name> Import a Lean module and compile its canonical `<Module>.spec`"
7575
IO.println " --backend-profile <semantic|solidity-parity-ordering>"
76-
IO.println " --target-fork <cancun|prague|fusaka|osaka> EVM fork target for intrinsic min_fork checks (default: cancun)"
76+
IO.println " --target-fork <cancun|prague|osaka|fusaka> EVM fork target for intrinsic min_fork checks (default: cancun; fusaka is an alias for osaka)"
7777
IO.println " --allow-future-fork-intrinsics Allow intrinsics whose min_fork is newer than --target-fork"
7878
IO.println " --trust-report <path> Write JSON trust-surface report"
7979
IO.println " --assumption-report <path> Write JSON assumption inventory report"
@@ -142,7 +142,7 @@ private def parseArgs (args : List String) : IO CLIArgs := do
142142
| some fork => go rest { cfg with targetFork := fork, targetForkExplicit := true }
143143
| none =>
144144
throw (IO.userError
145-
s!"Invalid value for --target-fork: {raw} (expected cancun, prague, fusaka, or osaka alias)")
145+
s!"Invalid value for --target-fork: {raw} (expected cancun, prague, osaka, or fusaka alias)")
146146
| ["--target-fork"] =>
147147
throw (IO.userError "Missing value for --target-fork")
148148
| "--allow-future-fork-intrinsics" :: rest =>

Compiler/MainPatched.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private def parseArgs (args : List String) : IO CLIArgs := do
126126
IO.println " --module <name> Import a Lean module and compile its canonical `<Module>.spec`"
127127
IO.println " --backend-profile <semantic|solidity-parity-ordering|solidity-parity>"
128128
IO.println " --parity-pack <id> Versioned parity-pack tuple (see docs/PARITY_PACKS.md)"
129-
IO.println " --target-fork <cancun|prague|fusaka|osaka> EVM fork target for intrinsic min_fork checks (default: cancun)"
129+
IO.println " --target-fork <cancun|prague|osaka|fusaka> EVM fork target for intrinsic min_fork checks (default: cancun; fusaka is an alias for osaka)"
130130
IO.println " --allow-future-fork-intrinsics Allow intrinsics whose min_fork is newer than --target-fork"
131131
IO.println " --enable-patches Enable deterministic Yul patch pass"
132132
IO.println " --patch-max-iterations <n> Max patch-pass fixpoint iterations (default: 2)"
@@ -225,7 +225,7 @@ private def parseArgs (args : List String) : IO CLIArgs := do
225225
| some fork => go rest { cfg with targetFork := fork, targetForkExplicit := true }
226226
| none =>
227227
throw (IO.userError
228-
s!"Invalid value for --target-fork: {raw} (expected cancun, prague, fusaka, or osaka alias)")
228+
s!"Invalid value for --target-fork: {raw} (expected cancun, prague, osaka, or fusaka alias)")
229229
| ["--target-fork"] =>
230230
throw (IO.userError "Missing value for --target-fork")
231231
| "--allow-future-fork-intrinsics" :: rest =>

Contracts/Smoke.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def plusInt256Helper (a : Uint256) (b : Int256) : Uint256 :=
2828
def eqWordHelper (a : Uint256) (b : Uint256) : Uint256 :=
2929
if a = b then 1 else 0
3030

31-
-- Focused minimal verity_intrinsic example (CLZ via EIP-7939 Fusaka).
31+
-- Focused minimal verity_intrinsic example (CLZ via EIP-7939 Osaka).
3232
-- Declaration shape per plan.md; the explicit intrinsic use site emits
3333
-- verbatim_1i_1o(hex"1e", x) in Yul.
34-
verity_intrinsic clz (x : Uint256) : Uint256 where pure; yul := verbatim 1 1 (hex "1e"); min_fork := fusaka; semantics := (fun x => Verity.Core.Uint256.ofNat (if x.val = 0 then 256 else 255 - Nat.log2 x.val)); obligation [clz_matches_eip7939 := assumed "EIP-7939 CLZ opcode; chain must be Fusaka+"]
34+
verity_intrinsic clz (x : Uint256) : Uint256 where pure; yul := verbatim 1 1 (hex "1e"); min_fork := osaka; semantics := (fun x => Verity.Core.Uint256.ofNat (if x.val = 0 then 256 else 255 - Nat.log2 x.val)); obligation [clz_matches_eip7939 := assumed "EIP-7939 CLZ opcode; chain must support Osaka+ execution semantics"]
3535

3636
verity_contract IntrinsicClzSmoke where
3737
storage

Verity/Core/Intrinsics.lean

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ namespace Verity.Core.Intrinsics
1919
inductive HardFork where
2020
| cancun
2121
| prague
22-
| fusaka
22+
| osaka
2323
deriving Repr, BEq, DecidableEq, Inhabited
2424

2525
def HardFork.rank : HardFork → Nat
2626
| .cancun => 0
2727
| .prague => 1
28-
| .fusaka => 2
28+
| .osaka => 2
2929

3030
/-- `allows target required` is the fail-closed fork guard used by intrinsic
3131
callers: the target fork must be at least the intrinsic's minimum fork. -/
@@ -35,17 +35,18 @@ def HardFork.allows (target required : HardFork) : Bool :=
3535
def HardFork.toString : HardFork → String
3636
| .cancun => "cancun"
3737
| .prague => "prague"
38-
| .fusaka => "fusaka"
38+
| .osaka => "osaka"
3939

4040
instance : ToString HardFork := ⟨HardFork.toString⟩
4141

4242
def HardFork.parse? (raw : String) : Option HardFork :=
4343
match raw with
4444
| "cancun" => some .cancun
4545
| "prague" => some .prague
46-
| "fusaka" => some .fusaka
47-
-- Solidity's execution-layer name for the Fusaka execution upgrade.
48-
| "osaka" => some .fusaka
46+
-- Ethereum's combined network upgrade name is Fusaka; the execution-layer
47+
-- fork relevant to compiler targets is Osaka.
48+
| "fusaka" => some .osaka
49+
| "osaka" => some .osaka
4950
| _ => none
5051

5152
@[simp] theorem HardFork.allows_refl (fork : HardFork) :
@@ -55,20 +56,20 @@ def HardFork.parse? (raw : String) : Option HardFork :=
5556
@[simp] theorem HardFork.cancun_not_allow_prague :
5657
HardFork.allows .cancun .prague = false := rfl
5758

58-
@[simp] theorem HardFork.cancun_not_allow_fusaka :
59-
HardFork.allows .cancun .fusaka = false := rfl
59+
@[simp] theorem HardFork.cancun_not_allow_osaka :
60+
HardFork.allows .cancun .osaka = false := rfl
6061

61-
@[simp] theorem HardFork.prague_not_allow_fusaka :
62-
HardFork.allows .prague .fusaka = false := rfl
62+
@[simp] theorem HardFork.prague_not_allow_osaka :
63+
HardFork.allows .prague .osaka = false := rfl
6364

6465
@[simp] theorem HardFork.prague_allows_cancun :
6566
HardFork.allows .prague .cancun = true := rfl
6667

67-
@[simp] theorem HardFork.fusaka_allows_cancun :
68-
HardFork.allows .fusaka .cancun = true := rfl
68+
@[simp] theorem HardFork.osaka_allows_cancun :
69+
HardFork.allows .osaka .cancun = true := rfl
6970

70-
@[simp] theorem HardFork.fusaka_allows_prague :
71-
HardFork.allows .fusaka .prague = true := rfl
71+
@[simp] theorem HardFork.osaka_allows_prague :
72+
HardFork.allows .osaka .prague = true := rfl
7273

7374
theorem HardFork.allows_trans {a b c : HardFork}
7475
(hab : HardFork.allows a b = true)

Verity/Macro/Elaborate.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def elabVerityIntrinsic : CommandElab := fun stx => do
169169
match Verity.Core.Intrinsics.HardFork.parse? (toString fork.getId) with
170170
| some parsed => pure parsed
171171
| none => throwErrorAt fork
172-
s!"unknown intrinsic min_fork '{toString fork.getId}' (expected cancun, prague, fusaka, or osaka alias)"
172+
s!"unknown intrinsic min_fork '{toString fork.getId}' (expected cancun, prague, osaka, or fusaka alias)"
173173
let parsedObligations ← obligations.mapM fun obligation => do
174174
match obligation with
175175
| `(verityIntrinsicObligation| $obligationName:ident := $status:ident $message:str) =>

Verity/Macro/Translate.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private def hardForkTermFromParsed (fork : Verity.Core.Intrinsics.HardFork) : Co
3434
match fork with
3535
| .cancun => `(Verity.Core.Intrinsics.HardFork.cancun)
3636
| .prague => `(Verity.Core.Intrinsics.HardFork.prague)
37-
| .fusaka => `(Verity.Core.Intrinsics.HardFork.fusaka)
37+
| .osaka => `(Verity.Core.Intrinsics.HardFork.osaka)
3838

3939
inductive ValueType where
4040
| uint256
@@ -4390,9 +4390,9 @@ partial def translatePureExprWithTypes
43904390
| _ => throwErrorAt args "expected list literal [..]"
43914391
`(Compiler.CompilationModel.Expr.externalCall $(strTerm extName) [ $[$argsExprs],* ])
43924392
| `(term| intrinsic_fusaka $name:term $lowering:term $args:term) =>
4393-
translateIntrinsic name lowering args (← `(Verity.Core.Intrinsics.HardFork.fusaka))
4393+
translateIntrinsic name lowering args (← `(Verity.Core.Intrinsics.HardFork.osaka))
43944394
| `(term| intrinsic_osaka $name:term $lowering:term $args:term) =>
4395-
translateIntrinsic name lowering args (← `(Verity.Core.Intrinsics.HardFork.fusaka))
4395+
translateIntrinsic name lowering args (← `(Verity.Core.Intrinsics.HardFork.osaka))
43964396
| `(term| intrinsic_prague $name:term $lowering:term $args:term) =>
43974397
translateIntrinsic name lowering args (← `(Verity.Core.Intrinsics.HardFork.prague))
43984398
| `(term| intrinsic_cancun $name:term $lowering:term $args:term) =>

docs-site/content/compiler.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ For proof-strict builds, deny flags lock down the trust surface. Each one fails
7575
| `--deny-layout-incompatibility` | Candidate storage layout breaks baseline (paired with `--layout-compat-report`) |
7676
| `--deny-unsafe` | Catch-all: any of the above categories trips the build |
7777

78-
Intrinsic users should also set `--target-fork <cancun|prague|fusaka|osaka>`.
78+
Intrinsic users should also set `--target-fork <cancun|prague|osaka>`.
79+
`fusaka` is accepted as an alias for Osaka, Ethereum's execution-layer half of
80+
the combined Fulu/Osaka network upgrade.
7981
The default is `cancun`; an intrinsic whose `min_fork` is newer than the target
8082
fails closed unless `--allow-future-fork-intrinsics` is passed explicitly.
8183

0 commit comments

Comments
 (0)