Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/network-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ jobs:

$REPO/spartan/scripts/generate_devnet_config.sh ${{ env.VALUES_FILE }}

- name: Generate sepolia accounts
id: generate-sepolia-accounts
if: ${{ inputs.sepolia_deployment == 'true' }}
run: |
REPO=$(git rev-parse --show-toplevel)
export FUNDING_PRIVATE_KEY=${{ secrets.SEPOLIA_FUNDING_PRIVATE_KEY }}
export ETHEREUM_HOST=${{ env.EXTERNAL_ETHEREUM_HOST }}
mnemonic=$(bash $REPO/spartan/scripts/prepare_sepolia_accounts.sh ${{ env.VALUES_FILE }} 5)
echo "::add-mask::$mnemonic"
echo "mnemonic=$mnemonic" >> "$GITHUB_OUTPUT"

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
Expand All @@ -187,7 +198,7 @@ jobs:
continue-on-error: true
run: |
if ${{ inputs.sepolia_deployment == 'true' }}; then
export L1_DEPLOYMENT_MNEMONIC="${{ secrets.SEPOLIA_ACCOUNTS_MNEMONIC }}"
export L1_DEPLOYMENT_MNEMONIC="${{ steps.generate-sepolia-accounts.outputs.mnemonic }}"
terraform destroy -auto-approve \
-var="RELEASE_NAME=${{ env.NAMESPACE }}" \
-var="VALUES_FILE=${{ env.VALUES_FILE }}" \
Expand All @@ -214,7 +225,7 @@ jobs:
working-directory: ./spartan/terraform/deploy-release
run: |
if ${{ inputs.sepolia_deployment == 'true' }}; then
export L1_DEPLOYMENT_MNEMONIC="${{ secrets.SEPOLIA_ACCOUNTS_MNEMONIC }}"
export L1_DEPLOYMENT_MNEMONIC="${{ steps.generate-sepolia-accounts.outputs.mnemonic }}"
terraform plan \
-var="RELEASE_NAME=${{ env.NAMESPACE }}" \
-var="VALUES_FILE=${{ env.VALUES_FILE }}" \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/nightly-kind-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ jobs:
export EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY=${{ secrets.SEPOLIA_API_KEY }}
export EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY_HEADER=${{ env.GCP_API_KEY_HEADER }}
export L1_DEPLOYMENT_PRIVATE_KEY=${{ secrets.SEPOLIA_L1_DEPLOYMENT_PRIVATE_KEY }}
export L1_ACCOUNTS_MNEMONIC="${{ secrets.SEPOLIA_ACCOUNTS_MNEMONIC }}"
SEPOLIA_RUN=true INSTALL_METRICS=false ./spartan/scripts/test_kind.sh "./src/spartan/${{ matrix.config.test }}" "${{ matrix.config.values }}"
ci3/cache_upload_flag "$artifact"
fi
Expand Down
3 changes: 3 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"multiaddr",
"multiaddrs",
"multiarch",
"multicall",
"multiformats",
"multivalue",
"muxers",
Expand Down Expand Up @@ -220,6 +221,7 @@
"Pokeable",
"preauthenticated",
"precompute",
"prefunded",
"preimage",
"preimages",
"prestat",
Expand Down Expand Up @@ -324,6 +326,7 @@
"webassembly",
"WITGEN",
"workdir",
"yamls",
"yamux",
"yarnrc",
"zerocash",
Expand Down
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
4 changes: 2 additions & 2 deletions spartan/aztec-network/files/config/deploy-l1-contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ RETRY_DELAY=15

for attempt in $(seq 1 $MAX_RETRIES); do
# Construct base command
base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --test-accounts"
base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts"

# Add account - use private key if set, otherwise use mnemonic
if [ -n "${L1_DEPLOYMENT_PRIVATE_KEY:-}" ]; then
base_cmd="$base_cmd --private-key $L1_DEPLOYMENT_PRIVATE_KEY"
else
base_cmd="$base_cmd --mnemonic '$MNEMONIC'"
base_cmd="$base_cmd --mnemonic '$MNEMONIC' --test-accounts"

