forked from risechain/pevm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rs
39 lines (33 loc) · 1.08 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Launch K clusters.
//! Each cluster has M people.
//! Each person makes N swaps.
#[path = "../common/mod.rs"]
pub mod common;
#[path = "../erc20/mod.rs"]
pub mod erc20;
#[path = "./mod.rs"]
pub mod uniswap;
use crate::uniswap::generate_cluster;
use ahash::AHashMap;
use pevm::{Bytecodes, EvmAccount, InMemoryStorage};
use revm::primitives::{Address, TxEnv};
#[test]
fn uniswap_clusters() {
const NUM_CLUSTERS: usize = 20;
const NUM_PEOPLE_PER_CLUSTER: usize = 20;
const NUM_SWAPS_PER_PERSON: usize = 20;
let mut final_state = AHashMap::from([(Address::ZERO, EvmAccount::default())]); // Beneficiary
let mut final_bytecodes = Bytecodes::default();
let mut final_txs = Vec::<TxEnv>::new();
for _ in 0..NUM_CLUSTERS {
let (state, bytecodes, txs) =
generate_cluster(NUM_PEOPLE_PER_CLUSTER, NUM_SWAPS_PER_PERSON);
final_state.extend(state);
final_bytecodes.extend(bytecodes);
final_txs.extend(txs);
}
common::test_execute_revm(
InMemoryStorage::new(final_state, Some(&final_bytecodes), []),
final_txs,
)
}