Skip to content

Commit

Permalink
Merge branch 'dev' into popzxc-rust-zksync-abi
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc authored Nov 13, 2020
2 parents a446913 + a99b90a commit 017ebf5
Show file tree
Hide file tree
Showing 66 changed files with 2,232 additions and 757 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion core/bin/data_restore/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl ContractsConfig {
async fn main() {
log::info!("Restoring zkSync state from the contract");
env_logger::init();
let connection_pool = ConnectionPool::new(Some(1)).await;
let connection_pool = ConnectionPool::new(Some(1));
let config_opts = ConfigurationOptions::from_env();

let opt = Opt::from_args();
Expand Down
2 changes: 1 addition & 1 deletion core/bin/server/examples/generate_exit_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async fn main() {

let timer = Instant::now();
log::info!("Restoring state from db");
let connection_pool = ConnectionPool::new(Some(1)).await;
let connection_pool = ConnectionPool::new(Some(1));
let mut storage = connection_pool
.access_storage()
.await
Expand Down
2 changes: 1 addition & 1 deletion core/bin/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn main() -> anyhow::Result<()> {
// It's a `ServerCommand::Launch`, perform the usual routine.
log::info!("Running the zkSync server");

let connection_pool = ConnectionPool::new(None).await;
let connection_pool = ConnectionPool::new(None);
let config_options = ConfigurationOptions::from_env();
let prover_options = ProverOptions::from_env();

Expand Down
8 changes: 7 additions & 1 deletion core/bin/zksync_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ keywords = ["blockchain", "zksync"]
categories = ["cryptography"]
publish = false # We don't want to publish our binaries.

[features]
default = []
api_test = []

[dependencies]
zksync_types = { path = "../../lib/types", version = "1.0" }
zksync_storage = { path = "../../lib/storage", version = "1.0" }
Expand Down Expand Up @@ -53,8 +57,10 @@ thiserror = "1.0"
futures01 = { package = "futures", version = "0.1" }
reqwest = { version = "0.10", features = ["blocking", "json"] }
tiny-keccak = "1.4.2"
async-trait = "0.1.31"
async-trait = "0.1"
jsonwebtoken = "7"

lru-cache = "0.1.2"

[dev-dependencies]
zksync_test_account = { path = "../../tests/test_account" }
3 changes: 3 additions & 0 deletions core/bin/zksync_api/src/api_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
//! `mod rpc_server` - JSON rpc via HTTP (for request reply functions)
//! `mod rpc_subscriptions` - JSON rpc via WebSocket (for request reply functions and subscriptions)
// Public uses
pub use rest::v1;

// External uses
use futures::channel::mpsc;
// Workspace uses
Expand Down
10 changes: 10 additions & 0 deletions core/bin/zksync_api/src/api_server/rest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,25 @@ use self::v01::api_decl::ApiV01;

mod helpers;
mod v01;
pub mod v1;

async fn start_server(api_v01: ApiV01, bind_to: SocketAddr) {
let logger_format = crate::api_server::loggers::rest::get_logger_format();

HttpServer::new(move || {
let api_v01 = api_v01.clone();

let api_v1_scope = {
let pool = api_v01.connection_pool.clone();
let env_options = api_v01.config_options.clone();
v1::api_scope(pool, env_options)
};

App::new()
.wrap(middleware::Logger::new(&logger_format))
.wrap(Cors::new().send_wildcard().max_age(3600).finish())
.service(api_v01.into_scope())
.service(api_v1_scope)
// Endpoint needed for js isReachable
.route(
"/favicon.ico",
Expand Down
Loading

0 comments on commit 017ebf5

Please sign in to comment.