Skip to content

Commit

Permalink
fix: deploy l1 contracts script (AztecProtocol#3713)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
3 people committed Dec 16, 2023
1 parent eb8413e commit 309be4b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 66 deletions.
2 changes: 1 addition & 1 deletion l1-contracts/REDEPLOY
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Append value to force redeploy
4
5
51 changes: 40 additions & 11 deletions l1-contracts/scripts/ci_deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,48 @@ fi
# Login to pull our ecr images with docker.
ecr_login

# Contract addresses will be saved in the serve directory
mkdir -p serve
# Contract addresses will be mounted in the serve directory
FILE_PATH=./serve/contract_addresses.json
CLI_IMAGE=$(calculate_image_uri cli)
retry docker pull $CLI_IMAGE

# remove 0x prefix from private key
PRIVATE_KEY=${CONTRACT_PUBLISHER_PRIVATE_KEY#0x}
docker run \
-v $(pwd)/serve:/usr/src/l1-contracts/serve \
-e ETHEREUM_HOST=$ETHEREUM_HOST -e PRIVATE_KEY=$CONTRACT_PUBLISHER_PRIVATE_KEY \
"$ECR_URL/l1-contracts:cache-$CONTENT_HASH" \
./scripts/deploy_contracts.sh

# Write the contract addresses as terraform variables
for KEY in ROLLUP_CONTRACT_ADDRESS REGISTRY_CONTRACT_ADDRESS INBOX_CONTRACT_ADDRESS OUTBOX_CONTRACT_ADDRESS CONTRACT_DEPLOYMENT_EMITTER_ADDRESS; do
VALUE=$(jq -r .$KEY ./serve/contract_addresses.json)
export TF_VAR_$KEY=$VALUE
done
$CLI_IMAGE \
deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY >./serve/contract_addresses.json

## Result format is:
# Rollup Address: 0xe33d37702bb94e83ca09e7dc804c9f4c4ab8ee4a
# Registry Address: 0xf02a70628c4e0d7c41f231f9af24c1678a030438
# L1 -> L2 Inbox Address: 0xdf34a07c7da15630d3b5d6bb17651d548a6e9d8f
# L2 -> L1 Outbox address: 0xf6b1b3c2c393fe55fe577a1f528bd72a76589ab0
# Contract Deployment Emitter Address: 0xf3ecc6e9428482a74687ee5f7b96f4dff8781454

# Read the file line by line
while IFS= read -r line; do
# Extract the hexadecimal address using awk
address=$(echo "$line" | awk '{print $NF}')

# Assign the address to the respective variable based on the line content
if [[ $line == *"Rollup"* ]]; then
export TF_VAR_ROLLUP_CONTRACT_ADDRESS=$address
echo "TF_VAR_ROLLUP_CONTRACT_ADDRESS=$TF_VAR_ROLLUP_CONTRACT_ADDRESS"
elif [[ $line == *"Registry"* ]]; then
export TF_VAR_REGISTRY_CONTRACT_ADDRESS=$address
echo "TF_VAR_REGISTRY_CONTRACT_ADDRESS=$TF_VAR_REGISTRY_CONTRACT_ADDRESS"
elif [[ $line == *"Inbox"* ]]; then
export TF_VAR_INBOX_CONTRACT_ADDRESS=$address
echo "TF_VAR_INBOX_CONTRACT_ADDRESS=$TF_VAR_INBOX_CONTRACT_ADDRESS"
elif [[ $line == *"Outbox"* ]]; then
export TF_VAR_OUTBOX_CONTRACT_ADDRESS=$address
echo "TF_VAR_OUTBOX_CONTRACT_ADDRESS=$TF_VAR_OUTBOX_CONTRACT_ADDRESS"
elif [[ $line == *"Emitter"* ]]; then
export TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$address
echo "TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS"
fi
done <"$FILE_PATH"

if [ "$DRY_DEPLOY" -eq 1 ]; then
echo "DRY_DEPLOY: deploy_terraform l1-contracts ./terraform"
Expand Down
54 changes: 0 additions & 54 deletions l1-contracts/scripts/deploy_contracts.sh

This file was deleted.

0 comments on commit 309be4b

Please sign in to comment.