Skip to content

Commit

Permalink
test(pool): add tests for UREP-010 and UREP-020
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-miao committed Dec 5, 2023
1 parent 3c0be7f commit c70cee8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion crates/pool/src/mempool/uo_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit c70cee8

Please sign in to comment.