ApeWorX / ape

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

gas_limit param causes error in 0.5.7 #1176

Closed r4VP4 closed 1 year ago

r4VP4 commented 1 year ago

Environment information

$ ape --version
# 0.5.7

$ ape plugins list
#Installed Plugins:
  polygon      0.5.1a1
  hardhat      0.5.3
  foundry      0.5.2
  vyper        0.5.2
  alchemy      0.5.3
  solidity     0.5.2
  etherscan    0.5.4
$ cat ape-config.yaml
hardhat:
  fork:
    ethereum:
      mainnet:
        upstream_provider: alchemy  

foundry:
  fork:
    ethereum:
      mainnet:
        upstream_provider: alchemy       

ethereum:
  mainnet:
    gas_limit: "max"

What went wrong?

calling a contract in a script with gas_limit parameter

mycontract.mymethod(
   myparam,
   sender=myaccount,
   gas_limit='auto' # or gas_limit=750000 makes no difference
)
ape run my_script --network ethereum:mainnet-fork:foundry
# or
ape run my_script --network ethereum:mainnet-fork:hardhat

leads to the following error

ERROR: (ConversionError) Type 'typing.Union[typing.Literal['auto', 'max'], int, str, NoneType]' must be one of [ChecksumAddress, bytes, int, Decimal, list, tuple].
fubuloubu commented 1 year ago

Taking a stab at this, but think it's originating from here: https://github.com/ApeWorX/ape/blob/main/src/ape/contracts/base.py#L25

r4VP4 commented 1 year ago

i've seen your commits in #1180 but i'm not sure if this is the solution, because i always have the problem if i use the gas_limit parameter. it is not just for 'auto'. sorry for the misleading example.

fubuloubu commented 1 year ago

related: #1220