(
skip: bool,
segment_id: usize,
in_a: &Segment,
in_t4: &Segment,
in_q4: Vec<Segment>,
fixedacc_const: ark_bn254::Fq6,
)
| 490 | } |
| 491 | |
| 492 | pub(crate) fn wrap_chunk_final_verify( |
| 493 | skip: bool, |
| 494 | segment_id: usize, |
| 495 | in_a: &Segment, |
| 496 | in_t4: &Segment, |
| 497 | in_q4: Vec<Segment>, |
| 498 | fixedacc_const: ark_bn254::Fq6, |
| 499 | ) -> Segment { |
| 500 | let mut input_segment_info: Vec<(SegmentID, ElementType)> = vec![ |
| 501 | (in_t4.id, ElementType::G2EvalPoint), |
| 502 | (in_a.id, ElementType::Fp6), |
| 503 | ]; |
| 504 | let t4: ElemG2Eval = in_t4.result.0.try_into().unwrap(); |
| 505 | let a: ark_bn254::Fq6 = in_a.result.0.try_into().unwrap(); |
| 506 | for v in in_q4.iter().rev() { |
| 507 | input_segment_info.push((v.id, ElementType::FieldElem)) |
| 508 | } |
| 509 | let q4xc0: ark_ff::BigInt<4> = in_q4[0].result.0.try_into().unwrap(); |
| 510 | let q4xc1: ark_ff::BigInt<4> = in_q4[1].result.0.try_into().unwrap(); |
| 511 | let q4yc0: ark_ff::BigInt<4> = in_q4[2].result.0.try_into().unwrap(); |
| 512 | let q4yc1: ark_ff::BigInt<4> = in_q4[3].result.0.try_into().unwrap(); |
| 513 | let q4 = ark_bn254::G2Affine::new_unchecked( |
| 514 | ark_bn254::Fq2::new(q4xc0.into(), q4xc1.into()), |
| 515 | ark_bn254::Fq2::new(q4yc0.into(), q4yc1.into()), |
| 516 | ); |
| 517 | |
| 518 | let (mut is_valid, mut scr, mut op_hints) = (true, script! {}, vec![]); |
| 519 | if !skip { |
| 520 | (is_valid, scr, op_hints) = chunk_final_verify(a, fixedacc_const, t4.t, q4); |
| 521 | |
| 522 | // op_hints.extend_from_slice(&Element::Fp12v0(a).get_hash_preimage_as_hints()); |
| 523 | } |
| 524 | let is_valid_fq = if is_valid { |
| 525 | ark_ff::BigInt::<4>::one() |
| 526 | } else { |
| 527 | ark_ff::BigInt::<4>::zero() |
| 528 | }; |
| 529 | |
| 530 | Segment { |
| 531 | id: segment_id as u32, |
| 532 | is_valid_input: true, |
| 533 | parameter_ids: input_segment_info, |
| 534 | result: (DataType::U256Data(is_valid_fq), ElementType::FieldElem), |
| 535 | hints: op_hints, |
| 536 | scr_type: ScriptType::PostMillerFinalVerify, |
| 537 | scr: scr.compile(), |
| 538 | } |
| 539 | } |
no test coverage detected