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
b57b7c5b
Commit
b57b7c5b
authored
Oct 22, 2021
by
mdj33
Committed by
vipwzw
Oct 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ut
parent
51a3e896
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
31 deletions
+39
-31
build_paracross.yml
.github/workflows/build_paracross.yml
+19
-1
build_paracross_bls.yml
.github/workflows/build_paracross_bls.yml
+0
-21
chain33.para.toml
chain33.para.toml
+2
-0
para.go
plugin/consensus/para/para.go
+4
-0
parablssign.go
plugin/consensus/para/parablssign.go
+10
-5
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+4
-4
No files found.
.github/workflows/build_paracross.yml
View file @
b57b7c5b
...
@@ -2,7 +2,7 @@ name: ci_paracross
...
@@ -2,7 +2,7 @@ name: ci_paracross
on
:
[
push
,
pull_request
]
on
:
[
push
,
pull_request
]
jobs
:
jobs
:
ci_
paracross
:
paracross
:
name
:
ci_paracross
name
:
ci_paracross
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
steps
:
steps
:
...
@@ -19,3 +19,21 @@ jobs:
...
@@ -19,3 +19,21 @@ jobs:
run
:
|
run
:
|
make docker-compose dapp=paracross
make docker-compose dapp=paracross
make docker-compose-down dapp=paracross
make docker-compose-down dapp=paracross
bls
:
name
:
bls
runs-on
:
ubuntu-latest
steps
:
-
name
:
Set up Golang
uses
:
actions/setup-go@v2
with
:
go-version
:
1.15
id
:
go
-
name
:
set go env
run
:
export PATH=${PATH}:`go env GOPATH`/bin
-
name
:
checkout
uses
:
actions/checkout@v2
-
name
:
deploy
run
:
|
make docker-compose dapp=paracross extra=1
make docker-compose-down dapp=paracross
.github/workflows/build_paracross_bls.yml
deleted
100644 → 0
View file @
51a3e896
name
:
ci_paracross_bls
on
:
[
push
,
pull_request
]
jobs
:
ci_paracross
:
name
:
ci_paracross_bls
runs-on
:
ubuntu-latest
steps
:
-
name
:
Set up Golang
uses
:
actions/setup-go@v2
with
:
go-version
:
1.15
id
:
go
-
name
:
set go env
run
:
export PATH=${PATH}:`go env GOPATH`/bin
-
name
:
checkout
uses
:
actions/checkout@v2
-
name
:
deploy
run
:
|
make docker-compose dapp=paracross extra=1
make docker-compose-down dapp=paracross
chain33.para.toml
View file @
b57b7c5b
...
@@ -131,7 +131,9 @@ mainLoopCheckCommitTxDoneForkHeight=4320000
...
@@ -131,7 +131,9 @@ mainLoopCheckCommitTxDoneForkHeight=4320000
#无平行链交易的主链区块间隔,平行链产生一个空块,从高度0开始,配置[blockHeight:interval],比如["0:50","1000:100"]
#无平行链交易的主链区块间隔,平行链产生一个空块,从高度0开始,配置[blockHeight:interval],比如["0:50","1000:100"]
emptyBlockInterval
=
["0:50"]
emptyBlockInterval
=
["0:50"]
#平行链共识节点聚合签名配置
[consensus.sub.para.bls]
[consensus.sub.para.bls]
#是否开启聚合签名,缺省不开启
blsSign
=
false
blsSign
=
false
...
...
plugin/consensus/para/para.go
View file @
b57b7c5b
...
@@ -340,6 +340,10 @@ func (client *client) ProcEvent(msg *queue.Message) bool {
...
@@ -340,6 +340,10 @@ func (client *client) ProcEvent(msg *queue.Message) bool {
return
true
return
true
}
}
plog
.
Info
(
"paracross ProcEvent"
,
"from"
,
req
.
GetFrom
(),
"topic:"
,
req
.
GetTopic
(),
"ty"
,
sub
.
GetTy
())
plog
.
Info
(
"paracross ProcEvent"
,
"from"
,
req
.
GetFrom
(),
"topic:"
,
req
.
GetTopic
(),
"ty"
,
sub
.
GetTy
())
if
!
client
.
blsSignCli
.
blsSignOn
{
plog
.
Error
(
"paracross ProcEvent bls is closed"
)
return
true
}
switch
sub
.
GetTy
()
{
switch
sub
.
GetTy
()
{
case
P2pSubCommitTx
:
case
P2pSubCommitTx
:
go
client
.
blsSignCli
.
rcvCommitTx
(
sub
.
GetCommitTx
())
go
client
.
blsSignCli
.
rcvCommitTx
(
sub
.
GetCommitTx
())
...
...
plugin/consensus/para/parablssign.go
View file @
b57b7c5b
...
@@ -50,6 +50,7 @@ type blsClient struct {
...
@@ -50,6 +50,7 @@ type blsClient struct {
peersBlsPubKey
map
[
string
]
crypto
.
PubKey
peersBlsPubKey
map
[
string
]
crypto
.
PubKey
commitsPool
map
[
int64
]
*
pt
.
ParaBlsSignSumDetails
commitsPool
map
[
int64
]
*
pt
.
ParaBlsSignSumDetails
rcvCommitTxCh
chan
[]
*
pt
.
ParacrossCommitAction
rcvCommitTxCh
chan
[]
*
pt
.
ParacrossCommitAction
blsSignOn
bool
leaderOffset
int32
leaderOffset
int32
leaderSwitchInt
int32
leaderSwitchInt
int32
leaderHeardTickInt
int32
leaderHeardTickInt
int32
...
@@ -74,24 +75,28 @@ func newBlsClient(para *client, cfg *subConfig) *blsClient {
...
@@ -74,24 +75,28 @@ func newBlsClient(para *client, cfg *subConfig) *blsClient {
b
.
rcvCommitTxCh
=
make
(
chan
[]
*
pt
.
ParacrossCommitAction
,
maxRcvTxCount
)
b
.
rcvCommitTxCh
=
make
(
chan
[]
*
pt
.
ParacrossCommitAction
,
maxRcvTxCount
)
b
.
quit
=
make
(
chan
struct
{})
b
.
quit
=
make
(
chan
struct
{})
b
.
leaderSwitchInt
=
defLeaderSwitchInt
b
.
leaderSwitchInt
=
defLeaderSwitchInt
b
.
leaderHeardTickInt
=
defLeaderHeardTickInt
b
.
watchLeaderSyncInt
=
defWatchLeaderSyncInt
b
.
consensHeightDiffThreshold
=
defConsensHeightThreshold
if
cfg
.
Bls
!=
nil
{
b
.
blsSignOn
=
cfg
.
Bls
.
BlsSign
if
cfg
.
Bls
.
LeaderSwitchInt
>
0
{
if
cfg
.
Bls
.
LeaderSwitchInt
>
0
{
b
.
leaderSwitchInt
=
cfg
.
Bls
.
LeaderSwitchInt
b
.
leaderSwitchInt
=
cfg
.
Bls
.
LeaderSwitchInt
}
}
b
.
leaderHeardTickInt
=
defLeaderHeardTickInt
if
cfg
.
Bls
.
LeaderHeardTickInt
>
0
{
if
cfg
.
Bls
.
LeaderHeardTickInt
>
0
{
b
.
leaderHeardTickInt
=
cfg
.
Bls
.
LeaderHeardTickInt
b
.
leaderHeardTickInt
=
cfg
.
Bls
.
LeaderHeardTickInt
}
}
b
.
watchLeaderSyncInt
=
defWatchLeaderSyncInt
if
cfg
.
Bls
.
WatchLeaderSyncInt
>
0
{
if
cfg
.
Bls
.
WatchLeaderSyncInt
>
0
{
b
.
watchLeaderSyncInt
=
cfg
.
Bls
.
WatchLeaderSyncInt
b
.
watchLeaderSyncInt
=
cfg
.
Bls
.
WatchLeaderSyncInt
}
}
b
.
consensHeightDiffThreshold
=
defConsensHeightThreshold
if
cfg
.
Bls
.
ConsensHeightDiffThreshold
>
0
{
if
cfg
.
Bls
.
ConsensHeightDiffThreshold
>
0
{
b
.
consensHeightDiffThreshold
=
cfg
.
Bls
.
ConsensHeightDiffThreshold
b
.
consensHeightDiffThreshold
=
cfg
.
Bls
.
ConsensHeightDiffThreshold
}
}
if
cfg
.
Bls
.
PartNodeGroup
>
0
{
if
cfg
.
Bls
.
PartNodeGroup
>
0
{
b
.
partNodeGroup
=
cfg
.
Bls
.
PartNodeGroup
b
.
partNodeGroup
=
cfg
.
Bls
.
PartNodeGroup
}
}
}
b
.
typeNode
=
pt
.
ParaCommitNode
b
.
typeNode
=
pt
.
ParaCommitNode
...
@@ -107,7 +112,7 @@ func newBlsClient(para *client, cfg *subConfig) *blsClient {
...
@@ -107,7 +112,7 @@ func newBlsClient(para *client, cfg *subConfig) *blsClient {
*/
*/
func
(
b
*
blsClient
)
procLeaderSync
()
{
func
(
b
*
blsClient
)
procLeaderSync
()
{
defer
b
.
paraClient
.
wg
.
Done
()
defer
b
.
paraClient
.
wg
.
Done
()
if
len
(
b
.
selfID
)
<=
0
{
if
len
(
b
.
selfID
)
<=
0
||
!
b
.
blsSignOn
{
return
return
}
}
...
@@ -279,7 +284,7 @@ func (b *blsClient) clearDonePool(consensHeight int64) {
...
@@ -279,7 +284,7 @@ func (b *blsClient) clearDonePool(consensHeight int64) {
//1. 要等到达成共识了才发送,不然处理未达成共识的各种场景会比较复杂,而且浪费手续费
//1. 要等到达成共识了才发送,不然处理未达成共识的各种场景会比较复杂,而且浪费手续费
func
(
b
*
blsClient
)
procAggregateTxs
()
{
func
(
b
*
blsClient
)
procAggregateTxs
()
{
defer
b
.
paraClient
.
wg
.
Done
()
defer
b
.
paraClient
.
wg
.
Done
()
if
len
(
b
.
selfID
)
<=
0
{
if
len
(
b
.
selfID
)
<=
0
||
!
b
.
blsSignOn
{
return
return
}
}
...
...
plugin/consensus/para/paracommitmsg.go
View file @
b57b7c5b
...
@@ -193,7 +193,7 @@ func (client *commitMsgClient) createCommitTx() {
...
@@ -193,7 +193,7 @@ func (client *commitMsgClient) createCommitTx() {
return
return
}
}
//如果配置了blsSign 则发送到p2p的leader节点来聚合发送,否则发送到主链
//如果配置了blsSign 则发送到p2p的leader节点来聚合发送,否则发送到主链
if
client
.
paraClient
.
subCfg
.
Bls
.
BlsSig
n
{
if
client
.
paraClient
.
blsSignCli
.
blsSignO
n
{
plog
.
Debug
(
"bls.event.para bls commitMs send to p2p"
,
"hash"
,
common
.
ToHex
(
tx
.
Hash
()))
plog
.
Debug
(
"bls.event.para bls commitMs send to p2p"
,
"hash"
,
common
.
ToHex
(
tx
.
Hash
()))
act
:=
&
pt
.
ParaP2PSubMsg
{
Ty
:
P2pSubCommitTx
,
Value
:
&
pt
.
ParaP2PSubMsg_CommitTx
{
CommitTx
:
tx
}}
act
:=
&
pt
.
ParaP2PSubMsg
{
Ty
:
P2pSubCommitTx
,
Value
:
&
pt
.
ParaP2PSubMsg_CommitTx
{
CommitTx
:
tx
}}
client
.
paraClient
.
SendPubP2PMsg
(
paraBlsSignTopic
,
types
.
Encode
(
act
))
client
.
paraClient
.
SendPubP2PMsg
(
paraBlsSignTopic
,
types
.
Encode
(
act
))
...
@@ -260,7 +260,7 @@ func (client *commitMsgClient) sendCommitActions(acts []*pt.ParacrossCommitActio
...
@@ -260,7 +260,7 @@ func (client *commitMsgClient) sendCommitActions(acts []*pt.ParacrossCommitActio
//如果当前正在发送交易,则取消此次发送,待发送被确认或取消后再触发. 考虑到已经聚合共识成功,又收到某节点消息场景,会多发送交易
//如果当前正在发送交易,则取消此次发送,待发送被确认或取消后再触发. 考虑到已经聚合共识成功,又收到某节点消息场景,会多发送交易
curTx
:=
client
.
getCurrentTx
()
curTx
:=
client
.
getCurrentTx
()
if
curTx
!=
nil
{
if
curTx
!=
nil
{
plog
.
Info
(
"paracommitmsg isSendingCommitMsg, cancel this operation"
,
"sending.tx"
,
common
.
ToHex
(
curTx
.
Hash
()))
plog
.
Info
(
"
bls.event.
paracommitmsg isSendingCommitMsg, cancel this operation"
,
"sending.tx"
,
common
.
ToHex
(
curTx
.
Hash
()))
return
return
}
}
...
@@ -268,7 +268,7 @@ func (client *commitMsgClient) sendCommitActions(acts []*pt.ParacrossCommitActio
...
@@ -268,7 +268,7 @@ func (client *commitMsgClient) sendCommitActions(acts []*pt.ParacrossCommitActio
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
plog
.
Info
(
"paracommitmsg sendCommitActions"
,
"txhash"
,
common
.
ToHex
(
txs
.
Hash
()))
plog
.
Info
(
"
bls.event.
paracommitmsg sendCommitActions"
,
"txhash"
,
common
.
ToHex
(
txs
.
Hash
()))
for
i
,
msg
:=
range
acts
{
for
i
,
msg
:=
range
acts
{
plog
.
Debug
(
"paracommitmsg sendCommitActions"
,
"idx"
,
i
,
"height"
,
msg
.
Status
.
Height
,
"mainheight"
,
msg
.
Status
.
MainBlockHeight
,
plog
.
Debug
(
"paracommitmsg sendCommitActions"
,
"idx"
,
i
,
"height"
,
msg
.
Status
.
Height
,
"mainheight"
,
msg
.
Status
.
MainBlockHeight
,
"blockhash"
,
common
.
HashHex
(
msg
.
Status
.
BlockHash
),
"mainHash"
,
common
.
HashHex
(
msg
.
Status
.
MainBlockHash
),
"blockhash"
,
common
.
HashHex
(
msg
.
Status
.
BlockHash
),
"mainHash"
,
common
.
HashHex
(
msg
.
Status
.
MainBlockHash
),
...
@@ -436,7 +436,7 @@ func (client *commitMsgClient) getSendingTx(startHeight, endHeight int64) (*type
...
@@ -436,7 +436,7 @@ func (client *commitMsgClient) getSendingTx(startHeight, endHeight int64) (*type
commits
=
append
(
commits
,
&
pt
.
ParacrossCommitAction
{
Status
:
stat
})
commits
=
append
(
commits
,
&
pt
.
ParacrossCommitAction
{
Status
:
stat
})
}
}
if
client
.
paraClient
.
subCfg
.
Bls
.
BlsSig
n
{
if
client
.
paraClient
.
blsSignCli
.
blsSignO
n
{
err
=
client
.
paraClient
.
blsSignCli
.
blsSign
(
commits
)
err
=
client
.
paraClient
.
blsSignCli
.
blsSign
(
commits
)
if
err
!=
nil
{
if
err
!=
nil
{
plog
.
Error
(
"paracommitmsg bls sign"
,
"err"
,
err
)
plog
.
Error
(
"paracommitmsg bls sign"
,
"err"
,
err
)
...
...
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