Expand description
Lighter L2 transaction encoding.
Each L2 transaction body is reduced to a sequence of Goldilocks field
elements in a fixed order, hashed with Poseidon2 to a single Fp5 digest,
optionally aggregated with a hash of the per-tx L2TxAttributes, and
emitted as 40 canonical little-endian bytes. The resulting hash is what
super::schnorr::PrivateKey::sign consumes; the venue’s sequencer
recomputes the same hash and rejects the transaction on mismatch.
The wire-format tx_info is a JSON object with field order matching the
upstream lighter-go txtypes.L2*TxInfo Go structs. The signature is
base64-encoded after s_le || e_le byte assembly. See sign_tx for
the full pipeline.
Phase E covers the trading critical path: CreateOrderTxInfo,
CancelOrderTxInfo, ModifyOrderTxInfo, plus
ApproveIntegratorTxInfo off the hot path. Subsequent tx types follow
the same template once a use case lands.
Structs§
- Approve
Integrator TxInfo ApproveIntegrator(tx_type = 45): approves an integrator account index.- Cancel
AllOrders TxInfo CancelAllOrders(tx_type = 16): account-wide cancel directive.- Cancel
Order TxInfo CancelOrder(tx_type = 15): cancels a single live order by index.- Create
Order TxInfo CreateOrder(tx_type = 14) — submits a new order to the sequencer.- L2Tx
Attributes - Per-transaction L2 attributes.
- Modify
Order TxInfo ModifyOrder(tx_type = 17) — amends size / price on a live order.- Order
Info - Common per-order body fields shared by
CreateOrderTxInfoand the not-yet-implementedCreateGroupedOrdersvariant. - Signed
Tx - Outcome of
sign_tx: the deterministic message hash plus the(s, e)Schnorr signature. - TxContext
- Common context wrapping a tx body: account, key, nonce, expiry.
- TxInfo
Json - JSON renderer for the L2 tx_info wire payload.
- Update
Leverage TxInfo UpdateLeverage(tx_type = 20): change leverage / margin mode for a market.
Constants§
- TX_
HASH_ BYTES - Canonical wire length of a Lighter L2 message hash: 40-byte LE
Fp5.
Traits§
- Lighter
Tx - Marker trait every signed L2 transaction implements.
Functions§
- compute_
tx_ hash - Compute the signed message hash for any
LighterTx. - sign_tx
- Sign any
LighterTxunder(sk, k)and return the 80-byte signature alongside the 40-byte tx hash.