{"componentChunkName":"component---src-templates-post-js","path":"/blog/cost-of-proving-llm-refusal","result":{"data":{"prevPost":{"html":"<p>Last week we looked at one-way functions, and we clearly said that they follow two properties: easy to compute and hard to invert.</p>\n<p>If it's easy to compute, then we have a PPT algorithm C such that for all x, which is the input, which comes from a set of n-bit strings, the probability that this algorithm C, when given this input, produces a valid output for our function should be one.</p>\n<div class=\"dpw-formula\">Pr[ C(x) = f(x) ] = 1 &nbsp;&nbsp; for all x &isin; {0,1}<sup>n</sup></div>\n<p>The second thing, which is the more interesting one: a one-way function has to be hard to invert. We have an input coming from a set of n-bit strings, and when we pass this input into our function, we get y as our output. If we have an adversary who, given only the security parameter and the output, is able to produce a valid input x′ such that when we plug in this x′ we get back the original output, then for it to be hard to invert, this probability has to be negligible.</p>\n<div class=\"dpw-formula\">Pr[ f(x&prime;) = y &nbsp;:&nbsp; x &larr; {0,1}<sup>n</sup>, y = f(x), x&prime; &larr; A(1<sup>n</sup>, y) ] &le; negl(n)</div>\n<h2 id=\"the-adversary-is-bounded\" style=\"position:relative;\"><a href=\"#the-adversary-is-bounded\" aria-label=\"the adversary is bounded permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The adversary is bounded</h2>\n<p>PPT is a probabilistic polynomial time algorithm, and all we need to remember for now is that this is pretty much a polynomial function with a randomness tape. It has an infinite source of randomness.</p>\n<p>In cryptography, most of the definitions do assume that the adversary is bounded. We don't assume that they have infinite compute power or infinite time, because those are impractical. If the adversary were unbounded, only perfect security could protect against it, and perfect security has its own downsides. Something like the one-time pad is a perfectly secure algorithm, where even if an adversary has infinite time, infinite power, a supercomputer, they still can't break the algorithm. But there are many downsides to the one-time pad. So we don't assume that the adversary is unbounded. That's why we always define the adversary as an algorithm that's polynomially bounded with respect to the input.</p>\n<p>Informally, negligible is saying that the probability that any adversary can invert a function should be as good as random guessing. For example, if we have 10 numbers, 1, 2, 3, up to 10, and I picked 3, and I told you to guess what number I picked, the probability that you'll get it right is 1/10. Obviously, everyone can just randomly guess, and if they do break the algorithm in that case, it's not considered a bad thing, because it was still secure within this bound of negligible.</p>\n<p>The adversary also gets 1<sup>n</sup>, which is just n ones in a row. So the adversary does know the size of the input. That's public information.</p>\n<h2 id=\"multiplication-is-only-a-weak-one-way-function\" style=\"position:relative;\"><a href=\"#multiplication-is-only-a-weak-one-way-function\" aria-label=\"multiplication is only a weak one way function permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Multiplication is only a weak one-way function</h2>\n<p>A strong one-way function is one where the adversary only succeeds with negligible probability. A weak one-way function is one where the adversary may invert f on a significant fraction of inputs, but there is a noticeable set of inputs where the adversary cannot invert.</p>\n<p>We looked at this weak one-way function for just multiplication: integer factorization, where the input domain was any n-bit integer. If we have a function f which takes x and y, it just multiplies x and y, and let's call this N. Given N, can we find any x′ and y′ such that f(x′, y′) gives N again? It doesn't have to be the exact x. We have to find any valid input that satisfies this condition.</p>\n<p>If N is even, one factor is 2 and the other factor is N/2, and that satisfies our integer factorization. We found two valid factors that, once multiplied, give N.</p>\n<p>Here is that trick as an actual adversary. It divides N by 2, or by every prime up to a bound, and wins if anything divides. How much of the input space does it invert, and what happens when the inputs are only allowed to be primes?</p>\n<div class=\"dpw\" id=\"cc3-weak\">\n  <div class=\"dpw-toggle-row\">\n    <span class=\"dpw-toggle-cap\">Input domain</span>\n    <button class=\"dpw-toggle\" data-dom=\"any\" data-on=\"true\">any n-bit integers</button>\n    <button class=\"dpw-toggle\" data-dom=\"prime\" data-on=\"false\">n-bit primes only</button>\n  </div>\n  <div class=\"dpw-toggle-row\">\n    <span class=\"dpw-toggle-cap\">The adversary tries dividing by</span>\n    <button class=\"dpw-toggle\" data-b=\"2\" data-on=\"true\">just 2</button>\n    <button class=\"dpw-toggle\" data-b=\"100\" data-on=\"false\">primes &lt; 100</button>\n    <button class=\"dpw-toggle\" data-b=\"10000\" data-on=\"false\">primes &lt; 10,000</button>\n  </div>\n  <div class=\"dpw-controls\">\n    <label class=\"dpw-label\">Bits per factor, n &nbsp; <span class=\"dpw-val\" id=\"cc3-n\">20</span>\n      <input type=\"range\" id=\"cc3-nr\" min=\"4\" max=\"26\" step=\"1\" value=\"20\" />\n    </label>\n  </div>\n  <div class=\"dpw-readout\">\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-win\">&ndash;</span><span class=\"dpw-cap\">of inputs inverted</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-lose\">&ndash;</span><span class=\"dpw-cap\">it cannot invert</span></div>\n  </div>\n  <div class=\"cc3-grid\" id=\"cc3-grid\" aria-label=\"One square per random input; filled squares were inverted\"></div>\n  <div class=\"dpw-verdict\" id=\"cc3-verdict\">&ndash;</div>\n  <div class=\"dpw-line\"><span id=\"cc3-ex\">&ndash;</span></div>\n  <div class=\"dpw-hint\">Each square is one random input (x, y), multiplied to N = x &middot; y. A filled square means the adversary found a valid x&prime;, y&prime; with x&prime; &middot; y&prime; = N. 400 fresh samples are drawn every time you change something.</div>\n</div>\n<p>On any integers, dividing by 2 alone wins about three times in four, whatever n is: N is odd only when x and y are both odd. On primes, the same adversary only wins while the primes are small enough to be on its list.</p>\n<h2 id=\"the-factoring-assumption\" style=\"position:relative;\"><a href=\"#the-factoring-assumption\" aria-label=\"the factoring assumption permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The factoring assumption</h2>\n<p>If our input domain is not any n-bit integer, but all n-bit prime numbers, then there is a widely believed assumption called the factoring assumption that kicks in. A lot of security is based on this assumption. If anyone is able to disprove this, then many things will break on the internet. There are several one-way functions and several assumptions that go with those one-way functions, and people just have not been able to disprove those assumptions yet, so we believe them to be true right now, but they may be broken in the future.</p>\n<p>I'm going to call the set which contains all n-bit prime numbers capital Π<sub>n</sub>. The factoring assumption states: we have two numbers, p, which comes from our set of all n-bit primes, and q, which also comes from the set of all n-bit primes. We multiply them to produce N, so p · q = N. If we give that N to an adversary, the probability that they can find factors that multiply to give N is, again, negligible. The larger they are, the harder it is.</p>\n<div class=\"dpw-formula\">Pr[ p&prime; &middot; q&prime; = N &nbsp;:&nbsp; p, q &larr; &Pi;<sub>n</sub>, N = p &middot; q, (p&prime;, q&prime;) &larr; A(N) ] &le; negl(n)</div>\n<p>So what we said so far is: if p and q are any integers, easy-ish to invert. If p and q are primes, very hard to invert.</p>\n<h2 id=\"the-proof\" style=\"position:relative;\"><a href=\"#the-proof\" aria-label=\"the proof permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The proof</h2>\n<p>Let's try to prove why this is true. I'm showing you a proof because most proofs in cryptography rely on this way of proving things, which is proving by contradiction. Initially, I found this also pretty confusing, but I think I'm starting to get the hang of it.</p>\n<ol>\n<li>Assume f is not a one-way function. If it's not a one-way function, that means the adversary can find p and q such that when they are multiplied, they give the original N, where N = f(p, q). It implies that this adversary is able to find a valid preimage with high probability. Remember, when we talk about an adversary, we're talking about an algorithm. The adversary is a probabilistic polynomial time algorithm.</li>\n<li>Construct B to violate the factoring assumption. This algorithm B uses A to break the factoring assumption. It takes in the output, which is the product of two primes, and invokes A on input N. The adversary A outputs p′ and q′. First of all, we don't even know if they're prime, so B checks if p′ and q′ are prime. This can be done pretty fast, in polynomial time. If you use something like Python, you can just call a function, but inside, they are using very fast algorithms to do a primality test. Then we also check if, when we multiply p′ and q′, we get N, which was given to B in the first place. If both of these are true, then output our factors p′, q′. If one is no or two is no, then just output something like fail.</li>\n<li>B runs in polynomial time. Primality testing is a polynomial time algorithm, and A is always a polynomially time-bounded algorithm. Both of these run in polynomial time; therefore, this whole algorithm runs in polynomial time. And the success probability of this algorithm B is at least the success probability of A, which we know is high. B is like a hollow function. It's just using A, with one more function.</li>\n<li>B is a polynomial algorithm which can find the factors of a number that is the product of two primes, with high probability, in polynomial time. That violates the factoring assumption, which shows that our initial assumption, that f is not a one-way function, is false. And since it's false, f must be a one-way function.</li>\n</ol>\n<p>You can see how this whole proof relied on the factoring assumption being true. We call these proofs by contradiction. We basically try to assume the opposite thing. Then we show what happens when the opposite thing is true. And then we look at our strongly believed assumptions, like in this case the factoring assumption, and we say: hey, wait a minute. If this was true, it violates the factoring assumption. So it must be false.</p>\n<h2 id=\"opening-the-input-space-back-up\" style=\"position:relative;\"><a href=\"#opening-the-input-space-back-up\" aria-label=\"opening the input space back up permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Opening the input space back up</h2>\n<p>What we've created is a strong one-way function, but it only works over this special input domain, which is primes. Very informally, what you could do is open up the input domain to all integers again, similar to our weak one-way function, and have an algorithm that runs a primality test on the inputs, which runs in polynomial time. If the inputs p, q are prime, then run the function f(p, q) = p · q. Otherwise, just output fail.</p>\n<p>We just added an extra layer. We allow the user to send in any numbers, but we're only going to actually do the multiplication if they are primes. The rest still remains true, because we know that if they are primes, then we have a proof that says that it is a one-way function.</p>\n<h2 id=\"weak-one-way-functions-are-not-useless\" style=\"position:relative;\"><a href=\"#weak-one-way-functions-are-not-useless\" aria-label=\"weak one way functions are not useless permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Weak one-way functions are not useless</h2>\n<p>There's a proof that says any weak one-way function can be converted into a strong one-way function. The person who showed this is Yao.</p>\n<p>Suppose you have your input x. Now you break the input into smaller chunks. This x becomes x<sub>1</sub>, x<sub>2</sub>, x<sub>3</sub>, and so on. The more chunks you can break it into, the better the security is. Assume that the adversary can invert, let's just say, 70% of the time. I'm making this up. Run the weak one-way function on the first chunk, second chunk, third chunk, and so on, until we have run the weak one-way function on all of x.</p>\n<p>Since we've broken it up into many chunks, they basically have to invert this successfully and this and this. It's not or, it's and. Even if they fail on a single piece of the input, security holds. Their success probability is the probability of inverting one chunk, raised to the power k, where k is how many chunks you split it into. In this case, it's 0.7<sup>k</sup>, and as we split it into more chunks, it drops and drops and drops until it also becomes negligible.</p>\n<div class=\"dpw-formula\">f&prime;(x<sub>1</sub>, x<sub>2</sub>, &hellip;, x<sub>k</sub>) = f(x<sub>1</sub>) &#124;&#124; f(x<sub>2</sub>) &#124;&#124; &hellip; &#124;&#124; f(x<sub>k</sub>) &nbsp;&nbsp;&rArr;&nbsp;&nbsp; Pr[invert f&prime;] = 0.7<sup>k</sup></div>\n<p>Someone asked how we can assume the function itself can be split up like that. x is from the input space. It's basically bits. You can keep it large so it can be split into chunks. The input is just a large n-bit binary string.</p>\n<p>So how many chunks does it take? Below, the adversary's chance on the whole input is put in the same terms as guessing a number I picked.</p>\n<div class=\"dpw\" id=\"cc3-yao\">\n  <div class=\"dpw-controls\">\n    <label class=\"dpw-label\">Adversary's success on one chunk &nbsp; <span class=\"dpw-val\" id=\"cc3-p\">70%</span>\n      <input type=\"range\" id=\"cc3-pr\" min=\"5\" max=\"99\" step=\"1\" value=\"70\" />\n    </label>\n    <label class=\"dpw-label\" style=\"margin-top:12px\">Number of chunks, k &nbsp; <span class=\"dpw-val\" id=\"cc3-k\">20</span>\n      <input type=\"range\" id=\"cc3-kr\" min=\"1\" max=\"400\" step=\"1\" value=\"20\" />\n    </label>\n  </div>\n  <svg id=\"cc3-svg\" viewBox=\"0 0 480 170\" class=\"dpw-svg\" role=\"img\" aria-label=\"Success probability on a log scale against the number of chunks\"></svg>\n  <div class=\"dpw-readout\">\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-pk\">&ndash;</span><span class=\"dpw-cap\">success on all <span class=\"dpw-var\">k</span> chunks</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-guess\">&ndash;</span><span class=\"dpw-cap\">as good as guessing 1 in</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-need\">&ndash;</span><span class=\"dpw-cap\">chunks to reach 2<sup>&minus;128</sup></span></div>\n  </div>\n  <div class=\"dpw-verdict\" id=\"cc3-yv\">&ndash;</div>\n  <div class=\"dpw-hint\">The dashed lines mark 2<sup>&minus;80</sup> and 2<sup>&minus;128</sup>, two common thresholds for \"negligible\" in practice. The curve is a straight line on a log scale because each chunk multiplies the adversary's chance by the same factor.</div>\n</div>\n<p>At 70% per chunk, 249 chunks are enough to make the adversary's chance smaller than 2<sup>−128</sup>. Even an adversary that wins 99% of the time on one chunk is pushed under that line, it just takes about nine thousand chunks.</p>\n<h2 id=\"where-this-goes-next\" style=\"position:relative;\"><a href=\"#where-this-goes-next\" aria-label=\"where this goes next permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Where this goes next</h2>\n<p>To my knowledge, Bitcoin security does not rely on the factoring assumption. But there is this other one-way function that Bitcoin does use actively, and that's what this has all been leading up to: the discrete log problem. First you choose a prime p; the larger it is, the safer. Then you also choose a generator g in a special group, which is the multiplicative group. It's easy to calculate g<sup>x</sup> mod p, but given the generator, the prime, and y, which are all public information, finding an x such that g<sup>x</sup> = y mod p is hard.</p>\n<div class=\"dpw-formula\">easy: &nbsp; y = g<sup>x</sup> mod p &nbsp;&nbsp;&nbsp;&nbsp; hard: &nbsp; given (g, p, y), find x</div>\n<style>\n.dpw {\n  --ink: #1b2228; --ink2: #5b7085; --line: #dae4ed;\n  --maroon: #a72e2b; --maroon-d: #6a1d1b; --rose: #f2cdcc; --green: #3f8f5b; --slate: #8ba2b8;\n  border: 1px solid var(--line); border-radius: 6px; padding: 20px;\n  margin: 32px 0; background: #fff; font-family: 'Open Sans', sans-serif;\n}\n.dpw * { box-sizing: border-box; }\n/* index.scss sets font on every span directly; let class-less spans inherit from the widget instead */\n.dpw span:not([class]) { font-size: inherit; line-height: inherit; font-family: inherit; }\n.dpw-formula { text-align: center; font-family: 'Inconsolata', monospace; font-size: 17px;\n  color: #1b2228; margin: 22px 0; letter-spacing: .01em; line-height: 1.6; overflow-x: auto; }\n.dpw-formula sup, .dpw-formula sub { font-size: 11px; }\n.dpw-controls { margin-bottom: 14px; }\n.dpw-label { display: block; font-size: 13px; color: var(--ink2); }\n.dpw-label input[type=range] { display: block; width: 100%; margin: 8px 0 0; accent-color: var(--maroon); }\n.dpw-val { color: var(--maroon-d); font-family: 'Inconsolata', monospace; font-weight: 700; }\n.dpw-hint { font-size: 12px; color: var(--ink2); margin-top: 10px; font-style: italic; line-height: 1.55; }\n.dpw-svg { width: 100%; height: auto; display: block; margin: 6px 0 4px;\n  background: linear-gradient(180deg, #fbfcfe, #f4f7fa); border-radius: 4px; }\n.dpw-verdict { margin: 10px 0 4px; padding: 8px 12px; border-radius: 4px; font-size: 13px; font-weight: 700;\n  background: var(--rose); color: var(--maroon-d); text-align: center; font-family: 'Inconsolata', monospace; }\n.dpw-verdict.dpw-ok { background: #dcefe3; color: var(--green); }\n.dpw-readout { display: flex; gap: 24px; margin-top: 12px; flex-wrap: wrap; }\n.dpw-stat { display: flex; flex-direction: column; }\n.dpw-num { font-family: 'Josefin Sans', sans-serif; font-size: 23px; color: var(--maroon-d); line-height: 1.15; }\n.dpw-cap { font-size: 11px; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }\n/* variable names keep their case inside the upper-cased captions (k is a number, G is a point) */\n.dpw-cap .dpw-var { text-transform: none; font-size: inherit; line-height: inherit; font-family: inherit; }\n.dpw-cap sub, .dpw-cap sup { text-transform: none; }\n.dpw-toggle-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }\n.dpw-toggle-cap { width: 100%; margin-bottom: 3px; font-size: 12px; color: var(--ink2); }\n.dpw-toggle { font-family: 'Inconsolata', monospace; font-size: 12px; border: 1px solid var(--line);\n  background: #fff; color: var(--ink2); padding: 5px 9px; border-radius: 4px; cursor: pointer; transition: all .15s; }\n.dpw-toggle[data-on=true] { background: var(--maroon); color: #fff; border-color: var(--maroon); }\n.dpw-line { font-size: 13px; color: var(--ink2); margin: 9px 0; display: flex; justify-content: space-between;\n  align-items: baseline; gap: 10px; flex-wrap: wrap; font-family: 'Inconsolata', monospace; word-break: break-all; }\n.cc3-grid { display: grid; grid-template-columns: repeat(40, 1fr); gap: 2px; margin: 14px 0 6px; }\n.cc3-grid i { display: block; aspect-ratio: 1; border-radius: 1px; background: #eef3f7; }\n.cc3-grid i.cc3-w { background: var(--maroon); }\n@media (max-width: 520px) { .cc3-grid { grid-template-columns: repeat(20, 1fr); } .dpw-readout { gap: 16px; } }\n@media (prefers-reduced-motion: reduce) { .dpw * { transition: none !important; } }\n</style>\n<script>\n(function () {\n  var root = document.getElementById('cc3-weak');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SMALL = [];\n  (function () { var s = new Uint8Array(10001); for (var i = 2; i <= 10000; i++) if (!s[i]) { SMALL.push(i); for (var j = i * i; j <= 10000; j += i) s[j] = 1; } })();\n  function isPrime(n) {\n    if (n < 2) return false;\n    for (var i = 0; i < SMALL.length && SMALL[i] * SMALL[i] <= n; i++) if (n % SMALL[i] === 0) return n === SMALL[i];\n    return true;\n  }\n  function randBits(n) { var lo = Math.pow(2, n - 1), hi = Math.pow(2, n); return lo + Math.floor(Math.random() * (hi - lo)); }\n  function randPrime(n) { for (;;) { var c = randBits(n); if (n > 2) c |= 1; if (isPrime(c)) return c; } }\n  function fmt(x) { return x.toLocaleString('en-US'); }\n\n  var dom = 'any', bound = 2, n = 20;\n  var grid = root.querySelector('#cc3-grid');\n\n  function run() {\n    var wins = 0, cells = [], example = null;\n    for (var t = 0; t < 400; t++) {\n      var x = dom === 'any' ? randBits(n) : randPrime(n);\n      var y = dom === 'any' ? randBits(n) : randPrime(n);\n      var N = x * y, found = 0;\n      for (var i = 0; i < SMALL.length && SMALL[i] <= bound && SMALL[i] < N; i++) {\n        if (N % SMALL[i] === 0) { found = SMALL[i]; break; }\n      }\n      if (found) { wins++; if (!example) example = [N, found]; }\n      cells.push(found ? 1 : 0);\n    }\n    var html = '';\n    for (var c = 0; c < cells.length; c++) html += cells[c] ? '<i class=\"cc3-w\"></i>' : '<i></i>';\n    grid.innerHTML = html;\n    var pct = Math.round(wins / 4);\n    root.querySelector('#cc3-win').textContent = pct + '%';\n    root.querySelector('#cc3-lose').textContent = (100 - pct) + '%';\n    var v = root.querySelector('#cc3-verdict');\n    if (pct >= 10) { v.className = 'dpw-verdict'; v.textContent = 'weak: the adversary inverts a significant fraction of inputs'; }\n    else if (wins > 0) { v.className = 'dpw-verdict'; v.textContent = 'a few small inputs still fall to the list of primes'; }\n    else { v.className = 'dpw-verdict dpw-ok'; v.textContent = 'inverted 0 of 400: on this domain the trick does nothing'; }\n    root.querySelector('#cc3-ex').textContent = example\n      ? 'e.g. N = ' + fmt(example[0]) + ' = ' + fmt(example[1]) + ' × ' + fmt(example[0] / example[1])\n      : 'no N in this sample had a factor on the list';\n  }\n\n  [].forEach.call(root.querySelectorAll('[data-dom]'), function (b) {\n    on(b, 'click', function () {\n      dom = b.getAttribute('data-dom');\n      [].forEach.call(root.querySelectorAll('[data-dom]'), function (o) { o.setAttribute('data-on', String(o === b)); });\n      run();\n    });\n  });\n  [].forEach.call(root.querySelectorAll('[data-b]'), function (b) {\n    on(b, 'click', function () {\n      bound = +b.getAttribute('data-b');\n      [].forEach.call(root.querySelectorAll('[data-b]'), function (o) { o.setAttribute('data-on', String(o === b)); });\n      run();\n    });\n  });\n  var nr = root.querySelector('#cc3-nr');\n  on(nr, 'input', function () { n = +nr.value; root.querySelector('#cc3-n').textContent = n; run(); });\n  run();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('cc3-yao');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SVG = 'http://www.w3.org/2000/svg', svg = root.querySelector('#cc3-svg');\n  var pr = root.querySelector('#cc3-pr'), kr = root.querySelector('#cc3-kr');\n  var W = 480, H = 170, X0 = 40, FS = 11, X1 = 470, Y0 = 12, Y1 = 150, KMAX = 400, LMIN = -160; // log2 axis 0 .. -160\n\n  function el(n, at, txt) { var e = document.createElementNS(SVG, n); for (var a in at) e.setAttribute(a, at[a]); if (txt !== undefined) e.textContent = txt; return e; }\n  function sx(k) { return X0 + (k / KMAX) * (X1 - X0); }\n  function sy(l2) { return Y0 + (Math.max(l2, LMIN) / LMIN) * (Y1 - Y0); }\n  function sci(l2) { // 2^l2 written as a power of ten\n    var l10 = l2 * Math.LOG10E * Math.LN2;\n    if (l10 > -3) return (Math.pow(10, l10) * 100).toFixed(l10 > -1 ? 1 : 2) + '%';\n    var e = Math.floor(l10), m = Math.pow(10, l10 - e);\n    return m.toFixed(1) + '×10' + sup(e);\n  }\n  function sup(e) { var m = { '-': '⁻', 0: '⁰', 1: '¹', 2: '²', 3: '³', 4: '⁴', 5: '⁵', 6: '⁶', 7: '⁷', 8: '⁸', 9: '⁹' }; return String(e).split('').map(function (c) { return m[c]; }).join(''); }\n  function big(l2) { // 1 / 2^l2 as a readable count\n    var l10 = -l2 * Math.LOG10E * Math.LN2;\n    if (l10 < 6) return Math.round(Math.pow(10, l10)).toLocaleString('en-US');\n    var e = Math.floor(l10); return (Math.pow(10, l10 - e)).toFixed(1) + '×10' + sup(e);\n  }\n\n  function draw() {\n    var p = +pr.value / 100, k = +kr.value, lp = Math.log2(p);\n    root.querySelector('#cc3-p').textContent = pr.value + '%';\n    root.querySelector('#cc3-k').textContent = k;\n    while (svg.firstChild) svg.removeChild(svg.firstChild);\n    var unitsPerPx = W / (svg.getBoundingClientRect().width || W);   // viewBox units per CSS pixel\n    FS = Math.min(20, 11 * unitsPerPx); X0 = Math.max(40, 3.4 * FS);\n    [[-80, '2⁻⁸⁰'], [-128, '2⁻¹²⁸']].forEach(function (t) {\n      svg.appendChild(el('line', { x1: X0, x2: X1, y1: sy(t[0]), y2: sy(t[0]), stroke: '#8ba2b8', 'stroke-dasharray': '4 4', 'stroke-width': 1 }));\n      svg.appendChild(el('text', { x: X0 - 4, y: sy(t[0]) + FS * 0.35, 'text-anchor': 'end', 'font-size': FS, fill: '#5b7085', 'font-family': 'Inconsolata, monospace' }, t[1]));\n    });\n    svg.appendChild(el('text', { x: X0 - 4, y: Y0 + FS * 0.35, 'text-anchor': 'end', 'font-size': FS, fill: '#5b7085', 'font-family': 'Inconsolata, monospace' }, '1'));\n    svg.appendChild(el('line', { x1: X0, x2: X0, y1: Y0, y2: Y1, stroke: '#dae4ed' }));\n    svg.appendChild(el('line', { x1: X0, x2: X1, y1: Y1, y2: Y1, stroke: '#dae4ed' }));\n    svg.appendChild(el('text', { x: X1, y: H - 4, 'text-anchor': 'end', 'font-size': FS, fill: '#5b7085', 'font-family': 'Inconsolata, monospace' }, 'chunks k → ' + KMAX));\n    var d = '';\n    for (var i = 0; i <= KMAX; i += 2) d += (i ? 'L' : 'M') + sx(i).toFixed(1) + ' ' + sy(i * lp).toFixed(1);\n    svg.appendChild(el('path', { d: d, fill: 'none', stroke: '#a72e2b', 'stroke-width': 2 }));\n    svg.appendChild(el('circle', { cx: sx(k), cy: sy(k * lp), r: 5, fill: '#6a1d1b' }));\n\n    var l2 = k * lp;\n    root.querySelector('#cc3-pk').textContent = sci(l2);\n    root.querySelector('#cc3-guess').textContent = big(l2);\n    root.querySelector('#cc3-need').textContent = Math.ceil(-128 / lp).toLocaleString('en-US');\n    var v = root.querySelector('#cc3-yv');\n    if (l2 <= -128) { v.className = 'dpw-verdict dpw-ok'; v.textContent = 'below 2⁻¹²⁸: negligible by any practical standard'; }\n    else if (l2 <= -80) { v.className = 'dpw-verdict dpw-ok'; v.textContent = 'below 2⁻⁸⁰: negligible for most purposes'; }\n    else { v.className = 'dpw-verdict'; v.textContent = 'not yet negligible: add more chunks'; }\n  }\n  on(pr, 'input', draw); on(kr, 'input', draw); on(window, 'resize', draw);\n  draw();\n})();\n</script>","headings":[{"value":"The adversary is bounded","depth":2},{"value":"Multiplication is only a weak one-way function","depth":2},{"value":"The factoring assumption","depth":2},{"value":"The proof","depth":2},{"value":"Opening the input space back up","depth":2},{"value":"Weak one-way functions are not useless","depth":2},{"value":"Where this goes next","depth":2}],"frontmatter":{"date_created":"2026-08-21","path":"/blog/crypto-club-proof-by-contradiction","tags":["Cryptography","Bitcoin"],"title":"Proving A Function Is One-Way By Assuming It Is Not"}},"currPost":{"html":"<p>In December I argued that GPT-5's safe completions are not zero-knowledge, and I argued it on paper. The protocol leaks structural information about the withheld witness across turns, an adversary composes those leaks, and the simulation argument fails. I still think that is right.</p>\n<p>What I did not do was cost it. A protocol analysis that never touches a prover is cheap to write and easy to like, and I have since spent two months building the thing it was hand-waving at. So this post does the arithmetic.</p>\n<p>The short version is that the bill is payable, and it is a bill for the wrong item. Proving an inference does not fix the leak I found in December, and working out why took me longer than working out the price.</p>\n<h2 id=\"the-smallest-interesting-verifiable-claim\" style=\"position:relative;\"><a href=\"#the-smallest-interesting-verifiable-claim\" aria-label=\"the smallest interesting verifiable claim permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The smallest interesting verifiable claim</h2>\n<p>Here is my anchor, and it is measured rather than cited.</p>\n<p>A RISC Zero guest re-executes the correctness check on a satellite computation. It re-hashes a design matrix against its commitment, re-hashes the audited index set, then evaluates a relative normal-equation residual at 256 pixels using 64-bit floats, all of it in software because RISC-V has no hardware double. Nothing exotic. Two SHA-256 calls and about eighty-five thousand floating point operations.</p>\n<p>That costs 8,388,608 cycles.</p>\n<p>The decomposition is worth keeping, because it is the part people never publish. 7,813,860 of those are the guest's own work. 214,654 go to paging memory across segment boundaries and 360,094 are reserved overhead, so roughly seven percent of the trace is the machine rather than the program. The whole thing splits into 8 segments at 2<sup>20</sup> cycles each, and 8 segments is exactly the parallelism budget you have if you want to spread this across GPUs.</p>\n<p>Divide it out and the guest spends about 92 cycles per double-precision operation, hashing and input deserialisation included. That is the number I would hand someone who asked what soft-float costs in a zkVM, with the caveat that it is an upper bound because the SHA-256 calls and the 30,916-byte input read are folded into it.</p>\n<h2 id=\"what-you-buy-at-each-rung\" style=\"position:relative;\"><a href=\"#what-you-buy-at-each-rung\" aria-label=\"what you buy at each rung permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What you buy at each rung</h2>\n<p>The same 8.39 million cycles can be sold to you three ways, and the difference between them is the whole engineering story.</p>\n<div class=\"dpw\" id=\"ladder\" data-initialised=\"false\">\n  <svg id=\"ld-svg\" viewBox=\"0 0 480 200\" class=\"dpw-svg\" role=\"img\" aria-label=\"Receipt size, prove time and verify time for composite, succinct and Groth16 receipts\"></svg>\n  <div class=\"dpw-detail\" id=\"ld-detail\">\n    <div class=\"dpw-detail-h\">Hover a bar</div>\n    <div class=\"dpw-detail-b\">Bars are receipt size on a log scale. All three carry the identical 432-byte journal and the identical claim.</div>\n  </div>\n</div>\n<p>A composite receipt is the raw STARK. It took 3,006 seconds on an eight-core machine and weighs 2,251,496 bytes, which is fine for a file and useless for a chain.</p>\n<p>Recursion folds the segments together. 1,463 seconds on sixteen cores, 224,090 bytes, a tenfold shrink. It verifies locally in 20.13 milliseconds.</p>\n<p>The Groth16 wrap runs the recursion, then proves the recursive verifier inside a pairing-based SNARK. 2,618.7 seconds, a peak resident set of 9.61 GB, and the receipt collapses to 1,361 bytes. The seal that actually travels in the transaction is 260 bytes. It verifies in 5.06 milliseconds locally, or on Base Sepolia for 249,749 gas, which at the gas price and ETH spot I read on 24 August is $0.0042.</p>\n<p>So the compression is 1,654 times, and it is bought with roughly 44 minutes of CPU and ten gigabytes of memory. Everything after this post's midpoint is an argument about whether that trade scales.</p>\n<h2 id=\"the-number-i-refuse-to-publish\" style=\"position:relative;\"><a href=\"#the-number-i-refuse-to-publish\" aria-label=\"the number i refuse to publish permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The number I refuse to publish</h2>\n<p>The obvious next move is to divide. 8,388,608 cycles in 2,618.7 seconds is 3,203 cycles per second, and from there you can extrapolate anything you like.</p>\n<p>Do not do this, and I say that as the person who did it first and got 3.85 × 10<sup>7</sup> for prover overhead against native execution. That figure is real arithmetic on real measurements and it describes my benchmark rather than my prover. The native side of it is 78 microseconds of vectorised numpy. When the numerator is a fixed cost that a 43-minute pipeline pays whether it proves eight million cycles or eighty million, a ratio taken at the bottom of the curve tells you about the fixed cost and nothing about the marginal one.</p>\n<p>Every \"N times overhead\" claim in this field has the same defect unless the workload size is printed next to it. Mine included.</p>\n<p>So here is the shape of the honest uncertainty rather than a headline. Set the two things I have not measured and watch the answer move.</p>\n<div class=\"dpw\" id=\"extrap\" data-initialised=\"false\">\n  <div class=\"dpw-controls dpw-grid\">\n    <label class=\"dpw-label\">Model size\n      <input type=\"range\" id=\"ex-p\" min=\"0\" max=\"5\" step=\"1\" value=\"2\" />\n      <span class=\"dpw-val\" id=\"ex-p-val\">7B</span>\n    </label>\n    <label class=\"dpw-label\">Tokens generated\n      <input type=\"range\" id=\"ex-t\" min=\"0\" max=\"4\" step=\"1\" value=\"1\" />\n      <span class=\"dpw-val\" id=\"ex-t-val\">64</span>\n    </label>\n    <label class=\"dpw-label\">Cycles per arithmetic op\n      <input type=\"range\" id=\"ex-c\" min=\"0\" max=\"4\" step=\"1\" value=\"2\" />\n      <span class=\"dpw-val\" id=\"ex-c-val\">92</span>\n    </label>\n    <label class=\"dpw-label\">Prover throughput, cycles per second\n      <input type=\"range\" id=\"ex-r\" min=\"3\" max=\"8\" step=\"1\" value=\"5\" />\n      <span class=\"dpw-val\" id=\"ex-r-val\">100 K</span>\n    </label>\n  </div>\n  <div class=\"dpw-two\">\n    <div class=\"dpw-panel\">\n      <div class=\"dpw-panel-h\">defensible</div>\n      <div class=\"dpw-line\">arithmetic ops <b id=\"ex-ops\">896 B</b></div>\n      <div class=\"dpw-line\">guest cycles <b id=\"ex-cyc\">82 T</b></div>\n      <div class=\"dpw-line\">segments at 2<sup>20</sup> <b id=\"ex-seg\">79 M</b></div>\n    </div>\n    <div class=\"dpw-panel dpw-panel-warn\">\n      <div class=\"dpw-panel-h\">not defensible without a measurement</div>\n      <div class=\"dpw-line\">prove time <b id=\"ex-time\">26 years</b></div>\n      <div class=\"dpw-line\">across the plausible throughput range <b id=\"ex-band\">10 days to 2.6 K years</b></div>\n    </div>\n  </div>\n  <div class=\"dpw-hint\">The left column moves only on things I can count. The right column moves five orders of magnitude on an assumption nobody has measured for this workload, which is the point.</div>\n</div>\n<p>The left panel is arithmetic I will defend. A forward pass over a model with P parameters costs about 2P operations per generated token, the cycle-per-op figure is anchored to a real trace, and segment counts follow. The right panel swings by five orders of magnitude on a parameter I have not measured, and neither has anyone else for this exact guest. Publishing a point estimate from that would be inventing a number.</p>\n<p>There is also a real reason my 92 cycles is too pessimistic for this use. My guest does 64-bit soft float because InSAR residuals need it. Quantised inference does 8-bit integer arithmetic, which is dramatically cheaper in a zkVM and is why serious zkML work quantises before it does anything else. Slide the cycles-per-op control down and you can see how much of the answer that one decision owns.</p>\n<h2 id=\"what-is-actually-provable-about-a-refusal\" style=\"position:relative;\"><a href=\"#what-is-actually-provable-about-a-refusal\" aria-label=\"what is actually provable about a refusal permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is actually provable about a refusal</h2>\n<p>Costing the wrong statement is worse than not costing it, so before spending anything it is worth sorting the claims by whether a proof can carry them at all.</p>\n<div class=\"dpw\" id=\"claims\" data-initialised=\"false\">\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"yes\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">1</span> \"This output came from the weights committed as H\"<span class=\"dpw-badge dpw-yes\">provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> Y = M<sub>W</sub>(P), where SHA-256(W) = H is published in advance.</p>\n      <p><b>Why it works:</b> it is a deterministic function evaluation over committed data, which is exactly what a zkVM proves. Same shape as my satellite guest, larger by a factor you can read off the widget above.</p>\n      <p class=\"dpw-cost\"><b>Cost:</b> the entire inference, in-circuit. This is the expensive one and it is the one that carries all the weight.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"yes\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">2</span> \"The refusal classifier scored this below threshold\"<span class=\"dpw-badge dpw-yes\">provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> C<sub>&theta;</sub>(Y) &lt; &tau;, for a classifier committed as &theta; and a published threshold.</p>\n      <p><b>Why it works:</b> a small committed model over a short string. Cheap, possibly thousands of times cheaper than claim 1.</p>\n      <p class=\"dpw-cost\"><b>The trap:</b> on its own this proves nothing about the system. I can run an honest classifier over an output that came from a different model, or from no model. Claim 2 is only worth anything when it is bound to claim 1, which means paying for claim 1.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"yes\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">3</span> \"The system prompt in force was the one published\"<span class=\"dpw-badge dpw-yes\">provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> the prompt prefix hashes to a published digest, and the same bytes fed the inference.</p>\n      <p><b>Why it works:</b> a hash inside the same circuit as claim 1, at almost no extra cost. This is the cheapest genuinely useful thing on the list, and nobody ships it.</p>\n      <p class=\"dpw-cost\"><b>Cost:</b> a few thousand cycles on top of an inference you are already proving.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"no\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">4</span> \"This output is safe\"<span class=\"dpw-badge dpw-no\">not provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> Y is harmless.</p>\n      <p><b>Why it fails:</b> there is no committed object to evaluate. Harmlessness is not a function of the bytes, it is a function of the reader, their intent, and what they already know. A proof system needs a decidable predicate over committed inputs and this is not one. No cycle budget changes that.</p>\n      <p class=\"dpw-cost\"><b>What you can have instead:</b> claim 2, stated honestly, which is a proof about a classifier and not about the world.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"no\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">5</span> \"Nothing about the withheld knowledge leaked\"<span class=\"dpw-badge dpw-no\">not provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> the transcript reveals nothing about the witness w the model declined to give up.</p>\n      <p><b>Why it fails:</b> this is the December result, and a proof makes it worse rather than better. Detail in the section below.</p>\n      <p class=\"dpw-cost\"><b>Cost:</b> not applicable. There is no price for this one.</p>\n    </div>\n  </div>\n</div>\n<p>Claims 1 through 3 compose into something worth having. Call it the Verified Refusal protocol and grade it the way I graded Π<sub>SafeCompletion</sub> in December.</p>\n<p><strong>Setup</strong>: The challenger commits to weights <strong>W</strong> as <strong>H</strong> = SHA-256(<strong>W</strong>), a classifier <strong>θ</strong>, a threshold <strong>τ</strong>, and a system prefix <strong>S</strong> with digest <strong>h</strong><sub>S</sub>.</p>\n<p><strong>Protocol</strong>: On prompt <strong>P</strong>, the prover publishes <strong>Y</strong> together with a proof <strong>π</strong> that <strong>Y</strong> = M<sub><strong>W</strong></sub>(<strong>S</strong> ‖ <strong>P</strong>) for the committed <strong>W</strong> and <strong>S</strong>, and that C<sub><strong>θ</strong></sub>(<strong>Y</strong>) &#x3C; <strong>τ</strong>.</p>\n<p><strong>Completeness</strong>: An honest operator running the committed weights under the committed prefix always produces an accepting proof. <strong>Perfect.</strong></p>\n<p><strong>Soundness</strong>: Substituting a different model, a different system prompt, or a different classifier breaks a commitment, and forging past it means finding a SHA-256 collision. The advantage of any probabilistic polynomial-time adversary is negligible in the security parameter. <strong>Perfect.</strong></p>\n<p><strong>Zero-knowledge</strong>: Against the weights, fine. The proof reveals nothing about <strong>W</strong> beyond what <strong>Y</strong> already reveals. Against the withheld witness <strong>w</strong>, it changes nothing whatsoever, and that is the finding.</p>\n<h2 id=\"proofs-give-integrity-and-the-leak-was-never-an-integrity-problem\" style=\"position:relative;\"><a href=\"#proofs-give-integrity-and-the-leak-was-never-an-integrity-problem\" aria-label=\"proofs give integrity and the leak was never an integrity problem permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Proofs give integrity, and the leak was never an integrity problem</h2>\n<p>The December analysis said Π<sub>SafeCompletion</sub> fails zero-knowledge under adaptive composition. The prover produces a sanitised abstraction ŷ that is computationally dependent on the structure of <strong>w</strong>, the adversary composes ŷ across turns, and reconstructs.</p>\n<p>Now add a proof and read it again. The proof establishes that ŷ was computed correctly by the committed model under the committed policy. Every leak the December post identified is in ŷ, which is published either way, so the proof does not remove a single bit of it. If anything it certifies the leak's provenance, which is a strange thing to hand an adversary. The transcript that reconstructs the witness is now a transcript with a receipt.</p>\n<p>Stated generally: a zero-knowledge proof of an inference protects the weights and the prover's private inputs. It does not protect anything that appears in the output, and in a safe-completions design the output is the deliverable. You cannot prove your way out of a leak that lives in the product.</p>\n<p>That is the opinion I would defend in a room. Verifiable inference is worth building and I am building toward it. It answers \"did the operator run the model they said they ran, under the policy they published\", which is a real question with real money attached, and today nobody can answer it. It does not answer \"is this model safe\", and the two get conflated in almost every pitch deck I have read this year, mine included until about three weeks ago.</p>\n<h2 id=\"what-i-would-actually-measure-next\" style=\"position:relative;\"><a href=\"#what-i-would-actually-measure-next\" aria-label=\"what i would actually measure next permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What I would actually measure next</h2>\n<p>I want to be plain about the boundary between what is measured here and what is not, since the widget above exists precisely to stop me blurring it.</p>\n<p>Measured: 8,388,608 cycles for a residual check at 256 samples, 8 segments, the three receipt sizes, three prove times on two machine sizes, 9.61 GB peak memory, 5.06 ms local verification, 249,749 gas on chain. Those come from committed artifacts and a live chain call, and anyone can rerun them.</p>\n<p>Not measured, and required before any of the extrapolation above becomes a claim: prover throughput in cycles per second at a workload large enough that fixed cost stops dominating, the cycle cost of quantised integer matrix multiplication in this specific zkVM, and how segment-parallel proving actually scales past the eight segments I have. Those are three benchmarks, not three papers, and the first one is a weekend.</p>\n<p>Until they exist, the honest form of the headline is that proving one small deterministic check costs eight million cycles and four tenths of a cent, that a language model forward pass is between four and eleven orders of magnitude larger in operations depending on the model and the length of the answer, and that converting the second fact into a dollar figure requires a measurement I do not have.</p>\n<p>The cheapest useful thing anyone could ship tomorrow is claim 3. Commit the system prompt, hash it into whatever proof you are already producing, and let people check that the policy in force was the policy you published. It costs a few thousand cycles. It would have made the December post much harder to write, because I would have been able to check what I was arguing about instead of inferring it from nine thousand words of transcript.</p>\n<style>\n.dpw {\n  --ink: #1b2228; --ink2: #5b7085; --line: #dae4ed;\n  --maroon: #a72e2b; --maroon-d: #6a1d1b; --rose: #f2cdcc; --green: #3f8f5b;\n  border: 1px solid var(--line); border-radius: 6px; padding: 20px;\n  margin: 32px 0; background: #fff; font-family: 'Open Sans', sans-serif;\n}\n.dpw * { box-sizing: border-box; }\n.dpw-svg { width: 100%; height: auto; display: block; margin: 6px 0 4px;\n  background: linear-gradient(180deg, #fbfcfe, #f4f7fa); border-radius: 4px; }\n.dpw-controls { margin-bottom: 14px; }\n.dpw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }\n.dpw-label { display: block; font-size: 13px; color: var(--ink2); }\n.dpw-label input[type=range] { display: block; width: 100%; margin: 8px 0 0; accent-color: var(--maroon); }\n.dpw-val { color: var(--maroon-d); font-family: 'Inconsolata', monospace; font-weight: 700; }\n.dpw-hint { font-size: 12px; color: var(--ink2); margin-top: 10px; font-style: italic; }\n.dpw-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }\n.dpw-panel { border: 1px solid var(--line); border-radius: 5px; padding: 14px; }\n.dpw-panel-warn { border-color: var(--rose); background: #fdf7f7; }\n.dpw-panel-h { font-family: 'Josefin Sans', sans-serif; font-size: 13px; text-transform: uppercase;\n  letter-spacing: .04em; color: var(--ink2); margin-bottom: 10px; }\n.dpw-panel-warn .dpw-panel-h { color: var(--maroon); }\n.dpw-line { font-size: 14px; color: var(--ink2); margin: 6px 0; }\n.dpw-line b { font-family: 'Inconsolata', monospace; font-size: 17px; color: var(--ink); }\n.dpw-line sup { font-size: 10px; }\n.dpw-detail { border: 1px solid var(--line); border-radius: 5px; padding: 12px 14px; margin-top: 12px; }\n.dpw-detail-h { font-family: 'Josefin Sans', sans-serif; font-size: 14px; color: var(--ink); margin-bottom: 6px; }\n.dpw-detail-b { font-size: 13px; color: var(--ink2); line-height: 21px; }\n.dpw-detail-b code { font-family: 'Inconsolata', monospace; font-size: 12px; background: #f4f7fa;\n  padding: 1px 5px; border-radius: 3px; color: var(--maroon-d); }\n.dpw-card { border: 1px solid var(--line); border-radius: 5px; margin-bottom: 8px; overflow: hidden; }\n.dpw-card-head { padding: 12px 14px; cursor: pointer; font-family: 'Josefin Sans', sans-serif;\n  font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 10px; transition: background .15s; }\n.dpw-card-head:hover { background: #f4f7fa; }\n.dpw-card[data-open=true] .dpw-card-head { background: var(--maroon); color: #fff; }\n.dpw-card-n { display: inline-flex; align-items: center; justify-content: center;\n  width: 22px; height: 22px; border-radius: 50%; background: var(--rose); color: var(--maroon-d);\n  font-family: 'Inconsolata', monospace; font-size: 13px; font-weight: 700; flex: none; }\n.dpw-card[data-open=true] .dpw-card-n { background: #fff; color: var(--maroon); }\n.dpw-badge { margin-left: auto; font-family: 'Inconsolata', monospace; font-size: 10px;\n  text-transform: uppercase; letter-spacing: .06em; padding: 3px 7px; border-radius: 3px; flex: none; }\n.dpw-yes { background: #dcefe3; color: var(--green); }\n.dpw-no { background: var(--rose); color: var(--maroon-d); }\n.dpw-card[data-open=true] .dpw-badge { background: rgba(255,255,255,.9); }\n.dpw-card-body { display: none; padding: 4px 16px 12px; font-size: 14px; color: var(--ink2); }\n.dpw-card[data-open=true] .dpw-card-body { display: block; }\n.dpw-card-body p { line-height: 22px; margin: 8px 0; }\n.dpw-card-body b { color: var(--ink); }\n.dpw-cost b { color: var(--maroon); }\n@media (max-width: 480px) {\n  .dpw-grid, .dpw-two { grid-template-columns: 1fr; }\n  .dpw-badge { display: none; }\n}\n@media (prefers-reduced-motion: reduce) { .dpw * { transition: none !important; } }\n</style>\n<script>\n(function () {\n  var root = document.getElementById('ladder');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SVG = 'http://www.w3.org/2000/svg';\n  var svg = root.querySelector('#ld-svg');\n  // All measured on the 141/54 witness. Composite ran on 8 vCPU, the other two on 16.\n  var R = [\n    { n: 'composite', bytes: 2251496, prove: 3006.5, cpu: '8 vCPU', verify: null, c: '#dd9793',\n      d: 'The raw STARK, 8 segments unfolded. 3,006 seconds on eight cores. Fine as a file, far too large for a transaction, and there is no on-chain verifier that takes it.' },\n    { n: 'succinct', bytes: 224090, prove: 1463.2, cpu: '16 vCPU', verify: 20.13, c: '#c4635f',\n      d: 'Recursion folds the 8 segments into one. Ten times smaller and, on twice the cores, faster than the composite run it contains. Verifies locally in 20.13 ms.' },\n    { n: 'groth16', bytes: 1361, prove: 2618.7, cpu: '16 vCPU', verify: 5.06, c: '#a72e2b',\n      d: 'The recursive verifier proved inside a pairing SNARK, which needs a 3.62 GB proving key and a container. 1,361 bytes, of which the 260-byte seal is what travels. 5.06 ms locally, 249,749 gas on Base Sepolia, $0.0042.' }\n  ];\n  var P = { l: 74, r: 92, t: 26, b: 30 };\n  var LO = Math.log10(1000), HI = Math.log10(4000000);\n  function X(b) { return P.l + (Math.log10(b) - LO) / (HI - LO) * (480 - P.l - P.r); }\n  function el(n, at) { var e = document.createElementNS(SVG, n); for (var k in at) e.setAttribute(k, at[k]); return e; }\n  var hover = -1;\n\n  function draw() {\n    while (svg.firstChild) svg.removeChild(svg.firstChild);\n    [1e3, 1e4, 1e5, 1e6].forEach(function (t) {\n      svg.appendChild(el('line', { x1: X(t), y1: P.t - 6, x2: X(t), y2: 200 - P.b, stroke: '#dae4ed', 'stroke-width': 1 }));\n      var lb = el('text', { x: X(t), y: 200 - P.b + 14, 'text-anchor': 'middle', 'font-size': 9.5,\n        fill: '#94a6b8', 'font-family': 'Inconsolata, monospace' });\n      lb.textContent = t >= 1e6 ? '1 MB' : t >= 1e3 ? (t / 1e3) + ' KB' : t;\n      svg.appendChild(lb);\n    });\n    R.forEach(function (r, i) {\n      var y = P.t + i * 44;\n      var g = el('g', { cursor: 'pointer' });\n      g.appendChild(el('rect', { x: P.l, y: y, width: Math.max(X(r.bytes) - P.l, 2), height: 26, rx: 3,\n        fill: r.c, opacity: hover === -1 || hover === i ? 1 : 0.4 }));\n      g.appendChild(el('rect', { x: 0, y: y - 6, width: 480, height: 38, fill: 'transparent' }));\n      on(g, 'mouseenter', function () { if (hover === i) return; hover = i; draw(); detail(i); });\n      svg.appendChild(g);\n      var nm = el('text', { x: P.l - 8, y: y + 17, 'text-anchor': 'end', 'font-size': 12,\n        fill: '#1b2228', 'font-family': 'Josefin Sans, sans-serif' }); nm.textContent = r.n;\n      svg.appendChild(nm);\n      var vl = el('text', { x: X(r.bytes) + 7, y: y + 17, 'font-size': 10.5,\n        fill: '#5b7085', 'font-family': 'Inconsolata, monospace' });\n      vl.textContent = r.bytes.toLocaleString() + ' B';\n      svg.appendChild(vl);\n      var pv = el('text', { x: P.l + 6, y: y + 17, 'font-size': 10, fill: '#fff',\n        'font-family': 'Inconsolata, monospace' });\n      pv.textContent = Math.round(r.prove) + ' s';\n      if (X(r.bytes) - P.l > 60) svg.appendChild(pv);\n    });\n    var ax = el('text', { x: 240, y: 196, 'text-anchor': 'middle', 'font-size': 10.5, fill: '#5b7085' });\n    ax.textContent = 'receipt size, log scale. bar label is prove time.';\n    svg.appendChild(ax);\n  }\n  function detail(i) {\n    var d = root.querySelector('#ld-detail'), r = R[i];\n    d.querySelector('.dpw-detail-h').textContent =\n      r.n + ' · ' + r.bytes.toLocaleString() + ' bytes · ' + Math.round(r.prove) + ' s on ' + r.cpu +\n      (r.verify ? ' · verifies in ' + r.verify + ' ms' : '');\n    d.querySelector('.dpw-detail-b').textContent = r.d;\n  }\n  draw();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('extrap');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var PARAMS = [[0.5e9, '0.5B'], [1.5e9, '1.5B'], [7e9, '7B'], [13e9, '13B'], [70e9, '70B'], [405e9, '405B']];\n  var TOKENS = [[1, '1'], [64, '64'], [256, '256'], [1024, '1,024'], [4096, '4,096']];\n  var CPO = [[1, '1 (int8, optimistic)'], [8, '8'], [92, '92 (measured, f64)'], [256, '256'], [1024, '1,024']];\n  var SEG = 1048576;\n\n  function fmtBig(v) {\n    var u = [[1e12, ' T'], [1e9, ' B'], [1e6, ' M'], [1e3, ' K']];\n    for (var i = 0; i < u.length; i++) if (v >= u[i][0]) return (v / u[i][0]).toFixed(v / u[i][0] < 10 ? 1 : 0) + u[i][1];\n    return v.toFixed(0);\n  }\n  function fmtTime(s) {\n    if (s < 60) return s.toFixed(1) + ' s';\n    if (s < 3600) return (s / 60).toFixed(1) + ' min';\n    if (s < 86400) return (s / 3600).toFixed(1) + ' hours';\n    if (s < 86400 * 365) return (s / 86400).toFixed(0) + ' days';\n    var y = s / (86400 * 365);\n    return y >= 1000 ? fmtBig(y) + ' years' : y.toFixed(0) + ' years';\n  }\n  function render() {\n    var p = PARAMS[+root.querySelector('#ex-p').value];\n    var t = TOKENS[+root.querySelector('#ex-t').value];\n    var c = CPO[+root.querySelector('#ex-c').value];\n    var rExp = +root.querySelector('#ex-r').value;\n    var rate = Math.pow(10, rExp);\n\n    root.querySelector('#ex-p-val').textContent = p[1];\n    root.querySelector('#ex-t-val').textContent = t[1];\n    root.querySelector('#ex-c-val').textContent = c[1];\n    root.querySelector('#ex-r-val').textContent = fmtBig(rate).trim();\n\n    var ops = 2 * p[0] * t[0];\n    var cyc = ops * c[0];\n    root.querySelector('#ex-ops').textContent = fmtBig(ops);\n    root.querySelector('#ex-cyc').textContent = fmtBig(cyc);\n    root.querySelector('#ex-seg').textContent = fmtBig(Math.ceil(cyc / SEG));\n    root.querySelector('#ex-time').textContent = fmtTime(cyc / rate);\n    root.querySelector('#ex-band').textContent =\n      fmtTime(cyc / 1e8) + ' to ' + fmtTime(cyc / 1e3);\n  }\n  ['#ex-p', '#ex-t', '#ex-c', '#ex-r'].forEach(function (id) {\n    on(root.querySelector(id), 'input', render);\n  });\n  render();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('claims');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var cards = root.querySelectorAll('.dpw-card');\n  cards.forEach(function (card) {\n    on(card.querySelector('.dpw-card-head'), 'click', function () {\n      var open = card.getAttribute('data-open') === 'true';\n      cards.forEach(function (c) { c.setAttribute('data-open', 'false'); });\n      card.setAttribute('data-open', open ? 'false' : 'true');\n    });\n  });\n})();\n</script>","headings":[{"value":"The smallest interesting verifiable claim","depth":2},{"value":"What you buy at each rung","depth":2},{"value":"The number I refuse to publish","depth":2},{"value":"What is actually provable about a refusal","depth":2},{"value":"Proofs give integrity, and the leak was never an integrity problem","depth":2},{"value":"What I would actually measure next","depth":2}],"frontmatter":{"date_created":"2026-08-24","path":"/blog/cost-of-proving-llm-refusal","tags":["AI Safety","Zero Knowledge Proofs","Verifiable Computation"],"title":"What It Would Cost To Prove An LLM Refused Correctly"}},"nextPost":{"html":"<p>Your proof can be valid, your verifier contract can be correct, the two of them can agree on every piece of mathematics between them, and the transaction still reverts.</p>\n<p>Mine did, for seven weeks. On 3 July I generated a RISC Zero proof of a satellite computation and pushed the on-chain verification to a to-do item, where it sat. The proof verified locally on every run I ever did. The chain rejected it. I assumed the wrap was half finished, because that is the boring explanation and the boring explanation is usually right.</p>\n<p>It was not the wrap. The proof had been valid the entire time. Eight 32-bit words were written to the calldata in the wrong byte order, and nothing in the stack is built to notice that.</p>\n<h2 id=\"the-two-verifiers-disagreed-and-both-were-correct\" style=\"position:relative;\"><a href=\"#the-two-verifiers-disagreed-and-both-were-correct\" aria-label=\"the two verifiers disagreed and both were correct permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The two verifiers disagreed and both were correct</h2>\n<p>The setup is ordinary. A RISC Zero guest re-executes a residual check over a satellite certificate. The host proves it, wraps the STARK into a Groth16 SNARK, and writes out the three arguments a Solidity verifier needs: the seal, the image ID, and the digest of the journal.</p>\n<p>Local verification is one line in the host, and it passes.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">[host] PROVED + VERIFIED in 2618.7s\n[host] VERIFY_MS 5.0582\n[host] JOURNAL_BYTES 432</code></pre></div>\n<p>Five milliseconds, receipt accepted, journal decoded, all fields as expected. Every signal on my machine said healthy.</p>\n<p>On Base Sepolia the same seal, against the RISC Zero verifier router at <code class=\"language-text\">0x0b144e07a0826182b6b59788c34b32bfa86fb711</code>, returned this.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">execution reverted, data: 0x439cc0cd</code></pre></div>\n<p>My first guess was that the router had no verifier registered for my seal version, which is the common failure and has a distinctive error. So I decoded the selector instead of guessing. <code class=\"language-text\">0x439cc0cd</code> is <code class=\"language-text\">VerificationFailed()</code>. Then I asked the router directly which contract it had registered for my seal's selector <code class=\"language-text\">0x73c457ba</code>, and it answered <code class=\"language-text\">0x724d375b5b622e15f0e64e9deb76a4cb17877797</code>.</p>\n<p>So the routing worked. The right verifier received the proof, ran the pairing check, and rejected it.</p>\n<p>At that point there are only two possibilities. The proof is invalid, or the statement I handed the verifier is not the statement the proof is about. The local verifier had already ruled out the first one.</p>\n<h2 id=\"eight-words-backwards\" style=\"position:relative;\"><a href=\"#eight-words-backwards\" aria-label=\"eight words backwards permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Eight words, backwards</h2>\n<p>Here is the line, in the host.</p>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">let</span> image_id <span class=\"token operator\">=</span> <span class=\"token constant\">CERT_VERIFY_ID</span>\n    <span class=\"token punctuation\">.</span><span class=\"token function\">iter</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token closure-params\"><span class=\"token closure-punctuation punctuation\">|</span>w<span class=\"token closure-punctuation punctuation\">|</span></span> <span class=\"token macro property\">format!</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"{w:08x}\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">.</span><span class=\"token function\">collect</span><span class=\"token punctuation\">::</span><span class=\"token operator\">&lt;</span><span class=\"token class-name\">Vec</span><span class=\"token operator\">&lt;</span>_<span class=\"token operator\">>></span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">.</span><span class=\"token function\">join</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p><code class=\"language-text\">CERT_VERIFY_ID</code> is a <code class=\"language-text\">[u32; 8]</code>. Formatting each word with <code class=\"language-text\">{:08x}</code> prints it big-endian, most significant byte first. The canonical byte string of a RISC Zero digest is the little-endian serialisation of each word. Same eight words, same 32 bytes, with the four bytes inside every word reversed.</p>\n<p>Toggle the two encodings below and watch what moves.</p>\n<div class=\"dpw\" id=\"flip\" data-initialised=\"false\">\n  <div class=\"dpw-toggle-row\">\n    <span class=\"dpw-toggle-cap\">Image ID encoding</span>\n    <button class=\"dpw-toggle\" id=\"fl-host\" data-on=\"true\">as the host writes it</button>\n    <button class=\"dpw-toggle\" id=\"fl-canon\">canonical digest bytes</button>\n  </div>\n  <div class=\"dpw-words\" id=\"fl-words\"></div>\n  <div class=\"dpw-hexrow\">\n    <span class=\"dpw-hexcap\">bytes sent to <code>verify()</code></span>\n    <code class=\"dpw-hex\" id=\"fl-hex\"></code>\n  </div>\n  <div class=\"dpw-term\">\n    <div class=\"dpw-term-l\"><span class=\"dpw-prompt\">$</span> cast call 0x0b144e07…b711 \"verify(bytes,bytes32,bytes32)\" $SEAL $IMG $JOURNAL</div>\n    <div class=\"dpw-term-r\" id=\"fl-out\">execution reverted, data: 0x439cc0cd &nbsp;<span class=\"dpw-decode\">VerificationFailed()</span></div>\n  </div>\n  <div class=\"dpw-hint\">Same seal. Same journal. Same 32 bytes, regrouped. One of these settles on chain for 249,749 gas and the other one does not settle at all.</div>\n</div>\n<p>Nothing about the proof changed. The seal is the same 260 bytes, the journal is the same 432 bytes, the digest of the journal is the same <code class=\"language-text\">0xee0444bb…</code>. Only the statement moved, and only inside each word.</p>\n<p>I want to be careful about what kind of bug this is, because I filed it in my head under the wrong heading at first.</p>\n<h2 id=\"this-is-a-completeness-failure-which-is-why-nobody-was-looking-for-it\" style=\"position:relative;\"><a href=\"#this-is-a-completeness-failure-which-is-why-nobody-was-looking-for-it\" aria-label=\"this is a completeness failure which is why nobody was looking for it permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>This is a completeness failure, which is why nobody was looking for it</h2>\n<p>Write down what soundness actually quantifies over. For a proof system <strong>Π</strong> = (Prove, Verify) with security parameter <strong>λ</strong>, soundness says that for every probabilistic polynomial-time prover <strong>P*</strong>,</p>\n<div class=\"dpw-formula\">Pr[ Verify(x, &pi;) = 1 &nbsp;&and;&nbsp; x &notin; L ] &nbsp;&le;&nbsp; negl(&lambda;)</div>\n<p>Read the quantifier. <strong>x</strong> is handed to Verify. The statement is an input to the security definition, not an output of it. Everything the proof system promises is conditional on both parties already agreeing on what <strong>x</strong> is.</p>\n<p>In a deployment there is no such agreement. There is a map.</p>\n<p><strong>Setup</strong>: The challenger fixes a program identity <strong>I</strong> (here a <code class=\"language-text\">[u32; 8]</code> image ID) and a journal <strong>J</strong>. The honest encoding <strong>E*</strong> produces the canonical statement bytes <strong>x*</strong> = <strong>E*</strong>(<strong>I</strong>, <strong>J</strong>). The deployed encoding <strong>E</strong> produces <strong>x</strong> = <strong>E</strong>(<strong>I</strong>, <strong>J</strong>).</p>\n<p><strong>The deployed check</strong>: The prover computes <strong>π</strong> ← Prove(<strong>x*</strong>), and the chain computes V<sub>chain</sub>(<strong>E</strong>(<strong>I</strong>, <strong>J</strong>), <strong>π</strong>).</p>\n<p><strong>Encoding fault</strong>: <strong>E</strong> ≠ <strong>E*</strong>.</p>\n<p>Grade it.</p>\n<p><strong>Completeness</strong>: An honest prover with a correct proof is rejected whenever <strong>E</strong> ≠ <strong>E*</strong>. That is exactly what happened, for seven weeks. <strong>Fails.</strong></p>\n<p><strong>Soundness</strong>: Untouched. The verifier rejected a statement it had no proof for, which is precisely the behaviour soundness demands. The system was never insecure. <strong>Perfect.</strong></p>\n<p><strong>Zero-knowledge</strong>: Untouched. Nothing leaked. <strong>Perfect.</strong></p>\n<p>So my bug lived in the one property whose failure mode looks like a stuck ticket rather than a breach. Completeness failures get triaged as \"the deploy isn't finished\". They do not get security review, they do not get a postmortem, and they can sit in a backlog for two months while everybody assumes the missing piece is somewhere else.</p>\n<p>Now flip the direction, because that is the part that should worry you. Suppose <strong>E</strong> is not injective, so two distinct statements collide onto the same bytes. Truncate the image ID, or pack a length field ambiguously, or hash a struct without domain separation. Then a proof about statement <strong>x₁</strong> is accepted as a proof about <strong>x₂</strong>, and the same silence applies. That is a soundness break, delivered by the same class of defect, and the proof system will not see it because <strong>E</strong> was never inside the quantifier.</p>\n<p>The property that needs stating out loud, and that neither the proof system nor the verifier contract checks, is this. <strong>E</strong> must be canonical and injective, and both sides must implement the same <strong>E</strong>.</p>\n<h2 id=\"where-the-trust-actually-sits\" style=\"position:relative;\"><a href=\"#where-the-trust-actually-sits\" aria-label=\"where the trust actually sits permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Where the trust actually sits</h2>\n<p>I found this useful to draw. Click a link in the chain to see what carries a proof and what carries an assumption.</p>\n<div class=\"dpw\" id=\"surface\" data-initialised=\"false\">\n  <svg id=\"sf-svg\" viewBox=\"0 0 480 150\" class=\"dpw-svg\" role=\"img\" aria-label=\"Pipeline from guest source to on-chain verifier, showing which links are proved and which are trusted\"></svg>\n  <div class=\"dpw-legend\">\n    <span class=\"dpw-key\"><i style=\"background:#3f8f5b\"></i>covered by a proof</span>\n    <span class=\"dpw-key\"><i style=\"background:#a72e2b\"></i>trusted, unproven</span>\n  </div>\n  <div class=\"dpw-detail\" id=\"sf-detail\">\n    <div class=\"dpw-detail-h\">Pick a link</div>\n    <div class=\"dpw-detail-b\">The zkVM covers exactly one of these five. The other four are engineering you have to get right by hand, and two of mine were wrong.</div>\n  </div>\n</div>\n<p>The middle link is the only one the zkVM is about. It says the guest with image ID <strong>I</strong> executed and produced journal <strong>J</strong>, and it says it with a soundness error negligible in <strong>λ</strong>. Every other link is ordinary software.</p>\n<h2 id=\"the-second-hole-in-the-same-boundary\" style=\"position:relative;\"><a href=\"#the-second-hole-in-the-same-boundary\" aria-label=\"the second hole in the same boundary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The second hole in the same boundary</h2>\n<p>While I had the prover up I rebuilt the guest from unchanged source to check something else, and got a different image ID.</p>\n<p>The July build identifies as <code class=\"language-text\">7403d550c2a6…</code>. Today's build of the same source, same repository, same machine, identifies as <code class=\"language-text\">c48992463c2a…</code>. The journals are byte-identical, the residual is the same to the last digit, the computation did not move. Only the program's name for itself did.</p>\n<p>That matters more than it sounds. The image ID is the on-chain claim about <em>which program ran</em>. If a reader cannot rebuild the guest and arrive at the ID that is published, then the published ID is an assertion by me rather than a fact they can check, and the whole point of putting it on a chain evaporates. RISC Zero ships a fix for this, a containerised guest build that pins the toolchain, and I had not turned it on.</p>\n<p>So the same boundary has two defects. The encoding of the program identity was wrong, and the derivation of the program identity was not reproducible. Both live in the gap between \"the proof is valid\" and \"you and I agree on what it is a proof of\".</p>\n<h2 id=\"what-the-corrected-call-actually-costs\" style=\"position:relative;\"><a href=\"#what-the-corrected-call-actually-costs\" aria-label=\"what the corrected call actually costs permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What the corrected call actually costs</h2>\n<p>With the byte order fixed, the call returns empty, which is how the RISC Zero interface says yes. Here is where the money goes.</p>\n<div class=\"dpw\" id=\"gas\" data-initialised=\"false\">\n  <div class=\"dpw-toggle-row\">\n    <span class=\"dpw-toggle-cap\">Show</span>\n    <button class=\"dpw-toggle\" id=\"gs-gas\" data-on=\"true\">gas</button>\n    <button class=\"dpw-toggle\" id=\"gs-bytes\">calldata bytes</button>\n  </div>\n  <svg id=\"gs-svg\" viewBox=\"0 0 480 118\" class=\"dpw-svg\" role=\"img\" aria-label=\"Breakdown of gas and calldata for the on-chain verification call\"></svg>\n  <div class=\"dpw-readout\">\n    <div class=\"dpw-stat\"><span class=\"dpw-num\">276,389</span><span class=\"dpw-cap\">gas, whole transaction</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\">249,749</span><span class=\"dpw-cap\">gas, the pairing check itself</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\">$0.0042</span><span class=\"dpw-cap\">at 0.006 gwei, ETH $2,512</span></div>\n  </div>\n  <div class=\"dpw-hint\">Hover a segment. Gas price read from Base mainnet and ETH spot from Coinbase on 24 August 2026, both stated so you can redo the arithmetic when they move.</div>\n</div>\n<p>Two proving runs sit behind that one call. The STARK and its recursion took 1,501 seconds before failing, and the successful wrap took 2,618.7 seconds with a peak resident set of 9.61 GB. The receipt shrinks from 2,251,496 bytes to 1,361 across that pipeline, and the seal that actually travels is 260 bytes.</p>\n<p>That first failure is worth one paragraph on its own, because it wasted 25 minutes and it will waste yours. The wrap runs inside a container, so the prover process needs to reach the Docker socket. Mine could not.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">thread &#39;main&#39; panicked at host/src/main.rs:72:10:\n  called `Result::unwrap()` on an `Err` value: docker returned failure exit code: Some(1)</code></pre></div>\n<p>The user was not in the <code class=\"language-text\">docker</code> group. The STARK and the recursion both completed first, so the run burns its full compute before dying on a permission check that could have been made in the first second. A <code class=\"language-text\">groups</code> check at startup would have cost nothing.</p>\n<h2 id=\"the-rule-i-took-away\" style=\"position:relative;\"><a href=\"#the-rule-i-took-away\" aria-label=\"the rule i took away permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The rule I took away</h2>\n<p>I have written before about grading protocols on completeness, soundness, and zero-knowledge. What this cost me is that I had been grading <strong>Π</strong>, and shipping V<sub>chain</sub> ∘ <strong>E</strong>.</p>\n<p>So the question I ask now, before wiring any proof to any verifier I did not write, is which bytes both sides think the statement is, and who wrote each of the two functions that produce them. If the answer is \"two different implementations in two different languages by two different authors\", that map deserves a test vector of its own, checked in, with the canonical bytes pinned. It is three lines of test and it would have saved me seven weeks.</p>\n<p>There's a broader version of this that I believe and will defend. Cryptographic assurance ends at the edge of the security definition, and the security definition starts <em>after</em> the statement exists. Everything upstream of that, the build that produces the program identity, the serialisation that produces the statement, the ABI that carries it, is unverified plumbing wearing the reputation of the proof it carries. Most of the code in a deployed proof system lives there.</p>\n<p>The mathematics was never the risky part.</p>\n<style>\n.dpw {\n  --ink: #1b2228; --ink2: #5b7085; --line: #dae4ed;\n  --maroon: #a72e2b; --maroon-d: #6a1d1b; --rose: #f2cdcc; --green: #3f8f5b;\n  border: 1px solid var(--line); border-radius: 6px; padding: 20px;\n  margin: 32px 0; background: #fff; font-family: 'Open Sans', sans-serif;\n}\n.dpw * { box-sizing: border-box; }\n.dpw-formula { text-align: center; font-family: 'Inconsolata', monospace; font-size: 18px;\n  color: #1b2228; margin: 22px 0; }\n.dpw-toggle-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }\n.dpw-toggle-cap { width: 100%; margin-bottom: 2px; font-size: 12px; color: var(--ink2); }\n.dpw-toggle { font-family: 'Inconsolata', monospace; font-size: 12px; border: 1px solid var(--line);\n  background: #fff; color: var(--ink2); padding: 5px 9px; border-radius: 4px; cursor: pointer; transition: all .15s; }\n.dpw-toggle[data-on=true] { background: var(--maroon); color: #fff; border-color: var(--maroon); }\n.dpw-words { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 14px; }\n.dpw-wrow { display: flex; align-items: center; gap: 8px; }\n.dpw-wlab { font-family: 'Inconsolata', monospace; font-size: 11px; color: #94a6b8; width: 22px; flex: none; }\n.dpw-wtrack { position: relative; height: 24px; flex: 1; }\n.dpw-byte { position: absolute; top: 0; height: 24px; width: 23.5%; border-radius: 3px;\n  font-family: 'Inconsolata', monospace; font-size: 12px; font-weight: 700; color: #fff;\n  display: flex; align-items: center; justify-content: center;\n  transition: left .45s cubic-bezier(.4,0,.2,1); }\n.dpw-hexrow { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }\n.dpw-hexcap { font-size: 11px; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }\n.dpw-hexcap code { text-transform: none; font-size: 11px; }\n.dpw-hex { font-family: 'Inconsolata', monospace; font-size: 12px; color: var(--maroon-d);\n  word-break: break-all; line-height: 1.6; background: #f4f7fa; padding: 8px 10px; border-radius: 4px; }\n.dpw-term { background: #1b2228; border-radius: 5px; padding: 12px 14px; font-family: 'Inconsolata', monospace;\n  font-size: 12px; line-height: 1.7; overflow-x: auto; }\n.dpw-term-l { color: #8ba2b8; white-space: nowrap; }\n.dpw-prompt { color: var(--green); }\n.dpw-term-r { color: #f2cdcc; margin-top: 4px; }\n.dpw-term-r.ok { color: #7fd6a0; }\n.dpw-decode { color: #94a6b8; }\n.dpw-svg { width: 100%; height: auto; display: block; margin: 6px 0 4px;\n  background: linear-gradient(180deg, #fbfcfe, #f4f7fa); border-radius: 4px; }\n.dpw-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }\n.dpw-key { font-size: 12px; color: var(--ink2); display: flex; align-items: center; gap: 6px; }\n.dpw-key i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }\n.dpw-detail { border: 1px solid var(--line); border-radius: 5px; padding: 12px 14px; margin-top: 12px; }\n.dpw-detail-h { font-family: 'Josefin Sans', sans-serif; font-size: 14px; color: var(--ink); margin-bottom: 6px; }\n.dpw-detail-b { font-size: 13px; color: var(--ink2); line-height: 21px; }\n.dpw-detail-b code { font-family: 'Inconsolata', monospace; font-size: 12px; background: #f4f7fa;\n  padding: 1px 5px; border-radius: 3px; color: var(--maroon-d); }\n.dpw-readout { display: flex; gap: 24px; margin-top: 10px; flex-wrap: wrap; }\n.dpw-stat { display: flex; flex-direction: column; }\n.dpw-num { font-family: 'Josefin Sans', sans-serif; font-size: 24px; color: var(--maroon-d); line-height: 1.1; }\n.dpw-cap { font-size: 11px; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }\n.dpw-hint { font-size: 12px; color: var(--ink2); margin-top: 8px; font-style: italic; }\n@media (max-width: 480px) { .dpw-readout { gap: 14px; } .dpw-num { font-size: 20px; } }\n@media (prefers-reduced-motion: reduce) { .dpw * { transition: none !important; } }\n</style>\n<script>\n(function () {\n  var root = document.getElementById('flip');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  // The real image ID, as eight u32 words printed big-endian by the host.\n  var HOST = 'c48992463c2a9780752776d1ac9cc75a50ae245f282d4b04198dcc9dd6478bc0';\n  var SHADES = ['#6a1d1b', '#a72e2b', '#c4635f', '#dd9793'];\n  var wrap = root.querySelector('#fl-words');\n  var canonical = false;\n\n  var words = [];\n  for (var i = 0; i < 8; i++) {\n    var bytes = [];\n    for (var b = 0; b < 4; b++) bytes.push(HOST.substr(i * 8 + b * 2, 2));\n    words.push(bytes);\n  }\n\n  // build once, then only move the cells\n  words.forEach(function (bytes, wi) {\n    var row = document.createElement('div'); row.className = 'dpw-wrow';\n    var lab = document.createElement('span'); lab.className = 'dpw-wlab'; lab.textContent = 'w' + wi;\n    var track = document.createElement('div'); track.className = 'dpw-wtrack';\n    bytes.forEach(function (hex, bi) {\n      var cell = document.createElement('div');\n      cell.className = 'dpw-byte'; cell.textContent = hex;\n      cell.style.background = SHADES[bi];\n      cell.setAttribute('data-bi', bi);\n      track.appendChild(cell);\n    });\n    row.appendChild(lab); row.appendChild(track); wrap.appendChild(row);\n  });\n\n  function hexString() {\n    return words.map(function (bytes) {\n      var b = canonical ? bytes.slice().reverse() : bytes;\n      return b.join('');\n    }).join('');\n  }\n\n  function render() {\n    root.querySelectorAll('.dpw-wtrack').forEach(function (track) {\n      track.querySelectorAll('.dpw-byte').forEach(function (cell) {\n        var bi = parseInt(cell.getAttribute('data-bi'), 10);\n        var slot = canonical ? 3 - bi : bi;\n        cell.style.left = (slot * 25.5) + '%';\n      });\n    });\n    root.querySelector('#fl-hex').textContent = '0x' + hexString();\n    var out = root.querySelector('#fl-out');\n    if (canonical) {\n      out.className = 'dpw-term-r ok';\n      out.innerHTML = '0x &nbsp;<span class=\"dpw-decode\">empty return, the proof is accepted &middot; 249,749 gas</span>';\n    } else {\n      out.className = 'dpw-term-r';\n      out.innerHTML = 'execution reverted, data: 0x439cc0cd &nbsp;<span class=\"dpw-decode\">VerificationFailed()</span>';\n    }\n    root.querySelector('#fl-host').setAttribute('data-on', !canonical);\n    root.querySelector('#fl-canon').setAttribute('data-on', canonical);\n  }\n  on(root.querySelector('#fl-host'), 'click', function () { canonical = false; render(); });\n  on(root.querySelector('#fl-canon'), 'click', function () { canonical = true; render(); });\n  render();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('surface');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SVG = 'http://www.w3.org/2000/svg';\n  var svg = root.querySelector('#sf-svg');\n  var NODES = [\n    { x: 34, t: 'guest', s: 'source' },\n    { x: 138, t: 'ELF', s: 'binary' },\n    { x: 242, t: 'image ID', s: '[u32; 8]' },\n    { x: 346, t: 'calldata', s: '420 bytes' },\n    { x: 448, t: 'verifier', s: 'Solidity' }\n  ];\n  var LINKS = [\n    { i: 0, proved: false, h: 'Build: source to ELF',\n      b: 'Not reproducible in my setup. The same source rebuilt on the same machine produced image ID <code>c48992463c2a…</code> against July\\'s <code>7403d550c2a6…</code>. Fix is RISC Zero\\'s containerised guest build, which pins the toolchain.' },\n    { i: 1, proved: false, h: 'Identity: ELF to image ID',\n      b: 'A digest of the binary. Correct here, but only meaningful if the previous link is reproducible. If you cannot rebuild the ELF, this ID is my word rather than your check.' },\n    { i: 2, proved: true, h: 'Execution: the zkVM proof',\n      b: 'The only link with a security proof behind it. It says the guest with this image ID ran and produced this journal, with soundness error negligible in the security parameter. 8,388,608 cycles, 8 segments, wrapped to a 260-byte seal.' },\n    { i: 3, proved: false, h: 'Encoding: image ID to calldata',\n      b: 'This is the one that broke. <code>format!(\"{w:08x}\")</code> over a <code>[u32; 8]</code> prints each word big-endian; the verifier expects the little-endian digest bytes. Seven weeks of <code>VerificationFailed()</code>.' }\n  ];\n  var sel = -1;\n\n  function el(n, at) { var e = document.createElementNS(SVG, n); for (var k in at) e.setAttribute(k, at[k]); return e; }\n\n  function draw() {\n    while (svg.firstChild) svg.removeChild(svg.firstChild);\n    LINKS.forEach(function (lk, i) {\n      var a = NODES[lk.i], b = NODES[lk.i + 1];\n      var col = lk.proved ? '#3f8f5b' : '#a72e2b';\n      var g = el('g', { cursor: 'pointer' });\n      g.appendChild(el('line', { x1: a.x + 30, y1: 58, x2: b.x - 30, y2: 58,\n        stroke: col, 'stroke-width': sel === i ? 4 : 2.2,\n        'stroke-dasharray': lk.proved ? '' : '5 3' }));\n      g.appendChild(el('polygon', { points: (b.x - 30) + ',58 ' + (b.x - 37) + ',54 ' + (b.x - 37) + ',62', fill: col }));\n      g.appendChild(el('rect', { x: a.x + 30, y: 46, width: b.x - a.x - 60, height: 24, fill: 'transparent' }));\n      on(g, 'click', function () { sel = i; draw(); detail(); });\n      svg.appendChild(g);\n    });\n    NODES.forEach(function (n) {\n      svg.appendChild(el('rect', { x: n.x - 30, y: 40, width: 60, height: 36, rx: 4,\n        fill: '#fff', stroke: '#dae4ed', 'stroke-width': 1.2 }));\n      var t1 = el('text', { x: n.x, y: 57, 'text-anchor': 'middle', 'font-size': 11,\n        fill: '#1b2228', 'font-family': 'Josefin Sans, sans-serif' }); t1.textContent = n.t;\n      var t2 = el('text', { x: n.x, y: 68, 'text-anchor': 'middle', 'font-size': 8.5,\n        fill: '#94a6b8', 'font-family': 'Inconsolata, monospace' }); t2.textContent = n.s;\n      svg.appendChild(t1); svg.appendChild(t2);\n    });\n    var hint = el('text', { x: 240, y: 108, 'text-anchor': 'middle', 'font-size': 10.5,\n      fill: '#5b7085', 'font-style': 'italic' });\n    hint.textContent = sel === -1 ? 'click a link between two boxes' : '';\n    svg.appendChild(hint);\n  }\n  function detail() {\n    var d = root.querySelector('#sf-detail');\n    var lk = LINKS[sel];\n    d.querySelector('.dpw-detail-h').textContent = (lk.proved ? '✓ ' : '! ') + lk.h;\n    d.querySelector('.dpw-detail-h').style.color = lk.proved ? '#3f8f5b' : '#a72e2b';\n    d.querySelector('.dpw-detail-b').innerHTML = lk.b;\n  }\n  draw();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('gas');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SVG = 'http://www.w3.org/2000/svg';\n  var svg = root.querySelector('#gs-svg');\n  // Measured: eth_estimateGas 276,389. Intrinsic = 21,000 + 330 nonzero x16 + 90 zero x4.\n  var GAS = [\n    { l: 'base transaction', v: 21000, c: '#dd9793' },\n    { l: 'calldata, 420 bytes', v: 5640, c: '#c4635f' },\n    { l: 'Groth16 pairing check', v: 249749, c: '#a72e2b' }\n  ];\n  var BYTES = [\n    { l: 'selector', v: 4, c: '#dd9793' },\n    { l: 'head: offset + imageId + journalDigest', v: 96, c: '#c4635f' },\n    { l: 'seal length word', v: 32, c: '#8ba2b8' },\n    { l: 'seal, 260 bytes padded to 288', v: 288, c: '#a72e2b' }\n  ];\n  var mode = 'gas', hover = -1;\n  function el(n, at) { var e = document.createElementNS(SVG, n); for (var k in at) e.setAttribute(k, at[k]); return e; }\n\n  function draw() {\n    var data = mode === 'gas' ? GAS : BYTES;\n    var unit = mode === 'gas' ? ' gas' : ' bytes';\n    var total = data.reduce(function (a, d) { return a + d.v; }, 0);\n    while (svg.firstChild) svg.removeChild(svg.firstChild);\n    var X0 = 14, W = 452, x = X0;\n    data.forEach(function (d, i) {\n      var w = d.v / total * W;\n      var g = el('g', { cursor: 'pointer' });\n      g.appendChild(el('rect', { x: x, y: 26, width: Math.max(w, 1.5), height: 34, fill: d.c,\n        opacity: hover === -1 || hover === i ? 1 : 0.45 }));\n      g.appendChild(el('rect', { x: x, y: 18, width: Math.max(w, 1.5), height: 50, fill: 'transparent' }));\n      on(g, 'mouseenter', function () { if (hover === i) return; hover = i; draw(); });\n      on(g, 'mouseleave', function () { hover = -1; draw(); });\n      svg.appendChild(g);\n      if (w > 46) {\n        var t = el('text', { x: x + w / 2, y: 48, 'text-anchor': 'middle', 'font-size': 11,\n          fill: '#fff', 'font-family': 'Inconsolata, monospace' });\n        t.textContent = d.v.toLocaleString();\n        svg.appendChild(t);\n      }\n      x += w;\n    });\n    var lab = el('text', { x: 240, y: 86, 'text-anchor': 'middle', 'font-size': 12, fill: '#1b2228' });\n    lab.textContent = hover === -1\n      ? total.toLocaleString() + unit + ' total'\n      : data[hover].l + ': ' + data[hover].v.toLocaleString() + unit;\n    svg.appendChild(lab);\n    var sub = el('text', { x: 240, y: 102, 'text-anchor': 'middle', 'font-size': 10, fill: '#94a6b8',\n      'font-style': 'italic' });\n    sub.textContent = hover === -1 ? 'hover a segment' :\n      (hover === data.length - 1 ? 'the part that is actually cryptography' : '');\n    svg.appendChild(sub);\n    root.querySelector('#gs-gas').setAttribute('data-on', mode === 'gas');\n    root.querySelector('#gs-bytes').setAttribute('data-on', mode === 'bytes');\n  }\n  on(root.querySelector('#gs-gas'), 'click', function () { mode = 'gas'; hover = -1; draw(); });\n  on(root.querySelector('#gs-bytes'), 'click', function () { mode = 'bytes'; hover = -1; draw(); });\n  draw();\n})();\n</script>","headings":[{"value":"The two verifiers disagreed and both were correct","depth":2},{"value":"Eight words, backwards","depth":2},{"value":"This is a completeness failure, which is why nobody was looking for it","depth":2},{"value":"Where the trust actually sits","depth":2},{"value":"The second hole in the same boundary","depth":2},{"value":"What the corrected call actually costs","depth":2},{"value":"The rule I took away","depth":2}],"frontmatter":{"date_created":"2026-08-24","path":"/blog/zk-serialization-boundary","tags":["Zero Knowledge Proofs","Formal Verification","Trust Boundaries"],"title":"What Your Zero Knowledge Proof Does Not Prove"}}},"pageContext":{"prevPostPath":"/blog/crypto-club-proof-by-contradiction","currPostPath":"/blog/cost-of-proving-llm-refusal","nextPostPath":"/blog/zk-serialization-boundary"}},"staticQueryHashes":[]}