-
Notifications
You must be signed in to change notification settings - Fork 0
Verify perf #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Verify perf #4
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
55a54dc
WIP
NDobrev 2b95610
Update bls library and optimize the finalization circuit
NDobrev cedb927
Update tests
NDobrev a138c4a
Minor refactoring
NDobrev f2eacf3
Add project for encrypted shares
NDobrev a86c8a3
Add pre-commit hook
NDobrev 957e814
Fix review comments
NDobrev 3ae6025
Little refactoring
NDobrev 148e4bd
WIP: bad partial share prove
NDobrev 2094b65
Finish bad partial key prover
NDobrev 08a00cc
Improve test runner UX
NDobrev c0c0e87
Add test scenarios for bad partial key prover
NDobrev 41ec3aa
Refactoring: improve dvt_abi error handling
NDobrev b5efcb8
Add little interactive tool that shows the dependencies between hashe…
NDobrev aa65f7c
Refactoring: remove code smells and improve code readability
NDobrev e389673
Update tests
NDobrev 6ab0247
Remove dead code
NDobrev f75caa4
WIP-verification for bad encrypted partial key
NDobrev 61167cd
Update bls12_381 patched ref
NDobrev f73680d
Add get_info.rs generation
NDobrev 2657529
Add doc for encrypted share exchange
NDobrev 4d32b09
Fix tests
NDobrev d35ccc1
Update circuits to match latest spec
NDobrev 243100c
Update test cases
NDobrev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| fn main() { | ||
| sp1_build::build_program("crates/share_exchange_prove"); | ||
| sp1_build::build_program("crates/finalization_prove"); | ||
| sp1_build::build_program("crates/wrong_final_key_generation_prove"); | ||
| sp1_build::build_program("crates/bad_encrypted_share_prove"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [package] | ||
| name = "bad_encrypted_share_prove" | ||
| version = "1.1.0" | ||
| edition = "2021" | ||
| publish = false | ||
|
|
||
| [dependencies] | ||
| sp1-zkvm = "3.4.0" | ||
| ff = "0.13.0" | ||
| rand = "0.8.5" | ||
| group = "0.13.0" | ||
| serde = "1.0.216" | ||
| dvt_abi = { path = "../dvt_abi" } | ||
| bls_utils = { path = "../bls_utils" } | ||
| hex = "0.4" | ||
| chacha20 = "0.9.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #![no_main] | ||
|
|
||
| sp1_zkvm::entrypoint!(main); | ||
|
|
||
| use core::panic; | ||
|
|
||
| use bls_utils::{self}; | ||
|
|
||
| use chacha20::cipher::{KeyIvInit, StreamCipher, StreamCipherSeek}; | ||
| use chacha20::ChaCha20; | ||
|
|
||
| pub fn main() { | ||
| let data = bls_utils::read_wrong_final_key_generation_data(); | ||
| print!("{:?}", data); | ||
|
|
||
| let ok = bls_utils::prove_wrong_final_key_generation(&data); | ||
| if ok.is_err() { | ||
| panic!("{:?}", ok.unwrap_err().to_string()); | ||
| } | ||
|
|
||
| let key = [0x42; 32]; | ||
| let nonce = [0x24; 12]; | ||
| let plaintext = hex::decode("000102030405060708090A0B0C0D0E0F").unwrap(); | ||
| let ciphertext = hex::decode("e405626e4f1236b3670ee428332ea20e").unwrap(); | ||
|
|
||
| // Key and IV must be references to the `GenericArray` type. | ||
| // Here we use the `Into` trait to convert arrays into it. | ||
| let mut cipher = ChaCha20::new(&key.into(), &nonce.into()); | ||
|
|
||
| let mut buffer = plaintext.clone(); | ||
|
|
||
| // apply keystream (encrypt) | ||
| cipher.apply_keystream(&mut buffer); | ||
| assert_eq!(buffer, ciphertext); | ||
|
|
||
| let ciphertext = buffer.clone(); | ||
|
|
||
| // ChaCha ciphers support seeking | ||
| cipher.seek(0u32); | ||
|
|
||
| // decrypt ciphertext by applying keystream again | ||
| cipher.apply_keystream(&mut buffer); | ||
| assert_eq!(buffer, plaintext); | ||
|
|
||
| // stream ciphers can be used with streaming messages | ||
| cipher.seek(0u32); | ||
| for chunk in buffer.chunks_mut(3) { | ||
| cipher.apply_keystream(chunk); | ||
| } | ||
| assert_eq!(buffer, ciphertext); | ||
| print!("{:?}", ciphertext); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smanilov marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.