Copy link
Copy Markdown
Collaborator

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?

Copy link
Copy Markdown
Collaborator

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.testAccounts

Copy link
Copy Markdown
Member Author

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 👍

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Member Author

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

fi

# Add validators if INIT_VALIDATORS is true
Expand Down
4 changes: 2 additions & 2 deletions spartan/aztec-network/files/config/get-private-key.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eu

# We get the index in the config map from the pod name, which will have the validator index within it
# We get the index in the config map from the pod name, which will have the service index within it
KEY_INDEX=$(echo $POD_NAME | awk -F'-' '{print $NF}')
# Add the index to the start index to get the private key index
PRIVATE_KEY_INDEX=$((KEY_INDEX_START + KEY_INDEX))
Expand All @@ -14,7 +14,7 @@ echo "MNEMONIC: $(echo $MNEMONIC | cut -d' ' -f1-2)..."
# Get the private key from the mnemonic
private_key=$(cast wallet private-key "$MNEMONIC" --mnemonic-index $PRIVATE_KEY_INDEX)

# Note, currently writing both prover and sequencer keys for all nodes for convinience
# Note, currently writing keys for all services for convenience
cat <<EOF >/shared/config/keys.env
export VALIDATOR_PRIVATE_KEY=$private_key
export L1_PRIVATE_KEY=$private_key
Expand Down
47 changes: 47 additions & 0 deletions spartan/aztec-network/templates/consolidate-balances.yaml
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we rather want post-delete? It looks like pre-delete runs in response to any resource getting deleted, but we probably want to consolidate funds after everything has been cleaned up?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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 }}
3 changes: 2 additions & 1 deletion spartan/aztec-network/templates/scripts-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ data:
{{ .Files.Get "files/config/get-private-key.sh" | nindent 4 }}
get-validator-addresses.sh: |
{{ .Files.Get "files/config/get-validator-addresses.sh" | nindent 4 }}

consolidate-sepolia-balances.sh: |
{{ .Files.Get "files/cleanup/consolidate-sepolia-balances.sh" | nindent 4 }}
8 changes: 6 additions & 2 deletions spartan/aztec-network/values/ci-sepolia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ aztec:
proofSubmissionWindow: 8
realProofs: false
l1DeploymentMnemonic: ""
validatorKeyIndexStart: 49
proverKeyIndexStart: 52
validatorKeyIndexStart: 0
proverKeyIndexStart: 3
botKeyIndexStart: 4

network:
setupL2Contracts: false

ethereum:
chainId: "11155111"
Expand Down
2 changes: 1 addition & 1 deletion spartan/aztec-network/values/ignition-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ aztec:
realProofs: true
l1DeploymentMnemonic: ""
validatorKeyIndexStart: 0
proverKeyIndexStart: 48
proverKeyIndexStart: 3

network:
setupL2Contracts: false
Expand Down
5 changes: 3 additions & 2 deletions spartan/aztec-network/values/rc-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ aztec:
realProofs: true
# TODO: Will need to change these as ignition will be using them
l1DeploymentMnemonic: ""
validatorKeyIndexStart: 4
proverKeyIndexStart: 52
validatorKeyIndexStart: 0
proverKeyIndexStart: 48
botKeyIndexStart: 49

images:
aztec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ telemetry:

aztec:
realProofs: false
validatorKeyIndexStart: 0
proverKeyIndexStart: 3
botKeyIndexStart: 4

network:
setupL2Contracts: false
public: false

ethereum:
l1DeploymentMnemonic:
proverKeyIndexStart: 0
validatorKeyIndexStart: 1
chainId: "11155111"
execution:
externalHost:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
telemetry:
enabled: true

aztec:
l1DeploymentMnemonic: ""
validatorKeyIndexStart: 0
proverKeyIndexStart: 48
botKeyIndexStart: 49

network:
setupL2Contracts: false
public: false
Expand All @@ -12,60 +18,15 @@ ethereum:
externalHost:
beacon:
externalHost:
apiKey: ""
apiKeyHeader: ""

