Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider setting block gas limit to zero in case of delayed finality #8437

Open
exalate-issue-sync bot opened this issue Jan 25, 2023 · 0 comments
Open

Comments

@exalate-issue-sync
Copy link

exalate-issue-sync bot commented Jan 25, 2023

NEP draft: near/NEPs#460

Consider adding new rule for blocks: if the height difference of the block and last final block (see block_header.inner_rest.last_final_block field) is >= 15, its gas limit must be zero.

This implies that no txs/receipts (even delayed) will be processed in this block. It serves several purposes:

  • If blocks are not finalized for a long time, we don’t know for sure which fork will be final. Thus it doesn’t make sense to do heavy computations in long forks, because they can be discarded in the future. 
  • During consensus lags, empty blocks help to reach consensus faster, because their computational complexity is low and we rely only on the network here.
  • (FS-related purpose) We want to charge storage_read fees proportional to 2 disk reads. During consensus lag we may need more disk reads, because FS represents only one fork. We could store more data on disk or use Trie instead, but it would lead to big undercharging. But if there are no txs/receipts to process, there is no undercharging :)

The check should just iterate over parents, until we reach the last final block or the height difference becomes >= 15. Last block headers should be cached somewhere to avoid additional disk reads. 15 is chosen to limit summary size of flat storage deltas properly. However, we may want to check this delta on real blocks and consider other values.

@Longarithm Longarithm changed the title Set block gas limit to zero during consensus lag Consider setting block gas limit to zero in case of delayed finality Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants