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

Make TransactionValidationOutcome generic over error type #14037

Open
emhane opened this issue Jan 28, 2025 · 2 comments · May be fixed by #14046
Open

Make TransactionValidationOutcome generic over error type #14037

emhane opened this issue Jan 28, 2025 · 2 comments · May be fixed by #14046
Assignees
Labels
A-op-reth Related to Optimism and op-reth A-sdk Related to reth's use as a library D-good-first-issue Nice and easy! A great choice to get started

Comments

@emhane
Copy link
Member

emhane commented Jan 28, 2025

Describe the feature

Make generic over invalid transaction error type with default being E = InvalidPoolTransactionError

/// A Result type returned after checking a transaction's validity.
#[derive(Debug)]
pub enum TransactionValidationOutcome<T: PoolTransaction> {
/// The transaction is considered _currently_ valid and can be inserted into the pool.
Valid {
/// Balance of the sender at the current point.
balance: U256,
/// Current nonce of the sender.
state_nonce: u64,
/// The validated transaction.
///
/// See also [`ValidTransaction`].
///
/// If this is a _new_ EIP-4844 blob transaction, then this must contain the extracted
/// sidecar.
transaction: ValidTransaction<T>,
/// Whether to propagate the transaction to the network.
propagate: bool,
},
/// The transaction is considered invalid indefinitely: It violates constraints that prevent
/// this transaction from ever becoming valid.
Invalid(T, InvalidPoolTransactionError),
/// An error occurred while trying to validate the transaction
Error(TxHash, Box<dyn core::error::Error + Send + Sync>),
}

This is necessary so that rollups can match on their own variants of invalid transaction errors.

Additional context

No response

@emhane emhane added A-op-reth Related to Optimism and op-reth A-sdk Related to reth's use as a library labels Jan 28, 2025
@emhane emhane added the D-good-first-issue Nice and easy! A great choice to get started label Jan 28, 2025
@PanGan21
Copy link
Contributor

Hey could I work on this?

@PanGan21
Copy link
Contributor

Hey @emhane I prepared #14046 for this issue. Let me know if it requires something more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-op-reth Related to Optimism and op-reth A-sdk Related to reth's use as a library D-good-first-issue Nice and easy! A great choice to get started
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants