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

fix: compatibility with zkSync #51

Merged
merged 45 commits into from
May 21, 2024

Conversation

Karrq
Copy link
Contributor

@Karrq Karrq commented May 2, 2024

This PR aims to address several discrepancies found when running the AAVE Delivery Infrastructure tests on the ZkSync network, with the ultimate goal of making AAVE protocol compatible with ZkSync.

The main discrepancies include:

  1. Reserved Addresses: In ZkSync, addresses below 2^16 are reserved and using them during testing can lead to failures or slow down the process due to the necessity of excluding them. The proposed solution is to introduce a fuzz config flag called no_zksync_reserved_addresses that offsets system-generated reserved addresses by 65536, allowing them to fall within the valid address range. This avoids using prop_filter and maps invalid addresses to the valid address range, ensuring minimal impact on fuzzer performance.
  2. Contract Size: In ZkEVM, contract size must be divisible by 32 bytes (4 instructions). Additionally, bytecode cannot exceed 2^16 32-byte words. The proposed solution (for the first issue) is to implement a method that satisfies the ensure_chunkable validation, so contract size will be divisible by 32.
  3. Issuing a CALL to tx.origin: Attempts to call the tx.origin address fail in ZkVM, so we propose using vm.assume to confirm that the address being called is not identical to tx.origin during fuzzing.

Test suite specific discrepancies:

  1. Adapter tests use different selectors for mocking functions than the actual implementations, causing discrepancies. The solution involves aligning the used selectors with the actual implementations.
  2. The Forwarder test suite needs to be updated to properly mock function calls and return values, ensuring compatibility with ZkVM.

By addressing these issues, we aim to facilitate discussions on the changes made and their reasons, ultimately leading to Aave's successful implementation on the ZkSync network.

Contributors

@HermanObst, @Jrigada, @Karrq, @nbaztec


/cc @Deniallugo @dutterbutter

Jrigada and others added 30 commits April 15, 2024 17:35
…r-CI

Comment out tests that still need to be fixed
fix: Assume on tests failing due to low addresses
Use non-reserved addresses for CrossChainReceiverTest
chore: Uncomment some CrossChainReceiverTest test
fix: reserved addresses on CrossChainController* tests
@sendra sendra marked this pull request as ready for review May 21, 2024 08:57
@sendra sendra merged commit ba9ce98 into bgd-labs:feat/zksync May 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants