diff --git a/Cargo.lock b/Cargo.lock index 9316238..ed31b82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -134,8 +134,8 @@ dependencies = [ [[package]] name = "p3-air" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "p3-field", "p3-matrix", @@ -143,11 +143,12 @@ dependencies = [ [[package]] name = "p3-challenger" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "p3-field", "p3-maybe-rayon", + "p3-monty-31", "p3-symmetric", "p3-util", "tracing", @@ -155,8 +156,8 @@ dependencies = [ [[package]] name = "p3-commit" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "itertools", "p3-challenger", @@ -169,8 +170,8 @@ dependencies = [ [[package]] name = "p3-dft" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "itertools", "p3-field", @@ -183,8 +184,8 @@ dependencies = [ [[package]] name = "p3-field" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "itertools", "num-bigint", @@ -198,8 +199,8 @@ dependencies = [ [[package]] name = "p3-fri" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "itertools", "p3-challenger", @@ -212,15 +213,17 @@ dependencies = [ "p3-util", "rand", "serde", + "thiserror", "tracing", ] [[package]] name = "p3-goldilocks" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "num-bigint", + "p3-challenger", "p3-dft", "p3-field", "p3-mds", @@ -234,8 +237,8 @@ dependencies = [ [[package]] name = "p3-interpolation" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "p3-field", "p3-matrix", @@ -245,8 +248,8 @@ dependencies = [ [[package]] name = "p3-keccak" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "p3-field", "p3-symmetric", @@ -256,8 +259,8 @@ dependencies = [ [[package]] name = "p3-matrix" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "itertools", "p3-field", @@ -271,16 +274,16 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "rayon", ] [[package]] name = "p3-mds" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "p3-dft", "p3-field", @@ -291,8 +294,8 @@ dependencies = [ [[package]] name = "p3-merkle-tree" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "itertools", "p3-commit", @@ -303,13 +306,37 @@ dependencies = [ "p3-util", "rand", "serde", + "thiserror", + "tracing", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin", "tracing", + "transpose", ] [[package]] name = "p3-poseidon2" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "p3-field", "p3-mds", @@ -320,8 +347,8 @@ dependencies = [ [[package]] name = "p3-symmetric" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "itertools", "p3-field", @@ -330,8 +357,8 @@ dependencies = [ [[package]] name = "p3-util" -version = "0.3.0" -source = "git+https://github.com/Plonky3/Plonky3?rev=658115aae28312e97cd3ef38d1ab046839f734a8#658115aae28312e97cd3ef38d1ab046839f734a8" +version = "0.4.2" +source = "git+https://github.com/Plonky3/Plonky3?rev=0835481398d2b481bef0c6d0e8188b484ab9a636#0835481398d2b481bef0c6d0e8188b484ab9a636" dependencies = [ "serde", ] @@ -350,18 +377,18 @@ checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -454,15 +481,35 @@ checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -474,9 +521,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -485,9 +532,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -496,9 +543,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" [[package]] name = "transpose" @@ -512,9 +559,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unty" diff --git a/Cargo.toml b/Cargo.toml index 6938de5..793fc08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,19 +11,19 @@ rust-version = "1.88" [dependencies] serde = { version = "1", features = ["derive"] } bincode = { version = "2", features = ["serde"] } -p3-air = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-goldilocks = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-challenger = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-commit = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-dft = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-field = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-fri = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-keccak = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-matrix = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-symmetric = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } -p3-util = { git = "https://github.com/Plonky3/Plonky3", rev = "658115aae28312e97cd3ef38d1ab046839f734a8" } +p3-air = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-goldilocks = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-challenger = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-commit = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-dft = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-field = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-fri = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-keccak = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-matrix = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-symmetric = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } +p3-util = { git = "https://github.com/Plonky3/Plonky3", rev = "0835481398d2b481bef0c6d0e8188b484ab9a636" } [features] parallel = ["p3-maybe-rayon/parallel"] diff --git a/src/chips/blake3_circuit.rs b/src/chips/blake3_circuit.rs index cfb4b24..fbc0d46 100644 --- a/src/chips/blake3_circuit.rs +++ b/src/chips/blake3_circuit.rs @@ -1990,7 +1990,8 @@ mod tests { let fri_parameters = FriParameters { log_final_poly_len: 0, num_queries: 64, - proof_of_work_bits: 0, + commit_proof_of_work_bits: 0, + query_proof_of_work_bits: 0, }; let proof = @@ -2160,7 +2161,8 @@ mod tests { let fri_parameters = FriParameters { log_final_poly_len: 0, num_queries: 64, - proof_of_work_bits: 0, + commit_proof_of_work_bits: 0, + query_proof_of_work_bits: 0, }; let proof = diff --git a/src/chips/byte_operations.rs b/src/chips/byte_operations.rs index 64eeeb0..cd0daeb 100644 --- a/src/chips/byte_operations.rs +++ b/src/chips/byte_operations.rs @@ -145,7 +145,8 @@ mod tests { let fri_parameters = FriParameters { log_final_poly_len: 0, num_queries: 64, - proof_of_work_bits: 0, + commit_proof_of_work_bits: 0, + query_proof_of_work_bits: 0, }; let proof = system.prove_multiple_claims(fri_parameters, &key, claims, witness); system diff --git a/src/chips/u32_add.rs b/src/chips/u32_add.rs index ecd24d8..a72dfc0 100644 --- a/src/chips/u32_add.rs +++ b/src/chips/u32_add.rs @@ -198,7 +198,8 @@ mod tests { let fri_parameters = FriParameters { log_final_poly_len: 0, num_queries: 64, - proof_of_work_bits: 0, + commit_proof_of_work_bits: 0, + query_proof_of_work_bits: 0, }; let proof = system.prove_multiple_claims(fri_parameters, &key, claims, witness); system diff --git a/src/lookup.rs b/src/lookup.rs index cd73ffa..fecd998 100644 --- a/src/lookup.rs +++ b/src/lookup.rs @@ -424,7 +424,8 @@ mod tests { let fri_parameters = FriParameters { log_final_poly_len: 0, num_queries: 64, - proof_of_work_bits: 0, + commit_proof_of_work_bits: 0, + query_proof_of_work_bits: 0, }; let proof = system.prove(fri_parameters, &key, claim, witness); system.verify(fri_parameters, claim, &proof).unwrap(); diff --git a/src/types.rs b/src/types.rs index 274d85d..a15926c 100644 --- a/src/types.rs +++ b/src/types.rs @@ -65,7 +65,8 @@ impl Committer { let dummy_parameters = FriParameters { log_final_poly_len: 0, num_queries: 0, - proof_of_work_bits: 0, + commit_proof_of_work_bits: 0, + query_proof_of_work_bits: 0, }; let pcs = new_pcs(commitment_parameters, dummy_parameters); Self { pcs } @@ -92,7 +93,10 @@ pub struct CommitmentParameters { pub struct FriParameters { pub log_final_poly_len: usize, pub num_queries: usize, - pub proof_of_work_bits: usize, + /// Number of bits for the PoW phase before sampling _each_ batching challenge. + pub commit_proof_of_work_bits: usize, + /// Number of bits for the PoW phase before sampling the queries. + pub query_proof_of_work_bits: usize, } type KeccakCompressionFunction = @@ -113,7 +117,8 @@ fn new_pcs(commitment_parameters: CommitmentParameters, fri_parameters: FriParam log_blowup: commitment_parameters.log_blowup, log_final_poly_len: fri_parameters.log_final_poly_len, num_queries: fri_parameters.num_queries, - proof_of_work_bits: fri_parameters.proof_of_work_bits, + commit_proof_of_work_bits: fri_parameters.commit_proof_of_work_bits, + query_proof_of_work_bits: fri_parameters.query_proof_of_work_bits, mmcs, }; let dft = Dft::default(); diff --git a/src/verifier.rs b/src/verifier.rs index d1e25aa..ef63a21 100644 --- a/src/verifier.rs +++ b/src/verifier.rs @@ -491,7 +491,8 @@ mod tests { let fri_parameters = FriParameters { log_final_poly_len: 0, num_queries: 64, - proof_of_work_bits: 0, + commit_proof_of_work_bits: 0, + query_proof_of_work_bits: 0, }; let no_claims = &[]; let proof = system.prove_multiple_claims(fri_parameters, &key, no_claims, witness); @@ -525,7 +526,8 @@ mod tests { let fri_parameters = FriParameters { log_final_poly_len: 0, num_queries: 100, - proof_of_work_bits: 20, + commit_proof_of_work_bits: 10, + query_proof_of_work_bits: 10, }; let no_claims = &[]; let proof = benchmark!(