From 78e8b1b7531565ddd6282a867b7454eb863e6f5d Mon Sep 17 00:00:00 2001 From: elfedy Date: Mon, 14 Oct 2024 16:49:49 -0300 Subject: [PATCH 1/2] feat: add non-inlinable libraries section --- src/SUMMARY.md | 1 + src/zksync-specifics/README.md | 1 + .../non-inlinable-libraries.md | 28 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 src/zksync-specifics/non-inlinable-libraries.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index f351d98d7..683cde8dd 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -21,6 +21,7 @@ - [Overview](./zksync-specifics/README.md) - [Execution Overview](./zksync-specifics/execution-overview.md) - [Compilation Overview](./zksync-specifics/compilation-overview.md) +- [Non Inlinable Libraries](./zksync-specifics/non-inlinable-libraries.md) - [Configuration Overview](./zksync-specifics/configuration-overview.md) - [Limitations](./zksync-specifics/limitations/README.md) - [General](./zksync-specifics/limitations/general.md) diff --git a/src/zksync-specifics/README.md b/src/zksync-specifics/README.md index 3e45066cc..4bf602dd6 100644 --- a/src/zksync-specifics/README.md +++ b/src/zksync-specifics/README.md @@ -2,6 +2,7 @@ - [Execution Overview](execution-overview.md) - [Compilation Overview](compilation-overview.md) +- [Non Inlinable Libraries](non-inlinable-libraries.md) - [Limitations](limitations/README.md) - [General](limitations/general.md) - [Compilation](limitations/compilation.md) diff --git a/src/zksync-specifics/non-inlinable-libraries.md b/src/zksync-specifics/non-inlinable-libraries.md new file mode 100644 index 000000000..4f4acc9fc --- /dev/null +++ b/src/zksync-specifics/non-inlinable-libraries.md @@ -0,0 +1,28 @@ +## Non inlinable libraries + +Compiling contracts without linking non-inlinable libraries is currently not supported. Libraries need to be deployed before building contracts using them. + +When building the contracts, the addresses need to be passed using the `libraries` config which contains a list of `CONTRACT_PATH`:`ADDRESS` mappings. + +on `foundry.toml`: + +```toml +libraries = [ + "src/MyLibrary.sol:MyLibrary:0xfD88CeE74f7D78697775aBDAE53f9Da1559728E4" +] +``` + +as a `cli` flag: + +```bash +forge build --zksync --libraries src/MyLibrary.sol:MyLibrary:0xfD88CeE74f7D78697775aBDAE53f9Da1559728E4 + +``` + +For more information please refer to [official docs](https://docs.zksync.io/build/developer-reference/ethereum-differences/libraries). + +### Listing missing libraries + +To scan missing non-inlinable libraries, you can build the project using the `--zk-detect-missing-libraries` flag. This will give a list of the libraries that need to be deployed and their addresses provided via the `libraries` option for the contracts to compile. Metadata about the libraries will be saved in `.zksolc-libraries-cache/missing_library_dependencies.json`. + + From f185787f1daf33a545e697de65eb278c9bf7e580 Mon Sep 17 00:00:00 2001 From: elfedy Date: Tue, 15 Oct 2024 14:01:46 -0300 Subject: [PATCH 2/2] Move non-inlinable libraries to compilation limitations section --- src/SUMMARY.md | 1 - src/zksync-specifics/README.md | 1 - .../limitations/compilation.md | 31 ++++++++++++++++++- .../non-inlinable-libraries.md | 28 ----------------- 4 files changed, 30 insertions(+), 31 deletions(-) delete mode 100644 src/zksync-specifics/non-inlinable-libraries.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 683cde8dd..f351d98d7 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -21,7 +21,6 @@ - [Overview](./zksync-specifics/README.md) - [Execution Overview](./zksync-specifics/execution-overview.md) - [Compilation Overview](./zksync-specifics/compilation-overview.md) -- [Non Inlinable Libraries](./zksync-specifics/non-inlinable-libraries.md) - [Configuration Overview](./zksync-specifics/configuration-overview.md) - [Limitations](./zksync-specifics/limitations/README.md) - [General](./zksync-specifics/limitations/general.md) diff --git a/src/zksync-specifics/README.md b/src/zksync-specifics/README.md index 4bf602dd6..3e45066cc 100644 --- a/src/zksync-specifics/README.md +++ b/src/zksync-specifics/README.md @@ -2,7 +2,6 @@ - [Execution Overview](execution-overview.md) - [Compilation Overview](compilation-overview.md) -- [Non Inlinable Libraries](non-inlinable-libraries.md) - [Limitations](limitations/README.md) - [General](limitations/general.md) - [Compilation](limitations/compilation.md) diff --git a/src/zksync-specifics/limitations/compilation.md b/src/zksync-specifics/limitations/compilation.md index 49493a375..599054146 100644 --- a/src/zksync-specifics/limitations/compilation.md +++ b/src/zksync-specifics/limitations/compilation.md @@ -77,4 +77,33 @@ There are three possible solutions to address this issue: contract MainContract is ContractPart1, ContractPart2 { // Logic to combine the functionalities of both parts } - ``` \ No newline at end of file + ``` + +### Non inlinable libraries + +Compiling contracts without linking non-inlinable libraries is currently not supported. Libraries need to be deployed before building contracts using them. + +When building the contracts, the addresses need to be passed using the `libraries` config which contains a list of `CONTRACT_PATH`:`ADDRESS` mappings. + +on `foundry.toml`: + +```toml +libraries = [ + "src/MyLibrary.sol:MyLibrary:0xfD88CeE74f7D78697775aBDAE53f9Da1559728E4" +] +``` + +as a `cli` flag: + +```bash +forge build --zksync --libraries src/MyLibrary.sol:MyLibrary:0xfD88CeE74f7D78697775aBDAE53f9Da1559728E4 + +``` + +For more information please refer to [official docs](https://docs.zksync.io/build/developer-reference/ethereum-differences/libraries). + +#### Listing missing libraries + +To scan missing non-inlinable libraries, you can build the project using the `--zk-detect-missing-libraries` flag. This will give a list of the libraries that need to be deployed and their addresses provided via the `libraries` option for the contracts to compile. Metadata about the libraries will be saved in `.zksolc-libraries-cache/missing_library_dependencies.json`. + + diff --git a/src/zksync-specifics/non-inlinable-libraries.md b/src/zksync-specifics/non-inlinable-libraries.md deleted file mode 100644 index 4f4acc9fc..000000000 --- a/src/zksync-specifics/non-inlinable-libraries.md +++ /dev/null @@ -1,28 +0,0 @@ -## Non inlinable libraries - -Compiling contracts without linking non-inlinable libraries is currently not supported. Libraries need to be deployed before building contracts using them. - -When building the contracts, the addresses need to be passed using the `libraries` config which contains a list of `CONTRACT_PATH`:`ADDRESS` mappings. - -on `foundry.toml`: - -```toml -libraries = [ - "src/MyLibrary.sol:MyLibrary:0xfD88CeE74f7D78697775aBDAE53f9Da1559728E4" -] -``` - -as a `cli` flag: - -```bash -forge build --zksync --libraries src/MyLibrary.sol:MyLibrary:0xfD88CeE74f7D78697775aBDAE53f9Da1559728E4 - -``` - -For more information please refer to [official docs](https://docs.zksync.io/build/developer-reference/ethereum-differences/libraries). - -### Listing missing libraries - -To scan missing non-inlinable libraries, you can build the project using the `--zk-detect-missing-libraries` flag. This will give a list of the libraries that need to be deployed and their addresses provided via the `libraries` option for the contracts to compile. Metadata about the libraries will be saved in `.zksolc-libraries-cache/missing_library_dependencies.json`. - -