1564 Commits

Author SHA1 Message Date
Dmitry Vagner
444da8f760 better comments 2023-02-13 14:31:53 -08:00
Dmitry Vagner
80e49caae1 segment virts 2023-02-13 14:04:43 -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
Dmitry Vagner
71243fd728 fix pairing code after big BN PR merge 2023-02-13 11:41:13 -08:00
Dmitry Vagner
2158c1d267 merge 2023-02-13 11:31:08 -08:00
Dmitry Vagner
9e60ee2567 segment 2023-02-13 11:25:46 -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
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
Dmitry Vagner
c6492bc5d5 merge fix 2023-02-08 11:28:52 -08:00
Dmitry Vagner
7b367f5c49 merge 2023-02-08 11:25:11 -08:00
Hamish Ivey-Law
83c0292be8
Move SHL and SHR generation to the CPU. (#878) 2023-02-09 05:44:05 +11:00
Dmitry Vagner
b585b6a7c7 remove macro 2023-02-08 09:46:54 -08:00
Dmitry Vagner
31095e1b23 stack macro 2023-02-08 09:37:27 -08:00
Dmitry Vagner
a061b88a7a naming 2023-02-08 09:15:38 -08:00
Dmitry Vagner
cecad5980d stack macro 2023-02-08 09:10:17 -08:00
Dmitry Vagner
361d6d7262 tests and stacks 2023-02-07 18:53:58 -08:00
Dmitry Vagner
cb7c638cbc more comments 2023-02-07 15:09:49 -08:00
Dmitry Vagner
69afed9297 refactor 2023-02-07 14:54:07 -08:00
Dmitry Vagner
57146c83bc miller loop test 2023-02-07 09:18:49 -08:00
Dmitry Vagner
e63cc2aa9b Merge branch 'main' of github.com:mir-protocol/plonky2 into non-inv 2023-02-07 08:53:43 -08:00
Dmitry Vagner
9f808fc78c align 2023-02-07 08:53:23 -08: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
Dmitry Vagner
1c73e23824 fp -> fp254 2023-02-05 17:43:31 -08:00
Dmitry Vagner
61ac0eff46 fmt 2023-02-05 17:40:45 -08:00
Dmitry Vagner
0f030fae4a naming for global labels 2023-02-05 17:40:04 -08:00
Dmitry Vagner
c107c5055e comments 2023-02-01 19:30:04 -08:00
Dmitry Vagner
e1dca8703c name 2023-02-01 19:19:36 -08:00
Dmitry Vagner
962754be99 rand impl 2023-02-01 19:15:56 -08:00
Dmitry Vagner
a950a26266 add comments 2023-02-01 18:57:50 -08:00
Dmitry Vagner
cd5c92b574 merge 2023-02-01 08:51:42 -08: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
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
Dmitry Vagner
ea01e19c41 comment 2023-01-28 14:17:55 +08:00
Dmitry Vagner
5b124fb121 minor 2023-01-26 10:42:31 +07:00
Dmitry Vagner
6e8d4a57a4 fix 2023-01-25 16:48:28 +07:00
Dmitry Vagner
0eef28af66 bools 2023-01-25 16:41:42 +07:00
Dmitry Vagner
3ea8ad9062 fmt 2023-01-25 16:26:50 +07:00
Dmitry Vagner
6958d46c56 names and comments 2023-01-25 16:26:41 +07:00
Dmitry Vagner
56be7317e0 comments 2023-01-25 16:20:24 +07:00
Dmitry Vagner
b46af11f3a move consts 2023-01-25 16:10:53 +07:00
Dmitry Vagner
f70243e70c better comments 2023-01-25 15:31:32 +07:00
Dmitry Vagner
f0a6ec9535 clean asm 2023-01-25 14:42:30 +07:00
Dmitry Vagner
9c8f11666f ocd 2023-01-25 14:15:46 +07:00
Dmitry Vagner
d98c69f0bc better comments 2023-01-25 14:12:29 +07:00
Dmitry Vagner
0b81258af3 stack macros 2023-01-24 17:18:13 +07:00