Skip to main content

LighterTx

Trait LighterTx 

Source
pub trait LighterTx {
    // Required methods
    fn tx_type(&self) -> LighterTxType;
    fn context(&self) -> TxContext;
    fn push_body_elements(&self, elems: &mut Vec<Fp>);

    // Provided methods
    fn attributes(&self) -> L2TxAttributes { ... }
    fn hash_elements(&self, chain_id: u32) -> Vec<Fp> { ... }
}
Expand description

Marker trait every signed L2 transaction implements.

The hash preimage is [chain_id, tx_type, nonce, expired_at, account_index, api_key_index, ...body]. Implementations are responsible for appending the per-type body elements after the preamble.

Required Methods§

Source

fn tx_type(&self) -> LighterTxType

L2 transaction type discriminant emitted on the wire.

Source

fn context(&self) -> TxContext

Common preamble fields.

Source

fn push_body_elements(&self, elems: &mut Vec<Fp>)

Append the body field elements after the preamble. Caller pushes the preamble; implementations push the body in the upstream-fixed order.

Provided Methods§

Source

fn attributes(&self) -> L2TxAttributes

Per-transaction attributes; defaults to an empty set.

Source

fn hash_elements(&self, chain_id: u32) -> Vec<Fp>

Build the full hash preimage [preamble || body] ready to feed to hash_to_quintic_extension.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§