Skip to content

Commit

Permalink
Misc typos / Fix lib exports (#265)
Browse files Browse the repository at this point in the history
* Misc doc fixes

* Fix sunscreen zkp exports

* Fix broken api doc reference
  • Loading branch information
samtay authored Jun 28, 2023
1 parent 8d9af63 commit 036b782
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 19 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/sudoku_zkp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
sunscreen = { path = "../../sunscreen" }
sunscreen_zkp_backend = { path = "../../sunscreen_zkp_backend" }
sunscreen = { path = "../../sunscreen", features = ["bulletproofs"] }

4 changes: 2 additions & 2 deletions examples/sudoku_zkp/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sunscreen::{
types::zkp::NativeField, zkp_program, BackendField, Compiler, Runtime, ZkpProgramInput,
types::zkp::NativeField, zkp_program, BackendField, BulletproofsBackend, Compiler, Runtime,
ZkpBackend, ZkpProgramInput,
};
use sunscreen_zkp_backend::{bulletproofs::BulletproofsBackend, ZkpBackend};

type BPField = NativeField<<BulletproofsBackend as ZkpBackend>::Field>;

Expand Down
2 changes: 1 addition & 1 deletion sunscreen/src/fhe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub type FheFrontendCompilation = CompilationResult<FheOperation>;

thread_local! {
/**
* Contains the graph of a ZKP program during compilation. An
* Contains the graph of an FHE program during compilation. An
* implementation detail and not for public consumption.
*/
pub static CURRENT_FHE_CTX: RefCell<Option<&'static mut FheContext>> = RefCell::new(None);
Expand Down
2 changes: 2 additions & 0 deletions sunscreen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ pub use sunscreen_runtime::{
InnerPlaintext, Params, Plaintext, PrivateKey, PublicKey, RequiredKeys, Runtime, WithContext,
ZkpProgramInput, ZkpRuntime,
};
#[cfg(feature = "bulletproofs")]
pub use sunscreen_zkp_backend::bulletproofs::{BulletproofsBackend, BulletproofsR1CSProof};
pub use sunscreen_zkp_backend::{BackendField, Error as ZkpError, Result as ZkpResult, ZkpBackend};
pub use zkp::ZkpProgramFn;
pub use zkp::{
Expand Down
5 changes: 4 additions & 1 deletion sunscreen_compiler_macros/src/zkp_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ pub fn zkp_program_impl(

fn get_generic_arg(generics: &Generics) -> Result<(Ident, Path)> {
if generics.type_params().count() != 1 {
return Err(Error::compile_error(generics.span(), "ZKP programs must take 1 generic argument with bound sunscreen::BackendField.sunscreen::BackendField"));
return Err(Error::compile_error(
generics.span(),
"ZKP programs must take 1 generic argument with bound sunscreen::BackendField",
));
}

if generics.lifetimes().count() > 0 {
Expand Down
23 changes: 12 additions & 11 deletions sunscreen_runtime/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use sunscreen_fhe_program::{FheProgram, SchemeType};
use crate::{Error, Result};

/**
* Indicates the type signatures of an Fhe Program. Serves as a piece of the [`FheProgramMetadata`].
* Indicates the type signature of an FHE or ZKP program.
*
* # Remarks
* This type is serializable and FHE program implementors can give this object
Expand All @@ -18,28 +18,29 @@ use crate::{Error, Result};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CallSignature {
/**
* The type of each argument in the FHE program.
* The type of each argument in the program.
*
* # Remarks
* The ith argument to the FHE program occupies the ith argument of the vector.
* The length of this vector equals the number of arguments to the FHE program.
* The ith argument to the program occupies the ith element of the vector.
* The length of this vector equals the number of arguments to the program.
*/
pub arguments: Vec<Type>,

/**
* The type of the single return value of the FHE program if the return type is
* not a type. If the return type of the FHE program is a tuple, then this contains
* The type of the single return value of the program if the return type is
* not a tuple. If the return type of the program is a tuple, then this contains
* each type in the tuple.
*
* # Remarks
* The ith argument to the FHE program occupies the ith argument of the vector.
* The length of this vector equals the number of arguments to the FHE program.
*/
pub returns: Vec<Type>,

/**
* The number of ciphertexts that compose the nth return value.
* The number of ciphertexts that compose the corresponding return value.
*
* # Remarks
* The number of ciphertexts composing the ith return value of the program occupies the ith
* element of the vector. The length of this vector equals the length of the returns.
*/
// TODO This field is specific to FHE; should we segment the types here? CallSignature<Fhe|Zkp> ?
pub num_ciphertexts: Vec<usize>,
}

Expand Down
2 changes: 1 addition & 1 deletion sunscreen_zkp_backend/src/bulletproofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl Neg for Node {
/**
* A Bulletproofs R1CS circuit.
*/
pub struct BulletproofsCircuit {
struct BulletproofsCircuit {
nodes: Vec<Option<Node>>,
}

Expand Down

0 comments on commit 036b782

Please sign in to comment.