-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare code for Native Mempool implementation (#2293)
# Description Sets the foundation for a driver native solution submission strategy, that can be conditionally turned on and tested via the config file. # Changes <!-- List of detailed changes (how the change is accomplished) --> - [x] Defines a new SubmissionLogic enum which can be set in the toml config - [x] inside infra, divide between the boundary implementation and the not yet implemented native driver infra mempool implementation - [x] Pipe config and implementation together Note, that currently the system would fail to start with the non-default Native solution submission configuration. ## How to test No logic change, just compilation ## Related Issues Part of #2216
- Loading branch information
Showing
6 changed files
with
94 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,44 @@ | ||
pub use crate::boundary::mempool::{Config, GlobalTxPool, Kind, Mempool, RevertProtection}; | ||
pub use crate::boundary::mempool::{Config, GlobalTxPool, Kind, RevertProtection, SubmissionLogic}; | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum Mempool { | ||
/// Legacy implementation of the mempool, using the shared and solvers crate | ||
Boundary(crate::boundary::mempool::Mempool), | ||
/// Driver native mempool implementation | ||
Native(Inner), | ||
} | ||
|
||
impl std::fmt::Display for Mempool { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
Self::Boundary(mempool) => write!(f, "Boundary({mempool})"), | ||
Self::Native(mempool) => write!(f, "Native({mempool})"), | ||
} | ||
} | ||
} | ||
|
||
impl Mempool { | ||
pub fn config(&self) -> &Config { | ||
match self { | ||
Self::Boundary(mempool) => mempool.config(), | ||
Self::Native(mempool) => &mempool.config, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Inner { | ||
config: Config, | ||
} | ||
|
||
impl std::fmt::Display for Inner { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "Mempool({})", self.config.kind.format_variant()) | ||
} | ||
} | ||
|
||
impl Inner { | ||
pub fn config(&self) -> &Config { | ||
&self.config | ||
} | ||
} |
This file contains 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