feat(master): send the completed epoch's chain time to challenges - #315
Conversation
The master reads Timestamp.Now at the pinned end-block hash of the completed epoch (integer milliseconds, floored to seconds) and passes it to challenge containers as the authenticated get_weights query epoch_at. OpenType prices its champion decay by this chain time, not request time. - ChainSnapshot.timestamp_seconds is optional; an unavailable timestamp leaves validator snapshots unchanged (reorg check still applies). - Under algorithm 3 with trusted OpenType, a missing or invalid timestamp postpones emission before any leaf is replaced or the epoch is sealed, instead of signing NoScore. Bounty/proof-only setups are unaffected. No wall-clock or estimated block-time fallback. - No signed protocol or validator economics change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe validator now records an optional timestamp from the pinned block. The master can pass that time to container challenge requests. Algorithm 3 epochs with an OpenType challenge require valid time before scoring and sealing. ChangesHistorical epoch timestamp scoring
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant BittensorChain
participant EpochEmitter
participant ChallengeClient
participant ContainerChallenge
BittensorChain-->>EpochEmitter: Completed snapshot with optional timestamp
alt Algorithm 3 includes OpenType and timestamp is unavailable
EpochEmitter-->>EpochEmitter: Raise 503 before scoring or sealing
else Timestamp is available or not required
EpochEmitter->>ChallengeClient: Request weights with epoch and optional epoch_at
ChallengeClient->>ContainerChallenge: GET weights with request parameters
ContainerChallenge-->>ChallengeClient: Return challenge weights
ChallengeClient-->>EpochEmitter: Return weights
end
Merge Risk: ⚪ Minimal · up to No actionable issue is established for the timestamp-scoring change; it is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The new timestamp check prevents an epoch from being sealed with scores based on missing historical time. It also makes reward issuance depend on historical timestamp availability. A separate compatibility risk remains: a challenge that rejects the new request parameter could have its scores recorded as unavailable rather than causing emission to wait. Production compatibility is not established by the available tests. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 7 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Problem and behavior
OpenType is switching from finite FIFO credits (exhausted in production: every recent epoch burned OpenType's 70 %) to a continuous champion reward: 100 % for 36 h after a certified crown, then a 36 h half-life (OpentypeAI/challenge#8). Pricing needs the epoch's chain time, not the time of the HTTP request, which differs for delayed or replayed epochs.
Previous behavior:
get_weights?epoch=Nonly.New behavior:
BittensorChain.snapshotreadsTimestamp.Nowat the pinned end-block hash (validated integer ms, floored to seconds) into optionalChainSnapshot.timestamp_seconds.EpochEmitterpasses it toChallengeClient.weights(..., epoch_at=), sent as the authenticated queryepoch_at.NoScore, no burned epoch). Bounty/proof-only configurations are unaffected. No wall-clock or estimated block-time fallback.Validation
scripts/check_repo.py --finalPublic contract
docs/CHALLENGES.md)BASE_*/domain compatibility remain intactReview
CodeRabbit replaces Greptile for this repository.
Risk
Timestamp.Nowstalls sealing (loggedcompleted epoch timestamp unavailable) rather than burning.🤖 Generated with Claude Code
Summary by CodeRabbit