ethermint icon indicating copy to clipboard operation
ethermint copied to clipboard

Refund unused gas in sdk 0.46's posthandlers

Open yihuang opened this issue 3 years ago • 4 comments

Proposal: Refund unused gas in sdk 0.46's posthandlers

Now we upgraded to SDK 0.46 which supports posthandlers, and apply feemarket to native tx, we can do gas refund in posthandlers in a unified way.

Current behavior: [What currently happens]

Desired behavior: [What you would like to happen]

Use case: [Why is this important (helps with prioritizing requests)]

Requests may be closed if we're not actively planning to work on them.

yihuang avatar Aug 10 '22 04:08 yihuang

@yihuang are you planning to work on this or should we assign someone from our team?

fedekunze avatar Aug 24 '22 10:08 fedekunze

@yihuang are you planning to work on this or should we assign someone from our team?

no, we are not working on it, do you plan to refund native tx gas just like eth tx?

yihuang avatar Aug 24 '22 12:08 yihuang

just Ethereum for now

fedekunze avatar Aug 24 '22 12:08 fedekunze

Ok I checked the current implementation of PostHandlers and the only way to accomplish the gas refund would be to use the ctx.GasMeter instead of relying on the transaction results (they are not passed to the post handler).

https://github.com/cosmos/cosmos-sdk/blob/81028cf93d0c0436110f350f0134f3c13a0ab7fd/baseapp/baseapp.go#L695-L710

I think we should deprioritize this until we've finished the module readiness (#1258) checklist and we have more extensive tests for gas metering behavior.

fedekunze avatar Aug 24 '22 15:08 fedekunze