Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
Merged
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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ serde_json = "1.0"
rand = "0.8"

halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_02_02" }
snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4", default-features=false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.5" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.5", default-features=false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }


[features]
Expand Down
4 changes: 2 additions & 2 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ eth-types = { path = "../eth-types" }
mpt-zktrie = { path = "../zktrie" }
zkevm-circuits = { path = "../zkevm-circuits", default-features = false }

snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4", default-features=false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.5" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.5", default-features=false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }

anyhow = "1.0"
base64 = "0.13.0"
Expand Down
8 changes: 4 additions & 4 deletions zkevm-circuits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ serde_json = "1.0.78"
hash-circuit = { package = "poseidon-circuit", git = "https://github.com/scroll-tech/poseidon-circuit.git", branch = "scroll-dev-0901"}
misc-precompiled-circuit = { package = "misc-precompiled-circuit", git = "https://github.com/scroll-tech/misc-precompiled-circuit.git", tag = "v0.1.0" }

halo2-base = { git = "https://github.com/scroll-tech/halo2-lib", tag = "v0.1.3", default-features=false, features=["halo2-pse","display"] }
halo2-ecc = { git = "https://github.com/scroll-tech/halo2-lib", tag = "v0.1.3", default-features=false, features=["halo2-pse","display"] }
halo2-base = { git = "https://github.com/scroll-tech/halo2-lib", tag = "v0.1.5", default-features=false, features=["halo2-pse","display"] }
halo2-ecc = { git = "https://github.com/scroll-tech/halo2-lib", tag = "v0.1.5", default-features=false, features=["halo2-pse","display"] }

maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2023_02_02" }

libsecp256k1 = "0.7"
num-bigint = { version = "0.4" }
subtle = "2.4"
rand_chacha = "0.3"
snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.4", default-features=false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.5" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", tag = "v0.1.5", default-features=false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
hex = "0.4.3"
rayon = "1.5"
once_cell = "1.17.0"
Expand Down
4 changes: 2 additions & 2 deletions zkevm-circuits/src/sig_circuit/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ where
// u3 = 1 if u1 == 1
// u3 = -1 if u1 != 1
// this ensures u1 + u3 != 0
let u3 = scalar_chip.select(ctx, &neg_one, &one, &u1_is_one);
let u3 = scalar_chip.select(ctx, &one, &neg_one, &u1_is_one);

let u1_plus_u3 = scalar_chip.add_no_carry(ctx, &u1, &u3);
let u1_plus_u3 = scalar_chip.carry_mod(ctx, &u1_plus_u3);
Expand Down Expand Up @@ -88,7 +88,7 @@ where
let neg_generator = -generator;
let generator = ecc_chip.assign_constant_point(ctx, generator);
let neg_generator = ecc_chip.assign_constant_point(ctx, neg_generator);
ecc_chip.select(ctx, &neg_generator, &generator, &u1_is_one)
ecc_chip.select(ctx, &generator, &neg_generator, &u1_is_one)
};

// compute u2 * pubkey + u3 * G
Expand Down
23 changes: 22 additions & 1 deletion zkevm-circuits/src/sig_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,28 @@ fn sign_verify() {

log::debug!("end of testing for msg_hash = 0");
}
// msg_hash != 0
// msg_hash == 1
{
log::debug!("testing for msg_hash = 1");
let mut signatures = Vec::new();

let (sk, pk) = gen_key_pair(&mut rng);
let msg = gen_msg(&mut rng);
let msg_hash = secp256k1::Fq::one();
let (r, s, v) = sign_with_rng(&mut rng, sk, msg_hash);
signatures.push(SignData {
signature: (r, s, v),
pk,
msg: msg.into(),
msg_hash,
});

let k = LOG_TOTAL_NUM_ROWS as u32;
run::<Fr>(k, 1, signatures);

log::debug!("end of testing for msg_hash = 1");
}
// random msg_hash
let max_sigs = [1, 16, MAX_NUM_SIG];
for max_sig in max_sigs.iter() {
log::debug!("testing for {} signatures", max_sig);
Expand Down
8 changes: 4 additions & 4 deletions zkevm-circuits/src/sig_circuit/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use halo2_proofs::{
// Hard coded parameters.
// FIXME: allow for a configurable param.
pub(super) const MAX_NUM_SIG: usize = 128;
// Each ecdsa signature requires 460605 cells
pub(super) const CELLS_PER_SIG: usize = 460605;
// Each ecdsa signature requires 63012 lookup cells
pub(super) const LOOKUP_CELLS_PER_SIG: usize = 63012;
// Each ecdsa signature requires 461540 cells
pub(super) const CELLS_PER_SIG: usize = 461540;
// Each ecdsa signature requires 63489 lookup cells
pub(super) const LOOKUP_CELLS_PER_SIG: usize = 63489;
// Total number of rows allocated for ecdsa chip
pub(super) const LOG_TOTAL_NUM_ROWS: usize = 20;
// Max number of columns allowed
Expand Down