Skip to content

Commit

Permalink
Merge branch 'sb-add-no-2fa-accounts' of https://github.com/matter-la…
Browse files Browse the repository at this point in the history
…bs/zksync-dev into sb-add-no-2fa-accounts
  • Loading branch information
StanislavBreadless committed Aug 17, 2021
2 parents 78f8842 + 602c7bd commit e44f2f6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/bin/zksync_core/src/mempool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,24 @@ impl MempoolBlocksHandler {
vlog::debug!("Proposed txs for block: {:?}", txs);
}
metrics::histogram!("mempool.propose_new_block", start.elapsed());

for pr_op in &priority_ops {
let labels = vec![
("name", pr_op.data.variance_name()),
("token", pr_op.data.token_id().to_string()),
];
metrics::increment_counter!("mempool.transactions_count", &labels)
}

for tx_variant in &txs {
for tx in tx_variant.get_transactions() {
let labels = vec![
("name", tx.tx.variance_name()),
("token", tx.tx.token_id().to_string()),
];
metrics::increment_counter!("mempool.transactions_count", &labels)
}
}
ProposedBlock { priority_ops, txs }
}

Expand Down
7 changes: 7 additions & 0 deletions core/lib/types/src/priority_ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ impl ZkSyncPriorityOp {
deposits_data.resize(n as usize, Vec::new());
(n, deposits_data)
}

pub fn variance_name(&self) -> String {
match self {
ZkSyncPriorityOp::Deposit(_) => "Deposit".to_string(),
ZkSyncPriorityOp::FullExit(_) => "FullExit".to_string(),
}
}
}

/// Priority operation description with the metadata required for server to process it.
Expand Down
13 changes: 13 additions & 0 deletions core/lib/types/src/tx/zksync_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,17 @@ impl ZkSyncTx {
ZkSyncTx::WithdrawNFT(tx) => tx.time_range.valid_from,
}
}

pub fn variance_name(&self) -> String {
match self {
ZkSyncTx::Transfer(_) => "Transfer".to_string(),
ZkSyncTx::Withdraw(_) => "Withdraw".to_string(),
ZkSyncTx::Close(_) => "Close".to_string(),
ZkSyncTx::ChangePubKey(_) => "ChangePubKey".to_string(),
ZkSyncTx::ForcedExit(_) => "ForcedExit".to_string(),
ZkSyncTx::MintNFT(_) => "MintNFT".to_string(),
ZkSyncTx::Swap(_) => "Swap".to_string(),
ZkSyncTx::WithdrawNFT(_) => "WithdrawNFT".to_string(),
}
}
}

0 comments on commit e44f2f6

Please sign in to comment.