Skip to content

Commit

Permalink
fix: fix benches
Browse files Browse the repository at this point in the history
  • Loading branch information
jjyr committed May 10, 2022
1 parent 55f9e9c commit 21e16a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
11 changes: 2 additions & 9 deletions crates/benches/benches/benchmarks/smt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,10 @@ impl BenchExecutionEnvironment {

let run_result = self
.generator
.execute_transaction(
&self.chain,
&state,
&block_info,
&raw_tx,
L2TX_MAX_CYCLES,
None,
)
.execute_transaction(&self.chain, &state, &block_info, &raw_tx, L2TX_MAX_CYCLES)
.unwrap();

state.apply_run_result(&run_result).unwrap();
state.apply_run_result(&run_result.write).unwrap();

from_id += 1;
if from_id > end_account_id {
Expand Down
15 changes: 5 additions & 10 deletions crates/benches/benches/benchmarks/sudt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,10 @@ fn run_contract_get_result<S: State + CodeStore>(
};
let generator = Generator::new(backend_manage, account_lock_manage, rollup_ctx);
let chain_view = DummyChainStore;
let run_result = generator.execute_transaction(
&chain_view,
tree,
block_info,
&raw_tx,
L2TX_MAX_CYCLES,
None,
)?;
tree.apply_run_result(&run_result).expect("update state");
let run_result =
generator.execute_transaction(&chain_view, tree, block_info, &raw_tx, L2TX_MAX_CYCLES)?;
tree.apply_run_result(&run_result.write)
.expect("update state");
Ok(run_result)
}

Expand All @@ -109,7 +104,7 @@ fn run_contract<S: State + CodeStore>(
) -> Result<Vec<u8>, TransactionError> {
let run_result =
run_contract_get_result(rollup_config, tree, from_id, to_id, args, block_info)?;
Ok(run_result.return_data)
Ok(run_result.return_data.to_vec())
}

pub fn bench(c: &mut Criterion) {
Expand Down

0 comments on commit 21e16a3

Please sign in to comment.