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

special character issues when dealing with openzepplin #2088

Closed OliverLaiGHong closed 3 months ago

OliverLaiGHong commented 4 months ago

Environment information

$ ape --version
0.7.19

$ ape plugins list
Installed Plugins
  alchemy      0.7.2
  ens          0.7.1
  etherscan    0.7.2
  foundry      0.7.4
  hardhat      0.7.2
  infura       0.7.3
  polygon      0.7.2
  solidity     0.7.3
  template     0.7.0
  tokens       0.7.1
  vyper        0.7.1
$ cat ape-config.yaml
name: play_ape
plugins:
  - name: polygon
  - name: ape-etherscan
  - name: foundry

default_ecosystem: polygon

polygon:
  default_network: mainnet
  mainnet:
    default_provider: geth

foundry:
  host: auto
  request_timeout: 20
  fork_request_timeout: 600
  fork:
    polygon:
      mainnet:
        upstream_provider: geth

geth:
  polygon:
    mainnet:
      uri: http://localhost:8545

dependencies:
  - name: OpenZeppelin
    github: OpenZeppelin/openzeppelin-contracts
    version: 5.0.1

solidity: 
  version: 0.8.23
  import_remapping:
    - "@openzeppelin=OpenZeppelin/5.0.1"

compile:
  include_dependencies: true

What went wrong?

I tried using solidity v0.8.23 and v0.8.25, and openzepplin v5.0.1 and v5.0.2, i keep getting the special character issues. when I removed everything the needs openzepplin, it got no problems.

Please include information like:

How can it be fixed?

Sorry. I have no idea.

linear[bot] commented 4 months ago

APE-1744 special character issues when dealing with openzepplin

fubuloubu commented 4 months ago

I had noticed that interfaces/IERC4626.sol is using a utf-8 special character for quotes in a comment somewhere, not sure if this is the problem but that file has been like that for 2+ years so I wouldn't think so

OliverLaiGHong commented 4 months ago

@fubuloubu Actually, these utf-8 characters are seen across multiple files. i have tried to remove them but it was proven impractical. however, Ape was able to handle them about a month ago.

antazoey commented 3 months ago

sorry - accidentally closed

antazoey commented 3 months ago

I can reproduce this problem by doing:

path.write_text("“", encoding="latin-1")

so that is why specifying the encoding as utf8 everywhere fixes the problem. (see attached 2 issues)

also - this is no longer a problem in this specific use-case anyway because we are using shutil.copytree() now as of https://github.com/ApeWorX/ape/pull/2123

so this issue will be closed in every way once the 2 attached PRs merge.