Skip to content
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

feat(pool): update throttling logic #484

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/rundler/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub async fn run() -> anyhow::Result<()> {
.context("metrics server should start")?;

match opt.command {
Command::Node(args) => node::run(args, opt.common).await?,
Command::Node(args) => node::run(*args, opt.common).await?,
0xfourzerofour marked this conversation as resolved.
Show resolved Hide resolved
Command::Pool(args) => pool::run(args, opt.common).await?,
Command::Rpc(args) => rpc::run(args, opt.common).await?,
Command::Builder(args) => builder::run(args, opt.common).await?,
Expand All @@ -62,7 +62,7 @@ enum Command {
///
/// Runs the Pool, Builder, and RPC servers in a single process.
#[command(name = "node")]
Node(NodeCliArgs),
Node(Box<NodeCliArgs>),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah right yeh this makes sense


/// Rpc command
///
Expand Down
18 changes: 18 additions & 0 deletions bin/rundler/src/cli/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ pub struct PoolArgs {
env = "POOL_CHAIN_UPDATE_CHANNEL_CAPACITY"
)]
pub chain_update_channel_capacity: Option<usize>,

#[arg(
long = "pool.throttled_entity_mempool_count",
name = "pool.throttled_entity_mempool_count",
env = "POOL_THROTTLED_ENTITY_MEMPOOL_COUNT",
default_value = "4"
)]
pub throttled_entity_mempool_count: u64,

#[arg(
long = "pool.throttled_entity_live_blocks",
name = "pool.throttled_entity_live_blocks",
env = "POOL_THROTTLED_ENTITY_LIVE_BLOCKS",
default_value = "4"
)]
pub throttled_entity_live_blocks: u64,
Comment on lines +105 to +119
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are the sort of things I want to move to ChainSpec in the future. Linking #486 to track.

}

impl PoolArgs {
Expand Down Expand Up @@ -149,6 +165,8 @@ impl PoolArgs {
precheck_settings: common.try_into()?,
sim_settings: common.try_into()?,
mempool_channel_configs: mempool_channel_configs.clone(),
throttled_entity_mempool_count: self.throttled_entity_mempool_count,
throttled_entity_live_blocks: self.throttled_entity_live_blocks,
})
})
.collect::<anyhow::Result<Vec<PoolConfig>>>()?;
Expand Down
4 changes: 4 additions & 0 deletions crates/pool/src/mempool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ pub struct PoolConfig {
/// operations. The mempool is divided into shards by taking the hash of the operation
/// and modding it by the number of shards.
pub num_shards: u64,
/// the maximum number of user operations with a throttled entity that can stay in the mempool
pub throttled_entity_mempool_count: u64,
/// The maximum number of blocks a user operation with a throttled entity can stay in the mempool
pub throttled_entity_live_blocks: u64,
}

/// Origin of an operation.
Expand Down
2 changes: 1 addition & 1 deletion crates/pool/src/mempool/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub(crate) struct PoolInner {
/// Removed operation hashes sorted by block number, so we can forget them
/// when enough new blocks have passed.
mined_hashes_with_block_numbers: BTreeSet<(u64, H256)>,
/// Count of operations by sender
/// Count of operations by entity address
count_by_address: HashMap<Address, usize>,
/// Submission ID counter
submission_id: u64,
Expand Down
Loading
Loading