validator:
l1FixedPriorityFeePerGas: 2
l1GasLimitBufferPercentage: 15
l1GasPriceMax: 500
replicas: 48
validatorKeys:
validatorAddresses:
- 0xcD92B30FeFbD2752fF80dD1d152347B1C0b80555
- 0x3eb04876AEaC0ecB2095D5be5FCE965BE114f6Ea
- 0x69746Fc304C08331C5B3F0E4A8Be82Bbe9079de7
- 0x11eCa503d1A4C89EA801B5428690844378FF8EDb
- 0x690944149F6090F8B8131d21B7C9243f44953dA3
- 0x9991124C826d4b469544A326B8e93C7ea6291Df6
- 0x790a1ACe055c42Ef0aDd7C94b0605e68F4F7ac32
- 0x3bb53E1A35768B250185d9a1E3A220dfcFD21959
- 0x1a42bfAF536DD0931AbDb6C7b5d6a2e795849111
- 0x0b69F2c3b1DCe6974c860655C1B1A0bE209F0EEe
- 0x15dC3B5b63B2846Caf36631b4cc89EC2133484A3
- 0xEb81BB1891ad6bDB88Bd870703e8E8ca809bF76e
- 0xe484C194039a2D1334F9f701e6AeEAdb2b1009F8
- 0xC1f9e958888FcfB74C0f72FF4fcA8525a2FD7577
- 0x27A99682eF70cE26CBe981B2E0BEA2f608bfD44D
- 0xb010Fb11B64Ad756721884d84E66dF0Aa96F1f5f
- 0xC5E960E795284a7AF2F1b5ED3acb17cE51143342
- 0x44C08d1b44C5D099ecCB626297541E9214aED279
- 0x78117dD80E4e54EFFd9546Dce1719fB5df30a0A1
- 0x941d42B68BE5B50f32b24e39c7C48A07Cda37f34
- 0xAbE28C0BA704111b03903BCBC92c486CE457eC3C
- 0xb0F15e42B0b234070C222B02e173b1e1263E9Bad
- 0xbEaB732a958301EF542DD465DFfcaaa7DA0D64cA
- 0x56C4277eACF43a4a19dEafa2617776f88566C9A8
- 0xfCaEA5838C6C5a90DA0DE920a122998D7F72e049
- 0xB204ed1f6cD2E7609421477DA004Aad34eD44aa2
- 0x5e6a2e947b506f0E06E94b5C421097564c1bf7B1
- 0x4f321D1922ECDAc05F137E6E9cD2b2873D02b13C
- 0x7964e6211fC121Fb4577d25729724aD97AfD6349
- 0x3Bf8F13D4D2d218B25C91F3C5d983c3cd25c686D
- 0xb310E13232e3a85b19123adA4E0762B3dC50B4E6
- 0x8C0B299a706beB7FCE32F820A40f558451534880
- 0xF88c298c08A46d235d688Eb9CFEA7A1B704842bC
- 0xe2a2ff6cA23AeCD58Aa5c2E5bEA89c2142Ce20cc
- 0x47D8383296B3Db67726fFb4dbDE21a15A17f5084
- 0xdE5e20DCB0781072341294f8bEfd3811E043f5Ca
- 0x686aC93A652194D6F7f3CF996C61B72cab1A3B4e
- 0x719b0E230E9c9F42C6485cc4DF0347318ced8daa
- 0x829CC1ad52d6c09e9F2249B69C42B99180FC8c17
- 0xEf051f942CAE84d86c8DED6f45632547E4f6b945
- 0x54D1aDec93f2EbA4fb90Bb140b56bd822c867e7D
- 0x879B29Bcef645E778136A2Ab727dc1691c089DE7
- 0x88f7C34641378E6e82F3e949c067589A0B38eacd
- 0x96C668DE46451ECD4F8C8FB16D342EC679f6E87f
- 0x981f78212b18671aA5A449d482001EDC1e00303D
- 0x6BE5a2c8250A2c8342E96a365957933DEbe22ca0
validator:
disabled: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ telemetry:

aztec:
realProofs: true
l1DeploymentMnemonic: ""
validatorKeyIndexStart: 0
proverKeyIndexStart: 48
botKeyIndexStart: 49

