Skip to content

Commit

Permalink
Merge pull request #174 from spacemeshos/dont-keep-verifier-in-service
Browse files Browse the repository at this point in the history
Reduce service memory requirements by not keeping randomx all the time
  • Loading branch information
poszu committed Jan 3, 2024
2 parents 071ea55 + 947f1d1 commit 3ef1ae5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 17 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ members = [

[package]
name = "post-rs"
version = "0.6.2"
version = "0.6.3"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion certifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "certifier"
version = "0.6.2"
version = "0.6.3"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "post-cbindings"
version = "0.6.2"
version = "0.6.3"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion initializer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "initializer"
version = "0.6.2"
version = "0.6.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion profiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "profiler"
version = "0.6.2"
version = "0.6.3"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion scrypt-ocl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "scrypt-ocl"
version = "0.6.2"
version = "0.6.3"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "service"
version = "0.6.2"
version = "0.6.3"
edition = "2021"

[lib]
Expand Down
7 changes: 4 additions & 3 deletions service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub struct PostService {
pow_flags: RandomXFlag,
proof_generation: Mutex<Option<ProofGenProcess>>,

verifier: Verifier,
stop: Arc<AtomicBool>,
}

Expand All @@ -55,7 +54,6 @@ impl PostService {
nonces,
threads,
pow_flags,
verifier: Verifier::new(Box::new(PoW::new(RandomXFlag::get_recommended_flags())?)),
stop: Arc::new(AtomicBool::new(false)),
})
}
Expand Down Expand Up @@ -115,7 +113,10 @@ impl crate::client::PostService for PostService {
}

fn verify_proof(&self, proof: &Proof, metadata: &ProofMetadata) -> eyre::Result<()> {
self.verifier
let pow_verifier =
PoW::new(RandomXFlag::get_recommended_flags()).context("creating PoW verifier")?;
let verifier = Verifier::new(Box::new(pow_verifier));
verifier
.verify(proof, metadata, &self.cfg, &self.init_cfg)
.wrap_err("verifying proof")
}
Expand Down

0 comments on commit 3ef1ae5

Please sign in to comment.