mirror of
https://github.com/fluencelabs/wasm-utils
synced 2025-07-16 06:32:00 +00:00
quadratic memory charge
This commit is contained in:
@@ -48,6 +48,10 @@ fn add_grow_counter(module: elements::Module, rules: &rules::Set, gas_func: u32)
|
||||
GetLocal(0),
|
||||
I32Const(rules.grow_cost() as i32),
|
||||
I32Mul,
|
||||
CurrentMemory(0),
|
||||
I32Const(1),
|
||||
I32Add,
|
||||
I32Mul,
|
||||
// todo: there should be strong guarantee that it does not return anything on stack?
|
||||
Call(gas_func),
|
||||
GrowMemory(0),
|
||||
@@ -244,6 +248,10 @@ mod tests {
|
||||
GetLocal(0),
|
||||
I32Const(10000),
|
||||
I32Mul,
|
||||
CurrentMemory(0),
|
||||
I32Const(1),
|
||||
I32Add,
|
||||
I32Mul,
|
||||
Call(0),
|
||||
GrowMemory(0),
|
||||
GetLocal(0),
|
||||
|
Reference in New Issue
Block a user