Commit Graph

54 Commits

Author SHA1 Message Date
Tyera 3442f184f7
Remove unneeded `clippy::new_ret_no_self` allows (#31035)
Remove unneeded allows
2023-04-03 20:35:20 -06:00
Illia Bobyr 23531fc659
ledger: Remove `clippy::wrong_self_convention` (#29916)
Clippy does not seem to be complaining anymore.

It looks like this rule is now only applied to `as_` methods that take `&self`
or `&mut self` as the first argument:

  a9c251f11d/clippy_lints/src/methods/wrong_self_convention.rs (L14)

For `Copy` types, `to_` rule is applied only when the method takes `self` as the
first argument:

  a9c251f11d/clippy_lints/src/methods/wrong_self_convention.rs (L25)

Enforcement is here:

  a9c251f11d/clippy_lints/src/methods/wrong_self_convention.rs (L106)
2023-01-26 15:12:35 -08:00
samkim-crypto c828031d9a
[zk-token-sdk] Fix ElGamal key derivation (#28792)
* fix ElGamal key derivation

* cargo fmt
2022-11-12 08:44:02 +09:00
samkim-crypto 636baaf494
[zk-token-sdk] Update docs for encryption in zk-token-sdk (#28760)
clean up docs for encryption
2022-11-08 10:03:24 +00:00
samkim-crypto 4c944931c5
zk-token-sdk:add length checks (#27389)
* zk-token-sdk: add length check for ristretto encodings

* zk-token-sdk: add type check for sigma proofs
2022-08-25 14:22:52 +09:00
samkim-crypto 5e8b8abd84
zk-token-sdk: constant time equality check for elgamal and aes key derivation (#27364)
zk-token-sdk: use constant time equality check for elgamal and aes key derivation
2022-08-24 18:56:55 +09:00
samkim-crypto 700da0fc83
zk-token-sdk: implement Display for ciphertexts (#26755) 2022-07-23 21:59:40 +09:00
Michael Vines b05c7d91ed Fix derive_partial_eq_without_eq clippy lint 2022-05-22 22:22:21 -07:00
Dmitri Makarov 569b00025c fix: replace rust cfg annotations that use bpf by target_os solana 2022-05-18 20:39:43 -07:00
samkim-crypto b2d502b461
zk-token-sdk: add support for scalar - ciphertext/commitment multiplication (#24120) 2022-04-09 14:19:29 +01:00
samkim-crypto f1f8f5458d
Threads for discrete log (#23867)
* zk-token-sdk: add multi-thread for discrete log

* zk-token-sdk: some clean-up

* zk-token-sdk: change default discrete log thread to 1

* zk-token-sdk: allow discrete log thread nums to be chosen as param

* zk-token-sdk: join discrete log threads

* zk-token-sdk: join thread handles before returning

* zk-token-sdk: Apply suggestions from code review

Co-authored-by: Michael Vines <mvines@gmail.com>

* zk-token-sdk: update tests to use num_threads

* zk-token-sdk: simplify discrete log by removing mpsc and just using join

* zk-token-sdk: minor

Co-authored-by: Michael Vines <mvines@gmail.com>
2022-04-01 20:01:24 -04:00
samkim-crypto d2b23da9ea
Zk token sdk clean decryption (#23478)
* zk-token-sdk: add decryption for pod elgamal ciphertexts

* zk-token-sdk: add decryption for pod elgamal ciphertexts

* zk-token-sdk: cargo fmt

* zk-token-sdk: minor update to docs

* zk-token-sdk: minor

* zk-token-sdk: fix bpf build error

* zk-token-sdk: more simplifying discrete log

* zk-token-sdk: fmt

* zk-token-sdk: minor update to doc
2022-03-04 15:57:19 -04:00
samkim-crypto 65f8f43665
Zk instructions pass (#22851)
* zk-token-sdk: re-organize transcript

* zk-token-sdk: add pod ElGamal group encryption

* zk-token-sdk: add transcript domain separators for sigma proofs

* zk-token-sdk: clean up transfer tx decryption

* zk-token-sdk: resolve encoding issues for transfer

* zk-token-sdk: fix transfer test

* zk-token-sdk: clean up transcript for close account and withdraw instructions

* zk-token-sdk: add transfer with fee instruction

* zk-token-sdk: add transfer with fee instruction

* zk-token-sdk: add pod for cryptographic structs needed for fee

* zk-token-sdk: add pod for fee sigma proof

* zk-token-sdk: fix test for transfer with fee instruction

* zk-token-sdk: add range proof verification for transfer with fee

* zk-token-sdk: add transfer amount decryption for transfer-with-fee

* zk-token-sdk: add proof generation error for instruction

* zk-token-sdk: cargo fmt and clippy

* zk-token-sdk: fix bpf build
2022-02-01 14:11:28 -05:00
samkim-crypto d8cbb2a952
Elgamal pass (#22632)
* zk-token-sdk: change G and H to static and optimize pedersen arithmetic

* zk-token-sdk: remove unnecessary copy in elgamal arithmetic

* zk-token-sdk: fix elgamal tests for new syntax

* zk-token-sdk: use lazy-static for pedersen base

* zk-token-sdk: add dlog test for elgamal decryption

* zk-token-sdk: reflect changes in elgamal in the rest of the sdk

* zk-token-sdk: rustfmt and clippy

* zk-token-sdk: some documentation for elgamal and pedersen

* zk-token-sdk: minor remove whitespace

* zk-token-sdk: update lock files

* zk-token-sdk: change random() to new_rand()

* zk-token-sdk: add explanation for suppressing clippy::op_ref
2022-01-21 20:56:27 -05:00
Michael Vines 69fab16e83 ElGamalKeypair::new() now generates valid keypairs 2022-01-05 08:51:18 -08:00
Michael Vines c1db2b4866 Wrap a struct around the discrete log precompute hashmap 2022-01-05 08:51:18 -08:00
Michael Vines 425a4a4082 cargo fmt 2022-01-05 08:51:18 -08:00
Michael Vines fdb658fff4 Various program refinements 2022-01-05 08:51:18 -08:00
Michael Vines c155519ae1 Generate AesKey/ElGamalSecretKey from an ed25519 signature instead of secret key 2022-01-05 08:51:18 -08:00
Sam Kim 221f499041 derive ElGamal keypair from the secret component of keypair 2022-01-05 08:51:18 -08:00
Sam Kim 89ddae29ef derive ElGamal keypair from Ed25519 keypair instead of just the signing key 2022-01-05 08:51:18 -08:00
Michael Vines abe6b27b34 clippy 2022-01-05 08:51:18 -08:00
Michael Vines 0ac6427abc cargo fmt 2022-01-05 08:51:18 -08:00
Sam Kim a707e85c10 add key pair derivation from ed25519 signing key 2022-01-05 08:51:18 -08:00
Sam Kim ecbdb6ba68 update cargo to include ed25519_dalek 2022-01-05 08:51:18 -08:00
Sam Kim 2eb326b0da add keypair derivation 2022-01-05 08:51:18 -08:00
Sam Kim f350fa7147 add key pair derivation from ed25519 signing key
merge
2022-01-05 08:51:18 -08:00
Sam Kim 0cc717340c update cargo to include ed25519_dalek 2022-01-05 08:51:18 -08:00
Sam Kim a368adcd30 add keypair derivation
merge
2022-01-05 08:51:18 -08:00
Sam Kim 500423626d merge 2022-01-05 08:51:18 -08:00
Sam Kim aea95e8ff3 update cargo to include ed25519_dalek 2022-01-05 08:51:18 -08:00
Sam Kim 0bd28f9620 merge 2022-01-05 08:51:18 -08:00
Sam Kim 65cf599786 merge 2022-01-05 08:51:18 -08:00
Sam Kim 9fdadb503d merge 2022-01-05 08:51:18 -08:00
Sam Kim ee6a13ef6f update cargo to include ed25519_dalek 2022-01-05 08:51:18 -08:00
Sam Kim 30702dcdee add keypair derivation 2022-01-05 08:51:18 -08:00
Sam Kim 43e368faf6 add ElGamal key derivation from Ed25519 signing key 2022-01-05 08:51:18 -08:00
Sam Kim 4b61e27d12 divide out elgamal algorithms with keypair 2022-01-05 08:51:18 -08:00
Michael Vines 93eb49a3e3 Rename ElGamalKeypair fields 2022-01-05 08:51:18 -08:00
Michael Vines c33e24de57 Rename ElGamal to ElGamalKeypair 2022-01-05 08:51:18 -08:00
Michael Vines f272c025bd Rename ElGamal::new() to ElGamal::default() 2022-01-05 08:51:18 -08:00
Michael Vines 6b59beda7b Add fn to save/load ElGamal 2022-01-05 08:51:18 -08:00
Michael Vines 2c1aa715b0 Adjust ElGamal::new() signature 2022-01-05 08:51:18 -08:00
Sam Kim 73c06d9e33 Rename ElGamalPubkey::gen_decrypt_handle method to ElGamalPubkey::decrypt_handle 2022-01-05 08:51:18 -08:00
Sam Kim c150b4b197 Replace to_elgamal_ciphertext with From trait for ElGamalCiphertext 2022-01-05 08:51:18 -08:00
Sam Kim a40e7fc59b Rename Pedersen related structs and methods for consistency 2022-01-05 08:51:18 -08:00
Michael Vines 20bce10204 add clippy 2022-01-05 08:51:18 -08:00
Sam Kim 75896958b6 rename to_elgamal_ctxt to to_elgamal_ciphertext 2022-01-05 08:51:18 -08:00
Michael Vines a622ee4b8d Rename ElGamal::keygen to ElGamal::new 2022-01-05 08:51:18 -08:00
Michael Vines 8bb6f0dc6f Rename ElGamalSK to ElGamalSecretKey 2022-01-05 08:51:18 -08:00