MCPcopy Create free account
hub / github.com/BitVM/BitVM / verify_pairing_scripted

Function verify_pairing_scripted

bitvm/src/chunk/g16_runner_core.rs:732–1052  ·  view source on GitHub ↗

Pairing verification check with normalized (1 + a. J) representation Includes equivalent bitcoin script in for each functions

(
        ps: Vec<ark_bn254::G1Affine>,
        qs: Vec<ark_bn254::G2Affine>,
        gc: ark_bn254::Fq12,
        _s: ark_bn254::Fq12,
        p1q1: ark_bn254::Fq6,
    )

Source from the content-addressed store, hash-verified

730 // Pairing verification check with normalized (1 + a. J) representation
731 // Includes equivalent bitcoin script in for each functions
732 pub fn verify_pairing_scripted(
733 ps: Vec<ark_bn254::G1Affine>,
734 qs: Vec<ark_bn254::G2Affine>,
735 gc: ark_bn254::Fq12,
736 _s: ark_bn254::Fq12,
737 p1q1: ark_bn254::Fq6,
738 ) {
739 use crate::chunk::{
740 taps_ext_miller::chunk_frob_fp12,
741 taps_mul::{chunk_dense_dense_mul, chunk_fq12_square},
742 taps_point_ops::{
743 chunk_init_t4, chunk_point_ops_and_multiply_line_evals_step_2, frob_q_power,
744 },
745 };
746
747 let beta_12x = BigUint::from_str(
748 "21575463638280843010398324269430826099269044274347216827212613867836435027261",
749 )
750 .unwrap();
751 let beta_12y = BigUint::from_str(
752 "10307601595873709700152284273816112264069230130616436755625194854815875713954",
753 )
754 .unwrap();
755 let beta_12 = ark_bn254::Fq2::from_base_prime_field_elems([
756 ark_bn254::Fq::from(beta_12x.clone()),
757 ark_bn254::Fq::from(beta_12y.clone()),
758 ])
759 .unwrap();
760 let beta_13x = BigUint::from_str(
761 "2821565182194536844548159561693502659359617185244120367078079554186484126554",
762 )
763 .unwrap();
764 let beta_13y = BigUint::from_str(
765 "3505843767911556378687030309984248845540243509899259641013678093033130930403",
766 )
767 .unwrap();
768 let beta_13 = ark_bn254::Fq2::from_base_prime_field_elems([
769 ark_bn254::Fq::from(beta_13x.clone()),
770 ark_bn254::Fq::from(beta_13y.clone()),
771 ])
772 .unwrap();
773 let beta_22x = BigUint::from_str(
774 "21888242871839275220042445260109153167277707414472061641714758635765020556616",
775 )
776 .unwrap();
777 let beta_22y = BigUint::from_str("0").unwrap();
778 let beta_22 = ark_bn254::Fq2::from_base_prime_field_elems([
779 ark_bn254::Fq::from(beta_22x.clone()),
780 ark_bn254::Fq::from(beta_22y.clone()),
781 ])
782 .unwrap();
783
784 let mut cinv = gc.inverse().unwrap();
785 cinv = ark_bn254::Fq12::new(ark_bn254::Fq6::ONE, cinv.c1 / cinv.c0);
786 let mut c = gc;
787 c = ark_bn254::Fq12::new(ark_bn254::Fq6::ONE, c.c1 / c.c0);
788
789 let mut f = cinv;

Callers 1

test_verify_pairingFunction · 0.85

Calls 11

chunk_init_t4Function · 0.85
chunk_fq12_squareFunction · 0.85
chunk_dense_dense_mulFunction · 0.85
chunk_frob_fp12Function · 0.85
frob_q_powerFunction · 0.85
cloneMethod · 0.80
lenMethod · 0.80
intoMethod · 0.45
negMethod · 0.45

Tested by 1

test_verify_pairingFunction · 0.68