Skip to content

Commit

Permalink
Remove old tokyo
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed Jul 26, 2021
1 parent 262165e commit 401b41d
Show file tree
Hide file tree
Showing 96 changed files with 1,703 additions and 2,428 deletions.
3,381 changes: 1,373 additions & 2,008 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
"core/bin/zksync_api",
"core/bin/zksync_core",
"core/bin/zksync_eth_sender",
"core/bin/zksync_event_listener",
# "core/bin/zksync_event_listener",
"core/bin/zksync_witness_generator",
"core/bin/zksync_forced_exit_requests",

Expand Down Expand Up @@ -40,12 +40,9 @@ members = [
# Test infrastructure
"core/tests/test_account",
"core/tests/testkit",
"core/tests/loadtest",
"core/tests/loadnext",
# "core/tests/loadtest",
# "core/tests/loadnext",

# SDK section
"sdk/zksync-rs"
]

[patch.crates-io]
ethabi = { git = "https://github.com/dvush/ethabi.git" }
2 changes: 1 addition & 1 deletion changelog/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ All notable changes to the core components will be documented in this file.
- (`zksync_api`): Internal error with tokens not listed on CoinGecko.
- Fix wrong block info cache behavior in the `api_server`.
- Bug with gas price limit being used instead of average gas price when storing data to DB in gas adjuster.
- `timeout` in ETH sender main loop was replaced with `tokio::time::delay_for`.
- `timeout` in ETH sender main loop was replaced with `tokio::time::sleep`.

## Release 2021-02-19

Expand Down
6 changes: 3 additions & 3 deletions core/bin/block_revert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ zksync_storage = { path = "../../lib/storage", version = "1.0" }
zksync_eth_client = { path = "../../lib/eth_client", version = "1.0" }
zksync_config = { path = "../../lib/config", version = "1.0" }

tokio = { version = "0.2", features = ["full"] }
ethabi = "12.0.0"
tokio = { version = "1", features = ["full"] }
ethabi = "14.0.0"
anyhow = "1.0"
web3 = "0.13.0"
web3 = "0.16.0"
structopt = "0.3.20"
6 changes: 3 additions & 3 deletions core/bin/data_restore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ vlog = { path = "../../lib/vlog", version = "1.0" }

num = { version = "0.3.1", features = ["serde"] }
tiny-keccak = "1.4.2"
ethabi = "12.0.0"
web3 = "0.13.0"
ethabi = "14.0.0"
web3 = "0.16.0"
hex = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.0"
anyhow = "1.0"
structopt = "0.3.20"
chrono = { version = "0.4", features = ["serde", "rustc-serialize"] }
tokio = { version = "0.2", features = ["full"] }
tokio = { version = "1", features = ["full"] }
async-trait = "0.1"

zksync_state = { path = "../../lib/state", version = "1.0" }
Expand Down
30 changes: 15 additions & 15 deletions core/bin/data_restore/src/contract/v4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ use zksync_types::{AccountId, BlockNumber, H256};

