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

Function test_tap_init_t4

bitvm/src/chunk/taps_point_ops.rs:1118–1190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1116
1117 #[test]
1118 fn test_tap_init_t4() {
1119 let mut prng = ChaCha20Rng::seed_from_u64(1);
1120 let temp_q1 = ark_bn254::G2Affine::rand(&mut prng);
1121 let q1: [BigInt<4>; 4] = [
1122 temp_q1.x.c0.into(),
1123 temp_q1.x.c1.into(),
1124 temp_q1.y.c0.into(),
1125 temp_q1.y.c1.into(),
1126 ];
1127 let q2 = [
1128 ark_ff::BigInt::<4>::zero(),
1129 ark_ff::BigInt::<4>::zero(),
1130 ark_ff::BigInt::<4>::zero(),
1131 ark_ff::BigInt::<4>::zero(),
1132 ];
1133 let q3 = [
1134 ark_ff::BigInt::<4>::one() << 255,
1135 ark_ff::BigInt::<4>::one() << 255,
1136 ark_ff::BigInt::<4>::one() << 255,
1137 ark_ff::BigInt::<4>::one() << 255,
1138 ];
1139 let q4 = [
1140 ark_ff::BigInt::<4>::one(),
1141 ark_ff::BigInt::<4>::one(),
1142 ark_ff::BigInt::<4>::zero(),
1143 ark_ff::BigInt::<4>::zero(),
1144 ];
1145
1146 let test_set = vec![(q1, false), (q2, true), (q3, true), (q4, true)];
1147 for (q, is_disprovable) in test_set {
1148 let (hint_out, is_valid_input, init_t4_tap, hint_script) = chunk_init_t4(q);
1149 assert_eq!(is_valid_input, !is_disprovable);
1150
1151 let hint_out = DataType::G2EvalData(hint_out);
1152
1153 let bitcom_script = script! {
1154 {hint_out.to_hash().as_hint_type().push()}
1155 {Fq::toaltstack()}
1156
1157 for temp in q.into_iter().rev() {
1158 {Hint::U256(temp.into()).push()}
1159 {Fq::toaltstack()}
1160 }
1161 };
1162 let hash_scr = script! {
1163 {hash_messages(vec![ElementType::G2EvalPoint])}
1164 OP_TRUE
1165 };
1166
1167 let tap_len = init_t4_tap.len() + hash_scr.len();
1168 let script = script! {
1169 for h in hint_script {
1170 { h.push() }
1171 }
1172 {bitcom_script}
1173 {init_t4_tap}
1174 {hash_scr}
1175 };

Callers

nothing calls this directly

Calls 4

chunk_init_t4Function · 0.85
execute_scriptFunction · 0.85
lenMethod · 0.80
intoMethod · 0.45

Tested by

no test coverage detected