Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
0f1093a0
Commit
0f1093a0
authored
May 09, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teshsh文件规整
parent
07736434
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
59 deletions
+53
-59
allRelayerTest.sh
plugin/dapp/x2Ethereum/testsh/allRelayerTest.sh
+19
-16
bridgeBankTest.sh
plugin/dapp/x2Ethereum/testsh/bridgeBankTest.sh
+1
-1
ebrelayerTest.sh
plugin/dapp/x2Ethereum/testsh/ebrelayerTest.sh
+3
-0
publicTest.sh
plugin/dapp/x2Ethereum/testsh/publicTest.sh
+15
-30
x2ethereumTest.sh
plugin/dapp/x2Ethereum/testsh/x2ethereumTest.sh
+15
-12
No files found.
plugin/dapp/x2Ethereum/allRelayerTest.sh
→
plugin/dapp/x2Ethereum/
testsh/
allRelayerTest.sh
View file @
0f1093a0
...
...
@@ -3,12 +3,15 @@
# shellcheck source=/dev/null
set
-x
source
"./ebrelayer/publicTest.sh"
# eth 和 chain33 两端都启动
# 启动4个 relayer 每个权重一样
CLIA
=
"./build/ebcli_A"
CLIB
=
"./build/ebcli_B"
CLIC
=
"./build/ebcli_C"
CLID
=
"./build/ebcli_D"
source
"./publicTest.sh"
CLIA
=
"../build/ebcli_A"
CLIB
=
"../build/ebcli_B"
CLIC
=
"../build/ebcli_C"
CLID
=
"../build/ebcli_D"
docker_chain33_ip
=
$(
docker inspect
-f
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
build_chain33_1
)
Chain33Cli
=
"
$GOPATH
/src/github.com/33cn/plugin/build/chain33-cli --rpc_laddr http://
${
docker_chain33_ip
}
:8801"
...
...
@@ -56,10 +59,10 @@ function EthImportKey() {
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
# 重启 ebrelayer 并解锁
for
name
in
A B C D
;
do
start_ebrelayer
".
/build/"
$name
"/ebrelayer"
"
./build/"
$name
"/ebrelayer.log"
start_ebrelayer
".
./build/"
$name
"/ebrelayer"
".
./build/"
$name
"/ebrelayer.log"
# 导入测试地址私钥
CLI
=
"./build/ebcli_
$name
"
CLI
=
".
.
/build/ebcli_
$name
"
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
)
#cli_ret "${result}" "set_pwd"
...
...
@@ -102,20 +105,20 @@ function StartRelayerAndDeploy() {
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
for
name
in
A B C D
;
do
local
ebrelayer
=
"./build/
$name
/ebrelayer"
local
ebrelayer
=
".
.
/build/
$name
/ebrelayer"
kill_ebrelayer
"
${
ebrelayer
}
"
done
kill_ebrelayer
"./build/ebrelayer"
kill_ebrelayer
".
.
/build/ebrelayer"
sleep
1
rm
-rf
'.
/build/A'
'./build/B'
'./build/C'
'./build/D'
'./build/datadir'
'./build/ebrelayer.log'
'
./build/logs'
mkdir
'.
/build/A'
'./build/B'
'./build/C'
'
./build/D'
cp
'.
/ebrelayer/relayer.toml'
'
./build/A/relayer.toml'
cp
'.
/build/ebrelayer'
'
./build/A/ebrelayer'
rm
-rf
'.
./build/A'
'../build/B'
'../build/C'
'../build/D'
'../build/datadir'
'../build/ebrelayer.log'
'.
./build/logs'
mkdir
'.
./build/A'
'../build/B'
'../build/C'
'.
./build/D'
cp
'.
./ebrelayer/relayer.toml'
'.
./build/A/relayer.toml'
cp
'.
./build/ebrelayer'
'.
./build/A/ebrelayer'
start_trufflesuite
start_ebrelayer
".
/build/A/ebrelayer"
"
./build/A/ebrelayer.log"
start_ebrelayer
".
./build/A/ebrelayer"
".
./build/A/ebrelayer.log"
# 部署合约
InitAndDeploy
...
...
@@ -124,9 +127,9 @@ function StartRelayerAndDeploy() {
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
# BridgeRegistry="0x5331F912027057fBE8139D91B225246e8159232f"
kill_ebrelayer
"./build/A/ebrelayer"
kill_ebrelayer
".
.
/build/A/ebrelayer"
# 修改 relayer.toml 配置文件
updata_relayer_toml
${
BridgeRegistry
}
${
maturityDegree
}
"./build/A/relayer.toml"
updata_relayer_toml
${
BridgeRegistry
}
${
maturityDegree
}
".
.
/build/A/relayer.toml"
updata_all_relayer_toml
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
...
...
plugin/dapp/x2Ethereum/
ebrelayer
/bridgeBankTest.sh
→
plugin/dapp/x2Ethereum/
testsh
/bridgeBankTest.sh
View file @
0f1093a0
...
...
@@ -346,7 +346,7 @@ main() {
InitAndDeploy
TestETH2Chain33Erc20
#
TestETH2Chain33Erc20_err
TestETH2Chain33Erc20_err
TestETH2Chain33Assets
TestChain33ToEthAssets
...
...
plugin/dapp/x2Ethereum/
ebrelayer
/ebrelayerTest.sh
→
plugin/dapp/x2Ethereum/
testsh
/ebrelayerTest.sh
View file @
0f1093a0
#!/usr/bin/env bash
set
-x
# 只启动 eth 这一端的测试
# 启动4个 relayer 每个权重一样
source
"./publicTest.sh"
CLIA
=
"../build/ebcli_A"
CLIB
=
"../build/ebcli_B"
...
...
plugin/dapp/x2Ethereum/
ebrelayer
/publicTest.sh
→
plugin/dapp/x2Ethereum/
testsh
/publicTest.sh
View file @
0f1093a0
...
...
@@ -4,19 +4,20 @@
set
-x
set
-e
# 公用测试函数
#color
RED
=
'\033[1;31m'
GRE
=
'\033[1;32m'
NOC
=
'\033[0m'
# 解锁
#function unlock_relayer() {
# for name in A B C D
# do
# local CLI="../build/ebcli_$name"
# ${CLI} relayer unlock -p 123456hzj
# done
#}
function
kill_all_ebrelayer
()
{
for
name
in
A B C D
do
local
ebrelayer
=
"./../build/
$name
/ebrelayer"
kill_ebrelayer
"
${
ebrelayer
}
"
done
}
# 判断结果是否正确
function
cli_ret
()
{
...
...
@@ -148,14 +149,6 @@ function kill_ebrelayer() {
sleep
1
}
#function kill_all_ebrelayer() {
# for name in A B C D
# do
# local ebrelayer="./../build/$name/ebrelayer"
# kill_ebrelayer "${ebrelayer}"
# done
#}
# chain33 区块等待 $1:cli 路径 $2:等待高度
function
block_wait
()
{
set
+x
...
...
@@ -177,10 +170,6 @@ function block_wait() {
count
=
$((
count
+
1
))
sleep
1
# if [[ ${count} -ge 30 ]]; then
# break
# fi
done
count
=
$((
count
+
1
))
...
...
@@ -294,9 +283,9 @@ function updata_relayer_toml() {
sed
-i
's/EthMaturityDegree=10/'
EthMaturityDegree
=
${
maturityDegree
}
'/g'
"
${
file
}
"
sed
-i
's/maturityDegree=10/'
maturityDegree
=
${
maturityDegree
}
'/g'
"
${
file
}
"
#sed -i 's/#BridgeRegistry=\"0x40BFE5eD039A9a2Eb42ece2E2CA431bFa7Cf4c42\"/BridgeRegistry=\"'${BridgeRegistry}'\"/g' "./build/relayer.toml"
#sed -i 's/192.168.64.2/'${chain33Host}'/g' "./build/relayer.toml"
#sed -i 's/192.168.3.156/'${pushHost}'/g' "./build/relayer.toml"
#sed -i 's/#BridgeRegistry=\"0x40BFE5eD039A9a2Eb42ece2E2CA431bFa7Cf4c42\"/BridgeRegistry=\"'${BridgeRegistry}'\"/g' ".
.
/build/relayer.toml"
#sed -i 's/192.168.64.2/'${chain33Host}'/g' ".
.
/build/relayer.toml"
#sed -i 's/192.168.3.156/'${pushHost}'/g' ".
.
/build/relayer.toml"
}
# 更新 B C D 的配置文件
...
...
@@ -306,9 +295,9 @@ function updata_all_relayer_toml() {
# local dockername=30
for
name
in
B C D
;
do
local
file
=
"./build/"
$name
"/relayer.toml"
cp
'./build/A/relayer.toml'
"
${
file
}
"
cp
'.
/build/ebrelayer'
"
./build/"
$name
"/ebrelayer"
local
file
=
".
.
/build/"
$name
"/relayer.toml"
cp
'.
.
/build/A/relayer.toml'
"
${
file
}
"
cp
'.
./build/ebrelayer'
".
./build/"
$name
"/ebrelayer"
# 删除配置文件中不需要的字段
for
deleteName
in
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"
\[
deploy
\]
"
;
do
...
...
@@ -440,10 +429,6 @@ function eth_block_wait() {
count
=
$((
count
+
1
))
sleep
1
# if [[ ${count} -ge 80 ]]; then
# break
# fi
done
count
=
$((
count
+
1
))
...
...
plugin/dapp/x2Ethereum/x2ethereumTest.sh
→
plugin/dapp/x2Ethereum/
testsh/
x2ethereumTest.sh
View file @
0f1093a0
...
...
@@ -3,9 +3,12 @@
# shellcheck source=/dev/null
set
-x
source
"./ebrelayer/publicTest.sh"
# eth 和 chain33 两端都启动
# 只启动一个 relayer 第一个地址权重设置超过2/3
CLI
=
"./build/ebcli_A"
source
"./publicTest.sh"
CLI
=
"../build/ebcli_A"
docker_chain33_ip
=
$(
docker inspect
-f
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
build_chain33_1
)
Chain33Cli
=
"
$GOPATH
/src/github.com/33cn/plugin/build/chain33-cli --rpc_laddr http://
${
docker_chain33_ip
}
:8801"
...
...
@@ -65,17 +68,17 @@ function EthImportKey() {
function
StartRelayerAndDeploy
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
kill_ebrelayer
"./build/ebrelayer"
kill_ebrelayer
"./build/A/ebrelayer"
kill_ebrelayer
".
.
/build/ebrelayer"
kill_ebrelayer
".
.
/build/A/ebrelayer"
cp
".
/ebrelayer/relayer.toml"
"
./build/relayer.toml"
sed
-i
's/initPowers=\[25, 25, 25, 25\]/initPowers=\[925, 25, 25, 25\]/g'
"./build/relayer.toml"
rm
-rf
".
/build/datadir"
"./build/ebrelayer.log"
"
./build/logs"
cp
".
./ebrelayer/relayer.toml"
".
./build/relayer.toml"
sed
-i
's/initPowers=\[25, 25, 25, 25\]/initPowers=\[925, 25, 25, 25\]/g'
".
.
/build/relayer.toml"
rm
-rf
".
./build/datadir"
"../build/ebrelayer.log"
".
./build/logs"
# 启动 eth
start_trufflesuite
start_ebrelayer
".
/build/ebrelayer"
"
./build/ebrelayer.log"
start_ebrelayer
".
./build/ebrelayer"
".
./build/ebrelayer.log"
InitAndDeploy
...
...
@@ -84,12 +87,12 @@ function StartRelayerAndDeploy() {
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
# BridgeRegistry="0x5331F912027057fBE8139D91B225246e8159232f"
kill_ebrelayer
"./build/ebrelayer"
kill_ebrelayer
".
.
/build/ebrelayer"
# 修改 relayer.toml 配置文件
updata_relayer_toml
${
BridgeRegistry
}
${
maturityDegree
}
"./build/relayer.toml"
updata_relayer_toml
${
BridgeRegistry
}
${
maturityDegree
}
".
.
/build/relayer.toml"
# 重启 ebrelayer 并解锁
start_ebrelayer
".
/build/ebrelayer"
"
./build/ebrelayer.log"
start_ebrelayer
".
./build/ebrelayer"
".
./build/ebrelayer.log"
${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
${
CLI
}
relayer unlock
-p
123456hzj
...
...
@@ -99,7 +102,7 @@ function StartRelayerAndDeploy() {
function
ExitRelayer
()
{
# kill ebrelayer
kill_ebrelayer
"./build/ebrelayer"
kill_ebrelayer
".
.
/build/ebrelayer"
# 删除 eth
docker stop ganachetest
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment