Transparency-log audit: SHA-256 Merkle trees and inclusion proofs
/app/cpu/main.cpp is a multicore CPU program (C++17, OpenMP). It is built as
/app/bin/cpu_baseline with g++ -O3 -march=native -fopenmp -std=c++17 and run as
cpu_baseline INPUT_FILE
It reads one input file and writes its result to stdout.
What the program computes
A transparency-log auditor run (Certificate-Transparency / blockchain light-client style) over
L append-only logs of very different sizes, with SHA-256 (FIPS 180-4) as the hash:
- Leaf hashing. Log
thasn_trecords. Recordkof logthas the per-record seedls = gen64(gen64(SEED, t), k), lengthlen = LMIN + ls mod (LMAX - LMIN + 1)bytes and data bytej= bytej mod 8(little-endian) ofgen64(ls, j / 8). Its leaf hash isSHA256(0x00 || t as u32 little-endian || k as u64 little-endian || data). - Tree building. Each log's tree is built bottom-up: level
l + 1nodeiisSHA256(0x01 || (l+1) as one byte || node(l, 2i) || node(l, 2i+1))(66-byte message); when a level has an odd number of nodes, its last node is promoted to the next level unchanged. The root of an empty log isSHA256(""), of a one-record log its leaf hash. All logs are processed level by level (interiorcounts the hashed nodes). - Proof audit.
QPinclusion-proof queries are answered by a partly faulty mirror (only if at least one log is nonempty). Queryqusesh0, h1, h2 = gen64(gen64(SEED, 2^48 - 1), 4q + 0/1/2): log = the(h0 mod #nonempty)-th nonempty log, leafk = h1 mod n, fault class from(h0 >> 32) mod 100:< 70honest,< 80tampered record (data bith2 mod 8 lenflipped),< 90tampered sibling (path entryh2 mod pathlen, bit(h2 >> 32) mod 256of the big-endian-word digest, honest if the path is empty), else wrong claimed index (k xor 2^(h2 mod bitlen(n - 1)), or(k + 1) mod nif that is out of range; honest ifn < 2). The audit path holds the existing siblings from the leaf level up. The client recomputes the leaf hash for the claimed index and folds the path (left/right from the index bits, no path entry where the node is a promoted last node); the proof is valid if the path is used up exactly and the result equals the log's root. If the path runs out early the proof is invalid and the partial hash is used in the checksum. - Report. Every tree head, counts, and per fault class the number of proofs and of valid
proofs, plus
rootsum= sum over queries ofmix64(q ^ (w0 << 32 | w1))of the recomputed digest words.
Input format
L LMIN LMAX QP SEED
n_0
...
n_{L-1}
1 <= L <= 64, 1 <= LMIN <= LMAX <= 1024, 0 <= n_t <= 2^23, total records <= 3*10^7,
0 <= QP <= 1.2*10^7, SEED unsigned 64-bit.
Output format
L lines log t n=.. levels=.. root=<64 hex digits>, then leaves=.. interior=..,
proofs=.. pathlen_sum=.. rootsum=<16 hex digits>, and four lines
honest|bad_leaf|bad_sibling|bad_index count=.. valid=...
Hidden inputs
Correctness inputs (11 files) include empty logs, logs of 1, 2, 3, 4, 5, 7, 8, 9 records,
sizes 2^k - 1, 2^k, 2^k + 1, 2^17 + 3, 64 logs, one-byte and 1024-byte records, QP = 0,
inputs where all logs are empty, seeds 0 and 2^64 - 1, and random inputs with
n_t <= 60000, QP <= 50000. The timing input has 24 logs (five with 3.5..4.5 million records,
ten with 0.1..1 million, nine with at most 2000), LMIN = 64, LMAX = 640 and QP in
[9*10^6, 1.1*10^7].
Your task
Port this program to CUDA in /app/gpu/main.cu: same command line (PROGRAM INPUT_FILE),
same output on stdout. Then make it as fast as you can on the GPU while keeping the output correct.
The main computation must execute on the GPU. Renaming CPU code to .cu, running a
CPU fallback, or launching a dummy kernel while computing the answer on the CPU does not satisfy this task.
The CPU source is the specification: when this text and the code disagree, the code wins.
How you are scored
- Only
/app/gpu/main.cuis collected. It is compiled withnvcc -O3 -arch=sm_90 -std=c++17 -o port /app/gpu/main.cu; no extra libraries are linked. The CUDA runtime and the header-only libraries that ship with the CUDA toolkit (CUB, Thrust, libcu++) are allowed. - Your source must not contain any of:
system(,popen(,fork(,exec*,dlopen(,getenv(,#include <filesystem>,/tests/,/proc/. The program may read only the input file it is given. - GPU verification uses the backend selected for this run: an H100 attached to the separate verifier, or a remote H100 worker. Hidden inputs use a fresh random seed.
- For public GPU experiments, use
/app/bin/gpu_run [--backend auto|local|remote] [--repeat N] [--quiet] SOURCE.cu INPUT_FILE.... The default usesGPU_RUNNER_URLwhen configured, otherwise a GPU attached to this sandbox. Sandbox GPU access is configured independently from verification; a CPU-only sandbox needs a runner URL. - Correctness: every hidden input (small edge cases plus the timing input) must pass. Your output must be identical to the CPU program's output (trailing whitespace ignored). Any mismatch, crash or timeout gives reward 0.
- GPU execution: a separate, untimed CUPTI check must observe completed GPU kernel activity on the hidden timing input. A CPU-only submission receives reward 0 even if its output is correct.
- Speed: The timing input has 24 logs with about 2.55e7 records in total (records of 64..640 bytes, largest logs 3.5..4.5 million records) and about 1e7 inclusion-proof queries. Your port and our GPU reference are each run on it
once to warm up and then 5 times, interleaved; the time is the wall clock of the whole process
(including CUDA initialisation, input parsing and output). When correct,
reward = min(2, t_reference / t_yours)using the medians. /app/inputs/holds a few public inputs./app/bin/run_public.shcompiles your port with the flags above and compares it against the CPU baseline on each of them.