Skip to content

Commit 309be4b

Browse files
spypsyPhilWindle
andauthored
fix: deploy l1 contracts script (AztecProtocol#3713)
can't figure out why (tried a lot) but `forge create` doesn't work, the `process()` function reverts every time. Using CLI command which seemed to work locally # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [ ] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [ ] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist). --------- Co-authored-by: PhilWindle <philip.windle@gmail.com> Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
1 parent eb8413e commit 309be4b

File tree

3 files changed

+41
-66
lines changed

3 files changed

+41
-66
lines changed

l1-contracts/REDEPLOY

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Append value to force redeploy
2-
4
2+
5

l1-contracts/scripts/ci_deploy_contracts.sh

+40-11
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,48 @@ fi
1919
# Login to pull our ecr images with docker.
2020
ecr_login
2121

22+
# Contract addresses will be saved in the serve directory
2223
mkdir -p serve
23-
# Contract addresses will be mounted in the serve directory
24+
FILE_PATH=./serve/contract_addresses.json
25+
CLI_IMAGE=$(calculate_image_uri cli)
26+
retry docker pull $CLI_IMAGE
27+
28+
# remove 0x prefix from private key
29+
PRIVATE_KEY=${CONTRACT_PUBLISHER_PRIVATE_KEY#0x}
2430
docker run \
25-
-v $(pwd)/serve:/usr/src/l1-contracts/serve \
26-
-e ETHEREUM_HOST=$ETHEREUM_HOST -e PRIVATE_KEY=$CONTRACT_PUBLISHER_PRIVATE_KEY \
27-
"$ECR_URL/l1-contracts:cache-$CONTENT_HASH" \
28-
./scripts/deploy_contracts.sh
29-
30-
# Write the contract addresses as terraform variables
31-
for KEY in ROLLUP_CONTRACT_ADDRESS REGISTRY_CONTRACT_ADDRESS INBOX_CONTRACT_ADDRESS OUTBOX_CONTRACT_ADDRESS CONTRACT_DEPLOYMENT_EMITTER_ADDRESS; do
32-
VALUE=$(jq -r .$KEY ./serve/contract_addresses.json)
33-
export TF_VAR_$KEY=$VALUE
34-
done
31+
$CLI_IMAGE \
32+
deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY >./serve/contract_addresses.json
33+
34+
## Result format is:
35+
# Rollup Address: 0xe33d37702bb94e83ca09e7dc804c9f4c4ab8ee4a
36+
# Registry Address: 0xf02a70628c4e0d7c41f231f9af24c1678a030438
37+
# L1 -> L2 Inbox Address: 0xdf34a07c7da15630d3b5d6bb17651d548a6e9d8f
38+
# L2 -> L1 Outbox address: 0xf6b1b3c2c393fe55fe577a1f528bd72a76589ab0
39+
# Contract Deployment Emitter Address: 0xf3ecc6e9428482a74687ee5f7b96f4dff8781454
40+
41+
# Read the file line by line
42+
while IFS= read -r line; do
43+
# Extract the hexadecimal address using awk
44+
address=$(echo "$line" | awk '{print $NF}')
45+
46+
# Assign the address to the respective variable based on the line content
47+
if [[ $line == *"Rollup"* ]]; then
48+
export TF_VAR_ROLLUP_CONTRACT_ADDRESS=$address
49+
echo "TF_VAR_ROLLUP_CONTRACT_ADDRESS=$TF_VAR_ROLLUP_CONTRACT_ADDRESS"
50+
elif [[ $line == *"Registry"* ]]; then
51+
export TF_VAR_REGISTRY_CONTRACT_ADDRESS=$address
52+
echo "TF_VAR_REGISTRY_CONTRACT_ADDRESS=$TF_VAR_REGISTRY_CONTRACT_ADDRESS"
53+
elif [[ $line == *"Inbox"* ]]; then
54+
export TF_VAR_INBOX_CONTRACT_ADDRESS=$address
55+
echo "TF_VAR_INBOX_CONTRACT_ADDRESS=$TF_VAR_INBOX_CONTRACT_ADDRESS"
56+
elif [[ $line == *"Outbox"* ]]; then
57+
export TF_VAR_OUTBOX_CONTRACT_ADDRESS=$address
58+
echo "TF_VAR_OUTBOX_CONTRACT_ADDRESS=$TF_VAR_OUTBOX_CONTRACT_ADDRESS"
59+
elif [[ $line == *"Emitter"* ]]; then
60+
export TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$address
61+
echo "TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS"
62+
fi
63+
done <"$FILE_PATH"
3564

3665
if [ "$DRY_DEPLOY" -eq 1 ]; then
3766
echo "DRY_DEPLOY: deploy_terraform l1-contracts ./terraform"

l1-contracts/scripts/deploy_contracts.sh

-54
This file was deleted.

0 commit comments

Comments
 (0)