Skip to content

perf(l1,l2): gas tip estimator design #5459

@Oppen

Description

@Oppen

Currently, the gas tip estimator performs about 40 queries to
the DB for every updates. While it caches the latest value, it
could be made much more efficient with little effort.

The general flow of gas estimation as it is now is as follows:

  • From the latest 20 canonical blocks, get the base fee and the
    three cheapest transactions (in terms of gas tip);
  • Of those (at most) 60 values, take the median.

Now, for that number of values all we really need is to keep a
window of those ordered by block number, with a safety margin
for reorgs, in memory, which amounts to at most a few kiB.
If we update this array on every canonical block, we avoid
accessing the DB entirely to estimate gas tips.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions