Skip to content

Conversation

@anylots
Copy link
Contributor

@anylots anylots commented Dec 5, 2025

Use a fixed priority_fee(0.001 Gwei) for gas-price-oracle tx.

Summary by CodeRabbit

  • Bug Fixes

    • EIP-1559 estimator now uses a fixed, predictable priority fee for more consistent transaction costs.
    • Blob base fee is now retrieved on-chain (via L1 RPC) to reflect current network state.
  • Refactor

    • Internal blob-fee calculation and related public constants removed or consolidated.
  • Chores

    • Test network config updated to a MorphL2 QuickNode endpoint.

✏️ Tip: You can customize this high-level summary in your review settings.

@anylots anylots requested a review from a team as a code owner December 5, 2025 07:15
@anylots anylots requested review from Web3Jumb0 and removed request for a team December 5, 2025 07:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Walkthrough

eip1559 estimator now ignores on-chain rewards and uses a fixed priority fee; blob base fee is fetched from L1 via eth_blobBaseFee RPC (local calc removed); some public blob-related constants and calc function removed; test RPC endpoint updated.

Changes

Cohort / File(s) Summary
Signer / fee estimator
gas-oracle/app/src/signer.rs
eip1559_estimator signature changed to accept _rewards: Vec<Vec<U256>> (unused); removed estimate_priority_fee; estimator uses a fixed max_priority_fee_per_gas rather than computing from rewards; test RPC URL updated to a MorphL2 quicknode endpoint.
L1 blob base fee retrieval
gas-oracle/app/src/l1_base_fee.rs
Removed local calc_blob_basefee usage/import; replaced local calculation with on-chain eth_blobBaseFee RPC call in query_l1_base_fee; added test_eth_blob_base_fee test; preserved error mapping to L1BaseFeeError.
Public API cleanup
gas-oracle/app/src/lib.rs
Removed public constants MIN_BLOB_GASPRICE, BLOB_GASPRICE_UPDATE_FRACTION, public function calc_blob_basefee(excess_blob_gas: u64), and private helper fake_exponential; trimmed surrounding exported API related to blob gas price handling.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review eip1559_estimator change for unintended side effects where rewards were previously used.
  • Validate the chosen fixed max_priority_fee_per_gas constant and any removed environment multiplier usage.
  • Confirm eth_blobBaseFee RPC integration handles errors and edge cases identically to prior local calc expectations.
  • Ensure removed public API items don't break downstream consumers or crate exports.
  • Run and inspect updated tests, especially the new test_eth_blob_base_fee and any RPC-dependent tests (check RPC endpoint accessibility).

Poem

🐰 I hop through code with a carrot of glee,

Fees now steady, no medians from me.
I fetch blob fees from the chain with a cheer,
Trim the hedges, tidy the trail — onward, my dear! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: replacing reward-based priority fee calculation with a fixed constant for gas-oracle transactions.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gas-price-oracle-tipfee

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
gas-oracle/app/src/signer.rs (2)

93-101: Fixed-fee estimator matches intent; consider extracting a named constant and cleaning unused statics

The fixed max_priority_fee_per_gas = 10^6 (0.001 Gwei) and ignoring _rewards align with the PR objective and the EIP-1559 API shape looks correct.

Two small cleanups you might consider:

  • Replace 10u32.pow(6) with a named constant (and/or env-configured value) for readability and easier future tuning.
  • Now that the estimator no longer scales based on rewards, PRIORITY_FEE_INCREASE_MULTIPLIER and PRIORITY_FEE_INCREASE_DIVISOR appear unused and could be dropped to avoid confusion.

For example:

