An integration of the zkSync network into Ape framework, with support for Account Abstraction (AA) aware transactions
zkSync is an EVM-compatible L2 with native support for Account Abstraction.
Ape is a new smart contract development platform in Python, focusing on Solidity and EVM (but also supports Vyper, Cairo and non-EVM chains). It's the Python equivalent of Hardhat.
Since Ape framework had no plugin for zkSync, this hackathon was the opportunity to build one. Adding support for Account Abstraction works well with plugin system, and allows sending transactions directly from smart accounts like Argent, Gnosis Safe etc.
This project managed to:
Integrate the ZK compiler into Ape framework, compiling Solidity code into zkSync's zkEVM bytecode (different than regular EVM bytecode)
Integrate a new zkSync network and provider in the framework, allowing to send transactions to the sequencer.
Include and serialize zkSync's new transaction format for AA-style transactions.
Send an AA-aware transaction from the framework to the sequencer:
https://explorer.zksync.io/tx/0x07ce8617c81410abfb304f4af8e6cdc4948ff58006126a9981c05fa82d69c22f
Account Abstraction:
Implemented zkSync's AA protocol heavily inspired by EIP-4337, using a special transaction type based on an RLP encoded EIP-712 structured message. Ported over the official TypeScript implementation to Python and checked that it worked in simple cases.
Compiler support:
Started with compiler support by translating code from zkSync's official Hardhat repo into Python, copied the compiler binary into the repo, but ideally it should be downloaded automatically. Used the regular Solidity compiler as input for the ZK compiler, adding support for compiling different versions of Solidity.
Provider:
zkSync is EVM compatible so it was mostly a matter of configuration for adding the new network.