Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless committed Dec 7, 2021
2 parents f936be8 + 54a4088 commit 5c22c81
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
9 changes: 4 additions & 5 deletions core/bin/zksync_api/src/api_server/rpc_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
use std::time::Instant;

// External uses
use bigdecimal::BigDecimal;
use futures::{
channel::{mpsc, oneshot},
SinkExt,
};
use jsonrpc_core::{Error, IoHandler, MetaIoHandler, Metadata, Middleware, Result};
use jsonrpc_http_server::ServerBuilder;
use tokio::task::JoinHandle;

// Workspace uses

use zksync_config::configs::api::{CommonApiConfig, JsonRpcConfig};
use zksync_storage::{
chain::{
block::records::StorageBlockDetails, operations::records::StoredExecutedPriorityOperation,
Expand All @@ -19,15 +21,14 @@ use zksync_storage::{
ConnectionPool, StorageProcessor,
};
use zksync_types::{tx::TxHash, Address, BlockNumber, TokenLike, TxFeeTypes};
use zksync_utils::panic_notify::{spawn_panic_handler, ThreadPanicNotify};

// Local uses
use crate::{
fee_ticker::{PriceError, ResponseBatchFee, ResponseFee, TickerRequest, TokenPriceRequestType},
signature_checker::VerifySignatureRequest,
utils::shared_lru_cache::AsyncLruCache,
};
use bigdecimal::BigDecimal;
use zksync_utils::panic_notify::{spawn_panic_handler, ThreadPanicNotify};

pub mod error;
mod ip_insert_middleware;
Expand All @@ -39,8 +40,6 @@ pub use self::rpc_trait::Rpc;
use self::types::*;
use super::tx_sender::TxSender;
use ip_insert_middleware::IpInsertMiddleWare;
use tokio::task::JoinHandle;
use zksync_config::configs::api::{CommonApiConfig, JsonRpcConfig};

#[derive(Clone)]
pub struct RpcApp {
Expand Down
16 changes: 10 additions & 6 deletions core/bin/zksync_api/src/api_server/rpc_subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

// Built-in deps
use std::sync::Arc;
use std::time::Duration;
// External uses
use futures::channel::mpsc;
use jsonrpc_core::{MetaIoHandler, Result};
use jsonrpc_derive::rpc;
use jsonrpc_pubsub::{typed::Subscriber, PubSubHandler, Session, SubscriptionId};
use jsonrpc_ws_server::RequestContext;
use tokio::task::JoinHandle;
// Workspace uses
use zksync_config::configs::api::{CommonApiConfig, JsonRpcConfig};
use zksync_storage::ConnectionPool;
use zksync_types::{tx::TxHash, ActionType, Address};
use zksync_utils::panic_notify::{spawn_panic_handler, ThreadPanicNotify};
// Local uses
use crate::fee_ticker::TickerRequest;
use crate::{
api_server::event_notify::{start_sub_notifier, EventNotifierRequest, EventSubscribeRequest},
api_server::rpc_server::types::{ETHOpInfoResp, ResponseAccountState, TransactionInfoResp},
signature_checker::VerifySignatureRequest,
};
use std::time::Duration;
use zksync_config::configs::api::{CommonApiConfig, JsonRpcConfig};

use tokio::task::JoinHandle;

#[rpc]
pub trait RpcPubSub {
Expand Down Expand Up @@ -206,7 +206,10 @@ pub fn start_ws_server(
confirmations_for_eth_event,
);

tokio::spawn(async move {
let (handler, panic_sender) = spawn_panic_handler();

std::thread::spawn(move || {
let _panic_sentinel = ThreadPanicNotify(panic_sender);
let mut io = PubSubHandler::new(MetaIoHandler::default());

req_rpc_app.extend(&mut io);
Expand All @@ -224,5 +227,6 @@ pub fn start_ws_server(
.expect("Unable to start RPC ws server");

server.wait().expect("rpc ws server start");
})
});
handler
}
12 changes: 5 additions & 7 deletions core/bin/zksync_witness_generator/src/tests/prover_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ impl Default for MockProverOptions {
async fn spawn_server(database: MockDatabase) {
let prover_options = MockProverOptions::default();

tokio::spawn({
run_prover_server(
database,
prover_options.0.api.prover,
prover_options.0.prover,
)
});
run_prover_server(
database,
prover_options.0.api.prover,
prover_options.0.prover,
);
}

#[tokio::test]
Expand Down

0 comments on commit 5c22c81

Please sign in to comment.