Unable to deploy contract with big factory deps on zkSync Era mainnet
brotherlymite 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 (ab00f2e 2024-07-09T00:25:00.511779000Z)
What command(s) is the bug in?
forge script
Operating System
macOS (Apple Silicon)
Describe the bug
I'm unable to deploy factory contract which uses create2 to deploy child contracts, on zkSync era mainnet.
I am able to deploy the same contract AaveV3LibrariesBatch1 on sepolia zkSync without any issues but when deploying on zkSync era mainnet getting the following error on the terminal:
aave-v3-origin-private % make deploy-libs
forge script --zksync --system-mode=true -vvvvvvvv scripts/misc/LibraryPreCompileOne.sol --rpc-url https://zksync-mainnet.g.alchemy.com/v2/key --private-key 0xprivatekey --sender 0xsender --slow --skip-simulation --gas-limit 10000000 --broadcast
[⠊] Compiling...
No files changed, compilation skipped
Traces:
[45369] LibraryPreCompileOne::run()
├─ [0] VM::startBroadcast()
│ └─ ← ()
├─ [0] → new <unknown>@0x8b822684b9c00feF0839347A4015BcFdc6359306
│ └─ ← 3232 bytes of code
├─ [0] VM::stopBroadcast()
│ └─ ← ()
└─ ← ()
Script ran successfully.
EIP-3855 is not supported in one or more of the RPCs used.
Unsupported Chain IDs: 324.
Contracts deployed with a Solidity version equal or higher than 0.8.20 might not work properly.
For more information, please see https://eips.ethereum.org/EIPS/eip-3855
SKIPPING ON CHAIN SIMULATION.
###
Finding wallets for all the necessary addresses...
##
Sending transactions [0 - 1].
⠁ [00:00:03] [####################################################>----------------------------------------------------] 1/2 txes (3.2s)
⠉ [00:00:06] [#####################################################################################################] 1/1 receipts (0.0s)
##### zksync
✅ [Success]Hash: 0x65115a730c60dbf5f726b3c74378c19825e09487840e59ee6d05aef37345ffda
Block: 38667599
Paid: 0.00000326331 ETH (108777 gas * 0.03 gwei)
Transactions saved to: bgd/aave-v3-origin-private/broadcast/LibraryPreCompileOne.sol/324/run-latest.json
Sensitive values saved to: bgd/aave-v3-origin-private/cache/LibraryPreCompileOne.sol/324/run-latest.json
Error:
Failed to estimate gas for tx: 0x88e45a68627cc5853bdbcd95275ec1dff2a528b8c087b96ad7675f63ae1eeffd
Context:
- (code: 3, message: execution reverted: Create2: Failed on deploy, data: Some(String("0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000019437265617465323a204661696c6564206f6e206465706c6f7900000000000000")))
make: *** [deploy-libs] Error 1
Unsure, why it reverts on the create2 deployment. For reference I'm using this method to deploy the contract:
function _create2Deploy(bytes32 salt, bytes memory bytecode) internal returns (address) {
address deployedAt;
assembly {
deployedAt := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
require(deployedAt != address(0), "Create2: Failed on deploy");
return deployedAt;
}
To replicate, please run make deploy-libs
on this repo with rpc-url of zkSync mainnet in net
env variable
Hmm this is quite puzzling.
There could be multiple things at play here, but looking at the command used, I'd like to exclude --slow
not being detected properly, and messing things up for you here.
Second, I noticed the simulation was skipped here, it wouldn't really affect the outcome, but perhaps it would have caught this early. It's also good for us to know if the simulation actually detects this or not as well.
I don't know how much foundry affects this, considering the same thing is working fine on mainnet - perhaps a specific issue with mainnet vs sepolia?
Strange, when trying to not skip the simulation it throws an error but for a different reason I assume:
## Setting up 1 EVM.
==========================
Simulated On-chain Traces:
[0] 0x0000000000000000000000000000000000000000::fallback()
└─ ← <empty revert data>
[0] 0x0000000000000000000000000000000000000000::fallback()
└─ ← <empty revert data>
Error:
Transaction failed when running the on-chain simulation. Check the trace above for more information.
Ok, I tried running the simulation also and also got this error.
Without specifying a gas limit, I'd get Account validation error: Not enough balance for fee + value
when running the script (before the simulation), which could be due to inaccurate gas estimation.
(EDIT: I found the issue here and produced a fix, so now script works and we get the same error in simulation, like when specifying a gas limit manually)
(EDIT2: The PR is #477 and it's been merged)
With --gas-limit 10000000
the script runs succesfully but then the simulation fails with the same error you are seeing, which unfortunately is rather non-descriptive.
This definitely needs more debugging to find the cause. I'll post here the tx execution output with debug logging, perhaps it could prove to be useful.
Output (of the failing tx in simulation) with RUST_LOG="info,foundry_zksync_core=debug"
& ZK_DEBUG_RESOLVE_HASHES="true"
2024-07-11T10:45:20.084381Z DEBUG foundry_zksync_core::vm::runner: zk transact calldata=0x9c4d535b0000000000000000000000000000000000000000000000000000000000000000010000655aa52a76e525bdfc8882571998a8b783fab519bf3e657fca9a14fa7200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000 fdeps=1
2024-07-11T10:45:20.084413Z DEBUG foundry_zksync_core::vm::runner: tx gas parameters gas_limit=235721943 max_fee_per_gas=260000000
2024-07-11T10:45:20.086827Z INFO foundry_zksync_core::vm::inspect: executing transaction in zk vm call_ctx=CallContext { tx_caller: 0x6ec33534be07d45cc4e02fbd127f8ed2ae919a6b, msg_sender: 0x6ec33534be07d45cc4e02fbd127f8ed2ae919a6b, contract: 0x0000000000000000000000000000000000008006, delegate_as: None, block_number: 0x0000000000000000000000000000000000000000000000000000000002503e87_U256, block_timestamp: 0x00000000000000000000000000000000000000000000000000000000668fb7bd_U256, block_basefee: 0x0_U256, is_create: false, is_static: false }
2024-07-11T10:45:20.086859Z INFO foundry_zksync_core::vm::env: batch env fair_l2_gas_price=0 l1_gas_price=1000
2024-07-11T10:45:20.126390Z DEBUG foundry_zksync_core::vm::tracer: overriding account version for caller 0x6ec33534be07d45cc4e02fbd127f8ed2ae919a6b
2024-07-11T10:45:20.456072Z DEBUG foundry_zksync_core::vm::inspect: Call: Reverted output=Unknown { function_selector: [], data: [] }
2024-07-11T10:45:20.456101Z INFO era_test_node::formatter:
2024-07-11T10:45:20.456105Z INFO era_test_node::formatter: ┌──────────────────────────┐
2024-07-11T10:45:20.456108Z INFO era_test_node::formatter: │ VM EXECUTION RESULTS │
2024-07-11T10:45:20.456111Z INFO era_test_node::formatter: └──────────────────────────┘
2024-07-11T10:45:20.456114Z INFO era_test_node::formatter: Cycles Used: 267959
2024-07-11T10:45:20.456116Z INFO era_test_node::formatter: Computation Gas Used: 79999256
2024-07-11T10:45:20.456119Z INFO era_test_node::formatter: Contracts Used: 15
2024-07-11T10:45:20.456237Z INFO era_test_node::formatter:
2024-07-11T10:45:20.456243Z INFO era_test_node::formatter:
[!] Revert Reason:
2024-07-11T10:45:20.456254Z INFO era_test_node::formatter: ════════════════════════════
2024-07-11T10:45:20.456257Z INFO foundry_zksync_core::vm::inspect: === Console Logs:
2024-07-11T10:45:20.456270Z INFO foundry_zksync_core::vm::inspect: === Calls:
2024-07-11T10:45:20.456510Z INFO era_test_node::formatter: Call(Normal) Account Code Storage getRawCodeHash(address) 4227857424
2024-07-11T10:45:20.456595Z INFO era_test_node::formatter: Call(Normal) System context 0x02fa5779 4227853014
2024-07-11T10:45:20.456809Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 4161791970
2024-07-11T10:45:20.456883Z INFO era_test_node::formatter: Call(Normal) System context 0x06bed036 4227848352
2024-07-11T10:45:20.456891Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 4161787119
2024-07-11T10:45:20.456959Z INFO era_test_node::formatter: Call(Normal) System context baseFee() 4227843942
2024-07-11T10:45:20.457022Z INFO era_test_node::formatter: Call(Normal) Bootloader utilities getTransactionHashes(tuple) 4227834933
2024-07-11T10:45:20.457252Z INFO era_test_node::formatter: Call(Normal) Keccak 9c4d535b 4161774015
2024-07-11T10:45:20.457261Z INFO era_test_node::formatter: Call(Normal) Keccak 01000a6b 4161772755
2024-07-11T10:45:20.457271Z INFO era_test_node::formatter: Call(Normal) Keccak 0x 4161771936
2024-07-11T10:45:20.457279Z INFO era_test_node::formatter: Call(Normal) Keccak 848e1bfa 4161770613
2024-07-11T10:45:20.457342Z INFO era_test_node::formatter: Call(Normal) System context chainId() 4161770046
2024-07-11T10:45:20.457656Z INFO era_test_node::formatter: Call(Normal) Keccak c2f87871 4161769353
2024-07-11T10:45:20.457665Z INFO era_test_node::formatter: Call(Normal) Keccak 190138d6 4161768723
2024-07-11T10:45:20.457674Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 4161767841
2024-07-11T10:45:20.457681Z INFO era_test_node::formatter: Call(Normal) Keccak c519b4f8 4161766896
2024-07-11T10:45:20.457743Z INFO era_test_node::formatter: Call(Normal) System context 0x06e7517b 4227825861
2024-07-11T10:45:20.457752Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 4161765384
2024-07-11T10:45:20.458068Z INFO era_test_node::formatter: Call(Normal) System context 0xa225efcb 4227824601
2024-07-11T10:45:20.458128Z INFO era_test_node::formatter: Call(Normal) System context setTxOrigin(address) 78725997
2024-07-11T10:45:20.458190Z INFO era_test_node::formatter: Call(Normal) System context setGasPrice(uint256) 78725241
2024-07-11T10:45:20.458256Z INFO era_test_node::formatter: Call(Normal) L2 deployer extendedAccountVersion(address) 78719130
2024-07-11T10:45:20.458330Z INFO era_test_node::formatter: Call(Normal) Nonce Holder validateNonceUsage(address, uint256, bool) 78717744
2024-07-11T10:45:20.458425Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77487228
2024-07-11T10:45:20.458435Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77484771
2024-07-11T10:45:20.458444Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77484267
2024-07-11T10:45:20.458508Z INFO era_test_node::formatter: Call(Normal) 0x6ec33534be07d45cc4e02fbd127f8ed2ae919a6b validateTransaction(bytes32, bytes32, tuple) 78705333
2024-07-11T10:45:20.458572Z INFO era_test_node::formatter: Call(Normal) Nonce Holder incrementMinNonceIfEquals(uint256) 77474754
2024-07-11T10:45:20.458803Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 76263705
2024-07-11T10:45:20.458812Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 76263138
2024-07-11T10:45:20.458874Z INFO era_test_node::formatter: Call(Normal) EthToken System Contract balanceOf(uint256) 77468328
2024-07-11T10:45:20.458884Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 76257342
2024-07-11T10:45:20.458943Z INFO era_test_node::formatter: Call(Normal) Nonce Holder validateNonceUsage(address, uint256, bool) 78694182
2024-07-11T10:45:20.459182Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77464044
2024-07-11T10:45:20.459238Z INFO era_test_node::formatter: Call(Normal) EthToken System Contract balanceOf(uint256) 78692796
2024-07-11T10:45:20.459249Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77462658
2024-07-11T10:45:20.459306Z INFO era_test_node::formatter: Call(Normal) 0x6ec33534be07d45cc4e02fbd127f8ed2ae919a6b payForTransaction(bytes32, bytes32, tuple) 78691095
2024-07-11T10:45:20.459315Z INFO era_test_node::formatter: Call(Normal) Msg Value System Contract 0x 77460741
2024-07-11T10:45:20.459602Z INFO era_test_node::formatter: Call(Normal) EthToken System Contract transferFromTo(address, address, uint256) 76249719
2024-07-11T10:45:20.459613Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 75057759
2024-07-11T10:45:20.459623Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 75057192
2024-07-11T10:45:20.459632Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 75053286
2024-07-11T10:45:20.459691Z INFO era_test_node::formatter: Call(Normal) Event writer 0x00000000 75052593
2024-07-11T10:45:20.459911Z INFO era_test_node::formatter: Call(Mimic) bootloader 0x 76243293
2024-07-11T10:45:20.459969Z INFO era_test_node::formatter: Call(Normal) EthToken System Contract balanceOf(uint256) 78682086
2024-07-11T10:45:20.459979Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77452137
2024-07-11T10:45:20.460037Z INFO era_test_node::formatter: Call(Normal) EthToken System Contract transferFromTo(address, address, uint256) 78680889
2024-07-11T10:45:20.460047Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77450940
2024-07-11T10:45:20.460267Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77450436
2024-07-11T10:45:20.460276Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 77449869
2024-07-11T10:45:20.460333Z INFO era_test_node::formatter: Call(Normal) Event writer 0x00000000 77449239
2024-07-11T10:45:20.460393Z INFO era_test_node::formatter: Call(Normal) Known code storage getMarker(bytes32) 78657012
2024-07-11T10:45:20.460457Z INFO era_test_node::formatter: Call(Normal) Compressor publishCompressedBytecode(bytes, bytes) 78652350
2024-07-11T10:45:20.460519Z INFO era_test_node::formatter: Call(Normal) 0x0000000000000000000000000000000000000002 0x00030000 76130523
2024-07-11T10:45:20.460702Z INFO era_test_node::formatter: Call(Normal) L1 messenger sendToL1(bytes) 75909708
2024-07-11T10:45:20.460712Z INFO era_test_node::formatter: Call(Normal) Keccak 0b420000 74722851
2024-07-11T10:45:20.460720Z INFO era_test_node::formatter: Call(Normal) Keccak 30a94eb4 74707101
2024-07-11T10:45:20.460777Z INFO era_test_node::formatter: Call(Normal) System context 0x8ac84c0e 74703132
2024-07-11T10:45:20.460787Z INFO era_test_node::formatter: Call(Normal) Keccak 00010ed7 74701935
2024-07-11T10:45:20.461021Z INFO era_test_node::formatter: Call(Normal) Keccak 9a0bc075 74699352
2024-07-11T10:45:20.461073Z INFO era_test_node::formatter: Call(Normal) Event writer 0x00000000 74689776
2024-07-11T10:45:20.461132Z INFO era_test_node::formatter: Call(Normal) Event writer 0x00000000 71095059
2024-07-11T10:45:20.461218Z INFO era_test_node::formatter: Call(Normal) Account Code Storage getCodeSize(uint256) 72222885
2024-07-11T10:45:20.461282Z INFO era_test_node::formatter: Call(Normal) Known code storage 0x79c4f929 72222192
2024-07-11T10:45:20.461405Z INFO era_test_node::formatter: Call(Normal) Event writer 0x 71089704
2024-07-11T10:45:20.461462Z INFO era_test_node::formatter: Call(Normal) Known code storage markFactoryDeps(bool, bytes32[]) 73445841
2024-07-11T10:45:20.461521Z INFO era_test_node::formatter: Call(Normal) System context setTxOrigin(address) 4149113850
2024-07-11T10:45:20.461581Z INFO era_test_node::formatter: Call(Normal) EthToken System Contract transferFromTo(address, address, uint256) 4149112086
2024-07-11T10:45:20.461592Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 4084281621
2024-07-11T10:45:20.461785Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 4084281117
2024-07-11T10:45:20.461792Z INFO era_test_node::formatter: Call(Normal) Keccak 00000000 4084280613
2024-07-11T10:45:20.461851Z INFO era_test_node::formatter: Call(Normal) Event writer 0x00000000 4084279983
2024-07-11T10:45:20.461856Z INFO foundry_zksync_core::vm::inspect: ==== 3 events
2024-07-11T10:45:20.461912Z INFO era_test_node::formatter: EthToken System Contract
2024-07-11T10:45:20.461919Z INFO era_test_node::formatter: Topics:
2024-07-11T10:45:20.461924Z INFO era_test_node::formatter: Transfer(address,address,uint256)
2024-07-11T10:45:20.462150Z INFO era_test_node::formatter: 0x0000000000000000000000006ec33534be07d45cc4e02fbd127f8ed2ae919a6b
2024-07-11T10:45:20.462153Z INFO era_test_node::formatter: 0x0000000000000000000000000000000000000000000000000000000000008001
2024-07-11T10:45:20.462158Z INFO era_test_node::formatter: Data (Hex): 0x00000000000000000000000000000000000000000000000000d9bcd7d85a4f00
2024-07-11T10:45:20.462162Z INFO era_test_node::formatter:
2024-07-11T10:45:20.462231Z INFO era_test_node::formatter: EthToken System Contract
2024-07-11T10:45:20.462234Z INFO era_test_node::formatter: Topics:
2024-07-11T10:45:20.462237Z INFO era_test_node::formatter: Transfer(address,address,uint256)
2024-07-11T10:45:20.462530Z INFO era_test_node::formatter: 0x0000000000000000000000000000000000000000000000000000000000008001
2024-07-11T10:45:20.462533Z INFO era_test_node::formatter: 0x0000000000000000000000006ec33534be07d45cc4e02fbd127f8ed2ae919a6b
2024-07-11T10:45:20.462537Z INFO era_test_node::formatter: Data (Hex): 0x00000000000000000000000000000000000000000000000000d9bcd7d85a4f00
2024-07-11T10:45:20.462541Z INFO era_test_node::formatter:
2024-07-11T10:45:20.462610Z INFO era_test_node::formatter: EthToken System Contract
2024-07-11T10:45:20.462614Z INFO era_test_node::formatter: Topics:
2024-07-11T10:45:20.462617Z INFO era_test_node::formatter: Transfer(address,address,uint256)
2024-07-11T10:45:20.462921Z INFO era_test_node::formatter: 0x0000000000000000000000000000000000000000000000000000000000008001
2024-07-11T10:45:20.462924Z INFO era_test_node::formatter: 0x0000000000000000000000006ec33534be07d45cc4e02fbd127f8ed2ae919a6b
2024-07-11T10:45:20.462927Z INFO era_test_node::formatter: Data (String):
2024-07-11T10:45:20.462932Z INFO era_test_node::formatter:
EDIT: A few things to note in the output: the gas limit was set to 235721943
(from heuristic) meanwhile the gas used was only 79999256
. Increasing the gas limit further doesn't seem to affect the gas used, instead it's always the same.
Skipping the simulation with the following flags --skip-simulation --gas-limit 15000000
and downgrading the compiler to version 1.4.1
from 1.5.0
I was able to deploy the contracts on zkSync mainnet (which seems a bit strange).
However when trying to deploy another batch of contract AaveV3LibrariesBatch2 on zksync mainnet, it sends 2/3 transactions:
- https://explorer.zksync.io/tx/0x2d12d5ac278cd1afd4cc514d48e0068cf46d011d8bfcfc82e12801f5fa301fa3
- https://explorer.zksync.io/tx/0x45b6ede16370069ca7d089808ad78ef64cc830c3996526039f22eacbf50fa685
But fails when sending the 3/3 tx deploying the contract, with the same error:
Error:
Failed to estimate gas for tx: 0x9bdbf167cbee0ae396a87b742d3d362e47a2a1fc6870f02a982d6191a646f097
Context:
- (code: 3, message: execution reverted: Create2: Failed on deploy, data: Some(String("0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000019437265617465323a204661696c6564206f6e206465706c6f7900000000000000")))
Attaching here the broadcast file: run-latest.json
Hey, we think we have identified the issue you are encountering and merged a fix (#476) (was also affecting you in the first deployment) so you should be able to continue your deployment.
We tried to do the AaveV3LibrariesBatch2
deployment on mainnet afterwards and were successful.
We also deployed using zksolc 1.5.0 as well to ensure the issue was not with the compiler.
We made a slight change so the libs wouldn't have the same bytecode as yours, which would result in us deploying the libraries for you.
Please let us know if you still have issues with this deployment.
For deploying AaveV3LibrariesBatch2
I ended up using forge create
instead of forge script
which worked fine to deploy the contracts.
While trying to deploy another batch of contracts using the 33b81ac foundry-version, I am able to send 2/8 txs and when sending the other txs I am facing a similar error: execution reverted: The code hash is not known
Attaching here the terminal output:
Traces:
[241736] Default::run()
├─ [0] VM::startBroadcast()
│ └─ ← ()
├─ [0] → new <unknown>@0x9acC60966ffda5cE1dc59384494F43Ce88f527C1
│ └─ ← 37728 bytes of code
├─ [0] 0x9acC60966ffda5cE1dc59384494F43Ce88f527C1::getInitialReport() [staticcall]
│ └─ ← InitialReport({ poolAddressesProvider: 0x12dF6A737CAFb88251876966E3DeFa99235817eB, poolAddressesProviderRegistry: 0xF0E1b70Fa96D4eF8b079AB2998d64FAE2D8Aa3Fc })
├─ [0] → new <unknown>@0x754D15FB9bE060E5D7B6B2e0fDC6980555561489
│ └─ ← 4512 bytes of code
├─ [0] 0x754D15FB9bE060E5D7B6B2e0fDC6980555561489::getGettersReportOne() [staticcall]
│ └─ ← GettersReportBatchOne({ walletBalanceProvider: 0x5C10e746e882Eb3c326129E631b84da2DA6c689a, uiIncentiveDataProvider: 0xB99983570FC54A00A7638F9378eaa3e39ED6C9Fe, protocolDataProvider: 0x79a51d8fb7fD3C182454291e56a06A3DeAf542b9, uiPoolDataProvider: 0x945595a1bdBE610Bbf0Af9180BFD545E3B397086 })
├─ [0] → new <unknown>@0x2464EE6633C229590792C9B6Ad82E4E0eF6Fce96
│ └─ ← 4512 bytes of code
├─ [0] 0x2464EE6633C229590792C9B6Ad82E4E0eF6Fce96::getPoolReport() [staticcall]
│ └─ ← PoolReport({ poolImplementation: 0x37996414240e21b76F76944254357201Fd569A44, poolConfiguratorImplementation: 0x8969B5bC71a7AF72f20396a74846c4E2733248f3 })
├─ [0] → new <unknown>@0x23d554D56e7fB4569C5361A2aD2a6e26b83cd7A9
│ └─ ← 13856 bytes of code
├─ [0] 0x23d554D56e7fB4569C5361A2aD2a6e26b83cd7A9::getPeripheryReport() [staticcall]
│ └─ ← PeripheryReport({ aaveOracle: 0x0CE0107E4Bc9639616CbD2EE42aB28366b6E2223, proxyAdmin: 0x287f6c3E9eF02BD8f1e609273e6A0c3f05DB64AA, treasury: 0x53B345456Edc51F7cbc52416f67586e19Dc0758d, treasuryImplementation: 0x2cE2f45a8675bca87c00b4a13181fe28d0880B33, emissionManager: 0x7a54E267c46ac8119c421243aF0b4b7C3d021a20, rewardsControllerImplementation: 0x5179884652ba55dB644dFdE9fC426C77BF68611F, defaultInterestRateStrategyV2: 0xc814109f685C2049173a3080464dA66a7B5ddd5e })
├─ [0] 0x9acC60966ffda5cE1dc59384494F43Ce88f527C1::setupAaveV3Market(Roles({ marketOwner: 0x04cE39789e11a49595cD0ECEf6f4Bd54ABF4d020, poolAdmin: 0x04cE39789e11a49595cD0ECEf6f4Bd54ABF4d020, emergencyAdmin: 0x6ec33534BE07d45cc4E02Fbd127F8ed2aE919a6b }), MarketConfig({ networkBaseTokenPriceInUsdProxyAggregator: 0x6D41d1dc818112880b40e26BD6FD347E41008eDA, marketReferenceCurrencyPriceInUsdProxyAggregator: 0x6D41d1dc818112880b40e26BD6FD347E41008eDA, marketId: "Aave V3 ZkSync Market", oracleDecimals: 8, paraswapAugustusRegistry: 0x0000000000000000000000000000000000000000, paraswapFeeClaimer: 0x0000000000000000000000000000000000000000, providerId: 44, salt: 0x0000000000000000000000000000000000000000000000000000000000000000, wrappedNativeToken: 0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91, proxyAdmin: 0x0000000000000000000000000000000000000000, flashLoanPremiumTotal: 5, flashLoanPremiumToProtocol: 4 }), 0x37996414240e21b76F76944254357201Fd569A44, 0x8969B5bC71a7AF72f20396a74846c4E2733248f3, 0x79a51d8fb7fD3C182454291e56a06A3DeAf542b9, 0x0CE0107E4Bc9639616CbD2EE42aB28366b6E2223, 0x5179884652ba55dB644dFdE9fC426C77BF68611F)
│ └─ ← SetupReport({ poolProxy: 0xe1607c00fb674A1b702145f89f5751be026C0994, poolConfiguratorProxy: 0xC1E93C1251d6F88C66c45bBDd482F92367a50f7d, rewardsControllerProxy: 0x6dA11a0e4fB89DACb1A4B367B52d2cA419aF072E, aclManager: 0x76aaC7D5c1E6196f3e87E121F31B7BCA0Fc96287 })
├─ [0] → new <unknown>@0x68cD57659e050a6c529BEb81c1644F3bf0FB9D43
│ └─ ← 3168 bytes of code
├─ [0] 0x68cD57659e050a6c529BEb81c1644F3bf0FB9D43::getGettersReportTwo() [staticcall]
│ └─ ← GettersReportBatchTwo({ wrappedTokenGateway: 0x0EAB90322bff7710a9377Edb53f182F60d21427B, l2Encoder: 0x7db3f5D8d8079Eca7a2aACe968C0b3f8CA3fA660 })
├─ [0] → new <unknown>@0xc16D995fd19d8b63a7d76917ED9624D250332DfA
│ └─ ← 7008 bytes of code
├─ [0] 0xc16D995fd19d8b63a7d76917ED9624D250332DfA::getTokensReport() [staticcall]
│ └─ ← TokensReport({ aToken: 0x54802F3863389D7743D1000c350833fD210e0412, variableDebtToken: 0x87161b6D3F6c2f81CC3B0Ef44455105F39bc54aB, stableDebtToken: 0x0733C2AC318733dD330D1d107301135d15d0a2b8 })
├─ [0] 0x9acC60966ffda5cE1dc59384494F43Ce88f527C1::setMarketReport(MarketReport({ poolAddressesProviderRegistry: 0xF0E1b70Fa96D4eF8b079AB2998d64FAE2D8Aa3Fc, poolAddressesProvider: 0x12dF6A737CAFb88251876966E3DeFa99235817eB, poolProxy: 0xe1607c00fb674A1b702145f89f5751be026C0994, poolImplementation: 0x37996414240e21b76F76944254357201Fd569A44, poolConfiguratorProxy: 0xC1E93C1251d6F88C66c45bBDd482F92367a50f7d, poolConfiguratorImplementation: 0x8969B5bC71a7AF72f20396a74846c4E2733248f3, protocolDataProvider: 0x79a51d8fb7fD3C182454291e56a06A3DeAf542b9, aaveOracle: 0x0CE0107E4Bc9639616CbD2EE42aB28366b6E2223, defaultInterestRateStrategyV2: 0xc814109f685C2049173a3080464dA66a7B5ddd5e, aclManager: 0x76aaC7D5c1E6196f3e87E121F31B7BCA0Fc96287, treasury: 0x53B345456Edc51F7cbc52416f67586e19Dc0758d, proxyAdmin: 0x287f6c3E9eF02BD8f1e609273e6A0c3f05DB64AA, treasuryImplementation: 0x2cE2f45a8675bca87c00b4a13181fe28d0880B33, wrappedTokenGateway: 0x0EAB90322bff7710a9377Edb53f182F60d21427B, walletBalanceProvider: 0x5C10e746e882Eb3c326129E631b84da2DA6c689a, uiIncentiveDataProvider: 0xB99983570FC54A00A7638F9378eaa3e39ED6C9Fe, uiPoolDataProvider: 0x945595a1bdBE610Bbf0Af9180BFD545E3B397086, paraSwapLiquiditySwapAdapter: 0x0000000000000000000000000000000000000000, paraSwapRepayAdapter: 0x0000000000000000000000000000000000000000, paraSwapWithdrawSwapAdapter: 0x0000000000000000000000000000000000000000, aaveParaSwapFeeClaimer: 0x0000000000000000000000000000000000000000, l2Encoder: 0x7db3f5D8d8079Eca7a2aACe968C0b3f8CA3fA660, aToken: 0x54802F3863389D7743D1000c350833fD210e0412, variableDebtToken: 0x87161b6D3F6c2f81CC3B0Ef44455105F39bc54aB, stableDebtToken: 0x0733C2AC318733dD330D1d107301135d15d0a2b8, emissionManager: 0x7a54E267c46ac8119c421243aF0b4b7C3d021a20, rewardsControllerImplementation: 0x5179884652ba55dB644dFdE9fC426C77BF68611F, rewardsControllerProxy: 0x6dA11a0e4fB89DACb1A4B367B52d2cA419aF072E }))
│ └─ ← ()
├─ [0] VM::stopBroadcast()
│ └─ ← ()
└─ ← ()
Script ran successfully.
EIP-3855 is not supported in one or more of the RPCs used.
Unsupported Chain IDs: 324.
Contracts deployed with a Solidity version equal or higher than 0.8.20 might not work properly.
For more information, please see https://eips.ethereum.org/EIPS/eip-3855
SKIPPING ON CHAIN SIMULATION.
###
Finding wallets for all the necessary addresses...
##
Sending transactions [0 - 7].
⠁ [00:00:04] [###########>--------------------------------------------------------------------------------] 1/8 txes (31.6s)
⠉ [00:00:07] [#########################################################################################] 1/1 receipts (0.0s)
##### zksync
✅ [Success]Hash: 0x1387b70ba8581450db1f2b525fd587f7736f90d45c708d2e451330c0a40925b5
Contract Address: 0x9acC60966ffda5cE1dc59384494F43Ce88f527C1
Block: 39238488
Paid: 0.000021838193 ETH (482612 gas * 0.04525 gwei)
⠉ [00:00:17] [#######################>--------------------------------------------------------------------] 2/8 txes (62.9s)
⠉ [00:00:07] [#########################################################################################] 1/1 receipts (0.0s)
##### zksync
✅ [Success]Hash: 0x8411b26bfc48cd6482eddd0209d8d8a44553a609cfa05049e4124d7ef0aaf401
Contract Address: 0x945595a1bdBE610Bbf0Af9180BFD545E3B397086
Block: 39238502
Paid: 0.00002235381675 ETH (494007 gas * 0.04525 gwei)
Error:
Failed to estimate gas for tx: 0xd378538a31e051898e1f0b467de749dbd38d5a06d0a2c9681c39db5740387514
Context:
- (code: 3, message: execution reverted: The code hash is not known, data: Some(String("0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a54686520636f64652068617368206973206e6f74206b6e6f776e000000000000")))
Here is the broadcast file: run-latest.json
Not sure why it is happening, tried to clean up zkout/
out/
and run again but facing the same issue, for context I'm using the default 1.4.1
compiler version which is being downloaded by foundry-zksync
Alright, let's see here.
Given the repo & branch you mentioned, here's the steps we did to test the deployment:
- updated
.env
a.SENDER=0x117EDEB31268ac50D073C61D2c667426d6e42258
b.PRIVATE_KEY=<REDACTED>
c.FOUNDRY_LIBRARIES=...
(see below)
d.net=https://mainnet.era.zksync.io/
- edited
ZkSyncInput
a.GUARDIAN
matching env'sSENDER
b.marketId
to 'Aave V3 ZkSync Market - MSL Testing' - run
make deploy-v3-batched
Unfortunately, we were not able to reproduce the error, and instead deployed successfully.
The total number of transactions was 8 for the DeployAaveV3MarketBatched.sol
script.
The first tx of the deployment is https://explorer.zksync.io/tx/0x221a2900f55bc4c174be5db012a481bddbdf7f30e9ce0d948f427982ec46d873,
and the last tx is https://explorer.zksync.io/tx/0x6770e50edaab2f8e3fbe97389e9be2e3744f40e8b30e34ed7fe61491969cd297.
We also made a second deployment (first tx, last tx) and a third one (first, last) from a separate machine, to make sure it wasn't a fluke.
Please let us know if we are doing something wrong and it somehow is making the deployment succeed...
With regards to FOUNDRY_LIBRARIES
:
The libraries used come from the 2 batches: first batch, second batch (same deployment mentioned in the previous comment).
Here's the collected libraries from those 2 batches:
FOUNDRY_LIBRARIES=aave-v3-core/contracts/protocol/libraries/logic/BorrowLogic.sol:BorrowLogic:0x296c5448F1c6d30B43c29bb12bdDa2e3520f5fd9,aave-v3-core/contracts/protocol/libraries/logic/BridgeLogic.sol:BridgeLogic:0xA38F8B87906DCdD9EeB4be4f1A1951Af3A6A98B1,aave-v3-core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol:ConfiguratorLogic:0xADC05ffD56111Addf3E4af4738d13662c69fd4b7,aave-v3-core/contracts/protocol/libraries/logic/EModeLogic.sol:EModeLogic:0x59B84d2B5a37017843BE353875fB8ceb2E19BF89,aave-v3-core/contracts/protocol/libraries/logic/FlashLoanLogic.sol:FlashLoanLogic:0xEa13BA369A878F1Dd3cA9799D7EF6d9Bb18598e9,aave-v3-core/contracts/protocol/libraries/logic/LiquidationLogic.sol:LiquidationLogic:0xb56ED0Eb220C5E81C8a09f4f3b2EfB8C92c8B5D5,aave-v3-core/contracts/protocol/libraries/logic/PoolLogic.sol:PoolLogic:0x1ee802B1bA2C1d529386e63630E50d3542eE6647,aave-v3-core/contracts/protocol/libraries/logic/SupplyLogic.sol:SupplyLogic:0xb0d34C0B825B679445E4CB9e3E4D887E26c61986
I updated the libraries to the one's mentioned in the previous comment and I was able to send all the transactions. Initially thought there was some issues with the libraries I deployed but when trying again with the libraries which I was using before I was able to send all the transactions too.
So currently the patch seems to work fine for me, not sure about the previous behaviour, could be due to some old cache (had cleared all the artifacts but still) but not exactly sure.
Awesome, glad to hear you were able to deploy successfully!
I'll go ahead and close the issue, please reopen if you still encounter problems with this deployment!
TLDR of the issue:
The current way we batch factory deps was not working properly and this lead to deployments failures on mainnet.
Originally, we introduced batching due to a gas issue but as we made an improvement on simulation's gas we can now avoid it.
We still allow configuring a batching threshold via MAX_FACTORY_DEPENDENCIES_SIZE_BYTES
env variable, but in our testing this would make the simulation succeed and execution fail.
A final solution for batching is still pending, but you can expect that the simulation to fail when you would need to batch the factory deps.