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
36d9fce4
Commit
36d9fce4
authored
Aug 12, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish rpc test
parent
2e954ca3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
136 additions
and
40 deletions
+136
-40
Dockerfile-x2ethrelayd
build/Dockerfile-x2ethrelayd
+0
-0
docker-compose-pre.sh
build/docker-compose-pre.sh
+0
-2
docker-compose.sh
build/docker-compose.sh
+3
-5
Dockerfile-x2ethrelay
plugin/dapp/x2ethereum/cmd/build/Dockerfile-x2ethrelay
+1
-1
allRelayerTest.sh
plugin/dapp/x2ethereum/cmd/build/allRelayerTest.sh
+0
-0
docker-compose-x2ethereum.yml
...n/dapp/x2ethereum/cmd/build/docker-compose-x2ethereum.yml
+0
-2
perf_test.sh
plugin/dapp/x2ethereum/cmd/build/perf_test.sh
+18
-15
publicTest.sh
plugin/dapp/x2ethereum/cmd/build/publicTest.sh
+111
-10
testcase.sh
plugin/dapp/x2ethereum/cmd/build/testcase.sh
+2
-3
test-rpc.sh
plugin/dapp/x2ethereum/cmd/test/test-rpc.sh
+0
-0
commands.go
plugin/dapp/x2ethereum/commands/commands.go
+0
-1
main.go
plugin/dapp/x2ethereum/ebrelayer/main.go
+1
-1
No files found.
build/Dockerfile-x2ethrelayd
deleted
100644 → 0
View file @
2e954ca3
build/docker-compose-pre.sh
View file @
36d9fce4
...
@@ -67,7 +67,6 @@ function run_dapp() {
...
@@ -67,7 +67,6 @@ function run_dapp() {
fi
fi
cd
..
cd
..
echo
"============ run dapp=
$app
end ================="
echo
"============ run dapp=
$app
end ================="
}
}
function
run_single_app
()
{
function
run_single_app
()
{
...
@@ -145,7 +144,6 @@ function main() {
...
@@ -145,7 +144,6 @@ function main() {
elif
[
"
${
OP
}
"
==
"modify"
]
;
then
elif
[
"
${
OP
}
"
==
"modify"
]
;
then
sed
-i
$sedfix
'/^useGithub=.*/a version=1'
chain33.toml
sed
-i
$sedfix
'/^useGithub=.*/a version=1'
chain33.toml
fi
fi
}
}
# run script
# run script
...
...
build/docker-compose.sh
View file @
36d9fce4
...
@@ -461,31 +461,29 @@ function dapp_test_address() {
...
@@ -461,31 +461,29 @@ function dapp_test_address() {
}
}
function
base_config
()
{
function
base_config
()
{
# sync
transfer
"
${
CLI
}
"
transfer
"
${
CLI
}
"
# transfer "${CLI4}"
}
}
function
rpc_test
()
{
function
rpc_test
()
{
if
[
"
$DAPP
"
==
""
]
;
then
if
[
"
$DAPP
"
==
""
]
;
then
system_test_rpc
"http://
${
1
}
:8801"
system_test_rpc
"http://
${
1
}
:8801"
dapp_test_address
"
${
CLI
}
"
dapp_test_address
"
${
CLI
}
"
dapp_test_rpc
"http://
${
1
}
:8801"
"
${
NODE3
}
"
dapp_test_rpc
"http://
${
1
}
:8801"
"
${
dockerNamePrefix
}
"
fi
fi
if
[
"
$DAPP
"
==
"paracross"
]
;
then
if
[
"
$DAPP
"
==
"paracross"
]
;
then
system_test_rpc
"http://
${
1
}
:8901"
system_test_rpc
"http://
${
1
}
:8901"
dapp_test_address
"
${
CLI
}
"
dapp_test_address
"
${
CLI
}
"
dapp_test_rpc
"http://
${
1
}
:8901"
dapp_test_rpc
"http://
${
1
}
:8901"
fi
fi
}
}
function
dapp_run
()
{
function
dapp_run
()
{
if
[
-e
"
$DAPP_TEST_FILE
"
]
;
then
if
[
-e
"
$DAPP_TEST_FILE
"
]
;
then
${
DAPP
}
"
${
CLI
}
"
"
${
1
}
"
"
${
2
}
"
${
DAPP
}
"
${
CLI
}
"
"
${
1
}
"
"
${
2
}
"
fi
fi
}
}
function
main
()
{
function
main
()
{
echo
"==============================DAPP=
$DAPP
main begin========================================================"
echo
"==============================DAPP=
$DAPP
main begin========================================================"
### init para ####
### init para ####
...
...
plugin/dapp/x2ethereum/cmd/build/Dockerfile-x2ethrelay
View file @
36d9fce4
FROM ubuntu:16.04
FROM ubuntu:16.04
.02
WORKDIR /root
WORKDIR /root
COPY relayer.toml relayer.toml
COPY relayer.toml relayer.toml
...
...
plugin/dapp/x2ethereum/cmd/build/allRelayerTest.sh
View file @
36d9fce4
This diff is collapsed.
Click to expand it.
plugin/dapp/x2ethereum/cmd/build/docker-compose-x2ethereum.yml
View file @
36d9fce4
...
@@ -4,8 +4,6 @@ services:
...
@@ -4,8 +4,6 @@ services:
ganachetest
:
ganachetest
:
entrypoint
:
[
"
node"
,
"
/app/ganache-core.docker.cli.js"
,
"
-a"
,
"
10"
,
"
-b"
,
"
2"
,
"
--debug"
,
"
-m"
,
"
coast
bar
giraffe
art
venue
decide
symbol
law
visual
crater
vital
fold"
]
entrypoint
:
[
"
node"
,
"
/app/ganache-core.docker.cli.js"
,
"
-a"
,
"
10"
,
"
-b"
,
"
2"
,
"
--debug"
,
"
-m"
,
"
coast
bar
giraffe
art
venue
decide
symbol
law
visual
crater
vital
fold"
]
image
:
trufflesuite/ganache-cli:latest
image
:
trufflesuite/ganache-cli:latest
ports
:
-
"
7545:8545"
ebrelayera
:
ebrelayera
:
build
:
build
:
...
...
plugin/dapp/x2ethereum/cmd/build/perf_test.sh
View file @
36d9fce4
...
@@ -6,10 +6,6 @@ set -x
...
@@ -6,10 +6,6 @@ set -x
source
"./publicTest.sh"
source
"./publicTest.sh"
source
"./allRelayerTest.sh"
source
"./allRelayerTest.sh"
CLIA
=
"./ebcli_A"
Chain33_CLI
=
""
Ethsender
=
"0xa4ea64a583f6e51c3799335b28a8f0529570a635"
Ethsender
=
"0xa4ea64a583f6e51c3799335b28a8f0529570a635"
privateKeys[0]
=
"8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
privateKeys[0]
=
"8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
privateKeys[1]
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
privateKeys[1]
=
"3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
...
@@ -29,10 +25,14 @@ ethAddress[6]="0x0C05bA5c230fDaA503b53702aF1962e08D0C60BF"
...
@@ -29,10 +25,14 @@ ethAddress[6]="0x0C05bA5c230fDaA503b53702aF1962e08D0C60BF"
maturityDegree
=
10
maturityDegree
=
10
tokenAddr
=
""
tokenAddr
=
""
tokenAddrBty
=
""
tokenAddrBty
=
""
Chain33_CLI
=
""
CLIA
=
""
ethUrl
=
""
loop_send_lock_eth
()
{
loop_send_lock_eth
()
{
# while 遍历数组
# while 遍历数组
echo
-e
"
${
GRE
}
=========== Ethereum Lock begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
=========== Ethereum Lock begin ===========
${
NOC
}
"
#shellcheck disable=SC2154
preChain33Balance
=
$(${
Chain33_CLI
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
| jq
".balance"
|
sed
's/\"//g'
)
preChain33Balance
=
$(${
Chain33_CLI
}
x2ethereum balance
-s
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-t
eth | jq
".res"
| jq
".[]"
| jq
".balance"
|
sed
's/\"//g'
)
i
=
0
i
=
0
...
@@ -44,7 +44,8 @@ loop_send_lock_eth() {
...
@@ -44,7 +44,8 @@ loop_send_lock_eth() {
let
i++
let
i++
done
done
eth_block_wait
$((
maturityDegree
+
2
))
#shellcheck disable=SC2154
eth_block_wait
$((
maturityDegree
+
2
))
"
${
ethUrl
}
"
i
=
0
i
=
0
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
...
@@ -71,13 +72,13 @@ loop_send_burn_eth() {
...
@@ -71,13 +72,13 @@ loop_send_burn_eth() {
i
=
0
i
=
0
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
-
-node_addr
"
${
ethUrl
}
"
-
k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
${
i
}
"burn chain33 tx hash:"
"
${
ethTxHash
}
"
echo
${
i
}
"burn chain33 tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
# shellcheck disable=SC2219
let
i++
let
i++
done
done
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
"
${
ethUrl
}
"
i
=
0
i
=
0
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
...
@@ -104,13 +105,13 @@ loop_send_lock_bty() {
...
@@ -104,13 +105,13 @@ loop_send_lock_bty() {
i
=
0
i
=
0
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
-
-node_addr
"
${
ethUrl
}
"
-
k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
${
i
}
"lock chain33 tx hash:"
"
${
ethTxHash
}
"
echo
${
i
}
"lock chain33 tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
# shellcheck disable=SC2219
let
i++
let
i++
done
done
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
"
${
ethUrl
}
"
i
=
0
i
=
0
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
...
@@ -141,7 +142,7 @@ loop_send_burn_bty() {
...
@@ -141,7 +142,7 @@ loop_send_burn_bty() {
let
i++
let
i++
done
done
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
"
${
ethUrl
}
"
i
=
0
i
=
0
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
...
@@ -171,7 +172,7 @@ loop_send_lock_erc20() {
...
@@ -171,7 +172,7 @@ loop_send_lock_erc20() {
# shellcheck disable=SC2219
# shellcheck disable=SC2219
let
i++
let
i++
done
done
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
"
${
ethUrl
}
"
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
))
...
@@ -190,13 +191,13 @@ loop_send_burn_erc20() {
...
@@ -190,13 +191,13 @@ loop_send_burn_erc20() {
i
=
0
i
=
0
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
}
"
-
-node_addr
"
${
ethUrl
}
"
-
k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
${
i
}
"burn chain33 tx hash:"
"
${
ethTxHash
}
"
echo
${
i
}
"burn chain33 tx hash:"
"
${
ethTxHash
}
"
# shellcheck disable=SC2219
# shellcheck disable=SC2219
let
i++
let
i++
done
done
eth_block_wait
$((
maturityDegree
+
2
))
eth_block_wait
$((
maturityDegree
+
2
))
"
${
ethUrl
}
"
i
=
0
i
=
0
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
while
[[
i
-lt
${#
privateKeys
[@]
}
]]
;
do
...
@@ -215,8 +216,10 @@ loop_send_burn_erc20() {
...
@@ -215,8 +216,10 @@ loop_send_burn_erc20() {
perf_test_main
()
{
perf_test_main
()
{
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
begin ===========
${
NOC
}
"
docker_chain33_ip
=
$(
docker inspect
"
${
NODE3
}
"
| jq
".[].NetworkSettings.Networks"
|
grep
"IPAddress"
|
awk
'{ print $2}'
|
sed
's/\"//g'
|
sed
's/,//g'
)
#shellcheck disable=SC2154
Chain33_CLI
=
"./chain33-cli --rpc_laddr http://
${
docker_chain33_ip
}
:8801"
docker_chain33_ip
=
$(
get_docker_addr
"
${
dockerNamePrefix
}
_chain33_1"
)
#shellcheck disable=SC2034
Chain33Cli
=
"./chain33-cli --rpc_laddr http://
${
docker_chain33_ip
}
:8801"
if
[[
${
1
}
!=
""
]]
;
then
if
[[
${
1
}
!=
""
]]
;
then
maturityDegree
=
${
1
}
maturityDegree
=
${
1
}
...
...
plugin/dapp/x2ethereum/cmd/build/publicTest.sh
View file @
36d9fce4
...
@@ -27,11 +27,31 @@ function exit_cp_file() {
...
@@ -27,11 +27,31 @@ function exit_cp_file() {
# shellcheck disable=SC2154
# shellcheck disable=SC2154
docker
cp
"
${
dockerNamePrefix
}
_ebrelayer
${
name
}
_1"
:/root/logs/x2Ethereum_relayer.log
"
$dirName
/ebrelayer
$name
.log"
docker
cp
"
${
dockerNamePrefix
}
_ebrelayer
${
name
}
_1"
:/root/logs/x2Ethereum_relayer.log
"
$dirName
/ebrelayer
$name
.log"
done
done
docker
cp
"
${
NODE3
}
"
:/root/logs/chain33.log
"
$dirName
/chain33.log"
docker
cp
"
${
dockerNamePrefix
}
_chain33_1
"
:/root/logs/chain33.log
"
$dirName
/chain33.log"
exit
1
exit
1
}
}
function
copyErrLogs
()
{
if
[
-n
"
$CASE_ERR
"
]
;
then
# /var/lib/jenkins
# shellcheck disable=SC2116
dirNameFa
=
$(
echo
~
)
dirName
=
"
$dirNameFa
/x2ethereumlogs"
if
[
!
-d
"
${
dirName
}
"
]
;
then
# shellcheck disable=SC2086
mkdir
-p
${
dirName
}
fi
for
name
in
a b c d
;
do
# shellcheck disable=SC2154
docker
cp
"
${
dockerNamePrefix
}
_ebrelayer
${
name
}
_rpc_1"
:/root/logs/x2Ethereum_relayer.log
"
$dirName
/ebrelayer
$name_rpc
.log"
done
docker
cp
"
${
dockerNamePrefix
}
_chain33_1"
:/root/logs/chain33.log
"
$dirName
/chain33_rpc.log"
fi
}
function
kill_all_ebrelayer
()
{
function
kill_all_ebrelayer
()
{
for
name
in
A B C D
;
do
for
name
in
A B C D
;
do
local
ebrelayer
=
"./../build/
$name
/ebrelayer"
local
ebrelayer
=
"./../build/
$name
/ebrelayer"
...
@@ -348,14 +368,19 @@ function get_inet_addr() {
...
@@ -348,14 +368,19 @@ function get_inet_addr() {
echo
"
${
inetAddr
}
"
echo
"
${
inetAddr
}
"
}
}
# $1 dockerName
function
get_docker_addr
()
{
local
dockerAddr
=
$(
docker inspect
"
${
1
}
"
| jq
".[].NetworkSettings.Networks"
|
grep
"IPAddress"
|
awk
'{ print $2}'
|
sed
's/\"//g'
|
sed
's/,//g'
)
echo
"
${
dockerAddr
}
"
}
# 更新配置文件 $1 为 BridgeRegistry 合约地址; $2 等待区块 默认10; $3 relayer.toml 地址
# 更新配置文件 $1 为 BridgeRegistry 合约地址; $2 等待区块 默认10; $3 relayer.toml 地址
function
updata_relayer_toml
()
{
function
updata_relayer_toml
()
{
local
BridgeRegistry
=
${
1
}
local
BridgeRegistry
=
${
1
}
local
maturityDegree
=
${
2
}
local
maturityDegree
=
${
2
}
local
file
=
${
3
}
local
file
=
${
3
}
# local chain33Host=$(docker inspect "${NODE3}" | jq ".[].NetworkSettings.Networks.${PROJ}_default.IPAddress" | sed 's/\"//g')
local
chain33Host
=
$(
get_docker_addr
"
${
dockerNamePrefix
}
_chain33_1"
)
local
chain33Host
=
$(
docker inspect
"
${
NODE3
}
"
| jq
".[].NetworkSettings.Networks"
|
grep
"IPAddress"
|
awk
'{ print $2}'
|
sed
's/\"//g'
|
sed
's/,//g'
)
if
[[
${
chain33Host
}
==
""
]]
;
then
if
[[
${
chain33Host
}
==
""
]]
;
then
echo
-e
"
${
RED
}
chain33Host is empty
${
NOC
}
"
echo
-e
"
${
RED
}
chain33Host is empty
${
NOC
}
"
exit_cp_file
exit_cp_file
...
@@ -410,8 +435,15 @@ function updata_relayer_toml_ropston() {
...
@@ -410,8 +435,15 @@ function updata_relayer_toml_ropston() {
sed
-i
's/maturityDegree=10/'
maturityDegree
=
"
${
maturityDegree
}
"
'/g'
"
${
file
}
"
sed
-i
's/maturityDegree=10/'
maturityDegree
=
"
${
maturityDegree
}
"
'/g'
"
${
file
}
"
}
}
# $1 portRelayer
function
updata_docker_relayer_toml
()
{
function
updata_docker_relayer_toml
()
{
local
port
=
20000
local
port
=
$1
local
portRelayer
=
$1
if
[
"
${
portRelayer
}
"
!=
"20000"
]
;
then
sed
-i
's/20000/'
"
${
portRelayer
}
"
'/g'
"./relayer.toml"
sed
-i
's/20000/'
"
${
portRelayer
}
"
'/g'
"./Dockerfile-x2ethrelay"
fi
for
name
in
b c d
;
do
for
name
in
b c d
;
do
local
file
=
"./relayer
$name
.toml"
local
file
=
"./relayer
$name
.toml"
...
@@ -423,7 +455,7 @@ function updata_docker_relayer_toml() {
...
@@ -423,7 +455,7 @@ function updata_docker_relayer_toml() {
done
done
port
=
$((
port
+
1
))
port
=
$((
port
+
1
))
sed
-i
's/
20000
/'
${
port
}
'/g'
"
${
file
}
"
sed
-i
's/
'
"
${
portRelayer
}
"
'
/'
${
port
}
'/g'
"
${
file
}
"
sed
-i
's/x2ethereum/x2ethereum'
${
name
}
'/g'
"
${
file
}
"
sed
-i
's/x2ethereum/x2ethereum'
${
name
}
'/g'
"
${
file
}
"
...
@@ -434,8 +466,7 @@ function updata_docker_relayer_toml() {
...
@@ -434,8 +466,7 @@ function updata_docker_relayer_toml() {
local
line
=
$(
delete_line_show
"
${
dockerfile
}
"
"COPY relayer.toml relayer.toml"
)
local
line
=
$(
delete_line_show
"
${
dockerfile
}
"
"COPY relayer.toml relayer.toml"
)
sed
-i
''
"
${
line
}
"
' a COPY relayer'
$name
'.toml relayer.toml'
"
${
dockerfile
}
"
sed
-i
''
"
${
line
}
"
' a COPY relayer'
$name
'.toml relayer.toml'
"
${
dockerfile
}
"
line
=
$(
delete_line_show
"
${
dockerfile
}
"
"EXPOSE 20000"
)
sed
-i
's/'
"
${
portRelayer
}
"
'/'
"
${
port
}
"
'/g'
"
${
dockerfile
}
"
sed
-i
''
"
${
line
}
"
' a EXPOSE '
$port
''
"
${
dockerfile
}
"
local
dockeryml
=
"./docker-compose-ebrelayer
$name
.yml"
local
dockeryml
=
"./docker-compose-ebrelayer
$name
.yml"
cp
"./docker-compose-ebrelayer.yml"
"
${
dockeryml
}
"
cp
"./docker-compose-ebrelayer.yml"
"
${
dockeryml
}
"
...
@@ -446,8 +477,77 @@ function updata_docker_relayer_toml() {
...
@@ -446,8 +477,77 @@ function updata_docker_relayer_toml() {
line
=
$(
delete_line_show
"
${
dockeryml
}
"
"dockerfile: Dockerfile-x2ethrelay"
)
line
=
$(
delete_line_show
"
${
dockeryml
}
"
"dockerfile: Dockerfile-x2ethrelay"
)
sed
-i
''
"
${
line
}
"
' a \ \ \ \ \ \ dockerfile: Dockerfile-x2ethrelay'
$name
''
"
${
dockeryml
}
"
sed
-i
''
"
${
line
}
"
' a \ \ \ \ \ \ dockerfile: Dockerfile-x2ethrelay'
$name
''
"
${
dockeryml
}
"
line
=
$(
delete_line_show
"
${
dockeryml
}
"
"20000:20000"
)
sed
-i
's/'
"
${
portRelayer
}
"
'/'
${
port
}
'/g'
"
${
dockeryml
}
"
sed
-i
''
"
${
line
}
"
' a \ \ \ \ \ \ -\ "'
${
port
}
':'
${
port
}
'"'
"
${
dockeryml
}
"
done
}
# 更新配置文件 $1 为 BridgeRegistry 合约地址; $2 等待区块 默认10; $3 MAIN_HTTP; $4 relayer.toml 地址
function
updata_relayer_toml_rpc
()
{
local
BridgeRegistry
=
${
1
}
local
maturityDegree
=
${
2
}
local
MAIN_HTTP
=
${
3
}
local
file
=
${
4
}
# shellcheck disable=SC2155
local
pushHost
=
$(
get_inet_addr
)
if
[[
${
pushHost
}
==
""
]]
;
then
echo
-e
"
${
RED
}
pushHost is empty
${
NOC
}
"
copyErrLogs
fi
# shellcheck disable=SC2155
local
line
=
$(
delete_line_show
"
${
file
}
"
"chain33Host"
)
# 在第 line 行后面 新增合约地址
sed
-i
''
"
${
line
}
"
' a chain33Host="'
"
${
MAIN_HTTP
}
"
'"'
"
${
file
}
"
line
=
$(
delete_line_show
"
${
file
}
"
"pushHost"
)
sed
-i
''
"
${
line
}
"
' a pushHost="http://'
"
${
pushHost
}
"
':20000"'
"
${
file
}
"
line
=
$(
delete_line_show
"
${
file
}
"
"BridgeRegistry"
)
sed
-i
''
"
${
line
}
"
' a BridgeRegistry="'
"
${
BridgeRegistry
}
"
'"'
"
${
file
}
"
sed
-i
's/EthMaturityDegree=10/'
EthMaturityDegree
=
"
${
maturityDegree
}
"
'/g'
"
${
file
}
"
sed
-i
's/maturityDegree=10/'
maturityDegree
=
"
${
maturityDegree
}
"
'/g'
"
${
file
}
"
sed
-i
's/^EthBlockFetchPeriod=.*/EthBlockFetchPeriod=500/g'
"
${
file
}
"
sed
-i
's/^fetchHeightPeriodMs=.*/fetchHeightPeriodMs=500/g'
"
${
file
}
"
}
# $1 portRelayer
function
updata_docker_relayer_toml_rpc
()
{
local
portRelayer
=
$1
local
port
=
$1
sed
-i
's/20000/'
"
${
portRelayer
}
"
'/g'
"./x2ethereum/relayer.toml"
sed
-i
's/20000/'
"
${
portRelayer
}
"
'/g'
"./x2ethereum/Dockerfile-x2ethrelay"
for
name
in
b c d
;
do
local
file
=
"./x2ethereum/relayer
$name
.toml"
cp
'./x2ethereum/relayer.toml'
"
${
file
}
"
# 删除配置文件中不需要的字段
for
deleteName
in
"deployerPrivateKey"
"operatorAddr"
"validatorsAddr"
"initPowers"
"deployerPrivateKey"
"deploy"
;
do
delete_line
"
${
file
}
"
"
${
deleteName
}
"
done
port
=
$((
port
-
1
))
sed
-i
's/'
"
${
portRelayer
}
"
'/'
${
port
}
'/g'
"
${
file
}
"
sed
-i
's/x2ethereum/x2ethereum'
${
name
}
'/g'
"
${
file
}
"
local
dockerfile
=
"./x2ethereum/Dockerfile-x2ethrelay
$name
"
cp
"./x2ethereum/Dockerfile-x2ethrelay"
"
${
dockerfile
}
"
# shellcheck disable=SC2155
local
line
=
$(
delete_line_show
"
${
dockerfile
}
"
"COPY relayer.toml relayer.toml"
)
sed
-i
''
"
${
line
}
"
' a COPY relayer'
$name
'.toml relayer.toml'
"
${
dockerfile
}
"
sed
-i
's/'
"
${
portRelayer
}
"
'/'
"
${
port
}
"
'/g'
"
${
dockerfile
}
"
local
dockeryml
=
"./x2ethereum/docker-compose-ebrelayer
$name
.yml"
cp
"./x2ethereum/docker-compose-ebrelayer.yml"
"
${
dockeryml
}
"
sed
-i
's/ebrelayera/ebrelayer'
${
name
}
'/g'
"
${
dockeryml
}
"
sed
-i
's/Dockerfile-x2ethrelay/Dockerfile-x2ethrelay'
${
name
}
'/g'
"
${
dockeryml
}
"
sed
-i
's/'
"
${
portRelayer
}
"
'/'
${
port
}
'/g'
"
${
dockeryml
}
"
done
done
}
}
...
@@ -515,6 +615,7 @@ function wait_prophecy_finish() {
...
@@ -515,6 +615,7 @@ function wait_prophecy_finish() {
fi
fi
count
=
$((
count
+
1
))
count
=
$((
count
+
1
))
if
[[
${
count
}
==
30
]]
;
then
if
[[
${
count
}
==
30
]]
;
then
set
-x
echo
-e
"
${
RED
}
failed to get balance
${
NOC
}
"
echo
-e
"
${
RED
}
failed to get balance
${
NOC
}
"
exit_cp_file
exit_cp_file
fi
fi
...
@@ -524,7 +625,7 @@ function wait_prophecy_finish() {
...
@@ -524,7 +625,7 @@ function wait_prophecy_finish() {
set
-x
set
-x
}
}
# eth 区块等待 $1:等待高度 $2:url地址,默认为 http://localhost:7545,测试网络用 https://ropsten-rpc.linkpool.io/
# eth 区块等待 $1:等待高度
$2:url地址,默认为 http://localhost:7545,测试网络用 https://ropsten-rpc.linkpool.io/
function
eth_block_wait
()
{
function
eth_block_wait
()
{
set
+x
set
+x
if
[[
$#
-lt
0
]]
;
then
if
[[
$#
-lt
0
]]
;
then
...
...
plugin/dapp/x2ethereum/cmd/build/testcase.sh
View file @
36d9fce4
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
# shellcheck source=/dev/null
# shellcheck source=/dev/null
source
"./allRelayerTest.sh"
source
"./allRelayerTest.sh"
#source "./relayerTest.sh"
source
"./perf_test.sh"
source
"./perf_test.sh"
function
x2ethereum
()
{
function
x2ethereum
()
{
...
@@ -15,8 +14,8 @@ function x2ethereum() {
...
@@ -15,8 +14,8 @@ function x2ethereum() {
echo
"========================== x2ethereum test =========================="
echo
"========================== x2ethereum test =========================="
set
+e
set
+e
set
-x
set
-x
AllRelayerMainTest
5
AllRelayerMainTest
1
#
perf_test_main 10
perf_test_main 10
echo
"========================== x2ethereum test end =========================="
echo
"========================== x2ethereum test end =========================="
fi
fi
}
}
plugin/dapp/x2ethereum/cmd/test/test-rpc.sh
View file @
36d9fce4
This diff is collapsed.
Click to expand it.
plugin/dapp/x2ethereum/commands/commands.go
View file @
36d9fce4
...
@@ -72,7 +72,6 @@ func addChain33ToEthFlags(cmd *cobra.Command) {
...
@@ -72,7 +72,6 @@ func addChain33ToEthFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"a"
,
float64
(
0
),
"the amount of this contract want to lock"
)
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"a"
,
float64
(
0
),
"the amount of this contract want to lock"
)
_
=
cmd
.
MarkFlagRequired
(
"amount"
)
_
=
cmd
.
MarkFlagRequired
(
"amount"
)
}
}
func
burn
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
burn
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
...
plugin/dapp/x2ethereum/ebrelayer/main.go
View file @
36d9fce4
...
@@ -65,7 +65,7 @@ func main() {
...
@@ -65,7 +65,7 @@ func main() {
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
log
.
Info
(
"db info:"
,
" Dbdriver = "
,
cfg
.
SyncTxConfig
.
Dbdriver
,
", DbPath = "
,
cfg
.
SyncTxConfig
.
DbPath
,
", DbCache = "
,
cfg
.
SyncTxConfig
.
DbCache
)
log
.
Info
(
"db info:"
,
" Dbdriver = "
,
cfg
.
SyncTxConfig
.
Dbdriver
,
", DbPath = "
,
cfg
.
SyncTxConfig
.
DbPath
,
", DbCache = "
,
cfg
.
SyncTxConfig
.
DbCache
,
", EthProvider = "
,
cfg
.
EthProvider
)
log
.
Info
(
"deploy info:"
,
"BridgeRegistry"
,
cfg
.
BridgeRegistry
)
log
.
Info
(
"deploy info:"
,
"BridgeRegistry"
,
cfg
.
BridgeRegistry
)
mainlog
.
Info
(
"db info:"
,
" Dbdriver = "
,
cfg
.
SyncTxConfig
.
Dbdriver
,
", DbPath = "
,
cfg
.
SyncTxConfig
.
DbPath
,
", DbCache = "
,
cfg
.
SyncTxConfig
.
DbCache
)
mainlog
.
Info
(
"db info:"
,
" Dbdriver = "
,
cfg
.
SyncTxConfig
.
Dbdriver
,
", DbPath = "
,
cfg
.
SyncTxConfig
.
DbPath
,
", DbCache = "
,
cfg
.
SyncTxConfig
.
DbCache
)
db
:=
dbm
.
NewDB
(
"relayer_db_service"
,
cfg
.
SyncTxConfig
.
Dbdriver
,
cfg
.
SyncTxConfig
.
DbPath
,
cfg
.
SyncTxConfig
.
DbCache
)
db
:=
dbm
.
NewDB
(
"relayer_db_service"
,
cfg
.
SyncTxConfig
.
Dbdriver
,
cfg
.
SyncTxConfig
.
DbPath
,
cfg
.
SyncTxConfig
.
DbCache
)
...
...
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