Skip to content

Conversation

@itamar-starkware
Copy link
Contributor

@itamar-starkware itamar-starkware commented Nov 4, 2025

TL;DR

Added a test to verify that validation is skipped for account transactions already in the mempool.

What changed?

Added a new test case test_account_tx_in_mempool_influence_on_validation that verifies the behavior of transaction validation based on whether an account transaction is already in the mempool. The test covers three scenarios:

  1. When the transaction is in the mempool (validation should be skipped)
  2. When the transaction is not in the mempool (validation should run)
  3. When there's a mempool error (validation should run)

How to test?

Run the new test with:

cargo test -p apollo_gateway test_account_tx_in_mempool_influence_on_validation

Why make this change?

This test ensures that the stateful transaction validator correctly optimizes validation by skipping redundant validation for transactions already present in the mempool, while still properly validating transactions that aren't in the mempool or when mempool errors occur.

@reviewable-StarkWare
Copy link

This change is Reviewable

@itamar-starkware itamar-starkware self-assigned this Nov 4, 2025
@ArniStarkware
Copy link
Contributor

crates/apollo_gateway/src/stateful_transaction_validator_test.rs line 444 at r1 (raw file):

#[rstest]
#[case(Ok(true), false)] // account tx in mempool → skip validation

Is that arrow symbol standard ASCII? I assume not. Please refrain from using it if this is the case.

Suggestion:

account tx in mempool -> skip validation

@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch from 7faf351 to f8cf519 Compare November 6, 2025 15:44
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from d139542 to f535c85 Compare November 6, 2025 15:44
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from f535c85 to a31bc96 Compare November 9, 2025 09:56
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch from f8cf519 to c51f57e Compare November 9, 2025 09:56
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from a31bc96 to 9fa4f2f Compare November 10, 2025 12:08
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch from c51f57e to d2d5f77 Compare November 10, 2025 12:08
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch from d2d5f77 to e827b03 Compare November 11, 2025 11:07
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch 2 times, most recently from 6d21bf3 to ecc9ac9 Compare November 12, 2025 20:39
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch from e827b03 to 14142cc Compare November 12, 2025 20:39
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from ecc9ac9 to 15c1729 Compare November 13, 2025 09:03
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch 2 times, most recently from 90e1beb to ba27508 Compare November 13, 2025 09:24
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from 15c1729 to 60beac9 Compare November 13, 2025 09:24
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from 60beac9 to b45425c Compare November 25, 2025 12:28
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch from ba27508 to a9b8430 Compare November 25, 2025 12:28
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from b45425c to bbbcefb Compare November 25, 2025 13:34
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch 2 times, most recently from a1ef90a to fc642eb Compare November 25, 2025 15:52
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from bbbcefb to 34d8704 Compare November 25, 2025 15:52
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_extract_async_mempool_query_from_blocking_task branch from fc642eb to b4115d2 Compare November 26, 2025 12:36
@itamar-starkware itamar-starkware force-pushed the 11-04-apollo_gateway_test_account_tx_in_mempool_influence_on_validation branch from 34d8704 to 40cf6e3 Compare November 26, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants