Struct CommittedTransaction

Source
pub struct CommittedTransaction { /* private fields */ }
Expand description

Information about a particular transaction in the blockchain.

§JSON presentation

NameEquivalent typeDescription
messageVerified<AnyTx>Transaction as recorded in the blockchain
locationTxLocationLocation of the transaction in the block
location_proofListProof<Hash>Proof of transaction inclusion into a block
status(custom; see below)Execution status
timeDateTime<Utc>Commitment time*

* By commitment time we mean an approximate commitment time of the block which includes the transaction. This time is a median time of the precommit local times of each validator.

§status field

The status field is a more readable representation of the ExecutionStatus type.

For successfully executed transactions, status is equal to

{ "type": "success" }

For transactions that cause an ExecutionError, status contains the error code and an optional description, i.e., has the following type in the TypeScript notation:

type Error = {
  type: 'service_error' | 'core_error' | 'common_error' | 'runtime_error' | 'unexpected_error',
  code?: number,
  description?: string,
  runtime_id: number,
  call_site?: CallSite,
};

type CallSite = MethodCallSite | HookCallSite;

type MethodCallSite = {
  call_type: 'method',
  instance_id: number,
  interface?: string,
  method_id: number,
};

type HookCallSite = {
  call_type: 'constructor' | 'before_transactions' | 'after_transactions',
  instance_id: number,
};

Explanations:

  • Error.type determines the component responsible for the error. Usually, errors are generated by the service code, but they can also be caused by the dispatch logic, runtime associated with the service, or come from another source (unexpected_errors).
  • Error.code is the error code. For service errors, this code is specific to the service instance (which can be obtained from call_site), and for runtime errors - to the runtime. For core errors, the codes are fixed; their meaning can be found in the CoreError docs. The code is present for all error types except unexpected_errors, in which the code is always absent. Besides types listed above, there is also a set of errors that can occur within any context, which are organized in the CommonError.
  • Error.description is an optional human-readable description of the error.
  • Error.runtime_id is the numeric ID of the runtime in which the error has occurred. Note that the runtime is defined for all error types, not just runtime_errors, since for any request it’s possible to say which runtime is responsible for its processing.
  • Error.call_site provides most precise known location of the call in which the error has occurred.

Implementations§

Source§

impl CommittedTransaction

Source

pub fn message(&self) -> &Verified<AnyTx>

Returns the content of the transaction.

Source

pub fn location(&self) -> &TxLocation

Returns the transaction location in block.

Source

pub fn location_proof(&self) -> &ListProof<Hash>

Returns a proof that transaction is recorded in the blockchain.

Source

pub fn status(&self) -> Result<(), &ExecutionError>

Returns the status of the transaction execution.

Source

pub fn time(&self) -> &DateTime<Utc>

Returns an approximate commit time of the block which includes this transaction.

Trait Implementations§

Source§

impl Debug for CommittedTransaction

Source§

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

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

impl<'de> Deserialize<'de> for CommittedTransaction

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 Serialize for CommittedTransaction

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