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
e8808e5a
Commit
e8808e5a
authored
May 13, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Ropsten test
parent
da782525
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
53 deletions
+109
-53
RopstenTest.sh
plugin/dapp/x2Ethereum/cmd/build/RopstenTest.sh
+47
-53
publicTest.sh
plugin/dapp/x2Ethereum/testsh/publicTest.sh
+62
-0
No files found.
plugin/dapp/x2Ethereum/cmd/build/RopstenTest.sh
View file @
e8808e5a
#!/usr/bin/env bash
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck disable=SC2128
# shellcheck source=/dev/null
# shellcheck source=/dev/null
# 测试前请先阅读文档,对代码进行修改 http://note.youdao.com/noteshare?id=675ce9a1162b6639182206864985e935&sub=14A1CFAA14CB4318B207EAEC94991A93
set
-x
set
-x
set
+e
set
+e
...
@@ -44,27 +46,20 @@ function kill_ebrelayerD() {
...
@@ -44,27 +46,20 @@ function kill_ebrelayerD() {
kill_ebrelayer
"./D/ebrelayer"
kill_ebrelayer
"./D/ebrelayer"
}
}
function
start_ebrelayerC
()
{
function
start_ebrelayerC
()
{
start_ebrelayer
"./C/ebrelayer"
"./C/ebrelayer.log"
start_ebrelayer_and_unlock C
${
CLIC
}
relayer unlock
-p
123456hzj
block_wait 2
sleep
5
eth_block_wait 3 https://ropsten-rpc.linkpool.io/
eth_block_wait 1 https://ropsten-rpc.linkpool.io/
sleep
1
sleep
1
}
}
function
start_ebrelayerD
()
{
function
start_ebrelayerD
()
{
start_ebrelayer
"./D/ebrelayer"
"./D/ebrelayer.log"
start_ebrelayer_and_unlock D
${
CLID
}
relayer unlock
-p
123456hzj
block_wait 2
sleep
5
eth_block_wait 3 https://ropsten-rpc.linkpool.io/
eth_block_wait 1 https://ropsten-rpc.linkpool.io/
sleep
1
sleep
1
}
}
function
InitAndDeploy
()
{
function
InitAndDeploy
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
result
=
$(${
CLIA
}
relayer set_pwd
-n
123456hzj
-o
kk
)
cli_ret
"
${
result
}
"
"set_pwd"
result
=
$(${
CLIA
}
relayer unlock
-p
123456hzj
)
cli_ret
"
${
result
}
"
"unlock"
result
=
$(${
CLIA
}
relayer ethereum deploy
)
result
=
$(${
CLIA
}
relayer ethereum deploy
)
cli_ret
"
${
result
}
"
"deploy"
cli_ret
"
${
result
}
"
"deploy"
...
@@ -86,18 +81,17 @@ function StartRelayerAndDeploy() {
...
@@ -86,18 +81,17 @@ function StartRelayerAndDeploy() {
cp
'./relayer.toml'
'./A/relayer.toml'
cp
'./relayer.toml'
'./A/relayer.toml'
cp
'./ebrelayer'
'./A/ebrelayer'
cp
'./ebrelayer'
'./A/ebrelayer'
#start_trufflesuite
start_ebrelayer_and_setpwd_unlock A
#start_ebrelayer "./A/ebrelayer" "./A/ebrelayer.log"
# 部署合约
# 部署合约
#
InitAndDeploy
InitAndDeploy
#
获取 BridgeRegistry 地址
获取 BridgeRegistry 地址
#
result=$(${CLIA} relayer ethereum bridgeRegistry)
result
=
$(${
CLIA
}
relayer ethereum bridgeRegistry
)
#
BridgeRegistry=$(cli_ret "${result}" "bridgeRegistry" ".addr")
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
BridgeRegistry
=
"0x212ae3c705DA7E3568a85595E8e16268FE7F6448"
#
BridgeRegistry="0x212ae3c705DA7E3568a85595E8e16268FE7F6448"
#
kill_ebrelayer "./A/ebrelayer"
kill_ebrelayer
"./A/ebrelayer"
# 修改 relayer.toml 配置文件
# 修改 relayer.toml 配置文件
updata_relayer_toml_ropston
${
BridgeRegistry
}
${
maturityDegree
}
"./A/relayer.toml"
updata_relayer_toml_ropston
${
BridgeRegistry
}
${
maturityDegree
}
"./A/relayer.toml"
updata_all_relayer_toml2
updata_all_relayer_toml2
...
@@ -171,15 +165,7 @@ function StartAllEbrelayer() {
...
@@ -171,15 +165,7 @@ function StartAllEbrelayer() {
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
# 重启 ebrelayer 并解锁
# 重启 ebrelayer 并解锁
for
name
in
A B C D
;
do
for
name
in
A B C D
;
do
start_ebrelayer
"./"
$name
"/ebrelayer"
"./"
$name
"/ebrelayer.log"
start_ebrelayer_and_setpwd_unlock
$name
# 导入测试地址私钥
CLI
=
"./ebcli_
$name
"
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
)
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj
)
cli_ret
"
${
result
}
"
"unlock"
done
done
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
...
@@ -219,14 +205,18 @@ function EthImportKey() {
...
@@ -219,14 +205,18 @@ function EthImportKey() {
function
TestChain33ToEthAssets
()
{
function
TestChain33ToEthAssets
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
# token4chain33 在 以太坊 上先有 bty
# token4chain33 在 以太坊 上先有 bty
result
=
$(${
CLIA
}
relayer ethereum token4chain33
-s
bty
)
tokenSymbol
=
"bty"
result
=
$(${
CLIA
}
relayer ethereum token4chain33
-s
"
${
tokenSymbol
}
"
)
tokenAddrBty
=
$(
cli_ret
"
${
result
}
"
"token4chain33"
".addr"
)
tokenAddrBty
=
$(
cli_ret
"
${
result
}
"
"token4chain33"
".addr"
)
#tokenAddrBty="0x79033B1090b0394BadCf43C4394cfe334BA2AF88" # YCC
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddrBty
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddrBty
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
# chain33 lock bty
# chain33 lock bty
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
bty
-r
${
ethReceiverAddr1
}
-q
${
tokenAddrBty
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr1
}
-q
${
tokenAddrBty
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -282,7 +272,7 @@ function TestETH2Chain33Assets() {
...
@@ -282,7 +272,7 @@ function TestETH2Chain33Assets() {
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
0.
0
1
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
0.1
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -306,9 +296,9 @@ function TestETH2Chain33Erc20() {
...
@@ -306,9 +296,9 @@ function TestETH2Chain33Erc20() {
# token4erc20 在 chain33 上先有 token,同时 mint
# token4erc20 在 chain33 上先有 token,同时 mint
tokenSymbol
=
"testc"
tokenSymbol
=
"testc"
#
result=$(${CLIA} relayer ethereum token4erc20 -s "${tokenSymbol}")
result
=
$(${
CLIA
}
relayer ethereum token4erc20
-s
"
${
tokenSymbol
}
"
)
#
tokenAddr=$(cli_ret "${result}" "token4erc20" ".addr")
tokenAddr
=
$(
cli_ret
"
${
result
}
"
"token4erc20"
".addr"
)
tokenAddr
=
"0x47F62ba65bCa4150BE98F31566DC559b9b04fc2D"
#
tokenAddr="0x47F62ba65bCa4150BE98F31566DC559b9b04fc2D"
# 先铸币 1000
# 先铸币 1000
result
=
$(${
CLIA
}
relayer ethereum mint
-m
1000
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum mint
-m
1000
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
...
@@ -367,6 +357,8 @@ function TestChain33ToEthAssetsKill() {
...
@@ -367,6 +357,8 @@ function TestChain33ToEthAssetsKill() {
tokenAddrBty
=
$(
cli_ret
"
${
result
}
"
"token4chain33"
".addr"
)
tokenAddrBty
=
$(
cli_ret
"
${
result
}
"
"token4chain33"
".addr"
)
fi
fi
# tokenAddrBty="0x79033B1090b0394BadCf43C4394cfe334BA2AF88" # YCC
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddrBty
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddrBty
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
...
@@ -374,7 +366,7 @@ function TestChain33ToEthAssetsKill() {
...
@@ -374,7 +366,7 @@ function TestChain33ToEthAssetsKill() {
kill_ebrelayerD
kill_ebrelayerD
# chain33 lock bty
# chain33 lock bty
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
bty
-r
${
ethReceiverAddr2
}
-q
${
tokenAddrBty
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
1.41
-t
bty
-r
${
ethReceiverAddr2
}
-q
${
tokenAddrBty
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -386,10 +378,10 @@ function TestChain33ToEthAssetsKill() {
...
@@ -386,10 +378,10 @@ function TestChain33ToEthAssetsKill() {
start_ebrelayerC
start_ebrelayerC
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
-t
"
${
tokenAddrBty
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
-t
"
${
tokenAddrBty
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"
5
"
cli_ret
"
${
result
}
"
"balance"
".balance"
"
1.41
"
# eth burn
# eth burn
result
=
$(${
CLIA
}
relayer ethereum burn
-m
5
-k
"
${
ethReceiverAddrKey2
}
"
-r
"
${
chain33Validator1
}
"
-t
"
${
tokenAddrBty
}
"
)
result
=
$(${
CLIA
}
relayer ethereum burn
-m
1.41
-k
"
${
ethReceiverAddrKey2
}
"
-r
"
${
chain33Validator1
}
"
-t
"
${
tokenAddrBty
}
"
)
cli_ret
"
${
result
}
"
"burn"
cli_ret
"
${
result
}
"
"burn"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
-t
"
${
tokenAddrBty
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
-t
"
${
tokenAddrBty
}
"
)
...
@@ -404,7 +396,7 @@ function TestChain33ToEthAssetsKill() {
...
@@ -404,7 +396,7 @@ function TestChain33ToEthAssetsKill() {
start_ebrelayerD
start_ebrelayerD
result
=
$(${
Chain33Cli
}
account balance
-a
"
${
chain33Validator1
}
"
-e
x2ethereum
)
result
=
$(${
Chain33Cli
}
account balance
-a
"
${
chain33Validator1
}
"
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"
5
"
balance_ret
"
${
result
}
"
"
1.41
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -419,29 +411,30 @@ function TestETH2Chain33AssetsKill() {
...
@@ -419,29 +411,30 @@ function TestETH2Chain33AssetsKill() {
bridgeBankAddr
=
$(
cli_ret
"
${
result
}
"
"bridgeBankAddr"
".addr"
)
bridgeBankAddr
=
$(
cli_ret
"
${
result
}
"
"bridgeBankAddr"
".addr"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
kill_ebrelayerC
kill_ebrelayerC
kill_ebrelayerD
kill_ebrelayerD
# eth lock 0.1
# eth lock 0.1
result
=
$(${
CLIA
}
relayer ethereum lock
-m
0.1
-k
"
${
ethReceiverAddrKey1
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
result
=
$(${
CLIA
}
relayer ethereum lock
-m
0.1
33
-k
"
${
ethReceiverAddrKey1
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
cli_ret
"
${
result
}
"
"lock"
cli_ret
"
${
result
}
"
"lock"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.1"
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+0.133"
| bc
)
# eth 等待 10 个区块
# eth 等待 10 个区块
eth_block_wait
$((
maturityDegree
+
2
))
https://ropsten-rpc.linkpool.io/
eth_block_wait
$((
maturityDegree
+
2
))
https://ropsten-rpc.linkpool.io/
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]
"
)
balance
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
| jq
-r
".balance
"
)
balance_ret
"
${
result
}
"
"0"
balance_ret
"
${
result
}
"
"0"
start_ebrelayerC
start_ebrelayerC
start_ebrelayerD
start_ebrelayerD
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"0.1"
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
| jq
-r
".balance"
)
balance_ret
"
${
result
}
"
"0.133"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
...
@@ -449,7 +442,7 @@ function TestETH2Chain33AssetsKill() {
...
@@ -449,7 +442,7 @@ function TestETH2Chain33AssetsKill() {
kill_ebrelayerC
kill_ebrelayerC
kill_ebrelayerD
kill_ebrelayerD
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
0.1
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
0.1
33
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -459,13 +452,13 @@ function TestETH2Chain33AssetsKill() {
...
@@ -459,13 +452,13 @@ function TestETH2Chain33AssetsKill() {
eth_block_wait 2 https://ropsten-rpc.linkpool.io/
eth_block_wait 2 https://ropsten-rpc.linkpool.io/
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.1"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.1
33
"
start_ebrelayerC
start_ebrelayerC
start_ebrelayerD
start_ebrelayerD
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+0.1"
| bc
)
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+0.1
33
"
| bc
)
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -544,6 +537,7 @@ function TestETH2Chain33Erc20Kill() {
...
@@ -544,6 +537,7 @@ function TestETH2Chain33Erc20Kill() {
function
AllRelayerMainTest
()
{
function
AllRelayerMainTest
()
{
set
+e
set
+e
# docker cp ${GOPATH}/src/github.com/33cn/plugin/build/ci/x2Ethereum build_chain33_1:/root/x2Ethereum
# docker cp ${GOPATH}/src/github.com/33cn/plugin/build/ci/x2Ethereum build_chain33_1:/root/x2Ethereum
# docker cp ${GOPATH}/src/github.com/33cn/plugin/plugin/dapp/x2Ethereum/cmd/build/RopstenTest.sh build_chain33_1:/root/x2Ethereum/RopstenTest.sh
Chain33Cli
=
"./../chain33-cli"
Chain33Cli
=
"./../chain33-cli"
...
@@ -555,16 +549,16 @@ function AllRelayerMainTest() {
...
@@ -555,16 +549,16 @@ function AllRelayerMainTest() {
fi
fi
# init
# init
#
StartRelayerAndDeploy
StartRelayerAndDeploy
#
InitChain33Vilators
InitChain33Vilators
StartAllEbrelayer
StartAllEbrelayer
EthImportKey
EthImportKey
# test
# test
#
TestChain33ToEthAssets
TestChain33ToEthAssets
TestETH2Chain33Assets
TestETH2Chain33Assets
TestETH2Chain33Erc20
TestETH2Chain33Erc20
#
# # kill relayer and start relayer
# # kill relayer and start relayer
# TestChain33ToEthAssetsKill
# TestChain33ToEthAssetsKill
# TestETH2Chain33AssetsKill
# TestETH2Chain33AssetsKill
...
...
plugin/dapp/x2Ethereum/testsh/publicTest.sh
View file @
e8808e5a
...
@@ -131,6 +131,68 @@ function start_ebrelayer() {
...
@@ -131,6 +131,68 @@ function start_ebrelayer() {
done
done
}
}
# 后台启动 ebrelayer 进程 $1 A B C D
function
start_ebrelayer_and_unlock
()
{
start_ebrelayer
"./
${
1
}
/ebrelayer"
"./
${
1
}
/ebrelayer.log"
sleep
2
local
CLI
=
"./ebcli_
$1
"
local
count
=
0
while
true
;
do
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj | jq
-r
.isOK
)
if
[[
${
result
}
==
"true"
]]
;
then
break
fi
count
=
$((
count
+
1
))
if
[[
${
count
}
==
5
]]
;
then
echo
-e
"
${
RED
}
failed to unlock
${
NOC
}
"
exit
1
fi
sleep
1
done
}
# 后台启动 ebrelayer 进程 $1 A B C D
function
start_ebrelayer_and_setpwd_unlock
()
{
start_ebrelayer
"./
${
1
}
/ebrelayer"
"./
${
1
}
/ebrelayer.log"
sleep
2
local
CLI
=
"./ebcli_
$1
"
local
count
=
0
while
true
;
do
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk | jq
-r
.isOK
)
if
[[
${
result
}
==
"true"
]]
;
then
break
fi
count
=
$((
count
+
1
))
if
[[
${
count
}
==
5
]]
;
then
echo
-e
"
${
RED
}
failed to set_pwd
${
NOC
}
"
exit
1
fi
sleep
1
done
count
=
0
while
true
;
do
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj | jq
-r
.isOK
)
if
[[
${
result
}
==
"true"
]]
;
then
break
fi
count
=
$((
count
+
1
))
if
[[
${
count
}
==
5
]]
;
then
echo
-e
"
${
RED
}
failed to unlock
${
NOC
}
"
exit
1
fi
sleep
1
done
}
# 杀死进程ebrelayer 进程 $1进程名称
# 杀死进程ebrelayer 进程 $1进程名称
function
kill_ebrelayer
()
{
function
kill_ebrelayer
()
{
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
...
...
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