fix(contracts): fix a bug where the proposal priority in rule governance was not valid
Priority invalidation due to a wrong object ID in rule governance.
This commit is contained in:
parent
18eecb2758
commit
ef8d80986f
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/meshplus/bitxhub-model/constant"
|
||||
"github.com/meshplus/bitxhub-model/pb"
|
||||
"github.com/meshplus/bitxhub/internal/repo"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
type Governance struct {
|
||||
|
@ -126,8 +125,7 @@ func (g *Governance) SubmitProposal(from, eventTyp, des, typ, objId string, extr
|
|||
}
|
||||
|
||||
// 3. lock low-priority proposals
|
||||
chainId := gjson.Get(string(extra), "id").String()
|
||||
lockPId, err := g.lockLowPriorityProposal(chainId, eventTyp)
|
||||
lockPId, err := g.lockLowPriorityProposal(objId, eventTyp)
|
||||
if err != nil {
|
||||
return boltvm.Error("close low priority proposals error:" + err.Error())
|
||||
}
|
||||
|
|
|
@ -562,9 +562,9 @@ func TestGovernance_SubmitProposal_LockLowPriorityProposal(t *testing.T) {
|
|||
mockStub.EXPECT().AddObject(gomock.Any(), gomock.Any()).AnyTimes()
|
||||
mockStub.EXPECT().CurrentCaller().Return("").AnyTimes()
|
||||
|
||||
res := g.SubmitProposal(idExistent, string(governance.EventUpdate), "des", string(AppchainMgr), "objId", chainData)
|
||||
res := g.SubmitProposal(idExistent, string(governance.EventUpdate), "des", string(AppchainMgr), appchainMethod, chainData)
|
||||
assert.False(t, res.Ok, string(res.Result))
|
||||
res = g.SubmitProposal(idExistent, string(governance.EventLogout), "des", string(AppchainMgr), "objId", chainData)
|
||||
res = g.SubmitProposal(idExistent, string(governance.EventLogout), "des", string(AppchainMgr), appchainMethod, chainData)
|
||||
assert.True(t, res.Ok, string(res.Result))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue