Skip to content

Commit

Permalink
multi-hosts update
Browse files Browse the repository at this point in the history
  • Loading branch information
spypsy committed Feb 27, 2025
1 parent 18b08c0 commit ed47234
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/network-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ jobs:
run: |
REPO=$(git rev-parse --show-toplevel)
export FUNDING_PRIVATE_KEY=${{ secrets.SEPOLIA_FUNDING_PRIVATE_KEY }}
export ETHEREUM_HOST=${{ env.EXTERNAL_ETHEREUM_HOST }}
export ETHEREUM_HOSTS=${{ env.EXTERNAL_ETHEREUM_HOSTS }}
echo "Preparing sepolia accounts..."
mnemonic=$($REPO/spartan/scripts/prepare_sepolia_accounts.sh ${{ env.VALUES_FILE }} 5)
echo "::add-mask::$mnemonic"
echo "mnemonic=$mnemonic" >> "$GITHUB_OUTPUT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ for i in $(seq 0 $((num_accounts - 1))); do
private_key=$(cast wallet private-key --mnemonic "$mnemonic" --mnemonic-index $i)

# Get balance
balance=$(cast balance $address --rpc-url "$ETHEREUM_HOST")
balance=$(cast balance $address --rpc-urls "$ETHEREUM_HOSTS")

if [ "$balance" != "0" ]; then
gas_price=$(cast gas-price --rpc-url "$ETHEREUM_HOST")
gas_price=$(cast gas-price --rpc-urls "$ETHEREUM_HOSTS")
gas_price=$((gas_price * 120 / 100)) # Add 20% to gas price
gas_cost=$((21000 * gas_price))

Expand All @@ -34,7 +34,7 @@ for i in $(seq 0 $((num_accounts - 1))); do

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" \
cast send --private-key "$private_key" --rpc-urls "$ETHEREUM_HOSTS" "$funding_address" \
--value "$send_amount" --gas-price "$gas_price" --async
else
echo "Balance too low to cover gas costs for $address"
Expand Down
4 changes: 2 additions & 2 deletions spartan/aztec-network/templates/consolidate-balances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ spec:
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 }}"
- name: ETHEREUM_HOSTS
value: "{{ .Values.ethereum.execution.externalHosts }}"
{{ end }}
4 changes: 2 additions & 2 deletions spartan/scripts/prepare_sepolia_accounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ADDRESSES=$(jq -r '.accounts[].address' output.json)
wei_amount=$(cast to-wei "$eth_amount" ether)

# Get current gas price and add 25% buffer
gas_price=$(cast gas-price --rpc-url "$ETHEREUM_HOST")
gas_price=$(cast gas-price --rpc-urls "$ETHEREUM_HOSTS")
gas_price=$((gas_price * 125 / 100)) # Add 25% to gas price

# Build 'calls' string in the format:
Expand All @@ -65,7 +65,7 @@ tx_hash=$(cast send "$multicall_address" \
"$calls" \
--value "$total_value" \
--private-key "$FUNDING_PRIVATE_KEY" \
--rpc-url "$ETHEREUM_HOST" \
--rpc-urls "$ETHEREUM_HOSTS" \
--json --gas-price "$gas_price")

echo >&2 "Sent ${wei_amount} wei to ${num_accounts} addresses in tx $tx_hash"
Expand Down

0 comments on commit ed47234

Please sign in to comment.