Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless committed Dec 7, 2021
1 parent 02e30c7 commit f936be8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Built-in uses
use std::collections::HashMap;
use std::{collections::HashMap, iter::FromIterator};

// External uses
use futures::{FutureExt, StreamExt};
Expand Down Expand Up @@ -46,16 +46,15 @@ fn get_call_with_ip_if_needed(
ip: Option<String>,
) -> jsonrpc_core::MethodCall {
// Methods, which should have the information about the ip appended to them
let mut methods_with_ip: HashMap<&'static str, MethodWithIpDescription> = HashMap::new();

// Unfortunately at this moment the compiler from the CI does not support creating HashMap from iterator/array
methods_with_ip.insert("tx_submit", MethodWithIpDescription::new(1, 4));
methods_with_ip.insert("submit_txs_batch", MethodWithIpDescription::new(1, 3));
methods_with_ip.insert("get_tx_fee", MethodWithIpDescription::new(3, 4));
methods_with_ip.insert(
"get_txs_batch_fee_in_wei",
MethodWithIpDescription::new(3, 4),
);
let methods_with_ip: HashMap<&'static str, MethodWithIpDescription> = HashMap::from_iter([
("tx_submit", MethodWithIpDescription::new(1, 4)),
("submit_txs_batch", MethodWithIpDescription::new(1, 3)),
("get_tx_fee", MethodWithIpDescription::new(3, 4)),
(
"get_txs_batch_fee_in_wei",
MethodWithIpDescription::new(3, 4),
),
]);

let description = methods_with_ip.get(call.method.as_str());
let description = if let Some(desc) = description {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/storage/src/misc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::{QueryResult, StorageProcessor};

pub mod records;

/// Tokens schema handles the `tokens` table, providing methods to
/// get and store new tokens.
/// MiscSchema should be used for various features not directly related to the main zkSync functionality
/// Please, use this schema if your functionality needs 1-3 methods. Otherwise, it should have a dedicated schema
#[derive(Debug)]
pub struct MiscSchema<'a, 'c>(pub &'a mut StorageProcessor<'c>);

Expand Down

0 comments on commit f936be8

Please sign in to comment.