{
  "component": "rckangaroo-private-adapter",
  "item": "rckangaroo-private-adapter",
  "batch": "e2-runner-components",
  "objectiveStatus": "INCOMPLETE",
  "objectiveStatusReason": "This item delivers a source-pinned, leak-hardened private adapter and runnable package only. No GPU/CUDA was supplied to this worker (no nvcc present), so the real #140 solve was not run and no key was recovered or paid. The objective requires a verified real solution and a confirmed prize payment; neither is done here.",
  "baseCommit": {
    "note": "Changes started from the goal trunk; only rckangaroo/** was modified.",
    "upstreamRepo": "https://github.com/RetiredC/RCKangaroo",
    "upstreamPinnedCommit": "618473acd7f5e696be5ec4f8377c18cc55c1361c",
    "upstreamCommitVerified": "git fetch --depth 1 + checkout FETCH_HEAD; rev-parse HEAD == pinned commit"
  },
  "files": {
    "vendoredSourcePatched": [
      "rckangaroo/upstream/RCKangaroo.cpp (PATCHED: candidate-fd key sink)",
      "rckangaroo/upstream/GpuKang.cpp", "rckangaroo/upstream/GpuKang.h",
      "rckangaroo/upstream/Ec.cpp", "rckangaroo/upstream/Ec.h",
      "rckangaroo/upstream/utils.cpp", "rckangaroo/upstream/utils.h",
      "rckangaroo/upstream/CallCubin.cpp", "rckangaroo/upstream/CallCubin.h",
      "rckangaroo/upstream/RCGpuCore.cu", "rckangaroo/upstream/RCGpuUtils.h",
      "rckangaroo/upstream/defs.h", "rckangaroo/upstream/CMakeLists.txt",
      "rckangaroo/upstream/README.md", "rckangaroo/upstream/LICENSE.TXT",
      "rckangaroo/upstream/fuse.asm", "rckangaroo/upstream/main.asm",
      "rckangaroo/upstream/mod_inv.asm", "rckangaroo/upstream/mod_mul.asm",
      "rckangaroo/upstream/mod_sub.asm", "rckangaroo/upstream/newKernelB.asm"
    ],
    "adapter": [
      "rckangaroo/adapter/rck_adapter.py",
      "rckangaroo/adapter/btccrypto.py",
      "rckangaroo/adapter/manifest_140.json"
    ],
    "patches": ["rckangaroo/patches/0001-candidate-fd-key-sink.patch"],
    "tests": [
      "rckangaroo/tests/test_output_path.py",
      "rckangaroo/tests/fake_solver.py",
      "rckangaroo/tests/cuda_kat_harness.py"
    ],
    "build": ["rckangaroo/build/build_cuda.sh"],
    "provenance": ["rckangaroo/PROVENANCE.json", "rckangaroo/SHA256SUMS.txt"],
    "docs": ["rckangaroo/README.md", "rckangaroo/docs/SECURITY.md", "rckangaroo/docs/CHECKPOINTS.md"],
    "excludedFromVendoring": {
      "RESULTS.TXT": "contains a plaintext recovered key; excluded by policy",
      "kernel_sm89.cubin": "prebuilt opaque GPU binary (turbo sm_89); hash recorded in PROVENANCE.json",
      "kernel_sm120.cubin": "prebuilt opaque GPU binary (turbo sm_120); hash recorded",
      "RCKangaroo.sln / .vcxproj / .vcxproj.user": "Visual Studio files not needed for CMake/Linux build"
    },
    "pathScope": "all modified files are under rckangaroo/** as required; no root/config files touched"
  },
  "patch": {
    "file": "rckangaroo/upstream/RCKangaroo.cpp",
    "pristineSha256": "ef2a2819f33456c52be2a06d9c97db62d8f12e524d3d598b0c9c4a8e2ce805f0",
    "patchedSha256": "7d0224cc72fd32bc78a7568e671408c705d3935c7470d3d4c3d353ef3b6ce13a",
    "patchSha256": "f85f253f56564aa2d9dcfb5bbc3b062ac39ae709c4fbab9b97963eb90fe30afd",
    "changes": [
      "removed stdout printf of 'PRIVATE KEY' and the fopen/fprintf append to RESULTS.TXT",
      "added EmitCandidate(): writes exactly 32 big-endian key bytes to inherited gCandidateFd, loops on partial writes/EINTR, fsync, returns false on any failure",
      "added --candidate-fd option parsing (int fd, >=0)",
      "main/real mode now requires --candidate-fd and aborts (exit 2) to label_end if absent",
      "key emit path scrubs the 32-byte buffer and fails closed (exit 2, no key on any stream) if EmitCandidate fails",
      "main returns gExitCode"
    ],
    "reviewEvidence": "diff in patches/0001-candidate-fd-key-sink.patch (131 lines). grep over patched file shows zero remaining 'PRIVATE KEY'/'RESULTS.TXT'/GetHexStr(s) key sinks.",
    "byteOrderVerified": "standalone g++ -Wall -Wextra test (test/scratch) replicated EcInt little-endian limb layout; extraction be[bi]=((u8*)data)[31-bi] matched Python int.to_bytes(32,'big') exactly",
    "compileCheck": "EmitCandidate + emit block compiled standalone with g++ -std=c++20 -Wall -Wextra -Wpedantic, clean; full TU not compiled here (needs CUDA headers, unavailable)"
  },
  "commands": {
    "vendor": "git -C <tmp> fetch --depth 1 origin 618473acd7f5e696be5ec4f8377c18cc55c1361c && git checkout FETCH_HEAD; cp whitelist -> rckangaroo/upstream; python3 -I test/scratch/apply_patch.py rckangaroo/upstream/RCKangaroo.cpp",
    "offlineTests": "python3 -I rckangaroo/tests/test_output_path.py",
    "verifyManifest": "python3 -I rckangaroo/adapter/rck_adapter.py verify-manifest",
    "verifyHashes": "cd rckangaroo && sha256sum -c SHA256SUMS.txt",
    "optionalCudaBuild": "CUDA_ROOT=/usr/local/cuda-12.x bash rckangaroo/build/build_cuda.sh",
    "optionalGpuKat": "python3 -I rckangaroo/tests/cuda_kat_harness.py --solver-bin rckangaroo/upstream/build-cuda/bin/rckangaroo --range-bits 48 --dp 14 --private-dir <dir outside checkout>",
    "realRun": "python3 -I rckangaroo/adapter/rck_adapter.py real140 --solver-bin <built binary> --private-dir <dir outside checkout> --i-am-entrant-private-host"
  },
  "tests": [
    {"name": "output-path + leak suite (offline, CPU, no CUDA)", "command": "python3 -I rckangaroo/tests/test_output_path.py", "state": "TESTED", "result": "PASS", "checks": 25, "failures": 0,
     "covers": ["good: 32-byte sentinel written 0600 outside checkout, no sentinel in wrapper output", "short/none: fail closed, no candidate persisted", "crash: fail closed on nonzero solver rc", "leak: fake 'PRIVATE KEY'/64-hex in child stdout+stderr scrubbed from wrapper output", "refusal of --private-dir inside checkout", "verify-manifest: recipient bech32m valid, pubkey->address match, start==2^139", "secp256k1 pubkey + big-endian round trip"],
     "label": "NOT a GPU correctness test"},
    {"name": "manifest independent verification", "command": "python3 -I rckangaroo/adapter/rck_adapter.py verify-manifest", "state": "TESTED", "result": "PASS",
     "findings": {"recipient_bech32m_mainnet": "valid p2tr (hrp bc, witness v1, 32-byte program, bech32m)", "pubkey_to_address": "031f6a33...0d6640 -> 1QKBaU6WAeycb3DbKbLBkX7vJiaS8r42Xo (matches challenge address)", "start": "2^139 == 0x80000000000000000000000000000000000"}},
    {"name": "hash self-consistency", "command": "cd rckangaroo && sha256sum -c SHA256SUMS.txt", "state": "TESTED", "result": "PASS (all files OK)"},
    {"name": "patch byte-order equivalence", "command": "g++ standalone extraction vs python to_bytes(32,'big')", "state": "TESTED", "result": "MATCH"},
    {"name": "EmitCandidate compile", "command": "g++ -std=c++20 -Wall -Wextra -Wpedantic standalone", "state": "TESTED", "result": "compiles clean, runs exit 0"},
    {"name": "generated known-answer vs REAL solver (range>=32)", "command": "rckangaroo/tests/cuda_kat_harness.py", "state": "NOT RUN", "reason": "unmet prerequisite: no compatible GPU / CUDA toolkit (no nvcc) supplied to this worker; task did not supply GPU/CUDA capability"},
    {"name": "full CUDA translation-unit build", "state": "UNAVAILABLE", "reason": "CUDA headers/nvcc absent on this worker; build recipe provided for entrant GPU host"},
    {"name": "real #140 solve + regtest claim", "state": "UNAVAILABLE", "reason": "entrant-private GPU execution + separate secure-claim tool required; not performed on this shared worker"}
  ],
  "measurements": [
    {"metric": "offline test checks passed", "value": 25, "unit": "checks"},
    {"metric": "offline test failures", "value": 0, "unit": "checks"},
    {"metric": "candidate payload size", "value": 32, "unit": "bytes (big-endian)"},
    {"metric": "review diff size", "value": 131, "unit": "lines"},
    {"metric": "vendored shipped files", "value": 34, "unit": "files"},
    {"metric": "upstream source files excluded", "value": 6, "unit": "files (RESULTS.TXT, 2 cubins, 3 VS files)"},
    {"metric": "throughput", "value": null, "unit": "n/a", "note": "no solver was run here; upstream README GH/s figures are NOT adopted as measurements"}
  ],
  "checkpointLimitations": "-tames saves TAME precomputation only (distinguished points for a fixed range), not wild-walk state. It is not a crash-resume of a real solve and full resume is NOT advertised. See docs/CHECKPOINTS.md. This optional path is excluded from the mandatory offline CPU tests.",
  "securityNotes": "Recovered key leaves the process only as 32 big-endian bytes on an inherited --candidate-fd; fails closed otherwise. Wrapper never prints key bytes, scrubs child stdout/stderr, writes 0600 files under an entrant-supplied --private-dir OUTSIDE the checkout, and refuses in-checkout paths. Real mode is entrant-private and locked to the fixed #140 manifest. No host inventory, no rented compute, no runtime downloads, no submodules; machine credentials/home/env/config were not read for the task.",
  "blockers": [
    "No GPU/CUDA capability supplied to this worker (no nvcc): cannot build the CUDA binary, cannot run the generated range>=32 known-answer test against the real solver, cannot run #140.",
    "Turbo kernels (sm_89/sm_120) require the excluded prebuilt .cubin files and upstream's RCAsm toolchain; the entrant must obtain and verify them against the recorded hashes on their private GPU host.",
    "Live UTXO / current-spendable-prize verification is an on-chain check not performed offline here."
  ],
  "restartCommand": "On an entrant-controlled CUDA/GPU host: (1) cd rckangaroo && sha256sum -c SHA256SUMS.txt ; (2) CUDA_ROOT=/usr/local/cuda-12.x bash rckangaroo/build/build_cuda.sh ; (3) python3 -I rckangaroo/tests/cuda_kat_harness.py --solver-bin rckangaroo/upstream/build-cuda/bin/rckangaroo --range-bits 48 --dp 14 --private-dir <dir outside checkout> ; (4) python3 -I rckangaroo/adapter/rck_adapter.py real140 --solver-bin rckangaroo/upstream/build-cuda/bin/rckangaroo --dp 30 --private-dir <dir outside checkout> --i-am-entrant-private-host ; (5) move the private candidate file to the separate regtest-tested secure-claim tool to sign+broadcast paying only the manifest recipient minus fees.",
  "stateSummary": {
    "implemented": ["vendored+pinned source", "candidate-fd key-sink patch", "fail-closed logic", "adapter wrapper (selftest-output/verify-manifest/kat/real140)", "std-lib secp256k1+bech32m+p2pkh verification", "fake-solver + offline tests", "CUDA build recipe", "GPU KAT harness", "provenance+hashes+docs"],
    "tested": ["offline output-path/leak suite (25/25)", "manifest verification", "hash self-check", "patch byte-order", "EmitCandidate compile"],
    "untested": ["kat/real140 against the real built solver (needs GPU)"],
    "unavailable": ["full CUDA TU build", "real #140 solve", "regtest claim broadcast"]
  }
}
