matter-labs / foundry-zksync

Fork of Foundry tailored for zkSync environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploy ERC1967Proxy.sol is not working.

wshino opened this issue · comments

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.0.2 (f908ce4 2024-08-29T00:24:00.853692000Z)

What command(s) is the bug in?

forge script script/Proxy.s.sol:ProxyScript --zksync --rpc-url $RPC_URL --broadcast -vvvv

Operating System

macOS (Apple Silicon)

Describe the bug

When I run the deployment script that deploys ERC1967Proxy, it's failed due to the following error.
Here is my sample script file. It works fine with the vanilla foundry to deploy to base sepolia.

https://gist.github.com/wshino/9b0bb6f5a20597b7b54a5ff0ac6bc7e2

In addition, I use ERC1967Proxy in my project script files since before. I believe it worked before with foundry zksync to zksync sepolia because actually I can see the txs which created contracts 1 month or 2 months ago. Why it's not working? I'd like to know how to solve this issue.

% forge script script/Proxy.s.sol:ProxyScript --zksync --rpc-url $RPC_URL --broadcast -vvvv
[⠆] Compiling...
No files changed, compilation skipped
[⠃] Using zksolc-1.5.0
[⠰] Compiling (zksync)
No files changed, compilation skipped
Traces:
  [68612] ProxyScript::run()
    ├─ [0] VM::envUint("PRIVATE_KEY") [staticcall]
    │   └─ ← [Return] <env var value>
    ├─ [0] VM::startBroadcast(<pk>)
    │   └─ ← [Return] 
    ├─ [0] → new <unknown>@0xD1681dD3Bd32d684c5bdc132D4c9F0216130365E
    │   └─ ← [Return] 32 bytes of code
    ├─ [0] → new <unknown>@0x1Cb2dC61775134Ed4532190cdd4f2FD73191c1c5
    │   └─ ← [Return] 32 bytes of code
    ├─ [0] VM::stopBroadcast()
    │   └─ ← [Return] 
    └─ ← [Stop] 


Script ran successfully.

## Setting up 1 EVM.
==========================
Simulated On-chain Traces:

  [0] 0x0000000000000000000000000000000000000000::fallback()
    └─ ← [Continue] <empty revert data>

  [0] 0x0000000000000000000000000000000000000000::fallback()
    └─ ← [Continue] <empty revert data>


==========================

Chain 300

Estimated gas price: 0.060873511 gwei

Estimated total gas used for script: 1017396

Estimated amount required: 0.000061932466597356 ETH

==========================
⠂ Sequence #1 on 300 | Sending transactions [0 - 1]
    ⠁ [00:00:00] [----------------------------------------------------------------------------] 0/2 txes (0.0s)
    ⠁ [00:00:00] [------------------------------------------------------------------------] 0/2 receipts (0.0s)The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: ErrorResp(ErrorPayload { code: 3, message: "execution reverted", data: Some(RawValue("0x4c9c8ce3000000000000000000000000d1681dd3bd32d684c5bdc132d4c9f0216130365e")) })
Location: /Users/runner/work/foundry-zksync/foundry-zksync/crates/script/src/broadcast.rs:81

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   2: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   3: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   4: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   5: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   6: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   7: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   8: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   9: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  10: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  11: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  12: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  13: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  14: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  15: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  16: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  17: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  18: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  19: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  20: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  21: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  22: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
  23: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
zsh: abort      forge script script/Proxy.s.sol:ProxyScript --zksync --rpc-url $RPC_URL  -vvv

Hey @wshino thanks for opening the issue. Could you try the same but with --slow flag? Zksync doesn't support batching and the lack of the flag can lead to this error. I tried your script from my end and the deployment completed successfully.

forge script script/Proxy.s.sol:ProxyScript --zksync --rpc-url $RPC_URL --broadcast -vvvv --slow

==========================

Chain 300

Estimated gas price: 0.050000001 gwei

Estimated total gas used for script: 1010640

Estimated amount required: 0.00005053200101064 ETH

==========================

##### 300
✅  [Success]Hash: 0x9fcea647d062cfaa090bd88e4a737b46793a380a216c0878b64f56629c6e6e6f
Contract Address: 0x2314d202141eB3e2838A7899a5E3dE714121BE5C
Block: 3704056
Paid: 0.00002437015 ETH (974806 gas * 0.025 gwei)


##### 300
✅  [Success]Hash: 0x1905bfb80c86ce89eeea28e4328e241ef2a9f6b8cbc96ecd33daafbf69a6372e
Contract Address: 0xB504eC969886758214f21e011D710FD92F2401c8
Block: 3704057
Paid: 0.001272628175 ETH (50905127 gas * 0.025 gwei)

✅ Sequence #1 on 300 | Total Paid: 0.001296998325 ETH (51879933 gas * avg 0.025 gwei)


==========================

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.

@Jrigada Thank you so much. I added --slow option then I've succeeded to execute the sample script.

And I completely succeeded to deploy contracts using create2 factory.
relates to this issue