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
957a16f0
Commit
957a16f0
authored
Dec 05, 2019
by
mdj33
Committed by
vipwzw
Dec 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd improve
parent
55589cbe
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
168 additions
and
72 deletions
+168
-72
para.go
plugin/consensus/para/para.go
+6
-7
para_test.go
plugin/consensus/para/para_test.go
+1
-1
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+8
-7
paracreate.go
plugin/consensus/para/paracreate.go
+1
-1
parasync.go
plugin/consensus/para/parasync.go
+3
-3
parasync_test.go
plugin/consensus/para/parasync_test.go
+1
-1
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+4
-4
Makefile
plugin/dapp/paracross/cmd/scripts/autodeploy/Makefile
+3
-2
autodeploy.md
plugin/dapp/paracross/cmd/scripts/autodeploy/autodeploy.md
+19
-0
config
plugin/dapp/paracross/cmd/scripts/autodeploy/config
+16
-23
docker-compose.sh
...n/dapp/paracross/cmd/scripts/autodeploy/docker-compose.sh
+12
-0
paracross.go
plugin/dapp/paracross/commands/paracross.go
+70
-17
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+1
-0
query.go
plugin/dapp/paracross/executor/query.go
+7
-6
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+3
-0
rpc.go
plugin/dapp/paracross/rpc/rpc.go
+13
-0
No files found.
plugin/consensus/para/para.go
View file @
957a16f0
...
@@ -58,8 +58,7 @@ type client struct {
...
@@ -58,8 +58,7 @@ type client struct {
commitMsgClient
*
commitMsgClient
commitMsgClient
*
commitMsgClient
blockSyncClient
*
blockSyncClient
blockSyncClient
*
blockSyncClient
multiDldCli
*
multiDldClient
multiDldCli
*
multiDldClient
authAccount
string
minerPrivateKey
crypto
.
PrivKey
privateKey
crypto
.
PrivKey
wg
sync
.
WaitGroup
wg
sync
.
WaitGroup
subCfg
*
subConfig
subCfg
*
subConfig
isClosed
int32
isClosed
int32
...
@@ -138,15 +137,15 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
...
@@ -138,15 +137,15 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
}
}
para
:=
&
client
{
para
:=
&
client
{
BaseClient
:
c
,
BaseClient
:
c
,
authAccount
:
subcfg
.
AuthAccount
,
minerPrivateKey
:
priKey
,
privateKey
:
priKey
,
subCfg
:
&
subcfg
,
subCfg
:
&
subcfg
,
quitCreate
:
make
(
chan
struct
{}),
quitCreate
:
make
(
chan
struct
{}),
}
}
para
.
commitMsgClient
=
&
commitMsgClient
{
para
.
commitMsgClient
=
&
commitMsgClient
{
paraClient
:
para
,
paraClient
:
para
,
authAccount
:
subcfg
.
AuthAccount
,
waitMainBlocks
:
waitBlocks4CommitMsg
,
waitMainBlocks
:
waitBlocks4CommitMsg
,
waitConsensStopTimes
:
waitConsensStopTimes
,
waitConsensStopTimes
:
waitConsensStopTimes
,
consensHeight
:
-
2
,
consensHeight
:
-
2
,
...
...
plugin/consensus/para/para_test.go
View file @
957a16f0
...
@@ -175,7 +175,7 @@ func TestAddMinerTx(t *testing.T) {
...
@@ -175,7 +175,7 @@ func TestAddMinerTx(t *testing.T) {
para
:=
&
client
{
BaseClient
:
&
drivers
.
BaseClient
{}}
para
:=
&
client
{
BaseClient
:
&
drivers
.
BaseClient
{}}
para
.
SetAPI
(
api
)
para
.
SetAPI
(
api
)
para
.
subCfg
=
new
(
subConfig
)
para
.
subCfg
=
new
(
subConfig
)
para
.
p
rivateKey
=
priKey
para
.
minerP
rivateKey
=
priKey
para
.
commitMsgClient
=
new
(
commitMsgClient
)
para
.
commitMsgClient
=
new
(
commitMsgClient
)
para
.
commitMsgClient
.
paraClient
=
para
para
.
commitMsgClient
.
paraClient
=
para
...
...
plugin/consensus/para/paracommitmsg.go
View file @
957a16f0
...
@@ -53,6 +53,7 @@ type commitMsgClient struct {
...
@@ -53,6 +53,7 @@ type commitMsgClient struct {
consensHeight
int64
consensHeight
int64
consensDoneHeight
int64
consensDoneHeight
int64
selfConsensError
int32
//自共识比主链共识更高的异常场景,需要等待自共识<=主链共识再发送
selfConsensError
int32
//自共识比主链共识更高的异常场景,需要等待自共识<=主链共识再发送
authAccount
string
authAccountIn
bool
authAccountIn
bool
isRollBack
int32
isRollBack
int32
checkTxCommitTimes
int32
checkTxCommitTimes
int32
...
@@ -76,7 +77,7 @@ func (client *commitMsgClient) handler() {
...
@@ -76,7 +77,7 @@ func (client *commitMsgClient) handler() {
client
.
paraClient
.
wg
.
Add
(
1
)
client
.
paraClient
.
wg
.
Add
(
1
)
go
client
.
getMainConsensusInfo
()
go
client
.
getMainConsensusInfo
()
if
client
.
paraClient
.
authAccount
!=
""
{
if
client
.
authAccount
!=
""
{
client
.
paraClient
.
wg
.
Add
(
1
)
client
.
paraClient
.
wg
.
Add
(
1
)
client
.
sendMsgCh
=
make
(
chan
*
types
.
Transaction
,
1
)
client
.
sendMsgCh
=
make
(
chan
*
types
.
Transaction
,
1
)
go
client
.
sendCommitMsg
()
go
client
.
sendCommitMsg
()
...
@@ -275,7 +276,7 @@ func (client *commitMsgClient) checkAuthAccountIn() {
...
@@ -275,7 +276,7 @@ func (client *commitMsgClient) checkAuthAccountIn() {
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
authExist
:=
strings
.
Contains
(
nodes
,
client
.
paraClient
.
authAccount
)
authExist
:=
strings
.
Contains
(
nodes
,
client
.
authAccount
)
//如果授权节点重新加入,需要从当前共识高度重新发送
//如果授权节点重新加入,需要从当前共识高度重新发送
if
!
client
.
authAccountIn
&&
authExist
{
if
!
client
.
authAccountIn
&&
authExist
{
...
@@ -361,7 +362,7 @@ func (client *commitMsgClient) getSendingTx(startHeight, endHeight int64) (*type
...
@@ -361,7 +362,7 @@ func (client *commitMsgClient) getSendingTx(startHeight, endHeight int64) (*type
for
i
,
msg
:=
range
sendingMsgs
{
for
i
,
msg
:=
range
sendingMsgs
{
plog
.
Debug
(
"paracommitmsg sending"
,
"idx"
,
i
,
"height"
,
msg
.
Height
,
"mainheight"
,
msg
.
MainBlockHeight
,
plog
.
Debug
(
"paracommitmsg sending"
,
"idx"
,
i
,
"height"
,
msg
.
Height
,
"mainheight"
,
msg
.
MainBlockHeight
,
"blockhash"
,
common
.
HashHex
(
msg
.
BlockHash
),
"mainHash"
,
common
.
HashHex
(
msg
.
MainBlockHash
),
"blockhash"
,
common
.
HashHex
(
msg
.
BlockHash
),
"mainHash"
,
common
.
HashHex
(
msg
.
MainBlockHash
),
"from"
,
client
.
paraClient
.
authAccount
)
"from"
,
client
.
authAccount
)
}
}
return
signTx
,
count
return
signTx
,
count
...
@@ -678,7 +679,7 @@ out:
...
@@ -678,7 +679,7 @@ out:
isSync
=
true
isSync
=
true
}
}
if
client
.
paraClient
.
authAccount
!=
""
{
if
client
.
authAccount
!=
""
{
client
.
GetProperFeeRate
()
client
.
GetProperFeeRate
()
}
}
...
@@ -836,7 +837,7 @@ func (client *commitMsgClient) getNodeGroupAddrs() (string, error) {
...
@@ -836,7 +837,7 @@ func (client *commitMsgClient) getNodeGroupAddrs() (string, error) {
}
}
func
(
client
*
commitMsgClient
)
onWalletStatus
(
status
*
types
.
WalletStatus
)
{
func
(
client
*
commitMsgClient
)
onWalletStatus
(
status
*
types
.
WalletStatus
)
{
if
status
==
nil
||
client
.
paraClient
.
authAccount
==
""
{
if
status
==
nil
||
client
.
authAccount
==
""
{
return
return
}
}
if
!
status
.
IsWalletLock
&&
client
.
privateKey
==
nil
{
if
!
status
.
IsWalletLock
&&
client
.
privateKey
==
nil
{
...
@@ -858,7 +859,7 @@ func (client *commitMsgClient) onWalletStatus(status *types.WalletStatus) {
...
@@ -858,7 +859,7 @@ func (client *commitMsgClient) onWalletStatus(status *types.WalletStatus) {
}
}
func
(
client
*
commitMsgClient
)
onWalletAccount
(
acc
*
types
.
Account
)
{
func
(
client
*
commitMsgClient
)
onWalletAccount
(
acc
*
types
.
Account
)
{
if
acc
==
nil
||
client
.
paraClient
.
authAccount
==
""
||
client
.
paraC
lient
.
authAccount
!=
acc
.
Addr
||
client
.
privateKey
!=
nil
{
if
acc
==
nil
||
client
.
authAccount
==
""
||
c
lient
.
authAccount
!=
acc
.
Addr
||
client
.
privateKey
!=
nil
{
return
return
}
}
err
:=
client
.
fetchPriKey
()
err
:=
client
.
fetchPriKey
()
...
@@ -872,7 +873,7 @@ func (client *commitMsgClient) onWalletAccount(acc *types.Account) {
...
@@ -872,7 +873,7 @@ func (client *commitMsgClient) onWalletAccount(acc *types.Account) {
}
}
func
(
client
*
commitMsgClient
)
fetchPriKey
()
error
{
func
(
client
*
commitMsgClient
)
fetchPriKey
()
error
{
req
:=
&
types
.
ReqString
{
Data
:
client
.
paraClient
.
authAccount
}
req
:=
&
types
.
ReqString
{
Data
:
client
.
authAccount
}
msg
:=
client
.
paraClient
.
GetQueueClient
()
.
NewMessage
(
"wallet"
,
types
.
EventDumpPrivkey
,
req
)
msg
:=
client
.
paraClient
.
GetQueueClient
()
.
NewMessage
(
"wallet"
,
types
.
EventDumpPrivkey
,
req
)
err
:=
client
.
paraClient
.
GetQueueClient
()
.
Send
(
msg
,
true
)
err
:=
client
.
paraClient
.
GetQueueClient
()
.
Send
(
msg
,
true
)
...
...
plugin/consensus/para/paracreate.go
View file @
957a16f0
...
@@ -561,7 +561,7 @@ out:
...
@@ -561,7 +561,7 @@ out:
count
=
int64
(
len
(
paraTxs
.
Items
))
count
=
int64
(
len
(
paraTxs
.
Items
))
}
}
//如果超过1个block,则认为当前正在追赶,暂不处理
//如果超过1个block,则认为当前正在追赶,暂不处理
if
client
.
authAccount
!=
""
&&
len
(
paraTxs
.
Items
)
==
1
{
if
client
.
commitMsgClient
.
authAccount
!=
""
&&
len
(
paraTxs
.
Items
)
==
1
{
client
.
commitMsgClient
.
commitTxCheckNotify
(
paraTxs
.
Items
[
0
]
.
TxDetails
)
client
.
commitMsgClient
.
commitTxCheckNotify
(
paraTxs
.
Items
[
0
]
.
TxDetails
)
}
}
...
...
plugin/consensus/para/parasync.go
View file @
957a16f0
...
@@ -231,7 +231,7 @@ func (client *blockSyncClient) syncBlocksIfNeed() (bool, error) {
...
@@ -231,7 +231,7 @@ func (client *blockSyncClient) syncBlocksIfNeed() (bool, error) {
if
err
==
nil
{
if
err
==
nil
{
isSyncCaughtUp
:=
lastBlock
.
Height
+
1
==
lastLocalHeight
isSyncCaughtUp
:=
lastBlock
.
Height
+
1
==
lastLocalHeight
client
.
setSyncCaughtUp
(
isSyncCaughtUp
)
client
.
setSyncCaughtUp
(
isSyncCaughtUp
)
if
client
.
paraClient
.
authAccount
!=
""
{
if
client
.
paraClient
.
commitMsgClient
.
authAccount
!=
""
{
client
.
printDebugInfo
(
"Para sync - add block commit"
,
"isSyncCaughtUp"
,
isSyncCaughtUp
)
client
.
printDebugInfo
(
"Para sync - add block commit"
,
"isSyncCaughtUp"
,
isSyncCaughtUp
)
client
.
paraClient
.
commitMsgClient
.
updateChainHeightNotify
(
lastBlock
.
Height
+
1
,
false
)
client
.
paraClient
.
commitMsgClient
.
updateChainHeightNotify
(
lastBlock
.
Height
+
1
,
false
)
}
}
...
@@ -250,7 +250,7 @@ func (client *blockSyncClient) syncBlocksIfNeed() (bool, error) {
...
@@ -250,7 +250,7 @@ func (client *blockSyncClient) syncBlocksIfNeed() (bool, error) {
//通知发送层
//通知发送层
if
err
==
nil
{
if
err
==
nil
{
client
.
setSyncCaughtUp
(
false
)
client
.
setSyncCaughtUp
(
false
)
if
client
.
paraClient
.
authAccount
!=
""
{
if
client
.
paraClient
.
commitMsgClient
.
authAccount
!=
""
{
client
.
printDebugInfo
(
"Para sync - rollback block commit"
,
"isSyncCaughtUp"
,
false
)
client
.
printDebugInfo
(
"Para sync - rollback block commit"
,
"isSyncCaughtUp"
,
false
)
client
.
paraClient
.
commitMsgClient
.
updateChainHeightNotify
(
lastBlock
.
Height
-
1
,
true
)
client
.
paraClient
.
commitMsgClient
.
updateChainHeightNotify
(
lastBlock
.
Height
-
1
,
true
)
}
}
...
@@ -384,7 +384,7 @@ func (client *blockSyncClient) addMinerTx(preStateHash []byte, block *types.Bloc
...
@@ -384,7 +384,7 @@ func (client *blockSyncClient) addMinerTx(preStateHash []byte, block *types.Bloc
return
err
return
err
}
}
tx
.
Sign
(
types
.
SECP256K1
,
client
.
paraClient
.
p
rivateKey
)
tx
.
Sign
(
types
.
SECP256K1
,
client
.
paraClient
.
minerP
rivateKey
)
block
.
Txs
=
append
([]
*
types
.
Transaction
{
tx
},
block
.
Txs
...
)
block
.
Txs
=
append
([]
*
types
.
Transaction
{
tx
},
block
.
Txs
...
)
return
nil
return
nil
...
...
plugin/consensus/para/parasync_test.go
View file @
957a16f0
...
@@ -66,7 +66,7 @@ func createParaTestInstance(t *testing.T, q queue.Queue) *client {
...
@@ -66,7 +66,7 @@ func createParaTestInstance(t *testing.T, q queue.Queue) *client {
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
priKey
,
err
:=
secp
.
PrivKeyFromBytes
(
pk
)
priKey
,
err
:=
secp
.
PrivKeyFromBytes
(
pk
)
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
para
.
p
rivateKey
=
priKey
para
.
minerP
rivateKey
=
priKey
//实例化BlockSyncClient
//实例化BlockSyncClient
para
.
blockSyncClient
=
&
blockSyncClient
{
para
.
blockSyncClient
=
&
blockSyncClient
{
...
...
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
957a16f0
...
@@ -336,11 +336,11 @@ function para_cross_transfer_withdraw() {
...
@@ -336,11 +336,11 @@ function para_cross_transfer_withdraw() {
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
CLI
}
"
"
${
hash
}
"
query_tx
"
${
CLI
}
"
"
${
hash
}
"
hash
=
$(${
CLI
}
send para asset_transfer
--p
titl
e
user.p.para.
-a
1.4
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01
)
hash
=
$(${
CLI
}
send para asset_transfer
--p
araNam
e
user.p.para.
-a
1.4
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
hash2
=
$(${
CLI
}
send para asset_withdraw
--p
titl
e
user.p.para.
-a
0.7
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01
)
hash2
=
$(${
CLI
}
send para asset_withdraw
--p
araNam
e
user.p.para.
-a
0.7
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01
)
local times
=
200
local times
=
200
while
true
;
do
while
true
;
do
...
@@ -426,12 +426,12 @@ function para_cross_transfer_withdraw_for_token() {
...
@@ -426,12 +426,12 @@ function para_cross_transfer_withdraw_for_token() {
query_tx
"
${
MAIN_CLI
}
"
"
${
hash
}
"
query_tx
"
${
MAIN_CLI
}
"
"
${
hash
}
"
echo
"=========== # 2.transfer asset to para chain ============="
echo
"=========== # 2.transfer asset to para chain ============="
hash
=
$(${
CLI
}
send para asset_transfer
--p
titl
e
user.p.para.
-s
FZM
-a
220
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
hash
=
$(${
CLI
}
send para asset_transfer
--p
araNam
e
user.p.para.
-s
FZM
-a
220
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
MAIN_CLI
}
"
"
${
hash
}
"
query_tx
"
${
MAIN_CLI
}
"
"
${
hash
}
"
echo
"=========== # 3.asset_withdraw from parachain ============="
echo
"=========== # 3.asset_withdraw from parachain ============="
${
CLI
}
send para asset_withdraw
--p
titl
e
user.p.para.
-a
111
-s
FZM
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
${
CLI
}
send para asset_withdraw
--p
araNam
e
user.p.para.
-a
111
-s
FZM
-n
test
-t
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
-k
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
local times
=
100
local times
=
100
while
true
;
do
while
true
;
do
...
...
plugin/dapp/paracross/cmd/scripts/autodeploy/Makefile
View file @
957a16f0
...
@@ -13,4 +13,5 @@ help: ## Display this help screen
...
@@ -13,4 +13,5 @@ help: ## Display this help screen
@
printf
"Help doc:
\n
Usage: make docker-compose op=[command]
\n
"
@
printf
"Help doc:
\n
Usage: make docker-compose op=[command]
\n
"
@
printf
"[command]
\n
"
@
printf
"[command]
\n
"
@
printf
"[nodegroup]: create super node group if not create
\n
"
@
printf
"[nodegroup]: create super node group if not create
\n
"
@
printf
"[wallet]: set node wallet private key if not set
\n
"
@
printf
"[wallet]: set node wallet private key if not set
\n
"
\ No newline at end of file
@
printf
"[miner]: unlock wallet to miner
\n
"
\ No newline at end of file
plugin/dapp/paracross/cmd/scripts/autodeploy/autodeploy.md
0 → 100644
View file @
957a16f0
# 平行链授权节点一键式部署
## 需求
平行链申请超级节点步骤比较多,需要设置的地方也比较多,容易遗漏
## 使用
1.
把编译好的chain33,chain33-cli,chain33.toml,和chain33.para.toml和本脚本目录放到一起
1.
修改config文件配置项,每个配置项都有说明
1.
make docker-compose 缺省启动
1.
make docker-compose op=nodegroup 配置超级账户组
1.
make docker-compose op=wallet 配置钱包开启共识
1.
系统缺省会把区块链数据从docker重映射到本地storage目录,以后默认启动历史数据不会丢失
1.
make docker-compose down 停止当前平行链
## 系统重启
1.
系统重启使用 make docker-compose即可, 起来后 make docker-compose op=miner开启挖矿
\ No newline at end of file
plugin/dapp/paracross/cmd/scripts/autodeploy/config
View file @
957a16f0
paraName="test"
#genesisAccount=""
#genesisAmount=100000000
#mainStartHeight=4800000
#authAccount=()
#authPrikey=()
##docker8901端口暴露到宿主机的端口
#authPort=("18901" "18902" "18903" "18904")
#
##需要和chain33 主链保持一致
#superManager="['1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP']"
#
##nodegroup create
##申请超级账户需要在主链冻结币数量
#authFrozenCoins=0
#nodeGroupApplier=""
#applierPrikey=""
#superManagerPrikey=""
#平行链名字,这里不需要加user.p.前缀
paraName="test"
#### 测试链配置,主链配置需要把如下测试链配置屏蔽 ##########
#### 测试链配置四个节点例子,主链配置需要把如下测试链配置屏蔽 ##########
#创世账户
genesisAccount="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
genesisAccount="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
#创世数量
genesisAmount=100000000
genesisAmount=100000000
#从主链哪个高度开始同步区块
mainStartHeight=4000000
mainStartHeight=4000000
#平行链授权账户,这里的数量要和下面的authPrikey和authPort保持一致
authAccount=( "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4" "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR" "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k" "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs")
authAccount=( "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4" "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR" "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k" "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs")
#授权账户的私钥,为了导入钱包,自动开启共识挖矿
authPrikey=("0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b" "0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4" "0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115" "0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71")
authPrikey=("0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b" "0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4" "0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115" "0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71")
#授权节点的宿主机端口
authPort=("18901" "18902" "18903" "18904")
authPort=("18901" "18902" "18903" "18904")
#需要和chain33 主链保持一致
#需要和chain33 主链保持一致
...
@@ -32,8 +22,12 @@ superManager="['12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv']"
...
@@ -32,8 +22,12 @@ superManager="['12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv']"
tokenApprs="['12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv']"
tokenApprs="['12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv']"
#nodegroup create
#超级账户创建
#授权账户申请需要在主链上冻结的BTY数量,申请之前需要chain33项目方沟通,需要chain33超级管理员审批通过
authFrozenCoins=0
authFrozenCoins=0
#超级账户组申请者,需要事先在paracross合约转移必须的BTY,数量=申请的授权账户数量*authFrozenCoins
nodeGroupApplier="1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
nodeGroupApplier="1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
#超级账户组申请者私钥 签名交易使用
applierPrikey="0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
applierPrikey="0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
superManagerPrikey="4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
#超级管理员私钥,在主链上申请不需要填
\ No newline at end of file
superManagerPrikey="4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
plugin/dapp/paracross/cmd/scripts/autodeploy/docker-compose.sh
View file @
957a16f0
...
@@ -87,6 +87,13 @@ function para_import_wallet() {
...
@@ -87,6 +87,13 @@ function para_import_wallet() {
./
$CHAIN33_CLI
--rpc_laddr
"http://localhost:
$port
"
wallet status
./
$CHAIN33_CLI
--rpc_laddr
"http://localhost:
$port
"
wallet status
}
}
function
para_unlock_wallet
()
{
for
((
i
=
0
;
i <
${#
authPort
[@]
}
;
i++
))
;
do
echo
"=========== # para unlock wallet
${
authPort
[
$i
]
}
============="
./
$CHAIN33_CLI
--rpc_laddr
"http://localhost:
${
authPort
[
$i
]
}
"
wallet unlock
-p
1314fuzamei
-t
0
done
}
function
start
()
{
function
start
()
{
echo
"=========== # docker-compose ps ============="
echo
"=========== # docker-compose ps ============="
docker-compose ps
docker-compose ps
...
@@ -175,6 +182,7 @@ EOF
...
@@ -175,6 +182,7 @@ EOF
volumes:
volumes:
- "../storage/parachain
$i
/paradatadir:/root/paradatadir"
- "../storage/parachain
$i
/paradatadir:/root/paradatadir"
- "../storage/parachain
$i
/logs:/root/logs"
- "../storage/parachain
$i
/logs:/root/logs"
- "../storage/parachain
$i
/parawallet:/root/parawallet"
EOF
EOF
done
done
...
@@ -260,6 +268,10 @@ function main() {
...
@@ -260,6 +268,10 @@ function main() {
para_set_wallet
para_set_wallet
fi
fi
if
[
"
$1
"
==
"miner"
]
;
then
para_unlock_wallet
fi
echo
"===============================parachain startup end========================================================="
echo
"===============================parachain startup end========================================================="
}
}
...
...
plugin/dapp/paracross/commands/paracross.go
View file @
957a16f0
...
@@ -42,6 +42,7 @@ func ParcCmd() *cobra.Command {
...
@@ -42,6 +42,7 @@ func ParcCmd() *cobra.Command {
GetHeightCmd
(),
GetHeightCmd
(),
GetBlockInfoCmd
(),
GetBlockInfoCmd
(),
GetLocalBlockInfoCmd
(),
GetLocalBlockInfoCmd
(),
GetConsensDoneInfoCmd
(),
)
)
return
cmd
return
cmd
}
}
...
@@ -66,9 +67,6 @@ func addCreateAssetTransferFlags(cmd *cobra.Command) {
...
@@ -66,9 +67,6 @@ func addCreateAssetTransferFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
StringP
(
"note"
,
"n"
,
""
,
"transaction note info"
)
cmd
.
Flags
()
.
StringP
(
"note"
,
"n"
,
""
,
"transaction note info"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
""
,
""
,
"the title of para chain, like `user.p.guodun.`"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
cmd
.
Flags
()
.
StringP
(
"symbol"
,
"s"
,
""
,
"default for bty, symbol for token"
)
cmd
.
Flags
()
.
StringP
(
"symbol"
,
"s"
,
""
,
"default for bty, symbol for token"
)
}
}
...
@@ -98,9 +96,6 @@ func addCreateAssetWithdrawFlags(cmd *cobra.Command) {
...
@@ -98,9 +96,6 @@ func addCreateAssetWithdrawFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
StringP
(
"note"
,
"n"
,
""
,
"transaction note info"
)
cmd
.
Flags
()
.
StringP
(
"note"
,
"n"
,
""
,
"transaction note info"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
""
,
""
,
"the title of para chain, like `user.p.guodun.`"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
cmd
.
Flags
()
.
StringP
(
"to"
,
"t"
,
""
,
"receiver account address"
)
cmd
.
Flags
()
.
StringP
(
"to"
,
"t"
,
""
,
"receiver account address"
)
cmd
.
MarkFlagRequired
(
"to"
)
cmd
.
MarkFlagRequired
(
"to"
)
...
@@ -117,7 +112,7 @@ func createAssetWithdraw(cmd *cobra.Command, args []string) {
...
@@ -117,7 +112,7 @@ func createAssetWithdraw(cmd *cobra.Command, args []string) {
}
}
func
createAssetTx
(
cmd
*
cobra
.
Command
,
isWithdraw
bool
)
(
string
,
error
)
{
func
createAssetTx
(
cmd
*
cobra
.
Command
,
isWithdraw
bool
)
(
string
,
error
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"
titl
e"
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"
paraNam
e"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
cfg
:=
types
.
GetCliSysParam
(
title
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
...
@@ -130,12 +125,11 @@ func createAssetTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
...
@@ -130,12 +125,11 @@ func createAssetTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
note
,
_
:=
cmd
.
Flags
()
.
GetString
(
"note"
)
note
,
_
:=
cmd
.
Flags
()
.
GetString
(
"note"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
ptitle
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
if
!
strings
.
HasPrefix
(
title
,
"user.p"
)
{
if
!
strings
.
HasPrefix
(
ptitle
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"title is not right, title format like `user.p.guodun.`"
)
fmt
.
Fprintln
(
os
.
Stderr
,
"ptitle is not right, title format like `user.p.guodun.`"
)
return
""
,
types
.
ErrInvalidParam
return
""
,
types
.
ErrInvalidParam
}
}
execName
:=
p
title
+
pt
.
ParaX
execName
:=
title
+
pt
.
ParaX
param
:=
types
.
CreateTx
{
param
:=
types
.
CreateTx
{
To
:
toAddr
,
To
:
toAddr
,
...
@@ -269,7 +263,10 @@ func createNodeJoinTx(cmd *cobra.Command, args []string) {
...
@@ -269,7 +263,10 @@ func createNodeJoinTx(cmd *cobra.Command, args []string) {
opAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
opAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
1
,
Addr
:
opAddr
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
1
,
Addr
:
opAddr
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -304,7 +301,10 @@ func createNodeVoteTx(cmd *cobra.Command, args []string) {
...
@@ -304,7 +301,10 @@ func createNodeVoteTx(cmd *cobra.Command, args []string) {
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
val
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"value"
)
val
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"value"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
2
,
Id
:
id
,
Value
:
val
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
2
,
Id
:
id
,
Value
:
val
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -337,7 +337,10 @@ func addNodeQuitFlags(cmd *cobra.Command) {
...
@@ -337,7 +337,10 @@ func addNodeQuitFlags(cmd *cobra.Command) {
func
createNodeQuitTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
createNodeQuitTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
opAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
opAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
3
,
Addr
:
opAddr
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
3
,
Addr
:
opAddr
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -370,7 +373,10 @@ func addNodeCancelFlags(cmd *cobra.Command) {
...
@@ -370,7 +373,10 @@ func addNodeCancelFlags(cmd *cobra.Command) {
func
createNodeCancelTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
createNodeCancelTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
4
,
Id
:
id
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
paraName
,
Op
:
4
,
Id
:
id
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -655,6 +661,11 @@ func nodeGroupApply(cmd *cobra.Command, args []string) {
...
@@ -655,6 +661,11 @@ func nodeGroupApply(cmd *cobra.Command, args []string) {
addrs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addrs"
)
addrs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addrs"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
1
,
Addrs
:
addrs
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
1
,
Addrs
:
addrs
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -691,6 +702,11 @@ func nodeGroupApprove(cmd *cobra.Command, args []string) {
...
@@ -691,6 +702,11 @@ func nodeGroupApprove(cmd *cobra.Command, args []string) {
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
2
,
Id
:
id
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
2
,
Id
:
id
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -722,7 +738,10 @@ func addNodeGroupQuitCmdFlags(cmd *cobra.Command) {
...
@@ -722,7 +738,10 @@ func addNodeGroupQuitCmdFlags(cmd *cobra.Command) {
func
nodeGroupQuit
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
nodeGroupQuit
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
3
,
Id
:
id
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
3
,
Id
:
id
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -754,7 +773,10 @@ func addNodeGroupModifyCmdFlags(cmd *cobra.Command) {
...
@@ -754,7 +773,10 @@ func addNodeGroupModifyCmdFlags(cmd *cobra.Command) {
func
nodeGroupModify
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
nodeGroupModify
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"paraName is not right, paraName format like `user.p.guodun.`"
)
return
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
4
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
paraName
,
Op
:
4
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
Execer
:
getRealExecName
(
paraName
,
pt
.
ParaX
),
...
@@ -1110,3 +1132,34 @@ func showSelfStages(cmd *cobra.Command, args []string) {
...
@@ -1110,3 +1132,34 @@ func showSelfStages(cmd *cobra.Command, args []string) {
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.ListSelfStages"
,
params
,
&
res
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.ListSelfStages"
,
params
,
&
res
)
ctx
.
Run
()
ctx
.
Run
()
}
}
func
addConsensDoneCmdFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
Int64P
(
"height"
,
"g"
,
0
,
"height to para chain"
)
cmd
.
MarkFlagRequired
(
"height"
)
}
func
consensDoneInfo
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
height
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"height"
)
params
:=
pt
.
ReqParacrossTitleHeight
{
Title
:
paraName
,
Height
:
height
,
}
var
res
pt
.
RespParacrossDone
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.GetDoneTitleHeight"
,
params
,
&
res
)
ctx
.
Run
()
}
// GetConsensDoneInfoCmd get para chain done height consens info
func
GetConsensDoneInfoCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"consens_done"
,
Short
:
"Get para chain done height consensus info"
,
Run
:
consensDoneInfo
,
}
addConsensDoneCmdFlags
(
cmd
)
return
cmd
}
plugin/dapp/paracross/executor/exec_local.go
View file @
957a16f0
...
@@ -30,6 +30,7 @@ func (e *Paracross) ExecLocal_Commit(payload *pt.ParacrossCommitAction, tx *type
...
@@ -30,6 +30,7 @@ func (e *Paracross) ExecLocal_Commit(payload *pt.ParacrossCommitAction, tx *type
}
else
if
log
.
Ty
==
pt
.
TyLogParacrossCommitDone
{
}
else
if
log
.
Ty
==
pt
.
TyLogParacrossCommitDone
{
var
g
pt
.
ReceiptParacrossDone
var
g
pt
.
ReceiptParacrossDone
types
.
Decode
(
log
.
Log
,
&
g
)
types
.
Decode
(
log
.
Log
,
&
g
)
g
.
ChainExecHeight
=
e
.
GetHeight
()
key
:=
calcLocalTitleKey
(
g
.
Title
)
key
:=
calcLocalTitleKey
(
g
.
Title
)
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
&
g
)})
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
&
g
)})
...
...
plugin/dapp/paracross/executor/query.go
View file @
957a16f0
...
@@ -380,12 +380,13 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
...
@@ -380,12 +380,13 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
}
}
return
&
pt
.
RespParacrossDone
{
return
&
pt
.
RespParacrossDone
{
TotalNodes
:
st
.
TotalNodes
,
TotalNodes
:
st
.
TotalNodes
,
TotalCommit
:
st
.
TotalCommit
,
TotalCommit
:
st
.
TotalCommit
,
MostSameCommit
:
st
.
MostSameCommit
,
MostSameCommit
:
st
.
MostSameCommit
,
Title
:
st
.
Title
,
Title
:
st
.
Title
,
Height
:
st
.
Height
,
Height
:
st
.
Height
,
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
ChainExecHeight
:
st
.
ChainExecHeight
,
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
},
nil
},
nil
}
}
...
...
plugin/dapp/paracross/proto/paracross.proto
View file @
957a16f0
...
@@ -328,6 +328,7 @@ message ReceiptParacrossDone {
...
@@ -328,6 +328,7 @@ message ReceiptParacrossDone {
repeated
bytes
crossTxHashs
=
12
;
repeated
bytes
crossTxHashs
=
12
;
bytes
mainBlockHash
=
13
;
bytes
mainBlockHash
=
13
;
int64
mainBlockHeight
=
14
;
int64
mainBlockHeight
=
14
;
int64
chainExecHeight
=
15
;
}
}
message
ReceiptParacrossRecord
{
message
ReceiptParacrossRecord
{
...
@@ -356,6 +357,8 @@ message RespParacrossDone {
...
@@ -356,6 +357,8 @@ message RespParacrossDone {
string
stateHash
=
6
;
string
stateHash
=
6
;
uint32
txCounts
=
7
;
uint32
txCounts
=
7
;
string
txResult
=
8
;
string
txResult
=
8
;
//commitDone chainHeight
int64
chainExecHeight
=
9
;
}
}
message
RespParacrossTitles
{
message
RespParacrossTitles
{
...
...
plugin/dapp/paracross/rpc/rpc.go
View file @
957a16f0
...
@@ -118,6 +118,19 @@ func (c *channelClient) GetDoneTitleHeight(ctx context.Context, req *pt.ReqParac
...
@@ -118,6 +118,19 @@ func (c *channelClient) GetDoneTitleHeight(ctx context.Context, req *pt.ReqParac
return
nil
,
types
.
ErrDecode
return
nil
,
types
.
ErrDecode
}
}
// GetAssetTxResult get asset tx result
func
(
c
*
Jrpc
)
GetDoneTitleHeight
(
req
*
pt
.
ReqParacrossTitleHeight
,
result
*
interface
{})
error
{
if
req
==
nil
{
return
types
.
ErrInvalidParam
}
data
,
err
:=
c
.
cli
.
GetDoneTitleHeight
(
context
.
Background
(),
req
)
if
err
!=
nil
{
return
err
}
*
result
=
data
return
err
}
func
(
c
*
channelClient
)
GetAssetTxResult
(
ctx
context
.
Context
,
req
*
types
.
ReqString
)
(
*
pt
.
ParacrossAssetRsp
,
error
)
{
func
(
c
*
channelClient
)
GetAssetTxResult
(
ctx
context
.
Context
,
req
*
types
.
ReqString
)
(
*
pt
.
ParacrossAssetRsp
,
error
)
{
cfg
:=
c
.
GetConfig
()
cfg
:=
c
.
GetConfig
()
data
,
err
:=
c
.
Query
(
pt
.
GetExecName
(
cfg
),
"GetAssetTxResult"
,
req
)
data
,
err
:=
c
.
Query
(
pt
.
GetExecName
(
cfg
),
"GetAssetTxResult"
,
req
)
...
...
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