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

source

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.

source

pub fn verification_key(&self) -> StmVerificationKeyPoP

Extract the verification key.

source

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.

source

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.

source

pub fn to_bytes(&self) -> [u8; 256]

Convert to bytes

§Layout
  • Stake (u64)
  • Params
  • Secret Key
  • Public key (including PoP)
source

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

source§

fn clone(&self) -> StmInitializer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StmInitializer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for StmInitializer

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for StmInitializer

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,