diff --git a/tests/integration/test_wallet.py b/tests/integration/test_wallet.py index 0429816..07b1708 100644 --- a/tests/integration/test_wallet.py +++ b/tests/integration/test_wallet.py @@ -187,7 +187,10 @@ def test_prepare_deposit_transaction_token(self): transaction = self.wallet.prepare_deposit_tx( DepositTransaction( - token=l1_address, amount=5, refund_recipient=self.wallet.address, approve_erc20=True + token=l1_address, + amount=5, + refund_recipient=self.wallet.address, + approve_erc20=True, ) ) @@ -805,7 +808,9 @@ def test_withdraw_eth_paymaster(self): paymaster_balance_before = self.zksync.zksync.zks_get_balance(paymaster_address) paymaster_token_balance_before = self.zksync.zksync.zks_get_balance( - paymaster_address, token_address=token_address, block_tag=ZkBlockParams.LATEST + paymaster_address, + token_address=token_address, + block_tag=ZkBlockParams.LATEST, ) sender_balance_before = self.wallet.get_balance() @@ -846,7 +851,9 @@ def test_withdraw_eth_paymaster(self): ) paymaster_balance_after = self.zksync.zksync.zks_get_balance(paymaster_address) paymaster_token_balance_after = self.zksync.zksync.zks_get_balance( - paymaster_address, token_address=token_address, block_tag=ZkBlockParams.LATEST + paymaster_address, + token_address=token_address, + block_tag=ZkBlockParams.LATEST, ) sender_balance_after = self.wallet.get_balance() sender_approval_token_balance_after = self.wallet.get_balance( @@ -857,9 +864,7 @@ def test_withdraw_eth_paymaster(self): self.assertEqual( paymaster_token_balance_after - paymaster_token_balance_before, 1 ) - self.assertEqual( - sender_balance_before - sender_balance_after, amount - ) + self.assertEqual(sender_balance_before - sender_balance_after, amount) self.assertEqual( sender_approval_token_balance_after, sender_approval_token_balance_before - 1, diff --git a/tests/integration/test_zksync_web3.py b/tests/integration/test_zksync_web3.py index ffbd011..6cb6e7d 100644 --- a/tests/integration/test_zksync_web3.py +++ b/tests/integration/test_zksync_web3.py @@ -19,7 +19,12 @@ ADDRESS_DEFAULT, StorageProof, ) -from zksync2.core.utils import pad_front_bytes, to_bytes, pad_back_bytes, L2_BASE_TOKEN_ADDRESS +from zksync2.core.utils import ( + pad_front_bytes, + to_bytes, + pad_back_bytes, + L2_BASE_TOKEN_ADDRESS, +) from zksync2.manage_contracts.contract_encoder_base import ( ContractEncoder, JsonConfiguration, @@ -768,7 +773,6 @@ def test_contract_factory(self): def test_get_all_account_balances(self): balances = self.web3.zksync.zks_get_all_account_balances(self.account.address) - # @skip("Integration test, used for develop purposes only") def test_get_l1_chain_id(self): self.assertIsInstance(self.web3.zksync.zks_l1_chain_id(), int) diff --git a/zksync2/account/wallet_l1.py b/zksync2/account/wallet_l1.py index e61d907..747c493 100644 --- a/zksync2/account/wallet_l1.py +++ b/zksync2/account/wallet_l1.py @@ -1147,8 +1147,12 @@ def finalize_withdrawal(self, withdraw_hash, index: int = 0): nonce=self._eth_web3.eth.get_transaction_count(self.address), ) - shared_bridge_address = self._zksync_web3.zksync.zks_get_bridge_contracts().shared_l1_default_bridge - shared_bridge = self._eth_web3.eth.contract(address=shared_bridge_address, abi=l1_shared_bridge_abi_default()) + shared_bridge_address = ( + self._zksync_web3.zksync.zks_get_bridge_contracts().shared_l1_default_bridge + ) + shared_bridge = self._eth_web3.eth.contract( + address=shared_bridge_address, abi=l1_shared_bridge_abi_default() + ) tx = shared_bridge.functions.finalizeWithdrawal( self._zksync_web3.eth.chain_id, params["l1_batch_number"], @@ -1190,7 +1194,7 @@ def is_withdrawal_finalized(self, withdraw_hash, index: int = 0): abi=l1_shared_bridge_abi_default(), ) - return l1_bridge.functions.isWithdrawalFinalizedShared( + return l1_bridge.functions.isWithdrawalFinalizedShared( self._zksync_web3.eth.chain_id, int(log["l1BatchNumber"], 16), proof.id ).call() diff --git a/zksync2/account/wallet_l2.py b/zksync2/account/wallet_l2.py index 4eb6f1a..bfec180 100644 --- a/zksync2/account/wallet_l2.py +++ b/zksync2/account/wallet_l2.py @@ -94,7 +94,9 @@ def transfer(self, tx: TransferTransaction) -> HexStr: ) if tx.options.gas_limit is None or tx.options.gas_limit == 0: - tx.options.gas_limit = self._zksync_web3.zksync.eth_estimate_gas(tx_fun_call.tx) + tx.options.gas_limit = self._zksync_web3.zksync.eth_estimate_gas( + tx_fun_call.tx + ) tx_712 = tx_fun_call.tx712(tx.options.gas_limit) signer = PrivateKeyEthSigner(self._l1_account, tx.options.chain_id) @@ -119,9 +121,11 @@ def withdraw(self, tx: WithdrawTransaction): tx, from_=self._l1_account.address ) if tx.options.gas_limit is None: - transaction.tx['gas'] = self._zksync_web3.zksync.eth_estimate_gas(transaction.tx) + transaction.tx["gas"] = self._zksync_web3.zksync.eth_estimate_gas( + transaction.tx + ) else: - transaction.tx['gas'] = tx.options.gas_limit + transaction.tx["gas"] = tx.options.gas_limit tx_712 = transaction.tx712() signer = PrivateKeyEthSigner(self._l1_account, self._zksync_web3.eth.chain_id) signed_message = signer.sign_typed_data(tx_712.to_eip712_struct()) diff --git a/zksync2/module/zksync_module.py b/zksync2/module/zksync_module.py index 2047cff..6bb0e76 100644 --- a/zksync2/module/zksync_module.py +++ b/zksync2/module/zksync_module.py @@ -770,7 +770,7 @@ def get_withdraw_transaction( token=tx.token, bridge_address=tx.bridge_address, from_=from_, - paymaster_params=tx.paymaster_params + paymaster_params=tx.paymaster_params, ) return transaction