* extract curve25519 crate
* remove obsolete comment
* fix Cargo.toml files
* fix imports
* update lock file
* remove unused deps from zk-token-sdk
* fmt
* add solana-curve25519 patch
* add missing override to programs/sbf/Cargo.toml
* copy over an allow()
* move new crate to curves dir
* use workspace version
* add back missing dev dep
* add missing dependencies to programs/sbf
* fmt
* move dep to the correct dependency table
* remove #[cfg(not(target_os = "solana"))] above errors mod
* use serde_derive instead of the derive feature of serde
* make serde_derive version match serde version
* remove serde dep entirely from programs/address-lookup-table
* replace remaining usage of serde "derive" feature
* update lock files
* explicitly use serde_derive in svm and frozen-abi
* add comments about serde and serde_derive versions matching
* refactor ciphertext for 2 handles instructions
* add instruction data for ciphertext with 3 handles validity proof
* add ciphertext for 3 handles validity proof instruction
* add test and bench for ciphertext 3 handles validity proof instruction
* cargo fmt
* Apply suggestions from code review
Co-authored-by: Jon C <me@jonc.dev>
* update instruction docs to mention the possibility to read from accounts
* Apply suggestions from code review
Co-authored-by: Jon C <me@jonc.dev>
---------
Co-authored-by: Jon C <me@jonc.dev>
* make the `errors` module available in sbf targets
* move `AuthenticatedEncryptionError` to the `errors` module
* move `ElGamalError` to the `errors` module
* add `ParseError` in `zk-token-elgamal`
* implement `FromStr` for `ElGamalPubkey` and `ElGamalCiphertext`
* implement `FromStr` for `AeCiphertext`
* fix target
* cargo fmt
* use constants for byte length check
* make `FromStr` functions available on chain
* use macros for the `FromStr` implementations
* restrict `from_str` macro to `pub(crate)`
* decode directly into array
* cargo fmt
* Apply suggestions from code review
Co-authored-by: Jon C <me@jonc.dev>
* remove unnecessary imports
* remove the need for `ParseError` dependency
---------
Co-authored-by: Jon C <me@jonc.dev>
* add `try_split_u64`
* add `try_combine_lo_hi_u64`
* add `try` variants of ciphertext arithmetic functions
* use try functions in proof generaiton and verification logic
* deprecate non-`try` functions
* use try functions in proof generaiton and verification logic
* Apply suggestions from code review
Co-authored-by: Jon C <me@jonc.dev>
* cargo fmt
---------
Co-authored-by: Jon C <me@jonc.dev>
* add functionality to read proof from accounts instead of instruction data
* update add tests
* clippy
* clarify instruction data discriminator
* avoid cloning entire proof data
* Update programs/zk-token-proof/src/lib.rs
Co-authored-by: Jon C <me@jonc.dev>
* update `PROOF_OFFSET_LENGTH` to `INSTRUCTION_DATA_LENGTH_WITH_PROOF_ACCOUNT`
* update instruction docs
* add feature gate
* Update sdk/src/feature_set.rs
Co-authored-by: Jon C <me@jonc.dev>
* update feature name `enable_zk_from_account` to `enable_zk_proof_from_account`
* Apply suggestions from code review
Co-authored-by: Jon C <me@jonc.dev>
* clarify the instruction data length more precisely
---------
Co-authored-by: Jon C <me@jonc.dev>
* replace assert statements with `VectorLengthMismatch` error variant
* add a condition to check that the bit lengths are in the correct range
* replace assert statements with `GeneratorLengthMismatch`
* remove unchecked arithmetic
* add `InnerProductLengthMismatch` error
* fix typo
* add a clarifying comment on unwrap safety
* fix typo
* limit max seed length for elgamal keypairs
* limit max seed length for authenticated encryption keys
* Apply suggestions from code review
Co-authored-by: Jon Cinque <me@jonc.dev>
* rename `SeedLengthTooLarge` to `SeedLengthTooLong`
---------
Co-authored-by: Jon Cinque <me@jonc.dev>
* allow pedantic invalid cast lint
* allow lint with false-positive triggered by `test-case` crate
* nightly `fmt` correction
* adapt to rust layout changes
* remove dubious test
* Use transmute instead of pointer cast and de/ref when check_aligned is false.
* Renames clippy::integer_arithmetic to clippy::arithmetic_side_effects.
* bump rust nightly to 2023-08-25
* Upgrades Rust to 1.72.0
---------
Co-authored-by: Trent Nelson <trent@solana.com>
* sdk: Add concurrent support for rand 0.7 and 0.8
* Update rand, rand_chacha, and getrandom versions
* Run command to replace `gen_range`
Run `git grep -l gen_range | xargs sed -i'' -e 's/gen_range(\(\S*\), /gen_range(\1../'
* sdk: Fix users of older `gen_range`
* Replace `hash::new_rand` with `hash::new_with_thread_rng`
Run:
```
git grep -l hash::new_rand | xargs sed -i'' -e 's/hash::new_rand([^)]*/hash::new_with_thread_rng(/'
```
* perf: Use `Keypair::new()` instead of `generate`
* Use older rand version in zk-token-sdk
* program-runtime: Inline random key generation
* bloom: Fix clippy warnings in tests
* streamer: Scope rng usage correctly
* perf: Fix clippy warning
* accounts-db: Map to char to generate a random string
* Remove `from_secret_key_bytes`, it's just `keypair_from_seed`
* ledger: Generate keypairs by hand
* ed25519-tests: Use new rand
* runtime: Use new rand in all tests
* gossip: Clean up clippy and inline keypair generators
* core: Inline keypair generation for tests
* Push sbf lockfile change
* sdk: Sort dependencies correctly
* Remove `hash::new_with_thread_rng`, use `Hash::new_unique()`
* Use Keypair::new where chacha isn't used
* sdk: Fix build by marking rand 0.7 optional
* Hardcode secret key length, add static assertion
* Unify `getrandom` crate usage to fix linking errors
* bloom: Fix tests that require a random hash
* Remove some dependencies, try to unify others
* Remove unnecessary uses of rand and rand_core
* Update lockfiles
* Add back some dependencies to reduce rebuilds
* Increase max rebuilds from 14 to 15
* frozen-abi: Remove `getrandom`
* Bump rebuilds to 17
* Remove getrandom from zk-token-proof
* function docs to focus on the action they perform
* update docs for fee sigma proof
* add link to zk token proof doc
* Apply suggestions from code review
Co-authored-by: Tyera <tyera@solana.com>
---------
Co-authored-by: Tyera <tyera@solana.com>
* make `ElGamalKeypair` fields private
* update the rest of `zk-token-sdk` for the visibility update
* update `zk-token-proof-tests` for the visibility update
* update `zk-keygen` for the visibility update
* update `zk-token-proof` benches for the updated visibility
* cargo fmt
* rename `ElGamalKeypair::new` to `ElGamalKeypair::new_for_tests`
* add docs for the proof program instructions
* add docs for the zk token proof program
* add docs for the instruction data types
* add brief description of the proofs for each of the proof instructions
* Apply suggestions from code review
Co-authored-by: Tyera <teulberg@gmail.com>
* change `pubkey` or `public-key` in the docs to `public key`
---------
Co-authored-by: Tyera <teulberg@gmail.com>