diff --git a/crates/hyle-loadtest/Cargo.toml b/crates/hyle-loadtest/Cargo.toml new file mode 100644 index 00000000..abe956c6 --- /dev/null +++ b/crates/hyle-loadtest/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "hyle-loadtest" +version.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +goose = "^0.17" +serde_json = "1.0.133" +tokio = "^1.12" +hyle = { path = "../../" } +# hyllar = { path = "../../contracts/hyllar" } +# amm = { path = "../../contracts/amm" } +# hydentity = { path = "../../contracts/hydentity" } +hyle-contract-sdk = { path = "../../contract-sdk", features = ["tracing"] } diff --git a/crates/hyle-loadtest/src/main.rs b/crates/hyle-loadtest/src/main.rs new file mode 100644 index 00000000..8f71aab3 --- /dev/null +++ b/crates/hyle-loadtest/src/main.rs @@ -0,0 +1,36 @@ +use goose::prelude::*; +use hyle::model::{BlobTransaction, ContractName}; +use hyle_contract_sdk::identity_provider::IdentityAction; + +async fn register_user(user: &mut GooseUser) -> TransactionResult { + for i in 0..10000 { + let identity = format!("identity-{}.hydentity", i); + + // Register identity + let blobs = vec![IdentityAction::RegisterIdentity { + account: identity.clone(), + } + .as_blob(ContractName("hydentity".to_owned()))]; + + let register_identity_blob_transaction = BlobTransaction { + identity: identity.into(), + blobs, + }; + user.post_json("/v1/tx/send/blob", ®ister_identity_blob_transaction) + .await?; + } + Ok(()) +} + +#[tokio::main] +async fn main() -> Result<(), GooseError> { + GooseAttack::initialize()? + .register_scenario( + scenario!("RegisterUsersBlobTransactions") + .register_transaction(transaction!(register_user)), + ) + .execute() + .await?; + + Ok(()) +}