* 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>
* remove decoded `TransferWithFeePubkeys`
* remove decoded `TransferPubkey`
* rename `TransferPubkeys` and `TransferWithFeePubkeys` fields
* relocate `TransferPubkeys` and `TransferWithFeePubkeys`
* reorder proof verify parameters for transfer and transfer with fee
* clippy
* replace `decoded::TransferAmountCiphertext` to `DecodedTransferAmountCiphertext`
* refactor pod convert logic for fee parameters
* remove manual byte conversions for `FeeParameters`
* fix error from rebase
* define `FeeEncryption` as a wrapper around `GroupedElGamalCiphertext`
* define pod `FeeEncryption` as a wrapper around `GroupedElGamalCiphertext2Handles`
* update proof data computation
* add comments about unwraps
* fully specify transcript function names `sep` to `separator`
* update names in `sigma_proofs`
* update names in `range_proof`
* update grouped ciphertext validity proofs with new full name
* define `TransferAmountEncryption` as a wrapper around `GroupedElGamalCiphertext`
* implement `From<GroupedElGamalCiphertext<3>>` for `GroupedElGamalCiphertext3Handles`
* define pod `TransferAmountEncryption` as a wrapper around pod `GroupedElGamalCiphertext3Handles`
* derive `Copy`, `Debug`, `Eq`, and `PartialEq` traits for `TransferAmountEncryption`
* rename `TransferAmountEncryption` to `TransferAmountCiphertext`
* clippy
* fix target arch
* add comment on why it is safe to unwrap
* ci: add missing description and documentation to zk-token-sdk/Cargo.toml
* ci: add missing description back to programs/bpf_loader/Cargo.toml
* ci: add missing description back to banks-client/Cargo.toml
* refactor `instruction::transfer` and `instruction::transfer_with_fee` into separate submodule
* rename `transfer.rs` to `transfer_without_fee.rs` to satisfy clippy
* refactor transfer encryptions into separate submodule
* refactor `FeeParameters` to parent transfer module
* refactor `Role` and ciphertext arithmetic specific to transfer instruction into transfer submodule
* fix visibility
* cargo fmt
* change `transfer_with_fee` and `transfer_without_fee` to `with_fee` and `without_fee`
* fix rebase errors
* refactor `DecryptHandle` into `pod::elgamal` from `pod::pedersen`
* refactor conversion for elgamal
* refactor conversion for pedersen
* change variable names
* add brief description of the types
* fix variable names in comments
* rename `sigma_proof::ctxt_comm_equality_proof` to non-abbreviated name
* rename `sigma_proof::ctxt_ctxt_equality_proof` to non-abbreviated name
* rename `instruction::ctxt_ctxt_equality` to non-abbreviated name
* add aggregate range proof instructions data
* add aggregate range proof instruction
* update proof program processor for aggregate range proof instructions
* cargo fmt
* Update zk-token-sdk/src/instruction/aggregate_range_proof/aggregate_range_proof_256.rs
Co-authored-by: mvines <mvines@gmail.com>
* add remark in instruction description that context state account must be pre-allocated
* use `u64::BITS` and `u128::BITS`
* add proof description in `zk_token_proof_instruction.rs`
* rename instruction names to `VerifyBatchedRangeProofU{N}`
* rename module names from `aggregate` to `batched`
* add `tokio::test` that was lost in rebase
---------
Co-authored-by: mvines <mvines@gmail.com>