Struct CallProof

Source
#[non_exhaustive]
pub struct CallProof { pub block_proof: BlockProof, pub call_proof: MapProof<CallInBlock, ExecutionError>, pub error_description: Option<String>, }
Expand description

Proof of authenticity for a single top-level call in a block, such as a transaction.

The proof consists of two parts:

  • block_proof: block header with the proof of authenticity
  • call_proof: proof from the error aggregator (i.e., a ProofMapIndex the Merkle root of which is recorded in the block header as error_hash).

For an execution that resulted in an error, call_proof will be a proof of existence. If a transaction was executed successfully, call_proof will be a proof of absence. Since the number of transactions in a block is mentioned in the block header, the user will be able to distinguish absence of error (meaning successful execution) from the absence of a transaction with such an index. Indeed, if the index is less than amount of transactions in block, the proof denotes successful execution; otherwise, the transaction with the given index does not exist in the block.

Similarly, execution errors of the before_transactions / after_transactions hooks can be proven to external clients. Discerning successful execution from a non-existing service requires prior knowledge though.

CallProofs should not be confused with a proof of transaction commitment. To verify that a certain transaction was committed, use a proof from the block_transactions index of the core schema.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§block_proof: BlockProof

Proof of authenticity for the block header.

§call_proof: MapProof<CallInBlock, ExecutionError>

Proof of authenticity for the call status. Must contain a single key corresponding to the CallInBlock in question. The root hash of the proof must be equal to the error_hash mentioned in block_proof.

§error_description: Option<String>

Human-readable description of an error if the call status is erroneous. This description is not authenticated and thus should be used for diagnostic purposes only. If the call is successful, the error description should be None.

Implementations§

Source§

impl CallProof

Source

pub fn verify( &self, validator_keys: &[PublicKey], ) -> Result<(CallInBlock, Result<(), ExecutionError>), ProofError>

Verifies this proof, returning the location of the proven call together with its status.

Note that a successful status is indistinguishable from the point of view of a proof from a non-existing one. It is up to caller to discern between these two possibilities.

Trait Implementations§

Source§

impl BinaryValue for CallProof

Source§

fn to_bytes(&self) -> Vec<u8>

Serializes the given value to the vector of bytes.
Source§

fn from_bytes(value: Cow<'_, [u8]>) -> Result<Self, Error>

Deserializes the value from the given bytes array.
Source§

fn into_bytes(self) -> Vec<u8>

Consumes and serializes the given value to the vector of bytes. This method is faster with the wrapped values, thus if you wouldn’t use value after serialization use it.
Source§

impl Clone for CallProof

Source§

fn clone(&self) -> CallProof

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 CallProof

Source§

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

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

impl<'de> Deserialize<'de> for CallProof

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 ProtobufConvert for CallProof

Source§

type ProtoStruct = CallProof

Type generated from the Protobuf definition.
Source§

fn to_pb(&self) -> Self::ProtoStruct

Performs conversion to the type generated from Protobuf.
Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Performs conversion from the type generated from Protobuf.
Source§

impl Serialize for CallProof

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

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

Source§

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