Skip to content

Conversation

@rayyan224
Copy link
Contributor

@rayyan224 rayyan224 commented Dec 16, 2025

What changed? Why?
This PR adds an in-memory mempool implementation for ERC-4337 user operations in account-abstraction-core, so we can enqueue, prioritize, and dequeue operations deterministically.

Key Changes:
◦ Introduces Mempool trait:

▪ add_operation(...) (validates min gas requirement, inserts/replaces)
▪ get_top_operations(n) (returns up to n ops, filtered to lowest nonce per sender)
▪ remove_operation(hash) (removes from all indices)

◦ MempoolImpl maintains an implementation of this

@rayyan224 rayyan224 changed the title Draft: Feat/mempool Create In Memory Mempool Service Dec 16, 2025
@rayyan224 rayyan224 changed the title Create In Memory Mempool Service feat(core): add in-memory mempool for 4337 user operations Dec 16, 2025
@rayyan224 rayyan224 marked this pull request as ready for review December 17, 2025 19:42
@rayyan224 rayyan224 requested a review from chunter-cb December 17, 2025 21:00
@rayyan224 rayyan224 requested a review from wlawt December 18, 2025 15:14
Copy link
Contributor

@wlawt wlawt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic makes sense to me!

just to confirm my understanding of all the AA/ERC-4337 stuff going on ...

  1. this in-memory mempool, is similar to the "off-chain mempool" that currently exists?
  2. is the pub trait Mempool a shared trait that op-rbuilder uses to fetch the userOps to build bundles out of?
  3. i'm assuming there'll be a follow-up PR to add the userOp to the in-memory mempool after it passes the validate_user_operation check in ingress-rpc?
  4. i'm not sure if this makes sense, but, what's the role of the user_op_queue_publisher now that we'll have the mempool? is it there to act as a buffer?

@rayyan224
Copy link
Contributor Author

logic makes sense to me!

just to confirm my understanding of all the AA/ERC-4337 stuff going on ...

  1. this in-memory mempool, is similar to the "off-chain mempool" that currently exists?
  2. is the pub trait Mempool a shared trait that op-rbuilder uses to fetch the userOps to build bundles out of?
  3. i'm assuming there'll be a follow-up PR to add the userOp to the in-memory mempool after it passes the validate_user_operation check in ingress-rpc?
  4. i'm not sure if this makes sense, but, what's the role of the user_op_queue_publisher now that we'll have the mempool? is it there to act as a buffer?

Nice questions, this mempool dosen't currently exist would actually be in the bundler i.e Rundler
2. Yep exactly
3. Yep the idea is that it will actually feed off the kafka events to keep the mempool in sync, this way we can keep it distributed, and single source of truth
4. It will still be needed as we need to tell the builder that there has been a change.

@wlawt wlawt mentioned this pull request Dec 18, 2025
6 tasks
Copy link
Contributor

@DeStefaniAndrei DeStefaniAndrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rayyan224 rayyan224 merged commit 235a940 into master Dec 18, 2025
10 checks passed
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.

5 participants