Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial changes + ffi workflow #550

Open
wants to merge 75 commits into
base: release-v23
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4c0e566
extend utils & update compilation process (#396)
Raid5594 Apr 24, 2024
3601648
NonceHolder Tests (#176)
neotheprogramist May 16, 2024
2840540
chore(scripts): remove unconditionally removed facets (#448)
koloz193 May 16, 2024
622638a
chore(contracts): remove usage of ergs (#454)
koloz193 May 16, 2024
bd9bec5
chore(verifier): update generation to include vk hash (#453)
koloz193 May 16, 2024
994897b
chore(contract): applied new solhint rules across l1, l2, and system …
koloz193 May 16, 2024
8e4c291
Merge branch 'release-v23' into dev
koloz193 Jun 5, 2024
d97d8cd
tests and fix merge conflict
koloz193 Jun 5, 2024
704b41b
fix merge conflicts and bump hashes
koloz193 Jun 5, 2024
ee5667e
fixed lint
koloz193 Jun 5, 2024
5c4525a
update system contracts hashes and verifier hash
koloz193 Jun 5, 2024
131f823
update forge-std
koloz193 Jun 5, 2024
360a918
Merge pull request #508 from matter-labs/zk-merge-release-23-dev
StanislavBreadless Jun 5, 2024
394f651
Merge pull request #399 from matter-labs/release-v23
StanislavBreadless Jun 11, 2024
680b252
sync with dev
StanislavBreadless Jun 11, 2024
8df3025
Merge pull request #523 from matter-labs/sb-merge-main-to-dev
StanislavBreadless Jun 11, 2024
01f033b
Add script for system contracts block explorer verification (#510)
vladbochok Jun 11, 2024
311b82e
chore: zksync-ethers 5.8.0-beta.5 (#387)
benceharomi Jun 11, 2024
ab2f13d
feat: check diamond cut hash locally (#525)
dimazhornyk Jun 12, 2024
29f9ff4
Finalize gas bound caller (#526)
StanislavBreadless Jun 12, 2024
594bac2
Update README.md (#532)
StanislavBreadless Jun 14, 2024
7d7af53
Fix incorrect clause (#535)
StanislavBreadless Jun 18, 2024
100b3bf
Adding doc comments to the chain contracts (#530)
vladbochok Jun 18, 2024
dc7bd13
Add CI coverage (reopenned to dev) (#543)
vladbochok Jun 21, 2024
db93876
Fix erc20 contracts (#545)
Deniallugo Jun 21, 2024
8fec7ec
Mailbox unit testing (#489)
neotheprogramist Jun 27, 2024
116206c
Revert "Mailbox unit testing (#489)" (#558)
saxenism Jun 27, 2024
8172969
feat(deploy): Mint tokens to multiple addresses (#552)
Deniallugo Jun 27, 2024
fb3a5d8
chore(ci): Additional permissions for CI token (#565)
artmakh Jul 2, 2024
1c1b93b
Mailbox unit testing (#559)
tommysr Jul 3, 2024
c9a8a68
chore: zksync-ethers to stable v5.9.0 (#567)
benceharomi Jul 3, 2024
62408fc
Make Deniallugo codeowner for deploy scripts (#597)
Deniallugo Jul 4, 2024
f4ae6a1
Accept admin using methods not files (#568)
Deniallugo Jul 4, 2024
bc98e4b
remove outdated folder (#601)
kelemeno Jul 8, 2024
c808b1f
Merge branch 'main' into zk-sync-main-dev
koloz193 Aug 5, 2024
5b8d6ae
Merge pull request #678 from matter-labs/zk-sync-main-dev
StanislavBreadless Aug 6, 2024
b62ca53
Add chain contract (#598)
vladbochok Aug 6, 2024
3161150
sync main with dev
StanislavBreadless Aug 7, 2024
0b80914
Merge pull request #681 from matter-labs/sb-merge-main-into-dev
StanislavBreadless Aug 7, 2024
7ca5517
feat: add tokenMultiplierSetter role to deployment scripts (#683)
ischasny Aug 9, 2024
1812c31
Merge branch 'main' into deniallugo-merge-main
Deniallugo Aug 13, 2024
d0d735c
Merge pull request #696 from matter-labs/deniallugo-merge-main
StanislavBreadless Aug 13, 2024
118f081
Bridgehub Test Coverage Increase (#494)
neotheprogramist Aug 14, 2024
fd4aebc
fix: zksync-ethers v5 dependency (#702)
benceharomi Aug 15, 2024
7f4f460
feat(foundry): use foundry zksync (dev) (#551)
Deniallugo Aug 16, 2024
80e8234
feat(consensus): add L2 registry contract (BFT-434) (#555)
moshababo Aug 19, 2024
2c8a5fa
Revert: "feat(consensus): add L2 registry contract (BFT-434)" (#717)
pompon0 Aug 20, 2024
5853c3a
feat(consensus): add L2 registry contract (BFT-434) (#555) (#718)
pompon0 Aug 20, 2024
8be87b2
Merge Protocol Defense Tasks into Dev (#518)
koloz193 Aug 20, 2024
7b488e6
chore: foundry config cleanup (#722)
benceharomi Aug 20, 2024
446d391
Add admin role to shared bridge (#727)
StanislavBreadless Aug 21, 2024
2395aed
Update solidity contracts version (#688)
IAvecilla Aug 23, 2024
a36c6c2
chore(config): Fix server build with symlinks (#740)
StanislavBreadless Aug 28, 2024
8d9240f
feat: add a script to prepare chain registration calldata (#671)
dimazhornyk Aug 28, 2024
1e0df10
feat(l2): solidity 0.8.24 and zksolc 1.5.0 (#743)
benceharomi Aug 28, 2024
f2d553b
feat(l1): added missing foundry lib symlinks (#741)
benceharomi Aug 28, 2024
383e1b0
docs: update zkSync casing to ZKsync (#733)
benceharomi Aug 28, 2024
dba0212
chore(contracts): add missing spdx licenses (#732)
koloz193 Aug 28, 2024
874bc6b
fix(scrips): read bytecode from foundry not hardhat (#750)
koloz193 Aug 29, 2024
d368769
feat: Deploy ConsensusRegistry through L1 to L2 transaction (BFT-504)…
aakoshh Sep 2, 2024
7f2c27a
Small PR to Fix "Ethers" and "ETH" encoding (#762)
Raid5594 Sep 3, 2024
3d6e02f
Set foundry optimizer_runs (#770)
perekopskiy Sep 5, 2024
8b5b296
Implement restriction to allow limiting chain admin in power (#699)
StanislavBreadless Sep 5, 2024
6892ccc
Add admin permission to add custom base tokens (#776)
vladbochok Sep 6, 2024
b6c7130
merge main into dev
StanislavBreadless Sep 6, 2024
0fa0fa2
foundry tests pass
StanislavBreadless Sep 6, 2024
00ddc06
fix compile for registry
StanislavBreadless Sep 6, 2024
ef33539
lint
StanislavBreadless Sep 6, 2024
b653ac8
Merge pull request #778 from matter-labs/sb-merge-main-to-dev
StanislavBreadless Sep 6, 2024
cc3b2ac
chore: merge main (#790)
kelemeno Sep 10, 2024
0ce72f9
Initial changes + ffi workflow
Yberjon Jun 24, 2024
47cc8e2
Change CI name
Yberjon Jun 24, 2024
b8b84d6
Deploy Paymaster Test
Yberjon Jul 9, 2024
350c423
Linter fix
Yberjon Jul 9, 2024
8813705
Fix imports and declarations
Yberjon Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"no-console": "off"
},
"ignorePatterns": [
"**/lib/*"
"**/lib/*",
"lib/*"
]
}
75 changes: 75 additions & 0 deletions .github/workflows/l1-contracts-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: L1 contracts CI
on:
pull_request:

# We need this permissions for this CI to work with external contributions
permissions:
contents: read
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -145,3 +150,73 @@ jobs:

- name: Compare
run: diff tools/data/Verifier.sol l1-contracts/contracts/state-transition/Verifier.sol

coverage:
defaults:
run:
working-directory: l1-contracts
needs: [build, lint]
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Use Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.18.0
cache: yarn

- name: Install dependencies
run: yarn

- name: Restore artifacts cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
key: artifacts-l1-${{ github.sha }}
path: |
l1-contracts/artifacts
l1-contracts/cache
l1-contracts/typechain

- name: Run coverage
run: FOUNDRY_PROFILE=default yarn test:foundry && FOUNDRY_PROFILE=default yarn coverage:foundry --report summary --report lcov

# To ignore coverage for certain directories modify the paths in this step as needed. The
# below default ignores coverage results for the test and script directories. Alternatively,
# to include coverage in all directories, comment out this step. Note that because this
# filtering applies to the lcov file, the summary table generated in the previous step will
# still include all files and directories.
# The `--rc lcov_branch_coverage=1` part keeps branch info in the filtered report, since lcov
# defaults to removing branch info.
- name: Filter directories
run: |
sudo apt update && sudo apt install -y lcov
lcov --remove lcov.info 'test/*' 'contracts/dev-contracts/*' '../lib/forge-std/*' '../lib/murky/*' 'lib/*' '../lib/*' 'lib/' --output-file lcov.info --rc lcov_branch_coverage=1

# This step posts a detailed coverage report as a comment and deletes previous comments on
# each push. The below step is used to fail coverage if the specified coverage threshold is
# not met. The below step can post a comment (when it's `github-token` is specified) but it's
# not as useful, and this action cannot fail CI based on a minimum coverage threshold, which
# is why we use both in this way.
- name: Post coverage report
if: github.event_name == 'pull_request' # This action fails when ran outside of a pull request.
uses: romeovs/lcov-reporter-action@v0.3.1
with:
delete-old-comments: true
lcov-file: ./l1-contracts/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }} # Adds a coverage summary comment to the PR.

- name: Verify minimum coverage
uses: zgosalvez/github-actions-report-lcov@v2
with:
coverage-files: ./l1-contracts/lcov.info
working-directory: l1-contracts
minimum-coverage: 85 # Set coverage threshold.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: L1 contracts foundry CI
name: L1 Deploy Scripts Tests CI

env:
ANVIL_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Create cache
uses: actions/cache/save@v3
with:
key: artifacts-l1-contracts-foudry-${{ github.sha }}
key: artifacts-l1-contracts-foundry-${{ github.sha }}
path: |
l1-contracts/cache
l1-contracts/out
Expand All @@ -61,7 +61,7 @@ jobs:
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
key: artifacts-l1-contracts-foudry-${{ github.sha }}
key: artifacts-l1-contracts-foundry-${{ github.sha }}
path: |
l1-contracts/cache
l1-contracts/out
Expand Down Expand Up @@ -99,19 +99,37 @@ jobs:
exit 1
fi

- name: Run DeployL1 script
working-directory: ./l1-contracts
run: forge script ./deploy-scripts/DeployL1.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY
test-ffi:
needs: [build]
runs-on: ubuntu-latest

- name: Run DeployErc20 script
working-directory: ./l1-contracts
run: forge script ./deploy-scripts/DeployErc20.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY
# TODO restore scripts verification
# - name: Run RegisterHyperchain script
# working-directory: ./l1-contracts
# run: |
# cat ./script-out/output-deploy-l1.toml >> ./script-config/register-hyperchain.toml
# forge script ./deploy-scripts/RegisterHyperchain.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY
# - name: Run InitializeL2WethToken script
# working-directory: ./l1-contracts-foundry
# run: forge script ./deploy-scripts/InitializeL2WethToken.s.sol --ffi --rpc-url $ANVIL_RPC_URL --broadcast --private-key $ANVIL_PRIVATE_KEY
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Use Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.18.0
cache: yarn

- name: Install dependencies
run: yarn

- name: Restore artifacts cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
key: artifacts-l1-${{ github.sha }}
path: |
l1-contracts/artifacts
l1-contracts/cache
l1-contracts/typechain

- name: Run tests
run: yarn l1 test:ffi
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ l1-contracts/coverage/*
l1-contracts/out/*
l1-contracts/broadcast/*
l1-contracts/script-config/*
!l1-contracts/script-config/artifacts
l1-contracts/script-out/*
!l1-contracts/script-out/.gitkeep
*.timestamp
l1-contracts/test/foundry/l1/integration/deploy-scripts/script-out/*
l1-contracts/zkout/*
18 changes: 9 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[submodule "l1-contracts/lib/forge-std"]
path = l1-contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "l1-contracts/lib/murky"]
path = l1-contracts/lib/murky
[submodule "lib/murky"]
path = lib/murky
url = https://github.com/dmfxyz/murky
[submodule "l1-contracts/lib/openzeppelin-contracts-upgradeable"]
path = l1-contracts/lib/openzeppelin-contracts-upgradeable
[submodule "lib/openzeppelin-contracts-upgradeable-v4"]
path = lib/openzeppelin-contracts-upgradeable-v4
url = https://github.com/Openzeppelin/openzeppelin-contracts-upgradeable
branch = release-v4.9
[submodule "l1-contracts/lib/openzeppelin-contracts"]
path = l1-contracts/lib/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-v4"]
path = lib/openzeppelin-contracts-v4
url = https://github.com/Openzeppelin/openzeppelin-contracts
branch = release-v4.9
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
6 changes: 5 additions & 1 deletion .markdownlintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
node_modules

# l1-contracts
l1-contracts/lib
l1-contracts/node_modules

# l1-contracts-foundry
Expand All @@ -14,3 +13,8 @@ l2-contracts/node_modules
# system-contracts
system-contracts/node_modules
system-contracts/bootloader/test_infra/target

l1-contracts/lib
lib/
l2-contracts/lib
system-contracts/lib
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
tools/data
l1-contracts/lib
l1-contracts-foundry/lib
lib
system-contracts/contracts/openzeppelin
system-contracts/contracts/Constants.sol
system-contracts/artifacts-zk
Expand All @@ -10,3 +11,6 @@ l1-contracts/cache
l1-contracts/cache-forge
l1-contracts/artifacts
l1-contracts/artifacts-forge
l1-contracts/zkout
l2-contracts/zkout
system-contracts/zkout
45 changes: 27 additions & 18 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
{
"extends": "solhint:recommended",
"rules": {
"state-visibility": "off",
"func-visibility": ["warn", { "ignoreConstructors": true }],
"var-name-mixedcase": "off",
"avoid-call-value": "off",
"no-empty-blocks": "off",
"not-rely-on-time": "off",
"avoid-call-value": "error",
"avoid-low-level-calls": "off",
"no-inline-assembly": "off",
"avoid-sha3": "error",
"check-send-result": "error",
"compiler-version": ["error", "^0.8.0"],
"const-name-snakecase": "off",
"no-complex-fallback": "off",
"reason-string": "off",
"contract-name-camelcase": "off",
"gas-calldata-parameters": "error",
"gas-custom-errors": "error",
"gas-increment-by-one": "error",
"gas-length-in-loops": "error",
"gas-struct-packing": "error",
"explicit-types": "error",
"func-name-mixedcase": "off",
"custom-errors": "off",
"no-unused-vars": "error",
"func-named-parameters": ["error", 4],
"func-visibility": ["error", { "ignoreConstructors": true }],
"imports-on-top": "error",
"max-states-count": "off",
"modifier-name-mixedcase": "error",
"named-parameters-mapping": "off",
"no-complex-fallback": "off",
"no-console": "error",
"no-empty-blocks": "off",
"no-global-import": "error",
"no-inline-assembly": "off",
"no-unused-import": "error",
"explicit-types": "error",
"modifier-name-mixedcase": "error",
"imports-on-top": "error",
"no-unused-vars": "error",
"not-rely-on-time": "off",
"quotes": "error",
"use-forbidden-name": "error",
"visibility-modifier-order": "error",
"reason-string": "error",
"reentrancy": "error",
"func-named-parameters": ["error", 4],
"compiler-version": ["error", "^0.8.0"]
"state-visibility": "error",
"use-forbidden-name": "error",
"var-name-mixedcase": "off",
"visibility-modifier-order": "error"
}
}
12 changes: 12 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ l1-contracts/cache
l1-contracts/cache-forge
l1-contracts/lib
l1-contracts/node_modules
l1-contracts/contracts/dev-contracts
l1-contracts/test
l1-contracts/deploy-scripts

# l1-contracts-foundry
l1-contracts-foundry/cache
Expand All @@ -18,3 +21,12 @@ l2-contracts/node_modules
# system-contracts
system-contracts/contracts/openzeppelin
system-contracts/contracts/Constants.sol
system-contracts/contracts/test-contracts
system-contracts/contracts-preprocessed

# gas-bound-caller
gas-bound-caller

lib/*
l2-contracts/lib
system-contracts/lib
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* @vladbochok @StanislavBreadless
l1-contracts/deploy-scripts @Deniallugo
l1-contracts/deploy-script-config-template @Deniallugo
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ We aim to make it as easy as possible to contribute to the mission. This is stil
and suggestions here too. Some resources to help:

1. [In-repo docs aimed at developers](docs)
2. [zkSync Era docs!](https://era.zksync.io/docs/)
2. [ZKsync Era docs!](https://era.zksync.io/docs/)
3. Company links can be found in the [repo's readme](README.md)

## Code of Conduct
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# zkSync Era: Smart Contracts
# ZKsync Era: Smart Contracts

[![Logo](eraLogo.svg)](https://zksync.io/)

zkSync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or
ZKsync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or
decentralization. Since it's EVM compatible (Solidity/Vyper), 99% of Ethereum projects can redeploy without refactoring
or re-auditing a single line of code. zkSync Era also uses an LLVM-based compiler that will eventually let developers
or re-auditing a single line of code. ZKsync Era also uses an LLVM-based compiler that will eventually let developers
write smart contracts in C++, Rust and other popular languages.

This repository contains both L1 and L2 zkSync smart contracts. For their description see the
This repository contains both L1 and L2 ZKsync smart contracts. For their description see the
[system overview](docs/Overview.md).

## Disclaimer
Expand All @@ -17,7 +17,7 @@ others may not.

## License

zkSync Era contracts are distributed under the terms of the MIT license.
ZKsync Era contracts are distributed under the terms of the MIT license.

See [LICENSE-MIT](LICENSE-MIT) for details.

Expand All @@ -33,7 +33,7 @@ See [LICENSE-MIT](LICENSE-MIT) for details.

## Disclaimer

zkSync Era has been through lots of testing and audits. Although it is live, it is still in alpha state and will go
ZKsync Era has been through lots of testing and audits. Although it is live, it is still in alpha state and will go
through more audits and bug bounties programs. We would love to hear our community's thoughts and suggestions about it!
It is important to state that forking it now can potentially lead to missing important security updates, critical
features, and performance improvements.
1 change: 1 addition & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extend-exclude = [
"/l1-contracts/out/",
"/l1-contracts/node_modules/",
"/l1-contracts/artifacts",
"/l1-contracts-foundry/lib/",
"/l2-contracts/artifacts-zk",
"/l2-contracts/cache-zk",
"/l2-contracts/typechain",
Expand Down
Loading