Commit 9c037e47 authored by mdj33's avatar mdj33 Committed by vipwzw

autonomy add item proposal

parent 4763c2ca
...@@ -307,7 +307,7 @@ pointHX="19172955941344617222923168298456110557655645809646772800021167670156933 ...@@ -307,7 +307,7 @@ pointHX="19172955941344617222923168298456110557655645809646772800021167670156933
pointHY="21116962883761739586121793871108889864627195706475546685847911817475098399811" pointHY="21116962883761739586121793871108889864627195706475546685847911817475098399811"
#电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于 #电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于
maxTreeLeaves=1024 maxTreeLeaves=1024
mixApprs=[]
[metrics] [metrics]
#是否使能发送metrics数据的发送 #是否使能发送metrics数据的发送
......
module github.com/33cn/plugin module github.com/33cn/plugin
go 1.15 go 1.15
replace github.com/33cn/chain33 => /home/pony/go/src/github.com/33cn/chain33
require ( require (
github.com/33cn/chain33 v1.65.6-0.20211025083411-82c4406c6701 github.com/33cn/chain33 v1.65.6-0.20211025083411-82c4406c6701
github.com/BurntSushi/toml v0.3.1 github.com/BurntSushi/toml v0.3.1
......
...@@ -130,3 +130,27 @@ func (a *Autonomy) Exec_TmintPropChange(payload *auty.TerminateProposalChange, t ...@@ -130,3 +130,27 @@ func (a *Autonomy) Exec_TmintPropChange(payload *auty.TerminateProposalChange, t
action := newAction(a, tx, int32(index)) action := newAction(a, tx, int32(index))
return action.tmintPropChange(payload) return action.tmintPropChange(payload)
} }
// Exec_PropChange 创建事项规则
func (a *Autonomy) Exec_PropItem(payload *auty.ProposalItem, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.propItem(payload)
}
// Exec_RvkPropItem 撤销事项规则
func (a *Autonomy) Exec_RvkPropItem(payload *auty.RevokeProposalItem, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.rvkPropItem(payload)
}
// Exec_VotePropItem 投票事项规则
func (a *Autonomy) Exec_VotePropItem(payload *auty.VoteProposalItem, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.votePropItem(payload)
}
// Exec_TmintPropItem 终止事项规则
func (a *Autonomy) Exec_TmintPropItem(payload *auty.TerminateProposalItem, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.tmintPropItem(payload)
}
...@@ -106,3 +106,23 @@ func (a *Autonomy) ExecLocal_VotePropChange(payload *auty.VoteProposalChange, tx ...@@ -106,3 +106,23 @@ func (a *Autonomy) ExecLocal_VotePropChange(payload *auty.VoteProposalChange, tx
func (a *Autonomy) ExecLocal_TmintPropChange(payload *auty.TerminateProposalChange, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (a *Autonomy) ExecLocal_TmintPropChange(payload *auty.TerminateProposalChange, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execAutoLocalChange(tx, receiptData) return a.execAutoLocalChange(tx, receiptData)
} }
// ExecLocal_PropItem 创建事项规则
func (a *Autonomy) ExecLocal_PropItem(payload *auty.ProposalItem, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execAutoLocalItem(tx, receiptData)
}
// ExecLocal_RvkPropItem 撤销事项规则
func (a *Autonomy) ExecLocal_RvkPropItem(payload *auty.RevokeProposalItem, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execAutoLocalItem(tx, receiptData)
}
// ExecLocal_VotePropItem 投票事项规则
func (a *Autonomy) ExecLocal_VotePropItem(payload *auty.VoteProposalItem, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execAutoLocalItem(tx, receiptData)
}
// ExecLocal_TmintPropItem 终止事项规则
func (a *Autonomy) ExecLocal_TmintPropItem(payload *auty.TerminateProposalItem, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execAutoLocalItem(tx, receiptData)
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package executor
import (
"fmt"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/pkg/errors"
)
func (a *Autonomy) execAutoLocalItem(tx *types.Transaction, receiptData *types.ReceiptData) (*types.LocalDBSet, error) {
set, err := a.execLocalItem(receiptData)
if err != nil {
return set, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = a.AddRollbackKV(tx, tx.Execer, set.KV)
return dbSet, nil
}
func (a *Autonomy) execLocalItem(receiptData *types.ReceiptData) (*types.LocalDBSet, error) {
table := NewItemTable(a.GetLocalDB())
for _, log := range receiptData.Logs {
switch log.Ty {
case auty.TyLogPropItem,
auty.TyLogRvkPropItem,
auty.TyLogVotePropItem,
auty.TyLogTmintPropItem:
{
var receipt auty.ReceiptProposalItem
err := types.Decode(log.Log, &receipt)
if err != nil {
return nil, err
}
err = table.Replace(receipt.Current)
if err != nil {
return nil, err
}
}
default:
break
}
}
kvs, err := table.Save()
if err != nil {
return nil, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = append(dbSet.KV, kvs...)
return dbSet, nil
}
func (a *Autonomy) listProposalItem(req *auty.ReqQueryProposalItem) (types.Message, error) {
if req == nil {
return nil, types.ErrInvalidParam
}
localDb := a.GetLocalDB()
query := NewItemTable(localDb).GetQuery(localDb)
var primary []byte
if req.Height > 0 {
primary = []byte(dapp.HeightIndexStr(req.Height, int64(req.Index)))
}
indexName := ""
if req.Status > 0 && req.Addr != "" {
indexName = "addr_status"
} else if req.Status > 0 {
indexName = "status"
} else if req.Addr != "" {
indexName = "addr"
}
cur := &ItemRow{
AutonomyProposalItem: &auty.AutonomyProposalItem{},
}
cur.Address = req.Addr
cur.Status = req.Status
cur.Height = req.Height
cur.Index = req.Index
prefix, err := cur.Get(indexName)
if err != nil {
alog.Error("Get", "indexName", indexName, "err", err)
return nil, err
}
rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction)
if err != nil {
alog.Error("query List failed", "indexName", indexName, "prefix", "prefix", "key", string(primary), "err", err)
return nil, err
}
if len(rows) == 0 {
return nil, types.ErrNotFound
}
var rep auty.ReplyQueryProposalItem
for _, row := range rows {
r, ok := row.Data.(*auty.AutonomyProposalItem)
if !ok {
alog.Error("listProposalItem", "err", "bad row type")
return nil, types.ErrDecode
}
rep.PropItems = append(rep.PropItems, r)
}
return &rep, nil
}
func getProposalItemDb(db dbm.KV, req *types.ReqString) (*auty.ReplyQueryProposalItem, error) {
if req == nil || len(req.Data) <= 0 {
return nil, errors.Wrapf(types.ErrInvalidParam, "invalid parameter")
}
value, err := db.Get(propItemID(req.Data))
if err != nil {
return nil, errors.Wrapf(err, "fail,db.get item id=%s", req.Data)
}
prop := &auty.AutonomyProposalItem{}
err = types.Decode(value, prop)
if err != nil {
return nil, errors.Wrapf(err, "decode item fail")
}
rep := &auty.ReplyQueryProposalItem{}
rep.PropItems = append(rep.PropItems, prop)
return rep, nil
}
// IsAutonomyApprovedItem get 2 parameters: autonomyItemID, applyTxHash
func IsAutonomyApprovedItem(db dbm.KV, req *types.ReqStrings) (types.Message, error) {
rep := &types.Reply{IsOk: false}
if req == nil {
rep.Msg = []byte("req is nill")
return rep, types.ErrInvalidParam
}
if len(req.Datas) < 2 {
rep.Msg = []byte("req datas less 2 parameters")
return rep, types.ErrInvalidParam
}
autonomyItemID := req.Datas[0]
applyTxHash := req.Datas[1]
res, err := getProposalItemDb(db, &types.ReqString{Data: autonomyItemID})
if err != nil {
rep.Msg = []byte(err.Error())
return rep, err
}
if len(res.GetPropItems()) <= 0 {
rep.Msg = []byte("not found item")
return rep, types.ErrNotFound
}
if res.PropItems[0].ProposalID != autonomyItemID {
rep.Msg = []byte(fmt.Sprintf("res prop id=%s not equal query=%s", res.PropItems[0].ProposalID, autonomyItemID))
return rep, errors.Wrapf(types.ErrInvalidParam, "item id=%s,req=%s", res.PropItems[0].ProposalID, autonomyItemID)
}
if res.PropItems[0].PropItem.ItemTxHash != applyTxHash {
rep.Msg = []byte(fmt.Sprintf("res item tx id=%s not equal query=%s", res.PropItems[0].PropItem.ItemTxHash, applyTxHash))
return rep, errors.Wrapf(types.ErrInvalidParam, "item txHash=%s,req=%s", res.PropItems[0].PropItem.ItemTxHash, applyTxHash)
}
if res.PropItems[0].Status == auty.AutonomyStatusTmintPropItem && res.PropItems[0].BoardVoteRes.Pass {
rep.IsOk = true
return rep, nil
}
if res.PropItems[0].Status != auty.AutonomyStatusTmintPropItem {
rep.Msg = []byte(fmt.Sprintf("item status =%d not terminate", res.PropItems[0].Status))
return rep, errors.Wrapf(types.ErrNotAllow, "item status =%d not terminate", res.PropItems[0].Status)
}
rep.Msg = []byte(fmt.Sprintf("item vote status not pass = %v", res.PropItems[0].BoardVoteRes.Pass))
return rep, errors.Wrap(types.ErrNotAllow, "item vote status not pass")
}
This diff is collapsed.
package executor
import (
"fmt"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db/table"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
/*
table struct
data: autonomy item
index: status, addr
*/
var itemOpt = &table.Option{
Prefix: "LODB-autonomy",
Name: "item",
Primary: "heightindex",
Index: []string{"addr", "status", "addr_status"},
}
//NewItemTable 新建表
func NewItemTable(kvdb db.KV) *table.Table {
rowmeta := NewItemRow()
newTable, err := table.NewTable(rowmeta, kvdb, itemOpt)
if err != nil {
panic(err)
}
return newTable
}
//ItemRow table meta 结构
type ItemRow struct {
*auty.AutonomyProposalItem
}
//NewItemRow 新建一个meta 结构
func NewItemRow() *ItemRow {
return &ItemRow{AutonomyProposalItem: &auty.AutonomyProposalItem{}}
}
//CreateRow 新建数据行(注意index 数据一定也要保存到数据中,不能就保存heightindex)
func (r *ItemRow) CreateRow() *table.Row {
return &table.Row{Data: &auty.AutonomyProposalItem{}}
}
//SetPayload 设置数据
func (r *ItemRow) SetPayload(data types.Message) error {
if d, ok := data.(*auty.AutonomyProposalItem); ok {
r.AutonomyProposalItem = d
return nil
}
return types.ErrTypeAsset
}
//Get 按照indexName 查询 indexValue
func (r *ItemRow) Get(key string) ([]byte, error) {
if key == "heightindex" {
return []byte(dapp.HeightIndexStr(r.Height, int64(r.Index))), nil
} else if key == "status" {
return []byte(fmt.Sprintf("%2d", r.Status)), nil
} else if key == "addr" {
return []byte(r.Address), nil
} else if key == "addr_status" {
return []byte(fmt.Sprintf("%s:%2d", r.Address, r.Status)), nil
}
return nil, types.ErrNotFound
}
...@@ -79,3 +79,12 @@ var ( ...@@ -79,3 +79,12 @@ var (
func propChangeID(txHash string) []byte { func propChangeID(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", changePrefix, txHash)) return []byte(fmt.Sprintf("%s%s", changePrefix, txHash))
} }
var (
//item
itemPrefix = idPrefix + "item-"
)
func propItemID(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", itemPrefix, txHash))
}
...@@ -261,7 +261,7 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec ...@@ -261,7 +261,7 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
} }
if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) { if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if cur.BoardVoteRes.TotalVotes != 0 && if cur.BoardVoteRes.TotalVotes != 0 && cur.BoardVoteRes.TotalVotes > cur.BoardVoteRes.QuitVotes &&
float32(cur.BoardVoteRes.ApproveVotes)/float32(cur.BoardVoteRes.TotalVotes-cur.BoardVoteRes.QuitVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 { float32(cur.BoardVoteRes.ApproveVotes)/float32(cur.BoardVoteRes.TotalVotes-cur.BoardVoteRes.QuitVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 {
cur.BoardVoteRes.Pass = true cur.BoardVoteRes.Pass = true
cur.PropProject.RealEndBlockHeight = a.height cur.PropProject.RealEndBlockHeight = a.height
...@@ -463,7 +463,7 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty ...@@ -463,7 +463,7 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
return nil, err return nil, err
} }
if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) { if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if cur.BoardVoteRes.TotalVotes != 0 && if cur.BoardVoteRes.TotalVotes != 0 && cur.BoardVoteRes.TotalVotes > cur.BoardVoteRes.QuitVotes &&
float32(cur.BoardVoteRes.ApproveVotes)/float32(cur.BoardVoteRes.TotalVotes-cur.BoardVoteRes.QuitVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 { float32(cur.BoardVoteRes.ApproveVotes)/float32(cur.BoardVoteRes.TotalVotes-cur.BoardVoteRes.QuitVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 {
cur.BoardVoteRes.Pass = true cur.BoardVoteRes.Pass = true
} else { } else {
......
...@@ -63,3 +63,8 @@ func (a *Autonomy) Query_GetProposalChange(in *types.ReqString) (types.Message, ...@@ -63,3 +63,8 @@ func (a *Autonomy) Query_GetProposalChange(in *types.ReqString) (types.Message,
func (a *Autonomy) Query_ListProposalChange(in *auty.ReqQueryProposalChange) (types.Message, error) { func (a *Autonomy) Query_ListProposalChange(in *auty.ReqQueryProposalChange) (types.Message, error) {
return a.listProposalChange(in) return a.listProposalChange(in)
} }
// Query_GetProposalChange 查询提案修改董事会成员
func (a *Autonomy) Query_IsAutonomyApprovedItem(in *types.ReqStrings) (types.Message, error) {
return IsAutonomyApprovedItem(a.GetStateDB(), in)
}
...@@ -9,6 +9,7 @@ import "board.proto"; ...@@ -9,6 +9,7 @@ import "board.proto";
import "project.proto"; import "project.proto";
import "rule.proto"; import "rule.proto";
import "change.proto"; import "change.proto";
import "item.proto";
package types; package types;
option go_package = "../types"; option go_package = "../types";
...@@ -40,6 +41,13 @@ message AutonomyAction { ...@@ -40,6 +41,13 @@ message AutonomyAction {
RevokeProposalChange rvkPropChange = 17; RevokeProposalChange rvkPropChange = 17;
VoteProposalChange votePropChange = 18; VoteProposalChange votePropChange = 18;
TerminateProposalChange tmintPropChange = 19; TerminateProposalChange tmintPropChange = 19;
//提案事项审核相关
ProposalItem propItem = 21;
RevokeProposalItem rvkPropItem = 22;
VoteProposalItem votePropItem = 23;
TerminateProposalItem tmintPropItem = 24;
} }
int32 ty = 20; int32 ty = 20;
} }
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax = "proto3";
import "lcommon.proto";
package types;
option go_package = "../types";
message AutonomyProposalItem {
ProposalItem propItem = 1;
// 投票该提案的规则
RuleConfig curRule = 2;
// 投票该提案的董事会成员
repeated string boards = 3;
// 董事会投票结果
VoteResult boardVoteRes = 4;
// 状态
int32 status = 6;
string address = 7;
int64 height = 8;
int32 index = 9;
string proposalID = 10;
}
message ProposalItem {
// 提案时间
int32 year = 1;
int32 month = 2;
int32 day = 3;
// 项目相关
string itemTxHash = 4; // item tx hash
string exec = 5; // 合约执行器
int64 itemTxBlockHeight = 6; //需要设置区块高度,太久的item不处理
string description = 7; // 简述
// 投票相关
int64 startBlockHeight = 12; // 提案开始投票高度
int64 endBlockHeight = 13; // 提案结束投票高度
int64 realEndBlockHeight = 14; // 实际提案结束投票高度
int32 projectNeedBlockNum = 15; // 以提案结束投票高度为准,需要项目需要消耗的区块数目所对应的时间
}
message RevokeProposalItem {
string proposalID = 1;
}
message VoteProposalItem {
string proposalID = 1;
bool approve = 2;
AutonomyVoteOption vote = 3;
}
message TerminateProposalItem {
string proposalID = 1;
}
// receipt
message ReceiptProposalItem {
AutonomyProposalItem prev = 1;
AutonomyProposalItem current = 2;
}
message LocalProposalItem {
AutonomyProposalItem propItem = 1;
repeated string comments = 2;
}
// query
message ReqQueryProposalItem {
int32 status = 1;
string addr = 2;
int32 count = 3;
int32 direction = 4;
int64 height = 5;
int32 index = 6;
}
message ReplyQueryProposalItem {
repeated AutonomyProposalItem propItems = 1;
}
...@@ -30,6 +30,11 @@ const ( ...@@ -30,6 +30,11 @@ const (
AutonomyActionVotePropChange AutonomyActionVotePropChange
AutonomyActionTmintPropChange AutonomyActionTmintPropChange
AutonomyActionPropItem
AutonomyActionRvkPropItem
AutonomyActionVotePropItem
AutonomyActionTmintPropItem
//log for autonomy //log for autonomy
TyLogPropBoard = 2101 TyLogPropBoard = 2101
TyLogRvkPropBoard = 2102 TyLogRvkPropBoard = 2102
...@@ -53,6 +58,11 @@ const ( ...@@ -53,6 +58,11 @@ const (
TyLogRvkPropChange = 2142 TyLogRvkPropChange = 2142
TyLogVotePropChange = 2143 TyLogVotePropChange = 2143
TyLogTmintPropChange = 2144 TyLogTmintPropChange = 2144
TyLogPropItem = 2161
TyLogRvkPropItem = 2162
TyLogVotePropItem = 2163
TyLogTmintPropItem = 2164
) )
// Board status // Board status
...@@ -88,6 +98,14 @@ const ( ...@@ -88,6 +98,14 @@ const (
AutonomyStatusTmintPropChange AutonomyStatusTmintPropChange
) )
// Item status
const (
AutonomyStatusProposalItem = iota + 1
AutonomyStatusRvkPropItem
AutonomyStatusVotePropItem
AutonomyStatusTmintPropItem
)
const ( const (
// GetProposalBoard 用于在cmd里面的区分不同的查询 // GetProposalBoard 用于在cmd里面的区分不同的查询
GetProposalBoard = "GetProposalBoard" GetProposalBoard = "GetProposalBoard"
......
...@@ -6,7 +6,6 @@ package executor ...@@ -6,7 +6,6 @@ package executor
import ( import (
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
manager "github.com/33cn/chain33/system/dapp/manage/types"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types" mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
"github.com/pkg/errors" "github.com/pkg/errors"
...@@ -14,8 +13,8 @@ import ( ...@@ -14,8 +13,8 @@ import (
// IsSuperManager is supper manager or not // IsSuperManager is supper manager or not
func isSuperManager(cfg *types.Chain33Config, addr string) bool { func isSuperManager(cfg *types.Chain33Config, addr string) bool {
confManager := types.ConfSub(cfg, manager.ManageX) confMix := types.ConfSub(cfg, mixTy.MixX)
for _, m := range confManager.GStrList("superManager") { for _, m := range confMix.GStrList("mixApprs") {
if addr == m { if addr == m {
return true return true
} }
......
...@@ -960,9 +960,29 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt ...@@ -960,9 +960,29 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
// NodeGroupApprove super addr approve the node group apply // NodeGroupApprove super addr approve the node group apply
func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) { func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
cfg := a.api.GetConfig() cfg := a.api.GetConfig()
//只在主链检查
if !cfg.IsPara() && !isSuperManager(cfg, a.fromaddr) { //只在主链检查, 主链检查失败不会同步到平行链,主链成功,平行链默认成功
return nil, errors.Wrapf(types.ErrNotAllow, "node group approve not super manager:%s", a.fromaddr) if !cfg.IsPara() {
//fork之后采用 autonomy 检查模式
if cfg.IsDappFork(a.height, pt.ParaX, pt.ForkParaAutonomySuperGroup) {
confManager := types.ConfSub(cfg, manager.ManageX)
autonomyExec := confManager.GStr("autonomyExec")
if len(autonomyExec) <= 0 {
return nil, errors.Wrapf(types.ErrNotFound, "manager autonomy key not config")
}
//去autonomy 合约检验是否id approved, 成功 err返回nil
_, err := a.api.QueryChain(&types.ChainExecutor{
Driver: autonomyExec,
FuncName: "IsAutonomyApprovedItem",
Param: types.Encode(&types.ReqStrings{Datas: []string{config.AutonomyItemID, config.Id}}),
})
if err != nil {
return nil, errors.Wrapf(err, "query autonomy,approveid=%s,hashId=%s", config.AutonomyItemID, config.Id)
}
} else if !isSuperManager(cfg, a.fromaddr) {
return nil, errors.Wrapf(types.ErrNotAllow, "node group approve not super manager:%s", a.fromaddr)
}
} }
id, err := getNodeGroupID(cfg, a.db, config.Title, a.exec.GetMainHeight(), config.Id) id, err := getNodeGroupID(cfg, a.db, config.Title, a.exec.GetMainHeight(), config.Id)
......
...@@ -125,6 +125,7 @@ message ParaNodeGroupConfig { ...@@ -125,6 +125,7 @@ message ParaNodeGroupConfig {
string addrs = 4; string addrs = 4;
int64 coinsFrozen = 5; int64 coinsFrozen = 5;
string blsPubKeys = 6; string blsPubKeys = 6;
string autonomyItemID = 7;
} }
message ParaNodeGroupStatus { message ParaNodeGroupStatus {
......
...@@ -26,12 +26,17 @@ var ( ...@@ -26,12 +26,17 @@ var (
MainLoopCheckCommitTxDoneForkHeight = "mainLoopCheckCommitTxDoneForkHeight" MainLoopCheckCommitTxDoneForkHeight = "mainLoopCheckCommitTxDoneForkHeight"
//MainForkParaSupervision = "mainForkParaSupervision" //MainForkParaSupervision = "mainForkParaSupervision"
// ForkParaSelfConsStages 平行链自共识分阶段共识
ForkParaSelfConsStages = "ForkParaSelfConsStages"
// ForkParaAssetTransferRbk 平行链资产转移平行链失败主链回滚 // ForkParaAssetTransferRbk 平行链资产转移平行链失败主链回滚
ForkParaAssetTransferRbk = "ForkParaAssetTransferRbk" ForkParaAssetTransferRbk = "ForkParaAssetTransferRbk"
// ForkParaSupervision 平行链新增监督节点 // ForkParaSupervision 平行链新增监督节点
ForkParaSupervision = "ForkParaSupervision" ForkParaSupervision = "ForkParaSupervision"
//ForkParaAutonomySuperGroup 分叉之后autonomy授权共识账户组,之前是配置超级管理员授权
ForkParaAutonomySuperGroup = "ForkParaAutonomySuperGroup"
//只在平行链开启的分叉
// ForkParaSelfConsStages 平行链自共识分阶段共识
ForkParaSelfConsStages = "ForkParaSelfConsStages"
// ForkParaFullMinerHeight 平行链全挖矿开启高度 // ForkParaFullMinerHeight 平行链全挖矿开启高度
ForkParaFullMinerHeight = "ForkParaFullMinerHeight" ForkParaFullMinerHeight = "ForkParaFullMinerHeight"
// ForkParaRootHash 平行链按照ForkRootHash计算rootHash高度,在之前版本中平行链侧计算txRootHash没有提供正确的主链高度计算,需要分叉 // ForkParaRootHash 平行链按照ForkRootHash计算rootHash高度,在之前版本中平行链侧计算txRootHash没有提供正确的主链高度计算,需要分叉
...@@ -65,6 +70,7 @@ func InitFork(cfg *types.Chain33Config) { ...@@ -65,6 +70,7 @@ func InitFork(cfg *types.Chain33Config) {
cfg.RegisterDappFork(ParaX, ForkLoopCheckCommitTxDone, 3230000) cfg.RegisterDappFork(ParaX, ForkLoopCheckCommitTxDone, 3230000)
cfg.RegisterDappFork(ParaX, ForkParaAssetTransferRbk, 4500000) cfg.RegisterDappFork(ParaX, ForkParaAssetTransferRbk, 4500000)
cfg.RegisterDappFork(ParaX, ForkParaSupervision, 6000000) cfg.RegisterDappFork(ParaX, ForkParaSupervision, 6000000)
cfg.RegisterDappFork(ParaX, ForkParaAutonomySuperGroup, 10000000)
//只在平行链启用 //只在平行链启用
cfg.RegisterDappFork(ParaX, ForkParaSelfConsStages, types.MaxHeight) cfg.RegisterDappFork(ParaX, ForkParaSelfConsStages, types.MaxHeight)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment