diff --git a/crates/prover/src/core/backend/cpu/grind.rs b/crates/prover/src/core/backend/cpu/grind.rs index c5d27a1da..9ca424861 100644 --- a/crates/prover/src/core/backend/cpu/grind.rs +++ b/crates/prover/src/core/backend/cpu/grind.rs @@ -8,7 +8,7 @@ impl GrindOps for CpuBackend { let mut nonce = 0; loop { let mut channel = channel.clone(); - channel.mix_nonce(nonce); + channel.mix_u64(nonce); if channel.trailing_zeros() >= pow_bits { return nonce; } diff --git a/crates/prover/src/core/backend/simd/grind.rs b/crates/prover/src/core/backend/simd/grind.rs index 231377643..221a4557b 100644 --- a/crates/prover/src/core/backend/simd/grind.rs +++ b/crates/prover/src/core/backend/simd/grind.rs @@ -69,7 +69,7 @@ impl GrindOps for SimdBackend { let mut nonce = 0; loop { let mut channel = channel.clone(); - channel.mix_nonce(nonce); + channel.mix_u64(nonce); if channel.trailing_zeros() >= pow_bits { return nonce; } diff --git a/crates/prover/src/core/channel/blake2s.rs b/crates/prover/src/core/channel/blake2s.rs index 98618620d..3887b0b5f 100644 --- a/crates/prover/src/core/channel/blake2s.rs +++ b/crates/prover/src/core/channel/blake2s.rs @@ -67,7 +67,7 @@ impl Channel for Blake2sChannel { self.update_digest(hasher.finalize()); } - fn mix_nonce(&mut self, nonce: u64) { + fn mix_u64(&mut self, nonce: u64) { let digest: [u32; 8] = unsafe { std::mem::transmute(self.digest) }; let mut msg = [0; 16]; msg[0] = nonce as u32; diff --git a/crates/prover/src/core/channel/mod.rs b/crates/prover/src/core/channel/mod.rs index 9b654088d..8d7579664 100644 --- a/crates/prover/src/core/channel/mod.rs +++ b/crates/prover/src/core/channel/mod.rs @@ -35,7 +35,7 @@ pub trait Channel: Default + Clone { // Mix functions. fn mix_felts(&mut self, felts: &[SecureField]); - fn mix_nonce(&mut self, nonce: u64); + fn mix_u64(&mut self, value: u64); // Draw functions. fn draw_felt(&mut self) -> SecureField; diff --git a/crates/prover/src/core/channel/poseidon252.rs b/crates/prover/src/core/channel/poseidon252.rs index 195d1fc67..e9db84593 100644 --- a/crates/prover/src/core/channel/poseidon252.rs +++ b/crates/prover/src/core/channel/poseidon252.rs @@ -81,7 +81,7 @@ impl Channel for Poseidon252Channel { self.update_digest(poseidon_hash_many(&res)); } - fn mix_nonce(&mut self, nonce: u64) { + fn mix_u64(&mut self, nonce: u64) { self.update_digest(poseidon_hash(self.digest, nonce.into())); } diff --git a/crates/prover/src/core/pcs/prover.rs b/crates/prover/src/core/pcs/prover.rs index 6da991150..e5ae1b266 100644 --- a/crates/prover/src/core/pcs/prover.rs +++ b/crates/prover/src/core/pcs/prover.rs @@ -123,7 +123,7 @@ impl<'a, B: BackendForChannel, MC: MerkleChannel> CommitmentSchemeProver<'a, let span1 = span!(Level::INFO, "Grind").entered(); let proof_of_work = B::grind(channel, self.config.pow_bits); span1.exit(); - channel.mix_nonce(proof_of_work); + channel.mix_u64(proof_of_work); // FRI decommitment phase. let (fri_proof, fri_query_domains) = fri_prover.decommit(channel); diff --git a/crates/prover/src/core/pcs/verifier.rs b/crates/prover/src/core/pcs/verifier.rs index 812137fa5..81107b455 100644 --- a/crates/prover/src/core/pcs/verifier.rs +++ b/crates/prover/src/core/pcs/verifier.rs @@ -82,7 +82,7 @@ impl CommitmentSchemeVerifier { FriVerifier::::commit(channel, self.config.fri_config, proof.fri_proof, bounds)?; // Verify proof of work. - channel.mix_nonce(proof.proof_of_work); + channel.mix_u64(proof.proof_of_work); if channel.trailing_zeros() < self.config.pow_bits { return Err(VerificationError::ProofOfWork); } diff --git a/crates/prover/src/examples/blake/air.rs b/crates/prover/src/examples/blake/air.rs index 58bb8633b..ca583abe3 100644 --- a/crates/prover/src/examples/blake/air.rs +++ b/crates/prover/src/examples/blake/air.rs @@ -55,8 +55,7 @@ impl BlakeStatement0 { TreeVec::concat_cols(sizes.into_iter()) } fn mix_into(&self, channel: &mut impl Channel) { - // TODO(spapini): Do this better. - channel.mix_nonce(self.log_size as u64); + channel.mix_u64(self.log_size as u64); } }