diff --git a/Cargo.toml b/Cargo.toml index bdd14a06..47d4509b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,7 @@ snark-verifier-sdk = { git = "https://github.com/axiom-crypto/snark-verifier.git ] } # ethereum types -ethereum-consensus-types = { git = "https://github.com/ChainSafe/ethereum-consensus-types", branch = "capella" } +ethereum-consensus-types = { git = "https://github.com/ChainSafe/ethereum-consensus-types", branch = "deneb" } beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus.git", rev = "f3bff52e9c43866f231ec40c8ab0e34125a8957f" } ssz_rs = "0.9" diff --git a/contracts b/contracts index a430caeb..4e972c54 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit a430caeb3678582b73e3ee73b6f001bd9d1e75ca +Subproject commit 4e972c5410cf4235c0b48295f54a02418d86cc67 diff --git a/justfile b/justfile index 76a6709a..bf076364 100644 --- a/justfile +++ b/justfile @@ -25,15 +25,15 @@ setup-committee-update network *k='24': -K $2 -P ./build/committee_update_verifier_$1.pkey setup gen-verifier-step network: - cargo run -r -p spectre-prover -- circuit sync-step -p ./build/sync_step_$1.pkey gen-verifier -o ./contracts/snark-verifiers/sync_step.sol + cargo run -r -p spectre-prover -- circuit sync-step -p ./build/sync_step_$1.pkey gen-verifier -o ./contracts/$1/snark-verifiers/sync_step.sol gen-verifier-step-compressed network: cargo run -r -p spectre-prover -- circuit sync-step-compressed -p ./build/sync_step_$1.pkey -P ./build/sync_step_verifier_$1.pkey \ - gen-verifier -o ./contracts/snark-verifiers/sync_step_verifier.sol + gen-verifier -o ./contracts/snark-verifiers/$1/sync_step_verifier.sol gen-verifier-committee-update network: cargo run -r -p spectre-prover -- circuit committee-update -p ./build/committee_update_$1.pkey -P ./build/committee_update_verifier_$1.pkey \ - gen-verifier -o ./contracts/snark-verifiers/committee_update_verifier.sol + gen-verifier -o ./contracts/snark-verifiers/$1/committee_update_verifier.sol build-contracts: cd contracts && forge build diff --git a/lightclient-circuits/config/committee_update_testnet.json b/lightclient-circuits/config/committee_update_testnet.json index 4bea29b8..bacec3d0 100644 --- a/lightclient-circuits/config/committee_update_testnet.json +++ b/lightclient-circuits/config/committee_update_testnet.json @@ -6,7 +6,7 @@ ], "num_fixed": 1, "num_lookup_advice_per_phase": [ - 1, + 0, 0, 0 ], @@ -18,4 +18,4 @@ 1048566 ] ] -} \ No newline at end of file +} diff --git a/lightclient-circuits/config/committee_update_verifier_testnet.json b/lightclient-circuits/config/committee_update_verifier_testnet.json index c38fdce4..61838b78 100644 --- a/lightclient-circuits/config/committee_update_verifier_testnet.json +++ b/lightclient-circuits/config/committee_update_verifier_testnet.json @@ -9,4 +9,4 @@ "break_points": [ [] ] -} \ No newline at end of file +} diff --git a/lightclient-circuits/config/sync_step_testnet.json b/lightclient-circuits/config/sync_step_testnet.json index 9659e0cd..78125575 100644 --- a/lightclient-circuits/config/sync_step_testnet.json +++ b/lightclient-circuits/config/sync_step_testnet.json @@ -18,10 +18,10 @@ 2097142, 2097140, 2097140, - 2097142, - 2097141, + 2097140, + 2097140, 2097140, 2097142 ] ] -} \ No newline at end of file +} diff --git a/lightclient-circuits/config/sync_step_verifier_testnet.json b/lightclient-circuits/config/sync_step_verifier_testnet.json index f64047ee..1bdff1b1 100644 --- a/lightclient-circuits/config/sync_step_verifier_testnet.json +++ b/lightclient-circuits/config/sync_step_verifier_testnet.json @@ -9,4 +9,4 @@ "break_points": [ [] ] -} \ No newline at end of file +} diff --git a/lightclient-circuits/src/sync_step_circuit.rs b/lightclient-circuits/src/sync_step_circuit.rs index f85d4ecd..b3f0eeb0 100644 --- a/lightclient-circuits/src/sync_step_circuit.rs +++ b/lightclient-circuits/src/sync_step_circuit.rs @@ -294,7 +294,7 @@ impl StepCircuit { fp_chip: &FpChip<'_, F>, pubkey_affines: &[G1Affine], pariticipation_bits: &[bool], - assigned_affines: &mut Vec>, + assigned_pubkeys: &mut Vec>, y_signs_packed: &mut Vec>, ) -> (G1Point, AssignedValue) { let gate = fp_chip.gate(); @@ -330,22 +330,17 @@ impl StepCircuit { fp_chip.limb_bases[1], ); - assigned_affines.push(assigned_affine); + assigned_pubkeys.push(assigned_affine); participation_bits.push(participation_bit); y_signs.push(y_sign); } - let mut acc = { - let x = fp_chip.load_constant(ctx, G1Affine::identity().x); - let y = fp_chip.load_constant(ctx, G1Affine::identity().y); - G1Point::new(x, y) // identity - }; - acc = g1_chip.select(ctx, assigned_affines[0].clone(), acc, participation_bits[0]); + let rand_point = g1_chip.load_random_point::(ctx); + let mut acc = rand_point.clone(); for (bit, point) in participation_bits .iter() .copied() - .zip(assigned_affines.iter_mut()) - .skip(1) + .zip(assigned_pubkeys.iter_mut()) { let is_equal = g1_chip.is_equal(ctx, acc.clone(), point.clone()); let add = g1_chip.add_unequal(ctx, acc.clone(), point.clone(), true); @@ -353,6 +348,7 @@ impl StepCircuit { let sum = g1_chip.select(ctx, doub, add, is_equal); acc = g1_chip.select(ctx, sum, acc, bit); } + let agg_pubkey = g1_chip.sub_unequal(ctx, acc, rand_point, false); let participation_sum = gate.sum(ctx, participation_bits); *y_signs_packed = y_signs @@ -360,7 +356,7 @@ impl StepCircuit { .map(|chunk| gate.bits_to_num(ctx, chunk)) .collect_vec(); - (acc, participation_sum) + (agg_pubkey, participation_sum) } } diff --git a/prover/src/cli.rs b/prover/src/cli.rs index d6f2b553..eef505b4 100644 --- a/prover/src/cli.rs +++ b/prover/src/cli.rs @@ -98,7 +98,7 @@ where ¶ms, &pk, &cfg_path, - None::, + Some("./build/committee_update_dummy.snark"), &Default::default(), ) .map_err(|e| eyre::eyre!("Failed to generate proof: {}", e)) @@ -176,7 +176,7 @@ where ¶ms, &pk, &cfg_path, - None::, + Some("./build/step_dummy.snark"), &Default::default(), ) .map_err(|e| eyre::eyre!("Failed to generate proof: {}", e)) diff --git a/prover/src/prover.rs b/prover/src/prover.rs index 03368b2a..aa748ec8 100644 --- a/prover/src/prover.rs +++ b/prover/src/prover.rs @@ -74,7 +74,7 @@ impl ProverState { params_map.get(step.degree()).unwrap(), step.pk(), step.config_path(), - None::, + Some("./build/step_dummy.snark"), &Default::default(), ) .unwrap(); @@ -90,7 +90,7 @@ impl ProverState { params_map.get(committee_update.degree()).unwrap(), committee_update.pk(), committee_update.config_path(), - None::, + Some("./build/committee_update_dummy.snark"), &Default::default(), ) .unwrap();