Skip to content

Commit

Permalink
Merge pull request #47 from RetricSu/rm-edit-gw-config.sh
Browse files Browse the repository at this point in the history
move edit-gw-config.sh file to gw_util.sh
  • Loading branch information
RetricSu authored Jun 1, 2021
2 parents 53efb3a + 464cd88 commit 66714c8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 34 deletions.
31 changes: 0 additions & 31 deletions config/edit_godwoken_config.sh

This file was deleted.

4 changes: 1 addition & 3 deletions godwoken_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
22 changes: 22 additions & 0 deletions gw_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 66714c8

Please sign in to comment.