diff --git a/crates/common/src/job.rs b/crates/common/src/job.rs index 0e6238d..a4ecea4 100644 --- a/crates/common/src/job.rs +++ b/crates/common/src/job.rs @@ -1,4 +1,4 @@ -use libsecp256k1::{PublicKey, Signature}; +use libsecp256k1::{curve::Scalar, sign, PublicKey, SecretKey, Signature}; use std::{ fmt::Display, hash::{DefaultHasher, Hash, Hasher}, @@ -18,6 +18,24 @@ pub struct Job { pub cpu_air_prover_config: Vec, // needed for proving } +impl Default for Job { + fn default() -> Self { + let secret_key = &SecretKey::default(); + let public_key = PublicKey::from_secret_key(secret_key); + let (signature, _recovery_id) = + sign(&libsecp256k1::Message(Scalar([0, 0, 0, 0, 0, 0, 0, 0])), secret_key); + Self { + reward: 0, + num_of_steps: 0, + cairo_pie: vec![1, 2, 3], + public_key, + signature, + cpu_air_params: vec![1, 2, 3], + cpu_air_prover_config: vec![1, 2, 3], + } + } +} + impl Hash for Job { fn hash(&self, state: &mut H) { self.reward.hash(state); @@ -34,12 +52,12 @@ impl Display for Job { } } -impl Job { - pub fn serialize_job(&self) -> Vec { - bincode::serialize(self).unwrap() - } +// impl Job { +// pub fn serialize_job(&self) -> Vec { +// bincode::serialize(self).unwrap() +// } - pub fn deserialize_job(serialized_job: &[u8]) -> Self { - bincode::deserialize(serialized_job).unwrap() - } -} +// pub fn deserialize_job(serialized_job: &[u8]) -> Self { +// bincode::deserialize(serialized_job).unwrap() +// } +// }