Skip to content

EVM on WASM: Return unused gas for reverted call transactions

Context

If a contract call reverts (using REVERT opcode), the caller only pays for gas used. Rest is refunded. We already have this for nested calls, but not for the top level call. This MR fixes this problem.

Integration tests are created to check that.

  1. `Gas used` in the transaction receipt does not include returned gas
  2. Returned gas fee is actually added to balance of sender

Manually testing the MR

Use unit tests as usual. Unit tests run as part of CI.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Hantang Sun

Merge request reports