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

Create a package for external contract interfaces #1209

Open
7 tasks
dutterbutter opened this issue Jan 20, 2025 · 5 comments
Open
7 tasks

Create a package for external contract interfaces #1209

dutterbutter opened this issue Jan 20, 2025 · 5 comments

Comments

@dutterbutter
Copy link

dutterbutter commented Jan 20, 2025

Description

External projects are increasingly making use of era-contracts for their Foundry projects. However, issues like #802 and #457 hinder the developer experience. Additionally, the era-contracts repo includes components that are not relevant or intended for external use.

To address these challenges, propose creating a new repo or package dedicated to external useful contracts.


Why This Is Needed

  1. Improve External Usability
    The current era-contracts repo does not distinguish internal and external usage, potentially leading to confusion. A dedicated package for external-facing contracts will improve clarity and usability for developers.

  2. Enable Floating Pragma

    • Existing contracts are locked to strict versioning (pragma solidity 0.8.20), creating friction for developers using these contracts as libraries in their projects.
    • Floating pragma (pragma solidity ^0.8.0) allows greater flexibility. This change is particularly necessary for compatibility with various Solidity versions in external projects.
  3. Resolve Placeholder Issues
    When users install matter-labs/era-contracts via Foundry (forge install matter-labs/era-contracts), compilation fails due to unresolved placeholders in files like Constants.sol. This package should address this issue.

  4. Streamline Integration
    Developers should only need external-facing contracts, not the entire repo. A streamlined package will simplify project dependencies.


Proposed Solution

  1. Create a Repo

    • We could make use of existing forge-zksync-std and update to include desired contracts? Or else a new repo to house the desireed contracts.
  2. Scope Floating Pragmas

    • Update identified contracts to use floating pragmas.
  3. Resolve Constants

    • Replace placeholders like {{SYSTEM_CONTRACTS_OFFSET}} with actual value.

Tasks

  1. Repository Setup

    • Determine where contracts should live.
    • Determine appropriate name for repo.
    • Configure repository.
  2. Contract Refinement

    • Identify external-facing contracts and move them into the new repo.
    • Update contracts to use floating pragma (pragma solidity ^0.8.0) where applicable.
    • Resolve placeholders in contracts like Constants.sol.
  3. Documentation

    • Update existing Foundry related documentation referencing era-contracts in favour of this new package/repo
@itegulov
Copy link
Contributor

itegulov commented Feb 5, 2025

Maybe I am missing something but are you aware of https://www.npmjs.com/package/@matterlabs/zksync-contracts/v/beta? From what I can tell it is hitting all the checkmarks on your list but is admittedly hard to find as it was never "finished" and publicly announced. It should be fairly easy to resurrect that effort if we want (AFAIK it even has a CI script for pulling era-contracts changes automatically).

@coffeexcoin
Copy link

coffeexcoin commented Feb 6, 2025

This is not a foundry package, this is npm/js

Forge uses either git submodules for dependencies or the newer Soldeer

Ideally both would be supported as they are widely used in the foundry ecosystem

@itegulov
Copy link
Contributor

itegulov commented Feb 6, 2025

Well, the README even mentions that you can install it with foundry/forge by running forge install matter-labs/v2-testnet-contracts@beta. I tried it locally and it seems to be working fine (as a git submodule as you mentioned).

Very likely that it needs more love on Soldeer front but I fail to see how it is not a valid foundry package?

@coffeexcoin
Copy link

ah, I did not look at the actual js package readme, just that it was an npm link.

Is the matter-labs/v2-testnet-contracts repo safe to use in production?

@itegulov
Copy link
Contributor

itegulov commented Feb 6, 2025

main branch is very outdated, beta is a lot more recent but let me get back to you on that question. I need to clarify what our plans for that branch is.

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

No branches or pull requests

3 participants