Skip to content

Commit 903373a

Browse files
committed
Update the sp1 to 4.2.1
1 parent 4c8538e commit 903373a

File tree

8 files changed

+29
-17
lines changed

8 files changed

+29
-17
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ members = [
2525

2626
[dependencies]
2727
hex = "0.4.3"
28-
sp1-sdk = "3.4.0"
28+
sp1-sdk = "4.2.1"
2929

3030
text_io = "0.1.12"
3131
serde = { version = "1.0", features = ["derive"] }
@@ -42,4 +42,4 @@ axum = "0.7"
4242
tokio = { version = "1", features = ["full"] }
4343

4444
[build-dependencies]
45-
sp1-build = "4.0.0"
45+
sp1-build = "4.2.1"

crates/bad_encrypted_share_prove/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
sp1-zkvm = "3.4.0"
8+
sp1-zkvm = "4.2.1"
99
ff = "0.13.0"
1010
rand = "0.8.5"
1111
group = "0.13.0"
1212
serde = "1.0.216"
1313
serde_cbor = "0.10"
1414
dkg = { path = "../dkg" }
15-
bls12_381 = { git = "https://github.com/NDobrev/bls12_381", branch="fp-to-bytes", features = ["experimental"]}
15+
bls12_381 = { git = "https://github.com/sp1-patches/bls12_381", tag = "patch-0.8.0-sp1-4.0.0-v2", features = ["experimental"]}
1616
hex = "0.4"
1717
chacha20 = "0.9.1"
1818
sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", tag= "sha2-v0.9.9-patch-v1" }

crates/bad_parial_key_prove/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
sp1-zkvm = "3.4.0"
8+
sp1-zkvm = "4.2.1"
99
ff = "0.13.0"
1010
rand = "0.8.5"
1111
group = "0.13.0"

crates/bad_share_exchange_prove/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
sp1-zkvm = "3.4.0"
8+
sp1-zkvm = "4.2.1"
99
ff = "0.13.0"
1010
rand = "0.8.5"
1111
group = "0.13.0"

crates/dkg/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ schemars = "0.8.22"
1515
serde_yaml = "0.9.34"
1616
paste = "1.0"
1717
hex = "0.4"
18-
sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", tag= "sha2-v0.9.9-patch-v1" }
18+
sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.10.8-sp1-4.0.0" }
1919
bls_org = { package = "bls12_381", version = "0.8.0"}
20-
secp256k1 = { git = "https://github.com/sp1-patches/rust-secp256k1", tag = "secp256k1-v0.29.1-patch-v1"}
21-
bls12_381 = { git = "https://github.com/sp1-patches/bls12_381", tag = "bls12_381-v0.8.0-patch-v1" , features = ["experimental"]}
20+
secp256k1 = { git = "https://github.com/sp1-patches/rust-secp256k1", tag = "patch-0.29.1-sp1-4.1.0"}
21+
bls12_381 = { git = "https://github.com/sp1-patches/bls12_381", tag = "patch-0.8.0-sp1-4.0.0-v2", features = ["experimental"]}

crates/dkg/src/crypto/bls_common.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@ use bls12_381::{
33
pairing, G1Affine, G1Projective, G2Affine, G2Projective, Scalar,
44
};
55

6+
use core::convert::AsRef;
7+
68
use crate::types::*;
79
use sha2::Sha256;
810

911
pub fn hash_message_to_g2(msg: &[u8]) -> G2Projective {
1012
let domain = b"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
11-
<G2Projective as HashToCurve<ExpandMsgXmd<Sha256>>>::hash_to_curve(msg, domain)
13+
14+
struct MsgInternal<'a> {
15+
msg: &'a [u8],
16+
}
17+
18+
impl bls12_381::hash_to_curve::Message for MsgInternal<'_> {
19+
fn input_message(self, mut f: impl FnMut(&[u8])) {
20+
f(self.msg);
21+
}
22+
}
23+
<G2Projective as HashToCurve<ExpandMsgXmd<Sha256>>>::hash_to_curve(MsgInternal { msg }, domain)
1224
}
1325

1426
pub fn bls_verify_precomputed_hash(

crates/finalization_prove/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
sp1-zkvm = "3.4.0"
8+
sp1-zkvm = "4.2.1"
99
ff = "0.13.0"
1010
rand = "0.8.5"
1111
group = "0.13.0"

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ where
435435
let bin = serde_cbor::to_vec(data).expect("Failed to serialize data");
436436
println!("input len: {}", bin.len());
437437
stdin.write(&bin);
438-
let client = ProverClient::new();
438+
let client = ProverClient::from_env();
439439
let (_public_values, report) = client
440-
.execute(elf, stdin)
440+
.execute(elf, &stdin)
441441
.run()
442442
.map_err(|e| style_error(format!("Verification failed: {e}")))?;
443443
if show_report {
@@ -458,10 +458,10 @@ where
458458
let mut stdin = SP1Stdin::new();
459459
let bin = serde_cbor::to_vec(data).expect("Failed to serialize data");
460460
stdin.write(&bin);
461-
let client = ProverClient::new();
461+
let client = ProverClient::from_env();
462462
let (pk, _) = client.setup(elf);
463463
let proof = client
464-
.prove(&pk, stdin)
464+
.prove(&pk, &stdin)
465465
.run()
466466
.map_err(|e| style_error(format!("Proof generation failed: {e}")))?;
467467

@@ -478,7 +478,7 @@ where
478478
}
479479

480480
fn verify_proof(elf: &[u8], proof_file: &str, show_report: bool) -> Result<(), Box<dyn Error>> {
481-
let client = ProverClient::new();
481+
let client = ProverClient::from_env();
482482
let (_, vk) = client.setup(elf);
483483

484484
let proof_with_pub_values = SP1ProofWithPublicValues::load(proof_file).map_err(|e| {
@@ -496,7 +496,7 @@ fn verify_proof(elf: &[u8], proof_file: &str, show_report: bool) -> Result<(), B
496496
stdin.write(&vk);
497497

498498
let (_, report) = client
499-
.execute(elf, stdin)
499+
.execute(elf, &stdin)
500500
.run()
501501
.map_err(|e| style_error(format!("Verification failed: {e}")))?;
502502

0 commit comments

Comments
 (0)