farcasterxyz / contracts

Implementation of the Farcaster contracts
https://www.farcaster.xyz/
MIT License
340 stars 122 forks source link

bug: Deploy script error #405

Open kevinweaver opened 11 months ago

kevinweaver commented 11 months ago

What is the bug? When I attempt to run the DeployL2.s.sol (or L1) script locally, it fails:

forge script -vvv --rpc-url http://localhost:8545 --broadcast script/DeployL2.s.sol
[⠒] Compiling...
No files changed, compilation skipped
Traces:
  [18479725] → new DeployL2@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
    └─ ← 92010 bytes of code

  [54543366] DeployL2::run()
    ├─ [0] VM::envAddress("ID_REGISTRY_OWNER_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("KEY_REGISTRY_OWNER_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("METADATA_VALIDATOR_OWNER_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("RECOVERY_PROXY_OWNER_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("STORAGE_RENT_PRICE_FEED_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("STORAGE_RENT_UPTIME_FEED_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("STORAGE_RENT_VAULT_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("STORAGE_RENT_ROLE_ADMIN_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("STORAGE_RENT_ADMIN_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("STORAGE_RENT_OPERATOR_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("STORAGE_RENT_TREASURER_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("DEPLOYER") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envAddress("MIGRATOR_ADDRESS") [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("STORAGE_RENT_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("ID_REGISTRY_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("ID_MANAGER_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("KEY_REGISTRY_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("KEY_MANAGER_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("SIGNED_KEY_REQUEST_VALIDATOR_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("BUNDLER_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] VM::envOr("RECOVERY_PROXY_CREATE2_SALT", 0x0000000000000000000000000000000000000000000000000000000000000000)
    │   └─ ← <env var value>
    ├─ [0] console::log("State     ", "Name                       ", "Address                                    ", "Initcode hash") [staticcall]
    │   └─ ← ()
    ├─ [0] 0x0000000000FFe8B47B3e2130213B802212439497::hasBeenDeployed(0x00000000fcCe7f938e7aE6D3c335bD6a1a7c593D) [staticcall]
    │   └─ ← ()
    └─ ← EvmError: Revert

== Logs ==
  State      Name                        Address                                     Initcode hash
Error: 
script failed: <no data>

How can it be reproduced? (optional)

git clone git@github.com:farcasterxyz/contracts.git
cd contracts
forge i && forge b
cp .env.example .env 
echo "PRIVATE_KEY=0xac09..." >> .env
source .env
forge script -vvv --rpc-url http://localhost:8545 --broadcast script/DeployL2.s.sol

Additional context (optional) Very likely user error, but any help welcome!

horsefacts commented 11 months ago

We use mainnet forking locally. Try running your Anvil as an OP mainnet fork. I'll leave this open until I add a note about this in docs!

kevinweaver commented 11 months ago

Thanks for the help! The final commands to test local L2 deployment were: forge

cp .env.prod .env
source .env
forge script --rpc-url http://localhost:8545 --sender 0x6D2b70e39C6bc63763098e336323591eb77Cd0C6 script/DeployL2.s.sol --broadcast --unlocked

anvil

anvil -f https://opt-mainnet.g.alchemy.com/v2/... --fork-block-number 108869000 --auto-impersonate