194 Commits

Author SHA1 Message Date
wborgeaud
8c78271f5c
Add random value to block metadata and fix sys_prevrandao (#1207)
* Add random to block metadata and fix `sys_prevrandao`

* Minor

* Observe block_random

* Write block_random

* cargo fmt

* block_random: H256

* Move sys_prevrandao to metadata.asm and delete syscall_stubs.asm

* Set block_random in set_block_metadata_target

* Minor

* Minor
2023-09-25 18:20:22 +02:00
Robin Salen
c0b4f155f4
Implement receipts and logs
Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>
Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>
2023-08-22 20:00:49 +01:00
Jacqueline Nabaglo
0117541909
Merge pull request #1071 from mir-protocol/jacqui/bad-opcode-witness-generation
Error handling
2023-06-07 15:49:07 -07:00
wborgeaud
55b29cacf8
Remove bootloader.asm (#1072) 2023-06-04 19:17:58 +02:00
Jacqueline Nabaglo
7ab0bba559
Merge branch 'main' into jacqui/bad-opcode-witness-generation 2023-06-02 21:34:52 -07:00
Jacqueline Nabaglo
b7220428b3 Error handling 2023-06-02 15:51:26 -07: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
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
wborgeaud
244d5e9b3c
Add refund journal event and checkpoint after access address event (#1040) 2023-05-16 14:36:17 +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
Nicholas Ward
f0df03f65a
Merge pull request #1009 from mir-protocol/expmod_precompile
expmod precompile calling code
2023-05-02 08:14:19 -07:00
Dima V
ae21ef8fd1
Merge pull request #997 from mir-protocol/pairing-test
Restructure BN254 Pairing Precompile to fit EVM Test Spec
2023-04-28 22:11:56 -07:00
Nicholas Ward
031fe6ed90 Merge branch 'main' into expmod_precompile 2023-04-28 11:39:47 -07:00
Dmitry Vagner
4c235e5a4b Merge branch 'main' of github.com:mir-protocol/plonky2 into pairing-test 2023-04-26 14:16:08 -07:00
Nicholas Ward
dc91554da2 expmod precompile 2023-04-25 17:19:44 -07:00
Nicholas Ward
9460acc196 rename blake2b 2023-04-25 14:55:44 -07:00
Nicholas Ward
5dc4491681 Merge branch 'main' into blake_precompile 2023-04-24 16:59:17 -07:00
Nicholas Ward
454e0add24 fixed blake2_f, and testing 2023-04-24 16:58:57 -07:00
Dmitry Vagner
b661a70904 twisted check 2023-04-19 23:06:02 -07:00
Nicholas Ward
cb23bfcade check for special cases and align with yellow paper 2023-04-19 14:55:19 -07:00
Dmitry Vagner
0e08243275 reorg 2023-04-19 10:40:39 -07:00
wborgeaud
b721236eb3
Precompiles interface (#983)
* Start

* Some sha256 test passing

* precompiles folder

* Files reorg

* Progress

* Minor

* Start of sha2 interface

* All call opcodes

* ecrec

* rip160

* Fix copy_returndata_to_mem

* id

* bn_add

* bn_mul

* TODOs for snarkv and blake2

* Comments

* Use charge_gas_const when possible

* Minor

* Minor

* Minor

* PR feedback
2023-04-14 12:20:28 +02:00
Nicholas Ward
d59fa59af8
Merge pull request #925 from mir-protocol/bignum-modexp
Bignum modexp
2023-04-04 13:37:48 -07:00
Daniel Lubarov
e70e4fca06 Doubly RLP-encode storage values 2023-04-03 21:51:17 -07:00
wborgeaud
8e04cbfe8d
Self-destruct list (#948) 2023-04-01 07:29:22 +02:00
wborgeaud
2ca00a9ad4
Selfdestruct gas and set (#947)
* Add new segment and global metadata

* Insert into self-destruct set

* Implement sys_selfdestruct

* PR feedback

* Fix stack underflow

* Forgot that NOT 1 ≠ 0. Added %not_bit macro for that.
2023-03-31 11:13:36 +02:00
Hamish Ivey-Law
9480cbed99
Signed operations as syscalls (#933)
* Implement syscalls for BYTE, SIGNEXTEND, SAR, SLT and SGT.

* Implement SDIV and SMOD; minor documentation and tidying.

* Implement EXP.

* Add sys_byte to the syscall jumptable.

* Test suite for signed syscalls.

* Handle `EXIT_KERNEL` "properly".

* Add gas charges; rename label.

* Uppercase all opcodes.

* Add test for BYTE; fix bug in BYTE.

* Calculate and charge gas for calling `EXP`.

* Fix gas calculation for `exponent = 0`.

* Address Jacqui's comments.

* Remove BYTE syscall as it will be implemented natively.

* Oops, forgot to remove this bit.
2023-03-30 05:56:01 +11:00
Daniel Lubarov
be0cccdf95
Merge pull request #938 from mir-protocol/rework_create_create2
Rework CREATE, CREATE2 syscalls
2023-03-29 11:25:52 -07:00
Nicholas Ward
c18377d12f Merge branch 'main' into bignum-modexp 2023-03-28 11:15:27 -07:00
Dmitry Vagner
c3a5fd8631 merge 2023-03-24 11:32:01 -07:00
Daniel Lubarov
911dfedd07 Rework CREATE, CREATE2 syscalls
The old code was outdated in various ways, e.g. it was trying to share code with contract-creation txns, so I would ignore the diff and just look at the new code.

Still a bunch of TODOs left here, like actually saving code that's returned.
2023-03-24 10:43:46 -07:00
wborgeaud
ce22d94518
Access lists (#937)
* Working linear search

* Working linear search for storage keys

* Macros

* Gas for wextaccount

* Add origin and to to the access list

* Handle precompiles

* Fixes

* Other opcodes

* Access list SLOAD

* Minor

* Add TODO for SSTORE

* Comments

* Clippy

* Minor

* PR feedback: cold_access

* PR feedback: simplify insert_accessed_addresses_no_return macro

* Fix sys_selfdestruct

* Store length in global metadata and store arrays in kernel memory

* Truncate address in all *CALL syscalls
2023-03-23 20:22:25 +01:00
Dmitry Vagner
1627a9a0d3 tests pass 2023-03-22 09:55:35 -07:00
Nicholas Ward
4cef5aaa84 modmul and modexp 2023-03-20 13:09:42 -07:00
Nicholas Ward
b16b82613e
Merge pull request #881 from mir-protocol/bignum-basic
Basic bignum operations
2023-03-20 13:09:17 -07:00
Daniel Lubarov
47fac8e35b Couple fixes & minor refactor 2023-03-19 22:35:53 -07:00
Nicholas Ward
1c71fb3407 Merge branch 'main' into bignum-basic 2023-03-15 19:33:58 -07:00
Nicholas Ward
e57358bcbd ge -> cmp and returns 0, 1, -1 2023-03-15 13:32:06 -07:00
Dmitry Vagner
24e0b29188 Merge branch 'main' of github.com:mir-protocol/plonky2 into non-inv 2023-03-14 13:42:22 -07:00
Nicholas Ward
6f05a144cb Merge branch 'main' into bignum-basic 2023-03-13 10:17:43 -07:00
Daniel Lubarov
d5003b7cf2 Gas fees go to coinbase 2023-03-12 23:13:19 -07:00
Dmitry Vagner
18c83e77da Merge branch 'main' of github.com:mir-protocol/plonky2 into non-inv 2023-03-08 09:44:21 -08:00
Nicholas Ward
9976a4b040 addmul initial 2023-03-07 17:47:09 -08:00
Nicholas Ward
fa605d7b22 basic bignum 2023-03-07 17:47:09 -08:00
Daniel Lubarov
a6ac051952 Misc EVM fixes 2023-03-06 22:33:06 -08:00
Daniel Lubarov
c558eedd65 Misc EVM fixes 2023-03-05 09:39:49 -08:00
Dmitry Vagner
be35111034 Merge branch 'main' of github.com:mir-protocol/plonky2 into non-inv 2023-02-16 19:31:16 -08:00
Dmitry Vagner
53ab0ada11 remove blake storage 2023-02-15 19:11:22 -08:00