Skip to content

Commit 75d773b

Browse files
feat: make the make_it_rain submission rate a float (#6180)
Description --- - This PR will allow a wider transaction submission rate for the make-it-rain tests. - Also fixed cucumber tests where it needed to detect transactions with a certain status. This was needed to fix the make-it-rain cucumber test. Motivation and Context --- A transaction submission fractional rate of between 1 and 2 txns/s is required for extended stress tests. How Has This Been Tested? --- Cucumber test `Scenario: As a user I want to make-it-rain via command line` What process can a PR reviewer use to test or verify this change? --- Cucumber test `Scenario: As a user I want to make-it-rain via command line` <!-- Checklist --> <!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. --> Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain -->
1 parent 464f2c3 commit 75d773b

16 files changed

+158
-120
lines changed

applications/minotari_console_wallet/src/automation/commands.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ pub async fn discover_peer(
351351
pub async fn make_it_rain(
352352
wallet_transaction_service: TransactionServiceHandle,
353353
fee_per_gram: u64,
354-
transactions_per_second: u32,
354+
transactions_per_second: f64,
355355
duration: Duration,
356356
start_amount: MicroMinotari,
357357
increase_amount: MicroMinotari,
@@ -360,6 +360,13 @@ pub async fn make_it_rain(
360360
transaction_type: MakeItRainTransactionType,
361361
message: String,
362362
) -> Result<(), CommandError> {
363+
// Limit the transactions per second to a reasonable range
364+
// Notes:
365+
// - The 'transactions_per_second' is best effort and not guaranteed.
366+
// - If a slower rate is requested as what is achievable, transactions will be delayed to match the rate.
367+
// - If a faster rate is requested as what is achievable, the maximum rate will be that of the integrated system.
368+
// - The default value of 25/s may not be achievable.
369+
let transactions_per_second = transactions_per_second.abs().max(0.01).min(250.0);
363370
// We are spawning this command in parallel, thus not collecting transaction IDs
364371
tokio::task::spawn(async move {
365372
// Wait until specified test start time
@@ -380,7 +387,7 @@ pub async fn make_it_rain(
380387
);
381388
sleep(Duration::from_millis(delay_ms)).await;
382389

383-
let num_txs = (f64::from(transactions_per_second) * duration.as_secs() as f64) as usize;
390+
let num_txs = (transactions_per_second * duration.as_secs() as f64) as usize;
384391
let started_at = Utc::now();
385392

386393
struct TransactionSendStats {
@@ -411,7 +418,7 @@ pub async fn make_it_rain(
411418

412419
// Manage transaction submission rate
413420
let actual_ms = (Utc::now() - started_at).num_milliseconds();
414-
let target_ms = (i as f64 * (1000.0 / f64::from(transactions_per_second))) as i64;
421+
let target_ms = (i as f64 * (1000.0 / transactions_per_second)) as i64;
415422
trace!(
416423
target: LOG_TARGET,
417424
"make-it-rain {}: target {:?} ms vs. actual {:?} ms", i, target_ms, actual_ms

applications/minotari_console_wallet/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ pub struct MakeItRainArgs {
163163
pub destination: TariAddress,
164164
#[clap(short, long, alias="amount", default_value_t = tari_amount::T)]
165165
pub start_amount: MicroMinotari,
166-
#[clap(short, long, alias = "tps", default_value_t = 25)]
167-
pub transactions_per_second: u32,
166+
#[clap(short, long, alias = "tps", default_value_t = 25.0)]
167+
pub transactions_per_second: f64,
168168
#[clap(short, long, parse(try_from_str = parse_duration), default_value="60")]
169169
pub duration: Duration,
170170
#[clap(long, default_value_t=tari_amount::T)]

applications/minotari_console_wallet/src/grpc/wallet_grpc_server.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -736,26 +736,31 @@ impl wallet_server::Wallet for WalletGrpcServer {
736736
) -> Result<Response<Self::GetCompletedTransactionsStream>, Status> {
737737
debug!(
738738
target: LOG_TARGET,
739-
"Incoming GRPC request for GetAllCompletedTransactions"
739+
"GetAllCompletedTransactions: Incoming GRPC request"
740740
);
741741
let mut transaction_service = self.get_transaction_service();
742742
let transactions = transaction_service
743743
.get_completed_transactions()
744744
.await
745745
.map_err(|err| Status::not_found(format!("No completed transactions found: {:?}", err)))?;
746+
debug!(
747+
target: LOG_TARGET,
748+
"GetAllCompletedTransactions: Found {} completed transactions",
749+
transactions.len()
750+
);
746751

747752
let (mut sender, receiver) = mpsc::channel(transactions.len());
748753
task::spawn(async move {
749-
for (_, txn) in transactions {
754+
for (i, (_, txn)) in transactions.iter().enumerate() {
750755
let response = GetCompletedTransactionsResponse {
751756
transaction: Some(TransactionInfo {
752757
tx_id: txn.tx_id.into(),
753758
source_address: txn.source_address.to_bytes().to_vec(),
754759
dest_address: txn.destination_address.to_bytes().to_vec(),
755-
status: TransactionStatus::from(txn.status) as i32,
760+
status: TransactionStatus::from(txn.status.clone()) as i32,
756761
amount: txn.amount.into(),
757762
is_cancelled: txn.cancelled.is_some(),
758-
direction: TransactionDirection::from(txn.direction) as i32,
763+
direction: TransactionDirection::from(txn.direction.clone()) as i32,
759764
fee: txn.fee.into(),
760765
timestamp: txn.timestamp.timestamp() as u64,
761766
excess_sig: txn
@@ -764,11 +769,19 @@ impl wallet_server::Wallet for WalletGrpcServer {
764769
.unwrap_or(&Signature::default())
765770
.get_signature()
766771
.to_vec(),
767-
message: txn.message,
772+
message: txn.message.clone(),
768773
}),
769774
};
770775
match sender.send(Ok(response)).await {
771-
Ok(_) => (),
776+
Ok(_) => {
777+
debug!(
778+
target: LOG_TARGET,
779+
"GetAllCompletedTransactions: Sent transaction TxId: {} ({} of {})",
780+
txn.tx_id,
781+
i + 1,
782+
transactions.len()
783+
);
784+
},
772785
Err(err) => {
773786
warn!(target: LOG_TARGET, "Error sending transaction via GRPC: {}", err);
774787
match sender.send(Err(Status::unknown("Error sending data"))).await {

integration_tests/tests/features/StressTest.feature

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ Feature: Stress Test
2222
# When mining node MINER mines 3 blocks
2323
# When mining node MINER mines <NumCoinsplitsNeeded> blocks
2424
# Then all nodes are on the same chain tip
25-
# Then wallet WALLET_A detects all transactions as Mined_or_Faux_Confirmed
25+
# Then wallet WALLET_A detects all transactions as Mined_or_OneSidedConfirmed
2626
# When I send <NumTransactions> transactions of 1111 uT each from wallet WALLET_A to wallet WALLET_B at fee_per_gram 4
2727
# # Mine enough blocks for the first block of transactions to be confirmed.
2828
# When mining node MINER mines 4 blocks
2929
# Then all nodes are on the same chain tip
3030
# # Now wait until all transactions are detected as confirmed in WALLET_A, continue to mine blocks if transactions
3131
# # are not found to be confirmed as sometimes the previous mining occurs faster than transactions are submitted
3232
# # to the mempool
33-
# Then while mining via SHA3 miner MINER all transactions in wallet WALLET_A are found to be Mined_or_Faux_Confirmed
34-
# # Then wallet WALLET_B detects all transactions as Mined_or_Faux_Confirmed
35-
# Then while mining via node NODE1 all transactions in wallet WALLET_B are found to be Mined_or_Faux_Confirmed
33+
# Then while mining via SHA3 miner MINER all transactions in wallet WALLET_A are found to be Mined_or_OneSidedConfirmed
34+
# # Then wallet WALLET_B detects all transactions as Mined_or_OneSidedConfirmed
35+
# Then while mining via node NODE1 all transactions in wallet WALLET_B are found to be Mined_or_OneSidedConfirmed
3636

3737
# @flaky
3838
# Examples:
@@ -71,14 +71,14 @@ Feature: Stress Test
7171
# When mining node MINER mines 8 blocks
7272

7373
# Then all nodes are on the same chain tip
74-
# Then wallet WALLET_A detects all transactions as Mined_or_Faux_Confirmed
74+
# Then wallet WALLET_A detects all transactions as Mined_or_OneSidedConfirmed
7575
# When I send 2000 transactions of 1111 uT each from wallet WALLET_A to wallet WALLET_B at fee_per_gram 4
7676
# # Mine enough blocks for the first block of transactions to be confirmed.
7777
# When mining node MINER mines 4 blocks
7878
# Then all nodes are on the same chain tip
7979
# # Now wait until all transactions are detected as confirmed in WALLET_A, continue to mine blocks if transactions
8080
# # are not found to be confirmed as sometimes the previous mining occurs faster than transactions are submitted
8181
# # to the mempool
82-
# Then while mining via SHA3 miner MINER all transactions in wallet WALLET_A are found to be Mined_or_Faux_Confirmed
83-
# # Then wallet WALLET_B detects all transactions as Mined_or_Faux_Confirmed
84-
# Then while mining via node NODE1 all transactions in wallet WALLET_B are found to be Mined_or_Faux_Confirmed
82+
# Then while mining via SHA3 miner MINER all transactions in wallet WALLET_A are found to be Mined_or_OneSidedConfirmed
83+
# # Then wallet WALLET_B detects all transactions as Mined_or_OneSidedConfirmed
84+
# Then while mining via node NODE1 all transactions in wallet WALLET_B are found to be Mined_or_OneSidedConfirmed

integration_tests/tests/features/TransactionInfo.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ Scenario: Get Transaction Info
2626
Then wallet WALLET_B detects all transactions are at least Broadcast
2727
When mining node MINER2 mines 1 blocks
2828
Then all nodes are at height 5
29-
Then wallet WALLET_A detects all transactions are at least Mined_or_Faux_Unconfirmed
30-
Then wallet WALLET_B detects all transactions are at least Mined_or_Faux_Unconfirmed
29+
Then wallet WALLET_A detects all transactions are at least Mined_or_OneSidedUnconfirmed
30+
Then wallet WALLET_B detects all transactions are at least Mined_or_OneSidedUnconfirmed
3131
When mining node MINER2 mines 10 blocks
3232
Then all nodes are at height 15
33-
Then wallet WALLET_A detects all transactions as Mined_or_Faux_Confirmed
34-
Then wallet WALLET_B detects all transactions as Mined_or_Faux_Confirmed
33+
Then wallet WALLET_A detects all transactions as Mined_or_OneSidedConfirmed
34+
Then wallet WALLET_B detects all transactions as Mined_or_OneSidedConfirmed
3535
# This wait is needed to stop base nodes from shutting down
3636
When I wait 1 seconds

integration_tests/tests/features/WalletCli.feature

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ Feature: Wallet CLI
8282
When I have mining node MINE connected to base node BASE and wallet SENDER
8383
When mining node MINE mines 15 blocks
8484
Then wallets SENDER should have AT_LEAST 12 spendable coinbase outputs
85-
When I wait 30 seconds
8685
Then I stop wallet SENDER
87-
When I make it rain from wallet SENDER 1 tx per sec 10 sec 8000 uT 100 increment to RECEIVER via command line
86+
When I make-it-rain from SENDER rate 10 txns_per_sec duration 1 sec value 8000 uT increment 100 uT to RECEIVER via command line
8887
Then wallet SENDER has at least 10 transactions that are all TRANSACTION_STATUS_BROADCAST and not cancelled
8988
Then wallet RECEIVER has at least 10 transactions that are all TRANSACTION_STATUS_BROADCAST and not cancelled
9089
When mining node MINE mines 5 blocks

integration_tests/tests/features/WalletFFI.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ Feature: Wallet FFI
202202
Then ffi wallet FFI_WALLET detects AT_LEAST 3 ffi transactions to be TRANSACTION_STATUS_BROADCAST
203203
When mining node MINER mines 2 blocks
204204
Then all nodes are at height 22
205-
Then wallet RECEIVER has at least 1 transactions that are all TRANSACTION_STATUS_FAUX_UNCONFIRMED and not cancelled
205+
Then wallet RECEIVER has at least 1 transactions that are all TRANSACTION_STATUS_ONE_SIDED_UNCONFIRMED and not cancelled
206206
When mining node MINER mines 5 blocks
207207
Then all nodes are at height 27
208-
Then wallet RECEIVER has at least 1 transactions that are all TRANSACTION_STATUS_FAUX_CONFIRMED and not cancelled
208+
Then wallet RECEIVER has at least 1 transactions that are all TRANSACTION_STATUS_ONE_SIDED_CONFIRMED and not cancelled
209209
And I stop ffi wallet FFI_WALLET
210210

211211
@critical @brokenFFI @broken
@@ -221,12 +221,12 @@ Feature: Wallet FFI
221221
Then I send a one-sided transaction of 1000000 uT from SENDER to FFI_RECEIVER at fee 20
222222
When mining node MINER mines 2 blocks
223223
Then all nodes are at height 12
224-
Then ffi wallet FFI_RECEIVER detects AT_LEAST 1 ffi transactions to be TRANSACTION_STATUS_FAUX_UNCONFIRMED
224+
Then ffi wallet FFI_RECEIVER detects AT_LEAST 1 ffi transactions to be TRANSACTION_STATUS_ONE_SIDED_UNCONFIRMED
225225
And I send 1000000 uT from wallet SENDER to wallet FFI_RECEIVER at fee 20
226226
Then ffi wallet FFI_RECEIVER detects AT_LEAST 1 ffi transactions to be TRANSACTION_STATUS_BROADCAST
227227
When mining node MINER mines 5 blocks
228228
Then all nodes are at height 17
229-
Then ffi wallet FFI_RECEIVER detects AT_LEAST 1 ffi transactions to be TRANSACTION_STATUS_FAUX_CONFIRMED
229+
Then ffi wallet FFI_RECEIVER detects AT_LEAST 1 ffi transactions to be TRANSACTION_STATUS_ONE_SIDED_CONFIRMED
230230
And I stop ffi wallet FFI_RECEIVER
231231

232232
Scenario: As a client I want to get fee per gram stats

integration_tests/tests/features/WalletMonitoring.feature

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Feature: Wallet Monitoring
2121
# And I list all COINBASE transactions for wallet WALLET_A1
2222
# Then wallet WALLET_A1 has 10 coinbase transactions
2323
# Then all COINBASE transactions for wallet WALLET_A1 are valid
24-
# Then wallet WALLET_A1 detects at least 7 coinbase transactions as Mined_or_Faux_Confirmed
24+
# Then wallet WALLET_A1 detects at least 7 coinbase transactions as CoinbaseConfirmed
2525
# #
2626
# # Chain 2:
2727
# # Collects 10 coinbases into one wallet
@@ -36,7 +36,7 @@ Feature: Wallet Monitoring
3636
# And I list all COINBASE transactions for wallet WALLET_B1
3737
# Then wallet WALLET_B1 has 10 coinbase transactions
3838
# Then all COINBASE transactions for wallet WALLET_B1 are valid
39-
# Then wallet WALLET_B1 detects at least 7 coinbase transactions as Mined_or_Faux_Confirmed
39+
# Then wallet WALLET_B1 detects at least 7 coinbase transactions as CoinbaseConfirmed
4040
# #
4141
# # Connect Chain 1 and 2
4242
# #
@@ -66,15 +66,15 @@ Feature: Wallet Monitoring
6666
# When mining node MINING_A mines 10 blocks with min difficulty 20 and max difficulty 9999999999
6767
# Then node SEED_A is at height 10
6868
# Then node NODE_A1 is at height 10
69-
# Then wallet WALLET_A1 detects exactly 7 coinbase transactions as Mined_or_Faux_Confirmed
69+
# Then wallet WALLET_A1 detects exactly 7 coinbase transactions as CoinbaseConfirmed
7070
# # Use 7 of the 10 coinbase UTXOs in transactions (others require 3 confirmations)
7171
# And I multi-send 7 transactions of 1000000 uT from wallet WALLET_A1 to wallet WALLET_A2 at fee 100
7272
# When mining node MINING_A mines 10 blocks with min difficulty 20 and max difficulty 9999999999
7373
# Then node SEED_A is at height 20
7474
# Then node NODE_A1 is at height 20
75-
# Then wallet WALLET_A2 detects all transactions as Mined_or_Faux_Confirmed
75+
# Then wallet WALLET_A2 detects all transactions as Mined_or_OneSidedConfirmed
7676
# Then all NORMAL transactions for wallet WALLET_A1 are valid
77-
# Then wallet WALLET_A1 detects exactly 17 coinbase transactions as Mined_or_Faux_Confirmed
77+
# Then wallet WALLET_A1 detects exactly 17 coinbase transactions as CoinbaseConfirmed
7878
# #
7979
# # Chain 2:
8080
# # Collects 10 coinbases into one wallet, send 7 transactions
@@ -88,15 +88,15 @@ Feature: Wallet Monitoring
8888
# When mining node MINING_B mines 10 blocks with min difficulty 1 and max difficulty 2
8989
# Then node SEED_B is at height 10
9090
# Then node NODE_B1 is at height 10
91-
# Then wallet WALLET_B1 detects exactly 7 coinbase transactions as Mined_or_Faux_Confirmed
91+
# Then wallet WALLET_B1 detects exactly 7 coinbase transactions as CoinbaseConfirmed
9292
# # Use 7 of the 10 coinbase UTXOs in transactions (others require 3 confirmations)
9393
# And I multi-send 7 transactions of 1000000 uT from wallet WALLET_B1 to wallet WALLET_B2 at fee 100
9494
# When mining node MINING_B mines 10 blocks with min difficulty 1 and max difficulty 2
9595
# Then node SEED_B is at height 20
9696
# Then node NODE_B1 is at height 20
97-
# Then wallet WALLET_B2 detects all transactions as Mined_or_Faux_Confirmed
97+
# Then wallet WALLET_B2 detects all transactions as Mined_or_OneSidedConfirmed
9898
# Then all NORMAL transactions for wallet WALLET_B1 are valid
99-
# Then wallet WALLET_B1 detects exactly 17 coinbase transactions as Mined_or_Faux_Confirmed
99+
# Then wallet WALLET_B1 detects exactly 17 coinbase transactions as CoinbaseConfirmed
100100
# #
101101
# # Connect Chain 1 and 2
102102
# #
@@ -105,8 +105,8 @@ Feature: Wallet Monitoring
105105
# # When tip advances past required confirmations, invalid coinbases still being monitored will be cancelled.
106106
# And mining node NODE_C mines 6 blocks
107107
# Then all nodes are at height 26
108-
# Then wallet WALLET_A1 detects exactly 20 coinbase transactions as Mined_or_Faux_Confirmed
109-
# Then wallet WALLET_B1 detects exactly 17 coinbase transactions as Mined_or_Faux_Confirmed
108+
# Then wallet WALLET_A1 detects exactly 20 coinbase transactions as CoinbaseConfirmed
109+
# Then wallet WALLET_B1 detects exactly 17 coinbase transactions as CoinbaseConfirmed
110110
# And I list all NORMAL transactions for wallet WALLET_A1
111111
# And I list all NORMAL transactions for wallet WALLET_B1
112112
# # Uncomment this step when wallets can handle reorg

integration_tests/tests/features/WalletQuery.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Feature: Wallet Querying
1212
When mining node MINER mines 5 blocks
1313
Then all nodes are at height 5
1414
When I mine 5 blocks on NODE
15-
Then all wallets detect all transactions as Mined_or_Faux_Confirmed
15+
Then all wallets detect all transactions as Mined_or_OneSidedConfirmed
1616

1717
@critical
1818
Scenario: As a wallet I want to submit a transaction
@@ -23,5 +23,5 @@ Feature: Wallet Querying
2323
When I wait 5 seconds
2424
When I transfer 5T from WALLET_A to WALLET_B
2525
When I mine 5 blocks on NODE
26-
Then all wallets detect all transactions as Mined_or_Faux_Confirmed
26+
Then all wallets detect all transactions as Mined_or_OneSidedConfirmed
2727

integration_tests/tests/features/WalletRoutingMechanism.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ Feature: Wallet Routing Mechanism
2323
When I wait 1 seconds
2424
# And mining node MINER mines 1 blocks
2525
# Then all nodes are at height 21
26-
# Then all wallets detect all transactions as Mined_or_Faux_Unconfirmed
26+
# Then all wallets detect all transactions as Mined_or_OneSidedUnconfirmed
2727
# # This wait is needed to stop next merge mining task from continuing
2828
When I wait 1 seconds
2929
# And mining node MINER mines 11 blocks
3030
# Then all nodes are at height 32
31-
# Then all wallets detect all transactions as Mined_or_Faux_Confirmed
31+
# Then all wallets detect all transactions as Mined_or_OneSidedConfirmed
3232
# This wait is needed to stop base nodes from shutting down
3333
When I wait 1 seconds
3434
# @long-running

0 commit comments

Comments
 (0)