Feature/zksync native order#394
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements ZkSync-specific support for native order functionality by adapting the contract system to work with ZkSync's unique CREATE2 implementation and bytecode handling.
- Adds ZkSync-specific address computation using ZkSync's custom CREATE2 prefix
- Implements ZkSync-compatible minimal proxy contract for deterministic deployments
- Creates ZkSync variants of native order contracts that use the custom address computation
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/libraries/ZkSyncLib.sol | New library implementing ZkSync-specific CREATE2 address computation |
| contracts/helpers/MinimalProxyZkSync.sol | ZkSync-compatible minimal proxy contract for delegatecall functionality |
| contracts/extensions/NativeOrderImplZkSync.sol | ZkSync variant of NativeOrderImpl using custom address calculation |
| contracts/extensions/NativeOrderImpl.sol | Modified base contract to support inheritance with virtual methods |
| contracts/extensions/NativeOrderFactoryZkSync.sol | ZkSync factory implementation with bytecode hash management |
| contracts/extensions/NativeOrderFactory.sol | Refactored to support virtual clone implementation method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1,37 @@ | |||
| // SPDX-License-Identifier: MIT | |||
|
|
|||
| pragma solidity ^0.8.20; | |||
There was a problem hiding this comment.
The pragma version ^0.8.20 is inconsistent with other contracts in this PR that use 0.8.30. Consider using a consistent Solidity version across all contracts for better maintainability.
| pragma solidity ^0.8.20; | |
| pragma solidity ^0.8.30; |
| MinimalProxyZkSync proxySrc = new MinimalProxyZkSync(IMPLEMENTATION); | ||
| bytes32 bytecodeHashSrc; | ||
| assembly ("memory-safe") { // solhint-disable-line no-inline-assembly | ||
| bytecodeHashSrc := extcodehash(proxySrc) | ||
| } | ||
| _PROXY_BYTECODE_HASH = bytecodeHashSrc; |
There was a problem hiding this comment.
Creating a temporary proxy contract just to get its bytecode hash is inefficient. Consider computing the bytecode hash directly from the proxy's creation code to avoid unnecessary contract deployment in the constructor.
| MinimalProxyZkSync proxySrc = new MinimalProxyZkSync(IMPLEMENTATION); | |
| bytes32 bytecodeHashSrc; | |
| assembly ("memory-safe") { // solhint-disable-line no-inline-assembly | |
| bytecodeHashSrc := extcodehash(proxySrc) | |
| } | |
| _PROXY_BYTECODE_HASH = bytecodeHashSrc; | |
| _PROXY_BYTECODE_HASH = keccak256(MinimalProxyZkSync.creationCode(IMPLEMENTATION)); |
No description provided.