design
design copied to clipboard
Call stack metering / deterministic depth restriction
The stack size and stack depth may be different on different engines (or machines the engine) is executed on, especially in the case of a JIT engine. The target machine stack size could have a big influence and potentially introduce non-determinism.
The number of locals can influence the amount memory used in a stack frame and the depth of the call frame may be different.
At EthCC @pepyakin has explained a potential way they are solving this problem. @pepyakin can you explain your solution briefly here?
Hey! I think docs in stack-height instrumentation do pretty good job explaining the solution.
https://github.com/paritytech/wasm-utils/blob/0380e4fa8e6a1cb5ed6bf609900015d3ae7c1ebd/src/stack_height/mod.rs#L1-L49
But If you (or anyone) run into questions pleask ask!