Skip to content

Commit 113d025

Browse files
committed
Fix benchmarks
1 parent d7d744c commit 113d025

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

crates/node/src/bench_utils.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ impl BenchShieldedCtx {
12851285
token: address::testing::nam(),
12861286
amount: denominated_amount,
12871287
};
1288-
let shielded = async_runtime
1288+
let (shielded, fmd_flags) = async_runtime
12891289
.block_on(async {
12901290
let expiration =
12911291
Namada::tx_builder(&namada).expiration.to_datetime();
@@ -1307,14 +1307,12 @@ impl BenchShieldedCtx {
13071307
masp_tx,
13081308
metadata: _,
13091309
epoch: _,
1310-
fmd_flags: _,
1311-
}| masp_tx,
1310+
fmd_flags,
1311+
}| (masp_tx, fmd_flags),
13121312
)
13131313
.expect("MASP must have shielded part");
13141314

1315-
let fmd_section = Section::Data(Data::from_borsh_encoded(&vec![
1316-
FlagCiphertext::default(),
1317-
]));
1315+
let fmd_section = Section::Data(Data::from_borsh_encoded(&fmd_flags));
13181316
let shielded_data = MaspTxData {
13191317
masp_tx_id: shielded.txid().into(),
13201318
flag_ciphertext_sechash: fmd_section.get_hash(),
@@ -1431,9 +1429,16 @@ impl BenchShieldedCtx {
14311429
vec![vectorized_transfer.targets.into_iter().next().unwrap()]
14321430
.into_iter()
14331431
.collect();
1434-
let fmd_section = Section::Data(Data::from_borsh_encoded(&vec![
1435-
FlagCiphertext::default(),
1436-
]));
1432+
let masp_tx = tx.tx.get_masp_section(&masp_tx_id).unwrap().clone();
1433+
let fmd_section = Section::Data(Data::from_borsh_encoded(
1434+
&std::iter::repeat_with(FlagCiphertext::default)
1435+
.take(
1436+
masp_tx
1437+
.sapling_bundle()
1438+
.map_or(0, |x| x.shielded_outputs.len()),
1439+
)
1440+
.collect::<Vec<_>>(),
1441+
));
14371442
let transfer = Transfer {
14381443
sources,
14391444
targets,
@@ -1442,7 +1447,6 @@ impl BenchShieldedCtx {
14421447
flag_ciphertext_sechash: fmd_section.get_hash(),
14431448
}),
14441449
};
1445-
let masp_tx = tx.tx.get_masp_section(&masp_tx_id).unwrap().clone();
14461450
let msg = MsgTransfer::<token::Transfer> {
14471451
message: msg,
14481452
transfer: Some(transfer),

0 commit comments

Comments
 (0)