ApeWorX / ape

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

Issues Deploying on Scroll Alpha testnet [APE-1220] #1557

Closed ControlCplusControlV closed 1 year ago

ControlCplusControlV commented 1 year ago

Environment information

$ ape --version
0.6.13

$ ape plugins list
Installed Plugins:
  etherscan    0.6.7
  solidity     0.6.7
  vyper        0.6.9
$ cat ape-config.yaml
name: Cog
contracts_folder: src

plugins:
  - name: vyper
  - name: solidity

geth:
  scroll:
    uri: https://alpha-rpc.scroll.io/l2

What went wrong?

Ape failed to deploy a contract, when I toyed around with changing tx parameters to EIP-1559 tx I got tx type not supported, so it seems to be related to format

Deployment script snippet

@click.group()
def cli():
    """
    Script for test deployment of CogPair
    """

@cli.command(
    cls=NetworkBoundCommand,
)
@network_option()
def deploy(network):
    colorama_init()

    # Deployer address
    if ':local' in network:
        account = accounts.test_accounts[0]
    else:
        account = accounts.load('alfa')
        account.set_autosign(True)

    kw = {
        'chain_id': project.provider.chain_id,
        'gas_price': project.provider.gas_price,
        'gas_limit': 1_000_000,
        'value': 0,
    }

    deployer = account.deploy(project.Deployer, **kw)

(deployer is not a relevant contract here, occurs with any contract type or interaction

❯ ape run scripts/deploy.py deploy --network https://alpha-rpc.scroll.io/l2
INFO: Connecting to existing Geth node at  https://alpha-rpc.scroll.io/l2.
Enter passphrase to permanently unlock 'alfa':
WARNING: Danger! This account will now sign any transaction it's given.

  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape/_cli.py", line 36, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/click/core.py", line 1657, in
invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape_run/_cli.py", line 74, in
invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/click/core.py", line 1657, in
invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/click/core.py", line 1657, in
invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape/cli/commands.py", line 18, in
invoke
    super().invoke(ctx)
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/click/core.py", line 1404, in
invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/click/core.py", line 760, in
invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/scripts/deploy.py", line 87, in deploy
    deployer = account.deploy(project.Deployer, **kw)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape/api/accounts.py", line 217, in
deploy
    txn = contract(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape/contracts/base.py", line 1282,
in __call__
    return self.constructor.serialize_transaction(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape/contracts/base.py", line 58,
in serialize_transaction
    return self.provider.network.ecosystem.encode_deployment(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape_ethereum/ecosystem.py", line
533, in encode_deployment
    txn = self.create_transaction(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape_ethereum/ecosystem.py", line
624, in create_transaction
    return txn_class(**kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape/api/transactions.py", line 91,
in convert_fees
    return cls.conversion_manager.convert(value, int)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/controlc/Code/Vyper/Cog-Finance-v1/deploy_env/lib/python3.11/site-packages/ape/managers/converters.py", line
354, in convert
    raise ConversionError(f"No conversion registered to handle '{value}'.")

ERROR: (ConversionError) No conversion registered to handle ''.

How can it be fixed?

Fill this in if you have ideas on how the bug could be fixed.

Allow users to specify whether legacy of EIP-1559 tx type directly at deployment time, since this only occurs with Scroll who uses a ~2 year old Geth fork likely lacking some tx types

fubuloubu commented 1 year ago

you can add type=0 to your deployment (or any transaction really) and it should function for any network that doesn't support EIP-1559

but also @theref has a plugin (that may need an update): https://github.com/theref/ape-scroll

ControlCplusControlV commented 1 year ago

Thanks, that fixed it!