-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inputs are global to a SyncComputeRequest. Additionally, introduce a `FHE_GET_INPUT_CIPHERTEXT` FHE operation that allows for a client to get an input ciphertext (that is not part of FHE computation). Would be used by the `verifyCiphertext` function in fhEVM-native. Change ciphertext version to 0. Add an integration test for gettting an input ciphertext. Introduce ciphertext compression - all ciphertexts coming in and going out of `SyncComputeRequest` will be compressed.
- Loading branch information
1 parent
fa449d9
commit 127271b
Showing
12 changed files
with
388 additions
and
107 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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,12 +1,47 @@ | ||
use executor::server::executor::{fhevm_executor_client::FhevmExecutorClient, SyncComputeRequest}; | ||
use utils::TestInstance; | ||
use executor::server::common::FheOperation; | ||
use executor::server::executor::sync_compute_response::Resp; | ||
use executor::server::executor::{ | ||
fhevm_executor_client::FhevmExecutorClient, SyncComputation, SyncComputeRequest, | ||
}; | ||
use executor::server::executor::{sync_input::Input, SyncInput}; | ||
use tfhe::CompactCiphertextListBuilder; | ||
use utils::get_test; | ||
|
||
mod utils; | ||
|
||
#[tokio::test] | ||
async fn compute_on_ciphertexts() -> Result<(), Box<dyn std::error::Error>> { | ||
let test_instance = TestInstance::new(); | ||
let mut client = FhevmExecutorClient::connect(test_instance.server_addr).await?; | ||
let resp = client.sync_compute(SyncComputeRequest::default()).await?; | ||
async fn get_input_ciphertexts() -> Result<(), Box<dyn std::error::Error>> { | ||
let test = get_test().await; | ||
let mut client = FhevmExecutorClient::connect(test.server_addr.clone()).await?; | ||
let mut builder = CompactCiphertextListBuilder::new(&test.keys.compact_public_key); | ||
let list = bincode::serialize(&builder.push(10_u8).build()).unwrap(); | ||
let input_handle = test.input_handle(&list, 0, 2); | ||
let sync_input = SyncInput { | ||
input: Some(Input::InputHandle(input_handle.to_vec())), | ||
}; | ||
let computation = SyncComputation { | ||
operation: FheOperation::FheGetInputCiphertext.into(), | ||
result_handles: vec![vec![0xaa]], | ||
inputs: vec![sync_input], | ||
}; | ||
let req = SyncComputeRequest { | ||
computations: vec![computation], | ||
input_lists: vec![list], | ||
}; | ||
let response = client.sync_compute(req).await?; | ||
let sync_compute_response = response.get_ref(); | ||
match &sync_compute_response.resp { | ||
Some(Resp::ResultCiphertexts(cts)) => { | ||
match (cts.ciphertexts.first(), cts.ciphertexts.len()) { | ||
(Some(ct), 1) => { | ||
if ct.handle != input_handle || ct.ciphertext.is_empty() { | ||
assert!(false); | ||
} | ||
} | ||
_ => assert!(false), | ||
} | ||
} | ||
_ => assert!(false), | ||
} | ||
Ok(()) | ||
} |
This file contains 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.