images:
aztec:
Expand Down Expand Up @@ -32,53 +36,6 @@ validator:
requests:
memory: "512Mi"
validatorKeys:
validatorAddresses:
- 0xcD92B30FeFbD2752fF80dD1d152347B1C0b80555
- 0x3eb04876AEaC0ecB2095D5be5FCE965BE114f6Ea
- 0x69746Fc304C08331C5B3F0E4A8Be82Bbe9079de7
- 0x11eCa503d1A4C89EA801B5428690844378FF8EDb
- 0x690944149F6090F8B8131d21B7C9243f44953dA3
- 0x9991124C826d4b469544A326B8e93C7ea6291Df6
- 0x790a1ACe055c42Ef0aDd7C94b0605e68F4F7ac32
- 0x3bb53E1A35768B250185d9a1E3A220dfcFD21959
- 0x1a42bfAF536DD0931AbDb6C7b5d6a2e795849111
- 0x0b69F2c3b1DCe6974c860655C1B1A0bE209F0EEe
- 0x15dC3B5b63B2846Caf36631b4cc89EC2133484A3
- 0xEb81BB1891ad6bDB88Bd870703e8E8ca809bF76e
- 0xe484C194039a2D1334F9f701e6AeEAdb2b1009F8
- 0xC1f9e958888FcfB74C0f72FF4fcA8525a2FD7577
- 0x27A99682eF70cE26CBe981B2E0BEA2f608bfD44D
- 0xb010Fb11B64Ad756721884d84E66dF0Aa96F1f5f
- 0xC5E960E795284a7AF2F1b5ED3acb17cE51143342
- 0x44C08d1b44C5D099ecCB626297541E9214aED279
- 0x78117dD80E4e54EFFd9546Dce1719fB5df30a0A1
- 0x941d42B68BE5B50f32b24e39c7C48A07Cda37f34
- 0xAbE28C0BA704111b03903BCBC92c486CE457eC3C
- 0xb0F15e42B0b234070C222B02e173b1e1263E9Bad
- 0xbEaB732a958301EF542DD465DFfcaaa7DA0D64cA
- 0x56C4277eACF43a4a19dEafa2617776f88566C9A8
- 0xfCaEA5838C6C5a90DA0DE920a122998D7F72e049
- 0xB204ed1f6cD2E7609421477DA004Aad34eD44aa2
- 0x5e6a2e947b506f0E06E94b5C421097564c1bf7B1
- 0x4f321D1922ECDAc05F137E6E9cD2b2873D02b13C
- 0x7964e6211fC121Fb4577d25729724aD97AfD6349
- 0x3Bf8F13D4D2d218B25C91F3C5d983c3cd25c686D
- 0xb310E13232e3a85b19123adA4E0762B3dC50B4E6
- 0x8C0B299a706beB7FCE32F820A40f558451534880
- 0xF88c298c08A46d235d688Eb9CFEA7A1B704842bC
- 0xe2a2ff6cA23AeCD58Aa5c2E5bEA89c2142Ce20cc
- 0x47D8383296B3Db67726fFb4dbDE21a15A17f5084
- 0xdE5e20DCB0781072341294f8bEfd3811E043f5Ca
- 0x686aC93A652194D6F7f3CF996C61B72cab1A3B4e
- 0x719b0E230E9c9F42C6485cc4DF0347318ced8daa
- 0x829CC1ad52d6c09e9F2249B69C42B99180FC8c17
- 0xEf051f942CAE84d86c8DED6f45632547E4f6b945
- 0x54D1aDec93f2EbA4fb90Bb140b56bd822c867e7D
- 0x879B29Bcef645E778136A2Ab727dc1691c089DE7
- 0x88f7C34641378E6e82F3e949c067589A0B38eacd
- 0x96C668DE46451ECD4F8C8FB16D342EC679f6E87f
- 0x981f78212b18671aA5A449d482001EDC1e00303D
- 0x6BE5a2c8250A2c8342E96a365957933DEbe22ca0
validator:
disabled: false

Expand Down
Loading