design icon indicating copy to clipboard operation
design copied to clipboard

Call stack metering / deterministic depth restriction

Open axic opened this issue 6 years ago • 2 comments

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.

axic avatar Mar 21 '18 18:03 axic

At EthCC @pepyakin has explained a potential way they are solving this problem. @pepyakin can you explain your solution briefly here?

axic avatar Mar 21 '18 18:03 axic

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!

pepyakin avatar Mar 22 '18 12:03 pepyakin