120 Commits

Author SHA1 Message Date
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
Dmitry Vagner
1627a9a0d3 tests pass 2023-03-22 09:55:35 -07:00
Dmitry Vagner
0e8f6a2f68 test skeleton 2023-03-21 21:17:46 -07:00
Dmitry Vagner
9ea0ebd78f skeleton 2023-03-21 21:10:01 -07:00
Dmitry Vagner
13d2ed90d7 merge 2023-03-21 19:23:54 -07:00
Daniel Lubarov
47fac8e35b Couple fixes & minor refactor 2023-03-19 22:35:53 -07:00
Dmitry Vagner
459d292964 folder 2023-03-15 19:34:33 -07:00
Dmitry Vagner
dd7948e77b merge 2023-03-14 16:40:58 -07:00
Nicholas Ward
676a483c06 fix 2023-03-14 12:34:51 -07:00
Nicholas Ward
476a554aea OR -> ADD 2023-03-14 12:29:30 -07:00
Dmitry Vagner
e8c9463268 comment 2023-02-25 18:22:55 -08:00
Dmitry Vagner
1d94756e1a add inverse doc 2023-02-25 18:07:10 -08:00
Dmitry Vagner
2ea3e5e3ca minor changes 2023-02-25 10:35:33 -08:00
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
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
9f808fc78c align 2023-02-07 08:53:23 -08:00
Dmitry Vagner
1c73e23824 fp -> fp254 2023-02-05 17:43:31 -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
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
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
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
f0a6ec9535 clean asm 2023-01-25 14:42:30 +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
Dmitry Vagner
c9b005d22e new power works 2023-01-24 17:08:29 +07:00
Dmitry Vagner
5deb164865 refactor power 2023-01-24 16:35:49 +07:00
Dmitry Vagner
60cbdde879 clean 2023-01-24 14:56:15 +07:00
Dmitry Vagner
ec4cddb7c9 inv as method 2023-01-23 14:59:08 +07:00
Dmitry Vagner
d2aa937a2f improved prover input and test api 2023-01-21 13:19:07 +07:00
Dmitry Vagner
e06a2f2d46 duh 2023-01-21 00:56:38 +07:00
Dmitry Vagner
a5c292c751 space 2023-01-21 00:33:09 +07:00
Dmitry Vagner
d99cadebc2 stack macro 2023-01-20 16:03:24 +07:00
Dmitry Vagner
b2f9d885f9 remove redundant macros and improve comments 2023-01-20 15:59:14 +07:00