Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make worker more "stateless" #81

Open
lispc opened this issue Jul 8, 2021 · 2 comments
Open

feat: make worker more "stateless" #81

lispc opened this issue Jul 8, 2021 · 2 comments
Labels

Comments

@lispc
Copy link
Member

lispc commented Jul 8, 2021

When a worker starts, it only knows the coordinator url.

Then it fetches a task from the coordinator, {circuit_id, witness}. If it does not know about the circuit, then it fetches the circuit information from the coordinator ( req: circuit_id, resp: { r1cs_url, srs_monomial_form_url, srs_lagrange_form_url} ). Then the worker can save the circuit locally ( both memory and local file is ok ).

( url can be s3 url or http url )

worked_id is generated as uuid locally.

@lispc lispc added the longterm label Jul 8, 2021
@lispc
Copy link
Member Author

lispc commented Jul 8, 2021

We may need to prove different circuits in the future ( block / exit tree , of different size / n_tx ) . So fetching circuit details from master seems more flexible ?

@lispc lispc changed the title feat: make worker more stateless feat: make worker more "stateless" Jul 8, 2021
@0xmountaintop
Copy link
Member

for now a client 100% know the circuit because it query from coordinator by task.

    pub async fn poll_task(&self) -> Result<Task, anyhow::Error> {
        let mut client = ClusterClient::connect(self.upstream.clone()).await?;

        let request = tonic::Request::new(PollTaskRequest {
            prover_id: self.id.clone(),
            circuit: self.circuit as i32,
            timestamp: chrono::Utc::now().timestamp_millis(),
        });

        log::info!("prover({}) polling task", self.id);
        match client.poll_task(request).await {
            Ok(t) => Ok(t.into_inner()),
            Err(e) => Err(anyhow!(e)),
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants