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
49765aa0
Commit
49765aa0
authored
May 22, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updata test sh
parent
fbfe6832
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
142 additions
and
109 deletions
+142
-109
build.sh
plugin/dapp/x2Ethereum/cmd/build.sh
+6
-1
RopstenTest.sh
plugin/dapp/x2Ethereum/cmd/build/RopstenTest.sh
+10
-10
allRelayerTest.sh
plugin/dapp/x2Ethereum/cmd/build/allRelayerTest.sh
+10
-10
perf_test.sh
plugin/dapp/x2Ethereum/cmd/build/perf_test.sh
+30
-14
testcase.sh
plugin/dapp/x2Ethereum/cmd/build/testcase.sh
+3
-0
allRelayerTest.sh
plugin/dapp/x2Ethereum/testsh/allRelayerTest.sh
+10
-10
bridgeBankTest.sh
plugin/dapp/x2Ethereum/testsh/bridgeBankTest.sh
+12
-10
ebrelayerTest.sh
plugin/dapp/x2Ethereum/testsh/ebrelayerTest.sh
+15
-13
publicTest.sh
plugin/dapp/x2Ethereum/testsh/publicTest.sh
+36
-31
x2ethereumTest.sh
plugin/dapp/x2Ethereum/testsh/x2ethereumTest.sh
+10
-10
No files found.
plugin/dapp/x2Ethereum/cmd/build.sh
View file @
49765aa0
#!/bin/sh
#!/usr/bin/env bash
# 官方ci集成脚本
# 官方ci集成脚本
strpwd
=
$(
pwd
)
strpwd
=
$(
pwd
)
strcmd
=
${
strpwd
##*dapp/
}
strcmd
=
${
strpwd
##*dapp/
}
...
@@ -11,9 +12,13 @@ FLAG=$2
...
@@ -11,9 +12,13 @@ FLAG=$2
# shellcheck disable=SC2086,1072
# shellcheck disable=SC2086,1072
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebrelayer"
"
${
SRC_EBRELAYER
}
"
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebrelayer"
"
${
SRC_EBRELAYER
}
"
# shellcheck disable=SC2086,1072
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_A"
"
${
SRC_EBCLI
}
"
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_A"
"
${
SRC_EBCLI
}
"
# shellcheck disable=SC2086,1072
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_B"
-ldflags
"-X
${
SRC_EBCLI
}
/buildflags.RPCAddr=http://localhost:9902"
"
${
SRC_EBCLI
}
"
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_B"
-ldflags
"-X
${
SRC_EBCLI
}
/buildflags.RPCAddr=http://localhost:9902"
"
${
SRC_EBCLI
}
"
# shellcheck disable=SC2086,1072
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_C"
-ldflags
"-X
${
SRC_EBCLI
}
/buildflags.RPCAddr=http://localhost:9903"
"
${
SRC_EBCLI
}
"
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_C"
-ldflags
"-X
${
SRC_EBCLI
}
/buildflags.RPCAddr=http://localhost:9903"
"
${
SRC_EBCLI
}
"
# shellcheck disable=SC2086,1072
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_D"
-ldflags
"-X
${
SRC_EBCLI
}
/buildflags.RPCAddr=http://localhost:9904"
"
${
SRC_EBCLI
}
"
go build
-i
${
FLAG
}
-v
-o
"
${
OUT_DIR
}
/ebcli_D"
-ldflags
"-X
${
SRC_EBCLI
}
/buildflags.RPCAddr=http://localhost:9904"
"
${
SRC_EBCLI
}
"
cp
../ebrelayer/relayer.toml
"
${
OUT_DIR
}
/relayer.toml"
cp
../ebrelayer/relayer.toml
"
${
OUT_DIR
}
/relayer.toml"
...
...
plugin/dapp/x2Ethereum/cmd/build/RopstenTest.sh
View file @
49765aa0
...
@@ -14,7 +14,7 @@ CLIC="./ebcli_C"
...
@@ -14,7 +14,7 @@ CLIC="./ebcli_C"
CLID
=
"./ebcli_D"
CLID
=
"./ebcli_D"
chain33SenderAddr
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddr
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey
=
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
#
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
...
@@ -93,7 +93,7 @@ function StartRelayerAndDeploy() {
...
@@ -93,7 +93,7 @@ function StartRelayerAndDeploy() {
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
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
...
@@ -128,7 +128,7 @@ function InitChain33Vilators() {
...
@@ -128,7 +128,7 @@ function InitChain33Vilators() {
# query Validators
# query Validators
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
check_number 100
${
totalPower
}
check_number 100
"
${
totalPower
}
"
# cions 转帐到 x2ethereum 合约地址
# cions 转帐到 x2ethereum 合约地址
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
...
@@ -217,7 +217,7 @@ function TestChain33ToEthAssets() {
...
@@ -217,7 +217,7 @@ function TestChain33ToEthAssets() {
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
"
${
tokenSymbol
}
"
-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
+
3
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
3
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -286,7 +286,7 @@ function TestETH2Chain33Assets() {
...
@@ -286,7 +286,7 @@ function TestETH2Chain33Assets() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
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"
| bc
)
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -331,7 +331,7 @@ function TestETH2Chain33Erc20() {
...
@@ -331,7 +331,7 @@ function TestETH2Chain33Erc20() {
balance_ret
"
${
result
}
"
"100"
balance_ret
"
${
result
}
"
"100"
# chain33 burn 100
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
3
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
3
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -368,7 +368,7 @@ function TestChain33ToEthAssetsKill() {
...
@@ -368,7 +368,7 @@ function TestChain33ToEthAssetsKill() {
kill_ebrelayerD
kill_ebrelayerD
# chain33 lock bty
# chain33 lock bty
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
1.41
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddrBty
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
1.41
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddrBty
}
"
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
3
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
3
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -423,7 +423,7 @@ function TestETH2Chain33AssetsKill() {
...
@@ -423,7 +423,7 @@ function TestETH2Chain33AssetsKill() {
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"
$(
echo
"
${
balance
}
+0.133"
| bc
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"
$(
echo
"
${
balance
}
+0.133"
| bc
)
"
# eth 等待 10 个区块
# eth 等待 10 个区块
eth_block_wait
$((
maturityDegree
+
3
))
https://ropsten-rpc.linkpool.io/
eth_block_wait
$((
maturityDegree
+
3
))
https://ropsten-rpc.linkpool.io/
...
@@ -459,7 +459,7 @@ function TestETH2Chain33AssetsKill() {
...
@@ -459,7 +459,7 @@ function TestETH2Chain33AssetsKill() {
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.133"
| bc
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"
$(
echo
"
${
balance
}
+0.133"
| bc
)
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -515,7 +515,7 @@ function TestETH2Chain33Erc20Kill() {
...
@@ -515,7 +515,7 @@ function TestETH2Chain33Erc20Kill() {
kill_ebrelayerD
kill_ebrelayerD
# chain33 burn 100
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
3
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
3
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
...
plugin/dapp/x2Ethereum/cmd/build/allRelayerTest.sh
View file @
49765aa0
...
@@ -18,7 +18,7 @@ Chain33Cli=""
...
@@ -18,7 +18,7 @@ Chain33Cli=""
Chain33Cli
=
"docker exec
${
NODE3
}
/root/chain33-cli"
Chain33Cli
=
"docker exec
${
NODE3
}
/root/chain33-cli"
chain33SenderAddr
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddr
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey
=
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
#
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
...
@@ -83,7 +83,7 @@ function EthImportKey() {
...
@@ -83,7 +83,7 @@ function EthImportKey() {
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
"./
$name
/ebrelayer"
"./
$name
/ebrelayer.log"
# 导入测试地址私钥
# 导入测试地址私钥
CLI
=
"./ebcli_
$name
"
CLI
=
"./ebcli_
$name
"
...
@@ -150,7 +150,7 @@ function StartRelayerAndDeploy() {
...
@@ -150,7 +150,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer
"./A/ebrelayer"
kill_ebrelayer
"./A/ebrelayer"
# 修改 relayer.toml 配置文件
# 修改 relayer.toml 配置文件
updata_relayer_toml
${
BridgeRegistry
}
${
maturityDegree
}
"./A/relayer.toml"
updata_relayer_toml
"
${
BridgeRegistry
}
"
${
maturityDegree
}
"./A/relayer.toml"
updata_all_relayer_toml2
updata_all_relayer_toml2
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
...
@@ -185,7 +185,7 @@ function InitChain33Vilators() {
...
@@ -185,7 +185,7 @@ function InitChain33Vilators() {
# query Validators
# query Validators
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
check_number 100
${
totalPower
}
check_number 100
"
${
totalPower
}
"
# cions 转帐到 x2ethereum 合约地址
# cions 转帐到 x2ethereum 合约地址
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
...
@@ -228,7 +228,7 @@ function TestChain33ToEthAssets() {
...
@@ -228,7 +228,7 @@ function TestChain33ToEthAssets() {
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
coins.bty
-r
${
ethReceiverAddr1
}
-q
${
tokenAddrBty
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
coins.bty
-r
${
ethReceiverAddr1
}
-q
"
${
tokenAddrBty
}
"
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -297,7 +297,7 @@ function TestETH2Chain33Assets() {
...
@@ -297,7 +297,7 @@ function TestETH2Chain33Assets() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
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"
| bc
)
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -341,7 +341,7 @@ function TestETH2Chain33Erc20() {
...
@@ -341,7 +341,7 @@ function TestETH2Chain33Erc20() {
balance_ret
"
${
result
}
"
"100"
balance_ret
"
${
result
}
"
"100"
# chain33 burn 100
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -375,7 +375,7 @@ function TestChain33ToEthAssetsKill() {
...
@@ -375,7 +375,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
5
-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
}
"
...
@@ -466,7 +466,7 @@ function TestETH2Chain33AssetsKill() {
...
@@ -466,7 +466,7 @@ function TestETH2Chain33AssetsKill() {
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"
| bc
)
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -522,7 +522,7 @@ function TestETH2Chain33Erc20Kill() {
...
@@ -522,7 +522,7 @@ function TestETH2Chain33Erc20Kill() {
kill_ebrelayerD
kill_ebrelayerD
# chain33 burn 100
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
...
plugin/dapp/x2Ethereum/cmd/build/perf_test.sh
View file @
49765aa0
#!/usr/bin/env bash
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
# shellcheck disable=SC2178
set
-x
set
-x
source
"./publicTest.sh"
source
"./publicTest.sh"
...
@@ -9,7 +12,7 @@ Chain33_CLI=""
...
@@ -9,7 +12,7 @@ Chain33_CLI=""
Ethsender
=
"0xa4ea64a583f6e51c3799335b28a8f0529570a635"
Ethsender
=
"0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethSender0PrivateKey
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
#
ethSender0PrivateKey="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
privateKeys[0]
=
"8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
privateKeys[0]
=
"8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
privateKeys[1]
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
privateKeys[1]
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
...
@@ -28,6 +31,8 @@ ethAddress[5]="0xA4Ea64a583F6e51C3799335b28a8F0529570A635"
...
@@ -28,6 +31,8 @@ ethAddress[5]="0xA4Ea64a583F6e51C3799335b28a8F0529570A635"
ethAddress[6]
=
"0x0C05bA5c230fDaA503b53702aF1962e08D0C60BF"
ethAddress[6]
=
"0x0C05bA5c230fDaA503b53702aF1962e08D0C60BF"
maturityDegree
=
10
maturityDegree
=
10
tokenAddr
=
""
tokenAddrBty
=
""
loop_send_lock_eth
()
{
loop_send_lock_eth
()
{
#while 遍历数组
#while 遍历数组
...
@@ -39,7 +44,8 @@ loop_send_lock_eth() {
...
@@ -39,7 +44,8 @@ loop_send_lock_eth() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
preEthBalance[
$i
]=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
preEthBalance[
$i
]=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
ethTxHash
=
$(${
CLIA
}
relayer ethereum lock-async
-m
1
-k
"
${
privateKeys
[i]
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
ethTxHash
=
$(${
CLIA
}
relayer ethereum lock-async
-m
1
-k
"
${
privateKeys
[i]
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
${
i
}
"lock-async tx hash:"
${
ethTxHash
}
echo
${
i
}
"lock-async tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
@@ -49,11 +55,12 @@ loop_send_lock_eth() {
...
@@ -49,11 +55,12 @@ loop_send_lock_eth() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
nowEthBalance
=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
nowEthBalance
=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
res
=
$((
preEthBalance[i]
-
nowEthBalance
))
res
=
$((
preEthBalance[i]
-
nowEthBalance
))
echo
${
i
}
"preBalance"
${
preEthBalance
[i]
}
"nowBalance"
${
nowEthBalance
}
"diff"
${
res
}
echo
${
i
}
"preBalance"
"
${
preEthBalance
[i]
}
"
"nowBalance"
"
${
nowEthBalance
}
"
"diff"
${
res
}
if
[[
$res
-le
100000000000000000
]]
;
then
if
[[
$res
-le
100000000000000000
]]
;
then
echo
-e
"
${
RED
}
error number, expect greater than 100000000000000000, get
${
res
}${
NOC
}
"
echo
-e
"
${
RED
}
error number, expect greater than 100000000000000000, get
${
res
}${
NOC
}
"
exit
1
exit
1
fi
fi
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
@@ -72,7 +79,8 @@ loop_send_burn_eth() {
...
@@ -72,7 +79,8 @@ loop_send_burn_eth() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
preEthBalance[
$i
]=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
preEthBalance[
$i
]=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
ethTxHash
=
$(${
Chain33_CLI
}
send x2ethereum burn
-a
1
-r
${
ethAddress
[i]
}
-t
eth
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
ethTxHash
=
$(${
Chain33_CLI
}
send x2ethereum burn
-a
1
-r
${
ethAddress
[i]
}
-t
eth
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
${
i
}
"burn chain33 tx hash:"
${
ethTxHash
}
echo
${
i
}
"burn chain33 tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
@@ -82,11 +90,12 @@ loop_send_burn_eth() {
...
@@ -82,11 +90,12 @@ loop_send_burn_eth() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
nowEthBalance
=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
nowEthBalance
=
$(
curl
-ksd
'{"jsonrpc":"2.0","method":"eth_getBalance","params":["'
${
ethAddress
[i]
}
'", "latest"],"id":1}'
http://localhost:7545 | jq
-r
".result"
)
res
=
$((
nowEthBalance
-
preEthBalance[i]
))
res
=
$((
nowEthBalance
-
preEthBalance[i]
))
echo
${
i
}
"preBalance"
${
preEthBalance
[i]
}
"nowBalance"
${
nowEthBalance
}
"diff"
${
res
}
echo
${
i
}
"preBalance"
"
${
preEthBalance
[i]
}
"
"nowBalance"
"
${
nowEthBalance
}
"
"diff"
${
res
}
if
[[
$res
-gt
1000000000000000000
]]
;
then
if
[[
$res
-gt
1000000000000000000
]]
;
then
echo
-e
"
${
RED
}
error number, expect greater than 1000000000000000000, get
${
res
}${
NOC
}
"
echo
-e
"
${
RED
}
error number, expect greater than 1000000000000000000, get
${
res
}${
NOC
}
"
exit
1
exit
1
fi
fi
# shellcheck disable=SC2219
let
i++
let
i++
done
done
nowChain33Balance
=
$(${
Chain33_CLI
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
| jq
".balance"
|
sed
's/\"//g'
)
nowChain33Balance
=
$(${
Chain33_CLI
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
| jq
".balance"
|
sed
's/\"//g'
)
...
@@ -106,7 +115,8 @@ loop_send_lock_bty() {
...
@@ -106,7 +115,8 @@ loop_send_lock_bty() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
preEthBalance[
$i
]=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
preEthBalance[
$i
]=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
ethTxHash
=
$(${
Chain33_CLI
}
send x2ethereum lock
-q
"
${
tokenAddrBty
}
"
-a
1
-r
${
ethAddress
[i]
}
-t
coins.bty
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
ethTxHash
=
$(${
Chain33_CLI
}
send x2ethereum lock
-q
"
${
tokenAddrBty
}
"
-a
1
-r
${
ethAddress
[i]
}
-t
coins.bty
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
${
i
}
"lock chain33 tx hash:"
${
ethTxHash
}
echo
${
i
}
"lock chain33 tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
@@ -116,8 +126,9 @@ loop_send_lock_bty() {
...
@@ -116,8 +126,9 @@ loop_send_lock_bty() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
res
=
$((
nowEthBalance
-
preEthBalance[i]
))
res
=
$((
nowEthBalance
-
preEthBalance[i]
))
echo
${
i
}
"preBalance"
${
preEthBalance
[i]
}
"nowBalance"
${
nowEthBalance
}
"diff"
${
res
}
echo
${
i
}
"preBalance"
"
${
preEthBalance
[i]
}
"
"nowBalance"
"
${
nowEthBalance
}
"
"diff"
${
res
}
check_number
"
${
res
}
"
1
check_number
"
${
res
}
"
1
# shellcheck disable=SC2219
let
i++
let
i++
done
done
nowChain33Balance
=
$(${
Chain33_CLI
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum | jq
-r
".balance"
|
sed
's/\"//g'
)
nowChain33Balance
=
$(${
Chain33_CLI
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum | jq
-r
".balance"
|
sed
's/\"//g'
)
...
@@ -139,7 +150,8 @@ loop_send_burn_bty() {
...
@@ -139,7 +150,8 @@ loop_send_burn_bty() {
preEthBalance[
$i
]=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
preEthBalance[
$i
]=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
approveTxHash
=
$(${
CLIA
}
relayer ethereum approve
-m
1
-k
"
${
privateKeys
[i]
}
"
-t
"
${
tokenAddrBty
}
"
)
approveTxHash
=
$(${
CLIA
}
relayer ethereum approve
-m
1
-k
"
${
privateKeys
[i]
}
"
-t
"
${
tokenAddrBty
}
"
)
ethTxHash
=
$(${
CLIA
}
relayer ethereum burn-async
-m
1
-k
"
${
privateKeys
[i]
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
"
${
tokenAddrBty
}
"
)
ethTxHash
=
$(${
CLIA
}
relayer ethereum burn-async
-m
1
-k
"
${
privateKeys
[i]
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
"
${
tokenAddrBty
}
"
)
echo
${
i
}
"burn-async tx hash:"
${
ethTxHash
}
echo
${
i
}
"burn-async tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
@@ -149,8 +161,9 @@ loop_send_burn_bty() {
...
@@ -149,8 +161,9 @@ loop_send_burn_bty() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddrBty
}
"
| jq
-r
".balance"
)
res
=
$((
preEthBalance[i]
-
nowEthBalance
))
res
=
$((
preEthBalance[i]
-
nowEthBalance
))
echo
${
i
}
"preBalance"
${
preEthBalance
[i]
}
"nowBalance"
${
nowEthBalance
}
"diff"
${
res
}
echo
${
i
}
"preBalance"
"
${
preEthBalance
[i]
}
"
"nowBalance"
"
${
nowEthBalance
}
"
"diff"
${
res
}
check_number
"
${
res
}
"
1
check_number
"
${
res
}
"
1
# shellcheck disable=SC2219
let
i++
let
i++
done
done
nowChain33Balance
=
$(${
Chain33_CLI
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum | jq
-r
".balance"
|
sed
's/\"//g'
)
nowChain33Balance
=
$(${
Chain33_CLI
}
account balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-e
x2ethereum | jq
-r
".balance"
|
sed
's/\"//g'
)
...
@@ -170,11 +183,12 @@ loop_send_lock_erc20() {
...
@@ -170,11 +183,12 @@ loop_send_lock_erc20() {
preEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
Ethsender
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
preEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
Ethsender
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
approveTxHash
=
$(${
CLIA
}
relayer ethereum approve
-m
10
-k
"
${
privateKeys
[5]
}
"
-t
"
${
tokenAddr
}
"
)
approveTxHash
=
$(${
CLIA
}
relayer ethereum approve
-m
10
-k
"
${
privateKeys
[5]
}
"
-t
"
${
tokenAddr
}
"
)
echo
${
i
}
"lock-async erc20 approve tx hash:"
${
approveTxHash
}
echo
${
i
}
"lock-async erc20 approve tx hash:"
"
${
approveTxHash
}
"
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
ethTxHash
=
$(${
CLIA
}
relayer ethereum lock-async
-m
1
-k
"
${
privateKeys
[5]
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
"
${
tokenAddr
}
"
)
ethTxHash
=
$(${
CLIA
}
relayer ethereum lock-async
-m
1
-k
"
${
privateKeys
[5]
}
"
-r
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
"
${
tokenAddr
}
"
)
echo
${
i
}
"lock-async erc20 tx hash:"
${
ethTxHash
}
echo
${
i
}
"lock-async erc20 tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
@@ -182,7 +196,7 @@ loop_send_lock_erc20() {
...
@@ -182,7 +196,7 @@ loop_send_lock_erc20() {
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
Ethsender
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
Ethsender
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
res
=
$((
preEthBalance
-
nowEthBalance
))
res
=
$((
preEthBalance
-
nowEthBalance
))
echo
${
i
}
"preBalance"
${
preEthBalance
}
"nowBalance"
${
nowEthBalance
}
"diff"
${
res
}
echo
${
i
}
"preBalance"
"
${
preEthBalance
}
"
"nowBalance"
"
${
nowEthBalance
}
"
"diff"
${
res
}
check_number
"
${
diff
}
"
7
check_number
"
${
diff
}
"
7
nowChain33Balance
=
$(${
Chain33_CLI
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
testc | jq
".res"
| jq
".[]"
| jq
".balance"
|
sed
's/\"//g'
)
nowChain33Balance
=
$(${
Chain33_CLI
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
testc | jq
".res"
| jq
".[]"
| jq
".balance"
|
sed
's/\"//g'
)
...
@@ -202,7 +216,8 @@ loop_send_burn_erc20() {
...
@@ -202,7 +216,8 @@ loop_send_burn_erc20() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
preEthBalance[i]
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
preEthBalance[i]
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
ethTxHash
=
$(${
Chain33_CLI
}
send x2ethereum burn
-a
1
-r
${
ethAddress
[i]
}
-t
testc
-q
"
${
tokenAddr
}
"
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
ethTxHash
=
$(${
Chain33_CLI
}
send x2ethereum burn
-a
1
-r
${
ethAddress
[i]
}
-t
testc
-q
"
${
tokenAddr
}
"
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
${
i
}
"burn chain33 tx hash:"
${
ethTxHash
}
echo
${
i
}
"burn chain33 tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
@@ -212,8 +227,9 @@ loop_send_burn_erc20() {
...
@@ -212,8 +227,9 @@ loop_send_burn_erc20() {
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
nowEthBalance
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethAddress
[i]
}
"
-t
"
${
tokenAddr
}
"
| jq
-r
".balance"
)
res
=
$((
nowEthBalance
-
preEthBalance[i]
))
res
=
$((
nowEthBalance
-
preEthBalance[i]
))
echo
${
i
}
"preBalance"
${
preEthBalance
[i]
}
"nowBalance"
${
nowEthBalance
}
"diff"
${
res
}
echo
${
i
}
"preBalance"
"
${
preEthBalance
[i]
}
"
"nowBalance"
"
${
nowEthBalance
}
"
"diff"
${
res
}
check_number
"
${
res
}
"
1
check_number
"
${
res
}
"
1
# shellcheck disable=SC2219
let
i++
let
i++
done
done
...
...
plugin/dapp/x2Ethereum/cmd/build/testcase.sh
View file @
49765aa0
#!/usr/bin/env bash
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
source
"./allRelayerTest.sh"
source
"./allRelayerTest.sh"
source
"./perf_test.sh"
source
"./perf_test.sh"
...
...
plugin/dapp/x2Ethereum/testsh/allRelayerTest.sh
View file @
49765aa0
...
@@ -17,7 +17,7 @@ docker_chain33_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPA
...
@@ -17,7 +17,7 @@ docker_chain33_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPA
Chain33Cli
=
"
$GOPATH
/src/github.com/33cn/plugin/build/chain33-cli --rpc_laddr http://
${
docker_chain33_ip
}
:8801"
Chain33Cli
=
"
$GOPATH
/src/github.com/33cn/plugin/build/chain33-cli --rpc_laddr http://
${
docker_chain33_ip
}
:8801"
chain33SenderAddr
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddr
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey
=
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
#
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
...
@@ -59,7 +59,7 @@ function EthImportKey() {
...
@@ -59,7 +59,7 @@ function EthImportKey() {
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
"../build/
"
$name
"/ebrelayer"
"../build/"
$name
"
/ebrelayer.log"
start_ebrelayer
"../build/
$name
/ebrelayer"
"../build/
$name
/ebrelayer.log"
# 导入测试地址私钥
# 导入测试地址私钥
CLI
=
"../build/ebcli_
$name
"
CLI
=
"../build/ebcli_
$name
"
...
@@ -129,7 +129,7 @@ function StartRelayerAndDeploy() {
...
@@ -129,7 +129,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer
"../build/A/ebrelayer"
kill_ebrelayer
"../build/A/ebrelayer"
# 修改 relayer.toml 配置文件
# 修改 relayer.toml 配置文件
updata_relayer_toml
${
BridgeRegistry
}
${
maturityDegree
}
"../build/A/relayer.toml"
updata_relayer_toml
"
${
BridgeRegistry
}
"
${
maturityDegree
}
"../build/A/relayer.toml"
updata_all_relayer_toml
updata_all_relayer_toml
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
...
@@ -164,7 +164,7 @@ function InitChain33Vilators() {
...
@@ -164,7 +164,7 @@ function InitChain33Vilators() {
# query Validators
# query Validators
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
check_number 100
${
totalPower
}
check_number 100
"
${
totalPower
}
"
# cions 转帐到 x2ethereum 合约地址
# cions 转帐到 x2ethereum 合约地址
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
...
@@ -207,7 +207,7 @@ function TestChain33ToEthAssets() {
...
@@ -207,7 +207,7 @@ function TestChain33ToEthAssets() {
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
coins.bty
-r
${
ethReceiverAddr1
}
-q
${
tokenAddr
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
coins.bty
-r
${
ethReceiverAddr1
}
-q
"
${
tokenAddr
}
"
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -276,7 +276,7 @@ function TestETH2Chain33Assets() {
...
@@ -276,7 +276,7 @@ function TestETH2Chain33Assets() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
result
=
$(${
CLIA
}
relayer ethereum balance
-o
"
${
ethReceiverAddr2
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
$(
echo
"
${
balance
}
+10"
| bc
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"
$(
echo
"
${
balance
}
+10"
| bc
)
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -320,7 +320,7 @@ function TestETH2Chain33Erc20() {
...
@@ -320,7 +320,7 @@ function TestETH2Chain33Erc20() {
balance_ret
"
${
result
}
"
"100"
balance_ret
"
${
result
}
"
"100"
# chain33 burn 100
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -354,7 +354,7 @@ function TestChain33ToEthAssetsKill() {
...
@@ -354,7 +354,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
5
-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
}
"
...
@@ -445,7 +445,7 @@ function TestETH2Chain33AssetsKill() {
...
@@ -445,7 +445,7 @@ function TestETH2Chain33AssetsKill() {
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"
| bc
)
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
...
@@ -501,7 +501,7 @@ function TestETH2Chain33Erc20Kill() {
...
@@ -501,7 +501,7 @@ function TestETH2Chain33Erc20Kill() {
kill_ebrelayerD
kill_ebrelayerD
# chain33 burn 100
# chain33 burn 100
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33Validator1
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
100
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33Validator1
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
...
plugin/dapp/x2Ethereum/testsh/bridgeBankTest.sh
View file @
49765aa0
#!/usr/bin/env bash
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set
-x
set
-x
# 只启动 eth 这一端的测试
# 只启动 eth 这一端的测试
# 只启动一个 relayer 第一个地址权重设置超过2/3
# 只启动一个 relayer 第一个地址权重设置超过2/3
...
@@ -31,7 +33,7 @@ prophecyTx5="0x662260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
...
@@ -31,7 +33,7 @@ prophecyTx5="0x662260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
prophecyTx6
=
"0x772260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
prophecyTx6
=
"0x772260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
InitAndDeploy
()
{
InitAndDeploy
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
)
result
=
$(${
CLI
}
relayer set_pwd
-n
123456hzj
-o
kk
)
cli_ret
"
${
result
}
"
"set_pwd"
cli_ret
"
${
result
}
"
"set_pwd"
...
@@ -48,14 +50,14 @@ InitAndDeploy() {
...
@@ -48,14 +50,14 @@ InitAndDeploy() {
result
=
$(${
CLI
}
relayer ethereum import_ethprivatekey
-k
"
${
ethValidatorAddrKey
}
"
)
result
=
$(${
CLI
}
relayer ethereum import_ethprivatekey
-k
"
${
ethValidatorAddrKey
}
"
)
cli_ret
"
${
result
}
"
"import_ethprivatekey"
cli_ret
"
${
result
}
"
"import_ethprivatekey"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
# eth to chain33
# eth to chain33
# 在以太坊上锁定资产,然后在 chain33 上铸币,针对 erc20 资产
# 在以太坊上锁定资产,然后在 chain33 上铸币,针对 erc20 资产
# 以太坊 brun 资产,balance 对比是否正确
# 以太坊 brun 资产,balance 对比是否正确
TestETH2Chain33Erc20
()
{
TestETH2Chain33Erc20
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
${
CLI
}
relayer unlock
-p
123456hzj
${
CLI
}
relayer unlock
-p
123456hzj
# token4erc20 在 chain33 上先有 token,同时 mint
# token4erc20 在 chain33 上先有 token,同时 mint
...
@@ -116,11 +118,11 @@ TestETH2Chain33Erc20() {
...
@@ -116,11 +118,11 @@ TestETH2Chain33Erc20() {
result
=
$(${
CLI
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
-t
"
${
tokenSymbol
}
"
)
result
=
$(${
CLI
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
-t
"
${
tokenSymbol
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
TestETH2Chain33Erc20_err
()
{
TestETH2Chain33Erc20_err
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
${
CLI
}
relayer unlock
-p
123456hzj
${
CLI
}
relayer unlock
-p
123456hzj
# token4erc20 在 chain33 上先有 token,同时 mint
# token4erc20 在 chain33 上先有 token,同时 mint
...
@@ -187,13 +189,13 @@ TestETH2Chain33Erc20_err() {
...
@@ -187,13 +189,13 @@ TestETH2Chain33Erc20_err() {
result
=
$(${
CLI
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
-t
"
${
tokenSymbol
}
"
)
result
=
$(${
CLI
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
-t
"
${
tokenSymbol
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"300"
cli_ret
"
${
result
}
"
"balance"
".balance"
"300"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
# eth to chain33
# eth to chain33
# 在以太坊上锁定资产,然后在 chain33 上铸币,针对 eth 资产
# 在以太坊上锁定资产,然后在 chain33 上铸币,针对 eth 资产
TestETH2Chain33Assets
()
{
TestETH2Chain33Assets
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
${
CLI
}
relayer unlock
-p
123456hzj
${
CLI
}
relayer unlock
-p
123456hzj
result
=
$(${
CLI
}
relayer ethereum bridgeBankAddr
)
result
=
$(${
CLI
}
relayer ethereum bridgeBankAddr
)
...
@@ -273,14 +275,14 @@ TestETH2Chain33Assets() {
...
@@ -273,14 +275,14 @@ TestETH2Chain33Assets() {
result
=
$(${
CLI
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
result
=
$(${
CLI
}
relayer ethereum balance
-o
"
${
bridgeBankAddr
}
"
)
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
cli_ret
"
${
result
}
"
"balance"
".balance"
"0"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
# chain33 to eth
# chain33 to eth
# 在 chain33 上锁定资产,然后在以太坊上铸币
# 在 chain33 上锁定资产,然后在以太坊上铸币
# chain33 brun 资产,balance 对比是否正确
# chain33 brun 资产,balance 对比是否正确
TestChain33ToEthAssets
()
{
TestChain33ToEthAssets
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj
)
result
=
$(${
CLI
}
relayer unlock
-p
123456hzj
)
# token4chain33 在 以太坊 上先有 bty
# token4chain33 在 以太坊 上先有 bty
result
=
$(${
CLI
}
relayer ethereum token4chain33
-s
coins.bty
)
result
=
$(${
CLI
}
relayer ethereum token4chain33
-s
coins.bty
)
...
@@ -334,7 +336,7 @@ TestChain33ToEthAssets() {
...
@@ -334,7 +336,7 @@ TestChain33ToEthAssets() {
result
=
$(${
CLI
}
relayer ethereum burn
-m
10
-k
"
${
ethReceiverAddrKey1
}
"
-r
"
${
chain33SenderAddr
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLI
}
relayer ethereum burn
-m
10
-k
"
${
ethReceiverAddrKey1
}
"
-r
"
${
chain33SenderAddr
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret_err
"
${
result
}
"
cli_ret_err
"
${
result
}
"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
main
()
{
main
()
{
...
...
plugin/dapp/x2Ethereum/testsh/ebrelayerTest.sh
View file @
49765aa0
#!/usr/bin/env bash
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set
-x
set
-x
# 只启动 eth 这一端的测试
# 只启动 eth 这一端的测试
...
@@ -20,7 +22,7 @@ prophecyTx0="0x772260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
...
@@ -20,7 +22,7 @@ prophecyTx0="0x772260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
# 初始化部署合约
# 初始化部署合约
InitAndDeploy
()
{
InitAndDeploy
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
# 创建文件夹及拷贝
# 创建文件夹及拷贝
rm
-rf
'../build/A'
'../build/B'
'../build/C'
'../build/D'
rm
-rf
'../build/A'
'../build/B'
'../build/C'
'../build/D'
mkdir
'../build/A'
'../build/B'
'../build/C'
'../build/D'
mkdir
'../build/A'
'../build/B'
'../build/C'
'../build/D'
...
@@ -36,47 +38,47 @@ InitAndDeploy() {
...
@@ -36,47 +38,47 @@ InitAndDeploy() {
result
=
$(${
CLIA
}
relayer ethereum deploy
)
result
=
$(${
CLIA
}
relayer ethereum deploy
)
cli_ret
"
${
result
}
"
"deploy"
cli_ret
"
${
result
}
"
"deploy"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
# 初始化 B C D 文件夹下的文容
# 初始化 B C D 文件夹下的文容
function
InitConfigFile
()
{
function
InitConfigFile
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
# 获取 BridgeRegistry 地址
# 获取 BridgeRegistry 地址
result
=
$(${
CLIA
}
relayer ethereum bridgeRegistry
)
result
=
$(${
CLIA
}
relayer ethereum bridgeRegistry
)
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
BridgeRegistry
=
$(
cli_ret
"
${
result
}
"
"bridgeRegistry"
".addr"
)
port
=
9901
port
=
9901
for
name
in
B C D
;
do
for
name
in
B C D
;
do
file
=
"../build/
"
$name
"
/relayer.toml"
file
=
"../build/
$name
/relayer.toml"
cp
'../build/relayer.toml'
"
${
file
}
"
cp
'../build/relayer.toml'
"
${
file
}
"
cp
'../build/ebrelayer'
"../build/
"
$name
"
/ebrelayer"
cp
'../build/ebrelayer'
"../build/
$name
/ebrelayer"
# 删除配置文件中不需要的字段
# 删除配置文件中不需要的字段
for
deleteName
in
"BridgeRegistry"
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"
\[
deploy
\]
"
;
do
for
deleteName
in
"BridgeRegistry"
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"
deploy
"
;
do
delete_line
"
${
file
}
"
"
${
deleteName
}
"
delete_line
"
${
file
}
"
"
${
deleteName
}
"
done
done
# 在第 5 行后面 新增合约地址
# 在第 5 行后面 新增合约地址
sed
-i
'5 a BridgeRegistry="'
${
BridgeRegistry
}
'"'
"
${
file
}
"
sed
-i
'5 a BridgeRegistry="'
"
${
BridgeRegistry
}
"
'"'
"
${
file
}
"
# 替换端口
# 替换端口
port
=
$((
port
+
1
))
port
=
$((
port
+
1
))
sed
-i
's/localhost:9901/localhost:'
${
port
}
'/g'
"
${
file
}
"
sed
-i
's/localhost:9901/localhost:'
${
port
}
'/g'
"
${
file
}
"
done
done
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
# 启动 B C D 的 ebrelayer 服务,导入私钥
# 启动 B C D 的 ebrelayer 服务,导入私钥
function
ImportCBDKey
()
{
function
ImportCBDKey
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
local
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
local
ethValidatorAddrKeyA
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
local
ethValidatorAddrKeyB
=
"a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
local
ethValidatorAddrKeyB
=
"a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
local
ethValidatorAddrKeyC
=
"bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
local
ethValidatorAddrKeyC
=
"bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
local
ethValidatorAddrKeyD
=
"c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
local
ethValidatorAddrKeyD
=
"c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
for
name
in
B C D
;
do
for
name
in
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
"
...
@@ -105,12 +107,12 @@ function ImportCBDKey() {
...
@@ -105,12 +107,12 @@ function ImportCBDKey() {
result
=
$(${
CLID
}
relayer ethereum import_ethprivatekey
-k
"
${
ethValidatorAddrKeyD
}
"
)
result
=
$(${
CLID
}
relayer ethereum import_ethprivatekey
-k
"
${
ethValidatorAddrKeyD
}
"
)
cli_ret
"
${
result
}
"
"import_ethprivatekeyD"
cli_ret
"
${
result
}
"
"import_ethprivatekeyD"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
# chain33 到 eth,chian33 lock 100,必须 A B C D 中有三个都lock,才能成功
# chain33 到 eth,chian33 lock 100,必须 A B C D 中有三个都lock,才能成功
TestChain33ToEth
()
{
TestChain33ToEth
()
{
echo
"===========
$FUNCNAME
begin ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
# token4chain33 在 以太坊 上先有 bty
# token4chain33 在 以太坊 上先有 bty
result
=
$(${
CLIA
}
relayer ethereum token4chain33
-s
coins.bty
)
result
=
$(${
CLIA
}
relayer ethereum token4chain33
-s
coins.bty
)
tokenAddr
=
$(
cli_ret
"
${
result
}
"
"token4chain33"
".addr"
)
tokenAddr
=
$(
cli_ret
"
${
result
}
"
"token4chain33"
".addr"
)
...
@@ -147,7 +149,7 @@ TestChain33ToEth() {
...
@@ -147,7 +149,7 @@ TestChain33ToEth() {
result
=
$(${
CLIA
}
relayer ethereum burn
-m
90
-k
"
${
ethReceiverAddrKey1
}
"
-r
"
${
chain33SenderAddr
}
"
-t
"
${
tokenAddr
}
"
)
result
=
$(${
CLIA
}
relayer ethereum burn
-m
90
-k
"
${
ethReceiverAddrKey1
}
"
-r
"
${
chain33SenderAddr
}
"
-t
"
${
tokenAddr
}
"
)
cli_ret
"
${
result
}
"
"burn"
cli_ret
"
${
result
}
"
"burn"
echo
"===========
$FUNCNAME
end ===========
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
}
main
()
{
main
()
{
...
...
plugin/dapp/x2Ethereum/testsh/publicTest.sh
View file @
49765aa0
#!/usr/bin/env bash
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck disable=SC2128
# shellcheck source=/dev/null
# shellcheck source=/dev/null
# shellcheck disable=SC2155
set
-x
set
-x
set
-e
set
-e
...
@@ -39,7 +40,7 @@ function cli_ret() {
...
@@ -39,7 +40,7 @@ function cli_ret() {
msg
=
$(
echo
"
${
1
}
"
| jq
-r
"
${
jqMsg
}
"
)
msg
=
$(
echo
"
${
1
}
"
| jq
-r
"
${
jqMsg
}
"
)
if
[[
$#
-eq
4
]]
;
then
if
[[
$#
-eq
4
]]
;
then
if
[
$(
echo
"
$msg
<
$4
"
| bc
)
-eq
1
]
||
[
$(
echo
"
$msg
>
$4
"
| bc
)
-eq
1
]
;
then
if
[
"
$(
echo
"
$msg
<
$4
"
| bc
)
"
-eq
1
]
||
[
"
$(
echo
"
$msg
>
$4
"
| bc
)
"
-eq
1
]
;
then
echo
-e
"
${
RED
}
The balance is not correct
${
NOC
}
"
echo
-e
"
${
RED
}
The balance is not correct
${
NOC
}
"
exit
1
exit
1
fi
fi
...
@@ -58,7 +59,7 @@ function balance_ret() {
...
@@ -58,7 +59,7 @@ function balance_ret() {
fi
fi
local
balance
=
$(
echo
"
${
1
}
"
| jq
-r
".balance"
)
local
balance
=
$(
echo
"
${
1
}
"
| jq
-r
".balance"
)
if
[
$(
echo
"
$balance
<
$2
"
| bc
)
-eq
1
]
||
[
$(
echo
"
$balance
>
$2
"
| bc
)
-eq
1
]
;
then
if
[
"
$(
echo
"
$balance
<
$2
"
| bc
)
"
-eq
1
]
||
[
"
$(
echo
"
$balance
>
$2
"
| bc
)
"
-eq
1
]
;
then
echo
-e
"
${
RED
}
The balance is not correct
${
NOC
}
"
echo
-e
"
${
RED
}
The balance is not correct
${
NOC
}
"
exit
1
exit
1
fi
fi
...
@@ -115,6 +116,7 @@ function start_ebrelayer() {
...
@@ -115,6 +116,7 @@ function start_ebrelayer() {
nohup
"
${
1
}
"
>
"
${
2
}
"
2>&1 &
nohup
"
${
1
}
"
>
"
${
2
}
"
2>&1 &
sleep
2
sleep
2
# shellcheck disable=SC2009
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
local
count
=
0
local
count
=
0
while
[
"
${
pid
}
"
==
""
]
;
do
while
[
"
${
pid
}
"
==
""
]
;
do
...
@@ -127,6 +129,7 @@ function start_ebrelayer() {
...
@@ -127,6 +129,7 @@ function start_ebrelayer() {
exit
1
exit
1
fi
fi
# shellcheck disable=SC2009
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
done
done
}
}
...
@@ -195,6 +198,7 @@ function start_ebrelayer_and_setpwd_unlock() {
...
@@ -195,6 +198,7 @@ function start_ebrelayer_and_setpwd_unlock() {
# 杀死进程ebrelayer 进程 $1进程名称
# 杀死进程ebrelayer 进程 $1进程名称
function
kill_ebrelayer
()
{
function
kill_ebrelayer
()
{
# shellcheck disable=SC2009
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
if
[
"
${
pid
}
"
==
""
]
;
then
if
[
"
${
pid
}
"
==
""
]
;
then
echo
"not find
${
1
}
pid"
echo
"not find
${
1
}
pid"
...
@@ -202,6 +206,7 @@ function kill_ebrelayer() {
...
@@ -202,6 +206,7 @@ function kill_ebrelayer() {
fi
fi
kill
"
${
pid
}
"
kill
"
${
pid
}
"
# shellcheck disable=SC2009
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"
${
1
}
"
|
grep
-v
'grep'
|
awk
'{print $2}'
)
if
[
"
${
pid
}
"
!=
""
]
;
then
if
[
"
${
pid
}
"
!=
""
]
;
then
echo
"kill
${
1
}
failed"
echo
"kill
${
1
}
failed"
...
@@ -255,7 +260,7 @@ function check_tx() {
...
@@ -255,7 +260,7 @@ function check_tx() {
local
count
=
0
local
count
=
0
while
true
;
do
while
true
;
do
ty
=
$(${
CLI
}
tx query
-s
${
2
}
| jq .receipt.ty
)
ty
=
$(${
CLI
}
tx query
-s
"
${
2
}
"
| jq .receipt.ty
)
if
[[
${
ty
}
!=
""
]]
;
then
if
[[
${
ty
}
!=
""
]]
;
then
break
break
fi
fi
...
@@ -271,7 +276,7 @@ function check_tx() {
...
@@ -271,7 +276,7 @@ function check_tx() {
set
-x
set
-x
ty
=
$(${
CLI
}
tx query
-s
${
2
}
| jq .receipt.ty
)
ty
=
$(${
CLI
}
tx query
-s
"
${
2
}
"
| jq .receipt.ty
)
if
[[
${
ty
}
!=
2
]]
;
then
if
[[
${
ty
}
!=
2
]]
;
then
echo
-e
"
${
RED
}
check tx error, hash is
${
2
}${
NOC
}
"
echo
-e
"
${
RED
}
check tx error, hash is
${
2
}${
NOC
}
"
exit
1
exit
1
...
@@ -283,7 +288,7 @@ function check_number() {
...
@@ -283,7 +288,7 @@ function check_number() {
echo
-e
"
${
RED
}
wrong check number parameters
${
NOC
}
"
echo
-e
"
${
RED
}
wrong check number parameters
${
NOC
}
"
exit
1
exit
1
fi
fi
if
[[
${
1
}
!=
${
2
}
]]
;
then
if
[[
${
1
}
!=
"
${
2
}
"
]]
;
then
echo
-e
"
${
RED
}
error number, expect
${
1
}
, get
${
2
}${
NOC
}
"
echo
-e
"
${
RED
}
error number, expect
${
1
}
, get
${
2
}${
NOC
}
"
exit
1
exit
1
fi
fi
...
@@ -296,8 +301,8 @@ function check_addr() {
...
@@ -296,8 +301,8 @@ function check_addr() {
exit
1
exit
1
fi
fi
addr
=
$(
echo
${
1
}
| jq
-r
".acc.addr"
)
addr
=
$(
echo
"
${
1
}
"
| jq
-r
".acc.addr"
)
if
[[
${
addr
}
!=
${
2
}
]]
;
then
if
[[
${
addr
}
!=
"
${
2
}
"
]]
;
then
echo
-e
"
${
RED
}
error addr, expect
${
1
}
, get
${
2
}${
NOC
}
"
echo
-e
"
${
RED
}
error addr, expect
${
1
}
, get
${
2
}${
NOC
}
"
exit
1
exit
1
fi
fi
...
@@ -331,18 +336,18 @@ function updata_relayer_toml() {
...
@@ -331,18 +336,18 @@ function updata_relayer_toml() {
exit
1
exit
1
fi
fi
local
line
=
$(
delete_line_show
${
file
}
"chain33Host"
)
local
line
=
$(
delete_line_show
"
${
file
}
"
"chain33Host"
)
# 在第 line 行后面 新增合约地址
# 在第 line 行后面 新增合约地址
sed
-i
''
${
line
}
' a chain33Host="http://'
${
chain33Host
}
':8801"'
"
${
file
}
"
sed
-i
''
"
${
line
}
"
' a chain33Host="http://'
"
${
chain33Host
}
"
':8801"'
"
${
file
}
"
line
=
$(
delete_line_show
${
file
}
"pushHost"
)
line
=
$(
delete_line_show
"
${
file
}
"
"pushHost"
)
sed
-i
''
${
line
}
' a pushHost="http://'
${
pushHost
}
':20000"'
"
${
file
}
"
sed
-i
''
"
${
line
}
"
' a pushHost="http://'
"
${
pushHost
}
"
':20000"'
"
${
file
}
"
line
=
$(
delete_line_show
${
file
}
"BridgeRegistry"
)
line
=
$(
delete_line_show
"
${
file
}
"
"BridgeRegistry"
)
sed
-i
''
${
line
}
' a BridgeRegistry="'
${
BridgeRegistry
}
'"'
"
${
file
}
"
sed
-i
''
"
${
line
}
"
' a BridgeRegistry="'
"
${
BridgeRegistry
}
"
'"'
"
${
file
}
"
sed
-i
's/EthMaturityDegree=10/'
EthMaturityDegree
=
${
maturityDegree
}
'/g'
"
${
file
}
"
sed
-i
's/EthMaturityDegree=10/'
EthMaturityDegree
=
"
${
maturityDegree
}
"
'/g'
"
${
file
}
"
sed
-i
's/maturityDegree=10/'
maturityDegree
=
${
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/#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.64.2/'${chain33Host}'/g' "../build/relayer.toml"
...
@@ -358,18 +363,18 @@ function updata_relayer_toml_ropston() {
...
@@ -358,18 +363,18 @@ function updata_relayer_toml_ropston() {
local
chain33Host
=
127.0.0.1
local
chain33Host
=
127.0.0.1
local
pushHost
=
127.0.0.1
local
pushHost
=
127.0.0.1
local
line
=
$(
delete_line_show
${
file
}
"chain33Host"
)
local
line
=
$(
delete_line_show
"
${
file
}
"
"chain33Host"
)
# 在第 line 行后面 新增合约地址
# 在第 line 行后面 新增合约地址
sed
-i
''
${
line
}
' a chain33Host="http://'
${
chain33Host
}
':8801"'
"
${
file
}
"
sed
-i
''
"
${
line
}
"
' a chain33Host="http://'
${
chain33Host
}
':8801"'
"
${
file
}
"
line
=
$(
delete_line_show
${
file
}
"pushHost"
)
line
=
$(
delete_line_show
"
${
file
}
"
"pushHost"
)
sed
-i
''
${
line
}
' a pushHost="http://'
${
pushHost
}
':20000"'
"
${
file
}
"
sed
-i
''
"
${
line
}
"
' a pushHost="http://'
${
pushHost
}
':20000"'
"
${
file
}
"
line
=
$(
delete_line_show
${
file
}
"BridgeRegistry"
)
line
=
$(
delete_line_show
"
${
file
}
"
"BridgeRegistry"
)
sed
-i
''
${
line
}
' a BridgeRegistry="'
${
BridgeRegistry
}
'"'
"
${
file
}
"
sed
-i
''
"
${
line
}
"
' a BridgeRegistry="'
"
${
BridgeRegistry
}
"
'"'
"
${
file
}
"
sed
-i
's/EthMaturityDegree=10/'
EthMaturityDegree
=
${
maturityDegree
}
'/g'
"
${
file
}
"
sed
-i
's/EthMaturityDegree=10/'
EthMaturityDegree
=
"
${
maturityDegree
}
"
'/g'
"
${
file
}
"
sed
-i
's/maturityDegree=10/'
maturityDegree
=
${
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/#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.64.2/'${chain33Host}'/g' "../build/relayer.toml"
...
@@ -383,12 +388,12 @@ function updata_all_relayer_toml() {
...
@@ -383,12 +388,12 @@ function updata_all_relayer_toml() {
# local dockername=30
# local dockername=30
for
name
in
B C D
;
do
for
name
in
B C D
;
do
local
file
=
"../build/
"
$name
"
/relayer.toml"
local
file
=
"../build/
$name
/relayer.toml"
cp
'../build/A/relayer.toml'
"
${
file
}
"
cp
'../build/A/relayer.toml'
"
${
file
}
"
cp
'../build/ebrelayer'
"../build/
"
$name
"
/ebrelayer"
cp
'../build/ebrelayer'
"../build/
$name
/ebrelayer"
# 删除配置文件中不需要的字段
# 删除配置文件中不需要的字段
for
deleteName
in
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"
\[
deploy
\]
"
;
do
for
deleteName
in
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"
deploy
"
;
do
delete_line
"
${
file
}
"
"
${
deleteName
}
"
delete_line
"
${
file
}
"
"
${
deleteName
}
"
done
done
...
@@ -421,12 +426,12 @@ function updata_all_relayer_toml2() {
...
@@ -421,12 +426,12 @@ function updata_all_relayer_toml2() {
# local dockername=30
# local dockername=30
for
name
in
B C D
;
do
for
name
in
B C D
;
do
local
file
=
"./
"
$name
"
/relayer.toml"
local
file
=
"./
$name
/relayer.toml"
cp
'./A/relayer.toml'
"
${
file
}
"
cp
'./A/relayer.toml'
"
${
file
}
"
cp
'./ebrelayer'
"./
"
$name
"
/ebrelayer"
cp
'./ebrelayer'
"./
$name
/ebrelayer"
# 删除配置文件中不需要的字段
# 删除配置文件中不需要的字段
for
deleteName
in
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"
\[
deploy
\]
"
;
do
for
deleteName
in
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"
deploy
"
;
do
delete_line
"
${
file
}
"
"
${
deleteName
}
"
delete_line
"
${
file
}
"
"
${
deleteName
}
"
done
done
...
@@ -512,7 +517,7 @@ function eth_block_wait() {
...
@@ -512,7 +517,7 @@ function eth_block_wait() {
if
[
"
${
url
}
"
==
""
]
;
then
if
[
"
${
url
}
"
==
""
]
;
then
cur_height
=
$(
curl
-ksd
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
http://localhost:7545 | jq
-r
".result"
)
cur_height
=
$(
curl
-ksd
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
http://localhost:7545 | jq
-r
".result"
)
else
else
cur_height
=
$(
curl
-H
"Content-Type: application/json"
-X
POST
--data
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
${
url
}
| jq
-r
".result"
)
cur_height
=
$(
curl
-H
"Content-Type: application/json"
-X
POST
--data
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
"
${
url
}
"
| jq
-r
".result"
)
fi
fi
local
expect
=
$((
cur_height
+
${
1
}
+
1
))
local
expect
=
$((
cur_height
+
${
1
}
+
1
))
...
@@ -521,7 +526,7 @@ function eth_block_wait() {
...
@@ -521,7 +526,7 @@ function eth_block_wait() {
if
[
"
${
url
}
"
==
""
]
;
then
if
[
"
${
url
}
"
==
""
]
;
then
new_height
=
$(
curl
-ksd
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
http://localhost:7545 | jq
-r
".result"
)
new_height
=
$(
curl
-ksd
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
http://localhost:7545 | jq
-r
".result"
)
else
else
new_height
=
$(
curl
-H
"Content-Type: application/json"
-X
POST
--data
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
${
url
}
| jq
-r
".result"
)
new_height
=
$(
curl
-H
"Content-Type: application/json"
-X
POST
--data
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
"
${
url
}
"
| jq
-r
".result"
)
fi
fi
if
[[
${
new_height
}
-ge
${
expect
}
]]
;
then
if
[[
${
new_height
}
-ge
${
expect
}
]]
;
then
...
...
plugin/dapp/x2Ethereum/testsh/x2ethereumTest.sh
View file @
49765aa0
...
@@ -23,14 +23,14 @@ ethReceiverAddr1="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
...
@@ -23,14 +23,14 @@ ethReceiverAddr1="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethReceiverAddrKey1
=
"355b876d7cbcb930d5dfab767f66336ce327e082cbaa1877210c1bae89b1df71"
ethReceiverAddrKey1
=
"355b876d7cbcb930d5dfab767f66336ce327e082cbaa1877210c1bae89b1df71"
ethReceiverAddr2
=
"0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddr2
=
"0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2
=
"9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
ethReceiverAddrKey2
=
"9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
ethReceiverAddr3
=
"0x1919203bA8b325278d28Fb8fFeac49F2CD881A4e"
#
ethReceiverAddr3="0x1919203bA8b325278d28Fb8fFeac49F2CD881A4e"
ethReceiverAddrKey3
=
"62ca4122aac0e6f35bed02fc15c7ddbdaa07f2f2a1821c8b8210b891051e3ee9"
#
ethReceiverAddrKey3="62ca4122aac0e6f35bed02fc15c7ddbdaa07f2f2a1821c8b8210b891051e3ee9"
chain33Validator1
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33Validator1
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33Validator2
=
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
#0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01
chain33Validator2
=
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
#0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01
chain33Validator3
=
"1BqP2vHkYNjSgdnTqm7pGbnphLhtEhuJFi"
chain33Validator3
=
"1BqP2vHkYNjSgdnTqm7pGbnphLhtEhuJFi"
BtyReceiever
=
"1BqP2vHkYNjSgdnTqm7pGbnphLhtEhuJFi"
#
BtyReceiever="1BqP2vHkYNjSgdnTqm7pGbnphLhtEhuJFi"
ETHContractAddr
=
"0x0000000000000000000000000000000000000000"
#
ETHContractAddr="0x0000000000000000000000000000000000000000"
maturityDegree
=
10
maturityDegree
=
10
function
InitAndDeploy
()
{
function
InitAndDeploy
()
{
...
@@ -89,7 +89,7 @@ function StartRelayerAndDeploy() {
...
@@ -89,7 +89,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer
"../build/ebrelayer"
kill_ebrelayer
"../build/ebrelayer"
# 修改 relayer.toml 配置文件
# 修改 relayer.toml 配置文件
updata_relayer_toml
${
BridgeRegistry
}
${
maturityDegree
}
"../build/relayer.toml"
updata_relayer_toml
"
${
BridgeRegistry
}
"
${
maturityDegree
}
"../build/relayer.toml"
# 重启 ebrelayer 并解锁
# 重启 ebrelayer 并解锁
start_ebrelayer
"../build/ebrelayer"
"../build/ebrelayer.log"
start_ebrelayer
"../build/ebrelayer"
"../build/ebrelayer.log"
...
@@ -130,10 +130,10 @@ function InitChain33Vilators() {
...
@@ -130,10 +130,10 @@ function InitChain33Vilators() {
# query Validators
# query Validators
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query validators
-v
${
chain33Validator1
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query validators
-v
${
chain33Validator1
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
check_number 87
${
totalPower
}
check_number 87
"
${
totalPower
}
"
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
totalPower
=
$(${
Chain33Cli
}
send x2ethereum query totalpower
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower |
sed
's/\"//g'
)
check_number 100
${
totalPower
}
check_number 100
"
${
totalPower
}
"
# cions 转帐到 x2ethereum 合约地址
# cions 转帐到 x2ethereum 合约地址
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send coins send_exec
-e
x2ethereum
-a
200
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
...
@@ -161,7 +161,7 @@ function TestChain33ToEthAssets() {
...
@@ -161,7 +161,7 @@ function TestChain33ToEthAssets() {
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
coins.bty
-r
${
ethReceiverAddr1
}
-q
${
tokenAddr
}
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
Chain33Cli
}
send x2ethereum lock
-a
5
-t
coins.bty
-r
${
ethReceiverAddr1
}
-q
"
${
tokenAddr
}
"
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -323,7 +323,7 @@ function TestETH2Chain33Erc20() {
...
@@ -323,7 +323,7 @@ function TestETH2Chain33Erc20() {
balance_ret
"
${
result
}
"
"100"
balance_ret
"
${
result
}
"
"100"
# chain33 burn 40
# chain33 burn 40
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
40
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33SenderAddr
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
40
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33SenderAddr
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
@@ -339,7 +339,7 @@ function TestETH2Chain33Erc20() {
...
@@ -339,7 +339,7 @@ function TestETH2Chain33Erc20() {
cli_ret
"
${
result
}
"
"balance"
".balance"
"60"
cli_ret
"
${
result
}
"
"balance"
".balance"
"60"
# burn 60
# burn 60
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
60
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
${
tokenAddr
}
-k
"
${
chain33SenderAddr
}
"
)
hash
=
$(${
Chain33Cli
}
send x2ethereum burn
-a
60
-t
"
${
tokenSymbol
}
"
-r
${
ethReceiverAddr2
}
-q
"
${
tokenAddr
}
"
-k
"
${
chain33SenderAddr
}
"
)
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
block_wait
"
${
Chain33Cli
}
"
$((
maturityDegree
+
2
))
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
check_tx
"
${
Chain33Cli
}
"
"
${
hash
}
"
...
...
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