Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor BaseFold test code #552

Merged
merged 20 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a1f1b9b
Refactor pcs tests by adding some utility functions.
yczhangsjtu Nov 5, 2024
eeec18d
Fix compilation errors.
yczhangsjtu Nov 5, 2024
8206cbc
Temporarily avoid a bug that will be fixed by other changes.
yczhangsjtu Nov 5, 2024
c7cdc59
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 5, 2024
ce8393f
Remove unnecessary cfg(test)
yczhangsjtu Nov 5, 2024
d925cbf
Remove an extra function.
yczhangsjtu Nov 5, 2024
c4d69ff
Cleanup use codes.
yczhangsjtu Nov 5, 2024
a71b2f5
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 5, 2024
a6c6181
Refactor tests in basefold.rs.
yczhangsjtu Nov 6, 2024
b5c7231
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 6, 2024
facbf72
Merge branch 'master' into feat/basefold-refactor-extract-0
yczhangsjtu Nov 7, 2024
19fd0a9
Merge branch 'master' into feat/basefold-refactor-extract-0
yczhangsjtu Nov 7, 2024
59870a9
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 11, 2024
4d4e813
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 11, 2024
55e6f19
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 11, 2024
e9b6d4c
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 11, 2024
81cd3f7
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 12, 2024
a07717b
Merge branch 'master' into feat/basefold-refactor-extract-0
yczhangsjtu Nov 14, 2024
e377a78
Fix according to comments.
yczhangsjtu Nov 28, 2024
980ebc1
Merge remote-tracking branch 'origin/master' into feat/basefold-refac…
yczhangsjtu Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 42 additions & 97 deletions mpcs/src/basefold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,108 +1191,53 @@ mod test {
type PcsGoldilocksBaseCode = Basefold<GoldilocksExt2, BasefoldBasecodeParams>;

#[test]
fn commit_open_verify_goldilocks_basecode_base() {
// Challenge is over extension field, poly over the base field
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(true, 10, 11);
// Test trivial proof with small num vars
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(true, 4, 6);
}

#[test]
fn commit_open_verify_goldilocks_rscode_base() {
// Challenge is over extension field, poly over the base field
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(true, 10, 11);
// Test trivial proof with small num vars
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(true, 4, 6);
}

#[test]
fn commit_open_verify_goldilocks_basecode_2() {
// Both challenge and poly are over extension field
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(false, 10, 11);
// Test trivial proof with small num vars
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(false, 4, 6);
}

#[test]
fn commit_open_verify_goldilocks_rscode_2() {
// Both challenge and poly are over extension field
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(false, 10, 11);
// Test trivial proof with small num vars
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(false, 4, 6);
}

#[test]
fn simple_batch_commit_open_verify_goldilocks_basecode_base() {
// Both challenge and poly are over base field
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
true, 10, 11, 1,
);
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
true, 10, 11, 4,
);
// Test trivial proof with small num vars
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(true, 4, 6, 4);
}

#[test]
fn simple_batch_commit_open_verify_goldilocks_rscode_base() {
// Both challenge and poly are over base field
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(true, 10, 11, 1);
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(true, 10, 11, 4);
// Test trivial proof with small num vars
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(true, 4, 6, 4);
}

#[test]
fn simple_batch_commit_open_verify_goldilocks_basecode_2() {
// Both challenge and poly are over extension field
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
false, 10, 11, 1,
);
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
false, 10, 11, 4,
);
// Test trivial proof with small num vars
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
false, 4, 6, 4,
);
}

#[test]
fn simple_batch_commit_open_verify_goldilocks_rscode_2() {
// Both challenge and poly are over extension field
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(
false, 10, 11, 1,
);
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(
false, 10, 11, 4,
);
// Test trivial proof with small num vars
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(false, 4, 6, 4);
}

#[test]
fn batch_commit_open_verify_goldilocks_basecode_base() {
// Both challenge and poly are over base field
run_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(true, 10, 11);
}

#[test]
fn batch_commit_open_verify_goldilocks_rscode_base() {
// Both challenge and poly are over base field
run_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(true, 10, 11);
fn commit_open_verify_goldilocks() {
for base in [true, false].into_iter() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small cosmetic suggestion:

Suggested change
for base in [true, false].into_iter() {
for base in [true, false] {

(Similar for the other loops, too.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yczhangsjtu good suggestion to pick

// Challenge is over extension field, poly over the base field
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(base, 10, 11);
// Test trivial proof with small num vars
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(base, 4, 6);
// Challenge is over extension field, poly over the base field
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(base, 10, 11);
// Test trivial proof with small num vars
run_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(base, 4, 6);
}
}

#[test]
fn batch_commit_open_verify_goldilocks_basecode_2() {
// Both challenge and poly are over extension field
run_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(false, 10, 11);
fn simple_batch_commit_open_verify_goldilocks() {
for base in [true, false].into_iter() {
// Both challenge and poly are over base field
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
base, 10, 11, 1,
);
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
base, 10, 11, 4,
);
// Test trivial proof with small num vars
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(
base, 4, 6, 4,
);
// Both challenge and poly are over base field
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(
base, 10, 11, 1,
);
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(
base, 10, 11, 4,
);
// Test trivial proof with small num vars
run_simple_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(
base, 4, 6, 4,
);
}
}

#[test]
fn batch_commit_open_verify_goldilocks_rscode_2() {
// Both challenge and poly are over extension field
run_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(false, 10, 11);
fn batch_commit_open_verify() {
for base in [true, false].iter() {
// Both challenge and poly are over base field
run_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksBaseCode>(*base, 10, 11);
run_batch_commit_open_verify::<GoldilocksExt2, PcsGoldilocksRSCode>(*base, 10, 11);
}
}
}
Loading
Loading