Skip to content

Commit

Permalink
chore: zksync-ethers 5.8.0-beta.5 (#387)
Browse files Browse the repository at this point in the history
Co-authored-by: Stanislav Breadless <[email protected]>
  • Loading branch information
benceharomi and StanislavBreadless authored Jun 11, 2024
1 parent 8df3025 commit 311b82e
Show file tree
Hide file tree
Showing 28 changed files with 203 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ contract GasBoundCallerTester is GasBoundCaller {
}
}

function testReturndataOverhead(uint256 len) external {
function testReturndataOverhead(uint256 _len, uint256 _gasForInner) external {
uint256 gasbefore = gasleft();
this.testReturndataOverheadInner(false, len);
this.testReturndataOverheadInner{gas: _gasForInner}(false, _len);
lastRecordedGasLeft = gasbefore - gasleft();
}

Expand Down
9 changes: 4 additions & 5 deletions gas-bound-caller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
"eslint-plugin-prettier": "^5.0.1",
"ethers": "^5.7.0",
"fast-glob": "^3.3.2",
"hardhat": "^2.18.3",
"preprocess": "^3.2.0",
"zksync-ethers": "https://github.com/zksync-sdk/zksync-ethers#ethers-v5-feat/bridgehub"
"hardhat": "=2.22.2",
"preprocess": "^3.2.0"
},
"devDependencies": {
"@matterlabs/hardhat-zksync-chai-matchers": "^0.1.4",
"@matterlabs/hardhat-zksync-chai-matchers": "^0.2.0",
"@matterlabs/hardhat-zksync-node": "^0.0.1-beta.7",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.3",
"@nomiclabs/hardhat-ethers": "^2.0.0",
Expand All @@ -38,7 +37,7 @@
"ts-node": "^10.1.0",
"typechain": "^4.0.0",
"typescript": "^4.6.4",
"zksync-ethers": "https://github.com/zksync-sdk/zksync-ethers#ethers-v5-feat/bridgehub"
"zksync-ethers": "5.8.0-beta.5"
},
"mocha": {
"timeout": 240000,
Expand Down
5 changes: 3 additions & 2 deletions gas-bound-caller/test/GasBoundCaller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ describe("GasBoundCaller tests", function () {
});

it("test returndata overhead", async () => {
// The tests' behavior depends on the amount of gas provided to its inner part, so we always provide 40kk
await (
await tester.testReturndataOverhead(10, {
await tester.testReturndataOverhead(10, 40_000_000, {
gasLimit: 80_000_000,
})
).wait();
const smallBytecodeGas = await tester.lastRecordedGasLeft();

await (
await tester.testReturndataOverhead(100000, {
await tester.testReturndataOverhead(100000, 40_000_000, {
gasLimit: 80_000_000,
})
).wait();
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"ts-node": "^10.1.0",
"typechain": "^4.0.0",
"typescript": "^4.6.4",
"zksync-ethers": "https://github.com/zksync-sdk/zksync-ethers#ethers-v5-feat/bridgehub"
"zksync-ethers": "5.8.0-beta.5"
},
"scripts": {
"build": "hardhat compile",
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/scripts/display-governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { applyL1ToL2Alias, getAddressFromEnv } from "../src.ts/utils";
import * as fs from "fs";

import { UpgradeableBeaconFactory } from "../../l2-contracts/typechain/UpgradeableBeaconFactory";
import { Provider } from "zksync-web3";
import { Provider } from "zksync-ethers";

const l2SharedBridgeABI = JSON.parse(
fs.readFileSync("../zksync/artifacts-zk/contracts/bridge/L2SharedBridge.sol/L2SharedBridge.json").toString()
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/scripts/setup-legacy-bridge-era.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { web3Provider, GAS_MULTIPLIER } from "./utils";
import { deployedAddressesFromEnv } from "../src.ts/deploy-utils";
import { ethTestConfig, getAddressFromEnv } from "../src.ts/utils";
import { hashL2Bytecode } from "../../l2-contracts/src/utils";
import { Provider } from "zksync-web3";
import { Provider } from "zksync-ethers";
import beaconProxy = require("../../l2-contracts/artifacts-zk/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.json");

const provider = web3Provider();
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/src.ts/deploy-test-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as ethers from "ethers";
import type { BigNumberish, Wallet } from "ethers";
import { Interface } from "ethers/lib/utils";
import * as zkethers from "zksync-ethers";
import { ETH_ADDRESS_IN_CONTRACTS } from "zksync-ethers/build/src/utils";
import { ETH_ADDRESS_IN_CONTRACTS } from "zksync-ethers/build/utils";
import * as fs from "fs";

import type { FacetCut } from "./diamondCut";
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/test/unit_tests/l2-upgrade.test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { BigNumberish } from "ethers";
import { Wallet } from "ethers";
import * as ethers from "ethers";
import * as hardhat from "hardhat";
import { hashBytecode } from "zksync-ethers/build/src/utils";
import { hashBytecode } from "zksync-ethers/build/utils";

import type { AdminFacet, ExecutorFacet, GettersFacet, StateTransitionManager } from "../../typechain";
import {
Expand Down
4 changes: 2 additions & 2 deletions l1-contracts/test/unit_tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as hardhat from "hardhat";
import type { BigNumberish, BytesLike } from "ethers";
import { BigNumber, ethers } from "ethers";
import type { Address } from "zksync-ethers/build/src/types";
import { REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT } from "zksync-ethers/build/src/utils";
import type { Address } from "zksync-ethers/build/types";
import { REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT } from "zksync-ethers/build/utils";

import type { IBridgehub } from "../../typechain/IBridgehub";
import type { IL1ERC20Bridge } from "../../typechain/IL1ERC20Bridge";
Expand Down
6 changes: 3 additions & 3 deletions l2-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.1.0",
"license": "MIT",
"devDependencies": {
"@matterlabs/hardhat-zksync-deploy": "^0.6.5",
"@matterlabs/hardhat-zksync-deploy": "^0.7.0",
"@matterlabs/hardhat-zksync-solc": "^0.3.15",
"@matterlabs/hardhat-zksync-verify": "^0.2.0",
"@matterlabs/hardhat-zksync-verify": "^0.4.0",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-ethers": "^3.0.4",
"@nomicfoundation/hardhat-verify": "^1.1.0",
Expand All @@ -28,7 +28,7 @@
"ts-node": "^10.1.0",
"typechain": "^4.0.0",
"typescript": "^5.2.2",
"zksync-web3": "^0.15.4"
"zksync-ethers": "5.8.0-beta.5"
},
"scripts": {
"build": "hardhat compile",
Expand Down
2 changes: 1 addition & 1 deletion l2-contracts/src/update-l2-erc20-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as hre from "hardhat";
import "@nomiclabs/hardhat-ethers";
import { Command } from "commander";
import { Wallet, ethers, BigNumber } from "ethers";
import { Provider } from "zksync-web3";
import { Provider } from "zksync-ethers";
import { getNumberFromEnv } from "../../l1-contracts/src.ts/utils";
import { web3Provider } from "../../l1-contracts/scripts/utils";
import { Deployer } from "../../l1-contracts/src.ts/deploy";
Expand Down
4 changes: 2 additions & 2 deletions l2-contracts/src/upgrade-bridge-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Command } from "commander";
import { BigNumber, Wallet, ethers } from "ethers";
import * as fs from "fs";
import * as path from "path";
import { Provider } from "zksync-web3";
import { REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT } from "zksync-web3/build/src/utils";
import { Provider } from "zksync-ethers";
import { REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT } from "zksync-ethers/build/utils";
import { web3Provider } from "../../l1-contracts/scripts/utils";
import { getAddressFromEnv, getNumberFromEnv } from "../../l1-contracts/src.ts/utils";
import { Deployer } from "../../l1-contracts/src.ts/deploy";
Expand Down
6 changes: 3 additions & 3 deletions l2-contracts/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { web3Provider } from "../../l1-contracts/scripts/utils";

import type { BigNumber, BytesLike, Wallet } from "ethers";
import { ethers } from "ethers";
import type { Provider } from "zksync-web3";
import { REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT, sleep } from "zksync-web3/build/src/utils";
import { IERC20Factory } from "zksync-web3/build/typechain";
import type { Provider } from "zksync-ethers";
import { REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT, sleep } from "zksync-ethers/build/utils";

import { ERC20Factory } from "../../l1-contracts/typechain";
import { IERC20Factory } from "../typechain/IERC20Factory";

export const provider = web3Provider();

Expand Down
4 changes: 2 additions & 2 deletions l2-contracts/test/erc20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { expect } from "chai";
import { ethers } from "ethers";
import * as hre from "hardhat";
import { Provider, Wallet } from "zksync-web3";
import { hashBytecode } from "zksync-web3/build/src/utils";
import { Provider, Wallet } from "zksync-ethers";
import { hashBytecode } from "zksync-ethers/build/utils";
import { unapplyL1ToL2Alias } from "./test-utils";
import { L2SharedBridgeFactory, L2StandardERC20Factory } from "../typechain";
import type { L2SharedBridge, L2StandardERC20 } from "../typechain";
Expand Down
2 changes: 1 addition & 1 deletion l2-contracts/test/weth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { expect } from "chai";
import { ethers } from "ethers";
import * as hre from "hardhat";
import { Provider, Wallet } from "zksync-web3";
import { Provider, Wallet } from "zksync-ethers";
import type { L2WrappedBaseToken } from "../typechain/L2WrappedBaseToken";
import type { L2SharedBridge } from "../typechain/L2SharedBridge";
import { L2SharedBridgeFactory } from "../typechain/L2SharedBridgeFactory";
Expand Down
9 changes: 4 additions & 5 deletions system-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "[email protected]:matter-labs/system-contracts.git",
"license": "MIT",
"dependencies": {
"@matterlabs/hardhat-zksync-deploy": "^0.6.5",
"@matterlabs/hardhat-zksync-deploy": "^0.7.0",
"@matterlabs/hardhat-zksync-solc": "^1.1.4",
"commander": "^9.4.1",
"eslint": "^8.51.0",
Expand All @@ -13,11 +13,10 @@
"ethers": "^5.7.0",
"fast-glob": "^3.3.2",
"hardhat": "=2.22.2",
"preprocess": "^3.2.0",
"zksync-ethers": "https://github.com/zksync-sdk/zksync-ethers#ethers-v5-feat/bridgehub"
"preprocess": "^3.2.0"
},
"devDependencies": {
"@matterlabs/hardhat-zksync-chai-matchers": "^0.1.4",
"@matterlabs/hardhat-zksync-chai-matchers": "^0.2.0",
"@matterlabs/hardhat-zksync-node": "^0.0.1-beta.7",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.3",
"@nomiclabs/hardhat-ethers": "^2.0.0",
Expand All @@ -37,7 +36,7 @@
"ts-node": "^10.1.0",
"typechain": "^4.0.0",
"typescript": "^4.6.4",
"zksync-ethers": "https://github.com/zksync-sdk/zksync-ethers#ethers-v5-feat/bridgehub"
"zksync-ethers": "5.8.0-beta.5"
},
"mocha": {
"timeout": 240000,
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/scripts/calculate-hashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from "fs";
import _ from "lodash";
import os from "os";
import { join } from "path";
import { hashBytecode } from "zksync-web3/build/src/utils";
import { hashBytecode } from "zksync-ethers/build/utils";

type ContractDetails = {
contractName: string;
Expand Down
6 changes: 3 additions & 3 deletions system-contracts/scripts/deploy-preimages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { ethers } from "ethers";
import { formatUnits, parseUnits } from "ethers/lib/utils";
import * as fs from "fs";
import * as path from "path";
import type { types } from "zksync-web3";
import { Provider, Wallet } from "zksync-web3";
import { hashBytecode } from "zksync-web3/build/src/utils";
import type { types } from "zksync-ethers";
import { Provider, Wallet } from "zksync-ethers";
import { hashBytecode } from "zksync-ethers/build/utils";
import { Language, SYSTEM_CONTRACTS } from "./constants";
import type { Dependency, DeployedDependency } from "./utils";
import { checkMarkers, filterPublishedFactoryDeps, getBytecodes, publishFactoryDeps, readYulBytecode } from "./utils";
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { BigNumberish, BytesLike } from "ethers";
import { BigNumber, ethers } from "ethers";
import * as fs from "fs";
import * as fsPr from "fs/promises";
import { hashBytecode } from "zksync-web3/build/src/utils";
import { hashBytecode } from "zksync-ethers/build/utils";
import type { YulContractDescription, ZasmContractDescription } from "./constants";
import { Language, SYSTEM_CONTRACTS } from "./constants";
import { getCompilersDir } from "hardhat/internal/util/global-dir";
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/test/BootloaderUtilities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "chai";
import { ethers } from "hardhat";
import type { Wallet } from "zksync-ethers";
import * as zksync from "zksync-ethers";
import { serialize } from "zksync-ethers/build/src/utils";
import { serialize } from "zksync-ethers/build/utils";
import type { BootloaderUtilities } from "../typechain";
import { BootloaderUtilitiesFactory } from "../typechain";
import { TEST_BOOTLOADER_UTILITIES_ADDRESS } from "./shared/constants";
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/test/CodeOracle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hashBytecode } from "zksync-web3/build/src/utils";
import { hashBytecode } from "zksync-ethers/build/utils";
import type { CodeOracleTest } from "../typechain";
import { REAL_CODE_ORACLE_CONTRACT_ADDRESS } from "./shared/constants";
import { publishBytecode, setCode, getCode, deployContract } from "./shared/utils";
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/test/Create2Factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ethers } from "hardhat";
import type { Wallet } from "zksync-ethers";
import type { Create2Factory } from "../typechain";
import { deployContract, getWallets, loadArtifact } from "./shared/utils";
import { create2Address, getDeployedContracts, hashBytecode } from "zksync-ethers/build/src/utils";
import { create2Address, getDeployedContracts, hashBytecode } from "zksync-ethers/build/utils";

describe("Create2Factory tests", function () {
let wallet: Wallet;
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/test/DefaultAccount.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "chai";
import { ethers, network } from "hardhat";
import type { Wallet } from "zksync-ethers";
import * as zksync from "zksync-ethers";
import { serialize } from "zksync-web3/build/src/utils";
import { serialize } from "zksync-ethers/build/utils";
import type { DefaultAccount, DelegateCaller, MockContract } from "../typechain";
import { DefaultAccountFactory } from "../typechain";
import { TEST_BOOTLOADER_FORMAL_ADDRESS } from "./shared/constants";
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/test/EventWriter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "chai";
import { ethers } from "hardhat";
import type { Wallet } from "zksync-ethers";
import { Contract } from "zksync-ethers";
import type { TransactionResponse } from "zksync-web3/build/src/types";
import type { TransactionResponse } from "zksync-ethers/build/types";
import { ONE_BYTES32_HEX, REAL_EVENT_WRITER_CONTRACT_ADDRESS } from "./shared/constants";
import { EXTRA_ABI_CALLER_ADDRESS, encodeExtraAbiCallerCalldata } from "./shared/extraAbiCaller";
import { getCode, getWallets, loadYulBytecode, loadZasmBytecode, setCode } from "./shared/utils";
Expand Down
4 changes: 2 additions & 2 deletions system-contracts/test/L1Messenger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { L1MessengerFactory } from "../typechain";
import { prepareEnvironment, setResult } from "./shared/mocks";
import type { StateDiff } from "./shared/utils";
import { compressStateDiffs, deployContractOnAddress, encodeStateDiffs, getCode, getWallets } from "./shared/utils";
import { utils } from "zksync-web3";
import type { Wallet } from "zksync-web3";
import { utils } from "zksync-ethers";
import type { Wallet } from "zksync-ethers";
import {
TEST_KNOWN_CODE_STORAGE_CONTRACT_ADDRESS,
TEST_L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS,
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/test/L2BaseToken.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { ethers, network } from "hardhat";
import type { Wallet } from "zksync-web3";
import type { Wallet } from "zksync-ethers";
import type { L2BaseToken } from "../typechain";
import { L2BaseTokenFactory } from "../typechain";
import { deployContractOnAddress, getWallets, loadArtifact, provider } from "./shared/utils";
Expand Down
2 changes: 1 addition & 1 deletion system-contracts/test/PubdataChunkPublisher.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { ethers, network } from "hardhat";
import type { Wallet } from "zksync-web3";
import type { Wallet } from "zksync-ethers";
import type { PubdataChunkPublisher } from "../typechain";
import { PubdataChunkPublisherFactory } from "../typechain";
import { TEST_L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS, TEST_PUBDATA_CHUNK_PUBLISHER_ADDRESS } from "./shared/constants";
Expand Down
Loading

0 comments on commit 311b82e

Please sign in to comment.