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

Function validate_assertions

bitvm/src/chunk/api.rs:273–294  ·  view source on GitHub ↗

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],
)

Source from the content-addressed store, hash-verified

271// returns index of disprove script generated in Step 2
272// and the witness required to execute this Disprove Script incase of failure
273pub 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,

Calls 4

cloneMethod · 0.80

Tested by 3

full_e2e_executionFunction · 0.68