From 0c9cf1cfcf9a1839ba77c6bfb9f596c9c6e3aa69 Mon Sep 17 00:00:00 2001 From: Zhang Zhuo Date: Wed, 5 Jan 2022 18:00:32 +0800 Subject: [PATCH] fix tx_convert in witness (#261) * fix tx_convert in witness * simplify code --- bus-mapping/src/eth_types.rs | 2 +- zkevm-circuits/src/evm_circuit/witness.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bus-mapping/src/eth_types.rs b/bus-mapping/src/eth_types.rs index 96c98cb337..72e27e459a 100644 --- a/bus-mapping/src/eth_types.rs +++ b/bus-mapping/src/eth_types.rs @@ -330,7 +330,7 @@ pub struct GethExecTrace { /// Truncate the memory in each step to the memory size before the step is /// executed (and before the memory is expanded). This is required because geth -/// sets the memory in each step as the memroy before execution but after +/// sets the memory in each step as the memory before execution but after /// expansion. pub fn fix_geth_trace_memory_size(trace: &mut [GethExecStep]) { let mut mem_sizes = vec![0; trace.len()]; diff --git a/zkevm-circuits/src/evm_circuit/witness.rs b/zkevm-circuits/src/evm_circuit/witness.rs index 1f5927760e..d5533a7e6f 100644 --- a/zkevm-circuits/src/evm_circuit/witness.rs +++ b/zkevm-circuits/src/evm_circuit/witness.rs @@ -404,7 +404,7 @@ fn tx_convert( tx: &bus_mapping::circuit_input_builder::Transaction, ops_len: (usize, usize, usize), ) -> Transaction { - let mut result: Transaction = Transaction:: { + Transaction:: { calls: vec![Call { id: 1, is_root: true, @@ -414,12 +414,13 @@ fn tx_convert( randomness, ), }], + steps: tx + .steps() + .iter() + .map(|step| step_convert(step, ops_len)) + .collect(), ..Default::default() - }; - let _ = tx.steps().iter().map(|step| { - result.steps.push(step_convert(step, ops_len)); - }); - result + } } pub fn block_convert(