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 — refactor(ctx): spell hex only through proof-submit's canonicaliser · CortexLM/cortex@dbec1a3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • bins/ctx/src
    • proof.rs
  • crates/proof-http/src
    • lib.rs
  • docs/external-miner
    • proof.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bins/ctx/src/proof.rs‎

Copy file name to clipboardExpand all lines: bins/ctx/src/proof.rs
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use std::time::Duration;
55

66
use keystore::{default_wallets_dir, load_hotkey, mini_secret_from_key_file, BittensorWallet};
77
use proof_submit::{
8-
fresh_submit_nonce_hex, hotkey_hex, manifest_lists, parse_hotkey_hex, parse_signature_hex,
9-
parse_submit_nonce_hex, sign_submit, verify_submit, SubmitFields, PROOF_SUBMIT_DOMAIN_LABEL,
8+
canonical_hex, fresh_submit_nonce_hex, hotkey_hex, is_lowercase_hex, manifest_lists,
9+
parse_hotkey_hex, parse_signature_hex, parse_submit_nonce_hex, sign_submit, verify_submit,
10+
SubmitFields, PROOF_SUBMIT_DOMAIN_LABEL,
1011
};
1112
use serde_json::{json, Value};
1213

@@ -185,7 +186,7 @@ fn resolve_signed(
185186
.map_err(|_| "manifest lists must be arrays of strings".to_owned())?;
186187
let nonce = match &input.key.submit_nonce {
187188
Some(raw) => {
188-
let n = raw.trim().to_ascii_lowercase();
189+
let n = canonical_hex(raw);
189190
parse_submit_nonce_hex(&n).map_err(|_| "submit-nonce must be 64 hex characters")?;
190191
n
191192
}
@@ -243,7 +244,7 @@ fn resolve_hotkey_and_sig(
243244
"hotkey",
244245
)?;
245246
let pk = parse_hotkey_hex(&hotkey).map_err(|e| e.to_string())?;
246-
let sig_hex = hex_sig.trim().trim_start_matches("0x").to_ascii_lowercase();
247+
let sig_hex = canonical_hex(hex_sig);
247248
let sig =
248249
parse_signature_hex(&sig_hex).map_err(|_| "hotkey_signature invalid".to_owned())?;
249250
let fields = SubmitFields {
@@ -436,12 +437,14 @@ fn ensure_declared(manifest: &Value) -> Result<(), String> {
436437
Ok(())
437438
}
438439

440+
/// The one wire form of a 64-hex field, produced by the same `proof-submit`
441+
/// canonicaliser the host's parser accepts — `ctx` never spells hex itself.
439442
fn normalize_hex64(s: &str, field: &str) -> Result<String, String> {
440-
let t = s.trim().trim_start_matches("0x");
441-
if t.len() != 64 || !t.chars().all(|c| c.is_ascii_hexdigit()) {
443+
let canonical = canonical_hex(s);
444+
if !is_lowercase_hex(&canonical, 64) {
442445
return Err(format!("{field} must be 64 hex characters"));
443446
}
444-
Ok(t.to_ascii_lowercase())
447+
Ok(canonical)
445448
}
446449

447450
fn print_fields(body: &Value) {
Collapse file

‎crates/proof-http/src/lib.rs‎

Copy file name to clipboardExpand all lines: crates/proof-http/src/lib.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ fn is_digest_of_nothing(hex64: &str) -> bool {
500500
fn parse_artifact_digest(s: &str) -> Result<String, (StatusCode, Json<serde_json::Value>)> {
501501
// Named before the encoding check so a pasted empty-tar digest gets the
502502
// useful answer whatever its case.
503-
if is_digest_of_nothing(s.trim().trim_start_matches("0x")) {
503+
if is_digest_of_nothing(&proof_submit::canonical_hex(s)) {
504504
return Err(err(
505505
StatusCode::BAD_REQUEST,
506506
"artifact_digest is the sha256 of empty input (or of an empty tar archive): hash the recipe bytes you ship at artifact_uri",
Collapse file

‎docs/external-miner/proof.md‎

Copy file name to clipboardExpand all lines: docs/external-miner/proof.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ submission row.
363363
| **503** `proof deadline … exceeded` | Your recipe did not finish inside `max_proof_deadline_s`; the body carries the run's `stdout_tail` | no | no (pod torn down) |
364364
| **503** `custom metric … has no registered runner` / `not wired` | The topic's `custom_id` has no runner on this host, or its topic VM is not configured | no | no |
365365
| **201** `queued` | Topic in `deferred_topics` (operator still installing its scoring path); every **400** above still applies first | **yes** (queued, scored later) | **no** (not yet) |
366-
| **200** existing row (`already queued …` / `already submitted … and scored`) | Same artefact + hotkey re-sent to a deferring topic, before or after its row was drained | existing row | **no** |
366+
| **200** existing row (`already queued …` / `already submitted … and scored`) | Same artefact + hotkey re-sent (freshly signed, new `submit_nonce`) to a deferring topic, before or after its row was drained | existing row | **no** |
367367
| **201** `rejected` + `contamination_evidence_missing` | Empty manifest | **yes** (rejected) | **no** |
368368
| **201** `rejected` + contamination | Holdout shard / corpus id in `manifest` | **yes** (rejected) | **no** |
369369
| **201** `rejected` + `anti-cheat checklist red` | A topic rule failed on your artefact | **yes** (rejected) | **no** (no paid inference) |

0 commit comments

Comments
0 (0)
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.