feat(gasprice): Add gas price controller(default mode)#18
feat(gasprice): Add gas price controller(default mode)#18JimmyShi22 wants to merge 5 commits intodevfrom
Conversation
724ab64 to
5e271ca
Compare
|
@copilot please describe this PR |
|
@JimmyShi22 I've opened a new pull request, #24, to work on those changes. Once the pull request is ready, I'll request review from you. |
dd84e5f to
cd92f8f
Compare
bf58221 to
a698831
Compare
|
|
||
| [[package]] | ||
| name = "ahash" | ||
| version = "0.7.8" |
There was a problem hiding this comment.
There is already an ahash with version 0.8.12. Let's see if we can use that instead
| reth-evm.workspace = true | ||
| reth-rpc-server-types.workspace = true | ||
| reth-tasks = { workspace = true, optional = true } | ||
| reth-tasks.workspace = true |
| /// Validate all X Layer configurations | ||
| pub fn validate(&self) -> Result<(), String> { | ||
| self.intercept.validate() | ||
| self.intercept.validate()?; |
There was a problem hiding this comment.
add this function: self.gas_price.validate()
| } | ||
| } | ||
|
|
||
| impl Default for XLayerGasPriceArgs { |
|
|
||
| /// Default gas price for XLayer (in wei) | ||
| #[arg(long = "xlayer.gasprice.default")] | ||
| pub default: Option<U256>, |
There was a problem hiding this comment.
Using default as a field name is a bit unusual.
| pub use node::*; | ||
|
|
||
| mod node_xlayer; | ||
|
|
There was a problem hiding this comment.
better to group the modules related to xlayer together.
| // } | ||
| _ => { | ||
| tracing::error!("Invalid gas price type: {}", price_type); | ||
| panic!("Invalid gas price type: {}", price_type); |
There was a problem hiding this comment.
the node will crash if use panic.
There was a problem hiding this comment.
done: default to default mode
fd67039 to
9105ea8
Compare
9105ea8 to
b7b867a
Compare
| pub fn validator_arc(&self) -> &Arc<V> { | ||
| &self.validator | ||
| } |
There was a problem hiding this comment.
Just a thought.
// Implement this trait
impl<V> AsRef<Arc<V>> for TransactionValidationTaskExecutor<V> {
fn as_ref(&self) -> &Arc<V> {
&self.validator
}
}
// Then instead of `self.validator().validator_arc().clone()`, do:
self.validator().as_ref().clone()
Implements XLayer gas price controller with default mode that control L2 gas prices based on network congestion while maintaining a configured minimum floor.
Architecture
Gas Price Controller (
crates/xlayer/gasprice/)DefaultGasPricer: Returns fixed configured price, no external data dependenciesXLayerScheduler: Periodic updates based on L2 congestion metrics (pending txs, block fullness)GasPriceCache: Thread-safe price storage with raw/adjusted valuesNode Integration (
crates/optimism/node/)node_xlayer.rsxlayer-gas-price-schedulerbackground taskRPC Layer (
crates/optimism/rpc/,crates/rpc/rpc/)XLayerFeestrait onOpEthApifor pricer managementmod_xlayer.rseth_minGasPriceRPC method--rollup.sequencer http://xxxxxis set.Configuration
To enable, add these to op-reth startup params
Future modes (follower, fixed) will calculate
raw_gpfrom L1 prices; default mode uses configured value.