Commit Graph

24 Commits

Author SHA1 Message Date
samkim-crypto 4bc8f90182
[zk-token-sdk] Add fee sigma proof verification instruction (#32291)
* add fee sigma proof verification instruction

* update proof program processor for fee sigma proof

* update bench for fee sigma proof

* cargo fmt

* clippy

* fix target arch

* add comments to describe fee, delta, and claimed instruction data field
2023-06-28 09:49:56 +09:00
Tyera bde7c174b8
[zk-token-proof] Fix doc typo (#32270)
Fix doc typo
2023-06-24 15:24:22 -07:00
samkim-crypto 42aa5d243c
[zk-token-proof] Update docs for the ZK Token proof program in `zk-token-sdk` (#32186)
* 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>
2023-06-21 20:50:49 +09:00
samkim-crypto 0495051a67
[zk-token-sdk] Add `VerifyGroupedCiphertext2HandlesValidity` and `VerifyBatchedGroupedCiphertext2HandlesValidity` proof instructions (#31816)
* add grouped ciphertext validity proof data

* add batched grouped ciphertext validity proof data

* rename proof contexts and data for consistency

* add grouped ciphertext validity proof instructions

* Update zk-token-sdk/src/instruction/batched_grouped_ciphertext_validity.rs

Co-authored-by: Tyera <teulberg@gmail.com>

---------

Co-authored-by: Tyera <teulberg@gmail.com>
2023-06-01 15:58:36 +09:00
samkim-crypto 2ebf38efd0
[zk-token-sdk] Add ciphertext-commitment equality proof instruction (#31808)
* add ciphertext-commitment proof data

* add ciphertext-commitment proof instruction

* update proof program processor for ciphertext-commitment equality proof

* cargo fmt

* update compute units

* rename submodule `ctxt_comm_equality` to `ciphertext_commitment_equality`

* update import statements

* fix mixed conflict

* remove `native_programs_consume_cu`
2023-05-27 11:25:29 +09:00
samkim-crypto ad4d1e5ff2
[zk-token-sdk] Add aggregate range proof instructions (#31793)
* 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>
2023-05-27 05:46:11 +09:00
samkim-crypto ef7ca5ee8b
[zk-token-sdk] add range-proof proof instruction (#31788)
* add `VerifyRangeProof` instruction

* update proof program processor for `VerifyRangeProof64`

* specify target arch for `RANGEPROOF64_BIT_LENGTH

* rename `transcript_new` to `new_transcript`

* add constructor for `VerifyRangeProof64`

* add remark in the instruction description that context state account must be pre-allocated

* add proof description in `zk_token_proof_instruction.rs`

* rename `VerifyRangeProof64` to `VerifyRangeProofU64`

* use `u64::BITS`

* Update zk-token-sdk/src/zk_token_proof_instruction.rs

Co-authored-by: Tyera <teulberg@gmail.com>

* Apply suggestions from code review

Co-authored-by: Tyera <teulberg@gmail.com>

* fix range proof test

---------

Co-authored-by: Tyera <teulberg@gmail.com>
2023-05-26 15:42:01 +09:00
samkim-crypto f9b0691eb4
[zk-token-sdk] rename and restructure `CloseAccount` and `WithdrawWithheld` proof instructions (#31608)
* rename and restruct ProofInstruction::VerifyCloseAccount to ProofInstruction::VerifyZeroBalance

* rename `PubkeySigmaProof` to `PubkeyValidityProof`

* refactor equality proofs into separate modules

* rename and restructure ProofInstruction::VerifyWithdrawWithheld to ProofInstruction::VerifyCiphertextCiphertextEquality

* add and reorg documentation for the proof instructions

* generalize ciphertext-ciphertext equality proof data constructor

* Update zk-token-sdk/src/instruction/ctxt_ctxt_equality.rs

Co-authored-by: Jon Cinque <joncinque@pm.me>

---------

Co-authored-by: Jon Cinque <joncinque@pm.me>
2023-05-18 08:43:00 +09:00
Ryo Onodera 4d4dddcaea
Update to nightly rustc to 2023-04-19 (#31381)
* Update to nightly rustc to 2023-04-19

* pray...

* Not enough pray..

* skip check...

* hope merciful shellcheck

* ci hack...

* Restore ci/test-checks.sh

* Restore debug_assertions with proper workaround...

* small cleanup

* seems this isn't needed?

* Make the workaround more robust...

* Remove now-resolved clippy exception
2023-05-11 15:48:13 +09:00
samkim-crypto 2d58bb287d
[zk-token-sdk] Add option to create proof context state in the proof verification program (#29996)
* extend verifiable trait

* add PodBool

* implement ZkProofData trait

* add proof context program to zk-token-proof program

* update tests  for close account

* add close account instruction

* reorganize tests

* complete tests

* clean up and add docs

* clean up pod

* add proof program state

* update tests

* move proof program tests as separate module

* clippy

* cargo sort

* cargo fmt

* re-organize visibility

* add context state description

* update maintainer reference

* change `VerifyProofData` and `ProofContextState` to pod

* add tests for mixing proof types

* add tests for self owned context state accounts

* cargo fmt

* remove unnecessary scoping and add comments on scopes

* re-organize proof instructions

* clippy

* update zk-token-proof-test to 1.16.0

* upgrade spl-token-2022 to 0.6.1

* reoganize proof type

* cargo lock

* remove ZkProofContext trait
2023-03-16 07:35:20 +09:00
samkim-crypto bc927097ce
[zk-token-sdk] add pubkey proof (#28392)
* add pubkey proof

* add pubkey sigma proof

* add docs for the sigma proof functions

* add pod public key sigma proof

* add public-key validity proof instruction

* add public-key validity proof instruction

* add VerifyPubkeyValidity instruction

* cargo fmt
2022-10-14 20:15:20 +09:00
Michael Vines f3639b76ce Remove some clippy lints 2022-06-22 09:23:22 -07:00
Michael Vines b05c7d91ed Fix derive_partial_eq_without_eq clippy lint 2022-05-22 22:22:21 -07:00
samkim-crypto ba92ba0e06
Zk instructions check length (#24103)
* zk-token-sdk: add a length check before decoding proof instruction

* zk-token-sdk: fix minor spelling

* zk-token-sdk: one-liner for length check

* zk-token-sdk: one-liner fix
2022-04-05 08:40:45 -04:00
samkim-crypto b4100a9b5d
Add additional zkp for fee (#23112)
* zk-token-sdk: add equality proof for fee

* zk-token-sdk: tweak some naming conventions for readability

* zk-token-sdk: add verify withdraw withheld instruction

* zk-token-sdk: add test for withdraw withheld verification

* zk-token-sdk: more renaming of variables for readability

* zk-token-sdk: cargo fmt

* zk-token-sdk: minor

* zk-token-sdk: resolve bpf compilation warnings

* zk-token-sdk: minor update to doc
2022-02-17 12:45:07 -05:00
samkim-crypto a47b76afcc
zk-token-sdk: add verify transfer with fee instruction (#22924) 2022-02-04 08:52:49 -05:00
Michael Vines 31737406da Adapt to changes to native program entrypoint 2022-01-05 08:51:18 -08:00
Michael Vines aba8c2f4af reformat imports 2022-01-05 08:51:18 -08:00
Sam Kim 77e79221a0 remove `UpdateAccountPk` instruction 2022-01-05 08:51:18 -08:00
Michael Vines a8ab615c89 Add inner instruction utility functions 2022-01-05 08:51:18 -08:00
Michael Vines 17cda46531 Merge transfer instructions 2022-01-05 08:51:18 -08:00
Michael Vines d01d425e4b Rename crypto crate to sdk 2022-01-05 08:51:18 -08:00
Michael Vines 7da620f0b4 Merge sdk/ back into crypto/ 2022-01-05 08:51:18 -08:00
Michael Vines ae5d254e73 Move solana-specific parts of crypto/ into sdk/ 2022-01-05 08:51:18 -08:00