pub struct StmInitializer {
pub stake: Stake,
pub params: StmParameters,
/* private fields */
}
Expand description
Initializer for StmSigner
.
This is the data that is used during the key registration procedure.
Once the latter is finished, this instance is consumed into an StmSigner
.
Fields§
§stake: Stake
This participant’s stake.
params: StmParameters
Current protocol instantiation parameters.
Implementations§
source§impl StmInitializer
impl StmInitializer
sourcepub fn setup<R: RngCore + CryptoRng>(
params: StmParameters,
stake: Stake,
rng: &mut R,
) -> Self
pub fn setup<R: RngCore + CryptoRng>( params: StmParameters, stake: Stake, rng: &mut R, ) -> Self
Builds an StmInitializer
that is ready to register with the key registration service.
This function generates the signing and verification key with a PoP, and initialises the structure.
sourcepub fn verification_key(&self) -> StmVerificationKeyPoP
pub fn verification_key(&self) -> StmVerificationKeyPoP
Extract the verification key.
sourcepub fn new_signer<D: Digest + Clone>(
self,
closed_reg: ClosedKeyReg<D>,
) -> Result<StmSigner<D>, RegisterError>
pub fn new_signer<D: Digest + Clone>( self, closed_reg: ClosedKeyReg<D>, ) -> Result<StmSigner<D>, RegisterError>
Build the avk
for the given list of parties.
Note that if this StmInitializer was modified between the last call to register
,
then the resulting StmSigner
may not be able to produce valid signatures.
Returns an StmSigner
specialized to
- this
StmSigner
’s ID and current stake - this
StmSigner
’s parameter valuation - the
avk
as built from the current registered parties (according to the registration service) - the current total stake (according to the registration service)
§Error
This function fails if the initializer is not registered.
sourcepub fn new_core_signer<D: Digest + Clone>(
self,
eligible_parties: &[RegParty],
) -> Option<StmSigner<D>>
pub fn new_core_signer<D: Digest + Clone>( self, eligible_parties: &[RegParty], ) -> Option<StmSigner<D>>
Creates a new core signer that does not include closed registration.
Takes eligible_parties
as a parameter and determines the signer’s index in the parties.
eligible_parties
is verified and trusted which is only run by a full-node
that has already verified the parties.
sourcepub fn from_bytes(bytes: &[u8]) -> Result<StmInitializer, RegisterError>
pub fn from_bytes(bytes: &[u8]) -> Result<StmInitializer, RegisterError>
Convert a slice of bytes to an StmInitializer
§Error
The function fails if the given string of bytes is not of required size.
Trait Implementations§
source§impl Clone for StmInitializer
impl Clone for StmInitializer
source§fn clone(&self) -> StmInitializer
fn clone(&self) -> StmInitializer
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for StmInitializer
impl Debug for StmInitializer
source§impl<'de> Deserialize<'de> for StmInitializer
impl<'de> Deserialize<'de> for StmInitializer
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for StmInitializer
impl RefUnwindSafe for StmInitializer
impl Send for StmInitializer
impl Sync for StmInitializer
impl Unpin for StmInitializer
impl UnwindSafe for StmInitializer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)