Skip to content

Commit

Permalink
Txn emitter changes for it to be used for bulk emitter script (aptos-…
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-aptos authored Jul 2, 2024
1 parent 35202bd commit 075f189
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 236 deletions.
2 changes: 1 addition & 1 deletion crates/transaction-emitter-lib/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub struct EmitArgs {

#[clap(long, default_value = "false")]
/// Skip minting account during initialization
pub skip_minting_accounts: bool,
pub skip_funding_accounts: bool,

#[clap(long)]
pub latency_polling_interval_s: Option<f32>,
Expand Down
23 changes: 3 additions & 20 deletions crates/transaction-emitter-lib/src/cluster.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

use crate::{emitter::query_sequence_number, instance::Instance, ClusterArgs};
use crate::{emitter::load_specific_account, instance::Instance, ClusterArgs};
use anyhow::{anyhow, bail, format_err, Result};
use aptos_crypto::{
ed25519::{Ed25519PrivateKey, Ed25519PublicKey},
test_utils::KeyPair,
};
use aptos_logger::{info, warn};
use aptos_rest_client::{Client as RestClient, State};
use aptos_sdk::types::{
account_config::aptos_test_root_address, chain_id::ChainId, AccountKey, LocalAccount,
};
use aptos_sdk::types::{chain_id::ChainId, AccountKey, LocalAccount};
use futures::{stream::FuturesUnordered, StreamExt};
use rand::seq::SliceRandom;
use std::{convert::TryFrom, time::Instant};
Expand Down Expand Up @@ -200,22 +198,7 @@ impl Cluster {
}

pub async fn load_coin_source_account(&self, client: &RestClient) -> Result<LocalAccount> {
let account_key = self.account_key();
let address = if self.coin_source_is_root {
aptos_test_root_address()
} else {
account_key.authentication_key().account_address()
};

let sequence_number = query_sequence_number(client, address).await.map_err(|e| {
format_err!(
"query_sequence_number on {:?} for account {} failed: {:?}",
client,
address,
e
)
})?;
Ok(LocalAccount::new(address, account_key, sequence_number))
load_specific_account(self.account_key(), self.coin_source_is_root, client).await
}

pub fn random_instance(&self) -> Instance {
Expand Down
Loading

0 comments on commit 075f189

Please sign in to comment.