nucypher / nucypher-contracts

Ethereum contracts supporting TACo applications on the Threshold Network.
17 stars 11 forks source link

Gas estimation failed when deploying TransparentUpgradeableProxy on Matic #17

Open cygnusv opened 2 years ago

cygnusv commented 2 years ago
  File "brownie/_cli/run.py", line 50, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/deploy_subscription_manager.py", line 27, in main
    transparent_proxy = oz.TransparentUpgradeableProxy.deploy(
  File "brownie/network/contract.py", line 528, in __call__
    return tx["from"].deploy(
  File "brownie/network/account.py", line 510, in deploy
    receipt, exc = self._make_transaction(
  File "brownie/network/account.py", line 727, in _make_transaction
    raise VirtualMachineError(e) from None
  File "brownie/exceptions.py", line 121, in __init__
    raise ValueError(str(exc)) from None
ValueError: Gas estimation failed: 'execution reverted: ERC1967: new implementation is not a contract'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
cygnusv commented 2 years ago

For context, I was running the script on interactive mode: david@Davids-MacBook-Pro nucypher-contracts % brownie run scripts/deploy_subscription_manager.py main TDev --interactive --network polygon-main

This allowed me to continue with an interactive prompt, regardless if the script succeeds or fails. In this case, I just tried again with the line that failed:

...
ValueError: Gas estimation failed: 'execution reverted: ERC1967: new implementation is not a contract'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.

Interactive mode enabled. Use quit() to close.
>>> transparent_proxy = oz.TransparentUpgradeableProxy.deploy(
        subscription_manager_logic.address,
        proxy_admin.address,
        calldata,
        {'from': deployer})
Transaction sent: 0x9c1a34065d509de444224658b1bd34490ca5f1363a3b7ba57627a4d4f035c4d1
  Gas price: 30.069999976 gwei   Gas limit: 790043   Nonce: 2
  File "<console>", line 1, in <module>
  File "brownie/network/contract.py", line 528, in __call__
    return tx["from"].deploy(
  File "brownie/network/account.py", line 510, in deploy
    receipt, exc = self._make_transaction(
  File "brownie/network/account.py", line 776, in _make_transaction
    receipt = self._await_confirmation(receipt, required_confs, gas_strategy, gas_iter)
  File "brownie/network/account.py", line 818, in _await_confirmation
    raise TransactionError(f"Tx dropped without known replacement: {receipt.txid}")
TransactionError: Tx dropped without known replacement: 0x9c1a34065d509de444224658b1bd34490ca5f1363a3b7ba57627a4d4f035c4d1

This time the TX was sent, but then it reports that the TX got dropped. This is however incorrect, since the TX indeed went through (see https://polygonscan.com/tx/0x9c1a34065d509de444224658b1bd34490ca5f1363a3b7ba57627a4d4f035c4d1).

I suspect both errors are related to TX finality somehow. Need to check brownie code to see if there are ways to introduce delays or waiting for some number of confirmations