Skip to content

feat(proof): continuous leaf emitter with ChallengeInternal cover - #256

Merged
echobt merged 5 commits into
mainfrom
cursor/proof-leaf-emitter-b251
Sep 9, 2026
Merged

feat(proof): continuous leaf emitter with ChallengeInternal cover#256
echobt merged 5 commits into
mainfrom
cursor/proof-leaf-emitter-b251

Conversation

@echobt

@echobt echobt commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a continuous Proof leaf emitter so D24 seal no longer depends on prod-real-seal.sh weights-smoke NoScore pre-cover for challenge-id proof.

ProofEmitter mirrors bounty emit cadence (120s, PROOF_EMIT_POLL_SECS / --emit-poll-secs):

  1. Pin E via gather_schedule_state + expected_set_at_chain at the last epoch block.
  2. If any in-process lattice is positive: emission_scoresemit_signed_leaf_set(..., b\"proof\", ...)submit_signed_leaf_set.
  3. If this tick has no positive scores and scored_epoch < epoch: cover all of E with NoScore(ChallengeInternal) (not NotAttempted) so the 8000 bps burns to uid 0 while D24 completeness still holds.
  4. If scored_epoch >= epoch and this tick would burn: Held — do not overwrite scored leaves.

P1 (restart must not burn): scored_epoch is persisted to PROOF_SCORED_EPOCH_FILE (/var/lib/proof/scored_epoch on the artefacts volume). Independently, the gateway store refuses a ChallengeInternal burn from replacing a positive leaf for the same (challenge_id, epoch, miner_hotkey) (409, original kept; race-safe in both memory and upsert_raw_weight_tip). Score-to-score and burn-to-score supersede are unchanged.

Missing BASE_CHALLENGE_SK_FILE warns and skips the loop (/health still comes up). prod-real-seal.sh pre-cover is not removed.

Greptile

  • Greptile has reviewed this PR; findings are fixed or answered
  • Commented @greptileai

Test plan

  • cargo test -p proof-challenge --all-targets (scored / burn / held / restart-with-watermark / ChallengeInternal-not-NotAttempted)
  • cargo test -p proof-challenge-bin (no SK → None; with SK → Some; scored-epoch file default; existing bin tests)
  • cargo test -p gateway --test raw_weights (S6: ChallengeInternal over score → 409)
  • cargo clippy -p proof-challenge -p proof-challenge-bin -p gateway -p gateway-core -p gateway-store-pg -p db --all-targets -- -D warnings
  • cargo run -p xtask -- loc-cap (crates/proof-challenge 442, bins/proof-challenge 700)
  • cargo run -p xtask -- spec-check design-check external-docs-check

Risk

Emission impact: Proof now posts exact-E leaves on its own. An empty store covers E with ChallengeInternal (same D24-complete burn bounty uses when the feed is down). A restart after a scored epoch holds instead of burning. Bounty code is unchanged. Challenge signing domain stays b\"proof\". BASE_* names and prod-real-seal.sh are untouched.

Naming

I did not rename BASE_* environment variables, deployed host paths
(/opt/base, /run/base, …), GHCR baseintelligence/base package names, or
base-*-v1 cryptographic domain tags, unless this PR’s purpose is a coordinated
cutover documented in docs/NAMING.md.

Open in Web Open in Cursor 

Wire ProofEmitter at the bounty 120s cadence so D24 can seal without
weights-smoke NoScore pre-cover for challenge-id proof.

Co-authored-by: Mathis <echobt@users.noreply.github.com>
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

@greptileai

Co-authored-by: Mathis <echobt@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR wires continuous Proof leaf emission into the running challenge service and adds defense-in-depth against replacing earned scores with burn leaves.

  • Pins each emission to the expected participant set at the last epoch boundary.
  • Emits positive in-process scores or an exact-set ChallengeInternal cover when nobody scores.
  • Persists the scored-epoch watermark across restarts.
  • Rejects burn-over-score replacement in both gateway store implementations.
  • Adds deployment configuration, migration coverage, emitter tests, and updated operational documentation.

Confidence Score: 5/5

Safe to merge.

No outstanding findings remain. The previously reported restart behavior is fully fixed: the scored-epoch watermark is persisted after scoring and restored at startup, and the gateway rejects a ChallengeInternal burn that would replace a positive leaf.

Reviews (5): Last reviewed commit: "Merge branch 'main' into cursor/proof-le..." | Re-trigger Greptile

Comment thread crates/proof-challenge/src/emit.rs
@echobt

echobt commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai

echobt and others added 2 commits September 10, 2026 02:17
Hold scored leaves across proof-challenge restarts via
PROOF_SCORED_EPOCH_FILE, and refuse ChallengeInternal from
replacing a positive raw-weight leaf at the gateway store.

Co-authored-by: Mathis <echobt@users.noreply.github.com>
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

@greptileai

1 similar comment
@echobt

echobt commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai

@echobt

echobt commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai

@echobt
echobt marked this pull request as ready for review September 9, 2026 22:40
@echobt
echobt merged commit 04f8372 into main Sep 9, 2026
5 checks passed
@echobt
echobt deleted the cursor/proof-leaf-emitter-b251 branch September 9, 2026 22:40
cursor Bot pushed a commit that referenced this pull request Sep 9, 2026
Retarget #257: main moved to #256. Digests from images run
34413377036. previous stays the full a8b9018 staging release.

Co-authored-by: Mathis <echobt@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Sep 10, 2026
Retarget #257: main moved to #256. Digests from images run
34413377036. previous stays the full a8b9018 staging release.

Co-authored-by: Mathis <echobt@users.noreply.github.com>
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.

2 participants