Struct Call

Source
pub struct Call {
Show 28 fields pub index: u32, pub parent_index: u32, pub depth: u32, pub call_type: i32, pub caller: Vec<u8>, pub address: Vec<u8>, pub address_delegates_to: Option<Vec<u8>>, pub value: Option<BigInt>, pub gas_limit: u64, pub gas_consumed: u64, pub return_data: Vec<u8>, pub input: Vec<u8>, pub executed_code: bool, pub suicide: bool, pub keccak_preimages: HashMap<String, String>, pub storage_changes: Vec<StorageChange>, pub balance_changes: Vec<BalanceChange>, pub nonce_changes: Vec<NonceChange>, pub logs: Vec<Log>, pub code_changes: Vec<CodeChange>, pub gas_changes: Vec<GasChange>, pub status_failed: bool, pub status_reverted: bool, pub failure_reason: String, pub state_reverted: bool, pub begin_ordinal: u64, pub end_ordinal: u64, pub account_creations: Vec<AccountCreation>,
}

Fields§

§index: u32§parent_index: u32§depth: u32§call_type: i32§caller: Vec<u8>§address: Vec<u8>§address_delegates_to: Option<Vec<u8>>

AddressDelegatesTo contains the address from which the actual code to execute will be loaded as defined per EIP-7702 rules. If the Call’s address value resolves to a code that delegates to another address, this field will be populated with the address that the call is delegated to. It will be empty in all other situations.

Assumes that a ‘SetCode’ transaction set address 0xA to delegates to address 0xB, then when a call is made to 0xA, the Call object would have:

  • caller =
  • address = 0xA
  • address_delegates_to = 0xB

Again, it’s important to emphasize that this field relates to EIP-7702, if the call is a DELEGATE or CALLCODE type, this field will not be populated and will remain empty.

It will be populated only if EIP-7702 is active on the chain (Prague fork) and if the ‘address’ of the call was pointing to another address at time of execution.

§value: Option<BigInt>§gas_limit: u64§gas_consumed: u64§return_data: Vec<u8>§input: Vec<u8>

Known Issues

§executed_code: bool

Indicates whether the call executed code.

Known Issues

  • Version 3: This may be incorrectly set to false for accounts with code handling native value transfers, as well as for certain precompiles with no input. The value is initially set based on call.type != CREATE && len(call.input) > 0 and later adjusted if the tracer detects an account without code.

    Fixed in Version 4, see https://docs.substreams.dev/reference-material/chains-and-endpoints/ethereum-data-model for information about block versions.

§suicide: bool§keccak_preimages: HashMap<String, String>

hex representation of the hash -> preimage

§storage_changes: Vec<StorageChange>

Known Issues

§balance_changes: Vec<BalanceChange>§nonce_changes: Vec<NonceChange>§logs: Vec<Log>§code_changes: Vec<CodeChange>§gas_changes: Vec<GasChange>

Known Issues

  • Version 3: Some gas changes are not correctly tracked: 1. Gas refunded due to data returned to the chain (occurs at the end of a transaction, before buyback). 2. Initial gas allocation (0 -> GasLimit) at the start of a call. 3. Final gas deduction (LeftOver -> 0) at the end of a call (if applicable). Fixed in Version 4, see https://docs.substreams.dev/reference-material/chains-and-endpoints/ethereum-data-model for information about block versions.
§status_failed: bool

In Ethereum, a call can be either:

  • Successful, execution passes without any problem encountered
  • Failed, execution failed, and remaining gas should be consumed
  • Reverted, execution failed, but only gas consumed so far is billed, remaining gas is refunded

When a call is either failed or reverted, the status_failed field below is set to true. If the status is reverted, then both status_failed and status_reverted are going to be set to true.

§status_reverted: bool§failure_reason: String

Populated when a call either failed or reverted, so when status_failed == true, see above for details about those flags.

§state_reverted: bool

This field represents whether or not the state changes performed by this call were correctly recorded by the blockchain.

On Ethereum, a transaction can record state changes even if some of its inner nested calls failed. This is problematic however since a call will invalidate all its state changes as well as all state changes performed by its child call. This means that even if a call has a status of SUCCESS, the chain might have reverted all the state changes it performed.

   Trx 1
    Call #1 <Failed>
      Call #2 <Execution Success>
      Call #3 <Execution Success>
      |--- Failure here
    Call #4

In the transaction above, while Call #2 and Call #3 would have the status EXECUTED.

If you check all calls and check only state_reverted flag, you might be missing some balance changes and nonce changes. This is because when a full transaction fails in ethereum (e.g. calls.all(x.state_reverted == true)), there is still the transaction fee that are recorded to the chain.

Refer to [TransactionTrace#status] field for more details about the handling you must perform.

§begin_ordinal: u64

Known Issues

  • Version 3:

    1. The block’s global ordinal when the call started executing, refer to [Block] documentation for further information about ordinals and total ordering.
    2. The transaction root call begin_ordial is always 0 (also in the GENESIS block), which can cause issues when sorting by this field. To ensure proper execution order, set it as follows: trx.Calls\[0\].BeginOrdinal = trx.BeginOrdinal.

    Fixed in Version 4, see https://docs.substreams.dev/reference-material/chains-and-endpoints/ethereum-data-model for information about block versions.

§end_ordinal: u64

Known Issues

  • Version 3:

    1. The block’s global ordinal when the call finished executing, refer to [Block] documentation for further information about ordinals and total ordering.
    2. The root call of the GENESIS block is always 0. To fix it, you can set it as follows: rx.Calls\[0\].EndOrdinal = max.Uint64.

    Fixed in Version 4, see https://docs.substreams.dev/reference-material/chains-and-endpoints/ethereum-data-model for information about block versions.

§account_creations: Vec<AccountCreation>
👎Deprecated

Known Issues

  • Version 4: AccountCreations are NOT SUPPORTED anymore. DO NOT rely on them.

Implementations§

Source§

impl Call

Source

pub fn call_type(&self) -> CallType

Returns the enum value of call_type, or the default if the field is set to an invalid enum value.

Source

pub fn set_call_type(&mut self, value: CallType)

Sets call_type to the provided enum value.

Source

pub fn address_delegates_to(&self) -> &[u8]

Returns the value of address_delegates_to, or the default value if address_delegates_to is unset.

Trait Implementations§

Source§

impl AsRef<Call> for Call

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Call> for CallView<'_>

Source§

fn as_ref(&self) -> &Call

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Call

Source§

fn clone(&self) -> Call

Returns a duplicate 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 Call

Source§

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

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

impl Default for Call

Source§

fn default() -> Self

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

impl Message for Call

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for Call

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

impl StructuralPartialEq for Call

Auto Trait Implementations§

§

impl Freeze for Call

§

impl RefUnwindSafe for Call

§

impl Send for Call

§

impl Sync for Call

§

impl Unpin for Call

§

impl UnwindSafe for Call

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