From 57b99d4fc906ae7ab5532ea23a069b34a2ee7c02 Mon Sep 17 00:00:00 2001 From: Danil Date: Thu, 26 Sep 2024 22:43:12 +0200 Subject: [PATCH] fix(zk_toolbox): Do not panic if mint is not successful (#2973) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Use governor for minting process and do not panic if minting is not successful ## Why ❔ ## Checklist - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. Signed-off-by: Danil --- zk_toolbox/crates/common/src/ethereum.rs | 15 +++++++-------- .../zk_inception/src/commands/chain/common.rs | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/zk_toolbox/crates/common/src/ethereum.rs b/zk_toolbox/crates/common/src/ethereum.rs index 4f000ed0fd5..33caaad9789 100644 --- a/zk_toolbox/crates/common/src/ethereum.rs +++ b/zk_toolbox/crates/common/src/ethereum.rs @@ -10,7 +10,7 @@ use ethers::{ }; use types::TokenInfo; -use crate::wallets::Wallet; +use crate::{logger, wallets::Wallet}; pub fn create_ethers_client( private_key: H256, @@ -103,13 +103,12 @@ pub async fn mint_token( let mut pending_txs = vec![]; for call in &pending_calls { - pending_txs.push( - call.send() - .await? - // It's safe to set such low number of confirmations and low interval for localhost - .confirmations(3) - .interval(Duration::from_millis(30)), - ); + let call = call.send().await; + match call { + // It's safe to set such low number of confirmations and low interval for localhost + Ok(call) => pending_txs.push(call.confirmations(3).interval(Duration::from_millis(30))), + Err(e) => logger::error(format!("Minting is not successful {e}")), + } } futures::future::join_all(pending_txs).await; diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/common.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/common.rs index ec70d6122d2..0aabc16154e 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/common.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/common.rs @@ -111,7 +111,7 @@ pub async fn mint_base_token( let amount = AMOUNT_FOR_DISTRIBUTION_TO_WALLETS * base_token.nominator as u128 / base_token.denominator as u128; common::ethereum::mint_token( - wallets.operator, + wallets.governor, base_token.address, addresses, l1_rpc_url,