Repository navigation
Fix multi-hop XFF resolution, worker status gauge, outcome bet counts, and migration log history - #1641
Merged
hman38705 merged 5 commits intoSep 27, 2026
Conversation
…iple X-Forwarded- Closes solutions-plug#1533
…er_status gauges Closes solutions-plug#1534
…tub, breaking res Closes solutions-plug#1535
…og key instead of Closes solutions-plug#1549
|
@ivieasakome 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! 🚀 |
…5-1549 # Conflicts: # contracts/predict-iq/src/modules/migration.rs # contracts/predict-iq/src/modules/resolution.rs
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
Fix multi-hop XFF resolution, worker status gauge, outcome bet counts, and migration log history
What was solved
#1533 — Add test for client_ip.rs behavior when multiple X-Forwarded-For hops are present
Add focused test coverage (and a module doc note) in services/api/src/client_ip.rs verifying that multi-hop X-Forwarded-For headers with a spoofed leading IP resolve to the real client IP within the trusted-proxy boundary, so rate limiting and audit logging use the correct value.
Addressed:
#1534 — Add regression test ensuring metrics.rs worker_status gauges reset correctly after a worker restart
Add a regression test (and the minimal production change it requires) ensuring the email queue worker's
worker_statusgauge is explicitly set to unhealthy on crash detection before the restart/backoff sleep, so the gauge transitions unhealthy → healthy across a restart instead of staying stuck at its last healthy value.Addressed:
Metrics::set_worker_status.otel-collector-config.ymlor dashboards) references this gauge; do not modify unrelated alerting/dashboard content beyond confirming/aligning the reference.#1535 — count_bets_for_outcome is a non-functional stub, breaking resolution gas/winner metrics
Fix the non-functional
markets::count_bets_for_outcomestub so it returns the real per-outcome unique-bettor count frommarket.winner_counts, restoring accuratewinner_countandgas_estimateinresolution::get_resolution_metrics, and add a regression test with 3+ distinct bettors on the same outcome.Addressed:
count_bets_for_outcomemust read and returnmarket.winner_counts.get(outcome)instead of the broken(market_id, contract_address)Bet lookup.resolution::get_resolution_metricsmust report an accuratewinner_countfor markets with multiple bettors on the winning outcome.get_resolution_metricsreports the correct count (previously 0 or 1).#1549 — record_migration overwrites a single fixed log key instead of keeping migration history
Update the migration module so that record_migration appends entries to a per-version migration history instead of overwriting a single fixed "migration:log" key, and expose a query function that returns the full migration history. Add a test that performs two sequential migrations and verifies both entries are independently recoverable.
Addressed:
Changes
services/api/src/client_ip.rs(modify)contracts/predict-iq/src/modules/migration.rs(modify)README.md(modify)contracts/predict-iq/src/modules/mod.rs(modify)contracts/predict-iq/src/modules/resolution.rs(modify)Approach
Issues
Closes #1533
Closes #1534
Closes #1535
Closes #1549