Skip to content

Commit 3f7d91e

Browse files
Feat/integrate bridge with chunk verifier (BitVM#226)
* init: integration function * chore: test apis for disprove invalid proof
1 parent 58f539f commit 3f7d91e

File tree

25 files changed

+484
-253
lines changed

25 files changed

+484
-253
lines changed

bitvm/src/bn254/fq.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,9 @@ fp_lc_mul!(Mul4LC, 3, 3, [true, true, true, true]);
412412

413413
#[cfg(test)]
414414
mod test {
415-
use crate::bn254::fp254impl::Fp254Impl;
415+
use crate::{bn254::fp254impl::Fp254Impl, ExecuteInfo};
416416
use crate::bn254::fq::Fq;
417417
use crate::treepp::*;
418-
use crate::chunker::common::extract_witness_from_stack;
419418
use ark_ff::Field;
420419
use ark_std::UniformRand;
421420
use ark_ff::AdditiveGroup;
@@ -426,6 +425,13 @@ mod test {
426425
use rand_chacha::ChaCha20Rng;
427426
use super::*;
428427

428+
fn extract_witness_from_stack(res: ExecuteInfo) -> Vec<Vec<u8>> {
429+
res.final_stack.0.iter_str().fold(vec![], |mut vector, x| {
430+
vector.push(x);
431+
vector
432+
})
433+
}
434+
429435
#[test]
430436
fn test_read_from_stack() {
431437
let _m = BigUint::from_str_radix(Fq::MODULUS, 16).unwrap();

bitvm/src/bn254/g1.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,7 @@ mod test {
946946
use crate::bn254::fq::Fq;
947947
use crate::bn254::fr::Fr;
948948

949-
use crate::chunker::common::extract_witness_from_stack;
950-
use crate::{execute_script_without_stack_limit, treepp::*};
949+
use crate::{execute_script_without_stack_limit, treepp::*, ExecuteInfo};
951950
use super::*;
952951
use ark_ec::CurveGroup;
953952
use ark_ff::Field;
@@ -957,6 +956,13 @@ mod test {
957956
use rand::SeedableRng;
958957
use rand_chacha::ChaCha20Rng;
959958

959+
fn extract_witness_from_stack(res: ExecuteInfo) -> Vec<Vec<u8>> {
960+
res.final_stack.0.iter_str().fold(vec![], |mut vector, x| {
961+
vector.push(x);
962+
vector
963+
})
964+
}
965+
960966
#[test]
961967
fn test_read_from_stack() {
962968
let mut prng = ChaCha20Rng::seed_from_u64(0);

bitvm/src/bn254/g2.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,15 +763,21 @@ mod test {
763763
use crate::bn254::g2::G2Affine;
764764
use crate::bn254::fq::Fq;
765765
use crate::bn254::fq2::Fq2;
766-
use crate::chunker::common::extract_witness_from_stack;
767-
use crate::treepp::*;
766+
use crate::{treepp::*, ExecuteInfo};
768767
use super::*;
769768
use ark_std::UniformRand;
770769
use rand::SeedableRng;
771770
use rand_chacha::ChaCha20Rng;
772771
use ark_ff::AdditiveGroup;
773772
use num_traits::One;
774773

774+
fn extract_witness_from_stack(res: ExecuteInfo) -> Vec<Vec<u8>> {
775+
res.final_stack.0.iter_str().fold(vec![], |mut vector, x| {
776+
vector.push(x);
777+
vector
778+
})
779+
}
780+
775781
#[test]
776782
fn test_read_from_stack() {
777783
let mut prng = ChaCha20Rng::seed_from_u64(0);

0 commit comments

Comments
 (0)