samkim-crypto
697a69cbe8
Add syscall tests for curve25519 ( #25634 )
...
* add curve25519 syscall tests
* add curve25519 syscall feature set description
* fmt
* rename curve25519 group syscall
* update point to scalar
* resolve conflict
2022-06-12 10:18:51 +09:00
Alessandro Decina
2c8a3f39a6
Consolidate syscalls under solana_program::syscalls, implement static syscalls (sbfv2) ( #24188 )
...
Move all syscall declarations under solana_program::syscalls. If the target
supports static syscalls (sbfv2), then actually define them statically to avoid
dynamic relocations.
2022-05-26 23:01:55 +10:00
samkim-crypto
d33cb2fa54
zk-token-sdk: implement convert traits for elgamal ciphertexts and ristretto points ( #25549 )
2022-05-26 05:46:29 +09:00
Michael Vines
b05c7d91ed
Fix derive_partial_eq_without_eq clippy lint
2022-05-22 22:22:21 -07:00
Alessandro Decina
9bf07ee206
More target_arch = "bpf" => target_os = "solana"
...
Continuing the work started in https://github.com/solana-labs/solana/pull/25358
2022-05-20 16:57:18 +10: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
aba6a89517
Curve25519 syscall group ops ( #25071 )
...
* zk-token-sdk: implement group ops trait for curve25519
* zk-token-sdk: extend syscall trait implementation for group ops for ristretto
* zk-token-sdk: register curve25519 group ops to bpf loader
* zk-token-sdk: update curve25519_syscall_enabled address
2022-05-08 11:28:07 +09:00
samkim-crypto
d9deab4d2c
Curve25519 point validation syscall ( #23771 )
...
* zk-token-sdk: add curve25519 basic ops
* zk-token-sdk: add bpf operations for curve25519 ops
* zk-token-sdk: rebase
* zk-token-sdk: add tests for curve25519 opertions
* zk-token-sdk: rustfmt
* zk-token-sdk: organize syscalls by trait
* zk-token-sdk: organize syscalls by trait
* zk-token-sdk: cleaning up
* zk-token-sdk: rename mods
* zk-token-sdk: cargo fmt
* zk-token-sdk: fix tests for edwards and ristretto
* zk-token-sdk: add Syscall object for curve point validation
* zk-token-sdk: docs for curve syscall traits
* zk-token-sdk: fix errors from rebase
* zk-token-sdk: update Vec to slice
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* zk-token-sdk: use enum with num-derive for curve ids
* zk-token-sdk: update vec to slice
* zk-token-sdk: make curve25519 tests be deterministic
* zk-token-sdk: rebase
* token-2022: re-organizing curve point validation
* token-2022: cargo fmt
* zk-token-sdk: minor
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
2022-05-07 16:20:53 +09:00
dependabot[bot]
b101e00ffa
chore: bump bytemuck from 1.8.0 to 1.9.1 ( #24604 )
...
* chore: bump bytemuck from 1.8.0 to 1.9.1
Bumps [bytemuck](https://github.com/Lokathor/bytemuck ) from 1.8.0 to 1.9.1.
- [Release notes](https://github.com/Lokathor/bytemuck/releases )
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md )
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.8.0...v1.9.1 )
---
updated-dependencies:
- dependency-name: bytemuck
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* [auto-commit] Update all Cargo lock files
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-04-22 20:50:47 -06:00
samkim-crypto
b22abbce7d
Additional tests for proof verification when ElGamal pubkey is zeroed ( #24243 )
...
* zk-token-sdk: add edge case tests for withdraw withheld proof
* zk-token-sdk: add test cases for proof verification when pubkeys are invalid
2022-04-11 17:53:31 +01: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
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
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
Will Hickey
c4ecfa5716
Bump version to v1.11 ( #23807 )
...
* Revert crossbeam_epoch to stable. 0.9.8 only works with nightly
* Remove unneeded unit expression
2022-03-21 17:40:50 -05:00
samkim-crypto
10eeafd3d6
zk-token-sdk: handle edge cases for transfer with fee ( #23804 )
...
* zk-token-sdk: handle edge cases for transfer with fee
* zk-token-sdk: clippy
* zk-token-sdk: clippy
* zk-token-sdk: cargo fmt
2022-03-21 16:10:33 -04:00
Will Hickey
2f58c9e501
Bump version to 1.10.4 ( #23743 )
2022-03-17 14:02:13 -05:00
Will Hickey
63bf0f66af
Bump version to 1.10.3 ( #23648 )
2022-03-14 11:18:45 -05:00
samkim-crypto
4e02ec342c
zk-token-sdk: fixing a range proof edge case ( #23605 )
...
* zk-token-sdk: fixing a range proof edge case
* zk-token-sdk: clippy
2022-03-11 16:57:56 -05:00
Brooks Prumo
d20dd21600
Sort tables in Cargo.toml files ( #23602 )
2022-03-11 11:05:57 -06:00
Will Hickey
b444836a97
Bump version to 1.10.2 ( #23597 )
2022-03-10 16:41:06 -06:00
dependabot[bot]
12337d8daf
chore: bump curve25519-dalek from 3.2.0 to 3.2.1 ( #23517 )
...
Bumps [curve25519-dalek](https://github.com/dalek-cryptography/curve25519-dalek ) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/dalek-cryptography/curve25519-dalek/releases )
- [Changelog](https://github.com/dalek-cryptography/curve25519-dalek/blob/main/CHANGELOG.md )
- [Commits](https://github.com/dalek-cryptography/curve25519-dalek/compare/3.2.0...3.2.1 )
---
updated-dependencies:
- dependency-name: curve25519-dalek
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-08 01:14:37 -07:00
samkim-crypto
08c9a650db
zk-token-sdk: generalize range proof ( #23506 )
...
* zk-token-sdk: update range proof in transfers for more flexible setting of params
* zk-token-sdk: clippy
2022-03-07 12:27:56 -05: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
8d53ea81e9
zk-token-sdk: change variable names to use suffix rather than prefix ( #23474 )
...
* zk-token-sdk: change variable names to use suffix rather than prefix for type
* zk-token-sdk: cargo fmt
2022-03-03 15:07:27 -05:00
Will Hickey
1a99251498
Bump version to 1.10.1 ( #23453 )
2022-03-02 13:47:01 -06:00
dependabot[bot]
da00d29de0
chore: bump bytemuck from 1.7.3 to 1.8.0 ( #23437 )
...
* chore: bump bytemuck from 1.7.3 to 1.8.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck ) from 1.7.3 to 1.8.0.
- [Release notes](https://github.com/Lokathor/bytemuck/releases )
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md )
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.7.3...v1.8.0 )
---
updated-dependencies:
- dependency-name: bytemuck
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* [auto-commit] Update all Cargo lock files
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-03-02 19:04:54 +00:00
dependabot[bot]
911c5a8362
chore: bump cipher from 0.3.0 to 0.4.3 ( #23362 )
...
* chore: bump cipher from 0.3.0 to 0.4.3
Bumps [cipher](https://github.com/RustCrypto/traits ) from 0.3.0 to 0.4.3.
- [Release notes](https://github.com/RustCrypto/traits/releases )
- [Commits](https://github.com/RustCrypto/traits/compare/cipher-v0.3.0...cipher-v0.4.3 )
---
updated-dependencies:
- dependency-name: cipher
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update Cargo.lock files
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2022-02-28 11:06:18 -07:00
Michael Vines
3ea9ca35fa
grant public access to ProofError enum
2022-02-23 14:22:42 -08:00
Michael Vines
6872fc79ba
Derive Clone for AeCiphertext ( #23293 )
2022-02-22 22:47:26 -08:00
buffalu
70ebab2c82
Add rustfmt.toml and `cargo fmt` ( #23238 )
...
* fmt
* formatted
Co-authored-by: Lucas B <buffalu@jito.network>
2022-02-19 13:32:29 +08: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
7873175764
zk-token-sdk: fix pod for zk-token transfer ( #22957 )
2022-02-08 12:09:50 -05:00
samkim-crypto
a47b76afcc
zk-token-sdk: add verify transfer with fee instruction ( #22924 )
2022-02-04 08:52:49 -05: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
5cef4c0a4c
Sigma pass ( #22801 )
...
* zk-token-sdk: add zeroize and reference arithmetic to zero-balance proof
* zk-token-sdk: add zeroize and reference arithmetic to equality proof
* zk-token-sdk: add zeroize and reference arithmetic to validity proof
* zk-token-sdk: add aggregated validity proof
* zk-token-sdk: use subtle choice for fee
* zk-token-sdk: add test for fee proof
* zk-token-sdk: add documentation for sigma protocols
* zk-token-sdk: add edge case tests for equality proof
* zk-token-sdk: add edge case tests for zero-balance proof
* zk-token-sdk: add edge case tests for validity proof
* zk-token-sdk: add some docs for fee sigma proof
* zk-token-sdk: clippy
2022-01-27 19:53:15 -05:00
dependabot[bot]
66b44b48a4
chore: remove time dep ( #22665 )
...
* chore: bump time from 0.3.5 to 0.3.6
Bumps [time](https://github.com/time-rs/time ) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/time-rs/time/releases )
- [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md )
- [Commits](https://github.com/time-rs/time/compare/v0.3.5...v0.3.6 )
---
updated-dependencies:
- dependency-name: time
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
* Remove separate time dependency
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2022-01-25 16:30:21 -07: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
Tyera Eulberg
7be533a770
Add zeroed default for ElGamalCiphertext ( #22639 )
2022-01-21 19:52:36 +00:00
samkim-crypto
41fb98c771
zk-token_sdk: define defaults for pod ElGamal/AES ciphertexts ( #22532 )
2022-01-20 16:27:31 -05:00
dependabot[bot]
0869f644fc
Bump merlin from 2.0.1 to 3.0.0 ( #22331 )
...
* Bump merlin from 2.0.1 to 3.0.0
Bumps [merlin](https://github.com/zkcrypto/merlin ) from 2.0.1 to 3.0.0.
- [Release notes](https://github.com/zkcrypto/merlin/releases )
- [Changelog](https://github.com/zkcrypto/merlin/blob/main/CHANGELOG.md )
- [Commits](https://github.com/zkcrypto/merlin/compare/2.0.1...3.0.0 )
---
updated-dependencies:
- dependency-name: merlin
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* [auto-commit] Update all Cargo lock files
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-01-10 11:18:15 -07:00
Tyera Eulberg
9cb27613c3
Don't accidentally commit farf ( #22349 )
2022-01-06 17:24:33 -07:00
Sam Kim
705084a25b
zk-token-sdk: rustfmt
2022-01-06 11:18:06 -05:00
samkim-crypto
f81f926a0c
zk-token-sdk: fix transfer verification / set up for fee proof ( #22337 )
2022-01-06 11:01:27 -05:00
samkim-crypto
bc654bf865
feat: add error types for each sigma protocol ( #22336 )
2022-01-06 08:10:37 -05:00
Michael Vines
005ca7759e
Remove stray printlns
2022-01-05 16:49:47 -08:00
Michael Vines
69e632a337
Adapt zk-token-{sdk,proof-program} for use in the monorepo
2022-01-05 08:51:18 -08:00
Sam Kim
1a254ec098
feat: use proper constructor syntax for inner product
2022-01-05 08:51:18 -08:00
Sam Kim
5b41d62f8a
feat: fix clippy for new error types
2022-01-05 08:51:18 -08:00
Sam Kim
0944abc0e2
feat: update error types for sdk
2022-01-05 08:51:18 -08:00
Sam Kim
1cbcda71cb
feat: add separate error types for sigma proofs
2022-01-05 08:51:18 -08:00
Sam Kim
7439d2424b
feat: add a separate TranscriptError
2022-01-05 08:51:18 -08:00
Sam Kim
a211fe1cf4
feat: add errors for range proof module
2022-01-05 08:51:18 -08:00
Sam Kim
e1d3883893
feat: clean up range proof constructor
2022-01-05 08:51:18 -08:00
Sam Kim
826c3bee4a
feat: add verification for fee proof
2022-01-05 08:51:18 -08:00
Sam Kim
e561fbc25a
feat: add test for fee proof
2022-01-05 08:51:18 -08:00
Sam Kim
bc7ac42f2a
feat: proof generation for max and equality proof
2022-01-05 08:51:18 -08:00
Sam Kim
601247d958
feat: add zk-proof certifying that a ciphertext encrypts specified max fee value
2022-01-05 08:51:18 -08:00
Michael Vines
beb95c4884
Allow publish
2022-01-05 08:51:18 -08:00
Sam Kim
08ef612361
refactor: add mod.rs for sigma_proofs
2022-01-05 08:51:18 -08:00
Sam Kim
584c63bcc4
refactor: CloseAccount now uses zero-balance-proof
2022-01-05 08:51:18 -08:00
Sam Kim
c26fa1d0e9
refactor: create pod struct for ZeroBalanceProof
2022-01-05 08:51:18 -08:00
Sam Kim
208621e3cf
refactor: create a separate zero-balance-proof for CloseAccount instruction
2022-01-05 08:51:18 -08:00
Sam Kim
c6cd0a5591
refactor: group equality and validity proofs in sigma_proofs module
2022-01-05 08:51:18 -08:00
Michael Vines
e011502875
Update to Rust 2021 edition
2022-01-05 08:51:18 -08:00
Michael Vines
8ee07cd5c6
Update to Solana 1.9.1
2022-01-05 08:51:18 -08:00
Michael Vines
31737406da
Adapt to changes to native program entrypoint
2022-01-05 08:51:18 -08:00
Michael Vines
93860e88d2
Update to Solana 1.9.0
2022-01-05 08:51:18 -08:00
Sam Kim
9a43fbe3b2
clean up authenticated encryption implementation and also rename aes to auth_encryption
2022-01-05 08:51:18 -08:00
Sam Kim
7a568482de
cargo fmt and fix clippy
2022-01-05 08:51:18 -08:00
Sam Kim
30871784e4
incorporate validity proof into transfer proof
2022-01-05 08:51:18 -08:00
Sam Kim
c7bf9958e7
add validity proof serialization and deserialization
2022-01-05 08:51:18 -08:00
Sam Kim
725781eaa7
add validity proof generation and verification
2022-01-05 08:51:18 -08:00
Sam Kim
dcc961ae00
fix clippy for the updated transfer
2022-01-05 08:51:18 -08:00
Sam Kim
ccdbe65c87
cleaning up transfer proof
2022-01-05 08:51:18 -08:00
Sam Kim
30e12aef9a
Update withdraw instruction to use equality proof
2022-01-05 08:51:18 -08:00
Sam Kim
6c329e2431
add equality proof struct
2022-01-05 08:51:18 -08:00
Sam Kim
f0db6020eb
updating close account zk proof
2022-01-05 08:51:18 -08:00
Michael Vines
aba8c2f4af
reformat imports
2022-01-05 08:51:18 -08:00
Michael Vines
c61775664e
Add decrypt helper function
2022-01-05 08:51:18 -08:00
Michael Vines
69fab16e83
ElGamalKeypair::new() now generates valid keypairs
2022-01-05 08:51:18 -08:00
Michael Vines
88ce934bd7
Derive thiserror::Error for ProofError
2022-01-05 08:51:18 -08:00
Michael Vines
2c51288afd
Add Copy to Role
2022-01-05 08:51:18 -08:00
Sam Kim
8d731f1a70
set ciphertext_lo and ciphertext_hi methods to private
2022-01-05 08:51:18 -08:00
Sam Kim
c59e8f7c8d
resolve conflict
2022-01-05 08:51:18 -08:00
Sam Kim
973287ad66
add decryption functionality to transfer data
2022-01-05 08:51:18 -08:00
Michael Vines
15aea0fe47
Avoid runtime discrete log table precomputation
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
Sam Kim
defdf8da72
change AESCiphertext to AesCiphertext
2022-01-05 08:51:18 -08:00
Sam Kim
3721eda23e
serialization for aes
2022-01-05 08:51:18 -08:00
Sam Kim
c7fc430adb
use randomized authenticated encryption for aes
2022-01-05 08:51:18 -08:00
Sam Kim
77e79221a0
remove `UpdateAccountPk` instruction
2022-01-05 08:51:18 -08:00
samkim-crypto
b0e492bc06
Update sdk/src/encryption/aes.rs
...
Co-authored-by: Michael Vines <mvines@gmail.com>
2022-01-05 08:51:18 -08:00
Sam Kim
173d88d514
remove `OptionAESCiphertext`
2022-01-05 08:51:18 -08:00
Sam Kim
22114c523f
update demo program and bpf test for aes ciphertext removal
2022-01-05 08:51:18 -08:00
Sam Kim
88f952075d
remove aes ciphertext from the proof program
2022-01-05 08:51:18 -08:00