Compare commits

...

151 commits

Author SHA1 Message Date
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
Andrei Burdușa
f83936d31f
Merge pull request #76 from NethermindEth/andreiburdusa/fix-rip160-for-nix
Find libssl path for rip precompiled contract
2025-04-15 12:32:00 +03:00
Andrei Burdusa
e37ed635ad Restore rip160.py 2025-04-08 23:41:32 +03:00
Andrei Burdusa
31cc147259 Find libssl path for rip precompiled contract 2025-04-07 18:21:19 +03:00
Andrei Burdușa
d34be14228
Merge pull request #74 from NethermindEth/Ferinko/fCI
force HTTPS on gitmodules for the CI
2025-03-24 15:32:35 +02:00
Frantisek Silvasi
7879546008 force HTTPS on gitmodules for the CI 2025-03-24 14:30:20 +01:00
Frantisek Silvasi
eea1095b37
Merge pull request #73 from NethermindEth/Ferinko/cleanups
cleanup structure, improve submodule cloning
2025-03-24 14:11:54 +01:00
Frantisek Silvasi
694a9e06ab cleanup structure, improve submodule cloning 2025-03-24 13:51:01 +01:00
Andrei Burdușa
36229c2c98
Merge pull request #70 from NethermindEth/Ferinko/testRunnerAndCI
Ferinko/test runner and ci
2025-03-24 13:19:41 +02:00
Frantisek Silvasi
370a547c99 change default number of threads
- from 1 to 'all available on the machine'
- this still defaults to 1 whenever `nproc` is not available, i.e.
  non-Linux systems, but it is primarily meant to be
  wrt. the CI which does run on Linux, users can still override this
2025-03-24 12:11:22 +01:00
Frantisek Silvasi
e1783c07c8 cleanup Conform/main.lean 2025-03-24 12:02:19 +01:00
Frantisek Silvasi
f0376822f3 bump readme 2025-03-24 12:00:45 +01:00
Frantisek Silvasi
83f0cf7633 CI + full tests 2025-03-24 11:59:15 +01:00
Frantisek Silvasi
e359a627d5 add CI - WIP testing 2025-03-24 11:56:50 +01:00
Frantisek Silvasi
ee9bd47f71 add test driver 2025-03-21 14:23:40 +01:00
Frantisek Silvasi
dbf0784fb2 cleanup lakefile.lean 2025-03-21 13:45:55 +01:00
Frantisek Silvasi
2204922bef
Merge pull request #69 from NethermindEth/Ferinko-patch-2
Update README.md
2025-03-21 11:57:40 +01:00
Frantisek Silvasi
9a9430672a
Update README.md 2025-03-21 11:57:16 +01:00
Frantisek Silvasi
85a8fa07fb reset main 2025-03-20 17:20:12 +01:00
Frantisek Silvasi
04fd6ff276 remove debug misc 2025-03-20 16:52:58 +01:00
Frantisek Silvasi
07742d8967 cleanup precompiledcontracts.lean 2025-03-20 10:43:38 +01:00
Frantisek Silvasi
e269a4f3e6 cleanup conform 2025-03-20 10:29:04 +01:00
Frantisek Silvasi
8d11a41cbe bump lakefile to grab the git submodule 2025-03-19 00:26:19 +01:00
Frantisek Silvasi
577e260bd3 cleanups 2025-03-19 00:25:02 +01:00
Frantisek Silvasi
c9ebfe9866 fix tests broken by the merge 2025-03-19 00:24:05 +01:00
Frantisek Silvasi
8520d4cd4c Merge branch 'andreiburdusa/all-checks-with-some-ffi' into Ferinko/FFI_WIP 2025-03-17 17:16:01 +01:00
Frantisek Silvasi
c06cc4f883 refine UX to phases 2025-03-17 14:11:26 +01:00
Andrei Burdusa
6b4def1293 Use input file for trie_root.py 2025-03-16 11:13:04 +02:00
Andrei Burdusa
5d96d6be0e Receipts root check 2025-03-14 18:30:21 +02:00
Andrei Burdusa
3e2cffb89f Use new stucture LogEntry 2025-03-14 18:30:21 +02:00
Andrei Burdusa
a7814d15d6 Refactor withdrawals trie root 2025-03-14 18:30:21 +02:00
Andrei Burdusa
9ad340530a INVALID_TRANSACTIONS_ROOT check 2025-03-14 18:30:18 +02:00
Andrei Burdusa
58b9f3be57 Check logsBloom (INVALID_LOG_BLOOM exception) 2025-03-14 18:26:05 +02:00
Frantisek Silvasi
245c8eca00 minor cleanup 2025-03-14 17:05:22 +01:00
Frantisek Silvasi
67246e88e3 use this commit <3 2025-03-14 16:57:10 +01:00
Frantisek Silvasi
895d54a22e WIP 2025-03-14 16:23:08 +01:00
Frantisek Silvasi
adfd193824 implement phasing, improve UX 2025-03-14 16:03:39 +01:00
Frantisek Silvasi
bbdfa1b109 commit out_all_per_file.txt by force 2025-03-14 16:03:39 +01:00
Frantisek Silvasi
f4e939bb6d add more FFI, optimise jumps, improve scheduling 2025-03-11 16:11:50 +01:00
Frantisek Silvasi
4b3b50b92f FFI for keccak256
parallel execution (simple scheduling)
2025-03-07 12:12:04 +01:00
Frantisek Silvasi
178a50493a Cleanup the lakefile 2025-03-05 18:17:18 +01:00
Frantisek Silvasi
35c320d19a remove the FastMemset dependency 2025-03-05 18:16:27 +01:00
Frantisek Silvasi
dcf375ac9e implement ByteArray.zeroes in FFI 2025-03-05 18:16:06 +01:00
Frantisek Silvasi
c802bcedb1 cleanup FFI 2025-03-05 16:15:23 +01:00
Frantisek Silvasi
a77e2d9d74 implement FFI
- blake2_f
- sha256
2025-03-05 14:24:55 +01:00
75 changed files with 4452 additions and 3583 deletions

6
.gitignore vendored

2
.gitmodules vendored

File diff suppressed because one or more lines are too long