Skip to main content

assemble_vc_key_package_upload

Function assemble_vc_key_package_upload 

Source
pub fn assemble_vc_key_package_upload<Storage: StorageProvider>(
    storage: &Storage,
    epoch_id: EpochId,
    generation: u32,
    key_package_info: Vec<KeyPackageInfo>,
) -> Result<KeyPackageUpload, VirtualClientsError>
Available on crate feature extensions-draft and crate feature virtual-clients-draft and (32-bit or 64-bit) only.
Expand description

Build a KeyPackageUpload for epoch_id from a batch’s generation and its KeyPackageInfo entries, filling leaf_index from the VcDerivationEpochState stored for that epoch.

The virtual client calls this after building a batch of KeyPackages with KeyPackageBuilder::build_vc_batch to assemble the message it hands to its sibling. generation is the single key_package operation generation the batch consumed.

This describes a completed operation rather than starting a new one, so it takes the epoch explicitly. Pass the epoch_id and generation the batch reports, not a freshly resolved epoch: the emulation group may have moved on to a newer derivation epoch since the batch was built.

Returns VirtualClientsError::MissingDerivationEpochState if no state is registered for epoch_id.