gear icon indicating copy to clipboard operation
gear copied to clipboard

Check gas limit for builtin actors before calling their respective `handle` method

Open ekovalev opened this issue 1 year ago • 1 comments

In the current implementation of the builtin actor framework (#3624) the builtin_dispatcher::run() doesn't check whether the gas provided is sufficient for the actor to execute a message - this can require decoding the message itself and, hence, is done inside the actor's handle function. We might want to change this flow to let the builtin_dispatcher decide upfront if the gas limit is sufficient. One of the ways to do that is to make builtins report their maximum possible incurred gas cost and require the message gas limit to surpass that value. If the actually burned gas turns out to be less than that amount, the unused gas will naturally be returned to the gas tree.

ekovalev avatar Feb 26 '24 13:02 ekovalev

And skip builtin message processing until next block in case that max of builtin weights is bigger than current gas allowance

breathx avatar Feb 26 '24 16:02 breathx