feat: use human-readable byte sizes and durations

This commit is contained in:
Daniil Polyakov
2026-02-26 16:25:24 +03:00
parent 8b5524901c
commit 437e5addb4
35 changed files with 154 additions and 134 deletions
+3 -3
View File
@@ -16,7 +16,7 @@ async fn reject_oversized_transaction() -> Result<()> {
max_num_tx_in_block: 100,
max_block_size: ByteSize::mib(1),
mempool_max_size: 1000,
block_create_timeout_millis: 10_000,
block_create_timeout: Duration::from_secs(10),
})
.build()
.await?;
@@ -57,7 +57,7 @@ async fn accept_transaction_within_limit() -> Result<()> {
max_num_tx_in_block: 100,
max_block_size: ByteSize::mib(1),
mempool_max_size: 1000,
block_create_timeout_millis: 10_000,
block_create_timeout: Duration::from_secs(10),
})
.build()
.await?;
@@ -99,7 +99,7 @@ async fn transaction_deferred_to_next_block_when_current_full() -> Result<()> {
max_num_tx_in_block: 100,
max_block_size: block_size,
mempool_max_size: 1000,
block_create_timeout_millis: 10_000,
block_create_timeout: Duration::from_secs(10),
})
.build()
.await?;
+7 -7
View File
@@ -8,22 +8,22 @@ use wallet::cli::{Command, config::ConfigSubcommand};
async fn modify_config_field() -> Result<()> {
let mut ctx = TestContext::new().await?;
let old_seq_poll_timeout_millis = ctx.wallet().config().seq_poll_timeout_millis;
let old_seq_poll_timeout = ctx.wallet().config().seq_poll_timeout;
// Change config field
let command = Command::Config(ConfigSubcommand::Set {
key: "seq_poll_timeout_millis".to_string(),
value: "1000".to_string(),
key: "seq_poll_timeout".to_string(),
value: "1s".to_string(),
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
let new_seq_poll_timeout_millis = ctx.wallet().config().seq_poll_timeout_millis;
assert_eq!(new_seq_poll_timeout_millis, 1000);
let new_seq_poll_timeout = ctx.wallet().config().seq_poll_timeout;
assert_eq!(new_seq_poll_timeout, std::time::Duration::from_secs(1));
// Return how it was at the beginning
let command = Command::Config(ConfigSubcommand::Set {
key: "seq_poll_timeout_millis".to_string(),
value: old_seq_poll_timeout_millis.to_string(),
key: "seq_poll_timeout".to_string(),
value: format!("{:?}", old_seq_poll_timeout),
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
+1 -1
View File
@@ -181,7 +181,7 @@ impl TpsTestManager {
max_num_tx_in_block: 300,
max_block_size: ByteSize::mb(500),
mempool_max_size: 10_000,
block_create_timeout_millis: 12_000,
block_create_timeout: Duration::from_secs(12),
}
}
}