diff --git a/crates/pool/src/mempool/uo_pool.rs b/crates/pool/src/mempool/uo_pool.rs index a98391825..c3e0a18a8 100644 --- a/crates/pool/src/mempool/uo_pool.rs +++ b/crates/pool/src/mempool/uo_pool.rs @@ -559,6 +559,7 @@ impl UoPoolMetrics { mod tests { use std::collections::HashMap; + use ethers::types::H160; use rundler_provider::MockStakeManager; use rundler_sim::{ EntityInfo, EntityInfos, MockPrechecker, MockSimulator, PrecheckError, PrecheckSettings, @@ -1057,6 +1058,26 @@ mod tests { assert_eq!(pool_op, None); } + #[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, @@ -1138,7 +1159,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, };