Add Uniswap TWAP fee oracle for batch_policy.log_gas_price - #30
Open
stephenctw wants to merge 6 commits into
Open
Add Uniswap TWAP fee oracle for batch_policy.log_gas_price#30stephenctw wants to merge 6 commits into
stephenctw wants to merge 6 commits into
Conversation
Drop the redundant current_frame_fee argument so dequeue/execute always use the lane's committed WriteHead fee.
Extract Alloy's MetaMask-style medium estimator behind a small helper so batch submission and fee charging stay on one policy.
Convert base+priority gas into fee-token units via a pinned V3 TWAP, apply 10× slack, and persist log_gas_price through a dedicated writer.
Resolve fixed vs Uniswap sources from config, require an initial refresh before the inclusion lane starts, and join the oracle on shutdown.
Record fee-token TWAP charging, writer ownership, env knobs, and Uniswap pool trust in the operator-facing and threat-model docs.
Add live-source worker/math/TWAP unit tests and assert a configured fixed log_gas_price is sampled into the first frame fee on devnet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
base_fee + priority) into fee-token smallest units via a pinned Uniswap V3 WETH/X 30‑minute TWAP, applies 10× slack, and updatesbatch_policy.log_gas_price.Test plan
cargo test -p sequencer --lib fee_oraclecargo test -p sequencer --lib eip1559cargo test -p sequencer --lib config::cargo run -p rollups-e2e --bin rollups-e2e -- fixed_fee_oracle_sets_frame_fee_test --exactlog_gas_price = 0when fee-oracle env is unset