From ccd15e8a25578b4d76c2498feab32f3db407d704 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 9 Feb 2026 23:17:19 +0100 Subject: [PATCH] refactor(txpool): rename and document validation methods (#22008) Co-authored-by: Amp --- .changelog/bold-frogs-run.md | 5 ++++ crates/transaction-pool/src/validate/eth.rs | 28 +++++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 .changelog/bold-frogs-run.md diff --git a/.changelog/bold-frogs-run.md b/.changelog/bold-frogs-run.md new file mode 100644 index 0000000000..365fc8ba33 --- /dev/null +++ b/.changelog/bold-frogs-run.md @@ -0,0 +1,5 @@ +--- +reth-transaction-pool: patch +--- + +Renamed and documented validation methods for clarity. `validate_one_no_state` and `validate_one_against_state` are now public methods `validate_stateless` and `validate_stateful` with improved documentation explaining their respective validation phases. diff --git a/crates/transaction-pool/src/validate/eth.rs b/crates/transaction-pool/src/validate/eth.rs index 058823f503..e3867630a0 100644 --- a/crates/transaction-pool/src/validate/eth.rs +++ b/crates/transaction-pool/src/validate/eth.rs @@ -230,7 +230,7 @@ where transaction: Tx, maybe_state: &mut Option>, ) -> TransactionValidationOutcome { - match self.validate_one_no_state(origin, transaction) { + match self.validate_stateless(origin, transaction) { Ok(transaction) => { // stateless checks passed, pass transaction down stateful validation pipeline // If we don't have a state provider yet, fetch the latest state @@ -250,30 +250,33 @@ where let state = maybe_state.as_deref().expect("provider is set"); - self.validate_one_against_state(origin, transaction, state) + self.validate_stateful(origin, transaction, state) } Err(invalid_outcome) => invalid_outcome, } } - /// Validates a single transaction with the provided state provider. + /// Validates a single transaction against the given state provider, performing both + /// [stateless](Self::validate_stateless) and [stateful](Self::validate_stateful) checks. pub fn validate_one_with_state_provider( &self, origin: TransactionOrigin, transaction: Tx, state: impl AccountInfoReader, ) -> TransactionValidationOutcome { - let tx = match self.validate_one_no_state(origin, transaction) { + let tx = match self.validate_stateless(origin, transaction) { Ok(tx) => tx, Err(invalid_outcome) => return invalid_outcome, }; - self.validate_one_against_state(origin, tx, state) + self.validate_stateful(origin, tx, state) } - /// Performs stateless validation on single transaction. Returns unaltered input transaction - /// if all checks pass, so transaction can continue through to stateful validation as argument - /// to [`validate_one_against_state`](Self::validate_one_against_state). - fn validate_one_no_state( + /// Validates a single transaction without requiring any state access (stateless checks only). + /// + /// Checks tx type support, nonce bounds, size limits, gas limits, fee constraints, chain ID, + /// intrinsic gas, and blob tx pre-checks. Returns the unmodified transaction on success so it + /// can be passed to [`validate_stateful`](Self::validate_stateful). + pub fn validate_stateless( &self, origin: TransactionOrigin, transaction: Tx, @@ -530,8 +533,11 @@ where Ok(transaction) } - /// Validates a single transaction using given state provider. - fn validate_one_against_state

( + /// Validates a single transaction against the given state (stateful checks only). + /// + /// Checks sender account balance, nonce, bytecode, and validates blob sidecars. The + /// transaction must have already passed [`validate_stateless`](Self::validate_stateless). + pub fn validate_stateful

( &self, origin: TransactionOrigin, mut transaction: Tx,