GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(proof): require miner hotkey signature on submit by echobt · Pull Request #259 · CortexLM/cortex

feat(proof): require miner hotkey signature on submit #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Mathis (echobt) merged 6 commits into main from cursor/proof-submit-hotkey-sig-e053
Sep 10, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

feat(proof): require miner hotkey signature on submit #259

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit Hold shift + click to select a range
e246973
feat(proof): require miner hotkey signature on submit
cursoragent Sep 9, 2026
48d4dd3
test(proof-http): keep miner_hotkey on zero-sig 401 probe
cursoragent Sep 9, 2026
ca28099
feat(proof): sign the manifest and require a single-use submit_nonce
cursoragent Sep 10, 2026
6c8bba2
fix(proof): verify submit hex fields as posted; one signer per ctx run
cursoragent Sep 10, 2026
e009b03
docs(proof): a queued re-send needs a fresh submit_nonce
cursoragent Sep 10, 2026
dbec1a3
refactor(ctx): spell hex only through proof-submit's canonicaliser
cursoragent Sep 10, 2026
File filter
Filter by extension


Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
feat(proof): sign the manifest and require a single-use submit_nonce
Greptile P1s on #259. The base-proof-submit-v1 payload now ends with
manifest_canonical || 0xff || submit_nonce_hex, where manifest_canonical
is count || (0xff || entry)* per list (train_content_hashes, then
train_dataset_ids), entries sorted bytewise, lists joined by 0xff. A
captured signature cannot be reused with another contamination manifest.

submit_nonce is a client-chosen 32-byte value as 64 lowercase hex. The
host verifies the signature, then reserves (hotkey, nonce) atomically in
the submission store before any budget check, rent, or row; a replay is
401 submit_nonce reused and never evaluates twice. Missing/invalid nonce
is 401. hotkey_signature is now exactly 128 lowercase hex, no 0x (P2).

ctx proof submit / sign draw a fresh nonce per run, print it, and sign
the manifest they post; --submit-nonce pins one (required with
--signature). Operator sign script and probes pass the manifest through;
the e2e probe replays a scored body and expects 401.

Co-authored-by: Mathis <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@cursoragent @echobt
cursoragent and echobt committed Sep 10, 2026
commit ca280994ae0577504a3335fa0da697120381d073

There are no files selected for viewing

