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
506a7e8a
Commit
506a7e8a
authored
May 08, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updatat test
parent
cdb965ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
21 deletions
+76
-21
allRelayerTest.sh
plugin/dapp/x2Ethereum/cmd/build/allRelayerTest.sh
+76
-21
No files found.
plugin/dapp/x2Ethereum/cmd/build/allRelayerTest.sh
View file @
506a7e8a
...
...
@@ -42,6 +42,23 @@ ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2
=
"9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
maturityDegree
=
10
function
kill_ebrelayerC
()
{
kill_ebrelayer
"./C/ebrelayer"
}
function
kill_ebrelayerD
()
{
kill_ebrelayer
"./D/ebrelayer"
}
function
start_ebrelayerC
()
{
start_ebrelayer
"./C/ebrelayer"
"./C/ebrelayer.log"
${
CLIC
}
relayer unlock
-p
123456hzj
sleep
60
}
function
start_ebrelayerD
()
{
start_ebrelayer
"./D/ebrelayer"
"./D/ebrelayer.log"
${
CLID
}
relayer unlock
-p
123456hzj
sleep
60
}
function
InitAndDeploy
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
result
=
$(${
CLIA
}
relayer set_pwd
-n
123456hzj
-o
kk
)
...
...
@@ -66,7 +83,6 @@ function EthImportKey() {
CLI
=
"./ebcli_
$name
"
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
)
#cli_ret "${result}" "set_pwd"
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj
)
cli_ret
"
${
result
}
"
"unlock"
...
...
@@ -125,7 +141,6 @@ function StartRelayerAndDeploy() {
# 获取 BridgeRegistry 地址
result
=
$(${
CLIA
}
relayer ethereum bridgeRegistry
)
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
# BridgeRegistry="0x5331F912027057fBE8139D91B225246e8159232f"
kill_ebrelayer
"./A/ebrelayer"
# 修改 relayer.toml 配置文件
...
...
@@ -206,15 +221,23 @@ function TestChain33ToEthAssets() {
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
kill_ebrelayerC
kill_ebrelayerD
# chain33 lock bty
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
bty
-r
${
ethReceiverAddr1
}
-q
${
tokenAddr
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
${
maturityDegree
}
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"195.0000"
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((${
maturityDegree
}
+
2
))
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
start_ebrelayerC
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"5"
...
...
@@ -227,10 +250,15 @@ function TestChain33ToEthAssets() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
# eth 等待 10 个区块
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((
${
maturityDegree
}
+
2
))
result
=
$(${
Chain33Cli
}
account balance
-a
"
${
chain33SenderAddr
}
"
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"5.0000"
balance_ret
"
${
result
}
"
"0"
start_ebrelayerD
result
=
$(${
Chain33Cli
}
account balance
-a
"
${
chain33SenderAddr
}
"
-e
x2ethereum
)
balance_ret
"
${
result
}
"
"5"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
...
...
@@ -247,24 +275,36 @@ function TestETH2Chain33Assets() {
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
# eth lock 10
result
=
$(${
CLIA
}
relayer ethereum lock
-m
10
-k
"
${
ethReceiverAddrKey1
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
kill_ebrelayerC
kill_ebrelayerD
# eth lock 0.1
result
=
$(${
CLIA
}
relayer ethereum lock
-m
0.1
-k
"
${
ethReceiverAddrKey1
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
cli_ret
"
${
result
}
"
"lock"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"
10
"
cli_ret
"
${
result
}
"
"balance"
".balance"
"
0.1
"
# eth 等待 10 个区块
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((
${
maturityDegree
}
+
2
))
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"10"
balance_ret
"
${
result
}
"
"0"
start_ebrelayerC
start_ebrelayerD
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"0.1"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
balance
=
$(
cli_ret
"
${
result
}
"
"balance"
".balance"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
10
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
kill_ebrelayerC
kill_ebrelayerD
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
0.1
-t
eth
-r
${
ethReceiverAddr2
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((${
maturityDegree
}
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
)
...
...
@@ -273,10 +313,13 @@ function TestETH2Chain33Assets() {
eth_block_wait 2
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0.1"
start_ebrelayerC
start_ebrelayerD
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+
10"
|
bc
)
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+
0.1"
|
bc
)
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
...
...
@@ -303,6 +346,9 @@ function TestETH2Chain33Erc20() {
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
kill_ebrelayerC
kill_ebrelayerD
# lock 100
result
=
$(${
CLIA
}
relayer ethereum lock
-m
100
-k
"
${
ethReceiverAddrKey1
}
"
-r
"
${
chain33Validator1
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"lock"
...
...
@@ -314,14 +360,23 @@ function TestETH2Chain33Erc20() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"100"
# eth 等待 10 个区块
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((${
maturityDegree
}
+
2
))
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"0"
start_ebrelayerC
start_ebrelayerD
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
balance_ret
"
${
result
}
"
"100"
kill_ebrelayerC
kill_ebrelayerD
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
${
maturityDegree
}
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
result
=
$(${
Chain33Cli
}
x2ethereum balance
-s
"
${
chain33Validator1
}
"
-t
"
${
tokenSymbol
}
"
-a
"
${
tokenAddr
}
"
| jq
".res"
| jq
".[]"
)
...
...
@@ -329,6 +384,8 @@ function TestETH2Chain33Erc20() {
eth_block_wait 2
start_ebrelayerC
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"100"
...
...
@@ -345,7 +402,7 @@ function MainTest() {
echo
-e
"
${
GRE
}
===========allTest
$FUNCNAME
begin ===========
${
NOC
}
"
if
[[
${
1
}
!=
""
]]
;
then
if
[[
"
${
1
}
"
!=
""
]]
;
then
maturityDegree
=
${
1
}
echo
-e
"
${
GRE
}
maturityDegree is
${
maturityDegree
}
${
NOC
}
"
fi
...
...
@@ -359,5 +416,3 @@ function MainTest() {
TestETH2Chain33Erc20
echo
-e
"
${
GRE
}
===========allTest
$FUNCNAME
end ===========
${
NOC
}
"
}
#MainTest "${1}"
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