diff --git a/crates/pool/src/mempool/uo_pool.rs b/crates/pool/src/mempool/uo_pool.rs index b2935cdef..d8884c437 100644 --- a/crates/pool/src/mempool/uo_pool.rs +++ b/crates/pool/src/mempool/uo_pool.rs @@ -495,6 +495,7 @@ impl UoPoolMetrics { mod tests { use std::collections::HashMap; + use ethers::types::H160; use rundler_sim::{ EntityInfo, EntityInfos, MockPrechecker, MockSimulator, PrecheckError, PrecheckSettings, PrecheckViolation, SimulationError, SimulationSettings, SimulationSuccess, @@ -909,6 +910,26 @@ mod tests { check_ops(pool.best_operations(1, 0).unwrap(), vec![replacement]); } + #[tokio::test] + async fn too_many_ops_for_unstaked_sender() { + let mut ops = vec![]; + let addr = H160::random(); + for i in 0..5 { + ops.push(create_op(addr, i, 1)) + } + let pool = create_pool(ops.clone()); + + for op in ops.iter().take(4) { + pool.add_operation(OperationOrigin::Local, op.op.clone()) + .await + .unwrap(); + } + assert!(pool + .add_operation(OperationOrigin::Local, ops[4].op.clone()) + .await + .is_err()); + } + #[derive(Clone, Debug)] struct OpWithErrors { op: UserOperation, @@ -973,7 +994,7 @@ mod tests { sim_settings: SimulationSettings::default(), mempool_channel_configs: HashMap::new(), num_shards: 1, - same_sender_mempool_count: 16, + same_sender_mempool_count: 4, throttled_entity_mempool_count: 4, throttled_entity_live_blocks: 10, };