Skip to content

feat(market-data): aggregate verified Polymarket evidence - #136

Merged
proerror77 merged 5 commits into
mainfrom
codex/polymarket-verified-evidence-set
Jul 18, 2026
Merged

proerror77 merged 5 commits into
mainfrom
codex/polymarket-verified-evidence-set

Conversation

@proerror77

@proerror77 proerror77 commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Change contract\n\nAggregate independently sealed and verified Polymarket evidence handles into one read-only, contiguous BTC/SOL evidence set without accepting raw rows or weakening any member trust boundary.\n\n## Out of scope\n\nSnapshot construction, CLI acquisition, OSS selection/downloading, prediction audit generation, evaluator execution, collector changes, deployment, and live execution.\n\n## Dependency or merge order\n\nNone. This focused data-layer seam can merge independently before downstream multi-member snapshot and audit consumers.\n\n## Focused validation\n\n- Focused GitHub Linux run: https://github.com/proerror77/monday/actions/runs/29646163256\n- Rust 1.91.0 formatting completed with no further diff.\n- Evidence-set counterexamples passed for empty input, gaps, overlap, duplicate artifact digests, duplicate market/condition/token/trade identities, missing or duplicate BTC/SOL slots, and misaligned manifest ranges.\n- Positive coverage passed for two independently sealed and verified continuous 60-minute members.\n- Focused library clippy with warnings denied and package check passed.\n- Formal CI identified the mechanically required policy identity as sha256:7dd434d5401c17245313e6e1db78cd6dd9d7fde6033dafa8e1d1be544fdd2884; both BTC/SOL mission templates are pinned to that exact generated value in this PR.\n- Scope: 5 files, 474 non-generated changed lines.\n\n## Rollout/rollback impact\n\nLibrary-only and fail-closed; no runtime rollout. The mission-template edits only keep the checked-in governed policy identity synchronized with this source change. Roll back by reverting this PR before downstream consumers depend on the aggregate handle.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds VerifiedPolymarketEvidenceSet and aggregation logic for verified Polymarket artifacts, enforcing deterministic ordering, digest and identifier uniqueness, contiguous 5-minute coverage, required BTC/SOL symbols, and comprehensive validation tests.

Changes

Verified evidence set aggregation

Layer / File(s) Summary
Evidence set API
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/mod.rs, rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/set.rs
Adds the public evidence-set type, aggregate bounds, artifact iterators, aggregation entry point, and module re-export.
Aggregation and validation
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/set.rs
Sorts members deterministically and validates digests, aligned and contiguous ranges, global artifact identifiers, and complete BTC/SOL 5-minute slot pairs.
Aggregation validation coverage
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/set.rs, rust_hft/prediction-markets/tasks/todo.md
Tests successful aggregation and rejection cases for range, digest, symbol, and identifier violations; adds the corresponding research checklist task.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VerifiedEvidence
  participant aggregate_verified_polymarket_evidence
  participant validate_members
  participant VerifiedPolymarketEvidenceSet
  VerifiedEvidence->>aggregate_verified_polymarket_evidence: submit verified members
  aggregate_verified_polymarket_evidence->>validate_members: validate ordering and coverage
  validate_members-->>aggregate_verified_polymarket_evidence: return aggregate bounds
  aggregate_verified_polymarket_evidence->>VerifiedPolymarketEvidenceSet: create validated set
Loading

Possibly related PRs

  • proerror77/monday#133: Builds research snapshots from verified Polymarket evidence artifacts and uses the same evidence-processing path.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main change: aggregating verified Polymarket evidence.
Description check ✅ Passed The description closely follows the template and provides concrete contract, scope, validation, and rollback details.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/polymarket-verified-evidence-set

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proerror77
proerror77 force-pushed the codex/polymarket-verified-evidence-set branch from 869bb21 to fffdb5b Compare July 18, 2026 13:37
@proerror77
proerror77 force-pushed the codex/polymarket-verified-evidence-set branch from fffdb5b to 0d1ca71 Compare July 18, 2026 13:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/set.rs (1)

74-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the promised empty-input rejection test.

The guard is correct, but no test exercises it despite empty-input validation being an explicit PR objective.

Proposed test
+    #[test]
+    fn rejects_empty_evidence_set() {
+        let error = aggregate_verified_polymarket_evidence(Vec::new()).unwrap_err();
+        assert!(error.to_string().contains("must not be empty"), "{error:#}");
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/set.rs`
around lines 74 - 77, Add a test for the verified evidence-set constructor or
validation path that supplies an empty members collection and asserts it rejects
the input with the “verified evidence set must not be empty” error. Keep
existing valid-input tests unchanged and place the test alongside the relevant
evidence-set tests in set.rs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@rust_hft/prediction-markets/tasks/todo.md`:
- Line 41: Mark the implemented Polymarket evidence aggregation task as complete
in the todo tracker by changing its unchecked checkbox to checked. Keep the task
wording unchanged and limit the update to that tracker entry.

---

Nitpick comments:
In
`@rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/set.rs`:
- Around line 74-77: Add a test for the verified evidence-set constructor or
validation path that supplies an empty members collection and asserts it rejects
the input with the “verified evidence set must not be empty” error. Keep
existing valid-input tests unchanged and place the test alongside the relevant
evidence-set tests in set.rs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a184b63f-555d-4009-a5be-78cccd6bf08f

📥 Commits

Reviewing files that changed from the base of the PR and between d076089 and 0d1ca71.

📒 Files selected for processing (3)
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/mod.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/set.rs
  • rust_hft/prediction-markets/tasks/todo.md

Comment thread rust_hft/prediction-markets/tasks/todo.md Outdated
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.

1 participant