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
b7088025
Commit
b7088025
authored
Oct 22, 2021
by
mdj33
Committed by
vipwzw
Oct 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bls improve
parent
a0eade8b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
115 additions
and
75 deletions
+115
-75
build.yml
.github/workflows/build.yml
+1
-1
build_cross2eth.yml
.github/workflows/build_cross2eth.yml
+1
-1
build_mix.yml
.github/workflows/build_mix.yml
+1
-1
build_paracross.yml
.github/workflows/build_paracross.yml
+1
-1
build_paracross_bls.yml
.github/workflows/build_paracross_bls.yml
+21
-0
build_relay.yml
.github/workflows/build_relay.yml
+1
-1
chain33.para.toml
chain33.para.toml
+3
-0
para.go
plugin/consensus/para/para.go
+23
-24
parablssign.go
plugin/consensus/para/parablssign.go
+0
-0
parablssign.md
plugin/consensus/para/parablssign.md
+5
-1
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+15
-7
paraquery.go
plugin/consensus/para/paraquery.go
+2
-2
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+7
-11
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+1
-1
paracross.pb.go
plugin/dapp/paracross/types/paracross.pb.go
+33
-24
No files found.
.github/workflows/build.yml
View file @
b7088025
name
:
build
name
:
ci_base
on
:
[
push
,
pull_request
]
on
:
[
push
,
pull_request
]
jobs
:
jobs
:
...
...
.github/workflows/build_cross2eth.yml
View file @
b7088025
name
:
build
name
:
ci_cross2eth
on
:
[
push
,
pull_request
]
on
:
[
push
,
pull_request
]
jobs
:
jobs
:
...
...
.github/workflows/build_mix.yml
View file @
b7088025
name
:
build
name
:
ci_mix
on
:
[
push
,
pull_request
]
on
:
[
push
,
pull_request
]
jobs
:
jobs
:
...
...
.github/workflows/build_paracross.yml
View file @
b7088025
name
:
build
name
:
ci_paracross
on
:
[
push
,
pull_request
]
on
:
[
push
,
pull_request
]
jobs
:
jobs
:
...
...
.github/workflows/build_paracross_bls.yml
0 → 100644
View file @
b7088025
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
.github/workflows/build_relay.yml
View file @
b7088025
name
:
build
name
:
ci_relay
on
:
[
push
,
pull_request
]
on
:
[
push
,
pull_request
]
jobs
:
jobs
:
...
...
chain33.para.toml
View file @
b7088025
...
@@ -131,6 +131,9 @@ mainLoopCheckCommitTxDoneForkHeight=4320000
...
@@ -131,6 +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]
blsSign
=
false
[store]
[store]
name
=
"kvmvccmavl"
name
=
"kvmvccmavl"
...
...
plugin/consensus/para/para.go
View file @
b7088025
...
@@ -70,29 +70,28 @@ type client struct {
...
@@ -70,29 +70,28 @@ type client struct {
}
}
type
subConfig
struct
{
type
subConfig
struct
{
WriteBlockSeconds
int64
`json:"writeBlockSeconds,omitempty"`
WriteBlockSeconds
int64
`json:"writeBlockSeconds,omitempty"`
ParaRemoteGrpcClient
string
`json:"paraRemoteGrpcClient,omitempty"`
ParaRemoteGrpcClient
string
`json:"paraRemoteGrpcClient,omitempty"`
StartHeight
int64
`json:"startHeight,omitempty"`
StartHeight
int64
`json:"startHeight,omitempty"`
WaitMainBlockNum
int64
`json:"waitMainBlockNum,omitempty"`
WaitMainBlockNum
int64
`json:"waitMainBlockNum,omitempty"`
GenesisStartHeightSame
bool
`json:"genesisStartHeightSame,omitempty"`
GenesisStartHeightSame
bool
`json:"genesisStartHeightSame,omitempty"`
EmptyBlockInterval
[]
string
`json:"emptyBlockInterval,omitempty"`
EmptyBlockInterval
[]
string
`json:"emptyBlockInterval,omitempty"`
AuthAccount
string
`json:"authAccount,omitempty"`
AuthAccount
string
`json:"authAccount,omitempty"`
WaitBlocks4CommitMsg
int32
`json:"waitBlocks4CommitMsg,omitempty"`
WaitBlocks4CommitMsg
int32
`json:"waitBlocks4CommitMsg,omitempty"`
GenesisAmount
int64
`json:"genesisAmount,omitempty"`
GenesisAmount
int64
`json:"genesisAmount,omitempty"`
MainBlockHashForkHeight
int64
`json:"mainBlockHashForkHeight,omitempty"`
MainBlockHashForkHeight
int64
`json:"mainBlockHashForkHeight,omitempty"`
WaitConsensStopTimes
uint32
`json:"waitConsensStopTimes,omitempty"`
WaitConsensStopTimes
uint32
`json:"waitConsensStopTimes,omitempty"`
MaxCacheCount
int64
`json:"maxCacheCount,omitempty"`
MaxCacheCount
int64
`json:"maxCacheCount,omitempty"`
MaxSyncErrCount
int32
`json:"maxSyncErrCount,omitempty"`
MaxSyncErrCount
int32
`json:"maxSyncErrCount,omitempty"`
BatchFetchBlockCount
int64
`json:"batchFetchBlockCount,omitempty"`
BatchFetchBlockCount
int64
`json:"batchFetchBlockCount,omitempty"`
ParaConsensStartHeight
int64
`json:"paraConsensStartHeight,omitempty"`
ParaConsensStartHeight
int64
`json:"paraConsensStartHeight,omitempty"`
MultiDownloadOpen
bool
`json:"multiDownloadOpen,omitempty"`
MultiDownloadOpen
bool
`json:"multiDownloadOpen,omitempty"`
MultiDownInvNumPerJob
int64
`json:"multiDownInvNumPerJob,omitempty"`
MultiDownInvNumPerJob
int64
`json:"multiDownInvNumPerJob,omitempty"`
MultiDownJobBuffNum
uint32
`json:"multiDownJobBuffNum,omitempty"`
MultiDownJobBuffNum
uint32
`json:"multiDownJobBuffNum,omitempty"`
MultiDownServerRspTime
uint32
`json:"multiDownServerRspTime,omitempty"`
MultiDownServerRspTime
uint32
`json:"multiDownServerRspTime,omitempty"`
RmCommitParamMainHeight
int64
`json:"rmCommitParamMainHeight,omitempty"`
RmCommitParamMainHeight
int64
`json:"rmCommitParamMainHeight,omitempty"`
JumpDownloadClose
bool
`json:"jumpDownloadClose,omitempty"`
JumpDownloadClose
bool
`json:"jumpDownloadClose,omitempty"`
BlsSign
bool
`json:"blsSign,omitempty"`
Bls
*
blsConfig
`json:"bls,omitempty"`
BlsLeaderSwitchIntval
int32
`json:"blsLeaderSwitchIntval,omitempty"`
}
}
// New function to init paracross env
// New function to init paracross env
...
@@ -347,7 +346,7 @@ func (client *client) ProcEvent(msg *queue.Message) bool {
...
@@ -347,7 +346,7 @@ func (client *client) ProcEvent(msg *queue.Message) bool {
case
P2pSubLeaderSyncMsg
:
case
P2pSubLeaderSyncMsg
:
err
:=
client
.
blsSignCli
.
rcvLeaderSyncTx
(
sub
.
GetSyncMsg
())
err
:=
client
.
blsSignCli
.
rcvLeaderSyncTx
(
sub
.
GetSyncMsg
())
if
err
!=
nil
{
if
err
!=
nil
{
plog
.
Error
(
"paracross ProcEvent leader sync msg"
,
"err"
,
err
)
plog
.
Error
(
"
bls.event.
paracross ProcEvent leader sync msg"
,
"err"
,
err
)
}
}
default
:
default
:
plog
.
Error
(
"paracross ProcEvent not support"
,
"ty"
,
sub
.
GetTy
())
plog
.
Error
(
"paracross ProcEvent not support"
,
"ty"
,
sub
.
GetTy
())
...
...
plugin/consensus/para/parablssign.go
View file @
b7088025
This diff is collapsed.
Click to expand it.
plugin/consensus/para/parablssign.md
View file @
b7088025
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
#1. 订阅P2P topic
#1. 订阅P2P topic
1.
以PARA-BLS-SIGN-TOPIC为topic在P2P订阅,平行链内部节点间通过p2p广播同步消息,比如这里bls签名交易和leader同步消息
1.
以PARA-BLS-SIGN-TOPIC为topic在P2P订阅,平行链内部节点间通过p2p DHT机制广播同步消息,
1.
消息有两类,一类是leader心跳和监听消息,leader广播心跳消息,候选节点监听心跳,如果超时没收到,则自动选择下一个节点为leader
1.
另一类是bls签名共识交易,广播出来,由leader节点聚合发送
#2. 协商leader
#2. 协商leader
1.
考虑到leader轮换发送共识交易,每隔一定共识高度比如100就会轮换下一个节点为leader发送交易,当前共识高度/100后对nodegroup 地址取余base值就是当前leader地址
1.
考虑到leader轮换发送共识交易,每隔一定共识高度比如100就会轮换下一个节点为leader发送交易,当前共识高度/100后对nodegroup 地址取余base值就是当前leader地址
...
@@ -15,6 +17,8 @@
...
@@ -15,6 +17,8 @@
#3. 发送聚合共识交易
#3. 发送聚合共识交易
1.
共识交易P2P广播给所有订阅的节点,leader节点负责聚合后上链,如果收集的签名交易不超过2/3节点,则不发送上链交易,聚合交易最终在主链达成共识
1.
共识交易P2P广播给所有订阅的节点,leader节点负责聚合后上链,如果收集的签名交易不超过2/3节点,则不发送上链交易,聚合交易最终在主链达成共识
1.
节点广播共识交易后,超过一定时间共识高度没增长,重新发送共识交易
1.
节点广播共识交易后,超过一定时间共识高度没增长,重新发送共识交易
1.
leader节点长时间未发送成功共识交易,共识高度超过和链高度阈值,任一达成共识的节点都可发送
1.
用户可手工设置达成共识的节点数,可以少于2/3个,其他节点可以选择非聚合签名,直接发送
#4. BLS聚合签名算法
#4. BLS聚合签名算法
...
...
plugin/consensus/para/paracommitmsg.go
View file @
b7088025
...
@@ -6,6 +6,7 @@ package para
...
@@ -6,6 +6,7 @@ package para
import
(
import
(
"context"
"context"
"encoding/hex"
"time"
"time"
"strings"
"strings"
...
@@ -191,10 +192,9 @@ func (client *commitMsgClient) createCommitTx() {
...
@@ -191,10 +192,9 @@ func (client *commitMsgClient) createCommitTx() {
if
tx
==
nil
{
if
tx
==
nil
{
return
return
}
}
//bls sign, send to p2p
//如果配置了blsSign 则发送到p2p的leader节点来聚合发送,否则发送到主链
if
client
.
paraClient
.
subCfg
.
BlsSign
{
if
client
.
paraClient
.
subCfg
.
Bls
.
BlsSign
{
//send to p2p pubsub
plog
.
Debug
(
"bls.event.para bls commitMs send to p2p"
,
"hash"
,
common
.
ToHex
(
tx
.
Hash
()))
plog
.
Info
(
"para 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
))
return
return
...
@@ -255,16 +255,24 @@ func (client *commitMsgClient) pushCommitTx(signTx *types.Transaction) {
...
@@ -255,16 +255,24 @@ func (client *commitMsgClient) pushCommitTx(signTx *types.Transaction) {
client
.
sendMsgCh
<-
signTx
client
.
sendMsgCh
<-
signTx
}
}
//根据收集的commit action,签名发送, 比如BLS签名后的commit msg
func
(
client
*
commitMsgClient
)
sendCommitActions
(
acts
[]
*
pt
.
ParacrossCommitAction
)
{
func
(
client
*
commitMsgClient
)
sendCommitActions
(
acts
[]
*
pt
.
ParacrossCommitAction
)
{
//如果当前正在发送交易,则取消此次发送,待发送被确认或取消后再触发. 考虑到已经聚合共识成功,又收到某节点消息场景,会多发送交易
curTx
:=
client
.
getCurrentTx
()
if
curTx
!=
nil
{
plog
.
Info
(
"paracommitmsg isSendingCommitMsg, cancel this operation"
,
"sending.tx"
,
common
.
ToHex
(
curTx
.
Hash
()))
return
}
txs
,
_
,
err
:=
client
.
createCommitMsgTxs
(
acts
)
txs
,
_
,
err
:=
client
.
createCommitMsgTxs
(
acts
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
plog
.
Debug
(
"paracommitmsg sendCommitActions"
,
"txhash"
,
common
.
ToHex
(
txs
.
Hash
()))
plog
.
Info
(
"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
),
"addrsmap"
,
common
.
ToHex
(
msg
.
Bls
.
AddrsMap
),
"sign"
,
common
.
ToHex
(
msg
.
Bls
.
Sign
))
"addrsmap"
,
hex
.
EncodeToString
(
msg
.
Bls
.
AddrsMap
),
"sign"
,
common
.
ToHex
(
msg
.
Bls
.
Sign
))
}
}
client
.
pushCommitTx
(
txs
)
client
.
pushCommitTx
(
txs
)
}
}
...
@@ -428,7 +436,7 @@ func (client *commitMsgClient) getSendingTx(startHeight, endHeight int64) (*type
...
@@ -428,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
.
BlsSign
{
if
client
.
paraClient
.
subCfg
.
Bls
.
Bls
Sign
{
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
)
...
...
plugin/consensus/para/paraquery.go
View file @
b7088025
...
@@ -60,8 +60,8 @@ func (client *client) Query_LeaderInfo(req *types.ReqNil) (types.Message, error)
...
@@ -60,8 +60,8 @@ func (client *client) Query_LeaderInfo(req *types.ReqNil) (types.Message, error)
if
client
==
nil
{
if
client
==
nil
{
return
nil
,
fmt
.
Errorf
(
"%s"
,
"client not bind message queue."
)
return
nil
,
fmt
.
Errorf
(
"%s"
,
"client not bind message queue."
)
}
}
nodes
,
leader
,
base
,
off
,
isLeader
:=
client
.
blsSignCli
.
getLeaderInfo
()
_
,
leader
,
base
,
off
,
isLeader
,
_
:=
client
.
blsSignCli
.
getLeaderInfo
()
return
&
pt
.
ElectionStatus
{
IsLeader
:
isLeader
,
Leader
:
&
pt
.
LeaderSyncInfo
{
ID
:
nodes
[
leader
]
,
BaseIdx
:
base
,
Offset
:
off
}},
nil
return
&
pt
.
ElectionStatus
{
IsLeader
:
isLeader
,
Leader
:
&
pt
.
LeaderSyncInfo
{
ID
:
leader
,
BaseIdx
:
base
,
Offset
:
off
}},
nil
}
}
func
(
client
*
client
)
Query_CommitTxInfo
(
req
*
types
.
ReqNil
)
(
types
.
Message
,
error
)
{
func
(
client
*
client
)
Query_CommitTxInfo
(
req
*
types
.
ReqNil
)
(
types
.
Message
,
error
)
{
...
...
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
b7088025
#!/usr/bin/env bash
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck disable=SC2128
set
-
x
set
+
x
PARA_CLI
=
"docker exec
${
NODE3
}
/root/chain33-cli --paraName user.p.para. --rpc_laddr http://localhost:8901"
PARA_CLI
=
"docker exec
${
NODE3
}
/root/chain33-cli --paraName user.p.para. --rpc_laddr http://localhost:8901"
...
@@ -51,14 +51,12 @@ function para_init() {
...
@@ -51,14 +51,12 @@ function para_init() {
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"/g'
chain33.para31.toml
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"/g'
chain33.para31.toml
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"/g'
chain33.para30.toml
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"/g'
chain33.para30.toml
para_set_toml chain33.para29.toml
"
$PARANAME_GAME
"
"
$1
"
# 一个节点不配置 blsSign
para_set_toml chain33.para29.toml
"
$PARANAME_GAME
"
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"/g'
chain33.para29.toml
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"/g'
chain33.para29.toml
# 监督节点
# 监督节点
para_set_toml chain33.para28.toml
"
$PARANAME
"
"
$1
"
para_set_toml chain33.para28.toml
"
$PARANAME
"
para_set_toml chain33.para27.toml
"
$PARANAME
"
"
$1
"
para_set_toml chain33.para26.toml
"
$PARANAME
"
"
$1
"
para_set_toml chain33.para25.toml
"
$PARANAME
"
"
$1
"
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="'
"
$ADDR_28
"
'"/g'
chain33.para28.toml
# 0x3a35610ba6e1e72d7878f4c819e6a6768668cb5481f423ef04b6a11e0e16e44f
sed
-i
$xsedfix
's/^authAccount=.*/authAccount="'
"
$ADDR_28
"
'"/g'
chain33.para28.toml
# 0x3a35610ba6e1e72d7878f4c819e6a6768668cb5481f423ef04b6a11e0e16e44f
}
}
...
@@ -81,8 +79,7 @@ function para_set_toml() {
...
@@ -81,8 +79,7 @@ function para_set_toml() {
if
[
-n
"
$3
"
]
;
then
if
[
-n
"
$3
"
]
;
then
echo
"
${
1
}
blssign=
$3
"
echo
"
${
1
}
blssign=
$3
"
sed
-i
$xsedfix
'/types=\["dht"\]/!b;n;cenable=true'
"
${
1
}
"
sed
-i
$xsedfix
'/types=\["dht"\]/!b;n;cenable=true'
"
${
1
}
"
sed
-i
$xsedfix
'/emptyBlockInterval=/!b;n;cblsSign=true'
"
${
1
}
"
sed
-i
$xsedfix
's/^blsSign=.*/blsSign=true/g'
"
${
1
}
"
sed
-i
$xsedfix
'/blsSign=/!b;n;cblsLeaderSwitchIntval=10'
"
${
1
}
"
fi
fi
...
@@ -518,7 +515,7 @@ function para_cross_transfer_withdraw_for_token() {
...
@@ -518,7 +515,7 @@ function para_cross_transfer_withdraw_for_token() {
echo
"=========== # 3.asset_withdraw from parachain ============="
echo
"=========== # 3.asset_withdraw from parachain ============="
${
CLI
}
send para asset_withdraw
--paraName
user.p.para.
-a
111
-s
FZM
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
${
CLI
}
send para asset_withdraw
--paraName
user.p.para.
-a
111
-s
FZM
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
local times
=
1
00
local times
=
2
00
while
true
;
do
while
true
;
do
acc
=
$(${
CLI
}
asset balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
--asset_symbol
FZM
--asset_exec
token
-e
paracross | jq
-r
".balance"
)
acc
=
$(${
CLI
}
asset balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
--asset_symbol
FZM
--asset_exec
token
-e
paracross | jq
-r
".balance"
)
acc_para
=
$(${
PARA_CLI
}
asset balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
--asset_symbol
token.FZM
--asset_exec
paracross
-e
paracross | jq
-r
".balance"
)
acc_para
=
$(${
PARA_CLI
}
asset balance
-a
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
--asset_symbol
token.FZM
--asset_exec
paracross
-e
paracross | jq
-r
".balance"
)
...
@@ -528,7 +525,7 @@ function para_cross_transfer_withdraw_for_token() {
...
@@ -528,7 +525,7 @@ function para_cross_transfer_withdraw_for_token() {
times
=
$((
times
-
1
))
times
=
$((
times
-
1
))
if
[
$times
-le
0
]
;
then
if
[
$times
-le
0
]
;
then
echo
"para_cross_transfer_withdraw failed"
echo
"para_cross_transfer_withdraw failed"
#
exit 1
exit
1
fi
fi
else
else
echo
"para_cross_transfer_withdraw success"
echo
"para_cross_transfer_withdraw success"
...
@@ -1253,7 +1250,6 @@ function para_test() {
...
@@ -1253,7 +1250,6 @@ function para_test() {
}
}
function
paracross
()
{
function
paracross
()
{
set
-x
if
[
"
${
2
}
"
==
"init"
]
;
then
if
[
"
${
2
}
"
==
"init"
]
;
then
para_init
"
${
3
}
"
para_init
"
${
3
}
"
elif
[
"
${
2
}
"
==
"config"
]
;
then
elif
[
"
${
2
}
"
==
"config"
]
;
then
...
...
plugin/dapp/paracross/proto/paracross.proto
View file @
b7088025
...
@@ -495,7 +495,7 @@ message LeaderSyncInfo {
...
@@ -495,7 +495,7 @@ message LeaderSyncInfo {
string
ID
=
1
;
//self id
string
ID
=
1
;
//self id
int32
baseIdx
=
2
;
//calculated by corrent consensus height and remainder by len(nodes)
int32
baseIdx
=
2
;
//calculated by corrent consensus height and remainder by len(nodes)
int32
offset
=
3
;
int32
offset
=
3
;
uint32
count
=
4
;
//发送计数器
}
}
message
ParaP2PSubMsg
{
message
ParaP2PSubMsg
{
...
...
plugin/dapp/paracross/types/paracross.pb.go
View file @
b7088025
...
@@ -4763,6 +4763,7 @@ type LeaderSyncInfo struct {
...
@@ -4763,6 +4763,7 @@ type LeaderSyncInfo struct {
ID
string
`protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
//self id
ID
string
`protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
//self id
BaseIdx
int32
`protobuf:"varint,2,opt,name=baseIdx,proto3" json:"baseIdx,omitempty"`
//calculated by corrent consensus height and remainder by len(nodes)
BaseIdx
int32
`protobuf:"varint,2,opt,name=baseIdx,proto3" json:"baseIdx,omitempty"`
//calculated by corrent consensus height and remainder by len(nodes)
Offset
int32
`protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
Offset
int32
`protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
Count
uint32
`protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
//发送计数器
}
}
func
(
x
*
LeaderSyncInfo
)
Reset
()
{
func
(
x
*
LeaderSyncInfo
)
Reset
()
{
...
@@ -4818,6 +4819,13 @@ func (x *LeaderSyncInfo) GetOffset() int32 {
...
@@ -4818,6 +4819,13 @@ func (x *LeaderSyncInfo) GetOffset() int32 {
return
0
return
0
}
}
func
(
x
*
LeaderSyncInfo
)
GetCount
()
uint32
{
if
x
!=
nil
{
return
x
.
Count
}
return
0
}
type
ParaP2PSubMsg
struct
{
type
ParaP2PSubMsg
struct
{
state
protoimpl
.
MessageState
state
protoimpl
.
MessageState
sizeCache
protoimpl
.
SizeCache
sizeCache
protoimpl
.
SizeCache
...
@@ -5680,34 +5688,35 @@ var file_paracross_proto_rawDesc = []byte{
...
@@ -5680,34 +5688,35 @@ var file_paracross_proto_rawDesc = []byte{
0x70
,
0x65
,
0x73
,
0x2e
,
0x50
,
0x61
,
0x72
,
0x61
,
0x42
,
0x6c
,
0x73
,
0x53
,
0x69
,
0x67
,
0x6e
,
0x53
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x50
,
0x61
,
0x72
,
0x61
,
0x42
,
0x6c
,
0x73
,
0x53
,
0x69
,
0x67
,
0x6e
,
0x53
,
0x75
,
0x6d
,
0x44
,
0x65
,
0x74
,
0x61
,
0x69
,
0x6c
,
0x73
,
0x53
,
0x68
,
0x6f
,
0x77
,
0x52
,
0x04
,
0x69
,
0x75
,
0x6d
,
0x44
,
0x65
,
0x74
,
0x61
,
0x69
,
0x6c
,
0x73
,
0x53
,
0x68
,
0x6f
,
0x77
,
0x52
,
0x04
,
0x69
,
0x6e
,
0x66
,
0x6f
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x74
,
0x6f
,
0x70
,
0x69
,
0x63
,
0x73
,
0x18
,
0x02
,
0x20
,
0x6e
,
0x66
,
0x6f
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x74
,
0x6f
,
0x70
,
0x69
,
0x63
,
0x73
,
0x18
,
0x02
,
0x20
,
0x03
,
0x28
,
0x09
,
0x52
,
0x06
,
0x74
,
0x6f
,
0x70
,
0x69
,
0x63
,
0x73
,
0x22
,
0x
52
,
0x0a
,
0x0e
,
0x4c
,
0x03
,
0x28
,
0x09
,
0x52
,
0x06
,
0x74
,
0x6f
,
0x70
,
0x69
,
0x63
,
0x73
,
0x22
,
0x
68
,
0x0a
,
0x0e
,
0x4c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x53
,
0x79
,
0x6e
,
0x63
,
0x49
,
0x6e
,
0x66
,
0x6f
,
0x12
,
0x0e
,
0x0a
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x53
,
0x79
,
0x6e
,
0x63
,
0x49
,
0x6e
,
0x66
,
0x6f
,
0x12
,
0x0e
,
0x0a
,
0x02
,
0x49
,
0x44
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x02
,
0x49
,
0x44
,
0x12
,
0x18
,
0x0a
,
0x02
,
0x49
,
0x44
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x02
,
0x49
,
0x44
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x62
,
0x61
,
0x73
,
0x65
,
0x49
,
0x64
,
0x78
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x07
,
0x07
,
0x62
,
0x61
,
0x73
,
0x65
,
0x49
,
0x64
,
0x78
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x07
,
0x62
,
0x61
,
0x73
,
0x65
,
0x49
,
0x64
,
0x78
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x6f
,
0x66
,
0x66
,
0x73
,
0x65
,
0x62
,
0x61
,
0x73
,
0x65
,
0x49
,
0x64
,
0x78
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x6f
,
0x66
,
0x66
,
0x73
,
0x65
,
0x74
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x06
,
0x6f
,
0x66
,
0x66
,
0x73
,
0x65
,
0x74
,
0x22
,
0x74
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x06
,
0x6f
,
0x66
,
0x66
,
0x73
,
0x65
,
0x74
,
0x12
,
0x8d
,
0x01
,
0x0a
,
0x0d
,
0x50
,
0x61
,
0x72
,
0x61
,
0x50
,
0x32
,
0x50
,
0x53
,
0x75
,
0x62
,
0x4d
,
0x73
,
0x14
,
0x0a
,
0x05
,
0x63
,
0x6f
,
0x75
,
0x6e
,
0x74
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x0d
,
0x52
,
0x05
,
0x67
,
0x12
,
0x0e
,
0x0a
,
0x02
,
0x74
,
0x79
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x02
,
0x74
,
0x63
,
0x6f
,
0x75
,
0x6e
,
0x74
,
0x22
,
0x8d
,
0x01
,
0x0a
,
0x0d
,
0x50
,
0x61
,
0x72
,
0x61
,
0x50
,
0x32
,
0x79
,
0x12
,
0x30
,
0x0a
,
0x08
,
0x63
,
0x6f
,
0x6d
,
0x6d
,
0x69
,
0x74
,
0x54
,
0x78
,
0x18
,
0x0a
,
0x20
,
0x50
,
0x53
,
0x75
,
0x62
,
0x4d
,
0x73
,
0x67
,
0x12
,
0x0e
,
0x0a
,
0x02
,
0x74
,
0x79
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x12
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x54
,
0x72
,
0x61
,
0x6e
,
0x01
,
0x28
,
0x05
,
0x52
,
0x02
,
0x74
,
0x79
,
0x12
,
0x30
,
0x0a
,
0x08
,
0x63
,
0x6f
,
0x6d
,
0x6d
,
0x69
,
0x73
,
0x61
,
0x63
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x48
,
0x00
,
0x52
,
0x08
,
0x63
,
0x6f
,
0x6d
,
0x6d
,
0x69
,
0x74
,
0x54
,
0x78
,
0x18
,
0x0a
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x12
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x74
,
0x54
,
0x78
,
0x12
,
0x31
,
0x0a
,
0x07
,
0x73
,
0x79
,
0x6e
,
0x63
,
0x4d
,
0x73
,
0x67
,
0x18
,
0x0b
,
0x73
,
0x2e
,
0x54
,
0x72
,
0x61
,
0x6e
,
0x73
,
0x61
,
0x63
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x48
,
0x00
,
0x52
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x15
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x4c
,
0x65
,
0x61
,
0x08
,
0x63
,
0x6f
,
0x6d
,
0x6d
,
0x69
,
0x74
,
0x54
,
0x78
,
0x12
,
0x31
,
0x0a
,
0x07
,
0x73
,
0x79
,
0x6e
,
0x64
,
0x65
,
0x72
,
0x53
,
0x79
,
0x6e
,
0x63
,
0x49
,
0x6e
,
0x66
,
0x6f
,
0x48
,
0x00
,
0x52
,
0x07
,
0x73
,
0x63
,
0x4d
,
0x73
,
0x67
,
0x18
,
0x0b
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x15
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x79
,
0x6e
,
0x63
,
0x4d
,
0x73
,
0x67
,
0x42
,
0x07
,
0x0a
,
0x05
,
0x76
,
0x61
,
0x6c
,
0x75
,
0x65
,
0x22
,
0x65
,
0x73
,
0x2e
,
0x4c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x53
,
0x79
,
0x6e
,
0x63
,
0x49
,
0x6e
,
0x66
,
0x5b
,
0x0a
,
0x0e
,
0x45
,
0x6c
,
0x65
,
0x63
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x6f
,
0x48
,
0x00
,
0x52
,
0x07
,
0x73
,
0x79
,
0x6e
,
0x63
,
0x4d
,
0x73
,
0x67
,
0x42
,
0x07
,
0x0a
,
0x05
,
0x73
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x69
,
0x73
,
0x4c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x18
,
0x01
,
0x20
,
0x76
,
0x61
,
0x6c
,
0x75
,
0x65
,
0x22
,
0x5b
,
0x0a
,
0x0e
,
0x45
,
0x6c
,
0x65
,
0x63
,
0x74
,
0x69
,
0x6f
,
0x01
,
0x28
,
0x08
,
0x52
,
0x08
,
0x69
,
0x73
,
0x4c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x12
,
0x2d
,
0x0a
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x73
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x69
,
0x73
,
0x4c
,
0x65
,
0x61
,
0x06
,
0x6c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x15
,
0x2e
,
0x64
,
0x65
,
0x72
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x08
,
0x52
,
0x08
,
0x69
,
0x73
,
0x4c
,
0x65
,
0x61
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x4c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x53
,
0x79
,
0x6e
,
0x63
,
0x64
,
0x65
,
0x72
,
0x12
,
0x2d
,
0x0a
,
0x06
,
0x6c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x18
,
0x02
,
0x20
,
0x49
,
0x6e
,
0x66
,
0x6f
,
0x52
,
0x06
,
0x6c
,
0x65
,
0x61
,
0x64
,
0x65
,
0x72
,
0x22
,
0x1d
,
0x0a
,
0x09
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x15
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x4c
,
0x65
,
0x61
,
0x64
,
0x42
,
0x6c
,
0x73
,
0x50
,
0x75
,
0x62
,
0x4b
,
0x65
,
0x79
,
0x12
,
0x10
,
0x0a
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x65
,
0x72
,
0x53
,
0x79
,
0x6e
,
0x63
,
0x49
,
0x6e
,
0x66
,
0x6f
,
0x52
,
0x06
,
0x6c
,
0x65
,
0x61
,
0x64
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x32
,
0x39
,
0x0a
,
0x09
,
0x70
,
0x65
,
0x72
,
0x22
,
0x1d
,
0x0a
,
0x09
,
0x42
,
0x6c
,
0x73
,
0x50
,
0x75
,
0x62
,
0x4b
,
0x65
,
0x79
,
0x12
,
0x61
,
0x72
,
0x61
,
0x63
,
0x72
,
0x6f
,
0x73
,
0x73
,
0x12
,
0x2c
,
0x0a
,
0x06
,
0x49
,
0x73
,
0x53
,
0x79
,
0x10
,
0x0a
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x03
,
0x6b
,
0x65
,
0x6e
,
0x63
,
0x12
,
0x0d
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x52
,
0x65
,
0x71
,
0x4e
,
0x69
,
0x79
,
0x32
,
0x39
,
0x0a
,
0x09
,
0x70
,
0x61
,
0x72
,
0x61
,
0x63
,
0x72
,
0x6f
,
0x73
,
0x73
,
0x12
,
0x2c
,
0x6c
,
0x1a
,
0x11
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x49
,
0x73
,
0x43
,
0x61
,
0x75
,
0x67
,
0x0a
,
0x06
,
0x49
,
0x73
,
0x53
,
0x79
,
0x6e
,
0x63
,
0x12
,
0x0d
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x68
,
0x74
,
0x55
,
0x70
,
0x22
,
0x00
,
0x42
,
0x0a
,
0x5a
,
0x08
,
0x2e
,
0x2e
,
0x2f
,
0x74
,
0x79
,
0x70
,
0x2e
,
0x52
,
0x65
,
0x71
,
0x4e
,
0x69
,
0x6c
,
0x1a
,
0x11
,
0x2e
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x2e
,
0x65
,
0x73
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
0x49
,
0x73
,
0x43
,
0x61
,
0x75
,
0x67
,
0x68
,
0x74
,
0x55
,
0x70
,
0x22
,
0x00
,
0x42
,
0x0a
,
0x5a
,
0x08
,
0x2e
,
0x2e
,
0x2f
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
}
}
var
(
var
(
...
...
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