This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Allow Engine to count expensive system calls towards block gas limit. #11320
Labels
A3-stale 🍃
Pull request did not receive any updates in a long time. No review needed at this stage. Close it.
POSDAO will do some expensive calculations once per week to distribute aggregated block rewards. These are performed by a block reward contract as a system call. Currently, this happens in
OpenBlock::close_and_lock
, which, with the Authority Round engine, callson_close_block
, which calls the contract. If that call is very expensive and happens after the block has already been filled, possibly up to the gas limit, that means the EVM does much more work for that block, making block creation and verification slower than it should be, given the gas limit.In #10928, we proposed a mechanism for a contract to tell the engine to temporarily lower the gas limit.
In a discussion with @dvdplm, we came up with a cleaner solution: To add a way for the system call's gas consumption to be subtracted from the block gas limit. That would require the call to be made when opening the block, not when closing it. So we would need to:
Engine::on_open_block
method that can make system calls and return their consumed gas, maybe in the form ofReceipt
s?ExecutedBlock::receipts
before the actual transactions? Or with a new field inExecutedBlock
?Machine::execute_code_as_system
so that it returns the gas consumption or receipt.Please let me know whether that approach makes sense, and would be preferred.
The text was updated successfully, but these errors were encountered: