Skip to content

Commit a8ffc66

Browse files
OsamaAlkhodairyjonathanpwangyi-sun
authored
Chore: adding test utils crate (#23)
* wip: refactor to use commit pointers * wip: permutation trace from partitioned main * wip: fix previous rebase * wip * wip: show new interface * chore: rename ChipsetProver to MultiTraceStarkProver * test: added ListChip and a test involving RangeCheckerChip and ListChip * chore: changed to using determinstic seed * feat: quotient refactor done * feat: prover done * chore: split out prove function into general post-trace part * feat: finished verifier * feat: keygen builder * chore: move fib triple test into same file * test: testing thread safety and other improvements * test: testing thread safety and other improvements * test: generating traces in parallel * feat: preliminary docs on STARK backend scope/support (#16) * feat: add backend readme * fix: link * fix: link * fix: latex * chore: fix typo * chore: add code references --------- Co-authored-by: Yi Sun <yi-sun@users.noreply.github.com> * chore: make DebugBuilder `after_challenge` consistent with other builders * chore: clean up if statement * test: testing RangeCheckerChip * chore: fix fmt * chore: fix previous merge and remove tracing No need for tracing on non-benchmark tests * chore: fix lint * fix: `eval_permutation_constraints` must handle partitioned_main * feat: integration test with cached trace * fix: forgot to add test files * chore: rename folder to `partitioned_sum_air` * chore: add test utils module * feat: added XorChip * chore: small fix * feat: add indexless cached lookup test for partitioned Air with interactions * feat: Partitioned Air Builder (#17) * fix: `eval_permutation_constraints` must handle partitioned_main * feat: integration test with cached trace * fix: forgot to add test files * chore: rename folder to `partitioned_sum_air` * chore: add test utils module * feat: add indexless cached lookup test for partitioned Air with interactions * chore: fix typo * feat: `add_main_matrix(width)` placeholder with mat width * chore: switch from RefCell to Arc Mutex * feat: added relative indexing and some documentation * wip * chore: simplifying trace.rs * chore: rename crates `afs-stark-backend, afs-derive` - `afs-middleware` -> `afs-stark-backend` - `afs-middleware-derive` -> `afs-derive` Imports can be handled by global find/replace. * chore: fix github workflow * chore: fix workflow name * chore: set up concurrency for workflow * chore: added test-utils crate * chore: removing the xor chip * wip * chore: moving the tests to a tests/ directory in test-utils crate * chore: fixing imports and moving cached_lookup to stark-backend --------- Co-authored-by: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Co-authored-by: Yi Sun <yi-sun@users.noreply.github.com>
1 parent 32934e2 commit a8ffc66

File tree

14 files changed

+212
-106
lines changed

14 files changed

+212
-106
lines changed

Cargo.lock

Lines changed: 48 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chips/tests/integration_test.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
use std::{iter, sync::Arc};
2+
3+
use rand::{rngs::StdRng, SeedableRng};
4+
5+
use afs_chips::range;
16
use afs_stark_backend::{
27
keygen::MultiStarkKeygenBuilder,
38
prover::{trace::TraceCommitmentBuilder, types::ProverRap, MultiTraceStarkProver},
@@ -8,14 +13,8 @@ use p3_matrix::dense::DenseMatrix;
813
use p3_maybe_rayon::prelude::IntoParallelRefIterator;
914
use p3_uni_stark::StarkGenericConfig;
1015

11-
use std::{iter, sync::Arc};
12-
13-
use afs_chips::range;
14-
mod list;
15-
1616
mod config;
17-
18-
use rand::{rngs::StdRng, SeedableRng};
17+
mod list;
1918

2019
#[test]
2120
fn test_list_range_checker() {

chips/tests/list/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<const MAX: u32> ListChip<MAX> {
3333
self.bus_index
3434
}
3535

36-
pub fn vals(&self) -> &Vec<u32> {
36+
pub fn vals(&self) -> &[u32] {
3737
&self.vals
3838
}
3939
}

stark-backend/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ derivative = "2.2.0"
2727
rand = "0.8.5"
2828
tracing-subscriber = { version = "0.3.17", features = ["std", "env-filter"] }
2929
tracing-forest = { version = "0.1.6", features = ["ansi", "smallvec"] }
30+
afs-test-utils = { path = "../test-utils"}
3031

3132
p3-dft = { workspace = true }
3233
p3-merkle-tree = { workspace = true }

stark-backend/tests/cached_lookup/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ use p3_field::AbstractField;
1010
use p3_matrix::dense::RowMajorMatrix;
1111
use p3_util::log2_ceil_usize;
1212

13-
use crate::{config, interaction::dummy_interaction_air::DummyInteractionAir};
13+
use crate::config;
14+
use afs_test_utils::interaction::dummy_interaction_air::DummyInteractionAir;
1415

1516
type Val = BabyBear;
1617

1718
// Lookup table is cached, everything else (including counts) is committed together
18-
fn prove_and_verify_indexless_lookups(
19+
pub fn prove_and_verify_indexless_lookups(
1920
sender: Vec<(u32, Vec<u32>)>,
2021
receiver: Vec<(u32, Vec<u32>)>,
2122
) -> Result<(), VerificationError> {
@@ -108,6 +109,7 @@ fn prove_and_verify_indexless_lookups(
108109
)
109110
}
110111

112+
/// tests for cached_lookup
111113
#[test]
112114
fn test_interaction_cached_trace_happy_path() {
113115
// count fields

stark-backend/tests/integration_test.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,22 @@
11
#![feature(trait_upcasting)]
22
#![allow(incomplete_features)]
33

4-
use afs_stark_backend::keygen::types::SymbolicRap;
54
use afs_stark_backend::keygen::MultiStarkKeygenBuilder;
65
use afs_stark_backend::prover::trace::TraceCommitmentBuilder;
7-
use afs_stark_backend::prover::types::ProverRap;
86
use afs_stark_backend::prover::MultiTraceStarkProver;
9-
use afs_stark_backend::verifier::types::VerifierRap;
107
use afs_stark_backend::verifier::MultiTraceStarkVerifier;
8+
/// Test utils
9+
use afs_test_utils::{config, utils};
1110
use p3_baby_bear::BabyBear;
1211
use p3_field::AbstractField;
1312
use p3_uni_stark::StarkGenericConfig;
1413

1514
mod cached_lookup;
16-
mod config;
1715
mod fib_air;
1816
mod fib_selector_air;
1917
mod fib_triples_air;
2018
pub mod interaction;
2119
mod partitioned_sum_air;
22-
/// Test utils
23-
mod utils;
24-
25-
trait ProverVerifierRap<SC: StarkGenericConfig>:
26-
ProverRap<SC> + VerifierRap<SC> + SymbolicRap<SC>
27-
{
28-
}
29-
impl<SC: StarkGenericConfig, RAP: ProverRap<SC> + VerifierRap<SC> + SymbolicRap<SC>>
30-
ProverVerifierRap<SC> for RAP
31-
{
32-
}
3320

3421
#[test]
3522
fn test_single_fib_stark() {

0 commit comments

Comments
 (0)