-
Notifications
You must be signed in to change notification settings - Fork 46
feat: refactor AA mempool into clean architecture layers #114
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- domain/ layer with types, events, mempool, entrypoints - services/ layer with MempoolEngine and ports (EventSource, UserOperationValidator) - infrastructure/ layer with Kafka and BaseNode adapters - factories/ layer with create_mempool_engine wiring Key changes: - KafkaEvent renamed to MempoolEvent (domain concept) - PoolConfig implements Default trait - Fixed println! to tracing::warn! in mempool - Applied ports & adapters pattern for testability - All 20 tests passing
- Updated Cargo.toml to use account-abstraction-core-v2 - Updated imports: KafkaEvent → MempoolEvent, KafkaMempoolEngine → MempoolEngine - Updated service.rs to use BaseNodeValidator instead of AccountAbstractionServiceImpl - Removed reputation checks (not yet implemented in v2) - Updated test mocks to use EventSource instead of KafkaConsumer - All 12 tests passing Breaking changes: - Removed ReputationService integration (will be added back in future)
- Explains domain, services, infrastructure, and factories layers - Documents ports & adapters pattern with examples - Includes usage examples and testing patterns - Provides visual dependency diagram
- Flatten domain/mempool/ folder → domain/mempool.rs (single file) - Move implementation details to infrastructure/in_memory/ - OrderedPoolOperation (BTreeSet helper) - ByMaxFeeAndSubmissionId (custom Ord for fees) - ByNonce (custom Ord for nonces) - Simplify Mempool trait: add_operation returns Result<(), Error> instead of Option<OrderedPoolOperation> - InMemoryMempool now in infrastructure layer where it belongs Benefits: - Domain is now pure interfaces (trait + PoolConfig only) - Implementation details hidden in infrastructure - Consistent with clean architecture principles - No unnecessary folder nesting - All 20 tests still passing
Contributor
Author
|
We can delete account-abstraction folder, and rename this one to that in another mr. So the diffs are easier to understand ! |
chunter-cb
approved these changes
Dec 19, 2025
|
Follow up pr will clean up/rename this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR sets up a clean architecture foundation for the account abstraction mempool. It clearly separates domain logic, service orchestration, and infrastructure so the core logic stays pure and easy to reason about.
The goal is to make the mempool more modular, easier to test (mocking Kafka/RPC), and flexible to extend or swap implementations in the future without touching business logic.