Skip to content

feat: support multi circuits - update column circuit of table task to type string #239

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

Merged
merged 4 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
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
31 changes: 19 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 6 additions & 11 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
#![allow(dead_code)]

use crossbeam_channel::RecvTimeoutError;
use fluidex_common::db::models::tablenames;
use fluidex_common::db::models::task::TaskStatus;
use fluidex_common::db::MIGRATOR;
use fluidex_common::non_blocking_tracing;
use fluidex_common::{
db::{
models::{
tablenames,
task::{CircuitType, TaskStatus},
},
MIGRATOR,
},
types::FrExt,
};
use fluidex_common::types::FrExt;
use rollup_state_manager::config::Settings;
use rollup_state_manager::grpc::run_grpc_server;
use rollup_state_manager::msg::{msg_loader, msg_processor};
Expand Down Expand Up @@ -240,6 +234,7 @@ async fn save_block_to_db(pool: &PgPool, block: &L2Block) -> anyhow::Result<()>
}

async fn save_task_to_db(pool: &PgPool, block: L2Block) -> anyhow::Result<()> {
let tx_num = block.detail.encoded_txs.len();
let input = L2BlockSerde::from(block.detail);
let task_id = unique_task_id();

Expand All @@ -248,7 +243,7 @@ async fn save_task_to_db(pool: &PgPool, block: L2Block) -> anyhow::Result<()> {
tablenames::TASK
))
.bind(task_id)
.bind(CircuitType::BLOCK)
.bind(format!("block_{}", tx_num))
.bind(block.block_id as i64) // TODO: will it overflow?
.bind(sqlx::types::Json(input))
.bind(TaskStatus::Inited)
Expand Down