pub struct BlockVersion(/* private fields */);
Expand description

A block version number that is known to be less or equal to BlockVersion::MAX

Note: BlockVersion::MAX may vary from client to client as we roll out network upgrades. Software should handle errors where the block version of the network is not supported, generally by requesting users to upgrade their software.

If you need to manipulate block versions that come from the network, you should use u32 to represent that.

Then, if you need to e.g. sign a transaction, you should try to convert them to BlockVersion. If that conversion fails, it means that this set of rules is not understood by your version of mc-transaction-core. This means that your build has reached end-of-life, and needs an update.

You should not assume that all block versions you will ever see will be understood by your version of transaction core, otherwise there will be no way for your software to help the user to upgrade when you reach EOL.

For example, BlockVersion::try_from(...).unwrap() is typically a bug if it’s not in test code.

Implementations§

§

impl BlockVersion

pub const MAX: BlockVersion = Self::FOUR

The maximum value of block_version that this build of mc-transaction-core has support for

pub const ZERO: BlockVersion = _

Refers to the block version number at network launch.

pub const ONE: BlockVersion = _

Constant for block version one

pub const TWO: BlockVersion = _

Constant for block version two

pub const THREE: BlockVersion = _

Constant for block version three

pub const FOUR: BlockVersion = _

Constant for block version four

pub fn iterator() -> BlockVersionIterator

Iterator over block versions from one up to max, inclusive. For use in tests.

pub fn e_memo_feature_is_supported(&self) -> bool

The encrypted memos feature is introduced in v1. MCIP #3

pub fn masked_token_id_feature_is_supported(&self) -> bool

The confidential token ids feature is introduced in v2. MCIP #25

pub fn validate_transaction_outputs_are_sorted(&self) -> bool

Transactions must be sorted from v3 onward. MCIP #34

pub fn mint_transactions_are_supported(&self) -> bool

Mint transactions are introduced in v2. MCIP #37

pub fn minting_to_fog_addresses_is_supported(&self) -> bool

Minting_to_fog_addresses is supported in v3 MCIP #53

pub fn mlsags_sign_extended_message_digest(&self) -> bool

The extended message digest is used when signing MLSAGs in v2 and higher. This is described in MCIP #25.

pub fn mixed_transactions_are_supported(&self) -> bool

Mixed transactions are introduced in v3 MCIP #31

pub fn signed_input_rules_are_supported(&self) -> bool

Signed input rules are introduced in v3. MCIP #31

pub fn masked_amount_v2_is_supported(&self) -> bool

Masked amount V2 derivation introduced with block version 3. MCIP #42

pub fn require_block_metadata(&self) -> bool

BlockData.metadata is required starting from v3. MCIP #43

pub fn mlsags_sign_extended_message_and_tx_summary_digest(&self) -> bool

MLSAGs sign extended-message-and-tx-summary digest starting from v3. MCIP #52

pub fn nested_multisigs_are_supported(&self) -> bool

Nested multisigs are supporoted starting from v3. [MCIP #TODO]

Methods from Deref<Target = u32>§

1.43.0 · source

pub const MIN: u32 = 0u32

1.43.0 · source

pub const MAX: u32 = 4_294_967_295u32

1.53.0 · source

pub const BITS: u32 = 32u32

Trait Implementations§

§

impl Clone for BlockVersion

§

fn clone(&self) -> BlockVersion

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
§

impl Debug for BlockVersion

§

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

Formats the value using the given formatter. Read more
§

impl Default for BlockVersion

§

fn default() -> BlockVersion

Returns the “default value” for a type. Read more
§

impl Deref for BlockVersion

§

type Target = u32

The resulting type after dereferencing.
§

fn deref(&self) -> &<BlockVersion as Deref>::Target

Dereferences the value.
§

impl<'de> Deserialize<'de> for BlockVersion

§

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

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

impl Digestible for BlockVersion

§

fn append_to_transcript<DT>(&self, context: &'static [u8], transcript: &mut DT)where DT: DigestTranscript,

Add the data from self to the transcript Context should be a string-literal
§

fn digest32<DT>(&self, context: &'static [u8]) -> [u8; 32]where DT: DigestTranscript,

Simply get a 32-byte hash using a one-off digest transcript. Read more
§

fn append_to_transcript_allow_omit<DT>( &self, context: &'static [u8], transcript: &mut DT )where DT: DigestTranscript,

To support schema evolution, in some contexts the generated code for a Digestible implementation of a compound type should append its children to the transcript, but allow them to skip themselves if they are empty. For members of a struct, this is allowed, because they don’t have a fixed set of members but for a variant it isn’t allowed, because the value cannot be omitted. Read more
§

impl Display for BlockVersion

§

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

Formats the value using the given formatter. Read more
§

impl FromStr for BlockVersion

§

type Err = BlockVersionError

The associated error which can be returned from parsing.
§

fn from_str(src: &str) -> Result<BlockVersion, <BlockVersion as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for BlockVersion

§

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

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
§

impl Ord for BlockVersion

§

fn cmp(&self, other: &BlockVersion) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
§

impl PartialEq<BlockVersion> for BlockVersion

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd<BlockVersion> for BlockVersion

§

fn partial_cmp(&self, other: &BlockVersion) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl Serialize for BlockVersion

§

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

Serialize this value into the given Serde serializer. Read more
§

impl TryFrom<u32> for BlockVersion

§

type Error = BlockVersionError

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

fn try_from( src: u32 ) -> Result<BlockVersion, <BlockVersion as TryFrom<u32>>::Error>

Performs the conversion.
§

impl Copy for BlockVersion

§

impl Eq for BlockVersion

§

impl StructuralEq for BlockVersion

§

impl StructuralPartialEq for BlockVersion

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

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

source§

default fn to_string(&self) -> String

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

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

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