pub fn do_round<C: Channel<F>>(
        &mut self,
        g_j: Polynomial<FieldElement<F>>,
        transcript: &mut C,
    ) -> Result<VerifierRoundResult<F>, VerifierError<F>> {
        // Check if we are past the expected number of rounds.
        if self.round >= self.num_vars {
            return Err(VerifierError::InvalidState(
                "Round number exceeds number of variables.".to_string(),
            ));
        }

        // 1. Check degree of g_j.
        // The degree of g_j(X_j) = sum_{...} prod P_i(...) can be at most the number of factors.
        let max_degree = self.oracle_factors.len();
        if g_j.degree() > max_degree {
            return Err(VerifierError::InvalidDegree {
                round: self.round,
                actual_degree: g_j.degree(),
                max_allowed: max_degree,
            });
        }

        // 2. Check consistency: g_j(0) + g_j(1) == expected_sum (current_sum)
        let zero = FieldElement::<F>::zero();
        let one = FieldElement::<F>::one();
        let eval_0 = g_j.evaluate(&zero);
        let eval_1 = g_j.evaluate(&one);
        let sum_evals = eval_0.clone() + eval_1.clone();

        if sum_evals != self.current_sum {
            // The prover's polynomial g_j does not match the expected sum from the previous round (or initial C).
            return Err(VerifierError::InconsistentSum {
                round: self.round,
                s0: eval_0,
                s1: eval_1,
                expected: self.current_sum.clone(),
            });
        }

        // 3. Obtain challenge r_j for this round from the transcript.
        let r_j = transcript.draw_felt();
        self.challenges.push(r_j.clone());

        // 4. Update the expected sum for the *next* round: current_sum = g_j(r_j)
        self.current_sum = g_j.evaluate(&r_j);
        self.round += 1;

        // 5. Check if this is the final round.
        if self.round == self.num_vars {
            // Perform the final check: evaluate prod P_i(r1, ..., rn)
            match evaluate_product_at_point(&self.oracle_factors, &self.challenges) {
                Ok(expected_final_eval) => {
                    let success = expected_final_eval == self.current_sum;
                    Ok(VerifierRoundResult::Final(success))
                }
                Err(e) => Err(VerifierError::OracleEvaluationError(e)),
            }
        } else {
            Ok(VerifierRoundResult::NextRound(r_j))
        }
    }
Executes a verification round based on the polynomial \( g_j \) received from the prover.
crates/provers/sumcheck/src/verifier.rs