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
5789e907
Commit
5789e907
authored
May 12, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updata test
parent
b4d05579
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
17 deletions
+56
-17
RopstenTest.sh
plugin/dapp/x2Ethereum/cmd/build/RopstenTest.sh
+0
-0
exec_test.go
plugin/dapp/x2Ethereum/executor/exec_test.go
+13
-15
publicTest.sh
plugin/dapp/x2Ethereum/testsh/publicTest.sh
+43
-2
No files found.
plugin/dapp/x2Ethereum/cmd/build/RopstenTest.sh
0 → 100755
View file @
5789e907
This diff is collapsed.
Click to expand it.
plugin/dapp/x2Ethereum/executor/exec_test.go
View file @
5789e907
...
...
@@ -74,7 +74,7 @@ func (x *suiteX2Ethereum) SetupSuite() {
tx
.
Nonce
=
1
tx
.
Sign
(
types
.
SECP256K1
,
privFrom
)
x
.
action
=
newAction
(
x2eth
,
tx
,
0
)
x
.
action
,
_
=
newAction
(
x2eth
,
tx
,
0
)
x
.
x2eth
=
x2eth
x
.
addrX2Eth
=
address
.
ExecAddress
(
driverName
)
...
...
@@ -178,9 +178,8 @@ func (x *suiteX2Ethereum) Test_4_Eth2Chain33() {
EthereumSender
:
ethereumAddr
,
Chain33Receiver
:
chain33Receiver
,
ValidatorAddress
:
addValidator1
,
Amount
:
10
,
ClaimType
:
common2
.
LockText
,
EthSymbol
:
symbol
,
Amount
:
"10"
,
ClaimType
:
int64
(
types2
.
LOCK_CLAIM_TYPE
),
}
receipt
,
err
:=
x
.
action
.
procMsgEth2Chain33
(
payload
)
...
...
@@ -198,20 +197,20 @@ func (x *suiteX2Ethereum) Test_4_Eth2Chain33() {
x
.
query_GetEthProphecy
(
"000x7B95B6EC7EbD73572298cEf32Bb54FA408207359"
,
types2
.
EthBridgeStatus_SuccessStatusText
)
x
.
query_GetSymbolTotalAmountByTxType
(
symbol
,
1
,
"lock"
,
10
)
payload
.
Amount
=
3
payload
.
Amount
=
"3"
payload
.
Nonce
=
1
payload
.
ClaimType
=
common2
.
BurnText
payload
.
ClaimType
=
int64
(
types2
.
BURN_CLAIM_TYPE
)
payload
.
ValidatorAddress
=
addValidator1
receipt
,
err
=
x
.
action
.
procWithdrawEth
(
payload
)
x
.
NoError
(
err
)
x
.
setDb
(
receipt
)
payload
.
ValidatorAddress
=
addValidator2
payload
.
Amount
=
2
payload
.
Amount
=
"2"
receipt
,
err
=
x
.
action
.
procWithdrawEth
(
payload
)
x
.
Equal
(
err
,
types2
.
ErrClaimInconsist
)
payload
.
Amount
=
3
payload
.
Amount
=
"3"
receipt
,
err
=
x
.
action
.
procWithdrawEth
(
payload
)
x
.
NoError
(
err
)
x
.
setDb
(
receipt
)
...
...
@@ -220,7 +219,7 @@ func (x *suiteX2Ethereum) Test_4_Eth2Chain33() {
x
.
query_GetSymbolTotalAmount
(
symbol
,
1
,
7
)
x
.
query_GetSymbolTotalAmountByTxType
(
symbol
,
1
,
"withdraw"
,
3
)
payload
.
Amount
=
10
payload
.
Amount
=
"10"
payload
.
Nonce
=
2
payload
.
ValidatorAddress
=
addValidator1
receipt
,
err
=
x
.
action
.
procWithdrawEth
(
payload
)
...
...
@@ -228,9 +227,9 @@ func (x *suiteX2Ethereum) Test_4_Eth2Chain33() {
receipt
,
err
=
x
.
action
.
procWithdrawEth
(
payload
)
x
.
Equal
(
types
.
ErrNoBalance
,
err
)
payload
.
Amount
=
1
payload
.
Amount
=
"1"
payload
.
Nonce
=
3
payload
.
ClaimType
=
common2
.
LockText
payload
.
ClaimType
=
int64
(
types2
.
LOCK_CLAIM_TYPE
)
payload
.
ValidatorAddress
=
addValidator1
receipt
,
err
=
x
.
action
.
procMsgEth2Chain33
(
payload
)
x
.
setDb
(
receipt
)
...
...
@@ -248,8 +247,7 @@ func (x *suiteX2Ethereum) Test_5_Chain33ToEth() {
TokenContract
:
tokenContractAddress
,
Chain33Sender
:
addValidator1
,
EthereumReceiver
:
ethereumAddr
,
Amount
:
5
,
EthSymbol
:
symbol
,
Amount
:
"5"
,
LocalCoinSymbol
:
"bty"
,
LocalCoinExec
:
coinExec
,
}
...
...
@@ -261,7 +259,7 @@ func (x *suiteX2Ethereum) Test_5_Chain33ToEth() {
x
.
query_GetSymbolTotalAmount
(
"bty"
,
2
,
5
)
x
.
query_GetSymbolTotalAmountByTxType
(
"bty"
,
2
,
"lock"
,
5
)
msgLock
.
Amount
=
4
msgLock
.
Amount
=
"4"
receipt
,
err
=
x
.
action
.
procMsgBurn
(
msgLock
)
x
.
NoError
(
err
)
x
.
setDb
(
receipt
)
...
...
@@ -272,7 +270,7 @@ func (x *suiteX2Ethereum) Test_5_Chain33ToEth() {
receipt
,
err
=
x
.
action
.
procMsgBurn
(
msgLock
)
x
.
Equal
(
err
,
types
.
ErrNoBalance
)
msgLock
.
Amount
=
1
msgLock
.
Amount
=
"1"
receipt
,
err
=
x
.
action
.
procMsgBurn
(
msgLock
)
x
.
NoError
(
err
)
x
.
setDb
(
receipt
)
...
...
plugin/dapp/x2Ethereum/testsh/publicTest.sh
View file @
5789e907
...
...
@@ -287,6 +287,34 @@ function updata_relayer_toml() {
#sed -i 's/192.168.3.156/'${pushHost}'/g' "../build/relayer.toml"
}
# 更新配置文件 $1 为 BridgeRegistry 合约地址; $2 等待区块 默认10; $3 relayer.toml 地址
function
updata_relayer_toml_ropston
()
{
local
BridgeRegistry
=
${
1
}
local
maturityDegree
=
${
2
}
local
file
=
${
3
}
local
chain33Host
=
127.0.0.1
local
pushHost
=
127.0.0.1
local
line
=
$(
delete_line_show
${
file
}
"chain33Host"
)
# 在第 line 行后面 新增合约地址
sed
-i
''
${
line
}
' a chain33Host="http://'
${
chain33Host
}
':8801"'
"
${
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/#BridgeRegistry=\"0x40BFE5eD039A9a2Eb42ece2E2CA431bFa7Cf4c42\"/BridgeRegistry=\"'${BridgeRegistry}'\"/g' "../build/relayer.toml"
#sed -i 's/192.168.64.2/'${chain33Host}'/g' "../build/relayer.toml"
#sed -i 's/192.168.3.156/'${pushHost}'/g' "../build/relayer.toml"
}
# 更新 B C D 的配置文件
function
updata_all_relayer_toml
()
{
local
port
=
9901
...
...
@@ -409,7 +437,7 @@ function wait_prophecy_finish() {
set
-x
}
# eth 区块等待 $1:等待高度
# eth 区块等待 $1:等待高度
$2:url地址,默认为 http://localhost:7545,测试网络用 https://ropsten-rpc.linkpool.io/
function
eth_block_wait
()
{
set
+x
if
[[
$#
-lt
0
]]
;
then
...
...
@@ -417,11 +445,24 @@ function eth_block_wait() {
exit
1
fi
local
cur_height
=
$(
curl
-ksd
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
http://localhost:7545 | jq
-r
".result"
)
local
cur_height
=
""
local
new_height
=
""
local
url
=
${
2
}
if
[
"
${
url
}
"
==
""
]
;
then
cur_height
=
$(
curl
-ksd
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
http://localhost:7545 | jq
-r
".result"
)
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"
)
fi
local
expect
=
$((
cur_height
+
${
1
}
+
1
))
local
count
=
0
while
true
;
do
if
[
"
${
url
}
"
==
""
]
;
then
new_height
=
$(
curl
-ksd
'{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}'
http://localhost:7545 | jq
-r
".result"
)
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"
)
fi
if
[[
${
new_height
}
-ge
${
expect
}
]]
;
then
break
fi
...
...
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