Mequeue
Mequeue is an executor for MEV bots optimized to be able to process multiple transactions concurrently.
The main goal is to make this executor to add as less resource-overhead as possible while keeping it simple to use.
[dependencies]
mequeue = { git = "https://github.com/mekosko/mequeue" }
Simple bot example can be found in the interceptor folder.
Design decisions and why they were made
It was inspired by how async executors are made. There are several components:
- Workers, the number of which you can specify when creating an executor.
- A workers manager that restarts them every time the shared state changes.
- Shared among workers mpmc queue. Each event can be received by only one worker.
- Broadcast channel used to update shared between workers state.
Why we restart workers on every state change?
State change implies that all computations made by the workers are no longer relevant.
We don't want to spend our time on outdated computations, so we just abort workers and start them again.
Why do we prefer concurrent execution?
Because of concurrent execution while one worker is awaiting data from external source other can work.
Moreover, tokio can run coroutines in parallel. So workers can process events in parallel.