Skip to content

Comments

fix(sync): guarantee consecutive L1 gas price samples are fed into L1GasPriceProvider#3243

Open
t00ts wants to merge 13 commits intomainfrom
t00ts/robust-l1-gas-prices
Open

fix(sync): guarantee consecutive L1 gas price samples are fed into L1GasPriceProvider#3243
t00ts wants to merge 13 commits intomainfrom
t00ts/robust-l1-gas-prices

Conversation

@t00ts
Copy link
Contributor

@t00ts t00ts commented Feb 19, 2026

Relevant context for this PR can be found in #3197


This should now be way more reliable. Been running it for ~1d and it seems to work as expected.

Summary of key changes:

  1. In our ethereum client:
    a) Made the get_gas_price_data_range strict. It used to just silently skip errors.
    b) Changed subscribe_block_headers from callback-based to channel-based. Otherwise I couldn't make the caller have full control over the processing loop.
    c) Also added tracking of parent block hash to L1GasPriceData to detect reorgs.

  2. In the L1GasPriceProvider:
    a) Proper errors when adding a gas price sample. This allows the caller to take the right action accordingly.
    b) Detect reorgs by using those parent block hashes mentioned previously.

  3. The new sync loop:
    There's an outer loop that runs forever (reconnects on failures) and an inner "cycle" which bootstraps the provider, subscribes to block header updates, and processes them. Here's where we pay attention to the two errors (gap or reorg detected) and we act accordingly. For gaps, we just inline fill them and keep going, for reorgs we restart the whole thing.

Worth noting that I changed the bootstrap initial block from finalized to latest. The latter is way closer to what we'll get on our first subscribed items, and thus reduces the initial gap fill. I think for gas prices it should be fine to rely on latest.

Closes #3196
Closes #3197

@t00ts t00ts requested a review from a team as a code owner February 19, 2026 07:39
@vbar
Copy link
Contributor

vbar commented Feb 19, 2026

Worth noting that I changed the bootstrap initial block from finalized to latest. The latter is way closer to what we'll get on our first subscribed items, and thus reduces the initial gap fill. I think for gas prices it should be fine to rely on latest.

Note that this incompatible with the apollo implementation, which uses not just finalized blocks, but a configurable "finality gap" (but I agree the difference hopefully won't matter).

@t00ts t00ts force-pushed the t00ts/robust-l1-gas-prices branch from 669dcef to a41076a Compare February 19, 2026 12:13
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

Successfully merging this pull request may close these issues.

sync_gas_prices gets stuck on historical data, ignoring subscribed updates

2 participants