Predeploys should be proxies#119
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR migrates Ethscriptions predeploy contracts to use a proxy pattern, aligning with OP Stack architecture. The main change is moving the ETHSCRIPTIONS address from 0xEeee... to 0x3300...0001 to match the Ethscriptions namespace, and introducing proxy/implementation separation for system contracts.
Key changes:
- Updated
ETHSCRIPTIONS_ADDRESSconstant from0xEeee...to0x3300...0001across the codebase - Introduced proxy/implementation separation for predeploy contracts with distinct addresses
- Refactored genesis deployment script to create proxies across the full
0x3300...namespace
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/sys_config.rb | Updated ETHSCRIPTIONS_ADDRESS to new namespace |
| lib/storage_reader.rb | Changed to use centralized SysConfig constant |
| lib/event_decoder.rb | Changed to use centralized SysConfig constant |
| contracts/src/libraries/Predeploys.sol | Added proxy/implementation address pairs and namespace helper functions |
| contracts/src/TokenManager.sol | Updated to reference ERC20_TEMPLATE_IMPLEMENTATION instead of ERC20_TEMPLATE |
| contracts/src/CollectionsManager.sol | Updated to reference ERC721_TEMPLATE_IMPLEMENTATION instead of ERC721_TEMPLATE |
| contracts/script/L2Genesis.s.sol | Refactored to deploy proxies across namespace and wire up implementations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| address constant ERC721_TEMPLATE_PROXY = 0x3300000000000000000000000000000000000005; | ||
|
|
||
| /// @notice Implementation address for the ERC721 template (actual logic contract) | ||
| address constant ERC721_TEMPLATE_IMPLEMENTATION = 0xc0d3C0d3c0D3c0d3C0D3C0D3c0D3C0D3c0d30005; |
There was a problem hiding this comment.
Bug: ERC20/721 Template Address Casing Mismatch
The ERC20_TEMPLATE_IMPLEMENTATION and ERC721_TEMPLATE_IMPLEMENTATION addresses have inconsistent hex casing compared to the pattern derived by the predeployToCodeNamespace function. While the underlying address values are functionally equivalent in the EVM, this casing mismatch creates an inconsistency in the addressing scheme, which could lead to confusion or issues with string comparisons and checksum validations.
Note
Moves Ethscriptions to proxied 0x330… predeploys, wires implementations via code-namespace, and updates template/constants and tooling accordingly.
0x3300…with EIP-1967 admin set toPredeploys.PROXY_ADMINand implementations in code-namespace viasetImplementation.GenesisEthscriptionsto the implementation address, calling via proxy, then swapping in realEthscriptionsimplementation without resetting nonce._setImplementationCodeNamedand_setCodeAthelpers; templates (ERC20,ERC721) etched at implementation addresses (not proxied).ETHSCRIPTIONSto0x3300…0001; addERC20_TEMPLATE_PROXY/IMPLEMENTATIONandERC721_TEMPLATE_PROXY/IMPLEMENTATIONconstants.isOPPredeployNamespace,isEthscriptionsPredeployNamespace, and broadenisPredeployNamespace; keeppredeployToCodeNamespacefor both namespaces.CollectionsManagerandTokenManager: pointerc721Template/erc20Templateto*_TEMPLATE_IMPLEMENTATIONconstants.SysConfig: setETHSCRIPTIONS_ADDRESSto0x3300…0001.event_decoder.rbandstorage_reader.rb: useSysConfig::ETHSCRIPTIONS_ADDRESSinstead of hardcoded address.Written by Cursor Bugbot for commit 232e539. This will update automatically on new commits. Configure here.