Commit graph

1838 commits

Author SHA1 Message Date
Luke Parker
e504266c80
Remove the experimental feature from monero
It's been unused since we redid the types.
2022-05-30 18:04:57 -04:00
Luke Parker
bfa15283f5
Remove Monero's test FROST file in favor of FROST"s exposed test files
Moves private key recovery for given keys into FROST.
2022-05-30 16:37:51 -04:00
Luke Parker
ce4c899422
Remove "as", except for floats as needed
Also updates Bulletproofs from C to not be length prefixed, yet rather 
have Rust calculate their length.

Corrects an error in key_gen where self was blamed, instead of the 
faulty participant.
2022-05-30 02:14:34 -04:00
Luke Parker
614badfef7
Lint FROST key gen and optimize sign for the success path 2022-05-30 01:46:30 -04:00
Luke Parker
5a1f273cd5
Correct verification share calculation from n * n * t to just n * t
Reduces key gen execution time by a factor of 3.
2022-05-29 19:52:27 -04:00
Luke Parker
f6a41d9836
Clarify FROST's test-provided secp256k1 curve definition 2022-05-28 21:06:25 -04:00
Luke Parker
244d1b6b68
Clarify FROST's hash functions
Updates the keygen challenge to a format not vulnerable to collisions 
due to having multiple variable length elements.
2022-05-28 20:34:44 -04:00
Luke Parker
b5bdb545cc
Add basic key management to the processor 2022-05-28 19:57:10 -04:00
Luke Parker
e982908690
Update the Monero max inputs with according documentation 2022-05-28 05:25:00 -04:00
Luke Parker
92098b24ea
Implement get_outputs_in_block for Monero
Uses a dummy view/spend for now, as we don't have wallet management yet.
2022-05-28 05:24:17 -04:00
Luke Parker
e950b9682b
Add get_block_transactions_possible which automatically filters invalid TXs
Adds Clone to the various error types, which they already should've had.
2022-05-28 05:08:37 -04:00
Luke Parker
ba032cca4a
Optimize decoy selection
Saves roughly 0.8s when running the tests, which took 16.6s and now take 
15.8 (5%).

Removes the larger sample size, which replaced the closest selected 
decoy with the real spend, per advice of Rucknium.
2022-05-28 03:17:02 -04:00
Luke Parker
469ce9106b
Implement a binary search for BatchVerifier blame
Adds helper functions to verify and, on failure, blame, which move an 
unwrap from callers into multiexp where it's guaranteed to be safe and 
easily verified to be proper.

Closes https://github.com/serai-dex/serai/issues/10.
2022-05-27 02:01:01 -04:00
Luke Parker
c90e957e6a
Add a batch verifier to multiexp, along with constant time variants
Saves ~8% during FROST key gen, even with dropping a vartime for a 
constant time (as needed to be secure), as the new batch verifier is 
used where batch verification previously wasn't. The new multiexp API 
itself also offered a very slight performance boost, which may solely be 
a measurement error.

Handles most of https://github.com/serai-dex/serai/issues/10. The blame 
function isn't binary searched nor randomly sorted yet.
2022-05-27 00:52:44 -04:00
Luke Parker
c398b246ff
Add the bones of the processor 2022-05-26 04:36:19 -04:00
Luke Parker
4ddb838a5a
Drop the Monero patch version spec now that it's no longer relevant
Also adds a comment to FROST.
2022-05-26 03:52:45 -04:00
Luke Parker
5ca0945cbf
Implement serialization for SpendableOutput
Changes the output index to a u8. While it may expand to a u16 at some 
point, this can remain canonical using little endian serialization while 
dropping the latter byte if it's 0 (or simply only using u16 when it's 
actually possible).
2022-05-26 03:51:27 -04:00
Luke Parker
d45473b2bd
Add a test for batch verification 2022-05-25 00:57:00 -04:00
Luke Parker
3a2e5bea0d
Move the CLSAG test to the newly modular FROST test setup 2022-05-25 00:30:51 -04:00
Luke Parker
868a63a6b2
Start modularizing FROST tests as per https://github.com/serai-dex/serai/issues/9 2022-05-25 00:29:20 -04:00
Luke Parker
1eaf2f897b
Consolidate Schnorr code in FROST 2022-05-25 00:22:00 -04:00
Luke Parker
d67d6f2f98
Add PartialEq to structs 2022-05-25 00:21:01 -04:00
Luke Parker
d10c6e16dc
Move FROST to HashMaps
Honestly, the borrowed keys are frustrating, and this probably reduces 
performance while no longer offering an order when iterating. That said, 
they enable full u16 indexing and should mildly improve the API.

