feat(research): verify signed arrival-cost evidence - #788
Conversation
…ntract-v2 # Conflicts: # agent-worktree.yml
…into codex/lob-pit-trade-features
…to codex/runtime-latency-evidence # Conflicts: # agent-worktree.yml
…eatures # Conflicts: # agent-worktree.yml # rust_hft/research-core/manifest/src/lib.rs
…to codex/runtime-latency-evidence # Conflicts: # agent-worktree.yml
…to codex/runtime-latency-evidence
…to codex/runtime-latency-evidence
…-evidence # Conflicts: # agent-worktree.yml
…ation' into codex/runtime-latency-evidence # Conflicts: # agent-worktree.yml # rust_hft/market-core/engine/src/execution_worker.rs # rust_hft/market-core/ports/src/events.rs
* feat(research): define CEX replay snapshot V2 * fix(research): bind V2 snapshot evidence timelines * fix(research): keep V1 writer until consumers migrate * fix(research): harden V2 PIT evidence bounds * fix(research): bind complete PIT evidence sets * fix(research): close V2 evidence coverage gaps * fix(research): bind fee evidence to account * feat(research): materialize aggregate trade flow * feat(research): verify real lifecycle latency evidence * fix(research): bind V2 series identity * chore: refresh trade feature stack base * chore: refresh trade feature stack base * fix(research): bind latency evidence to fee account * refactor(research): pass prebuilt source lineage * chore: refresh latency evidence stack base * test(research): keep aggregate trade ids contiguous * chore: refresh latency evidence stack base * fix(research): bind real arrival latency evidence * fix(research): authenticate runtime instrument market --------- Co-authored-by: Sonic Shih <sonic.shih@mandonothing.com>
…-instrumentation # Conflicts: # agent-worktree.yml
…ation' into codex/runtime-latency-evidence # Conflicts: # agent-worktree.yml
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2c48caf0a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-instrumentation # Conflicts: # agent-worktree.yml
…ation' into codex/runtime-latency-evidence # Conflicts: # agent-worktree.yml
|
@codex review exact head 661093c against current base afc533b. The verifier streams digest-anchored signed LiveSmall fill evidence, binds Spot venue/account/symbol/PIT times, deduplicates selected events, rejects overflow, and now explicitly rejects USD-M until a real derivatives execution path exists. |
…ation' into codex/runtime-latency-evidence
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…-evidence # Conflicts: # agent-worktree.yml
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/tools/collector/src/runtime_latency_evidence.rs`:
- Around line 107-156: Move the event ID digest insertion and conflict
comparison to immediately after verify_runtime_attribution_event succeeds,
before the mode, identity, timing, and slippage selection filters. Continue only
with selected records when populating signed_events and observations, and add a
fixture containing conflicting records where one is filtered out to verify
rejection.
- Around line 35-212: Move verify_runtime_latency_evidence,
VerifiedRuntimeLatencyEvidence, and the percentile calculation from the
collector into rust_hft/alpha-harness, preserving their existing verification
and percentile behavior. Keep collector responsibilities limited to acquiring or
supplying the runtime evidence, then update module exports, dependencies, and
call sites to use the alpha-harness verifier.
- Around line 214-220: Update read_sha256_anchored to avoid unbounded
std::fs::read: open the file, read incrementally into a buffer capped at the
trusted-key size limit, and update the SHA-256 digest as chunks arrive. Reject
inputs exceeding the limit, verify the finalized digest against expected, then
parse or return only the bounded buffer.
🪄 Autofix
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 Plus
Run ID: 710252e4-85e4-4176-9a33-f393c9b9cd36
⛔ Files ignored due to path filters (1)
rust_hft/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
agent-worktree.ymlrust_hft/tools/collector/Cargo.tomlrust_hft/tools/collector/src/lib.rsrust_hft/tools/collector/src/runtime_latency_evidence.rs
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review exact head after the trust-source binding. Focused tests 7/7 and alpha-domain strict Clippy both pass. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Materialize verified Binance Spot/USD-M market tapes into the V3 outer materialization carrying CexReplaySnapshotV2: PIT instrument rules, account-bound maker/taker fees, independent funding and OI timelines, aggregate-trade flow, and signed runtime lifecycle latency evidence. Rebased onto origin/main be9e746, which already contains the signed arrival-cost evidence (#787), its verification (#788), fee-account binding (#789), and fee snapshot timers (#793). Refs #794.
* feat(research): publish verified CEX ResearchSnapshot V2 Materialize verified Binance Spot/USD-M market tapes into the V3 outer materialization carrying CexReplaySnapshotV2: PIT instrument rules, account-bound maker/taker fees, independent funding and OI timelines, aggregate-trade flow, and signed runtime lifecycle latency evidence. Rebased onto origin/main be9e746, which already contains the signed arrival-cost evidence (#787), its verification (#788), fee-account binding (#789), and fee snapshot timers (#793). Refs #794. * fix(research): close lob-pit-materializer review threads - Delegate runtime latency verification to the hardened alpha_domain::runtime_latency_evidence verifier instead of a drifted collector-local copy: event IDs are deduplicated before filtering (conflicting duplicates fail closed), every fill must carry an authenticated instrument_market_{market} identity, and USD-M fails closed until a derivatives execution path exists. - Republish verified fee and reference evidence triplets into the materialization artifact directory under content-addressed names so the digests recorded in the snapshot resolve to immutable bytes. - Restructure the test fixture per market: the happy path is Spot (signed LiveSmall latency evidence exists only for Spot), a new test proves USD-M materialization fails closed, and the aggregate-trade assertions now match the (previous, current] bucket semantics. * fix(research): anchor latency cohort and holding-interval funding - Publish the complete digest-anchored runtime feedback log and the trusted-key document into the artifact directory under their content digests, so independent readers can reverify every signed lifecycle event and no resolvable-evidence gap remains for the key document. - Charge USD-M funding settlements over each row's actual (current, future] holding interval, matching how the evaluator applies funding_bps to the held position; a settlement that precedes the holding interval is no longer charged and multi-bucket horizons collect every settlement. --------- Co-authored-by: Sonic Shih <sonic.shih@mandonothing.com>
Change contract
Verify immutable signed LiveSmall lifecycle evidence, select PIT-available market/account/symbol fills, and calculate real arrival-price latency-cost percentiles without duplicate reweighting.
Issue relationship
Closes #796
Out of scope
Runtime instrumentation, derivatives execution, fee-account mapping, materialization, deployment activation, and order placement.
Dependencies and merge order
PR #787 / issue #795 merged into main as 0bd446d.
Focused validation
Rollout and rollback
Research verifier only; no runtime mutation. Revert the squash commit to remove admission of lifecycle evidence.
Scope exception
None.
Summary by CodeRabbit