Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zkSync foundry break the original foundry #335

Open
2 tasks done
ChiHaoLu opened this issue Apr 23, 2024 · 3 comments
Open
2 tasks done

zkSync foundry break the original foundry #335

ChiHaoLu opened this issue Apr 23, 2024 · 3 comments
Labels
compiler Issues specific to compiling

Comments

@ChiHaoLu
Copy link

ChiHaoLu commented Apr 23, 2024

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (c47f5db 2024-04-12T10:12:34.747563000Z)

What command(s) is the bug in?

yarn forge:simulate scripts/deploy/deploy-fiat-token.s.sol --rpc-url testnet

Operating System

macOS (Apple Silicon)

Describe the bug

When I compile the contracts with foundry without zkSync flag, my forge still compiles with zkSync and produce zkout.

I meet the error with below log:

yarn forge:simulate scripts/deploy/deploy-fiat-token.s.sol --rpc-url testnet
yarn run v1.22.19
warning ../../../package.json: No license field
$ forge script -vv --gas-estimate-multiplier $(dotenv -p GAS_MULTIPLIER) scripts/deploy/deploy-fiat-token.s.sol --rpc-url testnet
[⠢] Compiling...
[⠔] Compiling 10 files with 0.6.12
[⠒] Solc 0.6.12 finished in 3.41s
Compiler run successful with warnings:
Warning (3628): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
contracts/upgradeability/AdminUpgradeabilityProxy.sol:31:1: Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
^ (Relevant source part starts here and spans across multiple lines).
contracts/upgradeability/Proxy.sol:35:5: The payable fallback function is defined here.
    fallback() external payable {
    ^ (Relevant source part starts here and spans across multiple lines).
Warning (3628): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
contracts/v1/FiatTokenProxy.sol:29:1: Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
contract FiatTokenProxy is AdminUpgradeabilityProxy {
^ (Relevant source part starts here and spans across multiple lines).
contracts/upgradeability/Proxy.sol:35:5: The payable fallback function is defined here.
    fallback() external payable {
    ^ (Relevant source part starts here and spans across multiple lines).
Warning (2018): Function state mutability can be restricted to pure
contracts/v2/FiatTokenV2_2.sol:195:5: Warning: Function state mutability can be restricted to pure
    function _chainId() internal virtual view returns (uint256) {
    ^ (Relevant source part starts here and spans across multiple lines).

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Warning: It looks like you are using 'ecrecover' to validate a signature of a user account.      │
│ zkSync Era comes with native account abstraction support, therefore it is highly recommended NOT │
│ to rely on the fact that the account has an ECDSA private key attached to it since accounts might│
│ implement other signature schemes.                                                               │
│ Read more about Account Abstraction at https://v2-docs.zksync.io/dev/developer-guides/aa.html    │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
--> contracts/util/ECRecover.sol

Error:
Failed to compile with zksolc: Compilation failed with "Contract `contracts/test/MockFiatTokenWithEditableBalanceAndBlacklistStates.sol:MockFiatTokenWithEditableBalanceAndBlacklistStates` compiling error: The contract `contracts/test/MockFiatTokenWithEditableBalanceAndBlacklistStates.sol:MockFiatTokenWithEditableBalanceAndBlacklistStates` LLVM IR generator definition pass error: Library `contracts/util/SignatureChecker.sol:SignatureChecker` not found in the projectThe contract `contracts/test/MockFiatTokenWithEditableBalanceAndBlacklistStates.sol:MockFiatTokenWithEditableBalanceAndBlacklistStates` LLVM IR generator definition pass error: Library `contracts/util/SignatureChecker.sol:SignatureChecker` not found in the project\n\n\nStack backtrace:\n   0: __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm\n   1: __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm\n   2: __mh_execute_header\n   3: __mh_execute_header\n   4: __mh_execute_header\n   5: __mh_execute_header\n   6: __mh_execute_header\n   7: __mh_execute_header\n   8: __mh_execute_header\n   9: __mh_execute_header\n  10: __mh_execute_header\n  11: __mh_execute_header\n  12: __mh_execute_header\n  13: __mh_execute_header\n  14: __mh_execute_header\n  15: __mh_execute_header\n  16: __mh_execute_header\n  17: __mh_execute_header\n  18: __mh_execute_header\n  19: __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm\n  20: __mh_execute_header\n  21: __mh_execute_header\n  22: __mh_execute_header\n  23: __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm\n  24: __pthread_deallocate\n". Using compiler: "/Users/chihaolu/.zksync/zksolc-macosx-arm64-v1.4.0", with args "/Users/chihaolu/Desktop/imToken/chargeable-and-refundable-stablecoin/contracts/test/MockFiatTokenWithEditableBalanceAndBlacklistStates.sol" ["--standard-json", "--solc", "/Users/chihaolu/.svm/0.6.12/solc-0.6.12"]
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I know it is the zkSync foundry's compiler error for some contracts, but I cannot compile this contract without the zkSync foundry even I don't give the --zkSync flag.

BTW, the testnet is pointed to sepolia.

How can I uninstall the foundry-zkSync or compile without foundry-zkSync?

@ChiHaoLu ChiHaoLu added the T-bug label Apr 23, 2024
@dutterbutter
Copy link
Collaborator

dutterbutter commented Apr 23, 2024

Thanks @ChiHaoLu for the issue. This is definitely something we should fix, as currently it does compiles both solc and zksolc which should be optional without the --zksync flag.

To uninstall foundry-zksync simply re-install foundry using the curl method described here: https://book.getfoundry.sh/getting-started/installation#using-foundryup. This will override the current installed foundry-zksync.

@dutterbutter dutterbutter added compiler Issues specific to compiling and removed T-bug labels Apr 23, 2024
@sam-goldman
Copy link

sam-goldman commented May 9, 2024

@dutterbutter Is there any update on this issue? It significantly degrades the UX of Foundry to the point where I've been uninstalling and re-installing the zkSync fork every time I need to run tests for zkSync. Specifically, the zksolc compilation process can be very slow compared to solc, which makes it difficult to work on aspects of my project that don't involve zkSync. I think this issue can be fixed by only using zksolc when the --zksync flag is specified. Thanks :)

@wottpal
Copy link

wottpal commented May 24, 2024

Have to agree with @sam-goldman here, current foundry-zksync dev-ex is far from optimal :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Issues specific to compiling
Projects
None yet
Development

No branches or pull requests

4 participants