bgd-labs / aave-proposals-v3

MIT License
19 stars 23 forks source link

Incompatibilities with zkSync #351

Open Karrq opened 3 months ago

Karrq commented 3 months ago

Hello! 👋

Our team here at Moonsong Labs has been working on adding support for zkSync on foundry & we have been cooperating with several of your repos to make sure all your tests are successful with our new implementation.

We are opening this issue today to inform you of a required action to ensure this repository's contracts are compatible with zkSync in the future.

In short, a refactor of these contracts will be needed as their bytecode size exceeds the limits of the zkEVM (docs).

We have ran your test suites and were unable to compile about 37 of your contracts. We were able to compile an additional 13 contracts by using --fallback-oz true (which sets allowOptimizingForSize in the zksolc's settings), but this still leaves about 24 contracts unable to be compiled, thus those tests are not able to be ran.

The good news is that all tests that we were able to run so far have passed 🚀

List of contracts originally not being able to be compiled ``` ProtocolV3TestBase.sol AaveV2Ethereum_TemporaryFreezeOfLongTailV2Assets_20240418.t.sol AaveV2Avalanche_TemporaryFreezeOfLongTailV2Assets_20240418.t.sol AaveV2Polygon_TemporaryFreezeOfLongTailV2Assets_20240418.t.sol AaveV3Ethereum_LlamariskRiskProvider_20240421.t.sol AaveV2Ethereum_AprilFinanceUpdate_20240421.t.sol AaveV2Polygon_AprilFinanceUpdate_20240421.t.sol AaveV3Gnosis_AprilFinanceUpdate_20240421.t.sol AaveV3Ethereum_StkGHOIncentives_20240424.t.sol AaveV2Avalanche_StablecoinIRUpdates_20240424.t.sol AaveV2Ethereum_StablecoinIRUpdates_20240424.t.sol AaveV3Arbitrum_StablecoinIRUpdates_20240424.t.sol AaveV3Avalanche_StablecoinIRUpdates_20240424.t.sol AaveV3BNB_StablecoinIRUpdates_20240424.t.sol AaveV3Base_StablecoinIRUpdates_20240424.t.sol AaveV3Ethereum_StablecoinIRUpdates_20240424.t.sol AaveV3Gnosis_StablecoinIRUpdates_20240424.t.sol AaveV3Optimism_StablecoinIRUpdates_20240424.t.sol AaveV3Polygon_StablecoinIRUpdates_20240424.t.sol AaveV3Scroll_StablecoinIRUpdates_20240424.t.sol AaveV3Arbitrum_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Avalanche_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3BNB_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Base_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Ethereum_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Gnosis_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Optimism_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Polygon_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Scroll_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Ethereum_UpdatingWeETHRiskParameters_20240426.t.sol 20240429_AaveV2Ethereum_AAMPLSecondDistributionAaveV2Ethereum_AAMPLSecondDistribution_20240429.t.sol AaveV1Ethereum_AaveV1Deprecation_20240502.t.sol AaveV3Ethereum_AaveV31CantinaCompetition_20240503.t.sol AaveV3Ethereum_ACIAdAstra_20240506.t.sol AaveV2Avalanche_ReserveFactorUpgrades_20240506.t.sol AaveV2Ethereum_ReserveFactorUpgrades_20240506.t.sol AaveV3Optimism_SUSDRiskParametersUpdate_20240517.t.sol ```
List of contracts still unable to be compiled (even with --fallback-oz true) ``` AaveV3Ethereum_LlamariskRiskProvider_20240421.t.sol AaveV3Gnosis_AprilFinanceUpdate_20240421.t.sol AaveV3Arbitrum_StablecoinIRUpdates_20240424.t.sol AaveV3Avalanche_StablecoinIRUpdates_20240424.t.sol AaveV3BNB_StablecoinIRUpdates_20240424.t.sol AaveV3Base_StablecoinIRUpdates_20240424.t.sol AaveV3Ethereum_StablecoinIRUpdates_20240424.t.sol AaveV3Gnosis_StablecoinIRUpdates_20240424.t.sol AaveV3Optimism_StablecoinIRUpdates_20240424.t.sol AaveV3Polygon_StablecoinIRUpdates_20240424.t.sol AaveV3Scroll_StablecoinIRUpdates_20240424.t.sol AaveV3Arbitrum_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Avalanche_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3BNB_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Base_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Ethereum_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Gnosis_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Optimism_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Polygon_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Scroll_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol AaveV3Ethereum_UpdatingWeETHRiskParameters_20240426.t.sol AaveV3Ethereum_AaveV31CantinaCompetition_20240503.t.sol AaveV3Ethereum_ACIAdAstra_20240506.t.sol AaveV3Optimism_SUSDRiskParametersUpdate_20240517.t.sol ```
Here's the command to run the test suite, edit the value of --avoid-contracts to remove contracts that now fit the size requirements (or to try to see if they fit) ``` forge test --zksync --fallback-oz true --avoid-contracts '**/AaveV3Ethereum_LlamariskRiskProvider_20240421.t.sol,**/AaveV3Gnosis_AprilFinanceUpdate_20240421.t.sol,**/AaveV3Arbitrum_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Avalanche_StablecoinIRUpdates_20240424.t.sol,**/AaveV3BNB_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Base_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Ethereum_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Gnosis_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Optimism_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Polygon_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Scroll_StablecoinIRUpdates_20240424.t.sol,**/AaveV3Arbitrum_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Avalanche_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3BNB_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Base_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Ethereum_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Gnosis_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Optimism_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Polygon_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Scroll_GeneralizedLTLTVReductionsOnAaveV3Step2_20240425.t.sol,**/AaveV3Ethereum_UpdatingWeETHRiskParameters_20240426.t.sol,**/AaveV3Ethereum_AaveV31CantinaCompetition_20240503.t.sol,**/AaveV3Ethereum_ACIAdAstra_20240506.t.sol,**/AaveV3Optimism_SUSDRiskParametersUpdate_20240517.t.sol' ```

/cc @HermanObst @Jrigada @nbaztec

MexicanAce commented 3 months ago

It looks like the common failure might be coming from ProtocolV3TestBase, and there's a PR to address splitting things out in the helper contract here: https://github.com/bgd-labs/aave-helpers/pull/301/files#diff-11db244616c6e96935c437db0de7ce023dfffdf011d81daa390a7961d2702aae

This should resolve the issue for exceeding bytecode size limitations for these tests.