Commit Graph

265 Commits

Author SHA1 Message Date
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
Sam Kim c51a51d0ad quick syntactical fixes from pr review
merge
2022-01-05 08:51:18 -08:00
Sam Kim 2359150b9c incorporate aes ciphertext for zk-proof instructions 2022-01-05 08:51:18 -08:00
Sam Kim 6749c45c63 merge 2022-01-05 08:51:18 -08:00
Sam Kim 57103c515b update applying pending balance for aes ciphertext 2022-01-05 08:51:18 -08:00
samkim-crypto 2d225de48c pod for AESCiphertext 2022-01-05 08:51:18 -08:00
samkim-crypto beba0eac55 Some clippy 2022-01-05 08:51:18 -08:00
Sam Kim e0c168ef3f add aes encryption 2022-01-05 08:51:18 -08:00
samkim-crypto 72ade5473a Add blueprint for aes encryption 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
Michael Vines 17f5dd734c Fix BPF build 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
Michael Vines 7aef523a41 sdk/ now builds for wasm32-unknown-unknown 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 a8ab615c89 Add inner instruction utility functions 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 1daf676b37 Update to Solana 1.7.15 2022-01-05 08:51:18 -08:00
Michael Vines 2c1aa715b0 Adjust ElGamal::new() signature 2022-01-05 08:51:18 -08:00
samkim-crypto 2d62e4e6bd update program processor for the single transfer instruction 2022-01-05 08:51:18 -08:00
samkim-crypto 09b8baa4b1 merge 2022-01-05 08:51:18 -08:00
Sam Kim db69128825 Simplify range proof verification syntax for merged transfer 2022-01-05 08:51:18 -08:00
Sam Kim a5d1efc207 Rust fmt and clippy 2022-01-05 08:51:18 -08:00
Sam Kim 25216705b3 Add UpdateAccountPk tests for edge cases 2022-01-05 08:51:18 -08:00
Sam Kim 1af1106b87 Add CloseAccount tests for edge cases 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
Michael Vines 20c6001836 derive Debug for pods for BPF target as well 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 17cda46531 Merge transfer instructions 2022-01-05 08:51:18 -08:00
Michael Vines 42f7c0c7f6 Update tests 2022-01-05 08:51:18 -08:00
Michael Vines 20bce10204 add clippy 2022-01-05 08:51:18 -08:00
Sam Kim 9b73e351aa minor name change 2022-01-05 08:51:18 -08:00
Sam Kim d6a808f41a simplify get_ciphertext methods 2022-01-05 08:51:18 -08:00
Sam Kim 93f2323e52 add ciphertext extraction methods for TransferData 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 94a96670e8 Update lib.rs 2022-01-05 08:51:18 -08:00
Michael Vines 8bb6f0dc6f Rename ElGamalSK to ElGamalSecretKey 2022-01-05 08:51:18 -08:00
Michael Vines 5445e13828 Rename dlog.rs to discrete_log.rs 2022-01-05 08:51:18 -08:00
Michael Vines 23d3b540a1 Avoid explicit curve25519_dalek dependency in demo/ 2022-01-05 08:51:18 -08:00
Sam Kim 1ef3a621a8 add decryption in demo 2022-01-05 08:51:18 -08:00
Sam Kim d20d03cd7f clean up ElGamal decryption 2022-01-05 08:51:18 -08:00
Michael Vines 409b55ad81 add some comments 2022-01-05 08:51:18 -08:00
Michael Vines 667e72144e rename encode.rs to dlog.rs 2022-01-05 08:51:18 -08:00
Michael Vines 2f138ecb96 Fix tests 2022-01-05 08:51:18 -08:00
Michael Vines 48047b55ba clippy 2022-01-05 08:51:18 -08:00
Michael Vines f227504ea7 Add sol_zk_token_elgamal syscall declarations 2022-01-05 08:51:18 -08:00
Michael Vines 78799640ea Rename ElGamalCT to ElGamalCiphertext, ElGamalPK to ElGamalPubkey 2022-01-05 08:51:18 -08:00
Michael Vines f3e7e62813 Refactor sdk/src/pod.rs 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 88b71c0732 Add demo cli 2022-01-05 08:51:18 -08:00
Michael Vines df521bbfc8 Adjust crate names 2022-01-05 08:51:18 -08:00
Michael Vines 03a3a501f3 Groom Cargo.tomls 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