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 Jan 25, 2024
1 parent 0fac43b commit 0b881ff
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 @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit 0b881ff

Please sign in to comment.