From 771f88cb534a856cec4e51213fb15aff6073693e Mon Sep 17 00:00:00 2001 From: petarTxFusion Date: Mon, 22 Apr 2024 16:17:14 +0200 Subject: [PATCH 1/3] test: make `test_full_required_deposit_fee` more flexible --- tests/integration/test_wallet.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/integration/test_wallet.py b/tests/integration/test_wallet.py index a93654a..5037797 100644 --- a/tests/integration/test_wallet.py +++ b/tests/integration/test_wallet.py @@ -240,17 +240,14 @@ def test_deposit_token(self): self.assertGreater(balance_l2_after, balance_l2_beore) def test_full_required_deposit_fee(self): - fee_data = FullDepositFee( - base_cost=285096500000000, - l1_gas_limit=110581, - l2_gas_limit=570193, - max_fee_per_gas=1500000010, - max_priority_fee_per_gas=1500000000, - ) fee = self.wallet.get_full_required_deposit_fee( DepositTransaction(token=ADDRESS_DEFAULT, to=self.wallet.address) ) - self.assertEqual(fee, fee_data) + self.assertTrue(fee.base_cost > 0) + self.assertTrue(fee.l1_gas_limit > 0) + self.assertTrue(fee.l2_gas_limit > 0) + self.assertTrue(fee.max_fee_per_gas > 0) + self.assertTrue(fee.max_priority_fee_per_gas > 0) def test_transfer_eth(self): amount = 7_000_000_000 From 1afdd2ec00a3c40dbf479a541c7e3eb87424fe22 Mon Sep 17 00:00:00 2001 From: petarTxFusion Date: Mon, 22 Apr 2024 16:32:10 +0200 Subject: [PATCH 2/3] chore: lint code --- zksync2/module/zksync_module.py | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/zksync2/module/zksync_module.py b/zksync2/module/zksync_module.py index d0f3958..3bb7983 100644 --- a/zksync2/module/zksync_module.py +++ b/zksync2/module/zksync_module.py @@ -369,12 +369,12 @@ class ZkSync(Eth, ABC): request_formatters=zksync_get_request_formatters, result_formatters=zksync_get_result_formatters, ) - _zks_get_proof: Method[ - Callable[[HexStr, List[HexStr], int], StorageProof] - ] = Method( - zks_get_proof_rpc, - mungers=[default_root_munger], - request_formatters=zksync_get_request_formatters, + _zks_get_proof: Method[Callable[[HexStr, List[HexStr], int], StorageProof]] = ( + Method( + zks_get_proof_rpc, + mungers=[default_root_munger], + request_formatters=zksync_get_request_formatters, + ) ) _zks_estimate_gas_l1_to_l2: Method[Callable[[Transaction], int]] = Method( zks_estimate_gas_l1_to_l2_rpc, @@ -400,12 +400,12 @@ class ZkSync(Eth, ABC): zks_l1_chain_id_rpc, mungers=None ) - _zks_get_all_account_balances: Method[ - Callable[[Address], ZksAccountBalances] - ] = Method( - zks_get_all_account_balances_rpc, - mungers=[default_root_munger], - result_formatters=zksync_get_result_formatters, + _zks_get_all_account_balances: Method[Callable[[Address], ZksAccountBalances]] = ( + Method( + zks_get_all_account_balances_rpc, + mungers=[default_root_munger], + result_formatters=zksync_get_result_formatters, + ) ) _zks_get_bridge_contracts: Method[Callable[[], ZksBridgeAddresses]] = Method( @@ -437,12 +437,12 @@ class ZkSync(Eth, ABC): mungers=[default_root_munger], request_formatters=zksync_get_request_formatters, ) - _eth_get_transaction_receipt: Method[ - Callable[[HexStr], ZksTransactionReceipt] - ] = Method( - eth_get_transaction_receipt_rpc, - mungers=[default_root_munger], - result_formatters=zksync_get_result_formatters, + _eth_get_transaction_receipt: Method[Callable[[HexStr], ZksTransactionReceipt]] = ( + Method( + eth_get_transaction_receipt_rpc, + mungers=[default_root_munger], + result_formatters=zksync_get_result_formatters, + ) ) _eth_get_transaction_by_hash: Method[Callable[[HexStr], ZksTransactions]] = Method( eth_get_transaction_by_hash_rpc, @@ -457,9 +457,9 @@ class ZkSync(Eth, ABC): Callable[[Address], ContractSourceDebugInfo] ] = Method(zks_get_contract_debug_info_rpc, mungers=[default_root_munger]) - _zks_get_transaction_trace: Method[ - Callable[[Address], ZksTransactionTrace] - ] = Method(zks_get_transaction_trace_rpc, mungers=[default_root_munger]) + _zks_get_transaction_trace: Method[Callable[[Address], ZksTransactionTrace]] = ( + Method(zks_get_transaction_trace_rpc, mungers=[default_root_munger]) + ) _zks_get_testnet_paymaster_address: Method[Callable[[], HexStr]] = Method( zks_get_testnet_paymaster_address, mungers=[default_root_munger] From 0f10c63902c00c8f8fec89207f61ea69ceb10566 Mon Sep 17 00:00:00 2001 From: petarTxFusion Date: Wed, 24 Apr 2024 14:53:33 +0200 Subject: [PATCH 3/3] test: remove`test_get_token_price` --- tests/integration/test_zksync_web3.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/integration/test_zksync_web3.py b/tests/integration/test_zksync_web3.py index 44b7aee..e502516 100644 --- a/tests/integration/test_zksync_web3.py +++ b/tests/integration/test_zksync_web3.py @@ -768,10 +768,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_token_price(self): - price = self.web3.zksync.zks_get_token_price(self.ETH_TOKEN.l2_address) - # @skip("Integration test, used for develop purposes only") def test_get_l1_chain_id(self): l1_chain_id = self.web3.zksync.zks_l1_chain_id()