Julian Sutherland
047f630703
Merge pull request #81 from NethermindEth/Coda-Coda/README-edit-2
...
Fix typo
2025-09-24 00:53:30 +01:00
Daniel Britten
30be522dfe
Fix typo
2025-09-24 11:51:05 +12:00
Julian Sutherland
cc0a7386e6
Merge pull request #80 from NethermindEth/Coda-Coda/README-edit
...
Add info to README about running the Yul semantics tests
2025-09-24 00:46:30 +01:00
Daniel Britten
092fd6c1e4
Add info to README about running the Yul semantics tests
2025-09-24 11:36:45 +12:00
Daniel Britten
a1a7a42062
Merge pull request #79 from NethermindEth/Coda-Coda/Yul-semantics-4
...
Add Yul semantics for `CALL*` operations and machinery required for this.
2025-09-24 00:15:29 +12:00
Daniel Britten
4c5437089b
Minor improvement to README
2025-09-24 00:14:24 +12:00
Daniel Britten
ab92ac7e94
Add info about other primops that are not modelled to README
2025-09-24 00:10:45 +12:00
Daniel Britten
fd1cc6f1b7
Add info about SELFDESTRUCT limitations to README
2025-09-23 23:32:49 +12:00
Daniel Britten
c27c95dedc
Add Yul halting for REVERT and STOP
2025-09-23 23:29:47 +12:00
Daniel Britten
401ddf57ef
Improve README
2025-09-23 23:02:59 +12:00
Daniel Britten
0c7c69b37e
Update Solidity and Yul source files for Yul semantics testing
2025-09-23 23:01:28 +12:00
Daniel Britten
b94001a801
Add callcode to parser
2025-09-23 22:56:05 +12:00
Daniel Britten
c5670d16ad
Add test for CALLCODE
...
The Yul code has been manually altered from `pop(delegatecall(_3, 4, add(expr_mpos, 0x20), _2, 0, 0))` to `pop(callcode(_3, 4, 0, add(expr_mpos, 0x20), _2, 0, 0))` (adding the value argument, zero, and changing delegate to call. Solidity no longer outputs `callcode` except when using inline assembly, preferring `delegatecall`.
2025-09-23 22:55:52 +12:00
Daniel Britten
bb7dede41d
FIx CALLCODE semantics
...
It should use the code from `address` but otherwise stay in the context of the current contract.
2025-09-23 22:34:45 +12:00
Daniel Britten
af5fa73f9d
Fix implementation of DELEGATECALL
...
The previous implementation only used the other contract's context for the call to the dispatcher.
2025-09-23 22:27:13 +12:00
Daniel Britten
38ef221d9a
Add a test of delegateCall
2025-09-23 22:26:05 +12:00
Daniel Britten
249aa21cce
Add test for fun_testStaticStore
2025-09-23 19:51:43 +12:00
Daniel Britten
36ba1f3cc4
Add check for primOps that violate static mode
2025-09-23 19:51:10 +12:00
Daniel Britten
74756747bc
Fix error propogation during switches
...
Before this fix, an error (such as `.STATICMODEVIOLATION`) in any of the branches would cause the final result to be the error (except for `.YulHalt`). The correct behaviour is for only that branch to be associated with the error, and not the whole result of the switch. This is now the behaviour.
2025-09-23 19:50:18 +12:00
Daniel Britten
c830940e14
Use state that has had perm set to false
2025-09-23 19:40:27 +12:00
Daniel Britten
bbf56a9f13
Simplify accessing executionEnv
2025-09-23 19:37:38 +12:00
Daniel Britten
81eb1aae57
Amend Caller2 test contract to pass a value to store
...
This should result in a `.StaticModeViolation` when run.
This commit was made with the assistance of Cursor (cursor.com).
2025-09-23 18:27:02 +12:00
Daniel Britten
9f308afb1d
Remove debug logging
2025-09-23 18:22:38 +12:00
Daniel Britten
dfcd0ed2ac
Add output of success or failure for existing Yul tests
2025-09-23 18:21:56 +12:00
Daniel Britten
b907934e2a
Set the Storage contract to have an initial number of 21 stored
2025-09-23 18:18:40 +12:00
Daniel Britten
89a438fe81
Add test of a succesful static call
2025-09-23 18:18:07 +12:00
Daniel Britten
6f84b5bb8e
Add caller2 example Yul contract
2025-09-23 18:17:13 +12:00
Daniel Britten
e08cfa0b0d
Restore ExecutionEnv for STATICCALL/DELEGATECALL/'CALLCODE`
2025-09-23 18:14:58 +12:00
Daniel Britten
20633125cf
Fix check for perm at start of STATICCALL
2025-09-23 18:02:49 +12:00
Daniel Britten
b2bb0fe8fc
Add limitations of the Yul semantics to README
2025-09-23 17:32:55 +12:00
Daniel Britten
4fa832ee31
Clarify syntax
2025-09-23 17:22:25 +12:00
Daniel Britten
a09682abb1
Add source code for contracts for Yul semantics tests
2025-09-23 17:18:55 +12:00
Daniel Britten
71f9a37960
Add Yul semantics test instructions
2025-09-23 17:18:30 +12:00
Daniel Britten
228ee0a742
Move and rename YulSemanticsTests.lean
2025-09-23 16:59:48 +12:00
Daniel Britten
7b41a8abe3
Remove repetitition of comments
2025-09-23 16:57:15 +12:00
Daniel Britten
4f1ad1a1df
Refactor
...
Create helper function `buildContractCallEmptyReturnState`.
2025-09-23 16:50:43 +12:00
Daniel Britten
6364e652e1
Use do notation to reduce indentation
2025-09-23 16:24:55 +12:00
Daniel Britten
be092b4d30
Simplify callFromCode and rename to callDispatcher
2025-09-23 16:09:55 +12:00
Daniel Britten
c6f677ba7b
Delete resolved TODO
2025-09-23 15:54:11 +12:00
Daniel Britten
b9c2f5dcc7
Add comment to indicate how to run Yul semantics tests
2025-09-23 15:47:22 +12:00
Daniel Britten
0f80edabbf
Remove unnecessary parentheses
2025-09-23 15:42:09 +12:00
Daniel Britten
cd419ae975
Remove unnecessary comment
2025-09-23 15:39:38 +12:00
Daniel Britten
6c460ddce3
Fix spelling
...
And related function selector
2025-09-22 22:48:35 +12:00
Daniel Britten
a9a9cd41ea
Handle Yul halting in STATICCALL/DELEGATECALL/CALLCODE
2025-09-22 22:45:35 +12:00
Daniel Britten
23a7971e7b
Set H_return to zero array at the end of a successful call.
...
This commit was made with the assistance of Cursor (cursor.com).
2025-09-22 22:39:51 +12:00
Daniel Britten
d5c2d7f016
Ensure memory is reset before external contract calls
...
This commit was made with the assistance of Cursor (cursor.com) with use of gpt-5.
2025-09-22 22:34:19 +12:00
Daniel Britten
84890e3387
Fix destination for copying H_return
...
This commit was made with the assistance of Cursor (cursor.com) using gpt-5.
2025-09-22 22:28:39 +12:00
Daniel Britten
f3647a94ba
Also set returnData to empty
...
This commit was made with the assistance of Cursor (cursor.com) using gpt-5.
2025-09-22 22:28:32 +12:00
Daniel Britten
493ede0f5d
Apply the transfer in the case where the contract does not exist
...
Like the STOP opcode.
This commit was made with the assistance of Cursor (cursor.com) using gpt-5.
2025-09-22 22:27:53 +12:00
Daniel Britten
ec85c2a761
Tweak generated Yul to not use extcodesize
...
And assume that the target address is a smart contract.
2025-09-22 21:03:15 +12:00
Daniel Britten
51acf96bb1
Make EXTCODESIZE return an error for Yul
...
To make it clearer that this operation is undefined for Yul.
2025-09-22 21:02:23 +12:00
Daniel Britten
af12e91bc8
Add Yul Exceptions
2025-09-22 21:01:22 +12:00
Daniel Britten
013867c00d
Add missing import
2025-09-22 19:57:30 +12:00
Daniel Britten
e5cc3a5eb2
Remove value arg and handling from STATICCALL
...
The value is implicitly zero, because it is a *static* call.
2025-09-22 19:56:04 +12:00
Daniel Britten
ff41234ccf
Restore ExecutionEnv after an external CALL
2025-09-22 19:54:10 +12:00
Daniel Britten
479f168f69
Model Yul halting for RETURN via a special Exception
2025-09-22 19:53:18 +12:00
Daniel Britten
568f7f7185
Add initial test of a cross-contract call
2025-09-22 13:31:43 +12:00
Daniel Britten
6e86b1143b
Add Repr instance for Yul exceptions
2025-09-19 14:58:52 +12:00
Daniel Britten
7bbe2c4d90
Replace returning default to indicate an error with raising relevant Yul.Exceptions
...
And add `execTopLevel` which describes how different exceptions should be interpreted. `default` there indicates an error that should not be possible if the state is set up correctly and the compiler runs correctly.
2025-09-18 20:06:25 +12:00
Daniel Britten
301c76af10
Switch to using Except for Yul semantics
2025-09-18 19:27:42 +12:00
Daniel Britten
6dc89eface
Revert "Replace FFI ByteArray.zeroes with a native Lean definition"
...
This reverts commit 53f2460998 .
2025-09-18 19:27:32 +12:00
Daniel Britten
53f2460998
Replace FFI ByteArray.zeroes with a native Lean definition
2025-09-15 22:36:08 +12:00
Daniel Britten
88f4526a02
Increase max heartbeats
2025-09-15 17:31:39 +12:00
Daniel Britten
6d102d091d
Fix callvalue transfer being lost
2025-09-15 17:29:01 +12:00
Daniel Britten
d45d42073c
Add Yul semantics for DELEGATECALL
2025-09-15 17:18:00 +12:00
Daniel Britten
757877526b
Fix overflow below zero handling in transfers
2025-09-15 17:05:01 +12:00
Daniel Britten
c3a5370df4
Add Yul semantics for CALLCODE
2025-09-15 16:28:52 +12:00
Daniel Britten
ed3ee4e282
Add Yul semantics for STATICCALL
2025-09-15 13:50:10 +12:00
Daniel Britten
e6cb6acb39
Fix handling of memory in CALL Yul semantics
2025-09-15 13:21:43 +12:00
Daniel Britten
70ea08a83f
Add callFromCode in preparation for adding callcode semantics
2025-09-15 12:46:57 +12:00
Daniel Britten
5766b7a948
Improve semantics of CALL
...
Handling the slightly less clear cases based on the yellow paper, comparing with the EVM semantics in this repo, and considering in particular the Nethermind execution client.
2025-09-12 20:15:17 +12:00
Daniel Britten
2bb582a948
Add newline to highlight invocation of call
2025-09-08 10:54:57 +12:00
Daniel Britten
ee01e6781b
Generalise Operation.pretty and add debug logging for Yul ops
2025-09-08 10:38:57 +12:00
Daniel Britten
1a283e99f4
Handle parsing of Yul function calls
...
Due to calling functions using their name (as a string) instead of inlining the `FunctionDefinition`.
2025-09-02 16:47:06 +12:00
Daniel Britten
89223234fb
Handle writing return data to memory as specified
...
See: https://docs.soliditylang.org/en/latest/yul.html#yul-call-return-area
2025-08-29 19:30:30 +12:00
Daniel Britten
4173512067
Add Yul semantics for call
2025-08-29 15:50:20 +12:00
Daniel Britten
7485d4dba5
Rename inputData -> calldata
2025-08-28 18:36:35 +12:00
Daniel Britten
e1b055c3d2
Combine cases further in Stmt
...
And adjust notation examples and the Yul semantics as required by the change.
2025-08-28 18:10:51 +12:00
Daniel Britten
e1b67c74f4
Undo combining PrimCall and Call for ExprStmt
...
To better take into account: "Thus, we cannot have literals or variables on the RHS."
2025-08-26 17:30:05 +12:00
Daniel Britten
061277b535
Clearly give .Assign the same semantics as .Let
...
Similarly for `.AssignCall`.
2025-08-26 17:10:49 +12:00
Daniel Britten
feed7d5935
Combine Call and PrimCall in Yul semantics
...
And fix Yul semantics from changes to `Stmt` and `Expr` structure
2025-08-26 16:40:00 +12:00
Daniel Britten
af478d9fb5
Fix SizeLemmas based on new Stmt and Expr structure
2025-08-26 15:41:04 +12:00
Daniel Britten
7a12e70a17
Fix Yul examples based on new Stmt and Expr structure
2025-08-26 15:39:25 +12:00
Daniel Britten
f701de90e8
Combine PrimCall and Call in Ast.lean
2025-08-26 15:19:34 +12:00
Daniel Britten
02c10c49bb
Make Yul semantics call functions using their name (as a String)
2025-08-26 15:10:54 +12:00
Daniel Britten
c482d8e331
Change to YulFunctionName/String for Expr and Stmt
...
In preparation for calling functions via their name rather than through and inlined `Yul.Ast.Stmt`.
2025-08-26 15:02:23 +12:00
Daniel Britten
457cfbaa13
Change dispatcher to Yul.Ast.Stmt
2025-08-26 14:48:41 +12:00
Daniel Britten
0258e59ad1
Remove ExternallCall branch from Stmt
...
This is the wrong approach.
2025-08-26 14:46:44 +12:00
Daniel Britten
d68904c0a3
Simplify and fix termination proofs by always reducing fuel
2025-08-21 21:44:22 +12:00
Daniel Britten
5d077c1b20
Create YulContract structure with an initial model of a dispatcher
...
Termination proof still broken.
2025-08-21 21:44:22 +12:00
Daniel Britten
542ba3dfff
Finmap approach to modelling external calls
...
Termination proof not complete.
2025-08-21 21:44:22 +12:00
Daniel Britten
a9912a0883
Add semantics for POP for Yul
...
As discussed.
2025-08-21 21:44:22 +12:00
Daniel Britten
856cbdeeb7
Move .Yul, _ case to the end of the match statement
2025-08-21 21:44:22 +12:00
Daniel Britten
2ae9c5e986
Handle EVM/Yul OperationType in conformance tests
2025-08-21 21:44:22 +12:00
Daniel Britten
fa81fd6da3
Add BEq and Repr instances as some are needed for the conformance tests
...
This commit was made with the assistance of Cursor (cursor.com).
2025-08-21 21:44:22 +12:00
Daniel Britten
2ea717cb82
Fix flow on effects of using EVM/Yul OperationType
...
Includes changes to `step` in `Semantics.lean` that removes previously defined Yul semantics from operations where this no longer is applicable.
2025-08-21 21:44:22 +12:00
Daniel Britten
f0cd224043
Make PersistentAccountState depend on EVM/Yul OperationType
...
In preparation for handling CALL* operations in the Yul semantics
2025-08-21 21:43:22 +12:00
Daniel Britten
9a26867e23
Make ExecutionEnv depend on EVM/Yul OperationType
...
In preparation for handling CALL* operations in the Yul semantics
2025-08-21 21:43:22 +12:00
Julian Sutherland
eb8da8f3fe
Factored in EVM stack operations into EVMYul.step function
2025-08-21 21:43:22 +12:00
Daniel Britten
0588268901
Merge pull request #78 from NethermindEth/bump-lean-version
...
Update to Lean and mathlib v4.22.0
2025-08-21 19:00:09 +12:00
Daniel Britten
7320708676
Resolve warnings from lake build and lake build conform
2025-08-21 18:51:23 +12:00
Daniel Britten
d69a6ed655
Bump Lean and mathlib to version 4.22.0
...
`lake build` succeeds.
2025-08-18 18:34:02 +12:00
Daniel Britten
5ea860c97b
Fix errors related to Fin.ofNat from bumping lean version to 4.21.0
...
`ofNat'` was renamed to `ofNat` in v4.21.0
See (v4.20.0): https://github.com/leanprover/lean4/blob/releases/v4.20.0/src/Init/Data/Fin/Basic.lean#L47
`lake build` now succeeds.
2025-08-18 18:21:34 +12:00
Daniel Britten
902f072820
Bump Lean and mathlib to version 4.21.0
...
`lake build` currently fails.
2025-08-18 18:01:15 +12:00
Daniel Britten
ecd791fe36
Bump Lean and mathlib to version 4.20.0
2025-08-18 16:16:03 +12:00
Daniel Britten
c959fb49f5
Fix errors from bumping lean version to 4.19.0
...
`lake build` now succeeds.
This commit was made with the assistance of Cursor (cursor.com).
2025-08-11 13:07:48 +12:00
Daniel Britten
40c4c1c391
Bump Lean and mathlib to version 4.19.0
...
`lake build` currently fails.
2025-08-04 21:29:50 +12:00