Skip to content

Commit

Permalink
Merge pull request #307 from CESSProject/hotfix/restore_args
Browse files Browse the repository at this point in the history
fix: the system.args not restored correctly
  • Loading branch information
0xbillw authored Feb 6, 2024
2 parents 56f4aa9 + 1d697f4 commit 2be1d30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/cestory/src/expert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct CesealExpertStub {
impl CesealExpertStub {
pub fn new(ceseal_props: CesealProperties) -> (Self, ExpertCmdReceiver) {
let (tx, rx) = mpsc::channel(16);
let thread_pool_cap = std::cmp::max(ceseal_props.cores - 1, 1);
let thread_pool_cap = ceseal_props.cores.saturating_sub(1).max(1);
let thread_pool = threadpool::ThreadPool::new(thread_pool_cap as usize);
info!("PODR2 compute thread pool capacity: {}", thread_pool.max_count());
let role = ceseal_props.role.clone();
Expand Down
16 changes: 7 additions & 9 deletions crates/cestory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use serde::{
Deserialize, Deserializer, Serialize, Serializer,
};

use crate::{light_validation::LightValidation, system::System};
use crate::light_validation::LightValidation;
use anyhow::{anyhow, Context as _, Result};
use ces_crypto::{
aead,
Expand Down Expand Up @@ -315,6 +315,7 @@ impl<Platform: pal::Platform> Ceseal<Platform> {
if let Some(system) = &mut self.system {
system.sealing_path = self.args.sealing_path.clone();
system.storage_path = self.args.storage_path.clone();
system.args = self.args.clone();
}
}

Expand Down Expand Up @@ -600,14 +601,11 @@ impl<Platform: Serialize + DeserializeOwned> Ceseal<Platform> {
let recv_mq = &mut runtime_state.recv_mq;
let send_mq = &mut runtime_state.send_mq;
let seq = &mut seq;
let mut system: System<Platform> =
ces_mq::checkpoint_helper::using_dispatcher(recv_mq, move || {
ces_mq::checkpoint_helper::using_send_mq(send_mq, || {
seq.next_element()?.ok_or_else(|| de::Error::custom("Missing System"))
})
})?;
system.args = factory.args.clone();
Some(system)
ces_mq::checkpoint_helper::using_dispatcher(recv_mq, move || {
ces_mq::checkpoint_helper::using_send_mq(send_mq, || {
seq.next_element()?.ok_or_else(|| de::Error::custom("Missing System"))
})
})?
};
} else {
let _: Option<serde::de::IgnoredAny> = seq.next_element()?;
Expand Down

0 comments on commit 2be1d30

Please sign in to comment.