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

Deneb testnet #76

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lightclient-circuits/config/committee_update_testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"num_fixed": 1,
"num_lookup_advice_per_phase": [
1,
0,
0,
0
],
Expand All @@ -18,4 +18,4 @@
1048566
]
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"break_points": [
[]
]
}
}
6 changes: 3 additions & 3 deletions lightclient-circuits/config/sync_step_testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
2097142,
2097140,
2097140,
2097142,
2097141,
2097140,
2097140,
2097140,
2097142
]
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"break_points": [
[]
]
}
}
18 changes: 7 additions & 11 deletions lightclient-circuits/src/sync_step_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl<S: Spec, F: Field> StepCircuit<S, F> {
fp_chip: &FpChip<'_, F>,
pubkey_affines: &[G1Affine],
pariticipation_bits: &[bool],
assigned_affines: &mut Vec<G1Point<F>>,
assigned_pubkeys: &mut Vec<G1Point<F>>,
y_signs_packed: &mut Vec<AssignedValue<F>>,
) -> (G1Point<F>, AssignedValue<F>) {
let gate = fp_chip.gate();
Expand Down Expand Up @@ -330,37 +330,33 @@ impl<S: Spec, F: Field> StepCircuit<S, F> {
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::<G1Affine>(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);
let doub = g1_chip.double(ctx, acc.clone());
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
.chunks(F::CAPACITY as usize - 1)
.map(|chunk| gate.bits_to_num(ctx, chunk))
.collect_vec();

(acc, participation_sum)
(agg_pubkey, participation_sum)
}
}

Expand Down
4 changes: 2 additions & 2 deletions prover/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
&params,
&pk,
&cfg_path,
None::<String>,
Some("./build/committee_update_dummy.snark"),
&Default::default(),
)
.map_err(|e| eyre::eyre!("Failed to generate proof: {}", e))
Expand Down Expand Up @@ -176,7 +176,7 @@ where
&params,
&pk,
&cfg_path,
None::<String>,
Some("./build/step_dummy.snark"),
&Default::default(),
)
.map_err(|e| eyre::eyre!("Failed to generate proof: {}", e))
Expand Down
4 changes: 2 additions & 2 deletions prover/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl ProverState {
params_map.get(step.degree()).unwrap(),
step.pk(),
step.config_path(),
None::<String>,
Some("./build/step_dummy.snark"),
&Default::default(),
)
.unwrap();
Expand All @@ -90,7 +90,7 @@ impl ProverState {
params_map.get(committee_update.degree()).unwrap(),
committee_update.pk(),
committee_update.config_path(),
None::<String>,
Some("./build/committee_update_dummy.snark"),
&Default::default(),
)
.unwrap();
Expand Down
Loading