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
0165b426
Commit
0165b426
authored
Nov 13, 2019
by
mdj33
Committed by
vipwzw
Nov 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
node group cli
parent
ecf117e7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
52 deletions
+50
-52
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+0
-0
paracross.go
plugin/dapp/paracross/commands/paracross.go
+46
-40
paracross.go
plugin/dapp/paracross/types/paracross.go
+2
-4
type.go
plugin/dapp/paracross/types/type.go
+2
-8
No files found.
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
0165b426
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/commands/paracross.go
View file @
0165b426
...
...
@@ -260,18 +260,19 @@ func addNodeJoinFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Float64P
(
"coins"
,
"c"
,
0
,
"frozen coins amount, should not less nodegroup's setting"
)
cmd
.
MarkFlagRequired
(
"coins"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
createNodeJoinTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
opAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
1
,
Addr
:
opAddr
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
title
,
Op
:
1
,
Addr
:
opAddr
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
@@ -297,18 +298,19 @@ func addNodeVoteFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Uint32P
(
"value"
,
"v"
,
1
,
"vote value: 1:yes,2:no"
)
cmd
.
MarkFlagRequired
(
"value"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
createNodeVoteTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
val
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"value"
)
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
2
,
Id
:
id
,
Value
:
val
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
title
,
Op
:
2
,
Id
:
id
,
Value
:
val
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
@@ -332,17 +334,18 @@ func nodeVoteCmd() *cobra.Command {
func
addNodeQuitFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"target quit addr"
)
cmd
.
MarkFlagRequired
(
"addr"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
createNodeQuitTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
opAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
3
,
Addr
:
opAddr
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
title
,
Op
:
3
,
Addr
:
opAddr
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
@@ -366,17 +369,19 @@ func nodeQuitCmd() *cobra.Command {
func
addNodeCancelFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"operating target apply id"
)
cmd
.
MarkFlagRequired
(
"id"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
createNodeCancelTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
4
,
Id
:
id
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Title
:
title
,
Op
:
4
,
Id
:
id
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
@@ -523,18 +528,18 @@ func addNodeGroupApplyCmdFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Float64P
(
"coins"
,
"c"
,
0
,
"coins amount to frozen, not less config"
)
cmd
.
MarkFlagRequired
(
"coins"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
nodeGroupApply
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
addrs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addrs"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Op
:
1
,
Addrs
:
addrs
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
title
,
Op
:
1
,
Addrs
:
addrs
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeGroupConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
@@ -561,18 +566,18 @@ func addNodeGroupApproveCmdFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Float64P
(
"coins"
,
"c"
,
0
,
"coins amount to frozen, not less config"
)
cmd
.
MarkFlagRequired
(
"coins"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
nodeGroupApprove
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Op
:
2
,
Id
:
id
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
title
,
Op
:
2
,
Id
:
id
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeGroupConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
@@ -596,17 +601,17 @@ func addNodeGroupQuitCmdFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"apply quit id for nodegroup "
)
cmd
.
MarkFlagRequired
(
"id"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
nodeGroupQuit
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Op
:
3
,
Id
:
id
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
title
,
Op
:
3
,
Id
:
id
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeGroupConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
@@ -629,17 +634,18 @@ func nodeGroupQuitCmd() *cobra.Command {
func
addNodeGroupModifyCmdFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
Float64P
(
"coins"
,
"c"
,
0
,
"modify coins amount to frozen, not less config"
)
cmd
.
MarkFlagRequired
(
"coins"
)
cmd
.
Flags
()
.
StringP
(
"ptitle"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"ptitle"
)
}
func
nodeGroupModify
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
cfg
:=
types
.
GetCliSysParam
(
title
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"ptitle"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins"
)
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Op
:
4
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Title
:
title
,
Op
:
4
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
cfg
.
ExecName
(
pt
.
ParaX
)
,
Execer
:
title
+
pt
.
ParaX
,
ActionName
:
"NodeGroupConfig"
,
Payload
:
types
.
MustPBToJSON
(
payload
),
}
...
...
plugin/dapp/paracross/types/paracross.go
View file @
0165b426
...
...
@@ -200,8 +200,7 @@ func createRawCommitTx(cfg *types.Chain33Config, status *ParacrossNodeStatus, na
}
// CreateRawNodeConfigTx create raw tx for node config
func
CreateRawNodeConfigTx
(
cfg
*
types
.
Chain33Config
,
config
*
ParaNodeAddrConfig
)
(
*
types
.
Transaction
,
error
)
{
config
.
Title
=
cfg
.
GetTitle
()
func
CreateRawNodeConfigTx
(
config
*
ParaNodeAddrConfig
)
(
*
types
.
Transaction
,
error
)
{
config
.
Addr
=
strings
.
Trim
(
config
.
Addr
,
" "
)
config
.
Id
=
strings
.
Trim
(
config
.
Id
,
" "
)
...
...
@@ -217,8 +216,7 @@ func CreateRawNodeConfigTx(cfg *types.Chain33Config, config *ParaNodeAddrConfig)
}
//CreateRawNodeGroupApplyTx create raw tx for node group
func
CreateRawNodeGroupApplyTx
(
cfg
*
types
.
Chain33Config
,
apply
*
ParaNodeGroupConfig
)
(
*
types
.
Transaction
,
error
)
{
apply
.
Title
=
cfg
.
GetTitle
()
func
CreateRawNodeGroupApplyTx
(
apply
*
ParaNodeGroupConfig
)
(
*
types
.
Transaction
,
error
)
{
apply
.
Id
=
strings
.
Trim
(
apply
.
Id
,
" "
)
action
:=
&
ParacrossAction
{
...
...
plugin/dapp/paracross/types/type.go
View file @
0165b426
...
...
@@ -136,20 +136,14 @@ func (p ParacrossType) CreateTx(action string, message json.RawMessage) (*types.
return
p
.
CreateRawTransferTx
(
action
,
message
)
}
else
if
action
==
"NodeConfig"
{
if
!
cfg
.
IsPara
()
{
return
nil
,
types
.
ErrNotSupport
}
var
param
ParaNodeAddrConfig
err
:=
types
.
JSONToPB
(
message
,
&
param
)
if
err
!=
nil
{
glog
.
Error
(
"CreateTx.NodeConfig"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawNodeConfigTx
(
cfg
,
&
param
)
return
CreateRawNodeConfigTx
(
&
param
)
}
else
if
action
==
"NodeGroupConfig"
{
if
!
cfg
.
IsPara
()
{
return
nil
,
types
.
ErrNotSupport
}
var
param
ParaNodeGroupConfig
err
:=
types
.
JSONToPB
(
message
,
&
param
)
//err := json.Unmarshal(message, ¶m)
...
...
@@ -157,7 +151,7 @@ func (p ParacrossType) CreateTx(action string, message json.RawMessage) (*types.
glog
.
Error
(
"CreateTx.NodeGroupApply"
,
"Error"
,
err
)
return
nil
,
types
.
ErrInvalidParam
}
return
CreateRawNodeGroupApplyTx
(
cfg
,
&
param
)
return
CreateRawNodeGroupApplyTx
(
&
param
)
}
return
nil
,
types
.
ErrNotSupport
...
...
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