Skip to main content

MultisigCommittee

Struct MultisigCommittee 

Source
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    ; threshold

There is also a legacy encoding for this type defined as:

legacy-multisig-committee = (vector legacy-multisig-member)
                            u16     ; threshold

Implementations§

Source§

impl MultisigCommittee

Source

pub fn derive_address(&self) -> Address

Available on crate feature 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

Source

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.

Source

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 threshold greater 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.

Source

pub fn members(&self) -> &[MultisigMember]

The members of the committee

Source

pub fn threshold(&self) -> ThresholdUnit

The total signature weight required to authorize a transaction for the address corresponding to this MultisigCommittee.

Source

pub fn scheme(&self) -> SignatureScheme

Return the flag for this signature scheme

Source

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.

Source

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.
Source§

type Parameters = ()

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
Source§

type Strategy = BoxedStrategy<MultisigCommittee>

The type of Strategy used to generate values of type Self.
Source§

fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
Source§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
Source§

impl Clone for MultisigCommittee

Source§

fn clone(&self) -> MultisigCommittee

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MultisigCommittee

Source§

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

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

impl<'de> Deserialize<'de> for MultisigCommittee

Available on crate feature serde only.
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 Display for MultisigCommittee

Source§

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

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

impl Eq for MultisigCommittee

Source§

impl From<&MultisigCommittee> for Address

Available on crate feature hash only.
Source§

fn from(committee: &MultisigCommittee) -> Self

Converts to this type from the input type.
Source§

impl From<MultisigCommittee> for Address

Available on crate feature hash only.
Source§

fn from(committee: MultisigCommittee) -> Self

Converts to this type from the input type.
Source§

impl Hash for MultisigCommittee

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MultisigCommittee

Source§

fn eq(&self, other: &MultisigCommittee) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for MultisigCommittee

Available on crate feature serde only.
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
Source§

impl StructuralPartialEq for MultisigCommittee

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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>,

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V