iroha icon indicating copy to clipboard operation
iroha copied to clipboard

Unification of wasm fuel across runtimes

Open aoyako opened this issue 6 months ago • 2 comments

In the https://github.com/hyperledger-iroha/iroha/pull/5465 PR, wasm execution calls are made, requiring a more advanced way to control wasm fuel usage. Some of the obvious issues that this issue aims to cover:

  • For the fees case, fuel is incorrectly tracked
  • Infinite recursive wasm calls are possible

What is the desired outcome?

  • The fuel can be added/removed in the executor, and consequent smartcontact runtimes will use/re-use those amounts without resetting them to the default ones.

The example of the flow: Image

The changes might include adding a fuel field in the State struct. At the beginning of the host function call, the state will receive fuel from the previous runtime and use that value when creating a new runtime. At the end of the execution, parent's runtime should receive new fuel from state and continue execution,

aoyako avatar Jul 10 '25 11:07 aoyako

I agree with the idea of carrying over the remaining consumable computation capacity from instruction to instruction.

However, as mentioned in https://github.com/hyperledger-iroha/iroha/pull/5421#discussion_r2094721370, I think it's better to first define a term other than the Wasm-specific "fuel" and base the discussion around that.

s8sato avatar Jul 14 '25 07:07 s8sato

Since #5357 no longer assumes an "executor", a dedicated component that inherits the fee-related functionality should be devised.

s8sato avatar Jul 14 '25 07:07 s8sato