Skip to content

Commit 1840854

Browse files
zksync-era-bottomimorjodatorJackHamer09calvogenerico
authored
chore: synchronize changes (#15)
Automated sync for version v1.132.0 --------- Co-authored-by: Tomi Moreno <166135794+tomimor@users.noreply.github.com> Co-authored-by: Maciej <mg@matterlabs.dev> Co-authored-by: Jack Hamer <47187316+JackHamer09@users.noreply.github.com> Co-authored-by: Miguel Duarte <miguelfeliped@gmail.com> Co-authored-by: mikhail-egorov <176599164+mikhail-egorov@users.noreply.github.com> Co-authored-by: Nicolas Villanueva <1890113+MexicanAce@users.noreply.github.com> Co-authored-by: Dustin Brickwood <dustinbrickwood204@gmail.com> Co-authored-by: Agustin Aon <21188659+aon@users.noreply.github.com> Co-authored-by: Maciej <247363+jodator@users.noreply.github.com> Co-authored-by: MexicanAce <nmv@matterlabs.dev>
1 parent 90cb795 commit 1840854

File tree

10 files changed

+784
-5
lines changed

10 files changed

+784
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# IDEs
2-
.idea
2+
.idea
3+
.pnpm-store
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Compiler output
2+
cache/
3+
out/
4+
5+
# Soldeer dependencies (installed from soldeer.lock)
6+
dependencies/
7+
remappings.txt
8+
9+
# Forge lib (installed via forge install)
10+
lib/
11+
12+
# Broadcast files from deployments
13+
broadcast/
14+
15+
# Environment files
16+
.env
17+
.env.*
18+
!.env.example
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[profile.default]
2+
src = "src"
3+
out = "out"
4+
libs = ["dependencies"]
5+
6+
[dependencies]
7+
eth-infinitism-account-abstraction = "0.8.0"
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/bin/bash
2+
# Deploy EntryPoint contracts with deterministic addresses
3+
# Uses pre-compiled bytecode from the official deployment to ensure matching addresses
4+
5+
set -e
6+
7+
SCRIPT_DIR="$(dirname "$0")"
8+
cd "$SCRIPT_DIR/.."
9+
10+
# Ensure soldeer dependencies are installed
11+
forge soldeer install
12+
13+
RPC_URL="${RPC_URL:-http://localhost:5050}"
14+
PRIVATE_KEY="${PRIVATE_KEY:-0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80}"
15+
16+
# CREATE2 factory addresses (from deterministic-deployment-proxy)
17+
# See: https://github.com/Arachnid/deterministic-deployment-proxy
18+
CREATE2_FACTORY="0x4e59b44847b379578588920cA78FbF26c0B4956C"
19+
FACTORY_DEPLOYER="0x3fAB184622Dc19b6109349B94811493BF2a45362"
20+
21+
# Salt used for deterministic deployment (mined to produce 0x4337... address)
22+
SALT="0x0a59dbff790c23c976a548690c27297883cc66b4c67024f9117b0238995e35e9"
23+
24+
# Known deterministic EntryPoint address (deployed via CREATE2 with specific salt)
25+
ENTRYPOINT_ADDRESS="0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
26+
27+
# Pre-signed transaction to deploy the CREATE2 factory
28+
# This works on any chain - the deployer address has nonce 0 and this tx deploys the factory
29+
FACTORY_DEPLOY_TX="0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222"
30+
31+
# Path to the official deployment JSON with pre-compiled bytecode
32+
ENTRYPOINT_DEPLOYMENT="dependencies/eth-infinitism-account-abstraction-0.8.0/deployments/ethereum/EntryPoint.json"
33+
34+
# Check if EntryPoint is already deployed
35+
echo "Checking if EntryPoint is already deployed at $ENTRYPOINT_ADDRESS..."
36+
ENTRYPOINT_CODE=$(cast code $ENTRYPOINT_ADDRESS --rpc-url $RPC_URL 2>/dev/null || echo "0x")
37+
38+
if [ "$ENTRYPOINT_CODE" != "0x" ] && [ -n "$ENTRYPOINT_CODE" ]; then
39+
echo "EntryPoint already deployed at $ENTRYPOINT_ADDRESS"
40+
exit 0
41+
fi
42+
43+
echo "EntryPoint not found, proceeding with deployment..."
44+
45+
echo "Checking CREATE2 factory at $CREATE2_FACTORY..."
46+
47+
# Check if CREATE2 factory exists
48+
FACTORY_CODE=$(cast code $CREATE2_FACTORY --rpc-url $RPC_URL 2>/dev/null || echo "0x")
49+
50+
if [ "$FACTORY_CODE" = "0x" ] || [ -z "$FACTORY_CODE" ]; then
51+
echo "CREATE2 factory not found, deploying..."
52+
53+
# Fund the factory deployer (needs ~0.1 ETH for gas)
54+
echo "Funding factory deployer at $FACTORY_DEPLOYER..."
55+
cast send $FACTORY_DEPLOYER --value 0.1ether --private-key $PRIVATE_KEY --rpc-url $RPC_URL
56+
57+
# Send the pre-signed deployment transaction
58+
echo "Deploying CREATE2 factory..."
59+
cast publish $FACTORY_DEPLOY_TX --rpc-url $RPC_URL
60+
61+
# Verify deployment
62+
sleep 2
63+
FACTORY_CODE=$(cast code $CREATE2_FACTORY --rpc-url $RPC_URL)
64+
if [ "$FACTORY_CODE" = "0x" ] || [ -z "$FACTORY_CODE" ]; then
65+
echo "ERROR: CREATE2 factory deployment failed"
66+
exit 1
67+
fi
68+
echo "CREATE2 factory deployed successfully at $CREATE2_FACTORY"
69+
else
70+
echo "CREATE2 factory already deployed"
71+
fi
72+
73+
# Extract pre-compiled bytecode from official deployment
74+
echo "Extracting pre-compiled EntryPoint bytecode..."
75+
if [ ! -f "$ENTRYPOINT_DEPLOYMENT" ]; then
76+
echo "ERROR: EntryPoint deployment file not found at $ENTRYPOINT_DEPLOYMENT"
77+
exit 1
78+
fi
79+
80+
# Get bytecode and remove 0x prefix for concatenation
81+
BYTECODE=$(sed -nE 's/.*"bytecode" *: *"(0x)?([^"]*)".*/\2/p' "$ENTRYPOINT_DEPLOYMENT")
82+
83+
# The CREATE2 factory expects: salt (32 bytes) ++ initCode
84+
# Salt without 0x prefix
85+
SALT_NO_PREFIX=$(echo $SALT | sed 's/^0x//')
86+
87+
# Concatenate salt + bytecode
88+
PAYLOAD="0x${SALT_NO_PREFIX}${BYTECODE}"
89+
90+
echo "Deploying EntryPoint via CREATE2 factory..."
91+
RESULT=$(cast send $CREATE2_FACTORY "$PAYLOAD" --private-key $PRIVATE_KEY --rpc-url $RPC_URL --json 2>&1)
92+
93+
# Verify deployment
94+
sleep 2
95+
DEPLOYED_CODE=$(cast code $ENTRYPOINT_ADDRESS --rpc-url $RPC_URL 2>/dev/null || echo "0x")
96+
97+
if [ "$DEPLOYED_CODE" = "0x" ] || [ -z "$DEPLOYED_CODE" ]; then
98+
echo "ERROR: EntryPoint deployment failed"
99+
echo "Expected address: $ENTRYPOINT_ADDRESS"
100+
exit 1
101+
fi
102+
103+
echo "EntryPoint deployed successfully at $ENTRYPOINT_ADDRESS"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[[dependencies]]
2+
name = "eth-infinitism-account-abstraction"
3+
version = "0.8.0"
4+
url = "https://soldeer-revisions.s3.amazonaws.com/eth-infinitism-account-abstraction/0_8_0_24-03-2025_13:49:05_eth-infinitism-account-abstraction-0.8.zip"
5+
checksum = "305f34048fe928dacefb31a61baecae18eed43959f892d6a1b428eb46bb6afc9"
6+
integrity = "8ffcb24a9c6089aef86df243251501b42928ace5cacfa3e47bb17e521ae67a1b"

dev/bundler/contracts/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@repo/contracts",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"install-deps": "cd entrypoint && forge soldeer install --config-location foundry",
7+
"bridge-funds": "tsx scripts/bridge-funds.ts",
8+
"entrypoint:deploy": "cd entrypoint && ./script/deploy.sh"
9+
},
10+
"dependencies": {
11+
"@matterlabs/zksync-js": "^0.0.2",
12+
"viem": "^2.0.0"
13+
},
14+
"devDependencies": {
15+
"tsx": "^4.0.0"
16+
}
17+
}

0 commit comments

Comments
 (0)