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
6f4f7852
Commit
6f4f7852
authored
Aug 23, 2019
by
liuyuhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add change test
parent
9771febb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
223 additions
and
222 deletions
+223
-222
round_state.go
plugin/consensus/tendermint/types/round_state.go
+3
-3
board_test.go
plugin/dapp/autonomy/executor/board_test.go
+45
-46
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+13
-11
boardaction_test.go
plugin/dapp/autonomy/executor/boardaction_test.go
+0
-0
change_test.go
plugin/dapp/autonomy/executor/change_test.go
+45
-46
changeaction.go
plugin/dapp/autonomy/executor/changeaction.go
+2
-1
changeaction_test.go
plugin/dapp/autonomy/executor/changeaction_test.go
+59
-60
project_test.go
plugin/dapp/autonomy/executor/project_test.go
+45
-46
projectaction.go
plugin/dapp/autonomy/executor/projectaction.go
+3
-2
projectaction_test.go
plugin/dapp/autonomy/executor/projectaction_test.go
+0
-0
rule_test.go
plugin/dapp/autonomy/executor/rule_test.go
+0
-0
ruleaction.go
plugin/dapp/autonomy/executor/ruleaction.go
+2
-1
ruleaction_test.go
plugin/dapp/autonomy/executor/ruleaction_test.go
+0
-0
certutils.go
...rt/authority/tools/cryptogen/generator/utils/certutils.go
+6
-6
No files found.
plugin/consensus/tendermint/types/round_state.go
View file @
6f4f7852
...
...
@@ -117,9 +117,9 @@ type RoundState struct {
// RoundStateMessage ...
func
(
rs
*
RoundState
)
RoundStateMessage
()
*
tmtypes
.
NewRoundStepMsg
{
return
&
tmtypes
.
NewRoundStepMsg
{
Height
:
rs
.
Height
,
Round
:
int32
(
rs
.
Round
),
Step
:
int32
(
rs
.
Step
),
Height
:
rs
.
Height
,
Round
:
int32
(
rs
.
Round
),
Step
:
int32
(
rs
.
Step
),
SecondsSinceStartTime
:
int32
(
time
.
Since
(
rs
.
StartTime
)
.
Seconds
()),
LastCommitRound
:
int32
(
rs
.
LastCommit
.
Round
()),
}
...
...
plugin/dapp/autonomy/executor/board_test.go
View file @
6f4f7852
...
...
@@ -13,7 +13,6 @@ import (
"github.com/33cn/chain33/util"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func
TestExecLocalBoard
(
t
*
testing
.
T
)
{
...
...
@@ -49,14 +48,14 @@ func testexecLocalBoard(t *testing.T, auto bool) {
var
err
error
if
!
auto
{
set
,
err
=
au
.
execLocalBoard
(
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalBoard
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -78,8 +77,8 @@ func testexecLocalBoard(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogRvkPropBoard
,
Log
:
types
.
Encode
(
receiptBoard1
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
...
...
@@ -89,8 +88,8 @@ func testexecLocalBoard(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogRvkPropBoard
,
Log
:
types
.
Encode
(
receiptBoard1
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -114,8 +113,8 @@ func testexecLocalBoard(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogVotePropBoard
,
Log
:
types
.
Encode
(
receiptBoard2
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
...
...
@@ -125,8 +124,8 @@ func testexecLocalBoard(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogVotePropBoard
,
Log
:
types
.
Encode
(
receiptBoard2
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -168,13 +167,13 @@ func testexecDelLocalBoard(t *testing.T) {
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
:=
au
.
execAutoLocalBoard
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
set
,
err
=
au
.
execAutoDelLocal
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
...
...
@@ -206,8 +205,8 @@ func testexecDelLocalBoard(t *testing.T) {
tx
,
err
=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalBoard
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// 正常测试退回
...
...
@@ -215,15 +214,15 @@ func testexecDelLocalBoard(t *testing.T) {
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalBoard
(
tx
,
recpt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
checkExecLocalBoard
(
t
,
kvdb
,
cur
)
set
,
err
=
au
.
execAutoDelLocal
(
tx
,
recpt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
checkExecLocalBoard
(
t
,
kvdb
,
pre1
)
...
...
@@ -238,9 +237,9 @@ func TestGetProposalBoard(t *testing.T) {
tx
:=
"1111111111111111111"
storedb
.
Set
(
propBoardID
(
tx
),
types
.
Encode
(
&
auty
.
AutonomyProposalBoard
{}))
rsp
,
err
:=
au
.
getProposalBoard
(
&
types
.
ReqString
{
Data
:
tx
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
rsp
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
1
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
rsp
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
1
)
}
func
TestListProposalBoard
(
t
*
testing
.
T
)
{
...
...
@@ -288,9 +287,9 @@ func TestListProposalBoard(t *testing.T) {
cur
.
Index
=
int32
(
tcase
.
index
)
err
:=
table
.
Replace
(
cur
)
require
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
kv
,
err
:=
table
.
Save
()
require
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
kvs
=
append
(
kvs
,
kv
...
)
}
...
...
@@ -303,12 +302,12 @@ func TestListProposalBoard(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
:=
au
.
listProposalBoard
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
len
(
testcase2
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
len
(
testcase2
))
k
:=
2
for
_
,
tcase
:=
range
testcase2
{
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
k
]
.
Height
,
tcase
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
k
]
.
Index
,
int32
(
tcase
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
k
]
.
Height
,
tcase
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
k
]
.
Index
,
int32
(
tcase
.
index
))
k
--
}
...
...
@@ -320,11 +319,11 @@ func TestListProposalBoard(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
=
au
.
listProposalBoard
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
len
(
testcase2
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
len
(
testcase2
))
for
i
,
tcase
:=
range
testcase2
{
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
i
]
.
Height
,
tcase
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
i
]
.
Index
,
int32
(
tcase
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
i
]
.
Height
,
tcase
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
i
]
.
Index
,
int32
(
tcase
.
index
))
}
// 翻页查找
...
...
@@ -335,12 +334,12 @@ func TestListProposalBoard(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
=
au
.
listProposalBoard
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
1
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
1
)
height
:=
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
0
]
.
Height
index
:=
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
0
]
.
Index
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
assert
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
assert
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
//
req
=
&
auty
.
ReqQueryProposalBoard
{
Status
:
auty
.
AutonomyStatusProposalBoard
,
...
...
@@ -350,12 +349,12 @@ func TestListProposalBoard(t *testing.T) {
Index
:
index
,
}
rsp
,
err
=
au
.
listProposalBoard
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
2
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
0
]
.
Height
,
testcase2
[
1
]
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
0
]
.
Index
,
int32
(
testcase2
[
1
]
.
index
))
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
1
]
.
Height
,
testcase2
[
0
]
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
1
]
.
Index
,
int32
(
testcase2
[
0
]
.
index
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
),
2
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
0
]
.
Height
,
testcase2
[
1
]
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
0
]
.
Index
,
int32
(
testcase2
[
1
]
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
1
]
.
Height
,
testcase2
[
0
]
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalBoard
)
.
PropBoards
[
1
]
.
Index
,
int32
(
testcase2
[
0
]
.
index
))
}
func
checkExecLocalBoard
(
t
*
testing
.
T
,
kvdb
db
.
KVDB
,
cur
*
auty
.
AutonomyProposalBoard
)
{
...
...
plugin/dapp/autonomy/executor/boardaction.go
View file @
6f4f7852
...
...
@@ -19,16 +19,17 @@ import (
)
const
(
minBoards
=
20
maxBoards
=
40
publicPeriod
int32
=
17280
*
7
// 公示一周时间,以区块高度计算
ticketPrice
=
types
.
Coin
*
3000
// 单张票价
largeProjectAmount
=
types
.
Coin
*
100
*
10000
// 重大项目公示金额阈值
proposalAmount
=
types
.
Coin
*
500
// 创建者消耗金额
boardApproveRatio
int32
=
66
// 董事会成员赞成率,以%计,可修改
pubAttendRatio
int32
=
75
// 全体持票人参与率,以%计
pubApproveRatio
int32
=
66
// 全体持票人赞成率,以%计
pubOpposeRatio
int32
=
33
// 全体持票人否决率,以%计
minBoards
=
20
maxBoards
=
40
publicPeriod
int32
=
17280
*
7
// 公示一周时间,以区块高度计算
ticketPrice
=
types
.
Coin
*
3000
// 单张票价
largeProjectAmount
=
types
.
Coin
*
100
*
10000
// 重大项目公示金额阈值
proposalAmount
=
types
.
Coin
*
500
// 创建者消耗金额
boardApproveRatio
int32
=
66
// 董事会成员赞成率,以%计,可修改
pubAttendRatio
int32
=
75
// 全体持票人参与率,以%计
pubApproveRatio
int32
=
66
// 全体持票人赞成率,以%计
pubOpposeRatio
int32
=
33
// 全体持票人否决率,以%计
startEndBlockPeriod
=
720
// 提案开始结束最小周期
)
type
action
struct
{
...
...
@@ -56,7 +57,8 @@ func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
return
nil
,
types
.
ErrInvalidParam
}
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
{
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
||
prob
.
StartBlockHeight
+
startEndBlockPeriod
>
prob
.
EndBlockHeight
{
alog
.
Error
(
"propBoard height invaild"
,
"StartBlockHeight"
,
prob
.
StartBlockHeight
,
"EndBlockHeight"
,
prob
.
EndBlockHeight
,
"height"
,
a
.
height
)
return
nil
,
types
.
ErrInvalidParam
...
...
plugin/dapp/autonomy/executor/boardaction_test.go
View file @
6f4f7852
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/executor/change_test.go
View file @
6f4f7852
...
...
@@ -13,7 +13,6 @@ import (
"github.com/33cn/chain33/util"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func
TestExecLocalChange
(
t
*
testing
.
T
)
{
...
...
@@ -49,14 +48,14 @@ func testexecLocalChange(t *testing.T, auto bool) {
var
err
error
if
!
auto
{
set
,
err
=
au
.
execLocalChange
(
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalChange
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -78,8 +77,8 @@ func testexecLocalChange(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogRvkPropChange
,
Log
:
types
.
Encode
(
receiptChange1
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
...
...
@@ -89,8 +88,8 @@ func testexecLocalChange(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogRvkPropChange
,
Log
:
types
.
Encode
(
receiptChange1
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -114,8 +113,8 @@ func testexecLocalChange(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogVotePropChange
,
Log
:
types
.
Encode
(
receiptChange2
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
...
...
@@ -125,8 +124,8 @@ func testexecLocalChange(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogVotePropChange
,
Log
:
types
.
Encode
(
receiptChange2
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -168,13 +167,13 @@ func testexecDelLocalChange(t *testing.T) {
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
:=
au
.
execAutoLocalChange
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
set
,
err
=
au
.
execAutoDelLocal
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
...
...
@@ -206,8 +205,8 @@ func testexecDelLocalChange(t *testing.T) {
tx
,
err
=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalChange
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// 正常测试退回
...
...
@@ -215,15 +214,15 @@ func testexecDelLocalChange(t *testing.T) {
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalChange
(
tx
,
recpt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
checkExecLocalChange
(
t
,
kvdb
,
cur
)
set
,
err
=
au
.
execAutoDelLocal
(
tx
,
recpt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
checkExecLocalChange
(
t
,
kvdb
,
pre1
)
...
...
@@ -238,9 +237,9 @@ func TestGetProposalChange(t *testing.T) {
tx
:=
"1111111111111111111"
storedb
.
Set
(
propChangeID
(
tx
),
types
.
Encode
(
&
auty
.
AutonomyProposalChange
{}))
rsp
,
err
:=
au
.
getProposalChange
(
&
types
.
ReqString
{
Data
:
tx
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
rsp
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
1
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
rsp
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
1
)
}
func
TestListProposalChange
(
t
*
testing
.
T
)
{
...
...
@@ -288,9 +287,9 @@ func TestListProposalChange(t *testing.T) {
cur
.
Index
=
int32
(
tcase
.
index
)
err
:=
table
.
Replace
(
cur
)
require
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
kv
,
err
:=
table
.
Save
()
require
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
kvs
=
append
(
kvs
,
kv
...
)
}
...
...
@@ -303,12 +302,12 @@ func TestListProposalChange(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
:=
au
.
listProposalChange
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
len
(
testcase2
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
len
(
testcase2
))
k
:=
2
for
_
,
tcase
:=
range
testcase2
{
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
k
]
.
Height
,
tcase
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
k
]
.
Index
,
int32
(
tcase
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
k
]
.
Height
,
tcase
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
k
]
.
Index
,
int32
(
tcase
.
index
))
k
--
}
...
...
@@ -320,11 +319,11 @@ func TestListProposalChange(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
=
au
.
listProposalChange
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
len
(
testcase2
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
len
(
testcase2
))
for
i
,
tcase
:=
range
testcase2
{
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
i
]
.
Height
,
tcase
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
i
]
.
Index
,
int32
(
tcase
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
i
]
.
Height
,
tcase
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
i
]
.
Index
,
int32
(
tcase
.
index
))
}
// 翻页查找
...
...
@@ -335,12 +334,12 @@ func TestListProposalChange(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
=
au
.
listProposalChange
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
1
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
1
)
height
:=
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
0
]
.
Height
index
:=
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
0
]
.
Index
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
assert
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
assert
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
//
req
=
&
auty
.
ReqQueryProposalChange
{
Status
:
auty
.
AutonomyStatusProposalChange
,
...
...
@@ -350,12 +349,12 @@ func TestListProposalChange(t *testing.T) {
Index
:
index
,
}
rsp
,
err
=
au
.
listProposalChange
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
2
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
0
]
.
Height
,
testcase2
[
1
]
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
0
]
.
Index
,
int32
(
testcase2
[
1
]
.
index
))
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
1
]
.
Height
,
testcase2
[
0
]
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
1
]
.
Index
,
int32
(
testcase2
[
0
]
.
index
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
),
2
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
0
]
.
Height
,
testcase2
[
1
]
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
0
]
.
Index
,
int32
(
testcase2
[
1
]
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
1
]
.
Height
,
testcase2
[
0
]
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalChange
)
.
PropChanges
[
1
]
.
Index
,
int32
(
testcase2
[
0
]
.
index
))
}
func
checkExecLocalChange
(
t
*
testing
.
T
,
kvdb
db
.
KVDB
,
cur
*
auty
.
AutonomyProposalChange
)
{
...
...
plugin/dapp/autonomy/executor/changeaction.go
View file @
6f4f7852
...
...
@@ -16,7 +16,8 @@ func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) {
alog
.
Error
(
"propChange "
,
"ProposalChange ChangeCfg invaild or have no modify param"
,
prob
)
return
nil
,
types
.
ErrInvalidParam
}
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
{
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
||
prob
.
StartBlockHeight
+
startEndBlockPeriod
>
prob
.
EndBlockHeight
{
alog
.
Error
(
"propChange height invaild"
,
"StartBlockHeight"
,
prob
.
StartBlockHeight
,
"EndBlockHeight"
,
prob
.
EndBlockHeight
,
"height"
,
a
.
height
)
return
nil
,
types
.
ErrInvalidParam
...
...
plugin/dapp/autonomy/executor/changeaction_test.go
View file @
6f4f7852
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/executor/project_test.go
View file @
6f4f7852
...
...
@@ -13,7 +13,6 @@ import (
"github.com/33cn/chain33/util"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func
TestExecLocalProject
(
t
*
testing
.
T
)
{
...
...
@@ -51,14 +50,14 @@ func testexecLocalProject(t *testing.T, auto bool) {
var
err
error
if
!
auto
{
set
,
err
=
au
.
execLocalProject
(
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalProject
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -81,8 +80,8 @@ func testexecLocalProject(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogRvkPropProject
,
Log
:
types
.
Encode
(
receiptProject1
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
...
...
@@ -92,8 +91,8 @@ func testexecLocalProject(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogRvkPropProject
,
Log
:
types
.
Encode
(
receiptProject1
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -118,8 +117,8 @@ func testexecLocalProject(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogVotePropProject
,
Log
:
types
.
Encode
(
receiptProject2
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
else
{
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
...
...
@@ -129,8 +128,8 @@ func testexecLocalProject(t *testing.T, auto bool) {
{
Ty
:
auty
.
TyLogVotePropProject
,
Log
:
types
.
Encode
(
receiptProject2
)},
},
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
//save to database
...
...
@@ -174,13 +173,13 @@ func testexecDelLocalProject(t *testing.T) {
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
:=
au
.
execAutoLocalProject
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
set
,
err
=
au
.
execAutoDelLocal
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
...
...
@@ -211,8 +210,8 @@ func testexecDelLocalProject(t *testing.T) {
tx
,
err
=
types
.
CreateFormatTx
(
types
.
ExecName
(
auty
.
AutonomyX
),
nil
)
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalProject
(
tx
,
receipt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// 正常测试退回
...
...
@@ -220,15 +219,15 @@ func testexecDelLocalProject(t *testing.T) {
assert
.
NoError
(
t
,
err
)
set
,
err
=
au
.
execAutoLocalProject
(
tx
,
recpt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
// check
checkExecLocalProject
(
t
,
kvdb
,
cur
)
set
,
err
=
au
.
execAutoDelLocal
(
tx
,
recpt
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
set
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
saveKvs
(
sdb
,
set
.
KV
)
checkExecLocalProject
(
t
,
kvdb
,
pre1
)
...
...
@@ -243,9 +242,9 @@ func TestGetProposalProject(t *testing.T) {
tx
:=
"1111111111111111111"
storedb
.
Set
(
propProjectID
(
tx
),
types
.
Encode
(
&
auty
.
AutonomyProposalProject
{}))
rsp
,
err
:=
au
.
getProposalProject
(
&
types
.
ReqString
{
Data
:
tx
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
rsp
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
1
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
rsp
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
1
)
}
func
TestListProposalProject
(
t
*
testing
.
T
)
{
...
...
@@ -295,9 +294,9 @@ func TestListProposalProject(t *testing.T) {
cur
.
Index
=
int32
(
tcase
.
index
)
err
:=
table
.
Replace
(
cur
)
require
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
kv
,
err
:=
table
.
Save
()
require
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
kvs
=
append
(
kvs
,
kv
...
)
}
saveKvs
(
sdb
,
kvs
)
...
...
@@ -310,12 +309,12 @@ func TestListProposalProject(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
:=
au
.
listProposalProject
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
len
(
testcase2
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
len
(
testcase2
))
k
:=
2
for
_
,
tcase
:=
range
testcase2
{
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
k
]
.
Height
,
tcase
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
k
]
.
Index
,
int32
(
tcase
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
k
]
.
Height
,
tcase
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
k
]
.
Index
,
int32
(
tcase
.
index
))
k
--
}
...
...
@@ -327,11 +326,11 @@ func TestListProposalProject(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
=
au
.
listProposalProject
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
len
(
testcase2
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
len
(
testcase2
))
for
i
,
tcase
:=
range
testcase2
{
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
i
]
.
Height
,
tcase
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
i
]
.
Index
,
int32
(
tcase
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
i
]
.
Height
,
tcase
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
i
]
.
Index
,
int32
(
tcase
.
index
))
}
// 翻页查找
...
...
@@ -342,12 +341,12 @@ func TestListProposalProject(t *testing.T) {
Index
:
-
1
,
}
rsp
,
err
=
au
.
listProposalProject
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
1
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
1
)
height
:=
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
0
]
.
Height
index
:=
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
0
]
.
Index
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
assert
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
assert
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
//
req
=
&
auty
.
ReqQueryProposalProject
{
Status
:
auty
.
AutonomyStatusProposalProject
,
...
...
@@ -357,12 +356,12 @@ func TestListProposalProject(t *testing.T) {
Index
:
index
,
}
rsp
,
err
=
au
.
listProposalProject
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
2
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
0
]
.
Height
,
testcase2
[
1
]
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
0
]
.
Index
,
int32
(
testcase2
[
1
]
.
index
))
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
1
]
.
Height
,
testcase2
[
0
]
.
height
)
require
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
1
]
.
Index
,
int32
(
testcase2
[
0
]
.
index
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
len
(
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
),
2
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
0
]
.
Height
,
testcase2
[
1
]
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
0
]
.
Index
,
int32
(
testcase2
[
1
]
.
index
))
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
1
]
.
Height
,
testcase2
[
0
]
.
height
)
assert
.
Equal
(
t
,
rsp
.
(
*
auty
.
ReplyQueryProposalProject
)
.
PropProjects
[
1
]
.
Index
,
int32
(
testcase2
[
0
]
.
index
))
}
func
checkExecLocalProject
(
t
*
testing
.
T
,
kvdb
db
.
KVDB
,
cur
*
auty
.
AutonomyProposalProject
)
{
...
...
plugin/dapp/autonomy/executor/projectaction.go
View file @
6f4f7852
...
...
@@ -23,7 +23,8 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error)
return
nil
,
types
.
ErrInvalidAddress
}
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
||
prob
.
Amount
<=
0
{
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
||
prob
.
Amount
<=
0
||
prob
.
StartBlockHeight
+
startEndBlockPeriod
>
prob
.
EndBlockHeight
{
alog
.
Error
(
"propProject height or amount invaild"
,
"StartBlockHeight"
,
prob
.
StartBlockHeight
,
"EndBlockHeight"
,
prob
.
EndBlockHeight
,
"height"
,
a
.
height
,
"amount"
,
prob
.
Amount
)
return
nil
,
types
.
ErrInvalidParam
...
...
@@ -593,7 +594,7 @@ func (a *action) checkPeriodAmount(act *auty.ActiveBoard, amount int64) bool {
if
act
==
nil
{
return
false
}
if
act
.
Amount
+
amount
>
=
maxBoardPeriodAmount
{
if
act
.
Amount
+
amount
>
maxBoardPeriodAmount
{
return
false
}
return
true
...
...
plugin/dapp/autonomy/executor/projectaction_test.go
View file @
6f4f7852
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/executor/rule_test.go
View file @
6f4f7852
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/executor/ruleaction.go
View file @
6f4f7852
...
...
@@ -51,7 +51,8 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
alog
.
Error
(
"propRule RuleCfg invaild"
,
"ruleCfg"
,
prob
.
RuleCfg
)
return
nil
,
types
.
ErrInvalidParam
}
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
{
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
||
prob
.
StartBlockHeight
+
startEndBlockPeriod
>
prob
.
EndBlockHeight
{
alog
.
Error
(
"propRule height invaild"
,
"StartBlockHeight"
,
prob
.
StartBlockHeight
,
"EndBlockHeight"
,
prob
.
EndBlockHeight
,
"height"
,
a
.
height
)
return
nil
,
types
.
ErrInvalidParam
...
...
plugin/dapp/autonomy/executor/ruleaction_test.go
View file @
6f4f7852
This diff is collapsed.
Click to expand it.
plugin/dapp/cert/authority/tools/cryptogen/generator/utils/certutils.go
View file @
6f4f7852
...
...
@@ -73,9 +73,9 @@ func ParseX509CertificateToSm2(x509Cert *x509.Certificate) *sm2.Certificate {
UnknownExtKeyUsage
:
x509Cert
.
UnknownExtKeyUsage
,
BasicConstraintsValid
:
x509Cert
.
BasicConstraintsValid
,
IsCA
:
x509Cert
.
IsCA
,
MaxPathLen
:
x509Cert
.
MaxPathLen
,
MaxPathLenZero
:
x509Cert
.
MaxPathLenZero
,
IsCA
:
x509Cert
.
IsCA
,
MaxPathLen
:
x509Cert
.
MaxPathLen
,
MaxPathLenZero
:
x509Cert
.
MaxPathLenZero
,
SubjectKeyId
:
x509Cert
.
SubjectKeyId
,
AuthorityKeyId
:
x509Cert
.
AuthorityKeyId
,
...
...
@@ -136,9 +136,9 @@ func ParseSm2CertificateToX509(sm2Cert *sm2.Certificate) *x509.Certificate {
UnknownExtKeyUsage
:
sm2Cert
.
UnknownExtKeyUsage
,
BasicConstraintsValid
:
sm2Cert
.
BasicConstraintsValid
,
IsCA
:
sm2Cert
.
IsCA
,
MaxPathLen
:
sm2Cert
.
MaxPathLen
,
MaxPathLenZero
:
sm2Cert
.
MaxPathLenZero
,
IsCA
:
sm2Cert
.
IsCA
,
MaxPathLen
:
sm2Cert
.
MaxPathLen
,
MaxPathLenZero
:
sm2Cert
.
MaxPathLenZero
,
SubjectKeyId
:
sm2Cert
.
SubjectKeyId
,
AuthorityKeyId
:
sm2Cert
.
AuthorityKeyId
,
...
...
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