Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix log gas (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamWuGit authored May 12, 2022
1 parent 818cf2e commit 223b38c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions zkevm-circuits/src/evm_circuit/execution/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ impl<F: Field> ExecutionGadget<F> for LogGadget<F> {
},
);

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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 223b38c

Please sign in to comment.