pub type SecureShareOperation = SecureShare<Operation, OperationId>;
Expand description

signed operation

Aliased Type§

struct SecureShareOperation {
    pub content: Operation,
    pub serialized_data: Vec<u8, Global>,
    pub signature: Signature,
    pub content_creator_pub_key: PublicKey,
    pub content_creator_address: Address,
    pub id: OperationId,
}

Fields§

§content: Operation

Reference contents. Not required for the the security protocols.

Use the Lightweight equivilant structures when you need verifiable serialized data, but do not need to read the values directly (such as when sending)

§serialized_data: Vec<u8, Global>

Content in sharable, deserializable form. Is used in the secure verification protocols.

§signature: Signature

A cryptographically generated value using serialized_data and a public key.

§content_creator_pub_key: PublicKey

The public-key component used in the generation of the signature

§content_creator_address: Address

Derived from the same public key used to generate the signature

§id: OperationId

A secure hash of the data. See also massa_hash::Hash

Implementations§

source§

impl SecureShareOperation

source

pub fn get_validity_range( &self, operation_validity_period: u64 ) -> RangeInclusive<u64>

get the range of periods during which an operation is valid Range: (op.expire_period - cfg.operation_validity_period) -> op.expire_period (included)

source

pub fn get_gas_usage( &self, base_operation_gas_cost: u64, sp_compilation_cost: u64 ) -> u64

Get the maximum amount of gas used by the operation.

base_operation_gas_cost comes from the configuration and is the cost of a basic operation (BASE_OPERATION_GAS_COST)

source

pub fn get_ledger_involved_addresses(&self) -> PreHashSet<Address>

get the addresses that are involved in this operation from a ledger point of view

source

pub fn get_max_spending(&self, roll_price: Amount) -> Amount

Gets the maximal amount of coins that may be spent by this operation (incl. fee)

source

pub fn get_roll_involved_addresses( &self ) -> Result<PreHashSet<Address>, ModelsError>

get the addresses that are involved in this operation from a rolls point of view

source§

impl<T, ID> SecureShare<T, ID>where T: Display + SecureShareContent, ID: Id,

source

pub fn sign( keypair: &KeyPair, content_hash: &Hash, _content: &T ) -> Result<Signature, ModelsError>

Sign the SecureShare given the content

source

pub fn verify_signature(&self) -> Result<(), ModelsError>

check if self has been signed by public key

source

pub fn compute_signed_hash(&self) -> Hash

Compute the signed hash

source

pub fn serialized_size(&self) -> usize

get full serialized size

Trait Implementations§

source§

impl<T, ID> Clone for SecureShare<T, ID>where T: Display + SecureShareContent + Clone, ID: Id + Clone,

source§

fn clone(&self) -> SecureShare<T, ID>

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<T, ID> Debug for SecureShare<T, ID>where T: Display + SecureShareContent + Debug, ID: Id + Debug,

source§

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

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

impl<'de, T, ID> Deserialize<'de> for SecureShare<T, ID>where T: Display + SecureShareContent + Deserialize<'de>, ID: Id + Deserialize<'de>,

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<T, ID> Display for SecureShare<T, ID>where T: Display + SecureShareContent, ID: Id,

source§

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

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

impl<T, ID> PartialEq<SecureShare<T, ID>> for SecureShare<T, ID>where T: Display + SecureShareContent + PartialEq, ID: Id + PartialEq,

source§

fn eq(&self, other: &SecureShare<T, ID>) -> 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.
source§

impl<T, ID> Serialize for SecureShare<T, ID>where T: Display + SecureShareContent + Serialize, ID: Id + Serialize,

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<T, ID> Eq for SecureShare<T, ID>where T: Display + SecureShareContent + Eq, ID: Id + Eq,

source§

impl<T, ID> StructuralEq for SecureShare<T, ID>where T: Display + SecureShareContent, ID: Id,

source§

impl<T, ID> StructuralPartialEq for SecureShare<T, ID>where T: Display + SecureShareContent, ID: Id,