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
542a16f1
Commit
542a16f1
authored
Nov 03, 2021
by
QM
Committed by
mdj33
Nov 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix autonomy
parent
958b08d8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
2 deletions
+40
-2
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+1
-1
changeaction.go
plugin/dapp/autonomy/executor/changeaction.go
+19
-0
changeaction_test.go
plugin/dapp/autonomy/executor/changeaction_test.go
+1
-0
projectaction.go
plugin/dapp/autonomy/executor/projectaction.go
+17
-1
rule.go
plugin/dapp/autonomy/executor/rule.go
+2
-0
No files found.
plugin/dapp/autonomy/executor/boardaction.go
View file @
542a16f1
...
...
@@ -398,7 +398,7 @@ func isApproved(totalVotes, approveVotes, opposeVotes, quitVotes, attendRation,
//参与率计算弃权票
attendVotes
:=
approveVotes
+
opposeVotes
+
quitVotes
//赞成率,忽略弃权票
validVotes
:=
approveVotes
+
oppose
Votes
validVotes
:=
totalVotes
-
quit
Votes
if
totalVotes
!=
0
&&
attendVotes
!=
0
&&
attendVotes
*
100
>
attendRation
*
totalVotes
&&
approveVotes
*
100
>
approveRatio
*
validVotes
{
...
...
plugin/dapp/autonomy/executor/changeaction.go
View file @
542a16f1
...
...
@@ -248,11 +248,19 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
-
cur
.
VoteResult
.
QuitVotes
)
>
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
cur
.
PropChange
.
RealEndBlockHeight
=
a
.
height
}
}
else
{
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
cur
.
PropChange
.
RealEndBlockHeight
=
a
.
height
}
}
key
:=
propChangeID
(
voteProb
.
ProposalID
)
cur
.
Status
=
auty
.
AutonomyStatusVotePropChange
...
...
@@ -306,12 +314,23 @@ func (a *action) tmintPropChange(tmintProb *auty.TerminateProposalChange) (*type
return
nil
,
err
}
cfg
:=
a
.
api
.
GetConfig
()
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
-
cur
.
VoteResult
.
QuitVotes
)
>
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
}
else
{
cur
.
VoteResult
.
Pass
=
false
}
}
else
{
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
}
else
{
cur
.
VoteResult
.
Pass
=
false
}
}
cur
.
PropChange
.
RealEndBlockHeight
=
a
.
height
var
logs
[]
*
types
.
ReceiptLog
...
...
plugin/dapp/autonomy/executor/changeaction_test.go
View file @
542a16f1
...
...
@@ -453,6 +453,7 @@ func voteProposalChangeTx(parm *auty.VoteProposalChange) (*types.Transaction, er
func
terminateProposalChange
(
t
*
testing
.
T
,
env
*
ExecEnv
,
exec
drivers
.
Driver
,
stateDB
dbm
.
KV
,
kvdb
dbm
.
KVDB
,
save
bool
)
{
api
:=
new
(
apimock
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
chainTestCfg
,
nil
)
api
.
On
(
"StoreList"
,
mock
.
Anything
)
.
Return
(
&
types
.
StoreListReply
{},
nil
)
api
.
On
(
"GetLastHeader"
,
mock
.
Anything
)
.
Return
(
&
types
.
Header
{
StateHash
:
[]
byte
(
""
)},
nil
)
hear
:=
&
types
.
Header
{
StateHash
:
[]
byte
(
""
)}
...
...
plugin/dapp/autonomy/executor/projectaction.go
View file @
542a16f1
...
...
@@ -253,11 +253,19 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
if
a
.
api
.
GetConfig
()
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
-
cur
.
BoardVoteRes
.
QuitVotes
)
>=
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
BoardVoteRes
.
Pass
=
true
cur
.
PropProject
.
RealEndBlockHeight
=
a
.
height
}
}
else
{
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
BoardVoteRes
.
Pass
=
true
cur
.
PropProject
.
RealEndBlockHeight
=
a
.
height
}
}
key
:=
propProjectID
(
voteProb
.
ProposalID
)
cur
.
Status
=
auty
.
AutonomyStatusVotePropProject
...
...
@@ -447,13 +455,21 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
"in board vote period can not terminate"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
if
a
.
api
.
GetConfig
()
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
-
cur
.
BoardVoteRes
.
QuitVotes
)
>=
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
BoardVoteRes
.
Pass
=
true
}
else
{
cur
.
BoardVoteRes
.
Pass
=
false
}
}
else
{
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardApproveRatio
)
/
100.0
{
cur
.
BoardVoteRes
.
Pass
=
true
}
else
{
cur
.
BoardVoteRes
.
Pass
=
false
}
}
if
cur
.
PubVote
.
Publicity
{
if
cur
.
PubVote
.
TotalVotes
==
0
{
//需要统计总票数
...
...
plugin/dapp/autonomy/executor/rule.go
View file @
542a16f1
...
...
@@ -139,6 +139,8 @@ func (a *Autonomy) getActiveRule() (types.Message, error) {
rule
.
ProposalAmount
=
proposalAmount
*
cfg
.
GetCoinPrecision
()
rule
.
LargeProjectAmount
=
largeProjectAmount
*
cfg
.
GetCoinPrecision
()
rule
.
PublicPeriod
=
publicPeriod
rule
.
PubAttendRatio
=
pubAttendRatio
rule
.
PubApproveRatio
=
pubApproveRatio
}
return
rule
,
nil
}
...
...
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