Skip to content

fix: restore count-based outlier quorum in price aggregation - #74

Closed
micahkendall wants to merge 1 commit into
mainfrom
codex/propose-fix-for-weight-quorum-vulnerability
Closed

fix: restore count-based outlier quorum in price aggregation#74
micahkendall wants to merge 1 commit into
mainfrom
codex/propose-fix-for-weight-quorum-vulnerability

Conversation

@micahkendall

Copy link
Copy Markdown
Member

Motivation

  • The outlier-quorum logic was changed to use total weight remaining after filtering which allows a single dominant-weight source to survive outlier removal and determine the published price.
  • The change restores multi-source integrity by requiring a majority of original sources (by count) to remain after outlier filtering before returning a price.

Description

  • Replaced the weight-based quorum check in compute_value_in_usd with a count-based majority check using total_sources and candidate_prices.len() in src/price_aggregator/conversions.rs.
  • Kept the weighted median and weighted averaging behavior for normal aggregation, but require candidate_prices.len() >= 1 + total_sources / 2 to proceed.
  • Added a regression test value_in_usd_should_not_allow_single_dominant_weight_source_after_outlier_filtering to assert that a lone dominant-weight source cannot produce a price after outlier filtering.

Testing

  • Ran cargo test -q value_in_usd_should_not_allow_single_dominant_weight_source_after_outlier_filtering which passed.
  • Ran cargo test -q value_in_usd_should_not_report_price_if_sources_are_too_far_apart which passed.
  • Ran cargo test -q value_in_usd_should_ignore_outlier_source which passed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant