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

use batch tx validation in eth validator #13383

Open
mattsse opened this issue Dec 13, 2024 · 2 comments · May be fixed by #13490
Open

use batch tx validation in eth validator #13383

mattsse opened this issue Dec 13, 2024 · 2 comments · May be fixed by #13490
Labels
A-tx-pool Related to the transaction mempool D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented Dec 13, 2024

we currently create a new state provider per tx:

let account = match self
.client
.latest()
.and_then(|state| state.basic_account(transaction.sender()))
{

this could be optimized if we validate txs in batches and only open the latest state once.

this needs some changes so that we can cache the provider when iterating over a list of txs

cc @hai-rise

          btw @hai-rise a similar problem exists here:

pub fn validate_one(
&self,
origin: TransactionOrigin,
transaction: Tx,
) -> TransactionValidationOutcome<Tx> {
self.inner.validate_one(origin, transaction)
}
/// Validates all given transactions.
///
/// Returns all outcomes for the given transactions in the same order.
///
/// See also [`Self::validate_one`]
pub fn validate_all(
&self,
transactions: Vec<(TransactionOrigin, Tx)>,
) -> Vec<TransactionValidationOutcome<Tx>> {
transactions.into_iter().map(|(origin, tx)| self.validate_one(origin, tx)).collect()

this could use the same provider for all txs, could easily do this if we flip these

Originally posted by @mattsse in #13382 (comment)

@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started A-tx-pool Related to the transaction mempool labels Dec 13, 2024
@Elvis339
Copy link
Contributor

Elvis339 commented Dec 13, 2024

Hey! This seems interesting, can I take this?

@PedroRosalba
Copy link

May I take this issue on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tx-pool Related to the transaction mempool D-good-first-issue Nice and easy! A great choice to get started
Projects
Status: Todo
3 participants