Cleans the Proof of Knowledge handling present in key gen.
2022-05-24 21:41:14 -04:00
Luke Parker
5ff65bd268
Move the DLEQProof to a Transcript 2022-05-23 03:24:33 -04:00
Luke Parker
0eb2386ef0
Have the C++ RNG apply a DST 2022-05-22 15:56:12 -04:00
Luke Parker
30529038f2
Move serialize from a folder to a file 2022-05-22 02:24:35 -04:00
Luke Parker
cc65b6e055
Move RingCT code to a deciated folder
Should help keep things ordered as more RingCT code is added.
2022-05-22 02:24:24 -04:00
Luke Parker
790e89902a
Override Monero's random function with a Rust-seedable random
Closes https://github.com/serai-dex/serai/issues/2. Also finishes the 
implementation of 
https://github.com/monero-project/research-lab/issues/103.
2022-05-22 01:56:17 -04:00
Luke Parker
0c01ad69d8
Correct RctPrunable decoding 2022-05-21 23:16:06 -04:00
Luke Parker
882d67838e
Fix test failure reporting 2022-05-21 22:23:16 -04:00
Luke Parker
e1fd462a50
Properly calculate uniqueness when creating change outputs
It was missing sorting its inputs by their key images.
2022-05-21 21:44:57 -04:00
Luke Parker
23d9d81bdb
Merge pull request #7 from serai-dex/issue-1
Remove monero-rs types
2022-05-21 20:41:58 -05:00
Luke Parker
890f7104f7
Remove a stray dbg 2022-05-21 21:39:20 -04:00
Luke Parker
ec6927e66e
Add Clone/Debug derivations to structs 2022-05-21 21:36:28 -04:00
Luke Parker
703b18c6e8
Implement Block types
Finishes updating the RPC to not use monero, tests now pass
2022-05-21 21:35:25 -04:00
Luke Parker
3282b19536
Transaction deserialization 2022-05-21 20:27:21 -04:00
Luke Parker
aa5d95ef1d
Changes meant for the previous commit 2022-05-21 20:26:28 -04:00
Luke Parker
517db6448a
Remove monero-rs types
Still missing an updated RPC file. Restructures the library as it makes 
sense
2022-05-21 15:33:35 -04:00
Luke Parker
573f847a9b
Implement shared key derivation according to https://github.com/monero-project/research-lab/issues/103
Currently solely used for single signer change outputs, intended to be 
used for funds into Serai and multisig change outputs (dependent on #2).

Also cleans the file layout, makes scanning a bit more robust, doesn't 
return outputs of amount 0, and shuffles outputs.
2022-05-20 01:03:54 -04:00
Luke Parker
8945b50988
Minor lint 2022-05-19 16:49:45 -04:00
Luke Parker
90fccc444b
Remove .is_some() unwraps for if let Some 2022-05-18 01:08:54 -04:00
Luke Parker
7c0886a113
Support signing Monero TXs with multiple inputs
Remove's CLSAG's msg Rc for the msg available through AlgorithmMachine. 
Potentially slightly more inefficient, as it needs to be converted from 
a slice to a [u8; 32], yet removes a re-impl.

Also removes a match for an if.
2022-05-18 00:53:13 -04:00
Luke Parker
3a13f80bdd
Patch for previous commit 2022-05-17 19:51:04 -04:00
Luke Parker
fd0fd77cf5
Simplify Monero key image handling 2022-05-17 19:15:53 -04:00
Luke Parker
dcd909a839
Allow offsetting FROST keys multiple times 2022-05-14 15:04:08 -04:00
Luke Parker
3f02ab3037
Optimize decoy selection by batching the get_outputs call per input 2022-05-14 02:12:54 -04:00
Luke Parker
bf4d83ba70
Remove simd_backend as a used dalek feature
It's great performance yet not mandatory.
2022-05-14 00:59:14 -04:00
Luke Parker
94bd30083b
Slightly simplify CLSAG signing
Expands its test to test all possible ring indexes, though just 0 and a 
single n would be sufficient.
2022-05-14 00:45:13 -04:00
Luke Parker
0aeab04c70
Move Rust definitions of C functions to their respective files 2022-05-13 20:26:53 -04:00
Luke Parker
3533e66c7f
Add Rust CLSAG verification
Marked experimental, not guaranteed to match Monero yet
2022-05-13 20:26:29 -04:00