Skip to content

Commit 58773e6

Browse files
committed
fix(design): stay under loc-cap for D24 emitter
1 parent 6487490 commit 58773e6

1 file changed

Lines changed: 6 additions & 21 deletions

File tree

crates/design-challenge/src/orchestrator.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub struct OrchestratorConfig {
149149
/// Auto-retry budget for infra-class failures (initial attempt + this
150150
/// many retries). Default 3; `cheat` / `rejected` are always terminal.
151151
pub auto_retry_max: u32,
152-
/// D24 epoch-boundary emitter poll interval.
152+
/// Poll interval for the late-tempo D24 filler.
153153
pub emit_poll: Duration,
154154
}
155155

@@ -180,7 +180,7 @@ pub struct Orchestrator<C: ChainClient + Send + Sync> {
180180
gating: Option<Arc<dyn GatingStore>>,
181181
/// Shared chain-epoch cache (HTTP `AppState.epoch` + sweeper clock).
182182
epoch_cache: Option<Arc<AtomicU64>>,
183-
/// Last chain epoch for which [`Self::emit_leaves`] succeeded (D24 fill).
183+
/// Last epoch successfully covered by [`Self::emit_leaves`].
184184
emitted_epoch: AtomicU64,
185185
}
186186

@@ -285,12 +285,8 @@ impl<C: ChainClient + Send + Sync + 'static> Orchestrator<C> {
285285
}
286286
}
287287

288-
/// D24 epoch-boundary filler: ensure design posts a complete leaf set for
289-
/// the current chain epoch even when no admin award fired.
290-
///
291-
/// Waits until late in the tempo so `award_round` (which also emits) can
292-
/// land Score leaves first. Gap epochs get `NotAttempted` coverage so
293-
/// `base-real-seal` is not stuck on incomplete participant sets.
288+
/// Late-tempo D24 filler: `NotAttempted` coverage when no admin award fired
289+
/// (waits ~last 48 blocks so `award_round` can land Score leaves first).
294290
pub async fn run_emitter(self: Arc<Self>)
295291
where
296292
C: Sync,
@@ -314,25 +310,14 @@ impl<C: ChainClient + Send + Sync + 'static> Orchestrator<C> {
314310
let state = chain::gather_schedule_state(self.chain.as_ref(), self.cfg.netuid)
315311
.map_err(|e| format!("schedule: {e}"))?;
316312
let epoch = state.subnet_epoch_index;
317-
if epoch == 0 {
318-
return Ok(false);
319-
}
320-
if self.emitted_epoch.load(Ordering::Relaxed) >= epoch {
313+
if epoch == 0 || self.emitted_epoch.load(Ordering::Relaxed) >= epoch {
321314
return Ok(false);
322315
}
323316
let tempo = u64::from(state.tempo.max(1));
324-
// Prefer award_round's scored emit; only fill when ~last 48 blocks remain
325-
// (~tempo-48 … tempo) so mid-epoch winners are not locked behind NoScore.
326-
let near_end = state.blocks_since_last_step.saturating_add(48) >= tempo;
327-
if !near_end {
317+
if state.blocks_since_last_step.saturating_add(48) < tempo {
328318
return Ok(false);
329319
}
330320
self.emit_leaves().await?;
331-
info!(
332-
epoch,
333-
blocks_since_last_step = state.blocks_since_last_step,
334-
"design epoch leaf set emitted (D24 fill)"
335-
);
336321
Ok(true)
337322
}
338323

0 commit comments

Comments
 (0)