-
Notifications
You must be signed in to change notification settings - Fork 265
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
fix: pass salt to deploy-l1-contracts.sh #10586
Changes from 1 commit
7fb3327
d2d293c
fb30f6e
da7c3de
943c3c0
00296fe
32a4e60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#!/bin/bash | ||
set -exu | ||
|
||
CHAIN_ID=$1 | ||
SALT=$1 | ||
CHAIN_ID=$2 | ||
|
||
|
||
# Run the deploy-l1-contracts command and capture the output | ||
|
@@ -11,9 +12,9 @@ RETRY_DELAY=60 | |
for attempt in $(seq 1 $MAX_RETRIES); do | ||
# if INIT_VALIDATORS is true, then we need to pass the validators flag to the deploy-l1-contracts command | ||
if [ "${INIT_VALIDATORS:-false}" = "true" ]; then | ||
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --mnemonic "$MNEMONIC" --validators $2 --l1-chain-id $CHAIN_ID) && break | ||
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --mnemonic "$MNEMONIC" --validators $3 --l1-chain-id $CHAIN_ID --salt $SALT) && break | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps need to handle the case of |
||
else | ||
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --mnemonic "$MNEMONIC" --l1-chain-id $CHAIN_ID) && break | ||
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --mnemonic "$MNEMONIC" --l1-chain-id $CHAIN_ID --salt $SALT) && break | ||
fi | ||
echo "Attempt $attempt failed. Retrying in $RETRY_DELAY seconds..." | ||
sleep "$RETRY_DELAY" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,14 +56,15 @@ spec: | |
- name: deploy-l1-contracts | ||
image: {{ .Values.images.aztec.image }} | ||
command: | ||
[ | ||
"/bin/bash", | ||
"-c", | ||
"cp /scripts/deploy-l1-contracts.sh /tmp/deploy-l1-contracts.sh && \ | ||
chmod +x /tmp/deploy-l1-contracts.sh && \ | ||
source /shared/config/service-addresses && \ | ||
/tmp/deploy-l1-contracts.sh {{ .Values.ethereum.chainId }} \"{{ join "," .Values.validator.validatorAddresses }}\"" | ||
] | ||
- /bin/bash | ||
- -c | ||
- | | ||
cp /scripts/deploy-l1-contracts.sh /tmp/deploy-l1-contracts.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, why were we copying the script elsewhere before running it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #10580 I added a common script (now removed) to block for services to be avilable but I was getting permission errors. I couldn't figure out why so I just inlined the content into the pod. Your comment above made me realise that it's probably becuase the scripts are mounted from a config map that's readonly. |
||
chmod +x /tmp/deploy-l1-contracts.sh | ||
source /shared/config/service-addresses | ||
HASH=$(echo "$RELEASE_NAME-$RELEASE_REVISION" | sha256sum | head -c 8) # first 4 hex characters = 4 bytes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 8* There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But won't $RELEASE_REVISION cause the hash to change with every helm upgrade? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the intention was to fix the boot node from hard forking if it got restarted by k8s, not necessarily to survive |
||
SALT=$((16#$HASH)) # convert to decimal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for sepolia deployments we usually don't want to pass a salt at all if we want each deployment to be a 'fresh' one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The salt would be different because helm will increment the revision number but I could make it optional. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that should be gud enough 👍 |
||
/tmp/deploy-l1-contracts.sh $SALT {{ .Values.ethereum.chainId }} "{{ join "," .Values.validator.validatorAddresses }}" | ||
volumeMounts: | ||
- name: scripts-output | ||
mountPath: /shared/contracts | ||
|
@@ -72,6 +73,10 @@ spec: | |
- name: scripts | ||
mountPath: /scripts | ||
env: | ||
- name: RELEASE_NAME | ||
value: "{{ .Release.Name }}" # e.g. rough-rhino | ||
- name: RELEASE_REVISION | ||
value: "{{ .Release.Revision }}" # e.g. 1, 2, 3. Increased with every helm install of the same name | ||
- name: TELEMETRY | ||
value: "{{ .Values.telemetry.enabled }}" | ||
- name: INIT_VALIDATORS | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why switch order here?