Skip to content

Move OkValidator into txpool behind test-utils feature gate #16140

Closed
@mattsse

Description

@mattsse

Describe the feature

This is quite useful:

#[derive(Debug, Default)]
#[non_exhaustive]
struct OkValidator;
impl TransactionValidator for OkValidator {
type Transaction = EthPooledTransaction;
async fn validate_transaction(
&self,
_origin: TransactionOrigin,
transaction: Self::Transaction,
) -> TransactionValidationOutcome<Self::Transaction> {
// Always return valid
let authorities = transaction.authorization_list().map(|auths| {
auths.iter().flat_map(|auth| auth.recover_authority()).collect::<Vec<_>>()
});
TransactionValidationOutcome::Valid {
balance: *transaction.cost(),
state_nonce: transaction.nonce(),
bytecode_hash: None,
transaction: ValidTransaction::Valid(transaction),
propagate: false,
authorities,
}
}
}

we can make this available from the pool itself, if we feature gate this behind test-utils and relax the type with a new PhantomType generic

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-tx-poolRelated to the transaction mempoolC-enhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions