Skip to content

Conversation

wz14
Copy link

@wz14 wz14 commented Jul 11, 2024

This PR adds a static stack analyzer for Script Builder.

    let mut script = script! (
        OP_ADD
        OP_ADD
        OP_ADD
    );
    let (x, y) = script.get_stack();
    assert_eq!(x, -4);
    assert_eq!(y, -3);

The stack analyzer is tested through groth16 verifier. Most of groth16 verifier can be analyzed staticly, but there still are three changes for dynamic cases, which can be pulled later.

BitVM change list:

  • src/fp/inv.rs Line 251: HINT
  • src/bigint/std.rs Line 111: HINT
  • src/bn254/curve.rs Line 417, Line 442: add one Fp::add(), it's improper to add hint to a big script

https://github.com/wz14/BitVM/tree/analyze_groth16

@lucidLuckylee lucidLuckylee merged commit 22f96a6 into BitVM:chunker Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants