-
Notifications
You must be signed in to change notification settings - Fork 953
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature(v1.4.1): Zksync compatibility (#840)
This PR "backmerges" the zksync compatibility from `main` to the `1.4.1` release branch. Backmerge is quoted because it turned out to be much more complicated and led to more significant changes, such as: - 1.4.1 was still using ethers v5, zksync plugins require ethers v6, so I had to migrate the ethers version used in the project (I didn't migrate it per se; I just used the `test` and `src` folders from the `main` branch, minus the 1.5.0 changes) - I migrated the project from `yarn` to `npm` because when I cherry-picked from main, which uses npm, it was easier to do so rather than sticking to `yarn` - backmerging also led to discovering certain issues that were fixed in `main`, such as broken benchmark on the CI when the compiler version `0.8.2` is used and node version v16 being unsupported by hardhat anymore **TL:DR** This PR is a 1.4.1 release with 1.5.0 tests, javascript utilities and hardhat env, minus changes introduced in 1.5.0. **How I tested the PR**: - I made sure no changes were made to the contracts and checking that they're still deployed to expected v1.4.1 addresses - I ran zkSync test suite and deployed the contracts to zksync sepolia. Proof of deployment: ``` > @safe-global/safe-smart-account@1.4.1-build.0 deploy-all > hardhat deploy-contracts --network zkSyncSepolia Yul codegen is only supported for solc >= 0.8. Flag forceEVMLA will automatically be set to true by default. Yul codegen is only supported for solc >= 0.8. Flag forceEVMLA will automatically be set to true by default. Nothing to compile No need to generate any newer typings. reusing "SimulateTxAccessor" at 0xdd35026932273768A3e31F4efF7313B5B7A7199d reusing "SafeProxyFactory" at 0xc329D02fd8CB2fc13aa919005aF46320794a8629 reusing "TokenCallbackHandler" at 0xd508168Db968De1EBc6f288322e6C820137eeF79 reusing "CompatibilityFallbackHandler" at 0x9301E98DD367135f21bdF66f342A249c9D5F9069 reusing "CreateCall" at 0xAAA566Fe7978bB0fb0B5362B7ba23038f4428D8f reusing "MultiSend" at 0x309D0B190FeCCa8e1D5D8309a16F7e3CB133E885 reusing "MultiSendCallOnly" at 0x0408EF011960d02349d50286D20531229BCef773 reusing "SignMessageLib" at 0xAca1ec0a1A575CDCCF1DC3d5d296202Eb6061888 reusing "SafeToL2Setup" at 0x199A9df0224031c20Cc27083A4164c9c8F1Bcb39 reusing "Safe" at 0xC35F063962328aC65cED5D4c3fC5dEf8dec68dFa reusing "SafeL2" at 0x610fcA2e0279Fa1F8C00c8c2F71dF522AD469380 reusing "SafeToL2Migration" at 0xa26620d1f8f1a2433F0D25027F141aaCAFB3E590 reusing "SafeMigration" at 0x817756C6c555A94BCEE39eB5a102AbC1678b09A7 ``` After the PR is merged and reviewed, I'll add the expected zkSync addresses to the changelog.
- Loading branch information
Showing
81 changed files
with
15,333 additions
and
13,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
# Redirect output to stderr. | ||
exec 1>&2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v16.7.0 | ||
v20.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"plugins": ["prettier-plugin-solidity"], | ||
"overrides": [ | ||
{ | ||
"files": "*.sol", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import "@nomiclabs/hardhat-ethers"; | ||
import { setupBenchmarkContracts } from "./utils/setup" | ||
import { setupBenchmarkContracts } from "./utils/setup"; | ||
|
||
const contractSetup = setupBenchmarkContracts(undefined, true) | ||
describe("Safe", async () => { | ||
const contractSetup = setupBenchmarkContracts(undefined, true); | ||
describe("Safe", () => { | ||
it("creation", async () => { | ||
await contractSetup() | ||
}) | ||
}) | ||
await contractSetup(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
import { expect } from "chai"; | ||
import { waffle, ethers } from "hardhat"; | ||
import "@nomiclabs/hardhat-ethers"; | ||
import { ethers } from "hardhat"; | ||
import { BigNumberish } from "ethers"; | ||
import { buildSafeTransaction } from "../src/utils/execution"; | ||
import { BigNumber } from "ethers"; | ||
import { benchmark, Contracts } from "./utils/setup" | ||
import { benchmark, Contracts } from "./utils/setup"; | ||
|
||
const [, , , , user5] = waffle.provider.getWallets(); | ||
|
||
benchmark("ERC1155", [{ | ||
name: "transfer", | ||
prepare: async (contracts: Contracts, target: string, nonce: number) => { | ||
const token = contracts.additions.token | ||
await token.mint(target, 23, 1337, "0x") | ||
const data = token.interface.encodeFunctionData("safeTransferFrom", [target, user5.address, 23, 500, "0x"]) | ||
return buildSafeTransaction({ to: token.address, data, safeTxGas: 1000000, nonce }) | ||
}, | ||
after: async (contracts: Contracts) => { | ||
expect( | ||
await contracts.additions.token.balanceOf(user5.address, 23) | ||
).to.be.deep.eq(BigNumber.from(500)) | ||
}, | ||
fixture: async () => { | ||
const tokenFactory = await ethers.getContractFactory("ERC1155Token") | ||
return { | ||
token: await tokenFactory.deploy() | ||
} | ||
} | ||
}]) | ||
benchmark("ERC1155", async () => { | ||
const [, , , , user5] = await ethers.getSigners(); | ||
return [ | ||
{ | ||
name: "transfer", | ||
prepare: async (contracts: Contracts, target: string, nonce: BigNumberish) => { | ||
const token = contracts.additions.token; | ||
const tokenAddress = await token.getAddress(); | ||
await token.mint(target, 23, 1337, "0x"); | ||
const data = token.interface.encodeFunctionData("safeTransferFrom", [target, user5.address, 23, 500, "0x"]); | ||
return buildSafeTransaction({ to: tokenAddress, data, safeTxGas: 1000000, nonce }); | ||
}, | ||
after: async (contracts: Contracts) => { | ||
expect(await contracts.additions.token.balanceOf(user5.address, 23)).to.eq(500n); | ||
}, | ||
fixture: async () => { | ||
const tokenFactory = await ethers.getContractFactory("ERC1155Token"); | ||
return { | ||
token: await tokenFactory.deploy(), | ||
}; | ||
}, | ||
}, | ||
]; | ||
}); |
Oops, something went wrong.