2 changes: 1 addition & 1 deletion 2 AGENTS.md
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ When verifying a challenge (local-e2e, staging, or focused tests), **simulate a
2. Edge / failure probes: bad harness, sanitize reject, quota, wrong routes/auth.
3. **Bounty — pair + report:** `ctx bounty pair --hotkey <ss58> --account-id <id> --accept-terms`, then `POST /v1/pair` (terms + signature) and `POST /v1/reports`. Operator bearer `POST /v1/admin/adjudicate` (`valid` / `already_fixed_not_prod` / `invalid_malicious` / `duplicate`). Scoring **reads** CortexLM/backend public JSON (`BOUNTY_BACKEND_PUBLIC_URL`); do not serve `/v1/public/*` from this repo.
4. **Bounty — fail-closed scorer:** the CortexLM/backend public feed is the only scorer. With no readable `BOUNTY_BACKEND_PUBLIC_URL`, `POST /v1/reports` must answer **503** and the emitter must pay **nobody** — it still covers `E` with `NoScore(ChallengeInternal)`, because a paid challenge with no leaves 409s the seal for every challenge. `BOUNTY_FORCE_SIM` is retired — do not reintroduce an offline bounty scorer. See [`docs/BOUNTY.md`](docs/BOUNTY.md).
5. **Proof — submit:** `POST /v1/submissions` with a `topic_id` and miner `hotkey_signature` (sr25519 over `base-proof-submit-v1`; `X-Lium-Api-Key` is not identity). Missing/unknown/not-open → **400** (no row); missing/invalid signature → **401** (no row); a custom topic without `artifact_uri` → **400** (no row); an `artifact_digest` that is the sha256 of nothing (zero bytes / an empty tar) → **400** (no row) — the KVM host likewise refuses a content-less or compressed `artifact_tar` before any sister, so an empty-artefact fetch stub can never score. Empty `eval_image_digest`, missing/closed/misconfigured RLM judge `InferenceOffer`, missing judge API key, spoofed topic origin, missing/closed/non-`1x` `EvalExecutorOffer` (Lium path), zero open topics, or an unsealed baseline → **503**. Miners submit claim + code + FLOPs + artifact; they do not bind the judge offer or the executor offer. Contamination / empty manifest persist **rejected** without rent; on custom topics the runner's measured `flops_used` over the budget or over the miner's `declared_flops` persists **rejected** after the run, and a report without a measurement is **503** (no row). `GET /v1/proof/topics` must never leak holdout records.
5. **Proof — submit:** `POST /v1/submissions` with a `topic_id`, miner `hotkey_signature` (sr25519 over `base-proof-submit-v1`: hotkey, topic, artefact, FLOPs, claim, canonical manifest, nonce; `X-Lium-Api-Key` is not identity), and a single-use 64-hex `submit_nonce` (the `(hotkey, nonce)` pair is reserved in the store before any row or rent; a replay is **401** `submit_nonce reused`). Missing/unknown/not-open → **400** (no row); missing/invalid signature or nonce → **401** (no row); a custom topic without `artifact_uri` → **400** (no row); an `artifact_digest` that is the sha256 of nothing (zero bytes / an empty tar) → **400** (no row) — the KVM host likewise refuses a content-less or compressed `artifact_tar` before any sister, so an empty-artefact fetch stub can never score. Empty `eval_image_digest`, missing/closed/misconfigured RLM judge `InferenceOffer`, missing judge API key, spoofed topic origin, missing/closed/non-`1x` `EvalExecutorOffer` (Lium path), zero open topics, or an unsealed baseline → **503**. Miners submit claim + code + FLOPs + artifact; they do not bind the judge offer or the executor offer. Contamination / empty manifest persist **rejected** without rent; on custom topics the runner's measured `flops_used` over the budget or over the miner's `declared_flops` persists **rejected** after the run, and a report without a measurement is **503** (no row). `GET /v1/proof/topics` must never leak holdout records.
6. **Proof — executor:** `GET /v1/proof/executor` is always 200 (`ready` + `reason`); `POST /v1/admin/proof/executor` (operator bearer) rotates or closes the live `1x` offer and 400s anything the pin refuses. Harvest rents the offer's `lium_template_id` at exactly `1x` (any other `rent_gpu_count` aborts before the rent) under `max_proof_deadline_s`; a run cut at the deadline is **503 + `stdout_tail`**. `PROOF_HARVEST_*` env only hot-swaps under the pin ceilings. Never a live Lium rent in CI.
7. **Proof — topic VMs (custom family):** the RLM runs in one Firecracker microVM per `topic_id` on a host with a working `/dev/kvm` (`proof-vm-orchestrator`, HTTPS + bearer **file**) — production: a dedicated DO droplet (`g-8vcpu-32gb`, nyc1, nested `/dev/kvm`) on the VPC, never colocated on the CP; staging: colocating the agent on the CP droplet with nested `/dev/kvm` is an allowed exception, proven on `cortex-staging` (nested stays fragile — if the boot fails, provision the dedicated droplet); the agent's TLS certificate carries a SAN for every host the CP's URL names (`PROOF_VM_AGENT_TLS_SANS`, checked at boot; `deploy/scripts/proof-vm-agent-tls.sh`); never on Lium, never emulated; every paid run is a **sister** Firecracker guest with **no network**, and the host stamps `sandboxed` / guest-measured `flops_used` on the report. `PROOF_VM_ORCHESTRATOR_URL` unset → `UnwiredVmOrchestrator` (503); URL set but token file missing/empty, `PROOF_RLM_VM_IMAGE_DIGEST` unpinned, agent down, or a `firecracker_required` run without the sister attestation → **503, no row, no host fallback**. `PROOF_VM_RUNNER_CUSTOM_IDS` is the only thing that registers a runner. The custom family is wired from that env alone — live orchestrator selected + ≥1 id → `FamilyMux::custom_only` when no Lium harvest is wired (custom topics score; `nll` / `throughput` → **503**, no row); never stage a placeholder Lium key to open custom topics, and the unwired stub never carries a mux. `/v1/status` keeps the families apart: `live_harvest_wired` is the **Lium harvest only** (never true because a custom mux exists); the custom family is `custom_family_wired` / `registered_custom` / `custom_ready`. Hard `topic_id ↔ VM` bind on both sides (agent 409 `topic_mismatch`). **Artefact identity is the served file, verbatim:** `artifact_digest` = sha256 of the exact bytes at `artifact_uri` (an uncompressed tar with content); the RLM guest verifies what it fetched (`proof_vm_proto::tar::verify_artifact`) and forwards those bytes unchanged — never a re-tar, never a substitute tree; a fetch that fails or does not verify is `RlmToHost::Failed` (503, no row); the host runs the same check before any sister jail and refuses gzip / non-tar / content-less / mis-hashed bytes by name. Do not invent an RLM / sister image digest. **Zero live Firecracker in CI** — every test uses the fake hypervisor. Probe the wire with `GET /v1/admin/proof/vm-orchestrator` (operator bearer, loopback) or `deploy/scripts/proof-vm-wire-check.sh` (`all`, `boot-probe`, `matrix` + `submit-probe --expect 503 --reason …`). Runbook: [`docs/runbooks/proof-vm-orchestrator.md`](docs/runbooks/proof-vm-orchestrator.md) § DigitalOcean staging. **Experiment VMs (in-guest runner topics):** a topic whose signed `constraints.params` select an in-guest runner (`baseline_runner` / synonym `in_guest_benchmark_runner` + `experiment_pack_digest`, naming an operator-baked adaptor id) gets **one dedicated Firecracker VM per paid job** (created for the `Baseline` / `Evaluate` job, destroyed after it; parallel experiments are parallel VMs, never containers sharing one), sized under **configurable caps — Architecte lock: 16 vCPU / 32 GiB RAM (the default a silent topic gets, the ceiling a topic may ask up to, and a hard maximum: a CP or host ceiling set above 16 / 32768 does not boot, a smaller host may only lower it), writable disk ≥ 16 GiB (32 GiB by default, not locked)** (`PROOF_EXPERIMENT_VM_*` on the CP, `PROOF_VM_AGENT_EXPERIMENT_MAX_*` + `PROOF_VM_AGENT_MAX_EXPERIMENT_VMS` on the host; over a ceiling = **503**, never a clamp). The result is returned **only when the orchestrator confirms the VM destroyed** — a failed or unconfirmed destroy after a successful run is `TeardownUnconfirmed` (503, no row, no baseline), never a scored result while the VM may still hold capacity. The host re-hashes the pinned pack from `PROOF_VM_AGENT_EXPERIMENT_PACK_DIR` before any jail and stages it over vsock; the guest agent (`bins/proof-vm-guest-agent`, generic) fetches the artefact streamed under a hard 64 MiB cap, refuses two signed params that collide as one `PROOF_PARAM_*` name, drains adaptor output into a bounded rolling tail while it runs, execs the operator adaptor for that runner id, and never reports a value it did not get from `report.json` — no runner / adaptor / pack / report → `Failed` (503, no row); the host attests the run `experiment_vm` for that VM and job. **Generalist rule:** runner ids, pack digests, model pins, sizes, and every adaptor input are signed-topic params; no benchmark, dataset, task list, harness, adaptor, or pack name is compiled in or committed — `deploy/guest/runners/` holds the adaptor contract and a fail-closed skeleton only (the guest image, its harness tooling via the bake's generic `--extra-pkgs` / `--overlay` / `--chroot-hook`, and its adaptors are operator artefacts baked with `deploy/guest/bake-rootfs.sh` — rootless podman on run-as-owned scratch paths, not Docker-in-VM, no nested KVM). Runbook: [`docs/runbooks/proof-experiment-vms.md`](docs/runbooks/proof-experiment-vms.md).
8. Leaf emission → `POST /v1/weights/raw` → seal → `GET /v1/weights/latest` with **`sealed: true`** (burn fallback alone is not a real seal).
Expand Down
1 change: 1 addition & 0 deletions 1 Cargo.lock
Show comments
View file
Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

87 changes: 71 additions & 16 deletions 87 bins/ctx/src/main.rs
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,33 @@ struct ProofKeyArgs {
/// 128-hex signature produced by an offline sign.
#[arg(long, value_name = "HEX")]
signature: Option<String>,
/// 64-hex single-use nonce bound into the signature. Fresh random when
/// omitted; required with --signature.
#[arg(long, value_name = "HEX64")]
submit_nonce: Option<String>,
}

/// Contamination manifest: the training data you declare. Signed.
#[derive(Debug, Args)]
struct ProofManifestArgs {
/// Full manifest JSON file, used verbatim.
#[arg(long, value_name = "PATH")]
manifest_file: Option<PathBuf>,
/// Shard content hash you trained on (repeatable).
#[arg(long = "train-hash", value_name = "SHA256")]
train_hashes: Vec<String>,
/// Dataset / corpus id you trained on (repeatable).
#[arg(long = "train-dataset", value_name = "ID")]
train_datasets: Vec<String>,
}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


/// Artifact and topic arguments for a Proof submit.
#[derive(Debug, Args)]
struct ProofSubmitArgs {
#[command(flatten)]
key: ProofKeyArgs,
#[command(flatten)]
manifest: ProofManifestArgs,
/// Open topic id (`ctx proof topics`).
#[arg(long, value_name = "ID")]
topic_id: String,
Expand All @@ -203,25 +223,19 @@ struct ProofSubmitArgs {
/// FLOPs spent reproducing the recipe. Must be ≤ the topic budget.
#[arg(long, value_name = "N")]
declared_flops: u64,
/// Full manifest JSON file, used verbatim.
#[arg(long, value_name = "PATH")]
manifest_file: Option<PathBuf>,
/// Shard content hash you trained on (repeatable).
#[arg(long = "train-hash", value_name = "SHA256")]
train_hashes: Vec<String>,
/// Dataset / corpus id you trained on (repeatable).
#[arg(long = "train-dataset", value_name = "ID")]
train_datasets: Vec<String>,
/// Keep polling until the submission stops moving.
#[arg(long)]
wait: bool,
}

/// Fields needed to sign a Proof submit without posting it.
/// Fields needed to sign a Proof submit without posting it. The manifest is
/// part of the signed bytes, so pass the same one you will post.
#[derive(Debug, Args)]
struct ProofSignArgs {
#[command(flatten)]
key: ProofKeyArgs,
#[command(flatten)]
manifest: ProofManifestArgs,
/// Open topic id (`ctx proof topics`).
#[arg(long, value_name = "ID")]
topic_id: String,
Expand Down Expand Up @@ -273,9 +287,9 @@ async fn run_proof(client: &Client, cmd: ProofCmd, json: bool) -> Result<(), Str
artifact_uri: args.artifact_uri,
claim: args.claim,
declared_flops: args.declared_flops,
manifest_file: args.manifest_file,
train_hashes: args.train_hashes,
train_datasets: args.train_datasets,
manifest_file: args.manifest.manifest_file,
train_hashes: args.manifest.train_hashes,
train_datasets: args.manifest.train_datasets,
wait: args.wait,
key: submit_key(args.key),
};
Expand All @@ -288,9 +302,9 @@ async fn run_proof(client: &Client, cmd: ProofCmd, json: bool) -> Result<(), Str
artifact_uri: None,
claim: args.claim,
declared_flops: args.declared_flops,
manifest_file: None,
train_hashes: Vec::new(),
train_datasets: Vec::new(),
manifest_file: args.manifest.manifest_file,
train_hashes: args.manifest.train_hashes,
train_datasets: args.manifest.train_datasets,
wait: false,
key: submit_key(args.key),
};
Expand All @@ -310,6 +324,7 @@ fn submit_key(key: ProofKeyArgs) -> SubmitKey {
wallet_name: key.wallet_name,
wallet_hotkey: key.wallet_hotkey,
signature: key.signature,
submit_nonce: key.submit_nonce,
}
}