fn decode_commitment_parameters(input_data: Vec<u8>) -> anyhow::Result<Vec<Token>> {
let commit_operation = ParamType::Tuple(vec![
Box::new(ParamType::FixedBytes(32)), // bytes32 encoded_root,
Box::new(ParamType::Bytes), // bytes calldata _publicData,
Box::new(ParamType::Uint(256)), // uint256 _timestamp,
Box::new(ParamType::Array(Box::new(ParamType::Tuple(vec![
Box::new(ParamType::Bytes), // bytes eht_witness
Box::new(ParamType::Uint(32)), //uint32 public_data_offset
])))),
Box::new(ParamType::Uint(32)), // uint32 _blockNumber,
Box::new(ParamType::Uint(32)), // uint32 _feeAccount,
ParamType::FixedBytes(32), // bytes32 encoded_root,
ParamType::Bytes, // bytes calldata _publicData,
ParamType::Uint(256), // uint256 _timestamp,
ParamType::Array(Box::new(ParamType::Tuple(vec![
ParamType::Bytes, // bytes eht_witness
ParamType::Uint(32), //uint32 public_data_offset
]))),
ParamType::Uint(32), // uint32 _blockNumber,
ParamType::Uint(32), // uint32 _feeAccount,
]);
let stored_block = ParamType::Tuple(vec![
Box::new(ParamType::Uint(32)), // uint32 blockNumber
Box::new(ParamType::Uint(64)), // uint32 priorityOperations
Box::new(ParamType::FixedBytes(32)), // bytes32 pendingOnchainOperationsHash
Box::new(ParamType::Uint(256)), // uint256 timestamp
Box::new(ParamType::FixedBytes(32)), // bytes32 stateHash
Box::new(ParamType::FixedBytes(32)), // bytes32 commitment
ParamType::Uint(32), // uint32 blockNumber
ParamType::Uint(64), // uint32 priorityOperations
ParamType::FixedBytes(32), // bytes32 pendingOnchainOperationsHash
ParamType::Uint(256), // uint256 timestamp
ParamType::FixedBytes(32), // bytes32 stateHash
ParamType::FixedBytes(32), // bytes32 commitment
]);
ethabi::decode(
vec![stored_block, ParamType::Array(Box::new(commit_operation))].as_slice(),
Expand Down
8 changes: 4 additions & 4 deletions core/bin/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ zksync_prover_utils = { path = "../../lib/prover_utils", version = "1.0" }

hex = "0.4"
rust-crypto = "0.2"
web3 = "0.13.0"
tokio = { version = "0.2", features = ["full"] }
web3 = "0.16.0"
tokio = { version = "1", features = ["full"] }
async-trait = "0.1"
futures = "0.3"

Expand All @@ -33,9 +33,9 @@ serde = "1.0.90"
serde_json = "1.0.0"
num = { version = "0.3.1", features = ["serde"] }
chrono = { version = "0.4", features = ["serde", "rustc-serialize"] }
reqwest = { version = "0.10", features = ["blocking", "json"] }
reqwest = { version = "0.11", features = ["blocking", "json"] }
jsonwebtoken = "7"
anyhow = "1.0"
backoff = { version = "0.2.1", features = ["tokio"] }
backoff = { version = "0.3.0", features = ["tokio"] }
structopt = "0.3.20"
ctrlc = { version = "3.1", features = ["termination"] }
3 changes: 1 addition & 2 deletions core/bin/prover/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use std::time::Duration;
// External deps
use anyhow::format_err;
use backoff::future::FutureOperation;
use backoff::Error::{Permanent, Transient};
use futures::Future;
use reqwest::Url;
Expand Down Expand Up @@ -47,7 +46,7 @@ impl ApiClient {
}

/// Repeats the function execution on the exponential backoff principle.
async fn with_retries<I, E, Fn, Fut>(&self, operation: Fn) -> anyhow::Result<I>
async fn with_retries<I, E, Fn, Fut>(&self, mut operation: Fn) -> anyhow::Result<I>
where
Fn: FnMut() -> Fut,
Fut: Future<Output = Result<I, backoff::Error<E>>>,
Expand Down
2 changes: 1 addition & 1 deletion core/bin/prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async fn heartbeat_future_handle<CLIENT>(
let random_multiplier = between.ind_sample(&mut rng);
Duration::from_secs((heartbeat_interval.as_secs_f64() * random_multiplier) as u64)
};
tokio::time::delay_for(timeout_value).await;
tokio::time::sleep(timeout_value).await;

vlog::debug!("Starting sending heartbeats for job with ID: {}", job_id);

Expand Down
6 changes: 3 additions & 3 deletions core/bin/prover/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async fn test_shutdown_request() {
&prover_name,
)
.fuse();
let timeout = tokio::time::delay_for(prover_options.prover.cycle_wait()).fuse();
let timeout = tokio::time::sleep(prover_options.prover.cycle_wait()).fuse();

pin_mut!(prover_work_cycle, timeout);

Expand Down Expand Up @@ -203,7 +203,7 @@ async fn test_receiving_heartbeats() {
&prover_name,
)
.fuse();
let timeout = tokio::time::delay_for(Duration::from_secs(10)).fuse();
let timeout = tokio::time::sleep(Duration::from_secs(10)).fuse();

pin_mut!(prover_work_cycle, timeout);

Expand Down Expand Up @@ -240,7 +240,7 @@ async fn test_publishing_proof() {
&prover_name,
)
.fuse();
let timeout = tokio::time::delay_for(Duration::from_secs(10)).fuse();
let timeout = tokio::time::sleep(Duration::from_secs(10)).fuse();

pin_mut!(prover_work_cycle, timeout);

Expand Down
2 changes: 1 addition & 1 deletion core/bin/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ anyhow = "1.0"
structopt = "0.3.20"
ctrlc = { version = "3.1", features = ["termination"] }
futures = "0.3"
tokio = { version = "0.2", features = ["full"] }
tokio = { version = "1", features = ["full"] }

vlog = { path = "../../lib/vlog", version = "1.0" }

Expand Down
35 changes: 16 additions & 19 deletions core/bin/zksync_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,29 @@ zksync_prometheus_exporter = { path = "../../lib/prometheus_exporter", version =
zksync_balancer = { path = "../../lib/balancer", version = "1.0" }
zksync_gateway_watcher = { path = "../../lib/gateway_watcher", version = "1.0" }

vlog = { path = "../../lib/vlog", version = "1.0", features=['actix'] }
vlog = { path = "../../lib/vlog", version = "1.0" }

hex = "0.4"
ethabi = "12.0.0"
web3 = "0.13.0"
ethabi = "14.0.0"
web3 = "0.16.0"
serde = "1.0.90"
serde_json = "1.0.0"
serde_repr = "0.1"
itertools = "0.8"
jsonrpc-core = "14.0.3"
jsonrpc-core-client = {version= "14.0.3", features=["ws", "http"]}
jsonrpc-pubsub = "14.0.3"
jsonrpc-ws-server = "14.0.3"
jsonrpc-http-server = "14.0.3"
jsonrpc-derive = "14.0.3"
jsonrpc-core = "18"
jsonrpc-core-client = {version= "18", features=["ws", "http"]}
jsonrpc-pubsub = "18.0.0"
jsonrpc-ws-server = "18"
jsonrpc-http-server = "18"
jsonrpc-derive = "18"
qstring = "0.7.2"

tokio = { version = "0.2", features = ["full"] }
tokio_old = { package = "tokio", version = "0.1.22" }
tokio = { version = "1", features = ["full"] }
futures = { version = "0.3", features = ["compat"] }
actix-rt = "1.1.1"
actix-cors = "0.3.0"
actix-web = "3.0.0"
actix-web-httpauth = "0.5.0"
actix-rt = "2.2.0"
actix-cors = "0.6.0-beta.2"
actix-web = "4.0.0-beta.8"
actix-web-httpauth = "0.6.0-beta.2"

num = { version = "0.3.1", features = ["serde"] }
bigdecimal = { version = "0.2.0", features = ["serde"]}
Expand All @@ -62,13 +61,11 @@ ctrlc = { version = "3.1", features = ["termination"] }
anyhow = "1.0"
thiserror = "1.0"
structopt = "0.3"
# TODO: should be removed after json rpc deps are updated is updated, current version (14.0) (ZKS-98).
futures01 = { package = "futures", version = "0.1" }
reqwest = { version = "0.10", features = ["blocking", "json"] }
reqwest = { version = "0.11", features = ["blocking", "json"] }
tiny-keccak = "1.4.2"
async-trait = "0.1"
jsonwebtoken = "7"
metrics = "=0.13.0-alpha.8"
metrics = "0.17"
lru-cache = "0.1.2"
once_cell = "1.4"
regex = "1"
Expand Down
3 changes: 1 addition & 2 deletions core/bin/zksync_api/src/api_server/admin_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ async fn run_server(app_state: AppState, bind_to: SocketAddr) {

App::new()
.wrap(auth)
.wrap(vlog::actix_middleware())
.app_data(web::Data::new(app_state.clone()))
.route("/tokens", web::post().to(add_token))
})
Expand All @@ -169,7 +168,7 @@ pub fn start_admin_server(
.name("admin_server".to_string())
.spawn(move || {
let _panic_sentinel = ThreadPanicNotify(panic_notify.clone());
actix_rt::System::new("api-server").block_on(async move {
actix_rt::System::new().block_on(async move {
let app_state = AppState {
secret_auth,
connection_pool,
Expand Down
3 changes: 1 addition & 2 deletions core/bin/zksync_api/src/api_server/event_notify/sub_store.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Storage for subscription objects.
use super::SubscriptionSender;
use futures::{compat::Future01CompatExt, FutureExt};
use std::{cmp::Ord, collections::BTreeMap, str::FromStr};
use zksync_types::{tx::TxHash, AccountId, ActionType, PriorityOpId};

Expand Down Expand Up @@ -53,7 +52,7 @@ where
}

fn send_once(&self, sink: &Sink<RESP>, val: RESP) {
tokio::spawn(sink.notify(Ok(val)).compat().map(drop));
// tokio::spawn(sink.notify(Ok(val)).compat().map(drop));
}

pub fn generate_sub_id(&mut self, action_id: ID, action_type: ActionType) -> SubscriptionId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub async fn submit_request(

pub async fn get_request_by_id(
data: web::Data<ApiForcedExitRequestsData>,
web::Path(request_id): web::Path<ForcedExitRequestId>,
request_id: web::Path<ForcedExitRequestId>,
) -> JsonResult<ForcedExitRequest> {
let start = Instant::now();

Expand All @@ -185,7 +185,7 @@ pub async fn get_request_by_id(
);

let fe_request_from_db = fe_requests_schema
.get_request_by_id(request_id)
.get_request_by_id(*request_id)
.await
.map_err(ApiError::internal)?;

Expand All @@ -199,7 +199,7 @@ pub async fn get_request_by_id(
// existing enough time
pub async fn check_account_eligibility(
data: web::Data<ApiForcedExitRequestsData>,
web::Path(account): web::Path<Address>,
account: web::Path<Address>,
) -> JsonResult<ForcedExitEligibilityResponse> {
let mut storage = data
.connection_pool
Expand All @@ -210,7 +210,7 @@ pub async fn check_account_eligibility(

let eligible = data
.forced_exit_checker
.check_forced_exit(&mut storage, account)
.check_forced_exit(&mut storage, *account)
.await
.map_err(ApiError::from)?;

Expand All @@ -228,7 +228,7 @@ pub fn api_scope(

// `enabled` endpoint should always be there
let scope = web::scope("v0.1")
.data(data)
.app_data(data)
.route("status", web::get().to(get_status));

if config.forced_exit_requests.enabled {
Expand Down Expand Up @@ -474,6 +474,6 @@ pub fn check_address_space_overflow(id: i64, digits_in_id: u8) {

metrics::histogram!(
"forced_exit_requests.address_space_overflow",
exceeding_rate
exceeding_rate as f64
);
}
5 changes: 2 additions & 3 deletions core/bin/zksync_api/src/api_server/rest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ async fn start_server(
v02::api_scope(tx_sender, &api_v01.config)
};
App::new()
.wrap(Cors::new().send_wildcard().max_age(3600).finish())
.wrap(vlog::actix_middleware())
.wrap(Cors::default().send_wildcard().max_age(3600))
.service(api_v01.into_scope())
.service(forced_exit_requests_api_scope)
.service(api_v02_scope)
Expand Down Expand Up @@ -76,7 +75,7 @@ pub(super) fn start_server_thread_detached(
.spawn(move || {
let _panic_sentinel = ThreadPanicNotify(panic_notify.clone());

actix_rt::System::new("api-server").block_on(async move {
actix_rt::System::new().block_on(async move {
let api_v01 = ApiV01::new(connection_pool, contract_address, config.clone());
api_v01.spawn_network_status_updater(panic_notify);

Expand Down
4 changes: 2 additions & 2 deletions core/bin/zksync_api/src/api_server/rest/v01/api_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl ApiV01 {
/// Creates an actix-web `Scope`, which can be mounted to the Http server.
pub fn into_scope(self) -> actix_web::Scope {
web::scope("/api/v0.1")
.data(self)
.app_data(self)
.route("/testnet_config", web::get().to(Self::testnet_config))
.route("/status", web::get().to(Self::status))
.route("/tokens", web::get().to(Self::tokens))
Expand Down Expand Up @@ -233,7 +233,7 @@ impl ApiV01 {
.await
.map_err(|err| {
vlog::warn!("Internal Server Error: '{}'; input: {}", err, *block_id);
HttpResponse::InternalServerError().finish()
H
})?;

if !blocks.is_empty()
Expand Down
Loading

0 comments on commit 401b41d

Please sign in to comment.