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

Config Override doesn't function in some scenarios [APE-1197] #1544

Closed fubuloubu closed 1 year ago

fubuloubu commented 1 year ago

Environment information

$ ape --version
0.6.13

$ ape plugins list
Installed Plugins:
  foundry      0.6.12
  solidity     0.6.7
  vyper        0.6.9
  alchemy      0.6.2
  template     0.6.1
  etherscan    0.6.7
$ cat ape-config.yaml
dependencies:
  - name: snekmate
    github: pcaversaccio/snekmate
    version: 0.0.2
    compiler_settings:
      # NOTE: This is not being respected
      vyper:
        evm_version: paris

What went wrong?

  1. Run anvil pre-Shanghai: $ anvil --hardfork paris (Because PUSH0 is not active yet)
  2. Run $ ape console --network ::foundry:
INFO: Connecting to existing 'anvil' process.

In [1]: a = accounts.test_accounts[0]

In [2]: c = a.deploy(project.dependencies["snekmate"]["0.0.2"].Math)
...  # Compiling snekmate
INFO: Confirmed 0x1b6bff45c9903cef46dcdaa438afd728ccf369c1bdbf6d3c43eb4cd514b80b97 (total fees paid = 0)
SUCCESS: Contract 'Math' deployed to: 0x274b028b03A250cA03644E6c578D81f019eE1323

In [3]: c.log_256(2**128, True)
ERROR: (VirtualMachineError) EVM error NotActivated

How can it be fixed?

It could just not work when dynamically compiling vs. ape compile/ape pm

antazoey commented 1 year ago

if it was previously compiled, it does not know to re-compile

antazoey commented 1 year ago

note if you do:

foundry:
  evm_version: paris

it should start foundry on that evm version instead of having to run it separately

antazoey commented 1 year ago

I was not able to reproduce. Everything is functioning correctly for me. Perhaps because I did not already have it compiled?

You need to force a recompile to get the changes!

antazoey commented 1 year ago

somehow need to check against cached compiler settings and stuff to know to automatically recompile, it is easier to just force a re-compile in this case.

antazoey commented 1 year ago

I feel we should close this issue, or change it, because config override works just fine, it just doesnt know it needs to recompile... Otherwise I am misunderstanding and need additional info because everything is working great for me.