-
Notifications
You must be signed in to change notification settings - Fork 615
chore: new mnemonic deployments on sepolia #12076
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
Changes from 15 commits
8c60236
e4cd094
417500e
110107f
c450dfa
43203a0
059b9d2
0706a28
b049e41
4b8f630
201d858
3bb6d03
b7b0336
07fa90b
de99ca7
f8519c5
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 |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/bin/bash | ||
| set -eu | ||
|
|
||
| mnemonic=$1 | ||
| # at least 2 accounts are needed for the validator and prover nodes | ||
| num_accounts=${2:-"2"} | ||
| funding_address=${3:-"0x33D525f5ac95c2BCf98b644738C7d5673480493A"} | ||
|
|
||
| XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"} | ||
|
|
||
| # Install cast if needed | ||
| if ! command -v cast &>/dev/null; then | ||
| curl -L https://foundry.paradigm.xyz | bash | ||
| $HOME/.foundry/bin/foundryup && export PATH="$PATH:$HOME/.foundry/bin" || | ||
| $XDG_CONFIG_HOME/.foundry/bin/foundryup && export PATH="$PATH:$XDG_CONFIG_HOME/.foundry/bin" | ||
| fi | ||
|
|
||
| # For each index | ||
| for i in $(seq 0 $((num_accounts - 1))); do | ||
| # Get address and private key for this index | ||
| address=$(cast wallet address --mnemonic "$mnemonic" --mnemonic-index $i) | ||
| private_key=$(cast wallet private-key --mnemonic "$mnemonic" --mnemonic-index $i) | ||
|
|
||
| # Get balance | ||
| balance=$(cast balance $address --rpc-url "$ETHEREUM_HOST") | ||
|
|
||
| if [ "$balance" != "0" ]; then | ||
| gas_price=$(cast gas-price --rpc-url "$ETHEREUM_HOST") | ||
| gas_price=$((gas_price * 120 / 100)) # Add 20% to gas price | ||
| gas_cost=$((21000 * gas_price)) | ||
|
|
||
| # Calculate amount to send (balance - gas cost) | ||
| send_amount=$((balance - gas_cost)) | ||
|
|
||
| if [ "$send_amount" -gt "0" ]; then | ||
| echo "Sending $send_amount wei from $address to $funding_address" | ||
| cast send --private-key "$private_key" --rpc-url "$ETHEREUM_HOST" "$funding_address" \ | ||
| --value "$send_amount" --gas-price "$gas_price" --async | ||
| else | ||
| echo "Balance too low to cover gas costs for $address" | ||
| fi | ||
| else | ||
| echo "No balance in $address" | ||
| fi | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| {{- if .Values.ethereum.execution.externalHost }} | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: {{ .Release.Name }}-consolidate-balances | ||
| labels: | ||
| {{- include "aztec-network.labels" . | nindent 4 }} | ||
| annotations: | ||
| "helm.sh/hook": pre-delete | ||
|
Collaborator
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. do we rather want
Member
Author
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. makes sense, updating! |
||
| "helm.sh/hook-delete-policy": hook-succeeded,hook-failed | ||
| "helm.sh/hook-weight": "-5" | ||
| spec: | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "aztec-network.selectorLabels" . | nindent 8 }} | ||
| app: consolidate-balances | ||
| spec: | ||
| restartPolicy: OnFailure | ||
| {{- if .Values.network.public }} | ||
| serviceAccountName: {{ include "aztec-network.fullname" . }}-node | ||
| {{- end }} | ||
| volumes: | ||
| - name: config | ||
| emptyDir: {} | ||
| - name: scripts | ||
| configMap: | ||
| name: {{ include "aztec-network.fullname" . }}-scripts | ||
| containers: | ||
| - name: consolidate-balances | ||
| {{- include "aztec-network.image" . | nindent 10 }} | ||
| volumeMounts: | ||
| - name: scripts | ||
| mountPath: /scripts | ||
| - name: config | ||
| mountPath: /shared/config | ||
| command: | ||
| - /bin/bash | ||
| - -c | ||
| - | | ||
| cp /scripts/consolidate-sepolia-balances.sh /tmp/consolidate-sepolia-balances.sh | ||
| chmod +x /tmp/consolidate-sepolia-balances.sh | ||
| /tmp/consolidate-sepolia-balances.sh "{{ .Values.aztec.l1DeploymentMnemonic }}" {{ add .Values.validator.replicas .Values.proverNode.replicas }} | ||
| env: | ||
| - name: ETHEREUM_HOST | ||
| value: "{{ .Values.ethereum.execution.externalHost }}" | ||
| {{ end }} | ||
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.
How come you only want test accounts here?
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.
Separately, I have a PR that just pulls this into the
aztec.testAccountsThere 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.
huh must've added this by mistake, will remove thx 👍
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.
oh wait nvm now I see what I did.. we don't have test accounts for sepolia
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.
But this "test accounts" is referring to L2 test accounts. It impacts the genesis state in the rollup.
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.
ah mb thought it was for L1 genesis state. And this doesn't need anything different done in L1? will add back