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

fix: truncate prover id #102

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/coordinator/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ impl Controller {
}

// Failure is acceptable here. We can re-assign the task to another prover later.
async fn assign_task(&mut self, task_id: String, prover_id: String) -> anyhow::Result<()> {
async fn assign_task(&mut self, task_id: String, mut prover_id: String) -> anyhow::Result<()> {
prover_id.truncate(30);
let stmt = format!("update {} set prover_id = $1, status = $2 where task_id = $3", tablenames::TASK);
sqlx::query(&stmt)
.bind(prover_id)
Expand All @@ -98,10 +99,12 @@ impl Controller {
"update {} set public_input = $1, proof = $2, prover_id = $3, status = $4 where task_id = $5",
tablenames::TASK
);
let mut prover_id = req.prover_id.clone();
prover_id.truncate(30);
sqlx::query(&stmt)
.bind(req.public_input)
.bind(req.proof)
.bind(req.prover_id)
.bind(prover_id)
.bind(task::TaskStatus::Proved)
.bind(req.task_id)
.execute(&self.db_pool)
Expand Down