diff --git a/crates/recursion/circuit-v2/src/machine/compress.rs b/crates/recursion/circuit-v2/src/machine/compress.rs index 6e5abdd0ef..4d665ac606 100644 --- a/crates/recursion/circuit-v2/src/machine/compress.rs +++ b/crates/recursion/circuit-v2/src/machine/compress.rs @@ -523,6 +523,8 @@ where compress_public_values.is_complete = is_complete; // Set the contains an execution shard flag. compress_public_values.contains_execution_shard = contains_execution_shard; + // Set the exit code. + compress_public_values.exit_code = exit_code; // Set the digest according to the previous values. compress_public_values.digest = match kind { PublicValuesOutputDigest::Reduce => { @@ -533,9 +535,6 @@ where } }; - // Set the exit code. - compress_public_values.exit_code = exit_code; - // If the proof is complete, make completeness assertions. assert_complete(builder, compress_public_values, is_complete); diff --git a/crates/recursion/circuit-v2/src/machine/core.rs b/crates/recursion/circuit-v2/src/machine/core.rs index 4dd813f2b8..b5714e15a1 100644 --- a/crates/recursion/circuit-v2/src/machine/core.rs +++ b/crates/recursion/circuit-v2/src/machine/core.rs @@ -475,6 +475,9 @@ where } } + // Update the exit code. + exit_code = public_values.exit_code; + // If `deferred_proofs_digest` is not zero, then the current value should be equal // to `public_values.deferred_proofs_digest. diff --git a/crates/recursion/core/src/air/public_values.rs b/crates/recursion/core/src/air/public_values.rs index 57864d96a5..475a893718 100644 --- a/crates/recursion/core/src/air/public_values.rs +++ b/crates/recursion/core/src/air/public_values.rs @@ -142,12 +142,12 @@ pub struct RecursionPublicValues { /// shard, i.e. a shard that contains the `cpu` chip. pub contains_execution_shard: T, - /// The digest of all the previous public values elements. - pub digest: [T; DIGEST_SIZE], - /// The exit code of the program. Note that this is not part of the public values digest, /// since it's value will be individually constrained. pub exit_code: T, + + /// The digest of all the previous public values elements. + pub digest: [T; DIGEST_SIZE], } /// Converts the public values to an array of elements.