From 3d32e0e0645644bd6206db9ed5ae0454d96f36d6 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 23 Jan 2025 23:02:34 +0000 Subject: [PATCH] fix: network deployments --- spartan/aztec-network/.gitignore | 3 +- spartan/aztec-network/eth-devnet/create.sh | 33 +++++++++++++--------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/spartan/aztec-network/.gitignore b/spartan/aztec-network/.gitignore index 466e24805a90..fc8838a8622c 100644 --- a/spartan/aztec-network/.gitignore +++ b/spartan/aztec-network/.gitignore @@ -1 +1,2 @@ -out/ \ No newline at end of file +out/ +tmp/ \ No newline at end of file diff --git a/spartan/aztec-network/eth-devnet/create.sh b/spartan/aztec-network/eth-devnet/create.sh index 954b1bcfbb4d..0d7ed36da3c6 100755 --- a/spartan/aztec-network/eth-devnet/create.sh +++ b/spartan/aztec-network/eth-devnet/create.sh @@ -103,39 +103,46 @@ create_beacon_genesis() { echo " Execution genesis path: $execution_genesis_path" # update the templates block time if it is provided - cp "$DIR_PATH/$beacon_config_path" "$DIR_PATH/out/config.yaml" + cp "$DIR_PATH/$beacon_config_path" "$DIR_PATH/tmp/config.yaml" if [[ -n "${BLOCK_TIME:-}" ]]; then - yq eval ".SECONDS_PER_SLOT = ${BLOCK_TIME}" -i "$DIR_PATH/out/config.yaml" - yq eval ".SECONDS_PER_ETH1_BLOCK = ${BLOCK_TIME}" -i "$DIR_PATH/out/config.yaml" + yq eval ".SECONDS_PER_SLOT = ${BLOCK_TIME}" -i "$DIR_PATH/tmp/config.yaml" + yq eval ".SECONDS_PER_ETH1_BLOCK = ${BLOCK_TIME}" -i "$DIR_PATH/tmp/config.yaml" fi # Update the chain id if it is provided if [[ -n "${CHAIN_ID:-}" ]]; then - yq eval ".DEPOSIT_CHAIN_ID = ${CHAIN_ID}" -i "$DIR_PATH/out/config.yaml" - yq eval ".DEPOSIT_NETWORK_ID = ${CHAIN_ID}" -i "$DIR_PATH/out/config.yaml" + yq eval ".DEPOSIT_CHAIN_ID = ${CHAIN_ID}" -i "$DIR_PATH/tmp/config.yaml" + yq eval ".DEPOSIT_NETWORK_ID = ${CHAIN_ID}" -i "$DIR_PATH/tmp/config.yaml" fi + # Copy mnemonics file to tmp and update it with provided mnemonic + cp "$DIR_PATH/config/mnemonics.yaml" "$DIR_PATH/tmp/mnemonics.yaml" + yq eval '.0.mnemonic = "'"$MNEMONIC"'"' -i "$DIR_PATH/tmp/mnemonics.yaml" + # Run the protolamba's eth2 testnet genesis container - echo "$DIR_PATH/config:/app/config" - echo "$DIR_PATH/out:/app/out" docker run --rm \ -v "$DIR_PATH/config:/app/config" \ + -v "$DIR_PATH/tmp:/app/tmp" \ -v "$DIR_PATH/out:/app/out" \ maddiaa/eth2-testnet-genesis deneb \ - --config="./out/config.yaml" \ + --config="./tmp/config.yaml" \ + --eth1-config="./tmp/genesis.json" \ --preset-phase0=minimal \ --preset-altair=minimal \ --preset-bellatrix=minimal \ --preset-capella=minimal \ --preset-deneb=minimal \ - --eth1-config="./out/genesis.json" \ --state-output="${beacon_genesis_path}/genesis.ssz" \ --tranches-dir="$beacon_genesis_path" \ - --mnemonics="$beacon_mnemonics_path" \ + --mnemonics="./tmp/mnemonics.yaml" \ --eth1-withdrawal-address="0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ --eth1-match-genesis-time + + cp "$DIR_PATH/tmp/genesis.json" "$DIR_PATH/out/genesis.json" + cp "$DIR_PATH/tmp/config.yaml" "$DIR_PATH/out/config.yaml" + if [[ $? -ne 0 ]]; then echo "Error: eth2-testnet-genesis failed." exit 1 @@ -162,12 +169,12 @@ beacon_config_path="$DIR_PATH/config/config.yaml" genesis_json_path="$DIR_PATH/config/genesis.json" mkdir -p "$DIR_PATH/out" +mkdir -p "$DIR_PATH/tmp" -create_execution_genesis "$DIR_PATH/config/genesis.json" "$DIR_PATH/out/genesis.json" -create_beacon_genesis "$DIR_PATH/out/genesis.json" +create_execution_genesis "$DIR_PATH/config/genesis.json" "$DIR_PATH/tmp/genesis.json" +create_beacon_genesis "$DIR_PATH/tmp/genesis.json" create_deposit_contract_block write_ssz_file_base64 -cp "$beacon_config_path" "$DIR_PATH/out/config.yaml" cp "$DIR_PATH/config/jwt-secret.hex" "$DIR_PATH/out/jwt-secret.hex" echo "Genesis files copied to ./out"