3334 Commits

Author SHA1 Message Date
Daniel Lubarov
7781dd366f Plonky2 to 0.1.3 2023-02-25 10:17:28 -08:00
Daniel Lubarov
db893831b4
Merge pull request #892 from mir-protocol/bump_plonky2
Use new plonky2
2023-02-25 09:57:44 -08:00
Daniel Lubarov
2133c7f3ba Use new plonky2 2023-02-25 09:36:25 -08:00
Daniel Lubarov
52e34265c6 Bump plonky2 to 0.1.2 2023-02-25 08:55:21 -08:00
Daniel Lubarov
7908471913
Merge pull request #891 from mir-protocol/fix_hash_or_noop
Fix `hash_or_noop` for general hash sizes
2023-02-25 08:51:56 -08:00
Daniel Lubarov
e52b75b0d1 Fix hash_or_noop for general hash sizes 2023-02-25 08:25:52 -08:00
Daniel Lubarov
d17f3aa440
Merge pull request #890 from mir-protocol/test_fixes
Fix a few issues found by EVM tests
2023-02-25 07:59:23 -08:00
Daniel Lubarov
29f0692efc Fix a few issues found by EVM tests 2023-02-24 23:37:08 -08:00
Daniel Lubarov
3318547653
Merge pull request #885 from mir-protocol/skip_log
Skip log_kernel_instruction if debug logs disabled
2023-02-17 09:18:21 -08:00
Daniel Lubarov
745bec8d4c Skip log_kernel_instruction if debug logs disabled 2023-02-17 07:33:30 -08:00
Dima V
6f2d99c7bc
Merge pull request #884 from mir-protocol/evm-kernel-tests 2023-02-17 03:20:04 +01:00
Dmitry Vagner
ea9846debf format 2023-02-16 17:01:43 -08:00
Dmitry Vagner
da7a8879c4 make hash functions take a location pointer 2023-02-16 16:59:51 -08:00
Dmitry Vagner
a6ffb4b3c3 simplify byte extraction 2023-02-16 16:30:50 -08:00
Dmitry Vagner
4e4cfb06b3 function API / remove redundancy 2023-02-16 15:01:22 -08:00
Dmitry Vagner
53ab0ada11 remove blake storage 2023-02-15 19:11:22 -08:00
Dmitry Vagner
77a7af76c2 remove sha2 storage 2023-02-15 19:00:52 -08:00
Dmitry Vagner
abc762f7b4 cleaner arithmetic 2023-02-15 18:50:26 -08:00
Dmitry Vagner
731c29c43b abstract 2023-02-15 18:47:33 -08:00
Dmitry Vagner
c6cf1dc56a remove custom 2023-02-15 18:26:05 -08:00
Dmitry Vagner
bce867188c simplify ripe md test 2023-02-15 18:18:26 -08:00
Jacqueline Nabaglo
f3946f75bf
Gas constraints (#880)
* Gas constraints

* Bugfix

* make test pass post rebase
2023-02-14 22:30:19 -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
Daniel Lubarov
3332fbb483
Merge pull request #882 from mir-protocol/back_to_nightly
Revert "Set CI to use an older version of nightly"
2023-02-10 23:25:57 -08:00
Daniel Lubarov
ff80f28b93 Revert "Set CI to use an older version of nightly"
This reverts commit da23fb116b934925f8a5cf37c2f1f092452fdc4d.
2023-02-10 23:10:39 -08:00
Daniel Lubarov
85b3309324
Merge pull request #879 from 0x0ece/patch-1
Make le_sum public
2023-02-10 14:18:28 -08:00
Emanuele Cesena
614c4ae69f
Make le_sum public
Methods like split_le are public. le_sum is the inverse map so useful to have it pub as well (at the very least, we’d like to access it).
2023-02-10 08:20:22 -06:00
Hamish Ivey-Law
40866e775a
Refactor arithmetic operation traits (#876)
* Use U256s in `generate(...)` interfaces; fix reduction bug modular.

* Refactor `Operation` trait.

* Rename file.

* Rename `add_cc` things to `addcy`.

* Clippy.

* Simplify generation of less-than and greater-than.

* Add some comparison tests.

* Use `PrimeField64` instead of `RichField` where possible.

* Connect `SUBMOD` operation to witness generator.

* Add clippy exception.

* Add missing verification of range counter column.

* Fix generation of RANGE_COUNTER column.

* Address William's PR comments.
2023-02-10 23:07:57 +11:00
Hamish Ivey-Law
83c0292be8
Move SHL and SHR generation to the CPU. (#878) 2023-02-09 05:44:05 +11:00
Hamish Ivey-Law
69228491d8
Unify generation and verification of ADD/SUB/LT/GT operations (#872)
* Unify handling of ADD, SUB, LT, GT under the formula x+y=z+cy*2^256.

* Rename general column ranges to "registers" instead of "inputs".

* Rename 'compare' module to 'addcc'.

* Update comments.

* Enforce length equality in iteration.

* Address William's PR comments.
2023-02-07 23:52:58 +11: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
9990632f48
Merge pull request #870 from mir-protocol/prep_for_publish
Prep for publishing to crates.io
2023-01-30 13:50:51 -08:00
Daniel Lubarov
137bc78565 Prep for publishing to crates.io 2023-01-30 13:18:06 -08:00
Daniel Lubarov
815113809a TODO 2023-01-30 08:43:52 -08:00
Hamish Ivey-Law
6c4ef29fec
Add range checks to the arithmetic Stark (#866)
* Simplify loop and remove clippy.

* Offset auxiliary coefficients so they're always positive.

* Split mul aux input into lo/hi parts.

* Rename register.

* Combine `QUO_INPUT_{LO,HI}`; rearrange some columns.

* Split `MODULAR_AUX_INPUT` into high and low pieces.

* Remove range_check_error debug output.

* First draft of generating the range checks.

* Remove opcodes for operations that were defined elsewhere.

* Clean up interface to build arithmetic trace.

* Fix "degree too high" bug in DIV by zero.

* Fix constraint_transition usage in recursive compare.

* Fix variable name; use named constant.

* Fix comment values.

* Fix bug in recursive MUL circuit.

* Superficial improvements; remove unnecessary genericity.

* Fix bug in recursive MULMOD circuit.

* Remove debugging noise; expand test.

* Minor comment.

* Enforce assumption in assert.

* Make DIV its own operation.

* Make MOD it's own operation; rename structs; refactor.

* Expand basic test.

* Remove comment.

* Put Stark operations in their own file.

* Test long traces.

* Minor comment.

* Address William's comments.

* Use `const_assert!` instead of `debug_assert!` because Clippy.
2023-01-31 02:23:24 +11:00
wborgeaud
136cdd053f
Remove InterpolationGate trait (#868) 2023-01-25 08:29:51 +01:00
Jim Posen
3bdb290746
Optimized interpolation gate (#861)
* New implementation of InterpolationGate

* Use CosetInterpolationGate in recursive verifier

* Minimize the degree of interpolation gate

Minimize the degree if it doesn't increase the number of wires or constraints. This allows for more efficiency with selectors.

* Include tests for number of wires and constraints

* Run rustfmt

* Run cargo fmt

* Fix documentation typo

Co-authored-by: wborgeaud <williamborgeaud@gmail.com>

* Fix clippy issue

Co-authored-by: wborgeaud <williamborgeaud@gmail.com>
2023-01-24 11:12:41 +01:00
Daniel Lubarov
8ae3647473
Merge pull request #865 from mir-protocol/increment_nonce
Increment sender nonce + buy gas
2023-01-18 14:43:48 -08:00
Daniel Lubarov
f2e40541d9 Increment sender nonce + buy gas 2023-01-17 23:57:53 -08:00
Daniel Lubarov
b753836a37
Merge pull request #864 from mir-protocol/block_circuit
Block circuit
2023-01-15 22:51:24 -08:00
Daniel Lubarov
b6f6c21018 Block circuit 2023-01-15 00:06:08 -08:00
Daniel Lubarov
3a6d693f3f
Merge pull request #863 from mir-protocol/smart_contract_test
Basic smart contract test
2023-01-14 21:42:20 -08:00
Daniel Lubarov
a2f4a58d9a log 2023-01-14 21:21:47 -08:00
Daniel Lubarov
df2ba7a384 Basic smart contract test 2023-01-14 21:18:58 -08:00
Nicholas Ward
07e02f2df1
Merge pull request #862 from mir-protocol/prover_inputs_error_handling
Use error instead of panicking in `FromStr`
2023-01-13 16:39:31 -08:00
wborgeaud
a158effe4d Use error instead of panicking in FromStr 2023-01-13 15:26:53 +01:00
Daniel Lubarov
be7a489c6e Fix stack overflow 2023-01-10 21:03:46 -08:00
Daniel Lubarov
8ba8bb62f2
Merge pull request #860 from mir-protocol/agg_circuit_2
Add aggregation circuit
2023-01-04 14:57:56 -08:00
Daniel Lubarov
87be6097a1 Feedback 2023-01-04 14:50:15 -08:00
Daniel Lubarov
ae212cfbbd
Merge pull request #859 from mir-protocol/remove_older_evm_recursion_logic
Remove some older EVM recursion logic
2023-01-04 00:07:15 -08:00