diff --git a/bus-mapping/src/circuit_input_builder/transaction.rs b/bus-mapping/src/circuit_input_builder/transaction.rs index 7016c0a7dc..9b86e197e1 100644 --- a/bus-mapping/src/circuit_input_builder/transaction.rs +++ b/bus-mapping/src/circuit_input_builder/transaction.rs @@ -241,7 +241,7 @@ impl Transaction { code_hash, depth: 1, value: eth_tx.value, - call_data_length: eth_tx.input.len().try_into().unwrap(), + call_data_length: 0, ..Default::default() } }; diff --git a/zkevm-circuits/src/evm_circuit/execution/calldatacopy.rs b/zkevm-circuits/src/evm_circuit/execution/calldatacopy.rs index e31047b09b..f7d9a76240 100644 --- a/zkevm-circuits/src/evm_circuit/execution/calldatacopy.rs +++ b/zkevm-circuits/src/evm_circuit/execution/calldatacopy.rs @@ -199,7 +199,14 @@ impl ExecutionGadget for CallDataCopyGadget { // Call data length and call data offset let (call_data_length, call_data_offset) = if call.is_root { - (tx.call_data.len() as u64, 0_u64) + ( + if tx.is_create() { + 0 + } else { + tx.call_data.len() as u64 + }, + 0_u64, + ) } else { (call.call_data_length, call.call_data_offset) }; diff --git a/zkevm-circuits/src/evm_circuit/execution/calldataload.rs b/zkevm-circuits/src/evm_circuit/execution/calldataload.rs index d7b0aba51a..ff0890bb8f 100644 --- a/zkevm-circuits/src/evm_circuit/execution/calldataload.rs +++ b/zkevm-circuits/src/evm_circuit/execution/calldataload.rs @@ -213,7 +213,15 @@ impl ExecutionGadget for CallDataLoadGadget { // Assign to the buffer reader gadget. let (src_id, call_data_offset, call_data_length) = if call.is_root { - (tx.id, 0, tx.call_data.len() as u64) + ( + tx.id, + 0, + if tx.is_create() { + 0 + } else { + tx.call_data.len() as u64 + }, + ) } else { ( call.caller_id as u64, @@ -249,7 +257,7 @@ impl ExecutionGadget for CallDataLoadGadget { for (i, byte) in calldata_bytes.iter_mut().enumerate() { if call.is_root { // Fetch from tx call data. - if src_addr + (i as u64) < tx.call_data.len() as u64 { + if src_addr + (i as u64) < call_data_length { *byte = tx.call_data[src_addr as usize + i]; } } else {