I loaded an active account on the Avalanche fuji testnet with 1.9 avax. I had a contract that I was able to deploy locally. Here is the sequence of events:
Locally this worked and the contract was successfully deployed. I then started ape trying to upload a contract to Fuji testnet.
The previous command failed with the following traceback: (I'm including successful DEBUG lines too)
DEBUG: Making request. Method: eth_getTransactionCount
DEBUG: Making request HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_getTransactionCount
DEBUG: Getting response HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_getTransactionCount, Response: {'jsonrpc': '2.0', 'id': 7, 'result': '0x4'}
DEBUG: Making request. Method: eth_maxPriorityFeePerGas
DEBUG: Making request HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_maxPriorityFeePerGas
DEBUG: Getting response HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_maxPriorityFeePerGas, Response: {'jsonrpc': '2.0', 'id': 8, 'result': '0x0'}
DEBUG: Making request. Method: eth_getBlockByNumber
DEBUG: Making request HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_getBlockByNumber
DEBUG: Getting response HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_getBlockByNumber, Response: {'jsonrpc': '2.0', 'id': 9, 'result': {'baseFeePerGas': '0x5d21dba00', 'blockExtraData': '0x', 'blockGasCost': '0x0', 'difficulty': '0x1', 'extDataGasUsed': '0x0', 'extDataHash': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', 'extraData': '0x00000000000c8c400000000000000000000000000016dfca0000000000000000000000000000000000000000000000000000000000036a46000000000000000000000000000000000000000000000000', 'gasLimit': '0xe4e1c0', 'gasUsed': '0x164aa', 'hash': '0xc70b77b747f44729657d10fd79c65d7688b0972234140c643ecd8e1d738d6687', 'logsBloom': '0x00000000000000000000000002100000000100000000080000000000020000000000000000004000000000000000000000000000000000000000000000000000000000000000000000008000000000000020000000000000200200000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 'miner': '0x0100000000000000000000000000000000000000', 'mixHash': '0x0000000000000000000000000000000000000000000000000000000000000000', 'nonce': '0x0000000000000000', 'number': '0x16c599d', 'parentHash': '0xa371025a9a666fd933149f8476d814b64778ad941259c37e9fce8b010edba2fe', 'receiptsRoot': '0x77dc911449e0a8288a573b30201b5a6fcbf6bd4551963d4f57b5a84ad25e4c7a', 'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', 'size': '0x5d4', 'stateRoot': '0xf964f2d921607f50ebdfefc15d2b61e7a51287500ac7d91910490c0326772ce4', 'timestamp': '0x64a706ad', 'totalDifficulty': '0x16c599d', 'transactions': ['0x1db44d5568278ae970183961696085aaeabe0ec2209161cb72dfa29483838e2f'], 'transactionsRoot': '0xb2d0563601d7d0a10d1938b378b1cc47f90fcb4daa90cdaf22c5811e5024b5e7', 'uncles': []}}
DEBUG: Making request. Method: eth_feeHistory
DEBUG: Making request HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_feeHistory
DEBUG: Getting response HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_feeHistory, Response: {'jsonrpc': '2.0', 'id': 10, 'result': {'oldestBlock': '0x16c599d', 'baseFeePerGas': ['0x5d21dba00'], 'gasUsedRatio': [0.006087066666666667]}}
DEBUG: Not enough fee_history. Defaulting less-accurate approach.
DEBUG: Making request. Method: eth_getBlockByNumber
DEBUG: Making request HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_getBlockByNumber
DEBUG: Getting response HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_getBlockByNumber, Response: {'jsonrpc': '2.0', 'id': 11, 'result': {'baseFeePerGas': '0x5d21dba00', 'blockExtraData': '0x', 'blockGasCost': '0x0', 'difficulty': '0x1', 'extDataGasUsed': '0x0', 'extDataHash': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', 'extraData': '0x00000000000c8c400000000000000000000000000016dfca0000000000000000000000000000000000000000000000000000000000036a46000000000000000000000000000000000000000000000000', 'gasLimit': '0xe4e1c0', 'gasUsed': '0x164aa', 'hash': '0xc70b77b747f44729657d10fd79c65d7688b0972234140c643ecd8e1d738d6687', 'logsBloom': '0x00000000000000000000000002100000000100000000080000000000020000000000000000004000000000000000000000000000000000000000000000000000000000000000000000008000000000000020000000000000200200000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 'miner': '0x0100000000000000000000000000000000000000', 'mixHash': '0x0000000000000000000000000000000000000000000000000000000000000000', 'nonce': '0x0000000000000000', 'number': '0x16c599d', 'parentHash': '0xa371025a9a666fd933149f8476d814b64778ad941259c37e9fce8b010edba2fe', 'receiptsRoot': '0x77dc911449e0a8288a573b30201b5a6fcbf6bd4551963d4f57b5a84ad25e4c7a', 'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', 'size': '0x5d4', 'stateRoot': '0xf964f2d921607f50ebdfefc15d2b61e7a51287500ac7d91910490c0326772ce4', 'timestamp': '0x64a706ad', 'totalDifficulty': '0x16c599d', 'transactions': ['0x1db44d5568278ae970183961696085aaeabe0ec2209161cb72dfa29483838e2f'], 'transactionsRoot': '0xb2d0563601d7d0a10d1938b378b1cc47f90fcb4daa90cdaf22c5811e5024b5e7', 'uncles': []}}
DEBUG: Making request. Method: eth_estimateGas
DEBUG: Making request. Method: eth_chainId
DEBUG: Making request HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_chainId
DEBUG: Getting response HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_chainId, Response: {'result': '0xa869', 'id': 12, 'jsonrpc': '2.0'}
DEBUG: Making request HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_estimateGas
DEBUG: Getting response HTTP. URI: https://api.avax-test.network/ext/bc/C/rpc, Method: eth_estimateGas, Response: {'jsonrpc': '2.0', 'id': 13, 'error': {'code': -32000, 'message': 'invalid opcode: PUSH0'}}
ERROR: (TransactionError) Traceback (most recent call last):
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/api/providers.py", line 817, in estimate_gas_cost
return self.web3.eth.estimate_gas(txn_params, block_identifier=block_id)
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/web3/eth/eth.py", line 292, in estimate_gas
return self._estimate_gas(transaction, block_identifier)
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/web3/module.py", line 68, in caller
result = w3.manager.request_blocking(
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/web3/manager.py", line 232, in request_blocking
return self.formatted_response(
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/web3/manager.py", line 205, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'invalid opcode: PUSH0'}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-e66b3a4103cc>", line 1, in <module>
contract = a.deploy(project.erc721)
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/api/accounts.py", line 219, in deploy
receipt = contract._cache_wrap(lambda: self.call(txn, **kwargs))
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/contracts/base.py", line 1325, in _cache_wrap
return function()
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/api/accounts.py", line 219, in <lambda>
receipt = contract._cache_wrap(lambda: self.call(txn, **kwargs))
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/api/accounts.py", line 112, in call
txn = self.prepare_transaction(txn)
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/api/accounts.py", line 304, in prepare_transaction
txn = self.provider.prepare_transaction(txn)
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/api/providers.py", line 1285, in prepare_transaction
txn.gas_limit = self.estimate_gas_cost(txn)
File "/Users/hankbirkdale/.local/share/virtualenvs/sc_learn-y1B6Fsfv/lib/python3.8/site-packages/ape/api/providers.py", line 827, in estimate_gas_cost
raise TransactionError(
ape.exceptions.TransactionError: Gas estimation failed: '(-32000) invalid opcode: PUSH0'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.