ApeWorX / ape

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
https://apeworx.io
Apache License 2.0
889 stars 131 forks source link

[BUG] Transaction failed on polygon Mumbai testnet #1947

Open bayou020 opened 8 months ago

bayou020 commented 8 months ago

Environment information

$ ape plugins list alchemy 0.7.1 arbitrum 0.7.2 etherscan 0.7.1 foundry 0.7.3 ganache 0.7.0 infura 0.7.1 polygon 0.7.1 solidity 0.7.1 tenderly 0.7.0b0 tokens 0.7.1


- Contents of your `ape-config.yaml` (NOTE: do not post anything private like RPC urls or secrets!):

```sh
$ cat ape-config.yaml

What went wrong?

Please include information like:

In [1]: admin=ape.accounts.load("test")

In [2]: fr_proxy='0x56Ba15587243c67E2A500a06839D81bC8d4949E9'

In [3]: farmId='Demeter Uni V3 Farm Deployer'

In [4]: uniV3Factory='0x1F98431c8aD98523631AE4a59f267346ea31F984'

In [5]: nfpm='0xC36442b4a4522E871399CD717aBDD847Ab11FE88'

In [6]: uni_utils='0xBcA67BAd52F90F4A461C27bd5FBd77b9A2329b89'

In [7]: nfpm_utils='0xb97FB0dD108C0882C3A556de37376E17c0587401'

In [8]: tx=admin.deploy(project.UniV3FarmDeployer, fr_proxy,farmId,uniV3Factory,nfpm,uni_utils,nfpm_utils) DEBUG: Making request. Method: eth_getTransactionCount DEBUG: Making request HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_getTransactionCount DEBUG: Getting response HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_getTransactionCount, Response: {'jsonrpc': '2.0', 'id': 1, 'result': '0x8'} DEBUG: Making request. Method: eth_maxPriorityFeePerGas DEBUG: Making request HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_maxPriorityFeePerGas DEBUG: Getting response HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_maxPriorityFeePerGas, Response: {'jsonrpc': '2.0', 'id': 2, 'result': '0x6c67ec300'} DEBUG: Making request. Method: eth_getBlockByNumber DEBUG: Making request HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_getBlockByNumber DEBUG: Getting response HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_getBlockByNumber, Response: {'jsonrpc': '2.0', 'id': 3, 'result': {'baseFeePerGas': '0xf', 'difficulty': '0x6', 'extraData': '0xd88301020683626f7289676f312e32302e3134856c696e757800000000000000c880c6c0c180c0c0c0352fe95938b5873603de4b1d38706eafead3c46baa3a8a938689115e583233ba56831ce13772325d5d437955a274bc2f226060e3053b79a3b2e67410d9a6e81800', 'gasLimit': '0x1c54e64', 'gasUsed': '0xc5db3', 'hash': '0x21fca0ba70bed6f0b5f4c4d70cddd6ec6c67434f4b323d1f063b0f20391d8053', 'logsBloom': '0x0000000000800002000800000010800800010000202200c000000600000080000000040020000002000100100800000000008000084000000800000800001001000000010000000040000010000000800000024000000100000100800000004080000010000040001008080000000904000000000010000080000000002000000004000000000000000481800000000010000200000080000000000000000001200800000008000000000000000000000020000000000000000080001000104000000000000000000001000008000000000000000008040000500040000000504000000000000200000000000000000008000000000000000000000000100000', 'miner': '0x0000000000000000000000000000000000000000', 'mixHash': '0x0000000000000000000000000000000000000000000000000000000000000000', 'nonce': '0x0000000000000000', 'number': '0x2c89259', 'parentHash': '0x975a94abe5533425ca70b20c1d17ae26d6dd16f4fb43d4477db9d54b6227fc4d', 'receiptsRoot': '0x87ca2aeb135607b2d7f516b038f46f0908838c9f271f7d069e7df02e39c0b152', 'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', 'size': '0xddc', 'stateRoot': '0x46a8b157a29039d20d4e18c7f7b353ee3127d8b05080658d4f87e50233402723', 'timestamp': '0x65e76af3', 'totalDifficulty': '0x111661f1', 'transactions': ['0xfb8e2b0f63db0d5d2731cc191b0c5665c01e333616c21d7200f053c586c36f22', '0x2363f1deda5ae5ded882eac6e65cca4b5e074d108202ded8c9a0bca9b16d8e8a', '0xd042bc27901b42fd9047b42fd4805edadb3001aecd0baa218b0498c4a3de42b7', '0xc0614a3871025105e32d8b5175ba8e82f6b09607d7e7823d9b615e4e6c1c2458', '0xdef556274834234673158c85d07d3b2c2989fe72a72e81cd979951f5166dc5fb'], 'transactionsRoot': '0x4910c9fd496d9c6acdc445011aaf298603d602fc770c5bb87ed980cc8d00f987', 'uncles': []}} DEBUG: Making request. Method: eth_feeHistory DEBUG: Making request HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_feeHistory DEBUG: Getting response HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_feeHistory, Response: {'jsonrpc': '2.0', 'id': 4, 'result': {'oldestBlock': '0x2c89259', 'baseFeePerGas': ['0xf', '0xf'], 'gasUsedRatio': [0.027279600870826308]}} DEBUG: Making request. Method: eth_estimateGas DEBUG: Making request. Method: eth_chainId DEBUG: Making request HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_chainId DEBUG: Getting response HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_chainId, Response: {'jsonrpc': '2.0', 'id': 5, 'result': '0x13881'} DEBUG: Making request HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_estimateGas DEBUG: Getting response HTTP. URI: https://polygon-mumbai.g.alchemy.com/[hidden] Method: eth_estimateGas, Response: {'jsonrpc': '2.0', 'id': 6, 'error': {'code': -32000, 'message': 'execution reverted'}} ERROR: (ContractLogicError) Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/ape_ethereum/provider.py", line 249, in estimate_gas_cost return self.web3.eth.estimate_gas(txn_params, block_identifier=block_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/web3/eth/eth.py", line 312, in estimate_gas return self._estimate_gas(transaction, block_identifier) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/web3/module.py", line 75, in caller result = w3.manager.request_blocking( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/web3/manager.py", line 326, in request_blocking return self.formatted_response( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/web3/manager.py", line 287, in formatted_response apply_error_formatters(error_formatters, response) File "/opt/homebrew/lib/python3.11/site-packages/web3/manager.py", line 104, in apply_error_formatters formatted_resp = pipe(response, error_formatters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe File "/opt/homebrew/lib/python3.11/site-packages/web3/_utils/error_formatters_utils.py", line 165, in raise_contract_logic_error_on_revert raise ContractLogicError("execution reverted", data=data) web3.exceptions.ContractLogicError: execution reverted

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in tx=admin.deploy(project.UniV3FarmDeployer, fr_proxy,farmId,uniV3Factory,nfpm,uni_utils,nfpm_utils) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/ape/api/accounts.py", line 252, in deploy receipt = contract._cache_wrap(lambda: self.call(txn, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/ape/contracts/base.py", line 1397, in _cache_wrap return function() ^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/ape/api/accounts.py", line 252, in receipt = contract._cache_wrap(lambda: self.call(txn, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/ape/api/accounts.py", line 125, in call txn = self.prepare_transaction(txn) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/ape/api/accounts.py", line 357, in prepare_transaction txn = self.provider.prepare_transaction(txn) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/ape_ethereum/provider.py", line 861, in prepare_transaction gas = self.estimate_gas_cost(txn) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/ape_ethereum/provider.py", line 256, in estimate_gas_cost raise tx_error from err ape.exceptions.ContractLogicError: Transaction failed.



### How can it be fixed?

I ran the same deployement on foundry fork and the deployement has passed, maybe it's related to a gas estimation error
linear[bot] commented 8 months ago

APE-1696 [BUG] Transaction failed on polygon Mumbai testnet

fubuloubu commented 8 months ago

@bayou020 what does the constructor for UniV3FarmDeployer look like?

bayou020 commented 8 months ago
        address _farmRegistry,
        string memory _farmId,
        address _uniV3Factory,
        address _nfpm,
        address _uniswapUtils,
        address _nfpmUtils
    ) FarmDeployer(_farmRegistry, _farmId) {
        _validateNonZeroAddr(_uniV3Factory);
        _validateNonZeroAddr(_nfpm);
        _validateNonZeroAddr(_uniswapUtils);
        _validateNonZeroAddr(_nfpmUtils);

        UNI_V3_FACTORY = _uniV3Factory;
        NFPM = _nfpm;
        UNISWAP_UTILS = _uniswapUtils;
        NFPM_UTILS = _nfpmUtils;
        farmImplementation = address(new UniV3Farm());
    }

@fubuloubu

fubuloubu commented 8 months ago

how about the constructor for FarmDeployer?

antazoey commented 7 months ago

how about the constructor for FarmDeployer?

Did we ever figure this out? I have gotten issues like this when using dynamic types in a ctor before others

fubuloubu commented 7 months ago

how about the constructor for FarmDeployer?

Did we ever figure this out? I have gotten issues like this when using dynamic types in a ctor before others

No, I was trying to track down what the constructor of FarmDeployer looks like, couldn't find @bayou020's code to do a deeper dive