Skip to content

Commit

Permalink
wip: load testing
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOsiris committed Jan 17, 2025
1 parent 1d432e9 commit b7ece35
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
kurtosis engine status
kurtosis enclave ls || ( kurtosis engine restart && kurtosis enclave ls )
- name: Setup Devnet
- name: E2E Tests
run: |
eval $(minikube -p minikube docker-env)
just e2e-test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:
jobs:
sync:
name: sync (${{ matrix.chain.bin }})
runs-on: ubuntu-22.04-32core
runs-on: ubuntu-latest
env:
RUST_LOG: info,sync=error
RUST_BACKTRACE: 1
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/DeployDevnet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract DeployDevnet is Script {
console.log("PBHEntryPointImplV1 Deployed at: ", pbhEntryPointImpl);
bytes memory initCallData = abi.encodeCall(
PBHEntryPointImplV1.initialize,
(IWorldID(worldIdGroups), IEntryPoint(entryPoint), 1000, address(0x123), MAX_PBH_GAS_LIMIT)
(IWorldID(worldIdGroups), IEntryPoint(entryPoint), 255, address(0x123), MAX_PBH_GAS_LIMIT)
);
pbhEntryPoint = address(new PBHEntryPoint(pbhEntryPointImpl, initCallData));
console.log("PBHEntryPoint Deployed at: ", pbhEntryPoint);
Expand Down
4 changes: 2 additions & 2 deletions devnet/src/el/world-chain/world_chain_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def get_config(
"--discovery.port={0}".format(discovery_port),
"--port={0}".format(discovery_port),
"--builder.pbh_entrypoint=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F", # Deterministic Deployment Address on re-runs
"--builder.signature_aggregator=0x09635F643e140090A9A8Dcd712eD6285858ceBef" # Deterministic Deployment Address on re-runs
"--builder.num_pbh_txs=1000"
"--builder.signature_aggregator=0x09635F643e140090A9A8Dcd712eD6285858ceBef", # Deterministic Deployment Address on re-runs
"--builder.world_id=0x3Aa5ebB10DC797CAC828524e59A333d0A371443c"
]

if len(existing_el_clients) > 0:
Expand Down
8 changes: 6 additions & 2 deletions world-chain-builder/crates/tests/src/cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::run_command;

const CONCURRENCY_LIMIT: usize = 50;

/// Sends 5k transactions to the builder concurrently
/// Sends a high volume of transactions to the builder concurrently.
pub async fn load_test<T, P>(builder_provider: Arc<P>, transactions: Vec<Bytes>) -> Result<()>
where
T: Transport + Clone,
Expand Down Expand Up @@ -134,7 +134,11 @@ where
..Default::default()
};

assert!(send_raw_transaction_conditional(tx.clone(), conditions, builder_provider.clone()).await.is_err());
assert!(
send_raw_transaction_conditional(tx.clone(), conditions, builder_provider.clone())
.await
.is_err()
);
Ok(())
}

Expand Down
29 changes: 19 additions & 10 deletions world-chain-builder/crates/tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::{
use alloy_provider::{Provider, ProviderBuilder};
use alloy_rpc_types_eth::{BlockNumberOrTag, BlockTransactionsKind};
use alloy_transport::Transport;
use clap::Parser;
use eyre::eyre::{eyre, Result};
use fixtures::generate_fixture;
use std::process::Command;
Expand All @@ -23,6 +24,12 @@ use tracing::info;
pub mod cases;
pub mod fixtures;

#[derive(Parser)]
pub struct Args {
#[clap(short, long, default_value = "true")]
pub spawn_devnet: bool,
}

#[tokio::main]
async fn main() -> Result<()> {
if std::env::var("RUST_LOG").is_err() {
Expand All @@ -32,8 +39,8 @@ async fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init();

let (builder_rpc, sequencer_rpc) = start_devnet().await?;
let args = Args::parse();
let (builder_rpc, sequencer_rpc) = start_devnet(args).await?;

let sequencer_provider =
Arc::new(ProviderBuilder::default().on_http(sequencer_rpc.parse().unwrap()));
Expand All @@ -51,7 +58,7 @@ async fn main() -> Result<()> {
};
f.await;

let fixture = generate_fixture(1000).await;
let fixture = generate_fixture(255).await;
info!("Running block building test");
cases::load_test(builder_provider.clone(), fixture.pbh).await?;
info!("Running fallback test");
Expand All @@ -61,14 +68,16 @@ async fn main() -> Result<()> {
Ok(())
}

async fn start_devnet() -> Result<(String, String)> {
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
.ancestors()
.nth(3)
.unwrap()
.canonicalize()?;
async fn start_devnet(args: Args) -> Result<(String, String)> {
if args.spawn_devnet {
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
.ancestors()
.nth(3)
.unwrap()
.canonicalize()?;

run_command(&"just", &["devnet-up"], path).await?;
run_command(&"just", &["devnet-up"], path).await?;
}

let builder_socket = run_command(
"kurtosis",
Expand Down
2 changes: 1 addition & 1 deletion world-chain-builder/crates/world/bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() {
let world_chain_node = WorldChainBuilder::new(builder_args.clone())?;
let handle = builder
.with_types_and_provider::<WorldChainBuilder, BlockchainProvider2<_>>()
.with_components(WorldChainBuilder::components(builder_args.clone()))
.with_components(world_chain_node.components_builder())
.with_add_ons(world_chain_node.add_ons())
.extend_rpc_modules(move |ctx| {
let provider = ctx.provider().clone();
Expand Down
4 changes: 2 additions & 2 deletions world-chain-builder/crates/world/pool/src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use super::error::WorldChainTransactionPoolError;
/// The slot of the `_latestRoot` in the
///
/// [WorldID contract](https://github.com/worldcoin/world-id-state-bridge/blob/729d2346a3bb6bac003284bdcefc0cf12ece3f7d/src/abstract/WorldIDBridge.sol#L30)
pub const LATEST_ROOT_SLOT: U256 = U256::from_limbs([2, 0, 0, 0]);
pub const LATEST_ROOT_SLOT: U256 = U256::from_limbs([1, 0, 0, 0]);
/// Root Expiration Period
pub const ROOT_EXPIRATION_WINDOW: u64 = 60 * 60; // 1 hour
pub const ROOT_EXPIRATION_WINDOW: u64 = 60 * 60 * 24 * 7; // 1 Week

/// A provider for managing and validating World Chain roots.
#[derive(Debug, Clone)]
Expand Down

0 comments on commit b7ece35

Please sign in to comment.