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
8b1f50ca
Commit
8b1f50ca
authored
Oct 10, 2019
by
张振华
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into dpos-v2
parents
e3aff5f4
91390fe4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
103 additions
and
59 deletions
+103
-59
dapp-test-rpc.sh
build/dapp-test-rpc.sh
+6
-10
docker-compose.sh
build/docker-compose.sh
+8
-18
find-fork.bash
build/find-fork.bash
+44
-0
chain33.para.toml
chain33.para.toml
+7
-8
chain33.toml
chain33.toml
+3
-3
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-2
parasync.go
plugin/consensus/para/parasync.go
+5
-2
chain33.cfg.toml
plugin/consensus/ticket/testdata/chain33.cfg.toml
+4
-4
ticket_test.go
plugin/consensus/ticket/ticket_test.go
+20
-11
game_test.go
plugin/dapp/game/executor/game_test.go
+0
-0
filtertxs.go
plugin/dapp/paracross/executor/filtertxs.go
+3
-0
No files found.
build/dapp-test-rpc.sh
View file @
8b1f50ca
...
...
@@ -8,18 +8,14 @@ function dapp_test_rpc() {
local
ip
=
$1
echo
"============ # dapp rpc test begin ============="
if
[
-d
dapptest
]
;
then
cp
$DAPP_TEST_COMMON
dapptest/
cp
"
$DAPP_TEST_COMMON
"
dapptest/
cd
dapptest
||
return
dir
=
$(
find
.
-maxdepth
1
-type
d
!
-name
dapptest
!
-name
ticket
!
-name
.
|
sed
's/^\.\///'
|
sort
)
echo
"dapps list:
$dir
"
for
app
in
$dir
;
do
echo
"=========== #
$app
rpc test ============="
./
"
$app
/
${
RPC_TESTFILE
}
"
"
$ip
"
echo
"=========== #
$app
rpc end ============="
done
##ticket用例最后执行
./ticket/
"
${
RPC_TESTFILE
}
"
"
$ip
"
dapps
=
$(
find
.
-maxdepth
1
-type
d
!
-name
dapptest
!
-name
.
|
sed
's/^\.\///'
|
sort
)
echo
"dapps list:
$dapps
"
parallel
-k
--retries
3
--joblog
./testlog ./
{}
/
"
${
RPC_TESTFILE
}
"
"
$ip
"
:::
"
$dapps
"
echo
"check dapps test log"
cat
./testlog
fi
echo
"============ # dapp rpc test end ============="
}
build/docker-compose.sh
View file @
8b1f50ca
...
...
@@ -184,16 +184,12 @@ function miner() {
exit
1
fi
sleep
1
echo
"=========== # unlock wallet ============="
result
=
$(${
1
}
wallet unlock
-p
1314fuzamei
-t
0 | jq
".isok"
)
if
[
"
${
result
}
"
=
"false"
]
;
then
exit
1
fi
sleep
1
echo
"=========== # import private key returnAddr ============="
result
=
$(${
1
}
account import_key
-k
CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944
-l
returnAddr | jq
".label"
)
echo
"
${
result
}
"
...
...
@@ -201,8 +197,6 @@ function miner() {
exit
1
fi
sleep
1
echo
"=========== # import private key mining ============="
result
=
$(${
1
}
account import_key
-k
4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01
-l
minerAddr | jq
".label"
)
echo
"
${
result
}
"
...
...
@@ -210,13 +204,11 @@ function miner() {
exit
1
fi
sleep
1
echo
"=========== # close auto mining ============="
#result=$(${1} wallet auto_mine -f 0
| jq ".isok")
#
if [ "${result}" = "false" ]; then
#
exit 1
#
fi
result
=
$(${
1
}
wallet auto_mine
-f
1
| jq
".isok"
)
if
[
"
${
result
}
"
=
"false"
]
;
then
exit
1
fi
}
function
block_wait
()
{
...
...
@@ -289,7 +281,7 @@ function check_docker_container() {
function
sync_status
()
{
echo
"=========== query sync status========== "
local
sync_status
local
count
=
100
local
count
=
100
0
local
wait_sec
=
0
while
[
$count
-gt
0
]
;
do
sync_status
=
$(${
1
}
net is_sync
)
...
...
@@ -302,9 +294,9 @@ function sync_status() {
fi
((
count--
))
wait_sec
=
$((
wait_sec
+
1
))
sleep
1
sleep
0.
1
done
echo
"sync wait
${
wait_sec
}
s"
echo
"sync wait
${
wait_sec
}
/10
s"
}
function
sync
()
{
...
...
@@ -373,8 +365,6 @@ function dapp_test_address() {
exit
1
fi
sleep
1
echo
"=========== # import private key dapptest2 mining ============="
result
=
$(${
1
}
account import_key
-k
2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989
-l
dapptest2 | jq
".label"
)
echo
"
${
result
}
"
...
...
@@ -387,7 +377,7 @@ function dapp_test_address() {
exit
1
fi
sleep
1
block_wait
"
${
1
}
"
1
hash
=
$(${
1
}
send coins transfer
-a
1500
-n
transfer
-t
1PUiGcbsccfxW3zuvHXZBJfznziph5miAo
-k
2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989
)
echo
"
${
hash
}
"
...
...
build/find-fork.bash
0 → 100755
View file @
8b1f50ca
#!/bin/bash
# 在 plugin/plugin_type/plugin_name 找出fork
function
subdir_forks
()
{
plugin_dir
=
$1
plugin_name
=
$2
full_dir
=
$1
forks
=
$(
grep
types.RegisterDappFork
"
${
full_dir
}
"
-R
|
cut
-d
'('
-f
2 |
cut
-d
')'
-f
1 |
sed
's/ //g'
)
if
[
-z
"
${
forks
}
"
]
;
then
return
fi
cnt
=
$(
echo
"
${
forks
}
"
|
grep
"^
\"
"
|
wc
-l
)
if
[
$cnt
-gt
0
]
;
then
name
=
$(
echo
$forks
|
head
-n1
|
cut
-d
','
-f
1 |
sed
's/"//g'
)
echo
"[fork.sub.
${
name
}
]"
else
echo
"[fork.sub.
${
plugin_name
}
]"
;
fi
for
fork
in
"
${
forks
}
"
do
echo
"
${
fork
}
"
|
awk
-F
','
'{ \
if(match($2,"\"")) gsub("\"","",$2); else gsub("X$","",$2); \
print $2 "=" $3}'
#/*print "debug" $1 $2 $3;*/ \
done
echo
}
dir
=
$(
go list
-f
'{{.Dir}}'
github.com/33cn/plugin
)
/plugin/
plugins
=
$(
find
$dir
-maxdepth
2
-mindepth
2
-type
d |
sort
)
for
plugin
in
${
plugins
}
do
name
=
$(
echo
$plugin
|
sed
's/.*\///g'
)
subdir_forks
$plugin
$name
done
chain33.para.toml
View file @
8b1f50ca
...
...
@@ -85,19 +85,18 @@ maxTxNumber = 1600
[mver.consensus.paracross]
coinReward
=
18
coinDevFund
=
12
coinReward
=
18
coinDevFund
=
12
[consensus.sub.para]
#主链节点的grpc服务器ip,当前可以支持多ip负载均衡,如“1
01.37.227.226:8802,39.97.20.242:8802,47.107.15.126
:8802,jiedian2.bityuan.com,cloud.bityuan.com”
#ParaRemoteGrpcClient="1
83.129.226.74:8802,183.129.226.75:8802,101.37.227.226:8802,39.97.20.242:8802,47.107.15.126:8802,jiedian2.bityuan.com,cloud.bityuan.com
"
#主链节点的grpc服务器ip,当前可以支持多ip负载均衡,如“1
18.31.177.1:8802,39.97.2.127:8802,120.77.111.44
:8802,jiedian2.bityuan.com,cloud.bityuan.com”
#ParaRemoteGrpcClient="1
18.31.177.1:8802,39.97.2.127:8802,120.77.111.44:8802,jiedian2.bityuan.com,cloud.bityuan.com,183.129.226.74:8802,183.129.226.75:8802
"
ParaRemoteGrpcClient
=
"localhost:8802"
#主链指定高度的区块开始同步
startHeight
=
345850
#打包时间间隔,单位秒
writeBlockSeconds
=
2
#验证账户,验证节点需要配置自己的账户,并且钱包导入对应种子,非验证节点留空
authAccount
=
""
#云端主链节点切换后,平行链适配新主链节点block,回溯查找和自己记录的相同blockhash的深度
...
...
@@ -108,8 +107,8 @@ genesisAmount=100000000
MainForkParacrossCommitTx
=
2270000
#平行链自共识开启对应的主链高度,需要大于等于MainForkParacrossCommitTx=2270000, -1 不开启
MainParaSelfConsensusForkHeight
=
-1
#主链开启循环检查共识交易done的fork高度
MainLoopCheckCommitTxDoneForkHeight
=
-1
#主链开启循环检查共识交易done的fork高度
,需要和主链保持严格一致,不可修改,4320000是bityuan主链对应高度, ycc或其他按实际修改
MainLoopCheckCommitTxDoneForkHeight
=
4320000
#主链每隔几个没有相关平行链交易的区块,平行链上打包空区块,缺省从平行链blockHeight=0开始,依次增长,空块间隔不能为0
[[consensus.sub.para.emptyBlockInterval]]
blockHeight
=
0
...
...
@@ -250,7 +249,7 @@ ForkTradePrice = 0
Enable
=
0
ForkParacrossWithdrawFromParachain
=
0
ForkParacrossCommitTx
=
0
ForkLoopCheckCommitTxDone
=
-1
ForkLoopCheckCommitTxDone
=
0
[fork.sub.evm]
Enable
=
0
...
...
chain33.toml
View file @
8b1f50ca
Title
=
"chain33"
TestNet
=
true
FixTime
=
false
version
=
"6.2.0"
version
=
"6.3.0"
[log]
# 日志级别,支持debug(dbug)/info/warn/error(eror)/crit
...
...
@@ -235,4 +236,4 @@ paraConsensusStopBlocks=30000
[exec.sub.autonomy]
total
=
"16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
useBalance
=
false
\ No newline at end of file
useBalance
=
false
go.mod
View file @
8b1f50ca
...
...
@@ -3,7 +3,7 @@ module github.com/33cn/plugin
go 1.12
require (
github.com/33cn/chain33 v0.0.0-20190925
060849-e4f820a6390e
github.com/33cn/chain33 v0.0.0-20190925
142515-31e357c36c74
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac
...
...
go.sum
View file @
8b1f50ca
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/33cn/chain33 v0.0.0-20190925
060849-e4f820a6390e h1:Wb1JboAH5FMilArO9dyrmwgKPTn3V6Qz34ZSRn+K11s
=
github.com/33cn/chain33 v0.0.0-20190925
060849-e4f820a6390e
/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
github.com/33cn/chain33 v0.0.0-20190925
142515-31e357c36c74 h1:8PC5TDbLIV5haxz3uhiSS2zrgDwkAFQKOSa6KgNTn9c
=
github.com/33cn/chain33 v0.0.0-20190925
142515-31e357c36c74
/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 h1:PqzgE6kAMi81xWQA2QIVxjWkFHptGgC547vchpUbtFo=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
...
...
plugin/consensus/para/parasync.go
View file @
8b1f50ca
...
...
@@ -359,12 +359,15 @@ func (client *blockSyncClient) addMinerTx(preStateHash []byte, block *types.Bloc
status
:=
&
pt
.
ParacrossNodeStatus
{
Title
:
types
.
GetTitle
(),
Height
:
block
.
Height
,
PreBlockHash
:
block
.
ParentHash
,
PreStateHash
:
preStateHash
,
MainBlockHash
:
localBlock
.
MainHash
,
MainBlockHeight
:
localBlock
.
MainHeight
,
}
if
!
pt
.
IsParaForkHeight
(
status
.
MainBlockHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
status
.
PreBlockHash
=
block
.
ParentHash
status
.
PreStateHash
=
preStateHash
}
tx
,
err
:=
pt
.
CreateRawMinerTx
(
&
pt
.
ParacrossMinerAction
{
Status
:
status
,
IsSelfConsensus
:
client
.
paraClient
.
isParaSelfConsensusForked
(
status
.
MainBlockHeight
),
...
...
plugin/consensus/ticket/testdata/chain33.cfg.toml
View file @
8b1f50ca
...
...
@@ -2,6 +2,7 @@ Title="local"
TestNet
=
true
FixTime
=
false
[log]
# 日志级别,支持debug(dbug)/info/warn/error(eror)/crit
loglevel
=
"debug"
...
...
@@ -82,7 +83,7 @@ maxTxNumber = 1600
maxTxNumber
=
10000
[mver.consensus.ForkChainParamV2]
powLimitBits
=
"0x
1
f2fffff"
powLimitBits
=
"0x
2
f2fffff"
[mver.consensus.ForkTicketFundAddrV1]
fundKeyAddr
=
"1Ji3W12KGScCM7C2p8bg635sNkayDM8MGY"
...
...
@@ -113,7 +114,7 @@ genesisBlockTime=1514533394
[[consensus.sub.ticket.genesis]]
minerAddr
=
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
returnAddr
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
count
=
10
000
count
=
3
000
[[consensus.sub.ticket.genesis]]
minerAddr
=
"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
...
...
@@ -185,4 +186,4 @@ superManager=[
[exec.sub.autonomy]
total
=
"16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
useBalance
=
false
\ No newline at end of file
useBalance
=
false
plugin/consensus/ticket/ticket_test.go
View file @
8b1f50ca
...
...
@@ -8,6 +8,7 @@ import (
"crypto/ecdsa"
"fmt"
"testing"
"time"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common/crypto"
...
...
@@ -68,20 +69,28 @@ func testTicket(t *testing.T) {
status
,
err
=
mock33
.
GetAPI
()
.
GetWalletStatus
()
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
true
,
status
.
IsAutoMining
)
err
=
mock33
.
WaitHeight
(
50
)
assert
.
Nil
(
t
,
err
)
//查询票是否自动close,并且购买了新的票
req
:=
&
types
.
ReqWalletTransactionList
{
Count
:
1000
}
list
,
err
:=
mock33
.
GetAPI
()
.
WalletTransactionList
(
req
)
assert
.
Nil
(
t
,
err
)
start
:=
time
.
Now
()
height
:=
int64
(
0
)
hastclose
:=
false
hastopen
:=
false
for
_
,
tx
:=
range
list
.
TxDetails
{
if
tx
.
ActionName
==
"tclose"
&&
tx
.
Receipt
.
Ty
==
2
{
hastclose
=
true
for
{
height
+=
20
err
=
mock33
.
WaitHeight
(
height
)
assert
.
Nil
(
t
,
err
)
//查询票是否自动close,并且购买了新的票
req
:=
&
types
.
ReqWalletTransactionList
{
Count
:
1000
}
list
,
err
:=
mock33
.
GetAPI
()
.
WalletTransactionList
(
req
)
assert
.
Nil
(
t
,
err
)
for
_
,
tx
:=
range
list
.
TxDetails
{
if
tx
.
ActionName
==
"tclose"
&&
tx
.
Receipt
.
Ty
==
2
{
hastclose
=
true
}
if
tx
.
ActionName
==
"topen"
&&
tx
.
Receipt
.
Ty
==
2
{
hastopen
=
true
}
}
if
tx
.
ActionName
==
"topen"
&&
tx
.
Receipt
.
Ty
==
2
{
hastopen
=
true
if
hastopen
==
true
&&
hastclose
==
true
||
time
.
Since
(
start
)
>
100
*
time
.
Second
{
break
}
}
assert
.
Equal
(
t
,
true
,
hastclose
)
...
...
plugin/dapp/game/executor/game_test.go
0 → 100644
View file @
8b1f50ca
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/executor/filtertxs.go
View file @
8b1f50ca
...
...
@@ -6,6 +6,7 @@ package executor
import
(
"bytes"
"encoding/hex"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/types"
...
...
@@ -65,6 +66,7 @@ func filterParaTxGroup(tx *types.Transaction, allTxs []*types.TxDetail, index in
}
if
!
checkReceiptExecOk
(
allTxs
[
i
]
.
Receipt
)
{
clog
.
Error
(
"filterParaTxGroup rmv tx group"
,
"txhash"
,
hex
.
EncodeToString
(
allTxs
[
i
]
.
Tx
.
Hash
()))
return
nil
,
endIdx
}
}
...
...
@@ -90,6 +92,7 @@ func FilterTxsForPara(main *types.ParaTxDetail) []*types.Transaction {
}
//单独的paracross tx 如果主链执行失败也要排除, 6.2fork原因 没有排除 非user.p.xx.paracross的平行链交易
if
main
.
Header
.
Height
>=
forkHeight
&&
bytes
.
HasSuffix
(
tx
.
Execer
,
[]
byte
(
pt
.
ParaX
))
&&
!
checkReceiptExecOk
(
main
.
TxDetails
[
i
]
.
Receipt
)
{
clog
.
Error
(
"FilterTxsForPara rmv tx"
,
"txhash"
,
hex
.
EncodeToString
(
tx
.
Hash
()))
continue
}
...
...
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