diff --git a/Cargo.lock b/Cargo.lock index 04075ef..5cb6026 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -743,15 +743,6 @@ dependencies = [ "rayon-core", ] -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array 0.14.7", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -780,7 +771,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ - "sha2 0.10.8", + "sha2", "tinyvec", ] @@ -967,7 +958,7 @@ dependencies = [ "hmac", "k256", "serde", - "sha2 0.10.8", + "sha2", "thiserror", ] @@ -983,7 +974,7 @@ dependencies = [ "once_cell", "pbkdf2 0.12.2", "rand", - "sha2 0.10.8", + "sha2", "thiserror", ] @@ -1002,7 +993,7 @@ dependencies = [ "ripemd", "serde", "serde_derive", - "sha2 0.10.8", + "sha2", "sha3", "thiserror", ] @@ -1363,7 +1354,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "const-oid", "crypto-common", "subtle", @@ -1545,7 +1536,7 @@ dependencies = [ "scrypt", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "sha3", "thiserror", "uuid", @@ -1788,7 +1779,7 @@ dependencies = [ "eth-keystore", "ethers-core", "rand", - "sha2 0.10.8", + "sha2", "thiserror", "tracing", ] @@ -2668,7 +2659,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.8", + "sha2", "signature", ] @@ -3090,12 +3081,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e296cf87e61c9cfc1a61c3c63a0f7f286ed4554e0e22be84e8a38e1d264a2a29" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "open-fastrlp" version = "0.1.4" @@ -3928,7 +3913,7 @@ name = "raffle-lib" version = "0.0.1" dependencies = [ "alloy-sol-types 0.8.3", - "sha2 0.9.9", + "sha2", "sp1-zkvm", ] @@ -4472,7 +4457,7 @@ dependencies = [ "hmac", "pbkdf2 0.11.0", "salsa20", - "sha2 0.10.8", + "sha2", ] [[package]] @@ -4675,19 +4660,6 @@ dependencies = [ "syn 2.0.77", ] -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.10.8" @@ -5197,7 +5169,7 @@ dependencies = [ "rand", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "sp1-core-machine", "sp1-recursion-compiler", "sp1-stark", @@ -5267,7 +5239,7 @@ dependencies = [ "reqwest-middleware", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "sp1-core-executor", "sp1-core-machine", "sp1-prover", @@ -5329,7 +5301,7 @@ dependencies = [ "once_cell", "rand", "serde", - "sha2 0.10.8", + "sha2", "sp1-lib", ] @@ -6535,7 +6507,7 @@ dependencies = [ "pasta_curves 0.5.1", "rand", "serde", - "sha2 0.10.8", + "sha2", "sha3", "subtle", ] diff --git a/README.md b/README.md index 0d2552b..675da8f 100644 --- a/README.md +++ b/README.md @@ -92,3 +92,9 @@ command: ```sh SP1_PROVER=network SP1_PRIVATE_KEY=... cargo run --release --bin evm ``` + +# TODO + +- prover network cost? +- lightest hash algorithm? +- use case improvements? diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 91035e8..a5690ec 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -10,7 +10,13 @@ path = "src/raffle.rs" [dependencies] alloy-sol-types = { workspace = true } sp1-zkvm = { workspace = true } -sha2-v0-9-8 = { version = "0.9.8", package = "sha2" } +# sha2-v0-9-8 = { version = "0.9.8", package = "sha2" } +sha2-v0-10-8 = { version = "0.10.8", package = "sha2" } +# sha3-v0-10-8 = { version = "0.10.8", package = "sha3" } +# tiny-keccak = { version = "2.0", features = ["sha3"] } [patch.crates-io] -sha2-v0-9-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.9.8" } +# sha2-v0-9-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.9.8" } +sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.10.8" } +# sha3-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", branch = "patch-sha3-v0.10.8" } +# tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", branch = "patch-v2.0.2" } diff --git a/lib/src/raffle.rs b/lib/src/raffle.rs index 8405379..6fc7664 100644 --- a/lib/src/raffle.rs +++ b/lib/src/raffle.rs @@ -1,4 +1,7 @@ -use sha2_v0_9_8::{Digest as Digest_9_8, Sha256 as Sha256_9_8}; +// use sha2_v0_9_8::{Digest as Digest_sha2_9_8, Sha256 as Sha256_9_8}; +use sha2_v0_10_8::{Digest as Digest_sha2_10_8, Sha256 as Sha256_10_8}; +// use sha3_v0_10_8::{Digest as Digest_sha3_10_8, Keccak256 as Keccak256_10_8}; +// use tiny_keccak::{Hasher, Keccak as Tiny_Keccak}; /// Naive raffle implementation pub fn raffle_naive(num_participants: u32, num_winners: u32, random_seed: u64) -> Vec { @@ -7,15 +10,12 @@ pub fn raffle_naive(num_participants: u32, num_winners: u32, random_seed: u64) - let n = num_participants; let m = num_winners; - for _ in 0..m { + while winners.len() < m as usize { let new_winner = (seed % n as u64) as u32; - if winners.contains(&new_winner) { - seed = hash(seed, new_winner as u64); - continue; - } else { + if !winners.contains(&new_winner) { winners.push(new_winner); - seed = hash(seed, new_winner as u64); } + seed = hash_sha2(seed, new_winner as u64); } winners @@ -27,8 +27,8 @@ pub fn raffle_fisher_yates(num_participants: u32, num_winners: u32, random_seed: let mut seed = random_seed; for i in (1..num_participants).rev() { - seed = hash(seed, i as u64); - let j = (seed % (i + 1) as u64) as usize; + seed = hash_sha2(seed, i as u64); + let j: usize = (seed % (i + 1) as u64) as usize; participants.swap(i as usize, j); } @@ -38,10 +38,27 @@ pub fn raffle_fisher_yates(num_participants: u32, num_winners: u32, random_seed: .collect() } -fn hash(seed: u64, value: u64) -> u64 { - let mut sha256 = Sha256_9_8::new(); +fn hash_sha2(seed: u64, value: u64) -> u64 { + let mut sha256: Sha256_10_8 = Sha256_10_8::new(); sha256.update(seed.to_le_bytes()); sha256.update(value.to_le_bytes()); let result = sha256.finalize(); u64::from_le_bytes(result[..8].try_into().unwrap()) } + +// fn hash_sha3(seed: u64, value: u64) -> u64 { +// let mut keccak256: Keccak256_10_8 = Keccak256_10_8::new(); +// keccak256.update(seed.to_le_bytes()); +// keccak256.update(value.to_le_bytes()); +// let result = keccak256.finalize(); +// u64::from_le_bytes(result[..8].try_into().unwrap()) +// } + +// fn hash_tiny_keccak(seed: u64, value: u64) -> u64 { +// let mut keccak = Tiny_Keccak::v256(); +// keccak.update(&seed.to_le_bytes()); +// keccak.update(&value.to_le_bytes()); +// let mut output = [0u8; 32]; +// keccak.finalize(&mut output); +// u64::from_le_bytes(output[..8].try_into().unwrap()) +// } diff --git a/programs/per-raffle-proof/README.md b/programs/per-raffle-proof/README.md index 7629837..da5d88f 100644 --- a/programs/per-raffle-proof/README.md +++ b/programs/per-raffle-proof/README.md @@ -13,34 +13,24 @@ cargo run --release -- --execute --num-participants 1000 --num-winners 10 Data below assumes random seed of `12345` -| Participants | Winners | Cycle Count | Merkle Root | Groth16 Proof Time | Groth16 Prover Network URL | -| ------------ | ------- | ----------- | ------------------------------------------------------------------ | ------------------ | --------------------------------------------------------------------- | -| 100 | 10 | 51228 | 0xced48ce2a54393639311900331de7fa22ee1a0ed8410119aa3ee6c17733aeb75 | 2m43s | https://explorer.succinct.xyz/proofrequest_01j8egy82degrts5fay3cn81wq | -| 1000 | 10 | 51228 | 0xbf449f1db6ee091b380b110ef54ff7112835222d91753c2ec8998971a2fd6c53 | | | -| 1000 | 100 | 389721 | 0xcf8d690ca84b2bae826470057e3b7585e5d3530f019e78c7fc6f262cf6869a73 | | | -| 10000 | 10 | 51228 | 0x06444ad88114b90ab4db3019d37c2955bbde6e15630d06e43074b346862cdac6 | | | -| 10000 | 100 | 395997 | 0x9971ec5531a3fad1e9c38c6a77a54d24bf6cafe950928608f8304e3a7fe0aa1c | | | -| 100000 | 10 | 52741 | 0x5d39e729f2250f4ef96561c7afbcd1bc0d03264bc634b5a9c52b07a6bddaf42d | | | -| 100000 | 100 | 420673 | 0x76fe23ca034289be494fcccb15a4f91af2233150fc27b198b5ffa8d6aef26224 | | | -| 10000000 | 10 | 53418 | 0xb72907e34b589edee7cdb4236efe59f2367d527a2bbb7c06104100fe02f1c0fc | | | -| 10000000 | 100 | 420673 | 0x76fe23ca034289be494fcccb15a4f91af2233150fc27b198b5ffa8d6aef26224 | 2m46s | https://explorer.succinct.xyz/proofrequest_01j8eh6905egrr635fymhr2ah7 | -| 10000000 | 1000 | 6290600 | 0x62383a7facecc690676ae8f078d164a26f8c75c1f58d66eae2602740d500345d | 3m6s | https://explorer.succinct.xyz/proofrequest_01j8ema4nvegtt76dqvk0s7brp | -| 10000000 | 10000 | 287693424 | 0xa72920a1add9f3cdf91682d2fe3fa2a09011ed4ea0975f09c621bf3204dff789 | 6m22s | https://explorer.succinct.xyz/proofrequest_01j8en6ngbegtvz4qvw4jvmvcy | - -## Logs - -100 participants, 10 winners(Groth16) - -``` -Verification Key: 0x007502a17bd054ca2d7bfdd7a0a9a7066b41d142eb76c6c2b296880305f8c7c4 -Public Values: 0x0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000003039ced48ce2a54393639311900331de7fa22ee1a0ed8410119aa3ee6c17733aeb75 -Proof Bytes: 0x6a2906ac092b7e497bcb047ad6e008a2f2b78e77b9a2732f282e897645fa339e29cae7750fc6ed66350f1ed84402ed0ed2a3c7104b896c44dcb93e6897eee6ae42f5f5572ad3ada13877fc89e0275d292c2a176d594220db67e075f6f851a34f50d96dbb16e6a7488579d42bbe8b88badb8a1e2a0bc7194e2f241540bb238928b62195ae2196b9a19d4a4279a8581ebf7a4706dbae9f69b941eab1e62d463f503981d8252022f9d4eee756e6fc1530d2cc1b097d0c715e325ca6e06a9723ca607c6ecbca15aff32d40288ddbdaf08141f76b795584d0dabffa6d563a807da42c951452992ac8cc2676a41c1afcfec6d95f0ec12d378581bff41f802335f6a8e6911cd0a0 -``` - -10000000 participants, 1000 winners Groth16) - -``` -Verification Key: 0x007502a17bd054ca2d7bfdd7a0a9a7066b41d142eb76c6c2b296880305f8c7c4 -Public Values: 0x000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000303962383a7facecc690676ae8f078d164a26f8c75c1f58d66eae2602740d500345d -Proof Bytes: 0x6a2906ac2bdc11c34385d676b280cbaa646d584c2f65f88341b11405e12fb18a750db8aa0e2d0a73536b05d5a67fbac543df23ff862d1e61f8c4bb49acc2aa9ad5b4edee1ed8af0233d985f535aa9518f533d1a9ab06f1e1680fd12e567d495ea546c0fd0a67b50e220ec2c9576666b69084f1853c6ec0d64eda22e76a30a2cd111eb12e06dcc8dd1fc8cd8f533bb35092d0f59591c54e4ef100919b6e53bd824473b56f0f63cc18213c64404a224cf4b98f320e286ce024b9db9dc7dce3648fb04ced733056bcd3e70ed46e9417853fc41ff6e45be5a48d5ecb374e57eba8994b54926103846766c514836ac41b58d4dba5ae591e4ec8a6436c4e7c5ac536a5b80e998f -``` +| Participants | Winners | Cycle Count (sha2-v0-9-8) | Merkle Root | Groth16 Proof Time | Groth16 Prover Network URL | +| ------------ | ------- | ------------------------- | ------------------------------------------------------------------ | -------------------- | --------------------------------------------------------------------- | +| 100 | 10 | 51216 | 0xced48ce2a54393639311900331de7fa22ee1a0ed8410119aa3ee6c17733aeb75 | 2 minutes 56 seconds | https://explorer.succinct.xyz/proofrequest_01j8fbfz8ae2cahb2hv4p1dbdk | +| 1000 | 10 | 51216 | 0xbf449f1db6ee091b380b110ef54ff7112835222d91753c2ec8998971a2fd6c53 | | | +| 1000 | 100 | 399627 | 0x3c78346b865e4b4ae9ac1fdcbc27a00e2d0289626643e235ee0ffbbc943742d3 | | | +| 10000 | 10 | 51216 | 0x06444ad88114b90ab4db3019d37c2955bbde6e15630d06e43074b346862cdac6 | | | +| 10000 | 100 | 399627 | 0x3c78346b865e4b4ae9ac1fdcbc27a00e2d0289626643e235ee0ffbbc943742d3 | | | +| 100000 | 10 | 52741 | 0x5d39e729f2250f4ef96561c7afbcd1bc0d03264bc634b5a9c52b07a6bddaf42d | | | +| 100000 | 100 | 395895 | 0x9971ec5531a3fad1e9c38c6a77a54d24bf6cafe950928608f8304e3a7fe0aa1c | | | +| 10000000 | 10 | 53418 | 0xb72907e34b589edee7cdb4236efe59f2367d527a2bbb7c06104100fe02f1c0fc | | | +| 10000000 | 100 | 420571 | 0x76fe23ca034289be494fcccb15a4f91af2233150fc27b198b5ffa8d6aef26224 | 2 minutes 46 seconds | https://explorer.succinct.xyz/proofrequest_01j8fbzpcjfezajrz9xhqfvccx | +| 10000000 | 1000 | 6289598 | 0x62383a7facecc690676ae8f078d164a26f8c75c1f58d66eae2602740d500345d | 3 minutes 13 seconds | https://explorer.succinct.xyz/proofrequest_01j8fc6645e6abb6k7q5266qa7 | +| 10000000 | 10000 | 288003808 | 0x647ee7b3d3e20c516d108670e48250d7fc1f76ebdc19fbf6ab86e91d25a63434 | 6 minutes 29 seconds | https://explorer.succinct.xyz/proofrequest_01j8fcd45ce6a930tvqngrqqst | + +### Hash algorithm + +10000000 participants, 1000 winners + +| sha2-v0-9-8 (sha256) | sha2-v0-10-8 (sha256) | sha3-v0-10-8 (keccak256) | tiny-keccak (keccak256) | +| -------------------- | --------------------- | ------------------------ | ----------------------- | +| 6289598 | 9709598 | 22346206 | 22566445 | diff --git a/programs/per-raffle-proof/contracts/src/fixtures/groth16-fixture.json b/programs/per-raffle-proof/contracts/src/fixtures/groth16-fixture.json index f6de29d..8e1403c 100644 --- a/programs/per-raffle-proof/contracts/src/fixtures/groth16-fixture.json +++ b/programs/per-raffle-proof/contracts/src/fixtures/groth16-fixture.json @@ -3,7 +3,7 @@ "numWinners": 1000, "randomSeed": 12345, "winnersMerkleRoot": "0x62383a7facecc690676ae8f078d164a26f8c75c1f58d66eae2602740d500345d", - "vkey": "0x007502a17bd054ca2d7bfdd7a0a9a7066b41d142eb76c6c2b296880305f8c7c4", + "vkey": "0x00c234cc871c2f30927c9413f45db38b26779fc92395cd767753d378b9f73155", "publicValues": "0x000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000303962383a7facecc690676ae8f078d164a26f8c75c1f58d66eae2602740d500345d", - "proof": "0x6a2906ac2bdc11c34385d676b280cbaa646d584c2f65f88341b11405e12fb18a750db8aa0e2d0a73536b05d5a67fbac543df23ff862d1e61f8c4bb49acc2aa9ad5b4edee1ed8af0233d985f535aa9518f533d1a9ab06f1e1680fd12e567d495ea546c0fd0a67b50e220ec2c9576666b69084f1853c6ec0d64eda22e76a30a2cd111eb12e06dcc8dd1fc8cd8f533bb35092d0f59591c54e4ef100919b6e53bd824473b56f0f63cc18213c64404a224cf4b98f320e286ce024b9db9dc7dce3648fb04ced733056bcd3e70ed46e9417853fc41ff6e45be5a48d5ecb374e57eba8994b54926103846766c514836ac41b58d4dba5ae591e4ec8a6436c4e7c5ac536a5b80e998f" + "proof": "0x6a2906ac0829c608457736242f348577c4be5ca98fa85a43481fa4b691203b9e21eedf84234e37cbf9fa6773b1e507938964aa7d56a291a867dd35d7806c3a37f5f05e2c076c4beeaeab02ff9c2962867c1161101f64c1cd02c6b3d082d4a1e1c96aa7cb1ef9f960e9de8263afb3b8301ea90f831181ee0904f078792ed8ccb0a2629b2407acdb0d21b65b0893551d501adc3c86218996a82110a446277e5d8f504ffac22d0cbb8e78658add65782e72497b55df9cd6d382a175f1912d2d7cf8bf6e3ade0fbd0ddcc2dbfbca89815018c972975042359164e34325269ba1d2a044f85efd2bad94003a84208835d3935b9e6c91c518c90cdc84c3e1e80a3aa9101ead9b1e" } \ No newline at end of file diff --git a/programs/per-raffle-proof/program/Cargo.lock b/programs/per-raffle-proof/program/Cargo.lock index e35f6c8..942586b 100644 --- a/programs/per-raffle-proof/program/Cargo.lock +++ b/programs/per-raffle-proof/program/Cargo.lock @@ -996,7 +996,7 @@ name = "raffle-lib" version = "0.0.1" dependencies = [ "alloy-sol-types", - "sha2 0.9.8", + "sha2 0.10.8", "sp1-zkvm 2.0.0", ] diff --git a/programs/per-raffle-proof/program/elf/riscv32im-succinct-zkvm-elf b/programs/per-raffle-proof/program/elf/riscv32im-succinct-zkvm-elf index 45d17b6..40f20b7 100755 Binary files a/programs/per-raffle-proof/program/elf/riscv32im-succinct-zkvm-elf and b/programs/per-raffle-proof/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/programs/per-user-proof/README.md b/programs/per-user-proof/README.md index 4d0fa26..5c9db99 100644 --- a/programs/per-user-proof/README.md +++ b/programs/per-user-proof/README.md @@ -14,37 +14,18 @@ cargo run --release -- --execute --num-participants 1000 --num-winners 10 Using `raffle_naive`: -| Participants | Winners | Cycle Count | Groth16 Proof Time | Groth16 Prover Network URL | -| ------------ | ------- | ----------- | ------------------ | --------------------------------------------------------------------- | -| 100 | 10 | 62338 | 2m30s | https://explorer.succinct.xyz/proofrequest_01j8eghd0wfpz8yy33ph1qxj15 | -| 1000 | 10 | 62338 | | | -| 1000 | 100 | 512989 | | | -| 10000 | 10 | 62338 | | | -| 10000 | 100 | 513868 | | | -| 100000 | 10 | 63896 | | | -| 100000 | 100 | 530818 | | | -| 100000 | 1000 | 7412270 | | | -| 100000 | 10000 | 284134198 | | | -| 1000000 | 10 | 64246 | | | -| 1000000 | 100 | 534856 | | | -| 1000000 | 1000 | 7463342 | | | -| 1000000 | 10000 | 298288259 | 5m56s | https://explorer.succinct.xyz/proofrequest_01j8emngr4egtsharwzjv3f8fm | - -## Logs - -100 participants, 10 winners (Groth16) - -``` -2024-09-23T04:02:00.006226Z INFO Proof request fulfilled -Verification Key: 0x0045e7d83fdafd41a15012355b47c5e83cf232237dbacb8cc6d63da869e2f5a8 -Public Values: 0x0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000303900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000 -Proof Bytes: 0x6a2906ac1bcf54c145c83d3b3849fc724d07a38035d0ba1e740dd20880ff6e97fe3feafd22e5b2f69a58dd8a3207a7099176711c57b753bb06a42cb28af1b86a9a71ac581cbdcc95f222014da8a7d969838caf760408c3d16c6c70a523831cb1237a14140ad30389e6e089de657e2c6855b590192b719ce20451e88c0cfde64e974253c62903eea65c5119d99d9ee41ca7105c73de472abb80c182943ae99a077a96e5e2116c39c14ccb14710c17c374caa7416627c99daf03e02f67c2028eab897a02ca1758f968d26d6426e8d1ed09d7297e74dca31cfb54ea592e91419e1059e83f4c0700aa813d250b6f2e2bd5b427974fc9e22906727c1967966c38f0125b7df5ec -``` - -1000000 participants, 10000 winners - -``` -Verification Key: 0x0045e7d83fdafd41a15012355b47c5e83cf232237dbacb8cc6d63da869e2f5a8 -Public Values: 0x00000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000303900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000 -Proof Bytes: 0x6a2906ac0dfeea46ba844e22fa44f7edef156c390756272f705fd2c7df5747ba6c347211296ca2cf1540c3878f666aa5ac55481bb2a07f2b3b483dbf38079b23f11a63d90440863829090e0d0a76fe6039a1d63e321ef57677279001c256c9212479bb960e17dd625c798b58c73d80245d5acdbcd864f35c10029ef19f781c693c56448d074896dddc64961d04d155b7daecb01ffcd401c659da812e7f910a468e2f72f62b93abc6e80a6c74f9e02c0a5b170985b40c1924b41756e7c8e1b3fa233d17762e00175aecae51d17333016146806b6e -``` +| Participants | Winners | Cycle Count | Groth16 Proof Time | Groth16 Prover Network URL | +| ------------ | ------- | ----------- | -------------------- | --------------------------------------------------------------------- | +| 100 | 10 | 62326 | 2 minutes 38 seconds | https://explorer.succinct.xyz/proofrequest_01j8fd3288e4br5bkk8wfv8qad | +| 1000 | 10 | 62326 | | | +| 1000 | 100 | 528562 | | | +| 10000 | 10 | 62326 | | | +| 10000 | 100 | 513766 | | | +| 100000 | 10 | 63884 | | | +| 100000 | 100 | 530716 | | | +| 100000 | 1000 | 7440941 | | | +| 100000 | 10000 | 310329795 | | | +| 1000000 | 10 | 64234 | | | +| 1000000 | 100 | 534754 | | | +| 1000000 | 1000 | 7462340 | | | +| 1000000 | 10000 | 300019549 | 5 minutes 59 seconds | https://explorer.succinct.xyz/proofrequest_01j8fde317e4btefd5q0bcdbq0 | diff --git a/programs/per-user-proof/contracts/src/fixtures/groth16-fixture.json b/programs/per-user-proof/contracts/src/fixtures/groth16-fixture.json index 7fe07ae..1bdaf6e 100644 --- a/programs/per-user-proof/contracts/src/fixtures/groth16-fixture.json +++ b/programs/per-user-proof/contracts/src/fixtures/groth16-fixture.json @@ -1,10 +1,10 @@ { - "numParticipants": 1000000, + "numParticipants": 10000000, "numWinners": 10000, "randomSeed": 12345, "participationId": 1, "isWinner": false, - "vkey": "0x0045e7d83fdafd41a15012355b47c5e83cf232237dbacb8cc6d63da869e2f5a8", - "publicValues": "0x00000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000303900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", - "proof": "0x6a2906ac0dfeea46ba844e22fa44f7edef156c390756272f705fd2c7df5747ba6c347211296ca2cf1540c3878f666aa5ac55481bb2a07f2b3b483dbf38079b23f11a63d90440863829090e0d0a76fe6039a1d63e321ef57677279001c256c9212479bb960e17dd625c798b58c73d80245d5acdbcd864f35c10029ef19f781c693c56448d074896dddc64961d04d155b7daecb01ffcd401c659da812e7f910a468e2f72f62b93abc6e80a6c74f9e02c0a5b170985b40c1924b41756e7c8e1b3fa233d17762e00175aecae51d17333016146806b6ee40bc336d5c139095cdffb64ba147e882ce30935531deddd897543f02340b0b0c560598237f9491e96bf55b78c76a49e" + "vkey": "0x0032c45879bb8619b30d1acbfbc57800726823441b6ff7724b04167662a184dc", + "publicValues": "0x00000000000000000000000000000000000000000000000000000000009896800000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000303900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", + "proof": "0x6a2906ac01c35c3f53caf96d1b26ca3090fc8333c9c5e5735c6eb8457f54a8e52f4a4f070fd3a84ea6194b16b2a51d95912d38c166b810111c5d8e7c96272ec79ce7b62802981f8b2e00ea991bc3e46a438917b03fd26583126fa6eb9b26050a74fa57c82a4ea14bd74425759ffbe29d88f2c79a6591c58b12b49caea78ea975e04d296905aba8ffd1949e5cc610d54e47db83c0354dcccfc927167347fbd47072397fec14bb129dbe0762762214c39072026d25572909ff77ddc1788872749897c31e8914c90b331cc5242e7676c20d27e4ebab6069583df7a2b1846cc0e3a1199791661946408a783a4b68802b3e3802ce98278182eb7419f2216e6f620fb78d077763" } \ No newline at end of file diff --git a/programs/per-user-proof/program/Cargo.lock b/programs/per-user-proof/program/Cargo.lock index 0c697e0..f4affcb 100644 --- a/programs/per-user-proof/program/Cargo.lock +++ b/programs/per-user-proof/program/Cargo.lock @@ -323,15 +323,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -501,7 +492,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "const-oid", "crypto-common", "subtle", @@ -743,7 +734,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.8", + "sha2", ] [[package]] @@ -821,12 +812,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -995,7 +980,7 @@ name = "raffle-lib" version = "0.0.1" dependencies = [ "alloy-sol-types", - "sha2 0.9.9", + "sha2", "sp1-zkvm 2.0.0", ] @@ -1243,19 +1228,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.10.8" @@ -1345,7 +1317,7 @@ dependencies = [ "once_cell", "rand", "serde", - "sha2 0.10.8", + "sha2", "sp1-lib 1.2.0", ] @@ -1363,7 +1335,7 @@ dependencies = [ "once_cell", "rand", "serde", - "sha2 0.10.8", + "sha2", "sp1-lib 2.0.0", ] diff --git a/programs/per-user-proof/program/elf/riscv32im-succinct-zkvm-elf b/programs/per-user-proof/program/elf/riscv32im-succinct-zkvm-elf index 2acf32e..83c76eb 100755 Binary files a/programs/per-user-proof/program/elf/riscv32im-succinct-zkvm-elf and b/programs/per-user-proof/program/elf/riscv32im-succinct-zkvm-elf differ