Description
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.
- Update to a newer wasmi version supporting metering (we need version 0.29): contracts: Upgrade to wasmi 0.28 #13312
- Use wasmi's builtin metering instead of instrumentation.
- Remove all the caching logic and just store the pristing code.
- Remove the benchmarks which are no longer needed.
- Write storage migration (blocked on contracts: Multi block migrations #13638)
Metadata
Assignees
Labels
Type
Projects
Status
Done
Status
No status