Expand description
§maili-protocol
Core protocol types for Optimism.
These include types, constants, and methods for derivation as well as batch-submission.
§Provenance
This code was initially ported from kona-primitives to op-alloy as part of ongoing maili migrations.
Structs§
- Batch
Reader - Batch Reader provides a function that iteratively consumes batches from the reader. The L1Inclusion block is also provided at creation time. Warning: the batch reader can read every batch-type. The caller of the batch-reader should filter the results.
- Batch
Transaction - BatchTransaction is a set of Frames that can be Into::into Bytes. if the size exceeds the desired threshold.
- Batch
With Inclusion Block - A batch with its inclusion block.
- Block
Info - Block Header Info
- Brotli
Compressor std
- The brotli compressor.
- Channel
- A Channel is a set of batches that are split into at least one, but possibly multiple frames.
- Channel
Out - ChannelOut constructs a channel from compressed, encoded batch data.
- Config
- Configuration for the compressor itself.
- Executing
Message - Solidity event, emitted when a cross chain message is being executed.
- Frame
- A channel frame is a segment of a channel’s data.
- Frame
Iter - An iterator over encoded frames.
- L1Block
Info Bedrock - Represents the fields within a Bedrock L1 block info transaction.
- L1Block
Info Ecotone - Represents the fields within an Ecotone L1 block info transaction.
- L1Block
Info Interop - Represents the fields within an Interop L1 block info transaction.
- L2Block
Info - L2 Block Header Info
- Message
Identifier - A
MessageIdentifier
uniquely represents a log that is emitted from a chain within the broader dependency set. It is included in the calldata of a transaction sent to the CrossL2Inbox contract. - Message
Payload - A
MessagePayload
is the raw payload of an initiating message. - Ratio
Compressor std
- Ratio Compressor
- RawSpan
Batch - Raw Span Batch
- Shadow
Compressor std
- Shadow Compressor
- Single
Batch - Represents a single batch: a single encoded L2 block
- Span
Batch - Container of the inputs required to build a span of L2 blocks in derived form.
- Span
Batch Bits - Type for span batch bits.
- Span
Batch Eip1559 Transaction Data - The transaction data for an EIP-1559 transaction within a span batch.
- Span
Batch Eip2930 Transaction Data - The transaction data for an EIP-2930 transaction within a span batch.
- Span
Batch Eip7702 Transaction Data - The transaction data for an EIP-7702 transaction within a span batch.
- Span
Batch Element - A single batch element is similar to the SingleBatch type but does not contain the parent hash and epoch hash since spans do not contain this data for every block in the span.
- Span
Batch Legacy Transaction Data - The transaction data for a legacy transaction within a span batch.
- Span
Batch Payload - Span Batch Payload
- Span
Batch Prefix - Span Batch Prefix
- Span
Batch Transactions - This struct contains the decoded information for transactions in a span batch.
- Zlib
Compressor - The ZLIB compressor.
Enums§
- Batch
- A Batch.
- Batch
Decoding Error - An error decoding a batch.
- Batch
Encoding Error - An error encoding a batch.
- Batch
Type - The Batch Type.
- Batch
Validity - Batch Validity
- Block
Info Error - An error type for parsing L1 block info transactions.
- Brotli
Compression Error std
- A Brotli Compression Error.
- Brotli
Decompression Error - A frame decompression error.
- Brotli
Level - The brotli encoding level used in Optimism.
- Channel
Error - An error returned when adding a frame to a channel.
- Channel
OutError - An error returned by the ChannelOut when adding single batches.
- Compression
Algo - The compression algorithm type.
- Compressor
Error - An error returned by the compressor.
- Compressor
Type - The type of compressor to use.
- Decode
Error - An error decoding an L1 block info transaction.
- Deposit
Error - An
TxDeposit
validation error. - Frame
Decoding Error - A frame decoding error.
- Frame
Parse Error - Frame parsing error.
- From
Block Error - An error that can occur when converting an OP Block to L2BlockInfo.
- L1Block
Info Tx - The L1BlockInfoTx enum contains variants for the different versions of the L1 block info transaction on OP Stack chains.
- OpBlock
Conversion Error - An error encountered during OP Block conversion.
- Safety
Level - The safety level of a message.
- Span
Batch Error - Span Batch Errors
- Span
Batch Transaction Data - The typed transaction data for a transaction within a span batch.
- Span
Decoding Error - Decoding Error
- Variant
Compressor std
- The channel compressor wraps the brotli and zlib compressor types, implementing the ChannelCompressor trait itself.
Constants§
- CHANNEL_
ID_ LENGTH - CHANNEL_ID_LENGTH is the length of the channel ID.
- DEPOSIT_
EVENT_ ABI - Deposit log event abi signature.
- DEPOSIT_
EVENT_ ABI_ HASH - Deposit event abi hash.
- DEPOSIT_
EVENT_ VERSION_ 0 - The initial version of the deposit event log.
- DERIVATION_
VERSION_ 0 - The version of the derivation pipeline.
- FJORD_
MAX_ RLP_ BYTES_ PER_ CHANNEL - FJORD_MAX_RLP_BYTES_PER_CHANNEL is the maximum amount of bytes that will be read from a channel when the Fjord Hardfork is activated. This limit is set when decoding the RLP.
- FRAME_
OVERHEAD - Count the tagging info as 200 in terms of buffer size.
- MAX_
FRAME_ LEN - Frames cannot be larger than 1MB.
- MAX_
RLP_ BYTES_ PER_ CHANNEL - MAX_RLP_BYTES_PER_CHANNEL is the maximum amount of bytes that will be read from a channel. This limit is set when decoding the RLP.
- MAX_
SPAN_ BATCH_ ELEMENTS - MAX_SPAN_BATCH_ELEMENTS is the maximum number of blocks, transactions in total, or transaction per block allowed in a span batch.
- SINGLE_
BATCH_ TYPE - The single batch type identifier.
- SPAN_
BATCH_ TYPE - The span batch type identifier.
Traits§
- Batch
Validation Provider - Describes the functionality of a data source that fetches safe blocks.
- Channel
Compressor - Channel Compressor
- Compressor
Writer - Compressor Writer
Functions§
- calculate_
tx_ l1_ cost_ bedrock - Calculate the gas cost of a transaction based on L1 block data posted on L2 post-bedrock.
- calculate_
tx_ l1_ cost_ bedrock_ empty_ scalars - Calculate the gas cost of a transaction based on L1 block data posted on L2 post-ecotone. This is a special case where the gas cost function uses the bedrock gas cost function, but the data gas is calculated using the ecotone data gas function.
- calculate_
tx_ l1_ cost_ ecotone - Calculate the gas cost of a transaction based on L1 block data posted on L2, post-Ecotone.
- calculate_
tx_ l1_ cost_ fjord - Calculate the gas cost of a transaction based on L1 block data posted on L2, post-Fjord.
- calculate_
tx_ l1_ cost_ regolith - Calculate the gas cost of a transaction based on L1 block data posted on L2 post-regolith.
- closing_
deposit_ context_ tx - Create a TxDeposit for closing the deposit context. This deposit transaction, after interop activation, always is placed last in the deposit section of the block.
- compress_
zlib - Method to compress data using ZLIB.
- data_
gas_ bedrock - Calculate the data gas for posting the transaction on L1.
- data_
gas_ fjord - Calculate the data gas for posting the transaction on L1.
- data_
gas_ regolith - Calculate the data gas for posting the transaction on L1.
- decode_
deposit - Derives a deposit transaction from an EVM log event emitted by the deposit contract.
- decompress_
brotli - Decompresses the given bytes data using the Brotli decompressor implemented
in the
brotli
crate. - decompress_
zlib - Method to decompress data using ZLIB.
- flz_
compress_ len - Re-export the fastlz compression length calculation function. Returns the length of the data after compression through FastLZ.
- read_
tx_ data - Reads transaction data from a reader.
- starts_
with_ 2718_ deposit - Returns if the given
value
is a deposit transaction. - to_
system_ config - Converts the OpBlock to a partial SystemConfig.
- tx_
estimated_ size_ fjord - Calculate the estimated compressed transaction size in bytes, scaled by 1e6. This value is computed based on the following formula: max(minTransactionSize, intercept + fastlzCoef*fastlzSize)
Type Aliases§
- Channel
Id - ChannelId is an opaque identifier for a channel.
- Compressor
Result - The result from compressing data.