Skip to content

Commit

Permalink
fixup! Fixes benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
grarco committed Jan 26, 2024
1 parent ca39540 commit c1e43f6
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions crates/apps/src/lib/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ static SHELL_INIT: Once = Once::new();

pub struct BenchShell {
pub inner: Shell,
// Cache of the masp transactions in the last block committed, the tx index
// coincides with the index in this collection
pub last_block_masp_txs: Vec<Tx>,
// Cache of the masp txs changed keys in the last block committed
pub last_block_masp_txs_changed_keys: Vec<BTreeSet<Key>>,
// Cache of the masp transactions and their changed keys in the last block
// committed, the tx index coincides with the index in this collection
pub last_block_masp_txs: Vec<(Tx, BTreeSet<Key>)>,
// NOTE: Temporary directory should be dropped last since Shell need to
// flush data on drop
tempdir: TempDir,
Expand Down Expand Up @@ -174,7 +172,6 @@ impl Default for BenchShell {
let mut bench_shell = BenchShell {
inner: shell,
last_block_masp_txs: vec![],
last_block_masp_txs_changed_keys: vec![],
tempdir,
};

Expand Down Expand Up @@ -577,9 +574,8 @@ impl BenchShell {
// Commit a masp transaction and cache the tx and the changed keys for
// client queries
pub fn commit_masp_tx(&mut self, masp_tx: Tx) {
self.last_block_masp_txs_changed_keys
.push(self.wl_storage.write_log.get_keys());
self.last_block_masp_txs.push(masp_tx);
self.last_block_masp_txs
.push((masp_tx, self.wl_storage.write_log.get_keys()));
self.wl_storage.commit_tx();
}
}
Expand Down Expand Up @@ -810,7 +806,10 @@ impl Client for BenchShell {
evidence_hash: None,
proposer_address: tendermint::account::Id::new([0u8; 20]),
},
last_block_txs.into_iter().map(|tx| tx.to_bytes()).collect(),
last_block_txs
.into_iter()
.map(|(tx, _)| tx.to_bytes())
.collect(),
tendermint::evidence::List::default(),
None,
)
Expand Down Expand Up @@ -840,7 +839,6 @@ impl Client for BenchShell {
Some(
self.last_block_masp_txs
.iter()
.zip(self.last_block_masp_txs_changed_keys.iter())
.enumerate()
.map(|(idx, (_tx, changed_keys))| {
let tx_result = TxResult {
Expand Down

0 comments on commit c1e43f6

Please sign in to comment.