diff --git a/test/config/test.kurtosis_template.toml b/test/config/test.kurtosis_template.toml index 25abf430..061a4838 100644 --- a/test/config/test.kurtosis_template.toml +++ b/test/config/test.kurtosis_template.toml @@ -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 @@ -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 diff --git a/test/scripts/config_kurtosis.sh b/test/scripts/config_kurtosis.sh deleted file mode 100755 index 009c59ba..00000000 --- a/test/scripts/config_kurtosis.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -ENCLAVE=cdk-v1 -DEST=/tmp/seq_sender - -build_vars_file(){ - cat > $DEST/vars.json < $DEST/test.kurtosis.toml - -echo "rember to stop sequence-sender:" -echo "-----------------------------------------------------------" -echo "kurtosis service stop cdk-v1 zkevm-node-sequence-sender-001" - diff --git a/test/scripts/config_kurtosis_for_local_run.sh b/test/scripts/config_kurtosis_for_local_run.sh new file mode 100755 index 00000000..424858bc --- /dev/null +++ b/test/scripts/config_kurtosis_for_local_run.sh @@ -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 +