feat: adding rpc interfaces into sequencer and node

This commit is contained in:
Oleksandr Pravdyvyi
2024-09-30 05:49:46 +03:00
parent c95ed90c9a
commit 42cfac8a74
35 changed files with 1390 additions and 20 deletions
+5 -1
View File
@@ -9,6 +9,7 @@ serde_json.workspace = true
env_logger.workspace = true
log.workspace = true
serde.workspace = true
actix.workspace = true
actix-web.workspace = true
tokio.workspace = true
@@ -38,4 +39,7 @@ path = "../zkvm"
path = "../node_rpc"
[dependencies.node_core]
path = "../node_core"
path = "../node_core"
[dependencies.rpc_primitives]
path = "../rpc_primitives"
+17
View File
@@ -0,0 +1,17 @@
use anyhow::Result;
use log::info;
use node_rpc::new_http_server;
use rpc_primitives::RpcConfig;
pub async fn main_runner() -> Result<()> {
env_logger::init();
let http_server = new_http_server(RpcConfig::default())?;
info!("HTTP server started");
let _http_server_handle = http_server.handle();
tokio::spawn(http_server);
loop {
//ToDo: Insert activity into main loop
}
}
+14 -3
View File
@@ -1,5 +1,16 @@
//ToDo: Add node_runner module
use anyhow::Result;
fn main() {
println!("Hello, world!");
use node_runner::main_runner;
pub const NUM_THREADS: usize = 4;
fn main() -> Result<()> {
actix::System::with_tokio_rt(|| {
tokio::runtime::Builder::new_multi_thread()
.worker_threads(NUM_THREADS)
.enable_all()
.build()
.unwrap()
})
.block_on(main_runner())
}