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

contracts: Switch to wasmi's builtin metering #13639

Closed
5 tasks done
Tracked by #113
athei opened this issue Mar 19, 2023 · 0 comments · Fixed by #14084
Closed
5 tasks done
Tracked by #113

contracts: Switch to wasmi's builtin metering #13639

athei opened this issue Mar 19, 2023 · 0 comments · Fixed by #14084
Assignees
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. Z4-involved Can be fixed by an expert coder with good knowledge of the codebase.

Comments

@athei
Copy link
Member

athei commented Mar 19, 2023

Our approach to gas metering so far is to instrument the wasm code on upload to the chain. We parse the code and inject wasm instructions that meter a contract. The alternative is to let the execution engine (wasmi) handle the metering. That is a way more efficient way of doing it. However, we decided to go with instrumentation anyways because the execution engine (wasmi) originally resided within the client. Doing the instrumentation within the runtime was a way to make the metering algorithm part of consensus instead of specifying it and have any client conform to it. That might lead to consensus issues when (accidental) changes were made to it between versions.

Since we moved wasmi into the runtime there is no longer a need to rely on instrumentation. Hence we move to a wasmi builtin metering. This will also allow us to remove the whole caching logic for instrumented code. The wasmi instrumentation is fast enough to just do it on every call. This is because it needs to parse the code anyways instead of having an additional pass just for instrumentation.

@athei athei added I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. Z4-involved Can be fixed by an expert coder with good knowledge of the codebase. labels Mar 19, 2023
@github-project-automation github-project-automation bot moved this to Backlog 🗒 in Smart Contracts Mar 19, 2023
@agryaznov agryaznov self-assigned this Apr 12, 2023
@athei athei moved this from Draft to Open in Parity Roadmap Apr 12, 2023
@agryaznov agryaznov moved this from Backlog 🗒 to In Progress 🛠 in Smart Contracts May 3, 2023
@agryaznov agryaznov moved this from In Progress 🛠 to Code in review 🧐 in Smart Contracts Jun 23, 2023
@github-project-automation github-project-automation bot moved this from Open to Closed in Parity Roadmap Jul 3, 2023
@github-project-automation github-project-automation bot moved this from Code in review 🧐 to Done ✅ in Smart Contracts Jul 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. Z4-involved Can be fixed by an expert coder with good knowledge of the codebase.
Projects
Status: Done
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants