Skip to main content

MessageRead

Trait MessageRead 

Source
pub trait MessageRead {
    // Required methods
    fn vm_message(&self) -> &Message;
    fn chain_length(&self) -> Result<usize>;
    fn from(&self) -> Address;
    fn to(&self) -> Address;
    fn sequence(&self) -> u64;
    fn value(&self) -> &TokenAmount;
    fn gas_limit(&self) -> u64;
    fn required_funds(&self) -> TokenAmount;
    fn gas_fee_cap(&self) -> &TokenAmount;
    fn gas_premium(&self) -> &TokenAmount;

    // Provided method
    fn effective_gas_premium(&self, base_fee: &TokenAmount) -> TokenAmount { ... }
}
Expand description

Message interface to make read-only interactions with Signed and unsigned messages in a generic context.

Required Methods§

Source

fn vm_message(&self) -> &Message

Returns the message the VM executes. For a signed message this is the inner unsigned message.

Mirrors Lotus ChainMsg.VMMessage.

Source

fn chain_length(&self) -> Result<usize>

Returns the number of bytes this message contributes to the chain, which is what on-chain gas is charged for. A Secp256k1 or delegated signature counts towards it; a BLS signature does not, because it is aggregated into the block header.

Mirrors Lotus ChainMsg.ChainLength.

Source

fn from(&self) -> Address

Returns the from address of the message.

Source

fn to(&self) -> Address

Returns the destination address of the message.

Source

fn sequence(&self) -> u64

Returns the message sequence or nonce.

Source

fn value(&self) -> &TokenAmount

Returns the amount sent in message.

Source

fn gas_limit(&self) -> u64

Returns the gas limit for the message.

Source

fn required_funds(&self) -> TokenAmount

Returns the required funds for the message.

Source

fn gas_fee_cap(&self) -> &TokenAmount

gets gas fee cap for the message.

Source

fn gas_premium(&self) -> &TokenAmount

gets gas premium for the message.

Provided Methods§

Source

fn effective_gas_premium(&self, base_fee: &TokenAmount) -> TokenAmount

This method returns the effective gas premium claimable by the miner given the supplied base fee. This method is not used anywhere except the Eth API.

Filecoin clamps the gas premium at gas_fee_cap - base_fee, if lower than the specified premium. Returns 0 if gas_fee_cap is less than base_fee.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + MessageRead + ?Sized> MessageRead for &'a T

Implementors§