From 223b38c79bc3c615293bfe2cb7d482cf399500a7 Mon Sep 17 00:00:00 2001 From: DreamWuGit Date: Thu, 12 May 2022 22:43:27 +0800 Subject: [PATCH] fix log gas (#507) --- zkevm-circuits/src/evm_circuit/execution/logs.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zkevm-circuits/src/evm_circuit/execution/logs.rs b/zkevm-circuits/src/evm_circuit/execution/logs.rs index 2bfb12be76..fb0507b185 100644 --- a/zkevm-circuits/src/evm_circuit/execution/logs.rs +++ b/zkevm-circuits/src/evm_circuit/execution/logs.rs @@ -155,7 +155,8 @@ impl ExecutionGadget for LogGadget { }, ); - let gas_cost = GasCost::LOG.as_u64().expr() * topic_count.clone() + let gas_cost = GasCost::LOG.as_u64().expr() + + GasCost::LOG.as_u64().expr() * topic_count.clone() + 8.expr() * from_bytes::expr(&msize.cells) + memory_expansion.gas_cost(); // State transition @@ -407,8 +408,10 @@ mod test { memory_expansion_gas_cost(curr_memory_word_size, next_memory_word_size); let topic_count = topics.len(); // dynamic calculate topic_count - let gas_cost = - GasCost::LOG.as_u64() * topic_count as u64 + 8 * msize.as_u64() + memory_expension_gas; + let gas_cost = GasCost::LOG.as_u64() + + GasCost::LOG.as_u64() * topic_count as u64 + + 8 * msize.as_u64() + + memory_expension_gas; let codes = [ OpcodeId::LOG0, OpcodeId::LOG1,