Skip to content

Commit c048ada

Browse files
committed
minor: fix linter errors
1 parent f51df57 commit c048ada

1 file changed

Lines changed: 35 additions & 12 deletions

File tree

tests/transactions/confidential_mpt.rs

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ use crate::common::{
1616
};
1717
use xrpl::asynch::account::get_next_valid_seq_number;
1818
use xrpl::asynch::clients::AsyncJsonRpcClient;
19-
use xrpl::mpt_crypto::{Privkey, Pubkey};
2019
use xrpl::models::transactions::confidential_mpt_clawback::ConfidentialMPTClawback;
2120
use xrpl::models::transactions::confidential_mpt_convert::ConfidentialMPTConvert;
2221
use xrpl::models::transactions::confidential_mpt_convert_back::ConfidentialMPTConvertBack;
2322
use xrpl::models::transactions::confidential_mpt_merge_inbox::ConfidentialMPTMergeInbox;
2423
use xrpl::models::transactions::confidential_mpt_send::ConfidentialMPTSend;
24+
use xrpl::mpt_crypto::{Privkey, Pubkey};
2525
use xrpl::wallet::Wallet;
2626

2727
// Fee for the prerequisite MPT transactions. None of these transactors
@@ -83,15 +83,19 @@ async fn rpc(body: serde_json::Value) -> serde_json::Value {
8383
/// Submit a server-signed `tx_json` (`secret` = wallet seed), assert
8484
/// `tesSUCCESS`, and advance the ledger. Used only for prerequisite setup.
8585
async fn submit_signed(seed: &str, tx_json: serde_json::Value) {
86-
let tx_type = tx_json["TransactionType"].as_str().unwrap_or("?").to_string();
86+
let tx_type = tx_json["TransactionType"]
87+
.as_str()
88+
.unwrap_or("?")
89+
.to_string();
8790
let result = rpc(serde_json::json!({
8891
"method": "submit",
8992
"params": [{ "secret": seed, "tx_json": tx_json }],
9093
}))
9194
.await;
9295
let code = result["engine_result"].as_str().unwrap_or("<none>");
9396
assert_eq!(
94-
code, "tesSUCCESS",
97+
code,
98+
"tesSUCCESS",
9599
"prerequisite {tx_type} failed: {code} — {}",
96100
result["engine_result_message"].as_str().unwrap_or("")
97101
);
@@ -299,10 +303,13 @@ fn build_convert_material(
299303

300304
let account = account_id_bytes(holder_account);
301305
let issuance = issuance_id_bytes(issuance_id_hex);
302-
let ctx = context::convert(&AccountId::new(account), &IssuanceId::new(issuance), sequence)
303-
.expect("convert context hash");
304-
let proof =
305-
prove::convert(holder_elgamal_sk, holder_elgamal_pk, &ctx).expect("convert proof");
306+
let ctx = context::convert(
307+
&AccountId::new(account),
308+
&IssuanceId::new(issuance),
309+
sequence,
310+
)
311+
.expect("convert context hash");
312+
let proof = prove::convert(holder_elgamal_sk, holder_elgamal_pk, &ctx).expect("convert proof");
306313

307314
ConfidentialMPTConvertBundle {
308315
holder_encrypted_amount: uppercase_hex(holder_ct.as_bytes()),
@@ -422,7 +429,10 @@ async fn confidential_mpt_convert() {
422429
.expect("ConfidentialBalanceInbox present"),
423430
&setup.holder_elgamal_sk,
424431
);
425-
assert_eq!(inbox, amount, "confidential inbox should decrypt to {amount}");
432+
assert_eq!(
433+
inbox, amount,
434+
"confidential inbox should decrypt to {amount}"
435+
);
426436
})
427437
.await;
428438
}
@@ -456,7 +466,10 @@ async fn confidential_mpt_merge_inbox() {
456466
.expect("ConfidentialBalanceInbox present"),
457467
&setup.holder_elgamal_sk,
458468
);
459-
assert_eq!(spending, amount, "spending should decrypt to {amount} after merge");
469+
assert_eq!(
470+
spending, amount,
471+
"spending should decrypt to {amount} after merge"
472+
);
460473
assert_eq!(inbox, 0, "inbox should decrypt to 0 (reset) after merge");
461474
// The first Convert leaves the version at 0 (omitted); MergeInbox bumps it.
462475
assert_eq!(
@@ -517,7 +530,10 @@ async fn confidential_mpt_clawback() {
517530
.expect("ConfidentialBalanceInbox present"),
518531
&setup.holder_elgamal_sk,
519532
);
520-
assert_eq!(inbox, 0, "clawback should zero the holder's confidential inbox");
533+
assert_eq!(
534+
inbox, 0,
535+
"clawback should zero the holder's confidential inbox"
536+
);
521537
})
522538
.await;
523539
}
@@ -781,8 +797,15 @@ async fn confidential_mpt_send() {
781797
get_next_valid_seq_number(setup.holder.classic_address.clone().into(), client, None)
782798
.await
783799
.expect("fetch sender sequence");
784-
let m = build_send_material(&setup, &dest.classic_address, &dest_pk, sequence, amount, sender_balance)
785-
.await;
800+
let m = build_send_material(
801+
&setup,
802+
&dest.classic_address,
803+
&dest_pk,
804+
sequence,
805+
amount,
806+
sender_balance,
807+
)
808+
.await;
786809

787810
let mut tx = ConfidentialMPTSend::new(
788811
setup.holder.classic_address.clone().into(),

0 commit comments

Comments
 (0)