gear icon indicating copy to clipboard operation
gear copied to clipboard

Re-check gas reduction and charge fairness

Open techraed opened this issue 2 years ago • 1 comments

Proposal

There are some host functions for which gas reduction and consumption is considered unfair. For example:

  1. send message -> here - https://github.com/gear-tech/gear/blob/fc520c673014ef599e520dd62897a0f34f965503/core-processor/src/ext.rs#L556-L557 we first reduce gas-left counter and then reduce gas for sending message itself (different fees for messages with/without delay). If the second charge fails, the reduction of gas for the actually unsent message remains.
  2. read -> here - https://github.com/gear-tech/gear/blob/fc520c673014ef599e520dd62897a0f34f965503/core-processor/src/ext.rs#L730-L733 we can charge for the requested read length, but fail on the fact, that length is greate than the payload iteself. So we will charge for things didn't happen.

techraed avatar Jun 03 '23 20:06 techraed

related to #2822

techraed avatar Jun 18 '23 14:06 techraed