pub trait RethL1BlockInfo {
// Required methods
fn l1_tx_data_fee(
&self,
chain_spec: &ChainSpec,
timestamp: u64,
input: &[u8],
is_deposit: bool,
) -> Result<U256, BlockExecutionError>;
fn l1_data_gas(
&self,
chain_spec: &ChainSpec,
timestamp: u64,
input: &[u8],
) -> Result<U256, BlockExecutionError>;
}
Available on crate feature
optimism
only.Expand description
An extension trait for [L1BlockInfo
] that allows us to calculate the L1 cost of a transaction
based off of the [ChainSpec
]’s activated hardfork.
Required Methods§
Sourcefn l1_tx_data_fee(
&self,
chain_spec: &ChainSpec,
timestamp: u64,
input: &[u8],
is_deposit: bool,
) -> Result<U256, BlockExecutionError>
fn l1_tx_data_fee( &self, chain_spec: &ChainSpec, timestamp: u64, input: &[u8], is_deposit: bool, ) -> Result<U256, BlockExecutionError>
Forwards an L1 transaction calculation to revm and returns the gas cost.
§Takes
chain_spec
: The [ChainSpec
] for the node.timestamp
: The timestamp of the current block.input
: The calldata of the transaction.is_deposit
: Whether or not the transaction is a deposit.
Sourcefn l1_data_gas(
&self,
chain_spec: &ChainSpec,
timestamp: u64,
input: &[u8],
) -> Result<U256, BlockExecutionError>
fn l1_data_gas( &self, chain_spec: &ChainSpec, timestamp: u64, input: &[u8], ) -> Result<U256, BlockExecutionError>
Computes the data gas cost for an L2 transaction.
§Takes
chain_spec
: The [ChainSpec
] for the node.timestamp
: The timestamp of the current block.input
: The calldata of the transaction.