pub struct MultisigCommittee { /* private fields */ }Expand description
A multisig committee
A MultisigCommittee is a set of members who collectively control a single
Address on the IOTA blockchain. The number of required signatures to
authorize the execution of a transaction is determined by
(signature_0_weight + signature_1_weight ..) >= threshold.
§BCS
The BCS serialized form for this type is defined by the following ABNF:
multisig-committee = (vector multisig-member)
u16 ; thresholdThere is also a legacy encoding for this type defined as:
legacy-multisig-committee = (vector legacy-multisig-member)
u16 ; thresholdImplementations§
Source§impl MultisigCommittee
impl MultisigCommittee
Sourcepub fn derive_address(&self) -> Address
Available on crate feature hash only.
pub fn derive_address(&self) -> Address
hash only.Derive an Address from this MultisigCommittee.
A MultiSig address is defined as the 32-byte Blake2b hash of serializing
the SignatureScheme flag (0x03), the threshold (in little endian), and
the concatenation of all n flags, public keys and their weights, where
flag_i? is the member’s SignatureScheme flag — omitted for Ed25519
keys, matching their plain address derivation.
hash(0x03 || threshold || flag_1? || pk_1 || weight_1 || ... || flag_n? || pk_n || weight_n).
Source§impl MultisigCommittee
impl MultisigCommittee
Sourcepub fn new_unchecked(
members: Vec<MultisigMember>,
threshold: ThresholdUnit,
) -> Self
pub fn new_unchecked( members: Vec<MultisigMember>, threshold: ThresholdUnit, ) -> Self
Construct a MultisigCommittee without validating the result.
Unlike Self::new, this performs no checks: the committee may
violate any of the invariants enforced by Self::validate (zero
threshold, empty or oversized member list, zero-weight members,
duplicate public keys, or a threshold exceeding the sum of weights).
Note that the order of the members is significant towards deriving the
Address governed by this committee.
Prefer Self::new; this constructor is intended for deserialization
paths and tests where the inputs are already known to be well-formed.
Sourcepub fn new(
members: Vec<MultisigMember>,
threshold: ThresholdUnit,
) -> Result<Self, MultisigError>
pub fn new( members: Vec<MultisigMember>, threshold: ThresholdUnit, ) -> Result<Self, MultisigError>
Construct a MultisigCommittee and verify it via Self::validate.
Compared to Self::new_unchecked, this rejects committees that:
- have a zero
threshold; - contain zero or more than ten members;
- contain a member with weight 0;
- have a
thresholdgreater than the sum of all member weights; - contain duplicate public keys.
Note that the order of the members is significant towards deriving the
Address governed by this committee.
Sourcepub fn members(&self) -> &[MultisigMember]
pub fn members(&self) -> &[MultisigMember]
The members of the committee
Sourcepub fn threshold(&self) -> ThresholdUnit
pub fn threshold(&self) -> ThresholdUnit
The total signature weight required to authorize a transaction for the
address corresponding to this MultisigCommittee.
Sourcepub fn scheme(&self) -> SignatureScheme
pub fn scheme(&self) -> SignatureScheme
Return the flag for this signature scheme
Sourcepub fn get_public_key_index(&self, public_key: &PublicKey) -> Option<u8>
pub fn get_public_key_index(&self, public_key: &PublicKey) -> Option<u8>
Get the index of a public key in the committee, if it is a member.
Sourcepub fn validate(&self) -> Result<(), MultisigError>
pub fn validate(&self) -> Result<(), MultisigError>
Checks if the Committee is valid.
A valid committee is one that:
- Has a nonzero threshold
- Has at least one member
- Has at most ten members
- No member has weight 0
- the sum of the weights of all members must be at least the threshold
- contains no duplicate members
Trait Implementations§
Source§impl Arbitrary for MultisigCommittee
Available on crate feature proptest only.
impl Arbitrary for MultisigCommittee
proptest only.Source§type Parameters = ()
type Parameters = ()
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = BoxedStrategy<MultisigCommittee>
type Strategy = BoxedStrategy<MultisigCommittee>
Strategy used to generate values of type Self.Source§fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
Source§impl Clone for MultisigCommittee
impl Clone for MultisigCommittee
Source§fn clone(&self) -> MultisigCommittee
fn clone(&self) -> MultisigCommittee
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MultisigCommittee
impl Debug for MultisigCommittee
Source§impl<'de> Deserialize<'de> for MultisigCommittee
Available on crate feature serde only.
impl<'de> Deserialize<'de> for MultisigCommittee
serde only.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>,
Source§impl Display for MultisigCommittee
impl Display for MultisigCommittee
impl Eq for MultisigCommittee
Source§impl From<&MultisigCommittee> for Address
Available on crate feature hash only.
impl From<&MultisigCommittee> for Address
hash only.Source§fn from(committee: &MultisigCommittee) -> Self
fn from(committee: &MultisigCommittee) -> Self
Source§impl From<MultisigCommittee> for Address
Available on crate feature hash only.
impl From<MultisigCommittee> for Address
hash only.Source§fn from(committee: MultisigCommittee) -> Self
fn from(committee: MultisigCommittee) -> Self
Source§impl Hash for MultisigCommittee
impl Hash for MultisigCommittee
Source§impl PartialEq for MultisigCommittee
impl PartialEq for MultisigCommittee
Source§impl Serialize for MultisigCommittee
Available on crate feature serde only.
impl Serialize for MultisigCommittee
serde only.