Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Runtime API/executor: limit the execution of runtime call #10648

Open
pepyakin opened this issue Jan 12, 2022 · 0 comments
Open

Runtime API/executor: limit the execution of runtime call #10648

pepyakin opened this issue Jan 12, 2022 · 0 comments

Comments

@pepyakin
Copy link
Contributor

When we executing Substrate Runtime we assume that the runtime is always trusted. That is, each call to the runtime API finishes in some reasonable amount of time (definitely finite). The Substrate Runtime authors and the governance of chains are supposed to ensure this property. It's in their interests to uphold this property lest they brick the chain.

After talking to @tomaka and @bkchr I found out that there are cases when we may actually limit the amount of time spent in executing Substrate Runtime for preventing abusing it by the RPC or other requests from untrusted sources.

This is why we may want to consider supporting for metering the execution of the runtime in a similar fashion to how contracts are limited by gas metering. We may be able to reuse the same machinery for instrumentation of the runtime code. However, in the case of wasmtime we should consider using their fuel mechanism or interrupts since those (especially the latter) seem to be more efficient compared to wasm-utils/wasm-instrument instrumentation. Wasmi atm does not have a native analogue unfortunately .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant