mirror of
https://github.com/fluencelabs/wasm-utils
synced 2025-05-01 09:42:18 +00:00
quadratic memory charge
This commit is contained in:
parent
81e53080d3
commit
72d71ec1c7
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user