Expand Down Expand Up @@ -477,6 +492,46 @@ mod tests {
} => {
assert!(args.key.hotkey.is_none());
assert!(args.key.secret_file.is_some());
assert!(args.key.submit_nonce.is_none(), "fresh nonce by default");
assert_eq!(args.manifest.train_datasets, ["mix-v0"]);
}
other => panic!("wrong command: {other:?}"),
}
}

#[test]
fn proof_sign_takes_the_manifest_and_an_explicit_nonce() {
let digest = "ab".repeat(32);
let nonce = "cd".repeat(32);
let cli = Cli::try_parse_from([
"ctx",
"proof",
"sign",
"--secret-file",
"/tmp/hotkey.sk",
"--submit-nonce",
&nonce,
"--topic-id",
"dt-no-ib-v0",
"--artifact-digest",
&digest,
"--claim",
"beat baseline",
"--declared-flops",
"1",
"--train-dataset",
"mix-v0",
"--train-hash",
&digest,
])
.expect("parse");
match cli.cmd {
Cmd::Proof {
cmd: ProofCmd::Sign(args),
} => {
assert_eq!(args.key.submit_nonce.as_deref(), Some(nonce.as_str()));
assert_eq!(args.manifest.train_datasets, ["mix-v0"]);
assert_eq!(args.manifest.train_hashes, [digest]);
}
other => panic!("wrong command: {other:?}"),
}
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.