Struct pbc_contract_common::zk::ZkInputDef
source · #[repr(C)]pub struct ZkInputDef<MetadataT, SecretT: SecretBinary> { /* private fields */ }
Expand description
Contains initialization information about Zk variables. Exclusively needed for the
zk_on_secret_input
hook.
<MetadataT>
is the type of the piece of public information associated with the variable.
Implementations§
source§impl<MetadataT, SecretT: SecretBinary + SecretBinaryFixedSize> ZkInputDef<MetadataT, SecretT>
impl<MetadataT, SecretT: SecretBinary + SecretBinaryFixedSize> ZkInputDef<MetadataT, SecretT>
sourcepub fn with_metadata(
shortname: Option<ShortnameZkVariableInputted>,
metadata: MetadataT
) -> Self
pub fn with_metadata( shortname: Option<ShortnameZkVariableInputted>, metadata: MetadataT ) -> Self
Create new ZkInputDef
with the given metadata, and a fixed size from the secret type ´SecretT`.
This method requires ‘SecretT’ to possess a fixed size. For types that do not
posses a fixed size, for example Vec
ors, use ZkInputDef::with_metadata_and_size
source§impl<MetadataT, SecretT: SecretBinary> ZkInputDef<MetadataT, SecretT>
impl<MetadataT, SecretT: SecretBinary> ZkInputDef<MetadataT, SecretT>
sourcepub fn with_metadata_and_size(
shortname: Option<ShortnameZkVariableInputted>,
metadata: MetadataT,
secret_size: u32
) -> Self
pub fn with_metadata_and_size( shortname: Option<ShortnameZkVariableInputted>, metadata: MetadataT, secret_size: u32 ) -> Self
Create new ZkInputDef
with the given metadata and size.
secret_size
specifies the size of the secret variable in bits.
Prefer ZkInputDef::with_metadata
when your type has a fixed size, as it is much easier
to use. Only use this method when using dynamically sized data, like Vec
tors.
This method requires you to know precisely how much data to secret-share,
and providing the wrong secret_size
could prevent usage.