feat: bind CEX fee evidence to runtime account - #789
Conversation
|
Warning Review limit reached
Next review available in: 57 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe change binds CEX fee schedules, latency evidence, Binance fee snapshots, and published manifests to a validated runtime account ID. Binance artifacts use schema v2, and artifact verification checks account identity consistency. ChangesCEX fee runtime account binding
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant BinanceFeeSnapshotCollector
participant BinanceFeeSnapshot
participant FeeManifest
participant ArtifactVerification
BinanceFeeSnapshotCollector->>BinanceFeeSnapshot: Validate and record runtime account ID
BinanceFeeSnapshotCollector->>FeeManifest: Publish schema v2 with runtime account ID
FeeManifest->>ArtifactVerification: Verify schema and matching account ID
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e24719e39
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/bin/binance-fee-snapshot.rs`:
- Around line 61-64: Update the binance-fee-snapshot credential-loading flow
around runtime_account_id and the Binance API key/secret reads to verify that
all credentials belong to the same Binance runtime-account scope before
publishing the fee snapshot. Reject mismatched or independently supplied
credentials, while preserving valid matching configurations and the existing
invalid-account error behavior.
🪄 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: 4c6ea785-2e0c-4612-bc27-e53a2404053f
📒 Files selected for processing (4)
agent-worktree.ymlrust_hft/research-core/manifest/src/lib.rsrust_hft/tools/collector/src/bin/binance-fee-snapshot.rsrust_hft/tools/collector/src/binance_fee_artifact.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80c27b29c8
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 507085bb46
ℹ️ 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".
|
@codex review exact head 790ecfa: verify protected runtime.env admits the atomic Binance account JSON, validates exact fields, and requires its API key/secret to equal the runtime credential pair. The suggested V1 decoder is intentionally not added: production readback found no fee artifacts and the fee binary has never been deployed, so there is no immutable V1 evidence to preserve; publication moves directly to V2. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6027bde981
ℹ️ 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".
…ding # 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: 31cee2fda8
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37ff4872a3
ℹ️ 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".
|
Codex Review: Didn't find any major issues. Swish! 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
Bind authenticated Binance fee evidence and realized latency evidence to the same validated logical runtime account ID, so a caller cannot join a fee credential fingerprint to an unrelated signed account stream.
Issue relationship
Refs #779
Out of scope
Credential provisioning, order placement, runtime activation, materialization, and production cutover.
Dependencies and merge order
None. The materializer PR consumes this contract after merge.
Focused validation
cargo test -p hft-research-manifest --locked(22 passed)git diff --checkpasslibc::RUSAGE_THREADincompatibility; Linux CI is authoritativeRollout and rollback
No runtime mutation. Fee schema advances to v2 before any production fee artifacts exist; rollback is this PR revert.
Scope exception
None.
Summary by CodeRabbit
New Features
Bug Fixes