Skip to content

Commit

Permalink
fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
joanestebanr committed Jul 24, 2024
1 parent ff9407a commit c0634c2
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 42 deletions.
5 changes: 2 additions & 3 deletions test/config/test.kurtosis_template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ L1BlockTimestampMargin = "30s"
MaxTxSizeForL1 = 131072
MaxBatchesForL1 = 2
L2Coinbase = "${zkevm_l2_sequencer_address}"
#PrivateKey = {Path = "../test/sequencer.keystore", Password = "testonly"}
PrivateKey = {Path = "/tmp/seq_sender/sequencer.keystore", Password = "${zkevm_l2_keystore_password}"}
PrivateKey = {Path = "${sequencer_keystore_file}", Password = "${zkevm_l2_keystore_password}"}

SequencesTxFileName = "sequencesender.json"
GasOffset = 80000
Expand All @@ -36,7 +35,7 @@ MaxPendingTx = 1
GetReceiptMaxTime = "250ms"
GetReceiptWaitInterval = "1s"
PrivateKeys = [
{Path = "/tmp/seq_sender/sequencer.keystore", Password = "${zkevm_l2_keystore_password}"},
{Path = "${sequencer_keystore_file}", Password = "${zkevm_l2_keystore_password}"},
]
ForcedGas = 0
GasPriceMarginFactor = 1
Expand Down
39 changes: 0 additions & 39 deletions test/scripts/config_kurtosis.sh

This file was deleted.

67 changes: 67 additions & 0 deletions test/scripts/config_kurtosis_for_local_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
#Include common varaibles
source $(dirname $0)/env.sh




###############################################################################
# MAIN
###############################################################################
set -o pipefail # enable strict command pipe error detection

if [ -z $TMP_CDK_FOLDER -o -z $ENCLAVE ]; then
echo "TMP_CDK_FOLDER or ENCLAVE is not set. Must be set on file env.sh"
exit 1
fi
DEST=${TMP_CDK_FOLDER}/local_config

[ ! -d ${DEST} ] && mkdir -p ${DEST}
rm $DEST/*
kurtosis files download cdk-v1 genesis $DEST
[ $? -ne 0 ] && echo "Error downloading genesis" && exit 1
export genesis_file=$DEST/genesis.json
kurtosis files download cdk-v1 sequencer-keystore $DEST
[ $? -ne 0 ] && echo "Error downloading sequencer-keystore" && exit 1
export sequencer_keystore_file=$DEST/sequencer.keystore

l1_rpc_port=$(kurtosis port print $ENCLAVE el-1-geth-lighthouse rpc | cut -f 3 -d ":")
[ $? -ne 0 ] && echo "Error getting l1_rpc_port" && exit 1 || export l1_rpc_port && echo "l1_rpc_port=$l1_rpc_port"

zkevm_data_streamer_port=$(kurtosis port print $ENCLAVE cdk-erigon-sequencer-001 data-streamer | cut -f 3 -d ":")
[ $? -ne 0 ] && echo "Error getting zkevm_data_streamer_port" && exit 1 || export zkevm_data_streamer_port && echo "zkevm_data_streamer_port=$zkevm_data_streamer_port"

kurtosis files download $ENCLAVE zkevm-sequence-sender-config-artifact $DEST
export zkevm_l2_sequencer_address=$(cat $DEST/config.toml |grep L2Coinbase | cut -f 2 -d "="| tr -d '"' | tr -d ' ')
export zkevm_l2_keystore_password=$(cat $DEST/config.toml |grep -A1 L2Coinbase | tr ',' '\n' | grep Password | cut -f 2 -d '=' | tr -d '}' | tr -d '"' | tr -d ' ')
export l1_chain_id=$(cat $DEST/config.toml |grep L1ChainID | cut -f 2 -d '=')
export zkevm_is_validium=$(cat $DEST/config.toml |grep IsValidiumMode | cut -f 2 -d '=')

if [ "$zkevm_is_validium" == "true" ]; then
dac_port=$(kurtosis port print $ENCLAVE zkevm-dac http-rpc | cut -f 3 -d ":")
[ $? -ne 0 ] && echo "Error getting dac_port" && exit 1 || export dac_port && echo "dac_port=$dac_port"
fi

envsubst < test/config/test.kurtosis_template.toml > $DEST/test.kurtosis.toml

echo "- start kurtosis"
echo " kurtosis clean --all; kurtosis run --enclave cdk-v1 --args-file cdk-erigon-sequencer-params.yml --image-download always ."
echo " "
echo "- Stop sequence-sender"
echo " kurtosis service stop cdk-v1 zkevm-node-sequence-sender-001"
echo " "
echo "- Add next configuration to vscode launch.json"
cat << EOF
{
"name": "run local_docker",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/",
"args":["run","-cfg","$DEST/test.kurtosis.toml",
"--components", "sequence-sender",
"--custom-network-file", "$DEST/local_config/genesis.json"
]
},
EOF

0 comments on commit c0634c2

Please sign in to comment.