-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(avm): Do not scale CALLDATACOPY base cost with size #5879
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import type { AvmContext } from '../avm_context.js'; | ||
import { getBaseGasCost, getMemoryGasCost, mulGas, sumGas } from '../avm_gas.js'; | ||
import { getBaseGasCost, getMemoryGasCost, sumGas } from '../avm_gas.js'; | ||
import { Field, type MemoryOperations, TaggedMemory, TypeTag } from '../avm_memory_types.js'; | ||
import { InstructionExecutionError } from '../errors.js'; | ||
import { BufferCursor } from '../serialization/buffer_cursor.js'; | ||
|
@@ -218,7 +218,7 @@ export class CalldataCopy extends Instruction { | |
} | ||
|
||
protected override gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }> = {}) { | ||
const baseGasCost = mulGas(getBaseGasCost(this.opcode), this.copySize); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this the only instance of scaling base cost? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SSTORE/SLOAD are the other ones I found There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. Those will get solved once we do this: #5153 |
||
const baseGasCost = getBaseGasCost(this.opcode); | ||
const memoryGasCost = getMemoryGasCost(memoryOps); | ||
return sumGas(baseGasCost, memoryGasCost); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think remove "as they":
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in dfb8704