echonet: L1Manager gas price target and mock L1 head#13621
echonet: L1Manager gas price target and mock L1 head#13621ron-starkware wants to merge 1 commit intoayelet/echonet/l1-gas-price/funcfrom
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
740b659 to
fcdfb7a
Compare
f0be778 to
2ece522
Compare
2ece522 to
4786a92
Compare
ayeletstarkware
left a comment
There was a problem hiding this comment.
@ayeletstarkware reviewed 1 file and made 5 comments.
Reviewable status: 1 of 3 files reviewed, 5 unresolved discussions (waiting on ron-starkware).
echonet/l1_logic/l1_manager.py line 28 at r2 (raw file):
It is incremented by set_gas_price_target (once per L2 block) and synced upward by set_new_tx when real L1 block numbers are stored. """
let's move the rest to the functions descriptions
Suggestion:
"""
Manages L1 block data and provides mock RPC responses for the L1 gas price scraper and L1 events scraper.
"""echonet/l1_logic/l1_manager.py line 55 at r2 (raw file):
# (T_next ≈ T_current + block_interval). The mock L1 timestamp must be ≤ T_current # so the Rust lag-margin lookup (lag=0) finds a qualifying block. 30s is safely # above the ~2s block interval and well below the 900s max_time_gap.
can you rephrase that? I don't understand
Code quote:
# set_gas_price_target is called with the NEXT feeder block's timestamp
# (T_next ≈ T_current + block_interval). The mock L1 timestamp must be ≤ T_current
# so the Rust lag-margin lookup (lag=0) finds a qualifying block. 30s is safely
# above the ~2s block interval and well below the 900s max_time_gap.echonet/l1_logic/l1_manager.py line 73 at r2 (raw file):
return block def __init__(
move up, above default_l1_block
Code quote:
def __init__(echonet/l1_logic/l1_manager.py line 91 at r2 (raw file):
# Condition used to implement long-polling in get_block_number. # Notified whenever _mock_l1_head_number changes so waiting scrapers wake up # immediately instead of hammering echonet with rapid polls.
I think the documentation related to the long polling should be in get_block_number
Suggestion:
# long-poll condition for get_block_numberechonet/l1_logic/l1_manager.py line 94 at r2 (raw file):
self._mock_l1_head_updated = threading.Condition() def _set_mock_l1_head_number(self, value: int) -> None:
Suggestion:
def _set_mock_l1_head_number(self, value: int) -> None:
"""Update the mock L1 head and wake any threads blocked in get_block_number."""

Note
Medium Risk
Changes mock
eth_blockNumbersemantics and introduces threaded long-polling plus synthetic fee fields, which may impact scraper behavior/timing if assumptions differ. Test coverage was updated, but integration timing/race conditions are the main risk.Overview
L1Managernow maintains a monotonically increasing mock L1 head (backed by newDEFAULT_L1_BLOCK_NUMBER) and changesget_block_numberto long-poll on a condition variable, reducing tight-loop polling load while still unblocking scrapers promptly.Adds
set_gas_price_target()and extends the default/fallback L1 block returned byget_block_by_numberto include EIP-1559 base fee and blob fee context (baseFeePerGas, derivedexcessBlobGas, timestamp), and syncs the mock head upward when real L1 blocks are stored/reset when clearing state. Unit tests are updated/expanded to assert the new head behavior, cleanup semantics, and reset/increment flows.Written by Cursor Bugbot for commit 4786a92. This will update automatically on new commits. Configure here.