140 Commits

Author SHA1 Message Date
Linda Guiga
48e2b24b49
Add range check constraints for the looked table (#1380)
* Add constraints to check that looked tables are well constructed for range checks

* Fix comments
2023-11-22 15:59:41 -05:00
Robin Salen
b9328815e6
Reduce visibility (#1364) 2023-11-17 15:45:38 -05:00
Robin Salen
88fcc32983
Reduce visibility for a bunch of structs and methods in EVM crate (#1289)
* Reduce visibility for a bunch of structs and methods

* Remove redundant
2023-11-13 09:26:56 -05:00
Hamy Ratoanina
d2b549affc
Constrain uninitialized memory to 0 (#1318) 2023-11-03 19:52:12 -04:00
Robin Salen
0d97b93af5
Add some documentation in EVM crate (#1295)
Co-authored-by: Linda Guiga <linda.guiga@toposware.com>
2023-10-30 14:28:24 -04:00
Robin Salen
8afd06cfdd
Fix description of Range-Check columns in STARK modules 2023-09-29 11:24:36 -04:00
Linda Guiga
bbc6fe768f
Merge branch 'main' into 'new-logup' 2023-09-25 11:42:11 -04:00
Robin Salen
d6be2b987b
Remove generic_const_exprs feature from EVM crate (#1246)
* Remove const_generic_exprs feature from EVM crate

* Get a generic impl of StarkFrame
2023-09-22 09:19:13 -04:00
Linda Guiga
c9c0f8b7e5
Use CTL challenges for logUP + change comments + add assert 2023-09-15 09:00:35 +01:00
wborgeaud
f65ad58a08
Implement logUp 2023-09-15 09:00:35 +01:00
Linda Guiga
42f7038031
Add blockhash sys opcode 2023-09-07 09:43:59 +01:00
Linda Guiga
b07644368f
Add missing links between public values 2023-08-31 13:40:13 +01: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
Robin Salen
b711e5279a
Combine a few constraints 2023-08-18 15:36:46 -04:00
Jacqueline Nabaglo
831fe862ff Cut 5 Columns From The Memory Table With This One Weird Trick! 2023-07-27 15:04:10 -07:00
wborgeaud
564864eac3
Remove parts of the copy-on-write logic (#1096)
* Remove parts of the copy-on-write logic

* Minor
2023-06-14 14:46:49 +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
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
ab692252ba
Minor fixes to context creation (#961) 2023-04-08 09:06:02 +02: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
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
be35111034 Merge branch 'main' of github.com:mir-protocol/plonky2 into non-inv 2023-02-16 19:31:16 -08:00
Dmitry Vagner
bce867188c simplify ripe md test 2023-02-15 18:18:26 -08:00
Dmitry Vagner
e2cac0bb0c Merge branch 'main' of github.com:mir-protocol/plonky2 into non-inv 2023-02-15 12:33:43 -08:00
Jacqueline Nabaglo
f3946f75bf
Gas constraints (#880)
* Gas constraints

* Bugfix

* make test pass post rebase
2023-02-14 22:30:19 -08:00
Dmitry Vagner
d320fbfbca update curve add with ops 2023-02-13 13:21:47 -08:00
Dmitry Vagner
787cc8903b change segment 2023-02-13 12:32:40 -08:00
wborgeaud
ac40bd5f5d
Optimize ecMul precompile (scalar multiplication on BN254) (#852)
* windowed mul

* Working

* Window of 4 bits

* Fix

* Comments

* Unroll loop

* Unroll loop

* remove global

* Minor

* Minor

* Implement `CALLVALUE, CALLDATALOAD, CALLDATASIZE, CALLDATACOPY` in interpreter

* Minor

* Doesn't work

* Minor

* Minor

* wnaf msm

* Working hardcoded values: 28657 opcodes

* Working wnaf

* Small wnaf optim

* Precompute works

* Working together

* Bump to 129 bits

* Working glv decomposition

* Working MSM with GLV

* Almost working

* Working

* ECC test folder

* Working with real sig data

* Fix tests + Clippy

* Minor

* Cleaning

* Comments

* Cleaning

* Smaller glv test file

* Print opcode count at the end of interpreter run

* More constants

* Add z3 proof that the GLV scalars are 129-bit or less

* Minor change to z3 proof

* Move files and renaming fns

* Testing

* Fix BN GLV

* BN precompute table

* Working precompute

* Working bn tests

* Working

* Minor

* Minor

* Use MULFP254

* Minor

* Merge conflicts

* Remove unused asm file

* ECC fns renaming (#874)

* PR feedback
2023-02-13 20:11:32 +01:00
wborgeaud
ca002aeafa
Optimize ecrecover ASM (#840)
* windowed mul

* Working

* Window of 4 bits

* Fix

* Comments

* Unroll loop

* Unroll loop

* remove global

* Minor

* Minor

* Implement `CALLVALUE, CALLDATALOAD, CALLDATASIZE, CALLDATACOPY` in interpreter

* Minor

* Doesn't work

* Minor

* Minor

* wnaf msm

* Working hardcoded values: 28657 opcodes

* Working wnaf

* Small wnaf optim

* Precompute works

* Working together

* Bump to 129 bits

* Working glv decomposition

* Working MSM with GLV

* Almost working

* Working

* ECC test folder

* Working with real sig data

* Fix tests + Clippy

* Minor

* Cleaning

* Comments

* Cleaning

* Smaller glv test file

* Print opcode count at the end of interpreter run

* More constants

* Add z3 proof that the GLV scalars are 129-bit or less

* Minor change to z3 proof

* Minor

* Hamish's suggestion

* Working

* Cleaning

* Clippy

* PR feedback

* Minor PR feedback
2023-01-31 19:23:54 +01:00
Daniel Lubarov
137bc78565 Prep for publishing to crates.io 2023-01-30 13:18:06 -08:00
Daniel Lubarov
88f64072ef Comments 2022-12-09 08:56:49 -08:00
Daniel Lubarov
1c5590fb22 Add dummy reads to fill any large gaps in memory fields 2022-12-05 15:48:09 -08:00
Daniel Lubarov
1303a83f7f Misc witness generation fixes 2022-12-03 21:09:57 -08:00
Daniel Lubarov
b8b2fefe52 Use Keccak sponge table for bootloading
And get rid of the deprecated Keccak memory table.
2022-12-03 11:21:31 -08:00
Daniel Lubarov
82d0f08193 clippies 2022-12-02 17:06:30 -08:00
Daniel Lubarov
05ab3d7933 Fixes 2022-12-01 16:23:39 -08:00
Daniel Lubarov
9bf47ef8ac Fixes 2022-12-01 12:46:14 -08:00
Daniel Lubarov
afb3e4b1e1 Misc work on witness generation 2022-11-30 14:58:40 -08:00
Daniel Lubarov
d23cecfcd8 Kernel code to do jumpdest analysis 2022-11-21 13:06:03 -08:00
Hamish Ivey-Law
1c87fbb712
EVM shift left/right operations (#801)
* First parts of shift implementation.

* Disable range check errors.

* Tidy up ASM.

* Update comments; fix some .sum() expressions.

* First full draft of shift left/right.

* Missed a +1.

* Clippy.

* Address Jacqui's comments.

* Add comment.

* Fix missing filter.

* Address second round of comments from Jacqui.
2022-11-09 10:47:15 +11:00
wborgeaud
fd96d30e24 Minor 2022-10-27 14:57:17 +02:00
wborgeaud
6b4cce21d8 Start 2022-10-21 18:00:41 +02:00
Daniel Lubarov
7f366cdace Treat storage tries as sub-tries of the state trie
I.e. have leaves in the state trie point to the root of a storage trie
2022-10-16 20:26:37 -07:00
Daniel Lubarov
299aabf860 Fix branch hashing bug 2022-10-11 15:56:23 -07:00
Daniel Lubarov
f2cb42bbe8 MPT logic to hash branch nodes 2022-10-05 20:46:49 -07:00
Daniel Lubarov
b6d71a7008 Keccak benchmark
And reworking things a bit to include the timing data we want.
2022-09-23 10:54:17 -07:00
Jacqueline Nabaglo
084700a7f4
Memory channel for program counter (#717) 2022-09-22 18:09:23 -07:00
Daniel Lubarov
aa87f2c3ba Public memory 2022-08-25 20:19:18 -07:00
Daniel Lubarov
c38a98f9e4 Simpler CPU <-> memory CTL 2022-08-23 23:38:28 -07:00