Step 4 validate signed assertions returns index of disprove script generated in Step 2 and the witness required to execute this Disprove Script incase of failure
(
vk: &ark_groth16::VerifyingKey<Bn254>,
signed_asserts: Signatures,
_inpubkeys: PublicKeys,
disprove_scripts: &[ScriptBuf; NUM_TAPS],
)
| 271 | // returns index of disprove script generated in Step 2 |
| 272 | // and the witness required to execute this Disprove Script incase of failure |
| 273 | pub fn validate_assertions( |
| 274 | vk: &ark_groth16::VerifyingKey<Bn254>, |
| 275 | signed_asserts: Signatures, |
| 276 | _inpubkeys: PublicKeys, |
| 277 | disprove_scripts: &[ScriptBuf; NUM_TAPS], |
| 278 | ) -> Option<(usize, Script)> { |
| 279 | println!("validate_assertions; get_assertions_from_signature"); |
| 280 | let asserts = get_assertions_from_signature(signed_asserts.clone()); |
| 281 | println!("validate_assertions; get_segments_from_assertion"); |
| 282 | let (success, segments) = get_segments_from_assertion(asserts, vk.clone()); |
| 283 | if !success { |
| 284 | println!("invalid tapscript at segment {}", segments.len()); |
| 285 | } |
| 286 | println!("validate_assertions; execute_script_from_signature"); |
| 287 | let exec_result = execute_script_from_signature(&segments, signed_asserts, disprove_scripts); |
| 288 | assert_eq!( |
| 289 | success, |
| 290 | exec_result.is_none(), |
| 291 | "ensure script execution matches rust execution match" |
| 292 | ); |
| 293 | exec_result |
| 294 | } |
| 295 | |
| 296 | // doesn't crash even if the proof may be incorrect |
| 297 | // should be used only for test purposes, |