1827 Commits

Author SHA1 Message Date
wborgeaud
f605d912a5
Propagate static flag (#1066) 2023-06-02 19:57:23 +02:00
wborgeaud
7307979694
Fix pairing invalid input (#1067) 2023-06-02 19:57:14 +02:00
Robin Salen
49bbe4e084
Fix arithmetic stark padding (#1069) 2023-06-03 02:51:21 +10:00
Hamish Ivey-Law
0d819cf888
Implement EVM BYTE operation (#1059)
* Initial implementation of BYTE.

* Large index constraints; byte range check (hat-tip to Jacqui)

* Implement recursive circuit version.

* Rebind variable to avoid exceeding degree limit.

* Integrate BYTE with arithmetic stark and witness generation.

* Clippy.

* Document verification proof; miscellaneous tidying.

* Update CTL mapping.

* Reverse argument order.

* Avoid undesired doctest.

* Address Jacqui's comments.

* Address remaining comments from Jacqui.
2023-06-03 02:16:45 +10:00
wborgeaud
a492d3e1db Fix revert gas bug 2023-05-25 17:43:25 +02:00
wborgeaud
7dfdacf247
Fix return and revert gas (#1058) 2023-05-25 16:47:55 +02:00
wborgeaud
42f3301730
Fix ecrecover edge case (#1057) 2023-05-25 14:15:48 +02:00
wborgeaud
c0abefdaf5 Fix DUP in call gas 2023-05-24 18:02:48 +02:00
wborgeaud
e6a7b8c5cb
Add contract creation flag (#1056)
* Add contract creation flag

* Minor

* Fix intrinsic gas test
2023-05-24 17:49:54 +02:00
wborgeaud
30b97b29e8 Fix DelegateCall bug 2023-05-24 15:44:40 +02:00
wborgeaud
9727eaf1e0
Fix extcodehash when account is empty (#1055) 2023-05-24 15:03:02 +02:00
wborgeaud
08a061bc4d
Implement LOG* gas and remove panic (#1054)
* Implement LOG* gas and remove panic

* Remove stubs
2023-05-24 10:29:34 +02:00
wborgeaud
354664c86c
Fix ecmul (#1053) 2023-05-23 17:03:33 +02:00
wborgeaud
6e3036017e
Support for type-2 transactions (#1052)
* Type-2 txns

* Minor

* Minor

* Fix add11_yml block metadata

* Fix simple_transfer test

* Minor
2023-05-23 15:06:26 +02:00
wborgeaud
9b0092ab1d
Support for type-1 transactions (#1051)
* Type 1 txn

* Remove magic constants

* Remove useless stack element

* Read correct original value for sk

* EIP-3651

* Fix encoding when TO is 0

* Minor
2023-05-23 09:21:27 +02:00
wborgeaud
15dec6faf9
Encode to as B160. (#1011) 2023-05-22 09:16:22 +02:00
wborgeaud
beefc91d73 Pop checkpoint in the right place 2023-05-18 19:04:27 +02:00
wborgeaud
5a7c176ce1
Fix issues related to CREATE2 collisions (#1050)
* Fix issues related to CREATE2 collisions

* Add error functions
2023-05-18 18:18:33 +02:00
BGluth
e720090e00
Merge pull request #1041 from mir-protocol/storage_addr_h160_to_h256
`TrieInputs` now uses `H256` for storage account addresses
2023-05-18 10:17:33 -06:00
wborgeaud
d57b62fff3
Perform jumpdest analysis whenever entering a new context (#1049) 2023-05-18 15:48:43 +02:00
wborgeaud
971bfba64a
EIP-2681: Limit account nonce to 2^64-1 (#1048)
* EIP-2681: Limit account nonce to 2^64-1

* Also for EOA

* Minor
2023-05-18 15:22:36 +02:00
wborgeaud
8faea881c1
Don't add an event for account creation for pre-existing account (#1047) 2023-05-18 14:53:13 +02:00
wborgeaud
29fac4caeb
Check balance in create (#1046) 2023-05-18 14:37:54 +02:00
wborgeaud
1616c0baa2 Fix extcodecopy 2023-05-18 13:50:34 +02:00
wborgeaud
3a9e5cc0e0
More fixes to contract creation (#1045) 2023-05-18 13:41:36 +02:00
BGluth
49979df919 Fixed failing test 2023-05-17 08:44:09 -06:00
wborgeaud
a294c7e2ed
Some fixes to contract creation (#1044)
* Fixes

* Fixes

* Remove panics in create

* Fix charge gas for code deposit

* Handle error in constructor
2023-05-17 15:53:16 +02:00
wborgeaud
84c156066b
Minor fixes to returndata and create (#1043)
* Fix returndata

* Add AccountCreated event

* returndatacopy_afterFailing_create.json passes

* Fix
2023-05-17 10:06:12 +02:00
BGluth
10e6c76842 TrieInputs now uses H256 for storage account addresses
- Slightly easier for us if we use `H256` instead of `H160`.
2023-05-16 13:51:03 -06:00
Nicholas Ward
ce6ac9f888
Merge pull request #1038 from mir-protocol/tests-memory-context-fix
Fix to hash precompile so EVM tests pass
2023-05-16 08:46:56 -07:00
Dima V
c36ed15e2d
Merge pull request #941 from mir-protocol/bls-fp2
BLS Fp2 Operations and More Systematic Test API
2023-05-16 15:22:04 +02:00
Dmitry Vagner
6292d8d7b1 redundant 2023-05-16 15:05:04 +02:00
Dmitry Vagner
d3986e6b50 merge successful 2023-05-16 15:02:01 +02:00
Dmitry Vagner
59ae7103a8 merge 2023-05-16 14:45:40 +02:00
wborgeaud
244d5e9b3c
Add refund journal event and checkpoint after access address event (#1040) 2023-05-16 14:36:17 +02:00
wborgeaud
bde7fb5019
Various fixes to checkpoint logic (#1039)
* Stack of checkpoints

* Fixes

* Don't use macro in revert selfdestruct

* All stZeroCallsTest, stNonZeroCallsTest, stZeroCallsRevert passing

* Minor
2023-05-16 10:47:38 +02:00
Nicholas Ward
e5b0fce6c6 revert testing changes 2023-05-15 14:07:09 -07:00
Nicholas Ward
3a77c5a05d fix 2023-05-15 12:23:55 -07:00
Nicholas Ward
14f92f7bfa Cargo.toml change for testing 2023-05-15 11:59:50 -07:00
wborgeaud
b116929f11
Delete touched recipient in EOA -> EOA (#1037) 2023-05-15 20:38:06 +02:00
Nicholas Ward
6ebee38e72 fix 2023-05-15 11:02:21 -07:00
wborgeaud
d05db4973d
Don't touch contract address in DELEGATECALL or CALLCODE (#1036)
* Don't touch address in DELEGATECALL or CALLCODE

* Minor
2023-05-15 18:41:21 +02:00
wborgeaud
bfd6834dc2
Journal of state changes + state reversion (#1028)
* Add segments and global metadata

* Add journal asm files

* Start revert

* Revert access lists

* Revert balance transfer

* Revert code change

* Revert nonce change

* Revert storage change

* Checkpoints

* Add some journal entries

* Add some journal entries

* Add some journal entries

* Fix revert

* Checkpoint in sys_call

* Minor

* PR feedback

* More checkpoints

* Fix checkpoint check

* Minor

* Checkpoints in precompiles

* Storage change checkpoint

* Add touched addresses

* Add touched addresses revert

* Add touched addresses journal events

* Delete all empty touch addresses

* Implement selfdestruct

* Update aggregator.rs
2023-05-12 13:04:46 +02:00
wborgeaud
74ba303255
MPT deletion (#1025)
* First try

* Fixes

* Fix sstore

* Comments

* Clippy

* Fix aggregator.rs

* PR feedback
2023-05-11 14:56:10 +02:00
wborgeaud
202985b24f
Fix CALL gas (#1030)
* Fix call gas + precompiles can be non-existent

* Memory expansion before call gas

* Minor

* Add call_gas.asm

* EIP-2200: If gasleft is less than or equal to gas stipend, fail the current call frame with ‘out of gas’ exception.
2023-05-11 14:45:32 +02:00
wborgeaud
944d4a2460
SSTORE refund (#1018)
* SSTORE refund

* SSTORE refund

* Minor
2023-05-11 14:18:34 +02:00
Hamish Ivey-Law
c134b59763
Cross-table lookup for arithmetic stark (#905)
* First draft of linking arithmetic Stark into the CTL mechanism.

* Handle {ADD,SUB,MUL}FP254 operations explicitly in `modular.rs`.

* Adjust argument order; add tests.

* Add CTLs for ADD, MUL, SUB, LT and GT.

* Add CTLs for {ADD,MUL,SUB}MOD, DIV and MOD.

* Add CTLs for {ADD,MUL,SUB}FP254 operations.

* Refactor the CPU/arithmetic CTL mapping; add some documentation.

* Minor comment fixes.

* Combine addcy CTLs at the expense of repeated constraint evaluation.

* Combine addcy CTLs at the expense of repeated constraint evaluation.

* Merge `*FP254` CTL into main CTL; rename some registers.

* Connect extra argument from CPU in binary ops to facilitate combining with ternary ops.

* Merge modular ops CTL into main CTL.

* Refactor DIV and MOD code into its own module.

* Merge DIV and MOD into arithmetic CTL.

* Clippy.

* Fixes related to merge.

* Simplify register naming.

* Generate u16 BN254 modulus limbs at compile time.

* Clippy.

* Add degree bits ranges for Arithmetic table.
2023-05-11 03:29:06 +10:00
Nicholas Ward
779456c2c9
Merge pull request #1029 from mir-protocol/precompile-memory-context-change
Use current memory context in hash precompiles
2023-05-10 10:06:00 -07:00
Nicholas Ward
6f4f00c6f8
Merge pull request #1027 from mir-protocol/memory-refactor
Memory refactor to make code more re-usable
2023-05-10 10:05:03 -07:00
Hamish Ivey-Law
2c5f6fd62a
Fix compile time problems and generic hash implementation (#1024)
* Fix egregious magic number.

* Remove generic consts from core permutations.

* Remove redundant `where` clauses.

* Remove HashConfig and friends.

* Refactor Permutation code.

* Remove redundant `where` clauses and `use`s.

* Introduce AlgebraicPermutation to wrap `[Target; WIDTH]`s.

* Remove `generic_const_expr` feature from plonky2!

* Remove `generic_const_expr` feature from plonky2!

* Compile time fixed! Start removing `generic_const_expr` from evm.

* Remove redundant `where` clauses from Starky.

* Remove `generic_const_expr`s from benchmarks.

* Remove redundant HASH_SIZE `where` clause.

* Clippy.

* Fix unrelated OsRng issue in `bench_recursion`.

* Fix function doc.
2023-05-11 02:59:02 +10:00