Skip to content

Conversation

@niran
Copy link
Contributor

@niran niran commented Nov 14, 2025

  • keep a 12-block in-memory cache of metered transactions (gas, DA size, execution timing) and percentile estimator to drive base_meteredPriorityFeePerGas
  • stream accepted bundles from Kafka and flashblock updates into that cache, emitting only freshness/error metrics and tracing for diagnostics
  • update the metering RPC to meter incoming bundles once, derive their resource demand, and return per-resource priority-fee recommendations based on recent flashblocks

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Nov 14, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

The Kafka AcceptedBundle contains the *requested* block number and the
flashblock state used for *simulation*, not the actual inclusion location.
The websocket flashblock feed provides the real (block, flashblock_index).

- Store Kafka metering data in pending map keyed by tx hash
- Populate cache when flashblock websocket events arrive with real location
- Remove unused FlashblockSnapshot and snapshot channel
- Bound pending map to 10k entries with FIFO eviction
- All transactions are bundles; warn on any misses
- Replace BTreeMap<ResourceKind, ResourceEstimate> with ResourceEstimates struct
- Add rolling window estimation across cached blocks (median per resource)
- Add single recommended_priority_fee field (max across resources)
- Rename next_block/next_flashblock to min/max_across_flashblocks
- Add doc comments explaining the estimation algorithm
Replace bottom-up fee discovery with top-down subtraction algorithm
that walks transactions from highest to lowest fee, subtracting usage
until remaining capacity falls below bundle demand.

- Add ResourceLimits struct for configured capacity limits
- Add CLI args for gas, execution time, DA, percentile, and uncongested fee
- Return error when bundle demand exceeds resource capacity
- Return configurable default fee for uncongested resources
…cking

Replace hardcoded cache size with --metering-cache-size CLI argument.
Remove unused flashblock-per-block limit tracking that was never actionable.
- Fix O(n²) index rebuild in cache eviction by moving rebuild outside loop
- Add --metering-state-root-time-us CLI arg for forward compatibility
- Reduce cloning in estimator by using reference slices for aggregation
- Fix supporting_transactions to return 0 when no txs fit (was incorrectly 1)
- Export ResourceFeeEstimateResponse from public API
- Rename supporting_transactions to threshold_tx_count for clarity
The priority fee estimator now respects dynamic DA limits set via the
miner_setMaxDASize RPC call. This allows operators to adjust DA limits
at runtime without restarting the node.

Key changes:
- PriorityFeeEstimator accepts optional OpDAConfig for dynamic DA limits
- When metering is enabled, the miner RPC module is automatically enabled
- Shared OpDAConfig is passed to both OpNode (for miner RPC) and estimator
- Add integration test that verifies setMaxDASize affects priority fee estimates
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