-lazy_static::lazy_static! {
-    static ref PRIORITY_FEE_INCREASE_MULTIPLIER: i32= read_env_var("PRIORITY_FEE_INCREASE_MULTIPLIER", 11);
-    static ref PRIORITY_FEE_INCREASE_DIVISOR: i32= read_env_var("PRIORITY_FEE_INCREASE_DIVISOR", 10);
-    static ref EIP1559_FEE_ESTIMATION_MAX_FEE: u64= read_env_var("EIP1559_FEE_ESTIMATION_MAX_FEE", 200_000_000_000);
-}
-
-fn eip1559_estimator(base_fee_per_gas: U256, _rewards: Vec<Vec<U256>>) -> (U256, U256) {
-    let max_priority_fee_per_gas = U256::from(10u32.pow(6)); //0.001Gwei
+lazy_static::lazy_static! {
+    static ref EIP1559_FEE_ESTIMATION_MAX_FEE: u64 =
+        read_env_var("EIP1559_FEE_ESTIMATION_MAX_FEE", 200_000_000_000);
+}
+
+const PRIORITY_FEE_PER_GAS_WEI: u64 = 1_000_000; // 0.001 Gwei
+
+fn eip1559_estimator(base_fee_per_gas: U256, _rewards: Vec<Vec<U256>>) -> (U256, U256) {
+    let max_priority_fee_per_gas = U256::from(PRIORITY_FEE_PER_GAS_WEI);
     let max_fee_per_gas = std::cmp::min(
         U256::from(*EIP1559_FEE_ESTIMATION_MAX_FEE),
         base_fee_per_gas + max_priority_fee_per_gas,
     );

105-116: Hard-coded MorphL2 QuickNode RPC in test; consider making it configurable

Using a concrete MorphL2 QuickNode URL in this ignored test is fine for local/manual runs and matches the PR aim of exercising the L2 path. If you expect others (or CI) to run this occasionally, consider reading the RPC URL from an env var with a sensible default so the test isn’t tied to a specific provider endpoint:

-    let l2_provider = Provider::<Http>::try_from("https://rpc-quicknode.morphl2.io").unwrap();
+    let rpc_url =
+        std::env::var("MORPH_L2_RPC_URL").unwrap_or_else(|_| "https://rpc-quicknode.morphl2.io".into());
+    let l2_provider = Provider::<Http>::try_from(rpc_url).unwrap();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df65943 and 25c5d77.

📒 Files selected for processing (1)
  • gas-oracle/app/src/signer.rs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: check
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
gas-oracle/app/src/signer.rs (1)

104-133: QuickNode RPC in ignored integration test – confirm endpoint & hard-coded credentials are acceptable

Switching the test RPC to https://rpc-quicknode.morphl2.io makes this ignored test talk to a real L2 endpoint instead of a placeholder/local node. That’s fine for a manual integration test, but please double‑check:

  • That this public URL is stable and appropriate to bake into source (or consider moving it to an env var if you expect it to change).
  • That the hard-coded dev private key and from/to addresses are safe to use against this network (e.g., only ever funded with test/dev funds), so running cargo test -- --ignored cannot accidentally spend anything valuable.

If both are intentional, no code changes are strictly needed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25c5d77 and 1e6e7a1.

📒 Files selected for processing (1)
  • gas-oracle/app/src/signer.rs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: check
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (2)
gas-oracle/app/src/signer.rs (2)

91-99: Fixed-priority EIP-1559 estimator looks correct and aligned with PR intent

PRIORITY_FEE_PER_GAS_WEI = 1_000_000 matches the 0.001 Gwei comment (1e9 * 0.001 = 1e6), and the estimator computes max_fee_per_gas = min(EIP1559_FEE_ESTIMATION_MAX_FEE, base_fee + priority_fee) as expected. Renaming the second arg to _rewards is an idiomatic way to keep the required callback signature while explicitly ignoring it.

From a gas-policy perspective, you may just want to validate on staging that a flat 0.001 Gwei tip is sufficient for timely inclusion under your expected L2 conditions, now that you no longer adapt to rewards.


102-102: Whitespace-only change

This appears to be a formatting/blank-line change with no behavioral impact; nothing to address here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
gas-oracle/app/src/lib.rs (1)

31-42: contract_error implementation is fine; consider small style cleanup

The logic for decoding revert data and formatting a clear error string looks solid and type-correct; no functional issues here.

If you want to simplify slightly, you can drop the error_msg binding and return the expression directly:

-pub fn contract_error<M: Middleware>(e: ContractError<M>) -> String {
-    let error_msg = if let Some(contract_err) = e.as_revert() {
+pub fn contract_error<M: Middleware>(e: ContractError<M>) -> String {
+    if let Some(contract_err) = e.as_revert() {
         if let Some(data) = GasPriceOracleErrors::decode_with_selector(contract_err.as_ref()) {
             format!("exec error: {:#?}", data)
         } else {
             format!("unknown contract error: {:#?}", contract_err)
         }
     } else {
         format!("error: {:#?}", e)
-    };
-    error_msg
+    }
 }

Purely optional; current version is correct and readable.

gas-oracle/app/src/l1_base_fee.rs (1)

234-234: Redundant U256::from() conversion.

latest_blob_fee is already of type U256 from the RPC response, so the wrapping is unnecessary.

-    Ok((l1_base_fee, U256::from(latest_blob_fee), gas_price))
+    Ok((l1_base_fee, latest_blob_fee, gas_price))
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e6e7a1 and c79f587.

📒 Files selected for processing (2)
  • gas-oracle/app/src/l1_base_fee.rs (3 hunks)
  • gas-oracle/app/src/lib.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: check
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
gas-oracle/app/src/l1_base_fee.rs (1)

214-221: Good refactor to use authoritative L1 data.

Fetching eth_blobBaseFee directly from the L1 node is more reliable than local calculation and avoids maintenance burden when L1 configs change.

Comment on lines +237 to +247
#[tokio::test]
async fn test_eth_blob_base_fee() -> Result<(), OracleError> {
let l1_provider = Provider::<Http>::try_from("https://ethereum-rpc.publicnode.com").unwrap();
let blob_base_fee = l1_provider
.request::<(), U256>("eth_blobBaseFee", ())
.await
.map_err(|e| OracleError::L1BaseFeeError(anyhow!(format!("eth_blobBaseFee: {:#?}", e))))?;

println!("eth_blobBaseFee: {:?}", blob_base_fee);
Ok(())
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Test relies on external network call without #[ignore].

This test makes a live RPC call to a public endpoint, which can cause CI flakiness due to rate limits, network issues, or endpoint unavailability. Consider:

  1. Adding #[ignore] to exclude from regular test runs:
 #[tokio::test]
+#[ignore] // Requires network access to external RPC
 async fn test_eth_blob_base_fee() -> Result<(), OracleError> {
  1. Adding an assertion to validate the result (e.g., assert!(!blob_base_fee.is_zero())).
🤖 Prompt for AI Agents
In gas-oracle/app/src/l1_base_fee.rs around lines 237 to 247, the test performs
a live RPC call which can make CI flaky; mark the test with #[ignore] to exclude
it from regular runs and add a simple assertion to validate the response (for
example assert that blob_base_fee is not zero) so the test actually verifies
behavior when run manually; optionally document in a comment that the test is
intended for manual/local/integration use or replace the live call with a mocked
Provider in unit tests if you want deterministic CI runs.

@anylots anylots merged commit aa7f191 into main Dec 8, 2025
8 checks passed
@anylots anylots deleted the gas-price-oracle-tipfee branch December 8, 2025 07:50
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.

3 participants