Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(primitives): Add docs to optimism InvalidTransaction errors. #884

Merged
merged 1 commit into from Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 28 additions & 4 deletions crates/primitives/src/result.rs
Expand Up @@ -216,12 +216,36 @@ pub enum InvalidTransaction {
TooManyBlobs,
/// Blob transaction contains a versioned hash with an incorrect version
BlobVersionNotSupported,
/// System transactions are not supported
/// post-regolith hardfork.
/// System transactions are not supported post-regolith hardfork.
///
/// Before the Regolith hardfork, there was a special field in the `Deposit` transaction
/// type that differentiated between `system` and `user` deposit transactions. This field
/// was deprecated in the Regolith hardfork, and this error is thrown if a `Deposit` transaction
/// is found with this field set to `true` after the hardfork activation.
///
/// In addition, this error is internal, and bubbles up into a [Halt::FailedDeposit] error
/// in the `revm` handler for the consumer to easily handle. This is due to a state transition
/// rule on OP Stack chains where, if for any reason a deposit transaction fails, the transaction
/// must still be included in the block, the sender nonce is bumped, the `mint` value persists, and
/// special gas accounting rules are applied. Normally on L1, [EVMError::Transaction] errors
/// are cause for non-inclusion, so a special [Halt] variant was introduced to handle this
/// case for failed deposit transactions.
#[cfg(feature = "optimism")]
DepositSystemTxPostRegolith,
/// Deposit transaction haults bubble up to the global main return handler,
/// wiping state and only increasing the nonce + persisting the mint value.
/// Deposit transaction haults bubble up to the global main return handler, wiping state and
/// only increasing the nonce + persisting the mint value.
///
/// This is a catch-all error for any deposit transaction that is results in a [Halt] error
/// post-regolith hardfork. This allows for a consumer to easily handle special cases where
/// a deposit transaction fails during validation, but must still be included in the block.
///
/// In addition, this error is internal, and bubbles up into a [Halt::FailedDeposit] error
/// in the `revm` handler for the consumer to easily handle. This is due to a state transition
/// rule on OP Stack chains where, if for any reason a deposit transaction fails, the transaction
/// must still be included in the block, the sender nonce is bumped, the `mint` value persists, and
/// special gas accounting rules are applied. Normally on L1, [EVMError::Transaction] errors
/// are cause for non-inclusion, so a special [Halt] variant was introduced to handle this
/// case for failed deposit transactions.
#[cfg(feature = "optimism")]
HaltedDepositPostRegolith,
}
Expand Down