Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
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
@athei

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.

Metadata

Assignees

Labels

I9-optimisationAn enhancement to provide better overall performance in terms of time-to-completion for a task.Z4-involvedCan be fixed by an expert coder with good knowledge of the codebase.

Type

No type

Projects

  • Status

    Done
  • Status

    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions