matter-labs / hardhat-zksync

Apache License 2.0
279 stars 227 forks source link

Add support for specifying separate addresses for non-inlinable libraries on different networks #1531

Open dutterbutter opened 1 week ago

dutterbutter commented 1 week ago

🌟 Feature Request for hardhat-zksync plugin

Related discussion from vmaark here: https://github.com/zkSync-Community-Hub/zksync-developers/discussions/763

πŸ’₯ Plugin name

hardhat-zksync

πŸ“ Description

Add support for specifying separate addresses for non-inlinable libraries on different networks in the compiler settings. Currently, non-inlinable libraries need to be deployed separately, with the address specified in the hardhat config. However, this single address setup poses issues when deploying to multiple networks, such as a testnet and mainnet, or different chains built with ZK Stack.

This new feature would allow users to provide a mapping with unique library addresses for each network, enabling seamless deployment to multiple targets without needing to manually change configuration files.

πŸ€” Rationale

This feature is essential for teams working with multiple deployment targets, as it ensures flexibility and efficiency when deploying to various networks. By supporting network-specific addresses, developers can automate deployments across different environments more effectively, saving time and reducing potential for error.

πŸ–ΌοΈ Mockups/Examples

If implemented, the configuration could look like this:

module.exports = {
  solidity: "0.8.7",
  networks: {
    mainnet: {
      libraryAddresses: {
        SomeLibrary: "0xMainnetAddress",
      },
    },
    testnet: {
      libraryAddresses: {
        SomeLibrary: "0xTestnetAddress",
      },
    },
  },
};

πŸ“‹ Additional Context

This enhancement would be particularly useful for projects utilizing ZK Stack or deploying across both mainnet and testnet environments. It provides a streamlined approach for managing library dependencies across various network configurations.

kiriyaga-txfusion commented 6 days ago

Hello @dutterbutter, The ML team has worked on compiler improvements to support linking libraries during deployment. As a result, this feature is no longer necessary. We will be releasing a new version of the plugins that allows users to link libraries when deploying a contract, similar to the functionality we have on L1. Here a link to the PR