Skip to content

Commit 2c78856

Browse files
bertllllBert
and
Bert
authored
GH-629: Batch request for redeeming multiple payables + the payable and pending_payable machinary reworked to request the DB do multiple operations in a single transactions (#190)
* GH-629: basic structure exists * GH-629: interim commit * GH-629: test for the transfer of tokens via batch transport is roughly ready; detailed hash values will be added later * GH-629: main contoures made and will think how to finish it to the working state * GH-629: in the middle of big rearrangement of connections between types and errors and also continuing work on send_payables_within_batch * GH-629: finaly compiling; after a lot of changes in data structures; new error handling system * GH-629: problem with signed_transaction; now it seems like I cannot get it before I dispatch the batch out and wait for the response; will go on an experiment * GH-629: the base test is complete and passing... still a lot of work ahead * GH-629: another big test starts passing * GH-629: interim commit * GH-629: improving blockchain bridge and testing and testing, and... * GH-629: fixed a couple of things in the joint with blockcahin bridge; old BB tests are passing * GH-629: pretty printed error messages; very simple tests fixes, changing the way we ask about the nonce for upcoming transactions * GH-629: advancing it repairing tests; but also continuous refactoring imperfections and adding logs * GH-629: in the middle of the transition from one fingerprint processed in a time to group processing, on probably all related methods * GH-629: continuation of implementing batch like processing for payable DAO and pending payable DAO ... quite a lot of todostatus still left * GH-629: mark_pending_payable() is fully implemented, I'm gonna switch to a deal with delete_fingerprints() now * GH-629: fixing more paths in handle_sent_payable(); also finished delete_fingerprints(); next probably concerns about tx receipt methods * GH-629: in the middle of reconstructure of pending payable (receipts, etc...) methods, trying hard for simplification * GH-629: confirming txs, deleting and updating of fingerprints reimplemented; now before the cancelation process reconstruction * GH-629: all old tests fixed and some portion above; logging better setup, minor things * GH-629: removed optionality at fields * GH-629: last TODOs knocked off * GH-629: first repair after my auto review * GH-629: a few more corrections from an auto review * GH-629: later fixes after diving more into the code when GH didn't let the card go through; refactoring the blockchain interface batch function (especially handling the right initial nonce to start with) * GH-629: trying to find a way how to get the proper row changes count - hopwfully this prototype is that right away * GH-629: fix for multi-record update transaction; and streightening the existing tests for other multi operations * GH-629: added a performance test for multi-record update sql with a case statement in it * GH-629: extra helper for detecting panics connected to repeated payaments * GH-629: more accure testing of performance of multirow update sql * GH-629: my own remarks turned into modyfications as well as things from the Steve's review * GH-629: modifying test slightly to pass in Actions * GH-629: tuning performance tests in payable dao * GH-629: interim commit - a performance wise integration test half done for payable dao * GH-629: trying performance integration test in Actions * GH-629: another adjustment in the effort for making the integ test reliably run * GH-629: formatting * GH-629: another adjustmen; also loosser requirements within my coeficients * GH-629: another aproachment to the optimum; adding the fifth attempt to make the metrics brighter * GH-629: cleaning up aftereffects of the master merge; not finished. To be continued. * GH-629: finished merge of v0.7.0 and had to modify a couple of things to work properly; also added better explanation of ArbitraryIdStamp * GH-629: fixing conficts in multinode tests and formatting * GH-629: fixed platform specifically behaving test * GH-629: test fix and adjustment of another one * GH-629: I revamped the text explaining ArbitraryIdStamp and made the performance int test more predictable * GH-629: reduced some of the compilation errors considerably; nearing to the softest tissues and smallest nuances, huh; gonna call a plastic surgeon * GH-629: another portion of restored tests and some production code shifting and rewriting...still merging * GH-629: repaired scanners to the probable compilation state; progress on other places too but some discrepancy is remaining and overally not compilling * GH-629: failing tests almost resolved; a few last to go * GH-629: finally all test passing; but will have to go through todos I left behind * GH-629: fixed; now knocking off todos; before trying PendingPayableId with a constructor * GH-629: PendingPayableId constructor added * GH-629: new portion of killed todos and some refactoring...; going on is necessary though * GH-629: merging beleived done; but one integration test is failing * GH-629: one older integration test repaired * GH-629: removed tests to be worked out in a diff card; plus some cosmetics * GH-629: the first few things fixed * GH-629-Dan-review-two: interim commit * GH-629-Dan-review-two: a lot more fixed; a savepoint before trying to refactor too a long method * GH-629-Dan-review-two: Sorry, new MERGE OF MASTER is coming; otherwise more things from reviews addressed * GH-629-Dan-review-teo: another big chunk of fixed things for the review * GH-629-Dan-review-two: some more fixed items * GH-629-Dan-review-two: made error distinguishing eaiser and nicer for eyes; aslo fixed a bug in handle_report_accounts_payable * GH-629-Dan-review-two: a big bunch of other newly fixed things; a few tougher ones are left * GH-629-Dan-review-two: some significant refactoring of a DAO fn * GH-629-Dan-review-two: interim commit * GH-629-Dan-review-two: a save-point, still dealing with the finished review; fixing the space for failed transactions and their handling * GH-629-Dan-review-two: all I know of from the review is fixed by now * GH-629: accountant/dao_utils is fixed * GH-629: pending_payable_dao fixed * GH-629: mostly fixes of stuff tied up with scanners, daos and a little bit of blockcahin bridge * GH-629: error messaging for failed mark_pending_payables_rowids fixed * GH-629: added a few more fixes * GH-629: save point before trying to come up with better explanation of an arbitrary id * GH-629: last fixes, also better examples for how to implement ArbitraryIdStamp * GH-629: review 3 answered * GH-629: little fix in a test * GH-629: getting cargo files up to date in their version * GH-629: fixes for old bad comments * GH-629: found and fix issue in utils for special integration test without init config --------- Co-authored-by: Bert <[email protected]>
1 parent 2b02bc1 commit 2c78856

40 files changed

+5409
-2828
lines changed

automap/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dns_utility/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

masq/src/commands/financials_command/mod.rs

+67-36
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ mod tests {
328328
UiPayableAccount, UiReceivableAccount,
329329
};
330330
use masq_lib::ui_gateway::MessageBody;
331-
use masq_lib::utils::array_of_borrows_to_vec;
331+
use masq_lib::utils::slice_of_strs_to_vec_of_strings;
332332
use regex::Regex;
333333
use std::sync::{Arc, Mutex};
334334

@@ -375,7 +375,7 @@ mod tests {
375375
.transact_result(Ok(meaningless_financials_response()))
376376
.transact_params(&transact_params_arc);
377377
let subject = factory
378-
.make(&array_of_borrows_to_vec(&[
378+
.make(&slice_of_strs_to_vec_of_strings(&[
379379
"financials",
380380
"--top",
381381
"20",
@@ -412,7 +412,7 @@ mod tests {
412412
.transact_result(Ok(meaningless_financials_response()))
413413
.transact_params(&transact_params_arc);
414414
let subject = factory
415-
.make(&array_of_borrows_to_vec(&[
415+
.make(&slice_of_strs_to_vec_of_strings(&[
416416
"financials",
417417
"--top",
418418
"10",
@@ -449,7 +449,7 @@ mod tests {
449449
.transact_result(Ok(meaningless_financials_response()))
450450
.transact_params(&transact_params_arc);
451451
let subject = factory
452-
.make(&array_of_borrows_to_vec(&[
452+
.make(&slice_of_strs_to_vec_of_strings(&[
453453
"financials",
454454
"--payable",
455455
"200-450|480000-158000008",
@@ -494,7 +494,7 @@ mod tests {
494494
fn supplied_big_masq_values_are_not_fatal_for_non_decimal_values() {
495495
let factory = CommandFactoryReal::new();
496496
let result = factory
497-
.make(&array_of_borrows_to_vec(&[
497+
.make(&slice_of_strs_to_vec_of_strings(&[
498498
"financials",
499499
"--payable",
500500
"200-450|480000-15800000800045",
@@ -512,7 +512,7 @@ mod tests {
512512
fn supplied_big_masq_values_are_not_fatal_for_decimal_values() {
513513
let factory = CommandFactoryReal::new();
514514
let result = factory
515-
.make(&array_of_borrows_to_vec(&[
515+
.make(&slice_of_strs_to_vec_of_strings(&[
516516
"financials",
517517
"--payable",
518518
"200-450|480045454455.00-158000008000455",
@@ -534,7 +534,10 @@ mod tests {
534534
fn command_factory_no_stats_arg_is_forbidden_if_no_other_arg_present() {
535535
let factory = CommandFactoryReal::new();
536536

537-
let result = factory.make(&array_of_borrows_to_vec(&["financials", "--no-stats"]));
537+
let result = factory.make(&slice_of_strs_to_vec_of_strings(&[
538+
"financials",
539+
"--no-stats",
540+
]));
538541

539542
let err = match result {
540543
Err(CommandFactoryError::CommandSyntax(err_msg)) => err_msg,
@@ -556,7 +559,7 @@ mod tests {
556559
) {
557560
let factory = CommandFactoryReal::new();
558561

559-
let result = factory.make(&array_of_borrows_to_vec(args));
562+
let result = factory.make(&slice_of_strs_to_vec_of_strings(args));
560563

561564
let err = match result {
562565
Ok(_) => panic!("we expected error but got ok"),
@@ -634,7 +637,7 @@ mod tests {
634637
fn ordered_can_be_combined_with_top_records_only() {
635638
let factory = CommandFactoryReal::new();
636639

637-
let result = factory.make(&array_of_borrows_to_vec(&[
640+
let result = factory.make(&slice_of_strs_to_vec_of_strings(&[
638641
"financials",
639642
"--receivable",
640643
"5-100|600-7000",
@@ -661,8 +664,13 @@ mod tests {
661664

662665
#[test]
663666
fn ordered_have_just_two_possible_values() {
664-
let args =
665-
array_of_borrows_to_vec(&["financials", "--top", "11", "--ordered", "upside-down"]);
667+
let args = slice_of_strs_to_vec_of_strings(&[
668+
"financials",
669+
"--top",
670+
"11",
671+
"--ordered",
672+
"upside-down",
673+
]);
666674

667675
let result = financials_subcommand()
668676
.get_matches_from_safe(args)
@@ -688,8 +696,15 @@ mod tests {
688696
#[test]
689697
fn financials_command_allows_shorthands_including_top_records() {
690698
let transact_params_arc = Arc::new(Mutex::new(vec![]));
691-
let args =
692-
array_of_borrows_to_vec(&["financials", "-g", "-t", "123", "-o", "balance", "-n"]);
699+
let args = slice_of_strs_to_vec_of_strings(&[
700+
"financials",
701+
"-g",
702+
"-t",
703+
"123",
704+
"-o",
705+
"balance",
706+
"-n",
707+
]);
693708
let mut context = CommandContextMock::new()
694709
.transact_params(&transact_params_arc)
695710
.transact_result(Ok(meaningless_financials_response()));
@@ -719,7 +734,7 @@ mod tests {
719734
#[test]
720735
fn financials_command_allows_shorthands_including_custom_query() {
721736
let transact_params_arc = Arc::new(Mutex::new(vec![]));
722-
let args = array_of_borrows_to_vec(&[
737+
let args = slice_of_strs_to_vec_of_strings(&[
723738
"financials",
724739
"-g",
725740
"-p",
@@ -767,8 +782,14 @@ mod tests {
767782
#[test]
768783
fn financials_command_top_records_ordered_by_age_instead_of_balance() {
769784
let transact_params_arc = Arc::new(Mutex::new(vec![]));
770-
let args =
771-
array_of_borrows_to_vec(&["financials", "--no-stats", "--top", "7", "-o", "age"]);
785+
let args = slice_of_strs_to_vec_of_strings(&[
786+
"financials",
787+
"--no-stats",
788+
"--top",
789+
"7",
790+
"-o",
791+
"age",
792+
]);
772793
let mut context = CommandContextMock::new()
773794
.transact_params(&transact_params_arc)
774795
.transact_result(Ok(meaningless_financials_response()));
@@ -797,7 +818,7 @@ mod tests {
797818

798819
#[test]
799820
fn parse_top_records_arg_with_ordered_defaulted_to_balance() {
800-
let args = array_of_borrows_to_vec(&["financials", "--top", "11"]);
821+
let args = slice_of_strs_to_vec_of_strings(&["financials", "--top", "11"]);
801822
let matches = financials_subcommand().get_matches_from_safe(args).unwrap();
802823

803824
let result = FinancialsCommand::parse_top_records_args(&matches);
@@ -813,8 +834,11 @@ mod tests {
813834

814835
#[test]
815836
fn financials_command_allows_obscure_leading_zeros_in_positive_numbers() {
816-
let args =
817-
array_of_borrows_to_vec(&["financials", "--receivable", "05000-0010000|040-050"]);
837+
let args = slice_of_strs_to_vec_of_strings(&[
838+
"financials",
839+
"--receivable",
840+
"05000-0010000|040-050",
841+
]);
818842

819843
let result = FinancialsCommand::new(&args).unwrap();
820844

@@ -845,7 +869,11 @@ mod tests {
845869

846870
#[test]
847871
fn financials_command_allows_obscure_leading_zeros_in_negative_numbers() {
848-
let args = array_of_borrows_to_vec(&["financials", "--receivable", "5000-10000|-050--040"]);
872+
let args = slice_of_strs_to_vec_of_strings(&[
873+
"financials",
874+
"--receivable",
875+
"5000-10000|-050--040",
876+
]);
849877

850878
let result = FinancialsCommand::new(&args).unwrap();
851879

@@ -927,9 +955,12 @@ mod tests {
927955
#[test]
928956
fn are_both_sets_to_be_displayed_works_for_top_records() {
929957
//top records always print as a pair so it always consists of both sets
930-
let subject =
931-
FinancialsCommand::new(&array_of_borrows_to_vec(&["financials", "--top", "20"]))
932-
.unwrap();
958+
let subject = FinancialsCommand::new(&slice_of_strs_to_vec_of_strings(&[
959+
"financials",
960+
"--top",
961+
"20",
962+
]))
963+
.unwrap();
933964

934965
let result = subject.are_both_sets_to_be_displayed();
935966

@@ -938,7 +969,7 @@ mod tests {
938969

939970
#[test]
940971
fn are_both_sets_to_be_displayed_works_for_custom_query_with_only_payable() {
941-
let subject = FinancialsCommand::new(&array_of_borrows_to_vec(&[
972+
let subject = FinancialsCommand::new(&slice_of_strs_to_vec_of_strings(&[
942973
"financials",
943974
"--payable",
944975
"20-40|60-120",
@@ -952,7 +983,7 @@ mod tests {
952983

953984
#[test]
954985
fn are_both_sets_to_be_displayed_works_for_custom_query_with_only_receivable() {
955-
let subject = FinancialsCommand::new(&array_of_borrows_to_vec(&[
986+
let subject = FinancialsCommand::new(&slice_of_strs_to_vec_of_strings(&[
956987
"financials",
957988
"--receivable",
958989
"20-40|-50-120",
@@ -966,7 +997,7 @@ mod tests {
966997

967998
#[test]
968999
fn are_both_sets_to_be_displayed_works_for_custom_query_with_both_parts() {
969-
let subject = FinancialsCommand::new(&array_of_borrows_to_vec(&[
1000+
let subject = FinancialsCommand::new(&slice_of_strs_to_vec_of_strings(&[
9701001
"financials",
9711002
"--receivable",
9721003
"20-40|-50-120",
@@ -1043,7 +1074,7 @@ mod tests {
10431074
fn financials_command_stats_and_top_records_default_units_as_masq() {
10441075
let transact_params_arc = Arc::new(Mutex::new(vec![]));
10451076
let expected_response = response_with_stats_and_either_top_records_or_top_queries(true);
1046-
let args = array_of_borrows_to_vec(&["financials", "--top", "123"]);
1077+
let args = slice_of_strs_to_vec_of_strings(&["financials", "--top", "123"]);
10471078
let mut context = CommandContextMock::new()
10481079
.transact_params(&transact_params_arc)
10491080
.transact_result(Ok(expected_response.tmb(31)));
@@ -1104,7 +1135,7 @@ mod tests {
11041135
fn financials_command_stats_and_custom_query_demanded_default_units_as_masq() {
11051136
let transact_params_arc = Arc::new(Mutex::new(vec![]));
11061137
let expected_response = response_with_stats_and_either_top_records_or_top_queries(false);
1107-
let args = array_of_borrows_to_vec(&[
1138+
let args = slice_of_strs_to_vec_of_strings(&[
11081139
"financials",
11091140
"--payable",
11101141
"0-350000|0.005-9",
@@ -1179,7 +1210,7 @@ mod tests {
11791210
fn financials_command_statistics_and_top_records_with_gwei_precision() {
11801211
let transact_params_arc = Arc::new(Mutex::new(vec![]));
11811212
let expected_response = response_with_stats_and_either_top_records_or_top_queries(true);
1182-
let args = array_of_borrows_to_vec(&["financials", "--top", "123", "--gwei"]);
1213+
let args = slice_of_strs_to_vec_of_strings(&["financials", "--top", "123", "--gwei"]);
11831214
let mut context = CommandContextMock::new()
11841215
.transact_params(&transact_params_arc)
11851216
.transact_result(Ok(expected_response.tmb(31)));
@@ -1241,7 +1272,7 @@ mod tests {
12411272
fn financials_command_statistics_and_custom_query_with_gwei_precision() {
12421273
let transact_params_arc = Arc::new(Mutex::new(vec![]));
12431274
let expected_response = response_with_stats_and_either_top_records_or_top_queries(false);
1244-
let args = array_of_borrows_to_vec(&[
1275+
let args = slice_of_strs_to_vec_of_strings(&[
12451276
"financials",
12461277
"--payable",
12471278
"0-350000|0.005-9",
@@ -1333,7 +1364,7 @@ mod tests {
13331364
}]),
13341365
}),
13351366
};
1336-
let args = array_of_borrows_to_vec(&[
1367+
let args = slice_of_strs_to_vec_of_strings(&[
13371368
"financials",
13381369
"--payable",
13391370
"0-350000|5",
@@ -1408,7 +1439,7 @@ mod tests {
14081439
receivable_opt: Some(vec![]),
14091440
}),
14101441
};
1411-
let args = array_of_borrows_to_vec(&["financials", "--top", "10"]);
1442+
let args = slice_of_strs_to_vec_of_strings(&["financials", "--top", "10"]);
14121443
let mut context = CommandContextMock::new()
14131444
.transact_params(&transact_params_arc)
14141445
.transact_result(Ok(expected_response.tmb(31)));
@@ -1485,7 +1516,7 @@ mod tests {
14851516
receivable_opt: None,
14861517
}),
14871518
};
1488-
let args = array_of_borrows_to_vec(&[
1519+
let args = slice_of_strs_to_vec_of_strings(&[
14891520
"financials",
14901521
"--payable",
14911522
"0-400000|355-6000",
@@ -1598,7 +1629,7 @@ mod tests {
15981629
]),
15991630
}),
16001631
};
1601-
let args = array_of_borrows_to_vec(&["financials", "--no-stats", "--top", "7"]);
1632+
let args = slice_of_strs_to_vec_of_strings(&["financials", "--no-stats", "--top", "7"]);
16021633
let mut context = CommandContextMock::new()
16031634
.transact_params(&transact_params_arc)
16041635
.transact_result(Ok(expected_response.tmb(31)));
@@ -1679,7 +1710,7 @@ mod tests {
16791710
receivable_opt: None,
16801711
}),
16811712
};
1682-
let args = array_of_borrows_to_vec(&[
1713+
let args = slice_of_strs_to_vec_of_strings(&[
16831714
"financials",
16841715
"--payable",
16851716
"3000-40000|88-1000",
@@ -1755,7 +1786,7 @@ mod tests {
17551786
]),
17561787
}),
17571788
};
1758-
let args = array_of_borrows_to_vec(&[
1789+
let args = slice_of_strs_to_vec_of_strings(&[
17591790
"financials",
17601791
"--no-stats",
17611792
"--receivable",

masq/src/terminal/terminal_interface.rs

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ impl TerminalWrapper {
134134
Self::configure_interface_generic(Box::new(Self::result_wrapper_for_in_memory_terminal))
135135
}
136136

137-
#[allow(clippy::unnecessary_wraps)]
138137
pub fn result_wrapper_for_in_memory_terminal() -> std::io::Result<test_cfg::MemoryTerminal> {
139138
Ok(test_cfg::MemoryTerminal::new())
140139
}

masq_lib/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub fn exit_process_with_sigterm(message: &str) {
271271
}
272272
}
273273

274-
pub fn array_of_borrows_to_vec(slice: &[&str]) -> Vec<String> {
274+
pub fn slice_of_strs_to_vec_of_strings(slice: &[&str]) -> Vec<String> {
275275
slice
276276
.iter()
277277
.map(|item| item.to_string())

multinode_integration_tests/tests/verify_bill_payment.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -409,19 +409,18 @@ fn build_config(
409409
payment_thresholds: PaymentThresholds,
410410
wallet_derivation_path: String,
411411
) -> (NodeStartupConfig, Wallet) {
412-
let (serving_node_wallet, serving_node_secret) =
413-
make_node_wallet(seed, wallet_derivation_path.as_str());
412+
let (node_wallet, node_secret) = make_node_wallet(seed, wallet_derivation_path.as_str());
414413
let config = NodeStartupConfigBuilder::standard()
415414
.blockchain_service_url(server_url_holder.url())
416415
.chain(Chain::Dev)
417416
.payment_thresholds(payment_thresholds)
418-
.consuming_wallet_info(ConsumingWalletInfo::PrivateKey(serving_node_secret))
417+
.consuming_wallet_info(ConsumingWalletInfo::PrivateKey(node_secret))
419418
.earning_wallet_info(EarningWalletInfo::Address(format!(
420419
"{}",
421-
serving_node_wallet.clone()
420+
node_wallet.clone()
422421
)))
423422
.build();
424-
(config, serving_node_wallet)
423+
(config, node_wallet)
425424
}
426425

427426
fn expire_payables(path: PathBuf) {

0 commit comments

Comments
 (0)