pub fn verify_last_layer(ctx: & mut Vec<Uint256>, n_points: usize) {

	let fri_last_deg_bound = uint256_ops::to_usize( &ctx[map::MM_FRI_LAST_LAYER_DEG_BOUND] );
	let group_order_minus_1 = uint256_ops::from_usize(fri_last_deg_bound) * ctx[map::MM_BLOW_UP_FACTOR].clone() - uint256_ops::get_uint256("0");
	let coeff_start = uint256_ops::to_usize( &ctx[map::MM_FRI_LAST_LAYER_PTR] );

	for i in 0..n_points {
		
		let mut point = ctx[map::MM_FRI_QUEUE + 3*i + 2].clone();

		// Invert point using inverse(point) == fpow(point, ord(point) - 1)
		point = prime_field::fpow(&point, &group_order_minus_1); 

		assert!( horner_eval(coeff_start, point, fri_last_deg_bound, ctx) ==  ctx[map::MM_FRI_QUEUE + 3*i + 1] ); //Bad Last layer value

	}
	
}
// Verify the last set of coefficents sent from the prover
Verify the last set of coefficents sent from the prover
Verify the last set of coefficents sent from the prover
pub fn verify_last_layer(ctx: & mut Vec<Uint256>, n_points: usize) {
	let fri_last_deg_bound = uint256_ops::to_usize( &ctx[map::MM_FRI_LAST_LAYER_DEG_BOUND] );
	let group_order_minus_1 = uint256_ops::from_usize(fri_last_deg_bound) * ctx[map::MM_BLOW_UP_FACTOR].clone() - uint256_ops::get_uint256("0");
	let coeff_start = uint256_ops::to_usize( &ctx[map::MM_FRI_LAST_LAYER_PTR] );
	for i in 0..n_points {
		let mut point = ctx[map::MM_FRI_QUEUE + 3*i + 2].clone();
		// Invert point using inverse(point) == fpow(point, ord(point) - 1)
		point = prime_field::fpow(&point, &group_order_minus_1); 
		assert!( horner_eval(coeff_start, point, fri_last_deg_bound, ctx) ==  ctx[map::MM_FRI_QUEUE + 3*i + 1] ); //Bad Last layer value
	}
}
pub fn verify_last_layer ( ctx : & mut Vec < Uint256 > , n_points : usize ) { let fri_last_deg_bound = uint256_ops :: to_usize ( & ctx [ map :: MM_FRI_LAST_LAYER_DEG_BOUND ] ) ; let group_order_minus_1 = uint256_ops :: from_usize ( fri_last_deg_bound ) * ctx [ map :: MM_BLOW_UP_FACTOR ] . clone ( ) - uint256_ops :: get_uint256 ( " " ) ; let coeff_start = uint256_ops :: to_usize ( & ctx [ map :: MM_FRI_LAST_LAYER_PTR ] ) ; for i in 0 .. n_points { let mut point = ctx [ map :: MM_FRI_QUEUE + 3 * i + 2 ] . clone ( ) ; // Invert point using inverse(point) == fpow(point, ord(point) - 1) point = prime_field :: fpow ( & point , & group_order_minus_1 ) ; assert ! ( horner_eval ( coeff_start point fri_last_deg_bound ctx ) ctx [ map MM_FRI_QUEUE 3 i 1 ] ) ; //Bad Last layer value } }
Verify the last set of coefficents sent from the prover
Verify the last set of coefficents sent from the prover
ctx
& mut Vec<Uint256>
n_points
usize
ctx
& mut Vec<Uint256>
n_points
usize