Description
The repo has security notes (docs/security/ATTACK-VECTORS.md, docs/security/SECURITY_CONSIDERATIONS.md) but lacks a single, code-grounded threat model tying the oracle and dispute subsystems' defenses to their implementations. With weighted-consensus, per-market staleness config, and dispute rate-limiting in flight, a consolidated threat-model document will keep contributors and auditors aligned. This issue adds that document, citing real modules and error codes.
Requirements and context
- Oracle defenses to document: sequential multi-source fetch + majority consensus (
OracleIntegrationManager in contracts/predictify-hybrid/src/oracles.rs, threshold DEFAULT_CONSENSUS_THRESHOLD = 66), staleness validation (validate_oracle_data -> Error::OracleStale, DEFAULT_MAX_STALENESS_SECS, per-market EventOracleValidationConfig), confidence bounds (Error::OracleConfidenceTooWide), and the oracle whitelist (OracleWhitelist).
- Dispute defenses to document: minimum stake (
MIN_DISPUTE_STAKE), the voting window, stake-weighted tally with exact-tie -> oracle-stands, and double-dispute prevention (Error::AlreadyDisputed); note the absence of dispute rate-limiting as a known gap (tracked separately).
- Each documented threat (oracle manipulation, stale-price exploitation, dispute griefing/spam, tie manipulation) must reference the concrete defense and the relevant
Error variant in contracts/predictify-hybrid/src/err.rs.
- Non-functional: the doc must live under
docs/security/, link from docs/README.md, and avoid duplicating ATTACK-VECTORS.md (cross-reference instead).
Acceptance criteria
Suggested execution
1. Fork the repo and create a branch — git checkout -b feature/threat-model-doc.
2. Implement changes — add docs/security/THREAT_MODEL.md; update docs/README.md index.
3. Write/extend tests — documentation only; verify all cited symbols exist via grep against contracts/predictify-hybrid/src.
4. Test and commit
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test -p predictify-hybrid
Example commit message
docs: add oracle and dispute threat-model and security-architecture document
Guidelines
Documentation coverage of all oracle/dispute defenses is expected; keep every citation verifiable against the source. Cross-reference API_DOCUMENTATION.md (Security Features, Oracle/Dispute Management). Timeframe: 96 hours.
Description
The repo has security notes (
docs/security/ATTACK-VECTORS.md,docs/security/SECURITY_CONSIDERATIONS.md) but lacks a single, code-grounded threat model tying the oracle and dispute subsystems' defenses to their implementations. With weighted-consensus, per-market staleness config, and dispute rate-limiting in flight, a consolidated threat-model document will keep contributors and auditors aligned. This issue adds that document, citing real modules and error codes.Requirements and context
OracleIntegrationManagerincontracts/predictify-hybrid/src/oracles.rs, thresholdDEFAULT_CONSENSUS_THRESHOLD = 66), staleness validation (validate_oracle_data->Error::OracleStale,DEFAULT_MAX_STALENESS_SECS, per-marketEventOracleValidationConfig), confidence bounds (Error::OracleConfidenceTooWide), and the oracle whitelist (OracleWhitelist).MIN_DISPUTE_STAKE), the voting window, stake-weighted tally with exact-tie -> oracle-stands, and double-dispute prevention (Error::AlreadyDisputed); note the absence of dispute rate-limiting as a known gap (tracked separately).Errorvariant incontracts/predictify-hybrid/src/err.rs.docs/security/, link fromdocs/README.md, and avoid duplicatingATTACK-VECTORS.md(cross-reference instead).Acceptance criteria
docs/security/THREAT_MODEL.md(or similarly named) enumerates oracle and dispute threats with mitigations.Errorvariant.docs/README.mdand references (not duplicates)ATTACK-VECTORS.mdandSECURITY_CONSIDERATIONS.md.Suggested execution
1. Fork the repo and create a branch —
git checkout -b feature/threat-model-doc.2. Implement changes — add
docs/security/THREAT_MODEL.md; updatedocs/README.mdindex.3. Write/extend tests — documentation only; verify all cited symbols exist via
grepagainstcontracts/predictify-hybrid/src.4. Test and commit
cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cargo test -p predictify-hybridExample commit message
Guidelines
Documentation coverage of all oracle/dispute defenses is expected; keep every citation verifiable against the source. Cross-reference
API_DOCUMENTATION.md(Security Features, Oracle/Dispute Management). Timeframe: 96 hours.