Skip to content

refactor: extract fee constants and consolidate dependency checks - #977

Merged
Maki-Zeninn merged 1 commit into
Maki-Zeninn:mainfrom
Folex1275:wave
Jul 30, 2026
Merged

refactor: extract fee constants and consolidate dependency checks#977
Maki-Zeninn merged 1 commit into
Maki-Zeninn:mainfrom
Folex1275:wave

Conversation

@Folex1275

Copy link
Copy Markdown
Contributor

Refactor: Code deduplication and maintenance improvements

Closes #960
Closes #961
Closes #962
Closes #963

This PR addresses four maintenance issues identified in code review.

Changes

1. Deduplicate dependent-route scan loop in router-core

  • Extracted common "route has dependents" check into route_has_dependents() helper
  • Eliminates copy-paste logic between remove_route() and remove_route_internal()
  • Future changes to dependency checking now only need updating in one location

2. Extract duplicated fee constants in rpc.rs

  • Introduced module-level constants: BASE_FEE, SURGE_THRESHOLD_BPS, SURGE_MULTIPLIER, NORMAL_MULTIPLIER
  • Replaced hardcoded values in both simulate() and heuristic_estimate()
  • Ensures consistency between RPC path and heuristic fallback path

3. Document unused fee_bps field

  • Added doc comment to SimulateRequest.fee_bps noting it's currently unused/reserved
  • Clarifies that fee estimation uses hardcoded constants for now
  • Prevents API consumer confusion about expected behavior

4. Normalize CI workflow formatting

  • Changed branches: [ main, develop ] to branches: [main, develop] in metrics-exporter.yml
  • Matches bracket-spacing convention used in all other workflow files
  • Improves consistency across .github/workflows/

Impact

  • No behavioral changes
  • Improves maintainability and code clarity
  • Reduces risk of drift in duplicated logic

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@Folex1275 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Maki-Zeninn
Maki-Zeninn merged commit 2352ee3 into Maki-Zeninn:main Jul 30, 2026
12 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment