From 61c6161edc38740f6d6c699eb5732a7d906a1af6 Mon Sep 17 00:00:00 2001 From: Marko Arambasic Date: Tue, 1 Oct 2024 17:06:48 +0200 Subject: [PATCH 1/5] chore: update upgradable and solc docs with new released plugin changes details --- .../30.plugins/40.hardhat-zksync-solc.md | 4 ++++ .../70.hardhat-zksync-upgradable.md | 24 ++++++++++--------- cspell-config/cspell-dev.txt | 2 ++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md index ce274696..8a447754 100644 --- a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md +++ b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md @@ -76,6 +76,8 @@ zksolc: { mode: '3', // optional. 3 by default, z to optimize bytecode size fallback_to_optimizing_for_size: false, // optional. Try to recompile with optimizer mode "z" if the bytecode is too large }, + suppressedWarnings: ['txorigin', 'sendtransfer'], // Suppress specified warnings. Currently supported: txorigin, sendtransfer + suppressedErrors: ['txorigin', 'sendtransfer'], // Suppress specified errors. Currently supported: txorigin, sendtransfer experimental: { dockerImage: '', // deprecated tag: '' // deprecated @@ -107,6 +109,8 @@ Defaults to `./.zksolc-libraries-cache/missingLibraryDependencies.json`. - `enabled`: `true` (default) or `false`. - `mode`: `3` (default) recommended for most projects. Mode `z` reduces bytecode size for large projects that make heavy use of `keccak` and far calls. - `fallback_to_optimizing_for_size` (optional) indicates that the compiler will try to recompile with optimizer mode "z" if the bytecode is too large. +- `suppressedWarnings` - Suppress specified warnings. Currently supported: txorigin, sendtransfer +- `suppressedErrors` - Suppress specified errors. Currently supported: txorigin, sendtransfer - `metadata`: Metadata settings. If the option is omitted, the metadata hash appends by default: - `bytecodeHash`: Can only be `none`. It removes metadata hash from the bytecode. - `dockerImage` and `tag` are deprecated options used to identify the name of the compiler docker image. diff --git a/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md b/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md index 7de54154..e9ee4722 100644 --- a/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md +++ b/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md @@ -25,6 +25,18 @@ Ensure you are using the correct version of the plugin with ethers: Examples are adopted for plugin version **>=1.0.0** :: +::callout{icon="i-heroicons-exclamation-triangle" color="amber"} +Ensure that you're using the correct version of OpenZeppelin Contracts Upgradable for compatibility with your plugin: + +- For plugin version **<1.6.0**: + + - Compatible with `@openzeppelin/contracts-upgradeable` **v4**. + +- For plugin version **≥1.7.0**: + - Compatible with `@openzeppelin/contracts-upgradeable` **v5** (⭐ Recommended) + +:: + ## Installation ::callout{icon="i-heroicons-exclamation-triangle" color="amber"} @@ -216,16 +228,6 @@ npx hardhat run SCRIPT_FILE :: -### Openzeppelin Version - -The plugin does not work with the latest versions due to a blocker on the `@matterlab/zksync-contracts` package. -The solution is to change the development dependencies to the previous version in your `package.json`. - -```json - "@openzeppelin/contracts": "^4.9.5", - "@openzeppelin/contracts-upgradeable": "^4.9.5", -``` - ### Hardhat config ```typescript @@ -287,7 +289,7 @@ contract BoxUups is Initializable, { function initialize(uint256 initValue) public initializer { value = initValue; - __Ownable_init(); + __Ownable_init(msg.sender); __UUPSUpgradeable_init(); } diff --git a/cspell-config/cspell-dev.txt b/cspell-config/cspell-dev.txt index 24e2ddad..f35201ba 100644 --- a/cspell-config/cspell-dev.txt +++ b/cspell-config/cspell-dev.txt @@ -90,8 +90,10 @@ smod sqlx-cli sstore syncvm +sendtransaction tlsv1 tokio +txorigin unroller viem Viem From 5e936ca6ab1c714e2db2419af99f990e3b04cf92 Mon Sep 17 00:00:00 2001 From: Marko Arambasic Date: Wed, 2 Oct 2024 10:50:24 +0200 Subject: [PATCH 2/5] chore: add new parameter to the command list --- .../20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md b/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md index e9ee4722..069af21c 100644 --- a/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md +++ b/content/00.build/40.tooling/20.hardhat/30.plugins/70.hardhat-zksync-upgradable.md @@ -832,6 +832,7 @@ yarn hardhat deploy-zksync:proxy --contract-name \ [--constructor-args ] \ [--deployment-type ] \ [--initializer ] \ + [--initial-owner ] \ [--no-compile] ``` @@ -854,6 +855,7 @@ yarn hardhat deploy-zksync:beacon --contract-name \ [--constructor-args ] \ [--deployment-type ] \ [--initializer ] \ + [--initial-owner ] \ [--no-compile] ``` @@ -887,6 +889,8 @@ e.g. `yarn hardhat upgrade-zksync:beacon --contract-name BoxV2 --beacon-address - `--proxy-address ` - deployed proxy contract address, e.g. `yarn hardhat upgrade-zksync:proxy --contract-name BoxV2 --proxy-address 0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520`. - `--initializer ` - initializer method name present in the contract, e.g. `hardhat deploy-zksync:proxy --contract-name Contract --initializer store`. If this parameter is omitted, the default value will be `initialize`. +- `--initial-owner` - specify inital contract owner, e.g. `hardhat deploy-zksync:beacon --contract-name Contract --initial-owner 0xa61464658AfeAf65CccaaFD3a512b69A83B77618`. +If this argument is omitted wallet address will be used. - `--no-compile`- skip the compilation process, e.g. `hardhat deploy-zksync:beacon --contract-name Contract --no-compile`. - `--deployment-type` - specify which deployer smart contract function will be called. Permissible values for this parameter include `create`, `create2`, `createAccount`, and `create2Account`. From 1b660fdb3330474a62c75a0450804f658e065acd Mon Sep 17 00:00:00 2001 From: Marko Arambasic <131957563+kiriyaga-txfusion@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:53:31 +0200 Subject: [PATCH 3/5] Update content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md Co-authored-by: Antonio --- .../40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md index 8a447754..e9a24bd0 100644 --- a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md +++ b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md @@ -110,7 +110,7 @@ Defaults to `./.zksolc-libraries-cache/missingLibraryDependencies.json`. - `mode`: `3` (default) recommended for most projects. Mode `z` reduces bytecode size for large projects that make heavy use of `keccak` and far calls. - `fallback_to_optimizing_for_size` (optional) indicates that the compiler will try to recompile with optimizer mode "z" if the bytecode is too large. - `suppressedWarnings` - Suppress specified warnings. Currently supported: txorigin, sendtransfer -- `suppressedErrors` - Suppress specified errors. Currently supported: txorigin, sendtransfer +- `suppressedErrors` - Suppress specified errors. Supported values: "txorigin" (when contracts use `tx.origin`), and "sendtransfer" (when contracts use `.transfer`) - `metadata`: Metadata settings. If the option is omitted, the metadata hash appends by default: - `bytecodeHash`: Can only be `none`. It removes metadata hash from the bytecode. - `dockerImage` and `tag` are deprecated options used to identify the name of the compiler docker image. From 3132be20a21e960ffcf92e643e388e6d4a45b2b5 Mon Sep 17 00:00:00 2001 From: Marko Arambasic <131957563+kiriyaga-txfusion@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:53:37 +0200 Subject: [PATCH 4/5] Update content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md Co-authored-by: Antonio --- .../40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md index e9a24bd0..4803d360 100644 --- a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md +++ b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md @@ -109,7 +109,7 @@ Defaults to `./.zksolc-libraries-cache/missingLibraryDependencies.json`. - `enabled`: `true` (default) or `false`. - `mode`: `3` (default) recommended for most projects. Mode `z` reduces bytecode size for large projects that make heavy use of `keccak` and far calls. - `fallback_to_optimizing_for_size` (optional) indicates that the compiler will try to recompile with optimizer mode "z" if the bytecode is too large. -- `suppressedWarnings` - Suppress specified warnings. Currently supported: txorigin, sendtransfer +- `suppressedWarnings` - Suppress specified warnings. Supported values: "txorigin" (when contracts use `tx.origin`), and "sendtransfer" (when contracts use `.transfer`) - `suppressedErrors` - Suppress specified errors. Supported values: "txorigin" (when contracts use `tx.origin`), and "sendtransfer" (when contracts use `.transfer`) - `metadata`: Metadata settings. If the option is omitted, the metadata hash appends by default: - `bytecodeHash`: Can only be `none`. It removes metadata hash from the bytecode. From 25b7b50e0656ed55f78e83cc722f9a70b4ee7292 Mon Sep 17 00:00:00 2001 From: Marko Arambasic Date: Wed, 2 Oct 2024 12:02:14 +0200 Subject: [PATCH 5/5] chore: line length fix --- .../20.hardhat/30.plugins/40.hardhat-zksync-solc.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md index 4803d360..1b970813 100644 --- a/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md +++ b/content/00.build/40.tooling/20.hardhat/30.plugins/40.hardhat-zksync-solc.md @@ -109,8 +109,10 @@ Defaults to `./.zksolc-libraries-cache/missingLibraryDependencies.json`. - `enabled`: `true` (default) or `false`. - `mode`: `3` (default) recommended for most projects. Mode `z` reduces bytecode size for large projects that make heavy use of `keccak` and far calls. - `fallback_to_optimizing_for_size` (optional) indicates that the compiler will try to recompile with optimizer mode "z" if the bytecode is too large. -- `suppressedWarnings` - Suppress specified warnings. Supported values: "txorigin" (when contracts use `tx.origin`), and "sendtransfer" (when contracts use `.transfer`) -- `suppressedErrors` - Suppress specified errors. Supported values: "txorigin" (when contracts use `tx.origin`), and "sendtransfer" (when contracts use `.transfer`) +- `suppressedWarnings` - Suppress specified warnings. Supported values: "txorigin" (when contracts use `tx.origin`), +and "sendtransfer" (when contracts use `.transfer`) +- `suppressedErrors` - Suppress specified errors. Supported values: "txorigin" (when contracts use `tx.origin`), +and "sendtransfer" (when contracts use `.transfer`) - `metadata`: Metadata settings. If the option is omitted, the metadata hash appends by default: - `bytecodeHash`: Can only be `none`. It removes metadata hash from the bytecode. - `dockerImage` and `tag` are deprecated options used to identify the name of the compiler docker image.