Skip to content

Commit d1a5d5d

Browse files
authored
Merge pull request #144 from lidofinance/verify/l1erc20bridge-cantina-audit
feat: add L1ERC20Bridge config for zkSync cantina audit
2 parents 409eed7 + b717b6d commit d1a5d5d

8 files changed

Lines changed: 103 additions & 24 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"build": {
44
"dockerfile": "Dockerfile",
55
"context": "..",
6+
"options": ["--platform=linux/amd64"],
67
"args": {
78
"DEVCONTAINER_BASE_IMAGE": "mcr.microsoft.com/devcontainers/python:3.11@sha256:f46978552419eb3cbf3bcf662ba0dca1639b07307f64447a3fcbe46110710b27",
89
"UV_VERSION": "0.10.9"

.github/workflows/regression.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,18 @@ jobs:
9797
--allow-source-diff 0xa11906bBBBaC5207b8FDA4F7F294d7EcB8dcc758
9898
--allow-source-diff 0xc5dCd2A9642ceA9B71A632BF5b8ff52424Ea1B40
9999
steps:
100-
- uses: actions/checkout@v4
100+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
101101

102102
- name: Restore diffyscan caches
103-
uses: actions/cache@v4
103+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
104104
with:
105105
path: .diffyscan_cache
106106
key: diffyscan-cache-${{ github.ref_name }}-${{ matrix.config }}-${{ github.sha }}
107107
restore-keys: |
108108
diffyscan-cache-${{ github.ref_name }}-${{ matrix.config }}-
109109
110110
- name: Restore devcontainer build cache
111-
uses: actions/cache@v4
111+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
112112
with:
113113
path: ${{ env.DEVCONTAINER_BUILD_CACHE_DIR }}
114114
key: devcontainer-buildx-${{ runner.os }}-${{ hashFiles('.devcontainer/Dockerfile', '.dockerignore') }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Foundry-verified contracts store full paths in Etherscan metadata, unlike Hardhat:
2+
# - Source paths include "zksync/" prefix, so relative_root must be "" (not "zksync")
3+
# - Dependency paths include "node_modules/" prefix, so dependency keys must too
4+
5+
contracts:
6+
"0x43a66B32c9AdcA1A59b273E69b61Da5197c21cCd": L1ERC20Bridge
7+
8+
explorer_hostname: api.etherscan.io
9+
explorer_chain_id: 1
10+
explorer_token_env_var: ETHERSCAN_EXPLORER_TOKEN
11+
12+
github_repo:
13+
url: https://github.com/lidofinance/lido-l2
14+
commit: b5bbb12982cc5d3279243e271ae69de6e4e6725e
15+
relative_root: "" # "" for Foundry, "zksync" for Hardhat
16+
17+
dependencies:
18+
"node_modules/@openzeppelin/contracts": # "node_modules/" prefix required for Foundry
19+
url: https://github.com/OpenZeppelin/openzeppelin-contracts
20+
commit: d4fb3a89f9d0a39c7ee6f2601d33ffbf30085322
21+
relative_root: contracts
22+
23+
"node_modules/@openzeppelin/contracts-upgradeable":
24+
url: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
25+
commit: f6febd79e2a3a17e26969dd0d450c6ebd64bf459
26+
relative_root: contracts
27+
28+
"node_modules/@matterlabs/zksync-contracts":
29+
url: https://github.com/matter-labs/v2-testnet-contracts
30+
commit: 093341c8549de4b750f779b14ae727c88ae884ff
31+
relative_root: ""
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
contracts:
2+
"0x9a810469F4a451Ebb7ef53672142053b4971587c": L1ERC20Bridge
3+
4+
explorer_hostname: api.etherscan.io
5+
explorer_chain_id: 1
6+
explorer_token_env_var: ETHERSCAN_EXPLORER_TOKEN
7+
8+
github_repo:
9+
url: https://github.com/lidofinance/lido-l2
10+
commit: fa6a77e694a34dc6f03d57bb8c934941e554ac9d
11+
relative_root: zksync
12+
13+
dependencies:
14+
"@openzeppelin/contracts":
15+
url: https://github.com/OpenZeppelin/openzeppelin-contracts
16+
commit: d4fb3a89f9d0a39c7ee6f2601d33ffbf30085322
17+
relative_root: contracts
18+
19+
"@openzeppelin/contracts-upgradeable":
20+
url: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
21+
commit: f6febd79e2a3a17e26969dd0d450c6ebd64bf459
22+
relative_root: contracts
23+
24+
"@matterlabs/zksync-contracts":
25+
url: https://github.com/matter-labs/v2-testnet-contracts
26+
commit: 093341c8549de4b750f779b14ae727c88ae884ff
27+
relative_root: ""
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
contracts:
2+
"0x43a66b32c9adca1a59b273e69b61da5197c21ccd": L1ERC20Bridge
3+
4+
network: mainnet
5+
explorer_hostname: api.etherscan.io
6+
explorer_token_env_var: ETHERSCAN_EXPLORER_TOKEN
7+
explorer_chain_id: 1
8+
9+
github_repo:
10+
url: https://github.com/lidofinance/lido-l2
11+
# https://github.com/lidofinance/audits/blob/main/L2/zkSync-2026-03-05-Cantina-PR-85-fix-report.pdf
12+
commit: b5bbb12982cc5d3279243e271ae69de6e4e6725e
13+
relative_root: ""
14+
15+
dependencies:
16+
"node_modules/@openzeppelin/contracts":
17+
url: https://github.com/OpenZeppelin/openzeppelin-contracts
18+
commit: d4fb3a89f9d0a39c7ee6f2601d33ffbf30085322 # 4.6.0
19+
relative_root: contracts
20+
"node_modules/@openzeppelin/contracts-upgradeable":
21+
url: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
22+
commit: f6febd79e2a3a17e26969dd0d450c6ebd64bf459 # 4.9.0
23+
relative_root: contracts
24+
"node_modules/@matterlabs/zksync-contracts":
25+
url: https://github.com/matter-labs/v2-testnet-contracts
26+
commit: 093341c8549de4b750f779b14ae727c88ae884ff # 0.6.2-beta
27+
relative_root: ""
28+

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ dev = [
3232
requires = ["hatchling==1.27.0"]
3333
build-backend = "hatchling.build"
3434

35+
[tool.black]
36+
target-version = ["py311"]
37+
3538
[tool.hatch.build.targets.wheel]
3639
packages = ["diffyscan"]
3740

tests/test_config_loading.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def test_yaml_and_json_produce_identical_config(tmp_path):
7878
def test_yaml_comments_are_ignored(tmp_path):
7979
"""Comments are the whole reason we migrated to YAML — verify they parse cleanly."""
8080
path = tmp_path / "config.yaml"
81-
path.write_text(
82-
"""\
81+
path.write_text("""\
8382
# Top-level comment
8483
contracts:
8584
"0x0000000000000000000000000000000000000001": TransparentUpgradeableProxy # Vault
@@ -96,8 +95,7 @@ def test_yaml_comments_are_ignored(tmp_path):
9695
commit: def456
9796
relative_root: contracts
9897
# version 1.0.0
99-
"""
100-
)
98+
""")
10199
result = load_config(str(path))
102100
assert (
103101
result["contracts"]["0x0000000000000000000000000000000000000001"]
@@ -140,8 +138,7 @@ def test_yaml_preserves_hex_address_strings(tmp_path):
140138
"""YAML auto-coerces unquoted hex (0x1A -> int 26). Quoted addresses must stay strings."""
141139
path = tmp_path / "config.yaml"
142140
# Write raw YAML with quoted hex addresses to ensure they stay as strings
143-
path.write_text(
144-
"""\
141+
path.write_text("""\
145142
contracts:
146143
"0x00000000000000000000000000000000000000AB": TestContract
147144
"0x0000000000000000000000000000000000000100": AnotherContract
@@ -153,8 +150,7 @@ def test_yaml_preserves_hex_address_strings(tmp_path):
153150
commit: abc123
154151
relative_root: ""
155152
dependencies: {}
156-
"""
157-
)
153+
""")
158154
result = load_config(str(path))
159155
addresses = list(result["contracts"].keys())
160156
for addr in addresses:
@@ -171,8 +167,7 @@ def test_yaml_preserves_hex_address_strings(tmp_path):
171167
def test_yaml_unquoted_hex_address_raises(tmp_path):
172168
"""Unquoted hex addresses get coerced to int by PyYAML — load_config must catch this."""
173169
path = tmp_path / "config.yaml"
174-
path.write_text(
175-
"""\
170+
path.write_text("""\
176171
contracts:
177172
0x00000000000000000000000000000000000000AB: TestContract
178173
explorer_hostname: api.etherscan.io
@@ -182,8 +177,7 @@ def test_yaml_unquoted_hex_address_raises(tmp_path):
182177
commit: abc123
183178
relative_root: ""
184179
dependencies: {}
185-
"""
186-
)
180+
""")
187181
with pytest.raises(ValueError, match="parsed as integer"):
188182
load_config(str(path))
189183

@@ -199,8 +193,7 @@ def test_empty_yaml_raises(tmp_path):
199193
def test_bytecode_comparison_unquoted_hex_raises(tmp_path):
200194
"""Unquoted hex in bytecode_comparison.constructor_args keys should be caught."""
201195
path = tmp_path / "config.yaml"
202-
path.write_text(
203-
"""\
196+
path.write_text("""\
204197
contracts:
205198
"0x0000000000000000000000000000000000000001": TestContract
206199
explorer_hostname: api.etherscan.io
@@ -214,17 +207,15 @@ def test_bytecode_comparison_unquoted_hex_raises(tmp_path):
214207
constructor_args:
215208
0x00000000000000000000000000000000000000AB:
216209
- "0x01"
217-
"""
218-
)
210+
""")
219211
with pytest.raises(ValueError, match="bytecode_comparison.constructor_args"):
220212
load_config(str(path))
221213

222214

223215
def test_bytecode_comparison_library_unquoted_hex_raises(tmp_path):
224216
"""Unquoted hex in bytecode_comparison.libraries values should be caught."""
225217
path = tmp_path / "config.yaml"
226-
path.write_text(
227-
"""\
218+
path.write_text("""\
228219
contracts:
229220
"0x0000000000000000000000000000000000000001": TestContract
230221
explorer_hostname: api.etherscan.io
@@ -238,8 +229,7 @@ def test_bytecode_comparison_library_unquoted_hex_raises(tmp_path):
238229
libraries:
239230
"contracts/Foo.sol":
240231
MyLib: 0x00000000000000000000000000000000000000AB
241-
"""
242-
)
232+
""")
243233
with pytest.raises(ValueError, match="bytecode_comparison.libraries"):
244234
load_config(str(path))
245235

tests/test_refactored.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from diffyscan.utils.custom_exceptions import CalldataError, EncoderError
2020
from diffyscan.utils.explorer import merge_libraries, get_solc_sources
2121

22-
2322
# --- encoder tests ---
2423

2524

0 commit comments

Comments
 (0)