From 464cd8807a65f2503b003c24037886a01415e18a Mon Sep 17 00:00:00 2001 From: RetricSu Date: Tue, 1 Jun 2021 13:12:17 +0800 Subject: [PATCH] init --- config/edit_godwoken_config.sh | 31 ------------------------------- godwoken_entrypoint.sh | 4 +--- gw_util.sh | 22 ++++++++++++++++++++++ 3 files changed, 23 insertions(+), 34 deletions(-) delete mode 100755 config/edit_godwoken_config.sh diff --git a/config/edit_godwoken_config.sh b/config/edit_godwoken_config.sh deleted file mode 100755 index b2e2e3fc..00000000 --- a/config/edit_godwoken_config.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -CONF=config.toml - -set_key_value() { - local key=${1} - local value=${2} - if [ -n $value ]; then - #echo $value - local current=$(sed -n -e "s/^\($key = '\)\([^ ']*\)\(.*\)$/\2/p" $CONF) # value带单引号 - if [ -n $current ];then - echo "setting $CONF : $key = $value" - value="$(echo "${value}" | sed 's|[&]|\\&|g')" - sed -i "s|^[#]*[ ]*${key}\([ ]*\)=.*|${key} = '${value}'|" ${CONF} - fi - fi -} - - -set_key_value "privkey_path" "deploy/private_key" -set_key_value "listen" "0.0.0.0:8119" - -# delete the default lock -sed -i '/\[block_producer.wallet_config.lock\]/{n;d}' $CONF -sed -i '/\[block_producer.wallet_config.lock\]/{n;d}' $CONF -sed -i '/\[block_producer.wallet_config.lock\]/{n;d}' $CONF - -# add new lock -sed -i "/\[block_producer.wallet_config.lock\]/a\code_hash = '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8'" $CONF -sed -i "/\[block_producer.wallet_config.lock\]/a\hash_type = 'type'" $CONF -sed -i "/\[block_producer.wallet_config.lock\]/a\args = '0x43d509d97f26007a285f39241cffcd411157196c'" $CONF \ No newline at end of file diff --git a/godwoken_entrypoint.sh b/godwoken_entrypoint.sh index 29b35f1e..fa6a360b 100644 --- a/godwoken_entrypoint.sh +++ b/godwoken_entrypoint.sh @@ -113,9 +113,7 @@ cp scripts/release/always-success ${PROJECT_DIR}/godwoken/deploy/polyjuice-valid $GW_TOOLS_BIN generate-config -d ${DATABASE_URL} -r ${ckb_rpc} -g deploy/genesis-deploy-result.json -s deploy/scripts-deploy-result.json -p deploy -o config.toml # Update block_producer.wallet_config section to your own lock. -cp ${PROJECT_DIR}/config/edit_godwoken_config.sh edit_godwoken_config.sh -./edit_godwoken_config.sh -rm edit_godwoken_config.sh +edit_godwoken_config_toml ${PROJECT_DIR}/godwoken/config.toml # update l1_sudt_script_hash in config.toml file(if it exits) with lumos script.sudt.code_hash codeHash=$(get_sudt_code_hash_from_lumos_file "${PolyjuiceDir}/packages/runner/configs/lumos-config.json") diff --git a/gw_util.sh b/gw_util.sh index 988513e1..5386375c 100755 --- a/gw_util.sh +++ b/gw_util.sh @@ -346,3 +346,25 @@ copy_poa_scripts_from_docker_or_abort(){ echo "prebuild image version is lower than v0.2.5, there is no poa scripts in docker. instead, use poa scripts in config folder. do nothing." fi } + +edit_godwoken_config_toml(){ + if [[ -f $1 ]]; + then echo 'found json file.' + else + echo "${1} file not exits, skip this steps." + return 0 + fi + + set_key_value_in_toml "privkey_path" "deploy/private_key" $1 + set_key_value_in_toml "listen" "0.0.0.0:8119" $1 + + # delete the default lock + sed -i '/\[block_producer.wallet_config.lock\]/{n;d}' $1 + sed -i '/\[block_producer.wallet_config.lock\]/{n;d}' $1 + sed -i '/\[block_producer.wallet_config.lock\]/{n;d}' $1 + + # add an new one with your own lock + sed -i "/\[block_producer.wallet_config.lock\]/a\code_hash = '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8'" $1 + sed -i "/\[block_producer.wallet_config.lock\]/a\hash_type = 'type'" $1 + sed -i "/\[block_producer.wallet_config.lock\]/a\args = '0x43d509d97f26007a285f39241cffcd411157196c'" $1 +}