Skip to content

Add oracle median price and signer quorum config#333

Open
Tomoya0k wants to merge 1 commit into
SO4-Markets:mainfrom
Tomoya0k:feat/oracle-multisigner-median-prices
Open

Add oracle median price and signer quorum config#333
Tomoya0k wants to merge 1 commit into
SO4-Markets:mainfrom
Tomoya0k:feat/oracle-multisigner-median-prices

Conversation

@Tomoya0k

@Tomoya0k Tomoya0k commented Jun 26, 2026

Copy link
Copy Markdown

Closes #280

Summary

This PR adds multi-signer oracle price aggregation with median price selection and per-token quorum configuration.

Changes

  • Added per-token signer configuration and quorum storage.

  • Added admin configuration for trusted keeper signer indices.

  • Added median calculation for signed oracle submissions.

  • Updated production set_prices(...) to:

    • validate submitted signed prices
    • preserve timestamp and ledger sequence freshness checks
    • preserve upstream circuit breaker validation
    • validate signer membership per token
    • reject duplicate signer submissions for the same token
    • verify ed25519 signatures
    • enforce quorum before storing prices
    • store median min/max prices per token
  • Preserved backward compatibility when no per-token signer config is set.

  • Kept set_prices_simple(...) as a simple test helper that stores submitted TokenPrice values directly while still running circuit breaker checks.

  • Added/update tests for median calculation, signer configuration, quorum validation, duplicate signer rejection, and single-signer compatibility.

Tests

  • cargo fmt
  • cargo test -p oracle

Notes

During workspace testing, an ADL handler failure was observed. I verified that the same failure occurs when using origin/main's oracle implementation, with the error happening in apply_delta_to_u128, so it appears unrelated to this oracle change.

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.

feat: multi-oracle price aggregation with median selection for manipulation resistance

1 participant