forked from madara-alliance/madara-orchestrator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
19 changed files
with
344 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use crate::config::Config; | ||
use crate::jobs::types::{JobItem, JobStatus, JobType, JobVerificationStatus}; | ||
use crate::jobs::Job; | ||
use async_trait::async_trait; | ||
use color_eyre::Result; | ||
use std::collections::HashMap; | ||
use uuid::Uuid; | ||
|
||
pub struct RegisterProofJob; | ||
|
||
#[async_trait] | ||
impl Job for RegisterProofJob { | ||
async fn create_job( | ||
&self, | ||
_config: &Config, | ||
internal_id: String, | ||
metadata: HashMap<String, String>, | ||
) -> Result<JobItem> { | ||
Ok(JobItem { | ||
id: Uuid::new_v4(), | ||
internal_id, | ||
job_type: JobType::ProofRegistration, | ||
status: JobStatus::Created, | ||
external_id: String::new().into(), | ||
// metadata must contain the blocks that have been included inside this proof | ||
// this will allow state update jobs to be created for each block | ||
metadata, | ||
version: 0, | ||
}) | ||
} | ||
|
||
async fn process_job(&self, _config: &Config, _job: &JobItem) -> Result<String> { | ||
// Get proof from S3 and submit on chain for verification | ||
// We need to implement a generic trait for this to support multiple | ||
// base layers | ||
todo!() | ||
} | ||
|
||
async fn verify_job(&self, _config: &Config, _job: &JobItem) -> Result<JobVerificationStatus> { | ||
// verify that the proof transaction has been included on chain | ||
todo!() | ||
} | ||
|
||
fn max_process_attempts(&self) -> u64 { | ||
todo!() | ||
} | ||
|
||
fn max_verification_attempts(&self) -> u64 { | ||
todo!() | ||
} | ||
|
||
fn verification_polling_delay_seconds(&self) -> u64 { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use crate::config::Config; | ||
use crate::jobs::types::{JobItem, JobStatus, JobType, JobVerificationStatus}; | ||
use crate::jobs::Job; | ||
use async_trait::async_trait; | ||
use color_eyre::Result; | ||
use std::collections::HashMap; | ||
use uuid::Uuid; | ||
|
||
pub struct SnosJob; | ||
|
||
#[async_trait] | ||
impl Job for SnosJob { | ||
async fn create_job( | ||
&self, | ||
_config: &Config, | ||
internal_id: String, | ||
metadata: HashMap<String, String>, | ||
) -> Result<JobItem> { | ||
Ok(JobItem { | ||
id: Uuid::new_v4(), | ||
internal_id, | ||
job_type: JobType::SnosRun, | ||
status: JobStatus::Created, | ||
external_id: String::new().into(), | ||
metadata, | ||
version: 0, | ||
}) | ||
} | ||
|
||
async fn process_job(&self, _config: &Config, _job: &JobItem) -> Result<String> { | ||
// 1. Fetch SNOS input data from Madara | ||
// 2. Import SNOS in Rust and execute it with the input data | ||
// 3. Store the received PIE in DB | ||
todo!() | ||
} | ||
|
||
async fn verify_job(&self, _config: &Config, _job: &JobItem) -> Result<JobVerificationStatus> { | ||
// No need for verification as of now. If we later on decide to outsource SNOS run | ||
// to another servicehow a, verify_job can be used to poll on the status of the job | ||
todo!() | ||
} | ||
|
||
fn max_process_attempts(&self) -> u64 { | ||
todo!() | ||
} | ||
|
||
fn max_verification_attempts(&self) -> u64 { | ||
todo!() | ||
} | ||
|
||
fn verification_polling_delay_seconds(&self) -> u64 { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use crate::config::Config; | ||
use crate::jobs::types::{JobItem, JobStatus, JobType, JobVerificationStatus}; | ||
use crate::jobs::Job; | ||
use async_trait::async_trait; | ||
use color_eyre::Result; | ||
use std::collections::HashMap; | ||
use uuid::Uuid; | ||
|
||
pub struct StateUpdateJob; | ||
|
||
#[async_trait] | ||
impl Job for StateUpdateJob { | ||
async fn create_job( | ||
&self, | ||
_config: &Config, | ||
internal_id: String, | ||
metadata: HashMap<String, String>, | ||
) -> Result<JobItem> { | ||
Ok(JobItem { | ||
id: Uuid::new_v4(), | ||
internal_id, | ||
job_type: JobType::ProofRegistration, | ||
status: JobStatus::Created, | ||
external_id: String::new().into(), | ||
// metadata must contain the blocks for which state update will be performed | ||
// we don't do one job per state update as that makes nonce management complicated | ||
metadata, | ||
version: 0, | ||
}) | ||
} | ||
|
||
async fn process_job(&self, _config: &Config, _job: &JobItem) -> Result<String> { | ||
// Read the metadata to get the blocks for which state update will be performed. | ||
// For each block, get the program output (from the PIE?) and the | ||
todo!() | ||
} | ||
|
||
async fn verify_job(&self, _config: &Config, _job: &JobItem) -> Result<JobVerificationStatus> { | ||
// verify that the proof transaction has been included on chain | ||
todo!() | ||
} | ||
|
||
fn max_process_attempts(&self) -> u64 { | ||
todo!() | ||
} | ||
|
||
fn max_verification_attempts(&self) -> u64 { | ||
todo!() | ||
} | ||
|
||
fn verification_polling_delay_seconds(&self) -> u64 { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use async_trait::async_trait; | ||
|
||
pub mod proof_registration; | ||
pub mod proving; | ||
pub mod snos; | ||
pub mod update_state; | ||
|
||
#[async_trait] | ||
pub trait Worker: Send + Sync { | ||
async fn run_worker(&self); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::workers::Worker; | ||
use async_trait::async_trait; | ||
|
||
pub struct ProofRegistrationWorker; | ||
|
||
#[async_trait] | ||
impl Worker for ProofRegistrationWorker { | ||
/// 1. Fetch all blocks with a successful proving job run | ||
/// 2. Group blocks that have the same proof | ||
/// 3. For each group, create a proof registration job with from and to block in metadata | ||
async fn run_worker(&self) { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use crate::workers::Worker; | ||
use async_trait::async_trait; | ||
|
||
pub struct ProvingWorker; | ||
|
||
#[async_trait] | ||
impl Worker for ProvingWorker { | ||
/// 1. Fetch all successful SNOS job runs that don't have a proving job | ||
/// 2. Create a proving job for each SNOS job run | ||
async fn run_worker(&self) { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::workers::Worker; | ||
use async_trait::async_trait; | ||
|
||
pub struct SnosWorker; | ||
|
||
#[async_trait] | ||
impl Worker for SnosWorker { | ||
/// 1. Fetch the latest completed block from the Starknet chain | ||
/// 2. Fetch the last block that had a SNOS job run. | ||
/// 3. Create SNOS run jobs for all the remaining blocks | ||
async fn run_worker(&self) { | ||
todo!() | ||
} | ||
} |
Oops, something went wrong.