Commit 52d25840 authored by QM's avatar QM

add shell

parent d63b29b1
......@@ -146,10 +146,6 @@ multisignAddrs=["168Sn1DXnLrZHTcAM9stD6t2P49fNuJfJ9", "13KTf57aCkVVJYNJBXBBveiA5
15XsGjTbV6SxQtDE1SC5oaHx8HbseQ4Lf9 -- bridge_token 地址
```
***
***
#### 离线多签设置
* 离线创建交易
......
......@@ -5,7 +5,7 @@ services:
entrypoint: ["node", "/app/ganache-core.docker.cli.js", "-a", "20", "-b", "2", "--debug", "-m", "coast bar giraffe art venue decide symbol law visual crater vital fold", "-e", "1000"]
image: trufflesuite/ganache-cli:latest
ebrelayerProxy:
ebrelayerproxy:
build:
context: .
dockerfile: Dockerfile-cross2eth
......
......@@ -8,6 +8,32 @@ set +e
source "./mainPubilcRelayerTest.sh"
function start_docker_ebrelayerProxy() {
# shellcheck disable=SC2154
cp './relayer.toml' "./relayerproxy.toml"
# 删除配置文件中不需要的字段
for deleteName in "deploy4chain33" "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers" "deploy" "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers"; do
delete_line "./relayerproxy.toml" "${deleteName}"
done
pushNameChange "./relayerproxy.toml"
sed -i 's/^ProcessWithDraw=.*/ProcessWithDraw=true/g' "./relayerproxy.toml"
# shellcheck disable=SC2154
docker cp "./relayerproxy.toml" "${dockerNamePrefix}_ebrelayerproxy_1":/root/relayer.toml
start_docker_ebrelayer "${dockerNamePrefix}_ebrelayerproxy_1" "/root/ebrelayer" "./ebrelayerproxy.log"
sleep 1
# shellcheck disable=SC2154
init_validator_relayer CLIP "${validatorPwd}" "${chain33ValidatorKeyp}" "${ethValidatorAddrKeyp}"
}
function setWithdraw() {
start_docker_ebrelayerProxy
}
function AllRelayerMainTest() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
set +e
......
......@@ -23,9 +23,6 @@ source "./offlinePublic.sh"
ethereumUSDTERC20TokenAddr=""
chain33USDTBridgeTokenAddr=""
chain33ID=0
maturityDegree=10
# ETH 部署合约者的私钥 用于部署合约时签名使用
ethDeployAddr="0x8AFDADFC88a1087c9A1D6c0F5Dd04634b87F303a"
ethDeployKey="0x8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
......@@ -70,6 +67,15 @@ source "./offlinePublic.sh"
chain33ReceiverAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
chain33ReceiverAddrKey="4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01"
chain33Validatorp="1GTxrmuWiXavhcvsaH5w9whgVxUrWsUMdV"
chain33ValidatorKeyp="0xd627968e445f2a41c92173225791bae1ba42126ae96c32f28f97ff8f226e5c68"
ethValidatorAddrp="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethValidatorAddrKeyp="9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
chain33ID=0
maturityDegree=10
validatorPwd="123456"
}
function start_docker_ebrelayerA() {
......@@ -102,22 +108,26 @@ function updata_toml_start_bcd() {
docker cp "${file}" "${dockerNamePrefix}_ebrelayer${name}_1":/root/relayer.toml
start_docker_ebrelayer "${dockerNamePrefix}_ebrelayer${name}_1" "/root/ebrelayer" "./ebrelayer${name}.log"
# shellcheck disable=SC2034
CLI="docker exec ${dockerNamePrefix}_ebrelayer${name}_1 /root/ebcli_A"
result=$(${CLI} set_pwd -p 123456hzj)
cli_ret "${result}" "set_pwd"
result=$(${CLI} unlock -p 123456hzj)
cli_ret "${result}" "unlock"
eval chain33ValidatorKey=\$chain33ValidatorKey${name}
# shellcheck disable=SC2154
result=$(${CLI} chain33 import_privatekey -k "${chain33ValidatorKey}")
cli_ret "${result}" "chain33 import_privatekey"
eval ethValidatorAddrKey=\$ethValidatorAddrKey${name}
# shellcheck disable=SC2154
result=$(${CLI} ethereum import_privatekey -k "${ethValidatorAddrKey}")
cli_ret "${result}" "ethereum import_privatekey"
init_validator_relayer "${CLI}" "${validatorPwd}" "${chain33ValidatorKey}" "${ethValidatorAddrKey}"
# result=$(${CLI} set_pwd -p 123456hzj)
# cli_ret "${result}" "set_pwd"
#
# result=$(${CLI} unlock -p 123456hzj)
# cli_ret "${result}" "unlock"
#
# # shellcheck disable=SC2154
# result=$(${CLI} chain33 import_privatekey -k "${chain33ValidatorKey}")
# cli_ret "${result}" "chain33 import_privatekey"
#
# # shellcheck disable=SC2154
# result=$(${CLI} ethereum import_privatekey -k "${ethValidatorAddrKey}")
# cli_ret "${result}" "ethereum import_privatekey"
done
}
......@@ -127,7 +137,7 @@ function restart_ebrelayerA() {
sleep 1
start_docker_ebrelayerA
result=$(${CLIA} unlock -p 123456hzj)
result=$(${CLIA} unlock -p "${validatorPwd}")
cli_ret "${result}" "unlock"
}
......@@ -841,6 +851,7 @@ function get_cli() {
Para8801Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
Para8901Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
CLIP="docker exec ${dockerNamePrefix}_ebrelayerproxy_1 /root/ebcli_A"
CLIA="docker exec ${dockerNamePrefix}_ebrelayera_1 /root/ebcli_A"
CLIB="docker exec ${dockerNamePrefix}_ebrelayerb_1 /root/ebcli_A"
CLIC="docker exec ${dockerNamePrefix}_ebrelayerc_1 /root/ebcli_A"
......
......@@ -73,23 +73,45 @@ function OfflineDeploy() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# shellcheck disable=SC2120
function InitRelayerA() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} set_pwd -p 123456hzj)
# init $1 CLI $2 pwd $3 chain33ValidatorKey $4 ethValidatorAddrKey
function init_validator_relayer() {
local CLI=$1
local pwd=$2
local chain33ValidatorKey=$3
local ethValidatorAddrKey=$4
result=$(${CLI} set_pwd -p "${pwd}")
cli_ret "${result}" "set_pwd"
result=$(${CLIA} unlock -p 123456hzj)
result=$(${CLI} unlock -p "${pwd}")
cli_ret "${result}" "unlock"
# shellcheck disable=SC2154
result=$(${CLIA} chain33 import_privatekey -k "${chain33ValidatorKeya}")
result=$(${CLI} chain33 import_privatekey -k "${chain33ValidatorKey}")
cli_ret "${result}" "chain33 import_privatekey"
# shellcheck disable=SC2154
result=$(${CLIA} ethereum import_privatekey -k "${ethValidatorAddrKeya}")
result=$(${CLI} ethereum import_privatekey -k "${ethValidatorAddrKey}")
cli_ret "${result}" "ethereum import_privatekey"
}
# shellcheck disable=SC2120
function InitRelayerA() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# shellcheck disable=SC2154
init_validator_relayer "${CLI}" "${validatorPwd}" "${chain33ValidatorKeya}" "${ethValidatorAddrKeya}"
# result=$(${CLIA} set_pwd -p 123456hzj)
# cli_ret "${result}" "set_pwd"
#
# result=$(${CLIA} unlock -p 123456hzj)
# cli_ret "${result}" "unlock"
#
# # shellcheck disable=SC2154
# result=$(${CLIA} chain33 import_privatekey -k "${chain33ValidatorKeya}")
# cli_ret "${result}" "chain33 import_privatekey"
#
# # shellcheck disable=SC2154
# result=$(${CLIA} ethereum import_privatekey -k "${ethValidatorAddrKeya}")
# cli_ret "${result}" "ethereum import_privatekey"
${CLIA} chain33 multisign set_multiSign -a "${multisignChain33Addr}"
......
......@@ -202,7 +202,7 @@ function start_ebrelayer_and_unlock() {
local CLI="./ebcli_$1"
local count=0
while true; do
result=$(${CLI} relayer unlock -p 123456hzj | jq -r .isOK)
result=$(${CLI} relayer unlock -p ${validatorPwd} | jq -r .isOK)
if [[ ${result} == "true" ]]; then
break
fi
......@@ -225,7 +225,7 @@ function start_ebrelayer_and_setpwd_unlock() {
local CLI="./ebcli_$1"
local count=0
while true; do
result=$(${CLI} relayer set_pwd -p 123456hzj | jq -r .isOK)
result=$(${CLI} relayer set_pwd -p ${validatorPwd} | jq -r .isOK)
if [[ ${result} == "true" ]]; then
break
fi
......@@ -241,7 +241,7 @@ function start_ebrelayer_and_setpwd_unlock() {
count=0
while true; do
result=$(${CLI} relayer unlock -p 123456hzj | jq -r .isOK)
result=$(${CLI} relayer unlock -p ${validatorPwd} | jq -r .isOK)
if [[ ${result} == "true" ]]; then
break
fi
......
......@@ -66,7 +66,7 @@ function kill_ebrelayerD() {
function start_ebrelayerC() {
nohup ./relayer_C/ebrelayer ./relayer_C/relayer.toml >./relayer_C/cross2eth_C.log 2>&1 &
sleep 2
${CLIC} unlock -p 123456hzj
${CLIC} unlock -p ${validatorPwd}
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
sleep ${maturityDegree}
......@@ -76,7 +76,7 @@ function start_ebrelayerC() {
function start_ebrelayerD() {
nohup ./relayer_D/ebrelayer ./relayer_D/relayer.toml >./relayer_D/cross2eth_D.log 2>&1 &
sleep 2
${CLID} unlock -p 123456hzj
${CLID} unlock -p ${validatorPwd}
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
sleep ${maturityDegree}
......@@ -86,10 +86,10 @@ function start_ebrelayerD() {
function InitAndDeploy() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} set_pwd -p 123456hzj)
result=$(${CLIA} set_pwd -p ${validatorPwd})
cli_ret "${result}" "set_pwd"
result=$(${CLIA} unlock -p 123456hzj)
result=$(${CLIA} unlock -p ${validatorPwd})
cli_ret "${result}" "unlock"
# shellcheck disable=SC2154
......@@ -287,10 +287,10 @@ function updata_toml_start_BCD() {
sleep 2
CLI="./ebcli_$name"
result=$(${CLI} set_pwd -p 123456hzj)
result=$(${CLI} set_pwd -p ${validatorPwd})
cli_ret "${result}" "set_pwd"
result=$(${CLI} unlock -p 123456hzj)
result=$(${CLI} unlock -p ${validatorPwd})
cli_ret "${result}" "unlock"
eval chain33ValidatorKey=\$chain33ValidatorKey${name}
......@@ -358,7 +358,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer ebrelayer
start_ebrelayerA
result=$(${CLIA} unlock -p 123456hzj)
result=$(${CLIA} unlock -p ${validatorPwd})
cli_ret "${result}" "unlock"
# start ebrelayer B C D
......@@ -424,7 +424,7 @@ function InitChain33Validator() {
}
# 导入 chain33Validators 私钥生成地址
for name in a b c d; do
for name in a b c d p; do
eval chain33ValidatorKey=\$chain33ValidatorKey${name}
eval chain33Validator=\$chain33Validator${name}
result=$(${Chain33Cli} account import_key -k "${chain33ValidatorKey}" -l validator$name)
......@@ -526,7 +526,7 @@ function StartOneRelayer() {
kill_ebrelayer ebrelayer
start_ebrelayerA
result=$(${CLIA} unlock -p 123456hzj)
result=$(${CLIA} unlock -p ${validatorPwd})
cli_ret "${result}" "unlock"
# 设置 token 地址
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment