Skip to content

Commit 5a44c59

Browse files
committed
chore: add method to initialize PeerDASContext with threads parameter
1 parent 8bafeda commit 5a44c59

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

eip7594/src/lib.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use constants::{BYTES_PER_BLOB, BYTES_PER_CELL, BYTES_PER_COMMITMENT};
2-
use prover::ProverContext;
3-
use trusted_setup::TrustedSetup;
4-
use verifier::VerifierContext;
2+
pub use prover::ProverContext;
3+
pub use trusted_setup::TrustedSetup;
4+
pub use verifier::VerifierContext;
55

66
pub mod constants;
77
pub mod prover;
@@ -43,6 +43,17 @@ impl Default for PeerDASContext {
4343
}
4444

4545
impl PeerDASContext {
46+
pub fn with_threads(trusted_setup: &TrustedSetup, num_threads: usize) -> Self {
47+
let thread_pool = std::sync::Arc::new(rayon::ThreadPoolBuilder::new()
48+
.num_threads(num_threads)
49+
.build()
50+
.unwrap());
51+
PeerDASContext {
52+
prover_ctx: ProverContext::from_threads_pool(trusted_setup, thread_pool.clone()),
53+
verifier_ctx: VerifierContext::from_thread_pool(trusted_setup, thread_pool),
54+
}
55+
}
56+
4657
pub fn prover_ctx(&self) -> &ProverContext {
4758
&self.prover_ctx
4859
}

0 commit comments

Comments
 (0)