Unverified Commit a2907e13 authored by trouble's avatar trouble Committed by GitHub

Merge branch 'master' into feature_exchange

parents b424df05 808969f4
......@@ -114,7 +114,6 @@ function base_init() {
# wallet
sed -i $sedfix 's/^minerdisable=.*/minerdisable=false/g' chain33.toml
sed -i $sedfix 's/^nodeGroupFrozenCoins=.*/nodeGroupFrozenCoins=20/g' chain33.toml
sed -i $sedfix 's/^paraConsensusStopBlocks=.*/paraConsensusStopBlocks=100/g' chain33.toml
# blockchain
......@@ -132,6 +131,10 @@ function base_init() {
sed -i $sedfix 's/^enableReduceLocaldb=.*/enableReduceLocaldb=false/g' chain33.toml
sed -i $sedfix 's/^enablePushSubscribe=.*/enablePushSubscribe=true/g' chain33.toml
fi
#autonomy config
sed -i $sedfix 's/^autonomyExec=.*/autonomyExec=""/g' chain33.toml
}
function start() {
......
......@@ -107,27 +107,24 @@ halvePeriod=1000
[consensus.sub.para]
#主链节点的grpc服务器ip,当前可以支持多ip负载均衡,如“118.31.177.1:8802,39.97.2.127:8802”
#ParaRemoteGrpcClient="118.31.177.1:8802,39.97.2.127:8802,120.77.111.44:8802,jiedian2.bityuan.com,cloud.bityuan.com"
#ParaRemoteGrpcClient="jiedian2.bityuan.com,cloud.bityuan.com"
ParaRemoteGrpcClient="localhost:8802"
#主链指定高度的区块开始同步
startHeight=345850
#主链指定高度后等待块数,防止主链回滚,联盟链最小为1,小于1则采用缺省高度100
#waitMainBlockNum=100
#打包时间间隔,单位
writeBlockSeconds=2
#等待打包主链区块时间间隔,单位毫
writeBlockMsec=2000
#共识节点账户,共识节点需要配置自己的账户,并且钱包导入对应种子,非共识节点留空
authAccount=""
#创世地址额度
genesisAmount=100000000
#主链计算blockhash forkheight,需要和主链保持严格一致,不可修改,1是bityuan主链对应高度, ycc或其他按实际修改
mainBlockHashForkHeight=1
#主链支持平行链共识tx分叉高度,需要和主链保持严格一致,不可修改,2270000是bityuan主链对应高度, ycc或其他按实际修改
#不可为0,主链Local时候需特殊配置
mainForkParacrossCommitTx=2270000
#主链开启循环检查共识交易done的fork高度,需要和主链保持严格一致,不可修改,4320000是bityuan主链对应高度, ycc或其他按实际修改
#不可为0,主链Local时候需特殊配置
mainLoopCheckCommitTxDoneForkHeight=4320000
#mainForkParaSupervision=10400000
#无平行链交易的主链区块间隔,平行链产生一个空块,从高度0开始,配置[blockHeight:interval],比如["0:50","1000:100"]
emptyBlockInterval=["0:50"]
......@@ -190,6 +187,8 @@ genesis="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
[exec.sub.manage]
superManager=["12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"]
#autonomy执行器名字,空则不开启,使用superManager list
autonomyExec=""
[exec.sub.token]
saveTokenTxList=true
......@@ -218,6 +217,8 @@ pointHX="19172955941344617222923168298456110557655645809646772800021167670156933
pointHY="21116962883761739586121793871108889864627195706475546685847911817475098399811"
#电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于
maxTreeLeaves=1024
#管理员列表
mixApprs=[]
#系统中所有的fork,默认用chain33的测试网络的
#但是我们可以替换
......@@ -270,6 +271,8 @@ ForkBadRepeatSecret=0
[fork.sub.manage]
Enable=0
ForkManageExec=0
#manage增加配置需要经过autonomy board成员审批,平行链不开启
ForkManageAutonomyEnable=-1
[fork.sub.token]
Enable=0
......@@ -300,6 +303,8 @@ ForkParaSupervision=0
ForkParaFullMinerHeight=0
#仅平行链适用,在旧的版本中计算blockTxHash输入高度为0,需要在此高度后统一采用新的主链高度值,旧的版本需要设置此分叉高度,新版本缺省为0即可
ForkParaRootHash=0
#nodegroup approve需要经过autonomy board成员审批,平行链不开启
ForkParaAutonomySuperGroup=-1
[fork.sub.evm]
Enable=0
......@@ -393,6 +398,7 @@ ForkUnfreezeIDX= 0
[fork.sub.autonomy]
Enable=0
ForkAutonomyDelRule=0
ForkAutonomyEnableItem=0
[fork.sub.jsvm]
Enable=0
......
......@@ -118,13 +118,13 @@ ParaRemoteGrpcClient="localhost:8802"
startHeight=345850
#主链指定高度后等待块数,防止主链回滚,联盟链最小为1,小于1则采用缺省高度100
#waitMainBlockNum=100
#检索主链最新区块时间间隔,单位
writeBlockSeconds=2
#等待打包主链区块时间间隔,单位毫
writeBlockMsec=2000
#共识节点账户,共识节点需要配置自己的账户,并且钱包导入对应种子,非共识节点留空
authAccount=""
#创世地址额度
genesisAmount=100000000
#主链计算blockhash forkheight,需要和主链保持严格一致,不可修改,1是bityuan主链对应高度, ycc或其他按实际修改
#主链计算blockhash forkheight,需要和主链保持严格一致,不可修改,1是bityuan主链对应高度, ycc或其他按实际修改 --此参数弃用
mainBlockHashForkHeight=1
#主链支持平行链共识tx分叉高度,需要和主链保持严格一致,不可修改,2270000是bityuan主链对应高度, ycc或其他按实际修改
#不可为0,主链Local时候需特殊配置
......@@ -275,6 +275,8 @@ ForkBadRepeatSecret=0
[fork.sub.manage]
Enable=0
ForkManageExec=0
#manage增加配置需要autonomy审批
ForkManageAutonomyEnable=0
[fork.sub.token]
Enable=0
......@@ -305,6 +307,8 @@ ForkParaSupervision=0
ForkParaFullMinerHeight=0
#仅平行链适用,在旧的版本中计算blockTxHash输入高度为0,需要在此高度后统一采用新的主链高度值,旧的版本需要设置此分叉高度,新版本缺省为0即可
ForkParaRootHash=0
#nodegroup approve需要经过autonomy board成员审批
ForkParaAutonomySuperGroup=0
[fork.sub.evm]
Enable=0
......@@ -398,6 +402,7 @@ ForkUnfreezeIDX= 0
[fork.sub.autonomy]
Enable=0
ForkAutonomyDelRule=0
ForkAutonomyEnableItem=0
[fork.sub.jsvm]
Enable=0
......
......@@ -277,6 +277,9 @@ superManager=[
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv",
"1Q8hGLfoGe63efeWa8fJ4Pnukhkngt6poK"
]
#autonomy执行器名字
autonomyExec="autonomy"
[exec.sub.paracross]
nodeGroupFrozenCoins=0
#平行链共识停止后主链等待的高度
......@@ -307,7 +310,7 @@ pointHX="19172955941344617222923168298456110557655645809646772800021167670156933
pointHY="21116962883761739586121793871108889864627195706475546685847911817475098399811"
#电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于
maxTreeLeaves=1024
mixApprs=["12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"]
[metrics]
#是否使能发送metrics数据的发送
......
......@@ -3,7 +3,7 @@ module github.com/33cn/plugin
go 1.15
require (
github.com/33cn/chain33 v1.65.6-0.20211025083411-82c4406c6701
github.com/33cn/chain33 v1.65.6-0.20211118074307-04e724cee41c
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/errors v0.0.0-20181203160057-9f787ce8f69e // indirect
......
......@@ -35,7 +35,7 @@ const (
//current miner tx take any privatekey for unify all nodes sign purpose, and para chain is free
minerPrivateKey = "6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
defaultGenesisAmount int64 = 1e8
poolMainBlockSec int64 = 5
poolMainBlockMsec int64 = 5000
defaultEmptyBlockInterval int64 = 50 //write empty block every interval blocks in mainchain
defaultSearchMatchedBlockDepth int32 = 10000
)
......@@ -70,7 +70,7 @@ type client struct {
}
type subConfig struct {
WriteBlockSeconds int64 `json:"writeBlockSeconds,omitempty"`
WriteBlockMsec int64 `json:"writeBlockMsec,omitempty"`
ParaRemoteGrpcClient string `json:"paraRemoteGrpcClient,omitempty"`
StartHeight int64 `json:"startHeight,omitempty"`
WaitMainBlockNum int64 `json:"waitMainBlockNum,omitempty"`
......@@ -105,8 +105,8 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
subcfg.GenesisAmount = defaultGenesisAmount
}
if subcfg.WriteBlockSeconds <= 0 {
subcfg.WriteBlockSeconds = poolMainBlockSec
if subcfg.WriteBlockMsec <= 0 {
subcfg.WriteBlockMsec = poolMainBlockMsec
}
//WaitMainBlockNum 配置最小为1,因为genesis块是startHeight-1, wait=1和startHeight相等
......@@ -291,7 +291,7 @@ func (client *client) GetStartMainHash(height int64) []byte {
}
if height > 0 {
hint := time.NewTicker(time.Second * time.Duration(client.subCfg.WriteBlockSeconds))
hint := time.NewTicker(time.Second)
for lastHeight < height+client.subCfg.WaitMainBlockNum {
select {
case <-hint.C:
......
......@@ -537,7 +537,7 @@ out:
if err == nil {
continue
}
time.Sleep(time.Second * time.Duration(client.subCfg.WriteBlockSeconds))
time.Sleep(time.Millisecond * time.Duration(client.subCfg.WriteBlockMsec))
continue
}
......
......@@ -63,6 +63,7 @@ func (j *jumpDldClient) getParaHeightList(startHeight, endHeight int64) ([]*type
return heightList, nil
}
//分页查找,只获取范围内的高度
plog.Info("jumpDld.getParaTxHeightList", "start", heights.Items[0].GetHeight(), "end", heights.Items[len(heights.Items)-1].GetHeight())
for _, h := range heights.Items {
if h.Height >= startHeight && h.Height <= endHeight {
heightList = append(heightList, h)
......@@ -280,17 +281,20 @@ func (j *jumpDldClient) getParaTxs(startHeight, endHeight int64, heights []*type
//获取每一排1000个paraTxBlocks
paraBlocks, err := j.getParaTxsBlocks(row, title)
if err != nil {
plog.Error("jumpDld.getParaTxsBlocks", "err", err)
return err
}
//根据1000个paraTxBlocks的头尾高度获取header的头尾高度,header的高度要包含paraTxBlocks高度
headerStart, headerEnd := getHeaderStartEndRange(startHeight, endHeight, heightsRows, i)
plog.Debug("jumpDld.getParaTxs", "headerStart", headerStart, "headerEnd", headerEnd, "i", i)
plog.Info("jumpDld.getParaTxs", "headerStart", headerStart, "headerEnd", headerEnd, "i", i)
err = j.procParaTxHeaders(headerStart, headerEnd, paraBlocks, jobCh)
if err != nil {
plog.Error("jumpDld.procParaTxHeaders", "err", err)
return err
}
if atomic.LoadInt32(&j.downFail) != 0 || j.paraClient.isCancel() {
plog.Error("jumpDld.downFail", "downfail", atomic.LoadInt32(&j.downFail))
return errors.New("verify fail or main thread cancel")
}
}
......
......@@ -69,6 +69,15 @@ func AutonomyCmd() *cobra.Command {
ShowProposalChangeCmd(),
)
// item
cmd.AddCommand(
ProposalItemCmd(),
RevokeProposalItemCmd(),
VoteProposalItemCmd(),
TerminateProposalItemCmd(),
ShowProposalItemCmd(),
)
return cmd
}
......
// 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 commands
import (
"encoding/json"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
)
// ProposalItemCmd 创建提案命令
func ProposalItemCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "proposalItem",
Short: "create proposal Item",
Run: proposalItem,
}
addProposalItemFlags(cmd)
return cmd
}
func addProposalItemFlags(cmd *cobra.Command) {
cmd.Flags().Int32P("year", "y", 0, "year")
cmd.Flags().Int32P("month", "m", 0, "month")
cmd.Flags().Int32P("day", "d", 0, "day")
cmd.Flags().StringP("itemTxHash", "i", "", "the tx to apply check")
cmd.MarkFlagRequired("itemTxHash")
cmd.Flags().StringP("exec", "x", "", "last stage proposal ID")
cmd.Flags().StringP("description", "p", "", "description item")
cmd.Flags().Int64P("startBlock", "s", 0, "start block height")
cmd.MarkFlagRequired("startBlock")
cmd.Flags().Int64P("endBlock", "e", 0, "end block height")
cmd.MarkFlagRequired("endBlock")
}
func proposalItem(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
paraName, _ := cmd.Flags().GetString("paraName")
year, _ := cmd.Flags().GetInt32("year")
month, _ := cmd.Flags().GetInt32("month")
day, _ := cmd.Flags().GetInt32("day")
txHash, _ := cmd.Flags().GetString("itemTxHash")
exec, _ := cmd.Flags().GetString("exec")
description, _ := cmd.Flags().GetString("description")
startBlock, _ := cmd.Flags().GetInt64("startBlock")
endBlock, _ := cmd.Flags().GetInt64("endBlock")
params := &auty.ProposalItem{
Year: year,
Month: month,
Day: day,
ItemTxHash: txHash,
Exec: exec,
Description: description,
StartBlockHeight: startBlock,
EndBlockHeight: endBlock,
}
payLoad, err := json.Marshal(params)
if err != nil {
return
}
pm := &rpctypes.CreateTxIn{
Execer: types.GetExecName(auty.AutonomyX, paraName),
ActionName: "PropItem",
Payload: payLoad,
}
var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", pm, &res)
ctx.RunWithoutMarshal()
}
// RevokeProposalItemCmd 撤销提案
func RevokeProposalItemCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "revokeItem",
Short: "revoke proposal Item",
Run: revokeProposalItem,
}
addRevokeProposalItemFlags(cmd)
return cmd
}
func addRevokeProposalItemFlags(cmd *cobra.Command) {
cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.MarkFlagRequired("proposalID")
}
func revokeProposalItem(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalItem{
ProposalID: ID,
}
payLoad, err := json.Marshal(params)
if err != nil {
return
}
pm := &rpctypes.CreateTxIn{
Execer: types.GetExecName(auty.AutonomyX, paraName),
ActionName: "RvkPropItem",
Payload: payLoad,
}
var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", pm, &res)
ctx.RunWithoutMarshal()
}
// VoteProposalItemCmd 投票提案
func VoteProposalItemCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "voteItem",
Short: "vote proposal Item",
Run: voteProposalItem,
}
addVoteProposalItemFlags(cmd)
return cmd
}
func addVoteProposalItemFlags(cmd *cobra.Command) {
cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.MarkFlagRequired("proposalID")
cmd.Flags().Int32P("approve", "r", 1, "1:approve, 2:oppose, 3:quit, default 1")
}
func voteProposalItem(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
ID, _ := cmd.Flags().GetString("proposalID")
approve, _ := cmd.Flags().GetInt32("approve")
params := &auty.VoteProposalItem{
ProposalID: ID,
Vote: auty.AutonomyVoteOption(approve),
}
payLoad, err := json.Marshal(params)
if err != nil {
return
}
pm := &rpctypes.CreateTxIn{
Execer: types.GetExecName(auty.AutonomyX, paraName),
ActionName: "VotePropItem",
Payload: payLoad,
}
var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", pm, &res)
ctx.RunWithoutMarshal()
}
// TerminateProposalItemCmd 终止提案
func TerminateProposalItemCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "terminateItem",
Short: "terminate proposal Item",
Run: terminateProposalItem,
}
addTerminateProposalItemFlags(cmd)
return cmd
}
func addTerminateProposalItemFlags(cmd *cobra.Command) {
cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.MarkFlagRequired("proposalID")
}
func terminateProposalItem(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalItem{
ProposalID: ID,
}
payLoad, err := json.Marshal(params)
if err != nil {
return
}
pm := &rpctypes.CreateTxIn{
Execer: types.GetExecName(auty.AutonomyX, paraName),
ActionName: "TmintPropItem",
Payload: payLoad,
}
var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", pm, &res)
ctx.RunWithoutMarshal()
}
// ShowProposalItemCmd 显示提案查询信息
func ShowProposalItemCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "showItem",
Short: "show proposal Item info",
Run: showProposalItem,
}
addShowProposalItemflags(cmd)
return cmd
}
func addShowProposalItemflags(cmd *cobra.Command) {
cmd.Flags().Uint32P("type", "y", 0, "type(0:query by hash; 1:list)")
cmd.MarkFlagRequired("type")
cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.Flags().Uint32P("status", "s", 0, "status")
cmd.Flags().StringP("addr", "a", "", "address")
cmd.Flags().Int32P("count", "c", 1, "count, default is 1")
cmd.Flags().Int32P("direction", "d", 0, "direction, default is reserve")
cmd.Flags().Int64P("height", "t", -1, "height, default is -1")
cmd.Flags().Int32P("index", "i", -1, "index, default is -1")
}
func showProposalItem(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
typ, _ := cmd.Flags().GetUint32("type")
propID, _ := cmd.Flags().GetString("proposalID")
status, _ := cmd.Flags().GetUint32("status")
addr, _ := cmd.Flags().GetString("addr")
count, _ := cmd.Flags().GetInt32("count")
direction, _ := cmd.Flags().GetInt32("direction")
height, _ := cmd.Flags().GetInt64("height")
index, _ := cmd.Flags().GetInt32("index")
var params rpctypes.Query4Jrpc
var rep interface{}
params.Execer = auty.AutonomyX
if 0 == typ {
req := types.ReqString{
Data: propID,
}
params.FuncName = auty.GetProposalItem
params.Payload = types.MustPBToJSON(&req)
rep = &auty.ReplyQueryProposalItem{}
} else if 1 == typ {
req := auty.ReqQueryProposalItem{
Status: int32(status),
Addr: addr,
Count: count,
Direction: direction,
Height: height,
Index: index,
}
params.FuncName = auty.ListProposalItem
params.Payload = types.MustPBToJSON(&req)
rep = &auty.ReplyQueryProposalItem{}
}
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.Query", params, rep)
ctx.Run()
}
......@@ -7,6 +7,7 @@ package executor
import (
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/pkg/errors"
)
// 提案董事会相关
......@@ -130,3 +131,39 @@ func (a *Autonomy) Exec_TmintPropChange(payload *auty.TerminateProposalChange, t
action := newAction(a, tx, int32(index))
return action.tmintPropChange(payload)
}
// Exec_PropChange 创建事项规则
func (a *Autonomy) Exec_PropItem(payload *auty.ProposalItem, tx *types.Transaction, index int) (*types.Receipt, error) {
if !a.GetAPI().GetConfig().IsDappFork(a.GetHeight(), auty.AutonomyX, auty.ForkAutonomyEnableItem) {
return nil, errors.Wrapf(types.ErrActionNotSupport, "not after fork")
}
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) {
if !a.GetAPI().GetConfig().IsDappFork(a.GetHeight(), auty.AutonomyX, auty.ForkAutonomyEnableItem) {
return nil, errors.Wrapf(types.ErrActionNotSupport, "not after fork")
}
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) {
if !a.GetAPI().GetConfig().IsDappFork(a.GetHeight(), auty.AutonomyX, auty.ForkAutonomyEnableItem) {
return nil, errors.Wrapf(types.ErrActionNotSupport, "not after fork")
}
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) {
if !a.GetAPI().GetConfig().IsDappFork(a.GetHeight(), auty.AutonomyX, auty.ForkAutonomyEnableItem) {
return nil, errors.Wrapf(types.ErrActionNotSupport, "not after fork")
}
action := newAction(a, tx, int32(index))
return action.tmintPropItem(payload)
}
......@@ -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) {
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 (
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 getProposalItem(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.ReqMultiStrings) (types.Message, error) {
if req == nil {
return nil, errors.Wrapf(types.ErrInvalidParam, "req is nil")
}
if len(req.Datas) < 2 {
return nil, errors.Wrapf(types.ErrInvalidParam, "req datas less 2 parameters")
}
autonomyItemID := req.Datas[0]
applyTxHash := req.Datas[1]
res, err := getProposalItem(db, &types.ReqString{Data: autonomyItemID})
if err != nil {
return nil, err
}
if len(res.GetPropItems()) <= 0 {
return nil, errors.Wrapf(types.ErrNotFound, "not get item")
}
if res.PropItems[0].ProposalID != autonomyItemID {
return nil, errors.Wrapf(types.ErrInvalidParam, "get prop id=%s not equal req=%s", res.PropItems[0].ProposalID, autonomyItemID)
}
if res.PropItems[0].PropItem.ItemTxHash != applyTxHash {
return nil, errors.Wrapf(types.ErrInvalidParam, "get item id=%s != req=%s", res.PropItems[0].PropItem.ItemTxHash, applyTxHash)
}
if res.PropItems[0].Status == auty.AutonomyStatusTmintPropItem && res.PropItems[0].BoardVoteRes.Pass {
return &types.Reply{IsOk: true}, nil
}
if res.PropItems[0].Status != auty.AutonomyStatusTmintPropItem {
return nil, errors.Wrapf(types.ErrNotAllow, "item status =%d not terminate", res.PropItems[0].Status)
}
return nil, errors.Wrapf(types.ErrNotAllow, "item vote status not pass = %v", res.PropItems[0].BoardVoteRes.Pass)
}
// 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 (
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/pkg/errors"
)
const (
itemWaitBlockNumber = 40 * 1000 //4w高度,大概2天
)
func (a *action) propItem(prob *auty.ProposalItem) (*types.Receipt, error) {
//start和end之间不能小于720高度,end不能超过当前高度+100w
if prob.StartBlockHeight < a.height || prob.StartBlockHeight >= prob.EndBlockHeight ||
prob.StartBlockHeight+startEndBlockPeriod > prob.EndBlockHeight ||
prob.EndBlockHeight > a.height+propEndBlockPeriod ||
prob.RealEndBlockHeight != 0 {
return nil, errors.Wrapf(auty.ErrSetBlockHeight, "propItem exe height=%d,start=%d,end=%d,realEnd=%d",
a.height, prob.StartBlockHeight, prob.EndBlockHeight, prob.RealEndBlockHeight)
}
if len(prob.ItemTxHash) <= 0 {
return nil, errors.Wrap(types.ErrInvalidParam, "propItem tx hash nil")
}
// 获取董事会成员
pboard, err := a.getActiveBoard()
if err != nil {
return nil, errors.Wrapf(err, "propItem.getActiveBoard")
}
// 获取当前生效提案规则
rule, err := a.getActiveRule()
if err != nil {
alog.Error("propItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "getActiveRule failed", err)
return nil, err
}
var logs []*types.ReceiptLog
var kv []*types.KeyValue
// 冻结提案金
receipt, err := a.coinsAccount.ExecFrozen(a.fromaddr, a.execaddr, rule.ProposalAmount)
if err != nil {
return nil, errors.Wrapf(err, "propItem.accountFrozen,proposalAmount=%d,addr=%s", rule.ProposalAmount, a.fromaddr)
}
logs = append(logs, receipt.Logs...)
kv = append(kv, receipt.KV...)
cur := &auty.AutonomyProposalItem{
PropItem: prob,
CurRule: rule,
Boards: pboard.Boards,
BoardVoteRes: &auty.VoteResult{TotalVotes: int32(len(pboard.Boards))},
Status: auty.AutonomyStatusProposalItem,
Address: a.fromaddr,
Height: a.height,
Index: a.index,
ProposalID: common.ToHex(a.txhash),
}
kv = append(kv, &types.KeyValue{Key: propItemID(common.ToHex(a.txhash)), Value: types.Encode(cur)})
receiptLog := getItemReceiptLog(nil, cur, auty.TyLogPropItem)
logs = append(logs, receiptLog)
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
}
func (a *action) rvkPropItem(rvkProb *auty.RevokeProposalItem) (*types.Receipt, error) {
cur, err := a.getProposalItem(rvkProb.ProposalID)
if err != nil {
alog.Error("rvkPropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "getProposalItem failed",
rvkProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "rvkPropItem.getItem,id=%s", rvkProb.ProposalID)
}
pre := copyAutonomyProposalItem(cur)
// 检查当前状态
if cur.Status != auty.AutonomyStatusProposalItem {
err := auty.ErrProposalStatus
alog.Error("rvkPropItem ", "addr", a.fromaddr, "status", cur.Status, "status is not match",
rvkProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "rvkPropItem wrong status =%d", cur.Status)
}
start := cur.GetPropItem().StartBlockHeight
if a.height >= start {
err := auty.ErrRevokeProposalPeriod
alog.Error("rvkPropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
rvkProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "rvkPropItem item started, startheight=%d,cur=%d", start, a.height)
}
if a.fromaddr != cur.Address {
err := auty.ErrRevokeProposalPower
alog.Error("rvkPropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
rvkProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "rvkPropItem wrong from addr, from=%s,,cur=%s", a.fromaddr, cur.Address)
}
var logs []*types.ReceiptLog
var kv []*types.KeyValue
// 解冻提案金
receipt, err := a.coinsAccount.ExecActive(a.fromaddr, a.execaddr, cur.CurRule.ProposalAmount)
if err != nil {
alog.Error("rvkPropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "ExecActive amount", cur.CurRule.ProposalAmount, "err", err)
return nil, err
}
logs = append(logs, receipt.Logs...)
kv = append(kv, receipt.KV...)
cur.Status = auty.AutonomyStatusRvkPropItem
kv = append(kv, &types.KeyValue{Key: propItemID(rvkProb.ProposalID), Value: types.Encode(cur)})
receiptLog := getItemReceiptLog(pre, cur, auty.TyLogRvkPropItem)
logs = append(logs, receiptLog)
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
}
func (a *action) votePropItem(voteProb *auty.VoteProposalItem) (*types.Receipt, error) {
cur, err := a.getProposalItem(voteProb.ProposalID)
if err != nil {
alog.Error("votePropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "getProposalItem failed",
voteProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "votePropItem.getItem id=%s", voteProb.ProposalID)
}
pre := copyAutonomyProposalItem(cur)
// 检查当前状态
if cur.Status == auty.AutonomyStatusRvkPropItem ||
cur.Status == auty.AutonomyStatusTmintPropItem {
err := auty.ErrProposalStatus
alog.Error("votePropItem ", "addr", a.fromaddr, "status", cur.Status, "ProposalID",
voteProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "votePropItem cur status=%d", cur.Status)
}
start := cur.GetPropItem().StartBlockHeight
end := cur.GetPropItem().EndBlockHeight
realHeight := cur.GetPropItem().RealEndBlockHeight
if a.height < start || a.height > end || realHeight != 0 {
err := auty.ErrVotePeriod
alog.Error("votePropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "votePropItem current height=%d,start=%d,end=%d,real=%d",
a.height, start, end, realHeight)
}
// 董事会成员验证
var isBoard bool
for _, addr := range cur.Boards {
if addr == a.fromaddr {
isBoard = true
break
}
}
if !isBoard {
err = auty.ErrNoActiveBoard
alog.Error("votePropItem ", "addr", a.fromaddr, "this addr is not active board member",
voteProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "fromAddr notActiveBoardMember proposalid=%s", voteProb.ProposalID)
}
// 检查是否已经参与投票
votes, err := a.checkVotesRecord([]string{a.fromaddr}, boardVotesRecord(voteProb.ProposalID))
if err != nil {
alog.Error("votePropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "checkVotesRecord boardVotesRecord failed",
voteProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "check votes record from addr=%s", a.fromaddr)
}
// 更新已经投票地址
votes.Address = append(votes.Address, a.fromaddr)
// 更新投票结果
switch voteProb.Vote {
case auty.AutonomyVoteOption_APPROVE:
cur.BoardVoteRes.ApproveVotes++
case auty.AutonomyVoteOption_OPPOSE:
cur.BoardVoteRes.OpposeVotes++
case auty.AutonomyVoteOption_QUIT:
cur.BoardVoteRes.QuitVotes++
default:
return nil, errors.Wrapf(types.ErrInvalidParam, "vote option=%d", voteProb.Vote)
}
var logs []*types.ReceiptLog
var kv []*types.KeyValue
// 首次进入投票期,即将提案金转入自治系统地址
if cur.Status == auty.AutonomyStatusProposalItem {
receipt, err := a.coinsAccount.ExecTransferFrozen(cur.Address, a.execaddr, a.execaddr, cur.CurRule.ProposalAmount)
if err != nil {
alog.Error("votePropItem ", "addr", cur.Address, "execaddr", a.execaddr, "ExecTransferFrozen amount fail", err)
return nil, err
}
logs = append(logs, receipt.Logs...)
kv = append(kv, receipt.KV...)
}
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 {
cur.BoardVoteRes.Pass = true
cur.PropItem.RealEndBlockHeight = a.height
}
key := propItemID(voteProb.ProposalID)
cur.Status = auty.AutonomyStatusVotePropItem
if cur.BoardVoteRes.Pass {
cur.Status = auty.AutonomyStatusTmintPropItem
}
kv = append(kv, &types.KeyValue{Key: key, Value: types.Encode(cur)})
// 更新VotesRecord
kv = append(kv, &types.KeyValue{Key: boardVotesRecord(voteProb.ProposalID), Value: types.Encode(votes)})
ty := auty.TyLogVotePropItem
if cur.BoardVoteRes.Pass {
ty = auty.TyLogTmintPropItem
}
receiptLog := getItemReceiptLog(pre, cur, int32(ty))
logs = append(logs, receiptLog)
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
}
func (a *action) tmintPropItem(tmintProb *auty.TerminateProposalItem) (*types.Receipt, error) {
cur, err := a.getProposalItem(tmintProb.ProposalID)
if err != nil {
alog.Error("tmintPropItem ", "addr", a.fromaddr, "execaddr", a.execaddr, "getProposalItem failed",
tmintProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "get item id=%s", tmintProb.ProposalID)
}
pre := copyAutonomyProposalItem(cur)
// 检查当前状态
if cur.Status == auty.AutonomyStatusTmintPropItem ||
cur.Status == auty.AutonomyStatusRvkPropItem {
err := auty.ErrProposalStatus
alog.Error("tmintPropItem ", "addr", a.fromaddr, "status", cur.Status, "status is not match",
tmintProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "cur status=%d", cur.Status)
}
// 董事会投票期间不能终止
end := cur.GetPropItem().EndBlockHeight
if !cur.BoardVoteRes.Pass && a.height <= end {
err := auty.ErrTerminatePeriod
alog.Error("tmintPropItem ", "addr", a.fromaddr, "status", cur.Status, "height", a.height,
"in board vote period can not terminate", tmintProb.ProposalID, "err", err)
return nil, errors.Wrapf(err, "vote period not should be terminated")
}
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 {
cur.BoardVoteRes.Pass = true
} else {
cur.BoardVoteRes.Pass = false
}
cur.PropItem.RealEndBlockHeight = a.height
var logs []*types.ReceiptLog
var kv []*types.KeyValue
// 如果为提案状态,则判断是否需要扣除提案费
if cur.Status == auty.AutonomyStatusProposalItem && a.height > end {
receipt, err := a.coinsAccount.ExecTransferFrozen(cur.Address, a.execaddr, a.execaddr, cur.CurRule.ProposalAmount)
if err != nil {
alog.Error("tmintPropItem ", "addr", cur.Address, "execaddr", a.execaddr, "ExecTransferFrozen amount fail", err)
return nil, err
}
logs = append(logs, receipt.Logs...)
kv = append(kv, receipt.KV...)
}
cur.Status = auty.AutonomyStatusTmintPropItem
kv = append(kv, &types.KeyValue{Key: propItemID(tmintProb.ProposalID), Value: types.Encode(cur)})
receiptLog := getItemReceiptLog(pre, cur, auty.TyLogTmintPropItem)
logs = append(logs, receiptLog)
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
}
func (a *action) getProposalItem(ID string) (*auty.AutonomyProposalItem, error) {
value, err := a.db.Get(propItemID(ID))
if err != nil {
return nil, err
}
cur := &auty.AutonomyProposalItem{}
err = types.Decode(value, cur)
if err != nil {
return nil, err
}
return cur, nil
}
// getItemReceiptLog 根据提案信息获取log
// 状态变化:
func getItemReceiptLog(pre, cur *auty.AutonomyProposalItem, ty int32) *types.ReceiptLog {
log := &types.ReceiptLog{}
log.Ty = ty
r := &auty.ReceiptProposalItem{Prev: pre, Current: cur}
log.Log = types.Encode(r)
return log
}
func copyAutonomyProposalItem(cur *auty.AutonomyProposalItem) *auty.AutonomyProposalItem {
if cur == nil {
return nil
}
newAut := *cur
if cur.PropItem != nil {
newItem := *cur.GetPropItem()
newAut.PropItem = &newItem
}
if cur.CurRule != nil {
newRule := *cur.GetCurRule()
newAut.CurRule = &newRule
}
if len(cur.Boards) > 0 {
newAut.Boards = make([]string, len(cur.Boards))
copy(newAut.Boards, cur.Boards)
}
if cur.BoardVoteRes != nil {
newRes := *cur.GetBoardVoteRes()
newAut.BoardVoteRes = &newRes
}
return &newAut
}
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 (
func propChangeID(txHash string) []byte {
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
}
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 {
cur.BoardVoteRes.Pass = true
cur.PropProject.RealEndBlockHeight = a.height
......@@ -463,7 +463,7 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
return nil, err
}
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 {
cur.BoardVoteRes.Pass = true
} else {
......
......@@ -63,3 +63,18 @@ func (a *Autonomy) Query_GetProposalChange(in *types.ReqString) (types.Message,
func (a *Autonomy) Query_ListProposalChange(in *auty.ReqQueryProposalChange) (types.Message, error) {
return a.listProposalChange(in)
}
// Query_GetProposalItem 查询提案
func (a *Autonomy) Query_GetProposalItem(in *types.ReqString) (types.Message, error) {
return getProposalItem(a.GetStateDB(), in)
}
// Query_ListProposalItem 批量查询
func (a *Autonomy) Query_ListProposalItem(in *auty.ReqQueryProposalItem) (types.Message, error) {
return a.listProposalItem(in)
}
// Query_GetProposalChange 查询提案修改董事会成员
func (a *Autonomy) Query_IsAutonomyApprovedItem(in *types.ReqMultiStrings) (types.Message, error) {
return IsAutonomyApprovedItem(a.GetStateDB(), in)
}
......@@ -9,6 +9,7 @@ import "board.proto";
import "project.proto";
import "rule.proto";
import "change.proto";
import "item.proto";
package types;
option go_package = "../types";
......@@ -40,6 +41,13 @@ message AutonomyAction {
RevokeProposalChange rvkPropChange = 17;
VoteProposalChange votePropChange = 18;
TerminateProposalChange tmintPropChange = 19;
//提案事项审核相关
ProposalItem propItem = 21;
RevokeProposalItem rvkPropItem = 22;
VoteProposalItem votePropItem = 23;
TerminateProposalItem tmintPropItem = 24;
}
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; // 合约执行器
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;
}
......@@ -51,6 +51,10 @@ type AutonomyAction struct {
// *AutonomyAction_RvkPropChange
// *AutonomyAction_VotePropChange
// *AutonomyAction_TmintPropChange
// *AutonomyAction_PropItem
// *AutonomyAction_RvkPropItem
// *AutonomyAction_VotePropItem
// *AutonomyAction_TmintPropItem
Value isAutonomyAction_Value `protobuf_oneof:"value"`
Ty int32 `protobuf:"varint,20,opt,name=ty,proto3" json:"ty,omitempty"`
}
......@@ -227,6 +231,34 @@ func (x *AutonomyAction) GetTmintPropChange() *TerminateProposalChange {
return nil
}
func (x *AutonomyAction) GetPropItem() *ProposalItem {
if x, ok := x.GetValue().(*AutonomyAction_PropItem); ok {
return x.PropItem
}
return nil
}
func (x *AutonomyAction) GetRvkPropItem() *RevokeProposalItem {
if x, ok := x.GetValue().(*AutonomyAction_RvkPropItem); ok {
return x.RvkPropItem
}
return nil
}
func (x *AutonomyAction) GetVotePropItem() *VoteProposalItem {
if x, ok := x.GetValue().(*AutonomyAction_VotePropItem); ok {
return x.VotePropItem
}
return nil
}
func (x *AutonomyAction) GetTmintPropItem() *TerminateProposalItem {
if x, ok := x.GetValue().(*AutonomyAction_TmintPropItem); ok {
return x.TmintPropItem
}
return nil
}
func (x *AutonomyAction) GetTy() int32 {
if x != nil {
return x.Ty
......@@ -319,6 +351,23 @@ type AutonomyAction_TmintPropChange struct {
TmintPropChange *TerminateProposalChange `protobuf:"bytes,19,opt,name=tmintPropChange,proto3,oneof"`
}
type AutonomyAction_PropItem struct {
//提案事项审核相关
PropItem *ProposalItem `protobuf:"bytes,21,opt,name=propItem,proto3,oneof"`
}
type AutonomyAction_RvkPropItem struct {
RvkPropItem *RevokeProposalItem `protobuf:"bytes,22,opt,name=rvkPropItem,proto3,oneof"`
}
type AutonomyAction_VotePropItem struct {
VotePropItem *VoteProposalItem `protobuf:"bytes,23,opt,name=votePropItem,proto3,oneof"`
}
type AutonomyAction_TmintPropItem struct {
TmintPropItem *TerminateProposalItem `protobuf:"bytes,24,opt,name=tmintPropItem,proto3,oneof"`
}
func (*AutonomyAction_PropBoard) isAutonomyAction_Value() {}
func (*AutonomyAction_RvkPropBoard) isAutonomyAction_Value() {}
......@@ -357,6 +406,14 @@ func (*AutonomyAction_VotePropChange) isAutonomyAction_Value() {}
func (*AutonomyAction_TmintPropChange) isAutonomyAction_Value() {}
func (*AutonomyAction_PropItem) isAutonomyAction_Value() {}
func (*AutonomyAction_RvkPropItem) isAutonomyAction_Value() {}
func (*AutonomyAction_VotePropItem) isAutonomyAction_Value() {}
func (*AutonomyAction_TmintPropItem) isAutonomyAction_Value() {}
var File_autonomy_proto protoreflect.FileDescriptor
var file_autonomy_proto_rawDesc = []byte{
......@@ -364,89 +421,105 @@ var file_autonomy_proto_rawDesc = []byte{
0x12, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x0b, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x0c, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x0a,
0x0a, 0x0e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x34, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f,
0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x40, 0x0a, 0x0c, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f,
0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x72, 0x76, 0x6b, 0x50,
0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x40, 0x0a, 0x0d, 0x76, 0x6f, 0x74, 0x65,
0x50, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x76, 0x6f, 0x74,
0x65, 0x50, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x47, 0x0a, 0x0e, 0x74, 0x6d,
0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69,
0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72,
0x64, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x42, 0x6f,
0x61, 0x72, 0x64, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65,
0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x48, 0x00, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12,
0x46, 0x0a, 0x0e, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63,
0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72,
0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70,
0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x46, 0x0a, 0x0f, 0x76, 0x6f, 0x74, 0x65, 0x50,
0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1a, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0f,
0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12,
0x4f, 0x0a, 0x12, 0x70, 0x75, 0x62, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72,
0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2e, 0x50, 0x75, 0x62, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x12, 0x70, 0x75,
0x62, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x12, 0x4d, 0x0a, 0x10, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f,
0x6a, 0x65, 0x63, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x10, 0x74,
0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12,
0x31, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73,
0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x52, 0x75,
0x6c, 0x65, 0x12, 0x3d, 0x0a, 0x0b, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c,
0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75,
0x6c, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c,
0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c,
0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65,
0x48, 0x00, 0x52, 0x0c, 0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65,
0x12, 0x44, 0x0a, 0x0d, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c,
0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x6c, 0x52, 0x75, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72,
0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66,
0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x46, 0x75, 0x6e, 0x64, 0x48, 0x00, 0x52,
0x08, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x0b, 0x63, 0x6f, 0x6d,
0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00,
0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x12, 0x37, 0x0a,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73,
0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70,
0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f,
0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x76,
0x6b, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x76,
0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x12, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00,
0x52, 0x0e, 0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x12, 0x4a, 0x0a, 0x0f, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65,
0x73, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x74, 0x6d, 0x69,
0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02,
0x74, 0x79, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65,
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x0c, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x69,
0x74, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x0b, 0x0a, 0x0e, 0x41, 0x75,
0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x09,
0x70, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x42, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61,
0x72, 0x64, 0x12, 0x40, 0x0a, 0x0c, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61,
0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42,
0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x42,
0x6f, 0x61, 0x72, 0x64, 0x12, 0x40, 0x0a, 0x0d, 0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70,
0x42, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x42, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f,
0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x47, 0x0a, 0x0e, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50,
0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d,
0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52,
0x0e, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12,
0x3a, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0b,
0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x46, 0x0a, 0x0e, 0x72,
0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x06, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x76, 0x6f,
0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63,
0x74, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a,
0x65, 0x63, 0x74, 0x12, 0x46, 0x0a, 0x0f, 0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x50,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x76, 0x6f, 0x74, 0x65,
0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4f, 0x0a, 0x12, 0x70,
0x75, 0x62, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63,
0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x50, 0x75, 0x62, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x12, 0x70, 0x75, 0x62, 0x56, 0x6f, 0x74,
0x65, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4d, 0x0a, 0x10,
0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54,
0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x10, 0x74, 0x6d, 0x69, 0x6e, 0x74,
0x50, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x70,
0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75,
0x6c, 0x65, 0x48, 0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x3d,
0x0a, 0x0b, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x18, 0x0b, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x76, 0x6f,
0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x48, 0x00,
0x52, 0x0b, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x3d, 0x0a,
0x0c, 0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x18, 0x0c, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x0c,
0x76, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x44, 0x0a, 0x0d,
0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x18, 0x0d, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x65, 0x72, 0x6d,
0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c,
0x65, 0x48, 0x00, 0x52, 0x0d, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x52, 0x75,
0x6c, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x18, 0x0e,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61,
0x6e, 0x73, 0x66, 0x65, 0x72, 0x46, 0x75, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x08, 0x74, 0x72, 0x61,
0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
0x50, 0x72, 0x6f, 0x70, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x6f,
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x12, 0x37, 0x0a, 0x0a, 0x70, 0x72, 0x6f,
0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68,
0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x79, 0x70, 0x65,
0x73, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x76, 0x6b, 0x50, 0x72, 0x6f,
0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x76, 0x6f, 0x74, 0x65, 0x50,
0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x76, 0x6f,
0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x4a, 0x0a, 0x0f,
0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18,
0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x65,
0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72,
0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70,
0x49, 0x74, 0x65, 0x6d, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x48,
0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x3d, 0x0a, 0x0b, 0x72,
0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52, 0x0b, 0x72,
0x76, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x3d, 0x0a, 0x0c, 0x76, 0x6f,
0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52, 0x0c, 0x76, 0x6f, 0x74,
0x65, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x44, 0x0a, 0x0d, 0x74, 0x6d, 0x69,
0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61,
0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00,
0x52, 0x0d, 0x74, 0x6d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12,
0x0e, 0x0a, 0x02, 0x74, 0x79, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x79, 0x42,
0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74,
0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
......@@ -483,6 +556,10 @@ var file_autonomy_proto_goTypes = []interface{}{
(*RevokeProposalChange)(nil), // 17: types.RevokeProposalChange
(*VoteProposalChange)(nil), // 18: types.VoteProposalChange
(*TerminateProposalChange)(nil), // 19: types.TerminateProposalChange
(*ProposalItem)(nil), // 20: types.ProposalItem
(*RevokeProposalItem)(nil), // 21: types.RevokeProposalItem
(*VoteProposalItem)(nil), // 22: types.VoteProposalItem
(*TerminateProposalItem)(nil), // 23: types.TerminateProposalItem
}
var file_autonomy_proto_depIdxs = []int32{
1, // 0: types.AutonomyAction.propBoard:type_name -> types.ProposalBoard
......@@ -504,11 +581,15 @@ var file_autonomy_proto_depIdxs = []int32{
17, // 16: types.AutonomyAction.rvkPropChange:type_name -> types.RevokeProposalChange
18, // 17: types.AutonomyAction.votePropChange:type_name -> types.VoteProposalChange
19, // 18: types.AutonomyAction.tmintPropChange:type_name -> types.TerminateProposalChange
19, // [19:19] is the sub-list for method output_type
19, // [19:19] is the sub-list for method input_type
19, // [19:19] is the sub-list for extension type_name
19, // [19:19] is the sub-list for extension extendee
0, // [0:19] is the sub-list for field type_name
20, // 19: types.AutonomyAction.propItem:type_name -> types.ProposalItem
21, // 20: types.AutonomyAction.rvkPropItem:type_name -> types.RevokeProposalItem
22, // 21: types.AutonomyAction.votePropItem:type_name -> types.VoteProposalItem
23, // 22: types.AutonomyAction.tmintPropItem:type_name -> types.TerminateProposalItem
23, // [23:23] is the sub-list for method output_type
23, // [23:23] is the sub-list for method input_type
23, // [23:23] is the sub-list for extension type_name
23, // [23:23] is the sub-list for extension extendee
0, // [0:23] is the sub-list for field type_name
}
func init() { file_autonomy_proto_init() }
......@@ -520,6 +601,7 @@ func file_autonomy_proto_init() {
file_project_proto_init()
file_rule_proto_init()
file_change_proto_init()
file_item_proto_init()
if !protoimpl.UnsafeEnabled {
file_autonomy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AutonomyAction); i {
......@@ -554,6 +636,10 @@ func file_autonomy_proto_init() {
(*AutonomyAction_RvkPropChange)(nil),
(*AutonomyAction_VotePropChange)(nil),
(*AutonomyAction_TmintPropChange)(nil),
(*AutonomyAction_PropItem)(nil),
(*AutonomyAction_RvkPropItem)(nil),
(*AutonomyAction_VotePropItem)(nil),
(*AutonomyAction_TmintPropItem)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
......
......@@ -30,6 +30,11 @@ const (
AutonomyActionVotePropChange
AutonomyActionTmintPropChange
AutonomyActionPropItem
AutonomyActionRvkPropItem
AutonomyActionVotePropItem
AutonomyActionTmintPropItem
//log for autonomy
TyLogPropBoard = 2101
TyLogRvkPropBoard = 2102
......@@ -53,6 +58,11 @@ const (
TyLogRvkPropChange = 2142
TyLogVotePropChange = 2143
TyLogTmintPropChange = 2144
TyLogPropItem = 2161
TyLogRvkPropItem = 2162
TyLogVotePropItem = 2163
TyLogTmintPropItem = 2164
)
// Board status
......@@ -88,6 +98,14 @@ const (
AutonomyStatusTmintPropChange
)
// Item status
const (
AutonomyStatusProposalItem = iota + 1
AutonomyStatusRvkPropItem
AutonomyStatusVotePropItem
AutonomyStatusTmintPropItem
)
const (
// GetProposalBoard 用于在cmd里面的区分不同的查询
GetProposalBoard = "GetProposalBoard"
......@@ -111,6 +129,11 @@ const (
GetProposalChange = "GetProposalChange"
// ListProposalChange 查询多个
ListProposalChange = "ListProposalChange"
// GetProposalItem 用于在cmd里面的区分不同的查询
GetProposalItem = "GetProposalItem"
// ListProposalItem 查询多个
ListProposalItem = "ListProposalItem"
)
//包的名字可以通过配置文件来配置
......
// 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.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.9.1
// source: item.proto
package types
import (
reflect "reflect"
sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type AutonomyProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PropItem *ProposalItem `protobuf:"bytes,1,opt,name=propItem,proto3" json:"propItem,omitempty"`
// 投票该提案的规则
CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule,proto3" json:"curRule,omitempty"`
// 投票该提案的董事会成员
Boards []string `protobuf:"bytes,3,rep,name=boards,proto3" json:"boards,omitempty"`
// 董事会投票结果
BoardVoteRes *VoteResult `protobuf:"bytes,4,opt,name=boardVoteRes,proto3" json:"boardVoteRes,omitempty"`
// 状态
Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"`
Address string `protobuf:"bytes,7,opt,name=address,proto3" json:"address,omitempty"`
Height int64 `protobuf:"varint,8,opt,name=height,proto3" json:"height,omitempty"`
Index int32 `protobuf:"varint,9,opt,name=index,proto3" json:"index,omitempty"`
ProposalID string `protobuf:"bytes,10,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
}
func (x *AutonomyProposalItem) Reset() {
*x = AutonomyProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AutonomyProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AutonomyProposalItem) ProtoMessage() {}
func (x *AutonomyProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AutonomyProposalItem.ProtoReflect.Descriptor instead.
func (*AutonomyProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{0}
}
func (x *AutonomyProposalItem) GetPropItem() *ProposalItem {
if x != nil {
return x.PropItem
}
return nil
}
func (x *AutonomyProposalItem) GetCurRule() *RuleConfig {
if x != nil {
return x.CurRule
}
return nil
}
func (x *AutonomyProposalItem) GetBoards() []string {
if x != nil {
return x.Boards
}
return nil
}
func (x *AutonomyProposalItem) GetBoardVoteRes() *VoteResult {
if x != nil {
return x.BoardVoteRes
}
return nil
}
func (x *AutonomyProposalItem) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *AutonomyProposalItem) GetAddress() string {
if x != nil {
return x.Address
}
return ""
}
func (x *AutonomyProposalItem) GetHeight() int64 {
if x != nil {
return x.Height
}
return 0
}
func (x *AutonomyProposalItem) GetIndex() int32 {
if x != nil {
return x.Index
}
return 0
}
func (x *AutonomyProposalItem) GetProposalID() string {
if x != nil {
return x.ProposalID
}
return ""
}
type ProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 提案时间
Year int32 `protobuf:"varint,1,opt,name=year,proto3" json:"year,omitempty"`
Month int32 `protobuf:"varint,2,opt,name=month,proto3" json:"month,omitempty"`
Day int32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"`
// 项目相关
ItemTxHash string `protobuf:"bytes,4,opt,name=itemTxHash,proto3" json:"itemTxHash,omitempty"` // item tx hash
Exec string `protobuf:"bytes,5,opt,name=exec,proto3" json:"exec,omitempty"` // 合约执行器
Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` // 简述
// 投票相关
StartBlockHeight int64 `protobuf:"varint,12,opt,name=startBlockHeight,proto3" json:"startBlockHeight,omitempty"` // 提案开始投票高度
EndBlockHeight int64 `protobuf:"varint,13,opt,name=endBlockHeight,proto3" json:"endBlockHeight,omitempty"` // 提案结束投票高度
RealEndBlockHeight int64 `protobuf:"varint,14,opt,name=realEndBlockHeight,proto3" json:"realEndBlockHeight,omitempty"` // 实际提案结束投票高度
ProjectNeedBlockNum int32 `protobuf:"varint,15,opt,name=projectNeedBlockNum,proto3" json:"projectNeedBlockNum,omitempty"` // 以提案结束投票高度为准,需要项目需要消耗的区块数目所对应的时间
}
func (x *ProposalItem) Reset() {
*x = ProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProposalItem) ProtoMessage() {}
func (x *ProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProposalItem.ProtoReflect.Descriptor instead.
func (*ProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{1}
}
func (x *ProposalItem) GetYear() int32 {
if x != nil {
return x.Year
}
return 0
}
func (x *ProposalItem) GetMonth() int32 {
if x != nil {
return x.Month
}
return 0
}
func (x *ProposalItem) GetDay() int32 {
if x != nil {
return x.Day
}
return 0
}
func (x *ProposalItem) GetItemTxHash() string {
if x != nil {
return x.ItemTxHash
}
return ""
}
func (x *ProposalItem) GetExec() string {
if x != nil {
return x.Exec
}
return ""
}
func (x *ProposalItem) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *ProposalItem) GetStartBlockHeight() int64 {
if x != nil {
return x.StartBlockHeight
}
return 0
}
func (x *ProposalItem) GetEndBlockHeight() int64 {
if x != nil {
return x.EndBlockHeight
}
return 0
}
func (x *ProposalItem) GetRealEndBlockHeight() int64 {
if x != nil {
return x.RealEndBlockHeight
}
return 0
}
func (x *ProposalItem) GetProjectNeedBlockNum() int32 {
if x != nil {
return x.ProjectNeedBlockNum
}
return 0
}
type RevokeProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
}
func (x *RevokeProposalItem) Reset() {
*x = RevokeProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RevokeProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RevokeProposalItem) ProtoMessage() {}
func (x *RevokeProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RevokeProposalItem.ProtoReflect.Descriptor instead.
func (*RevokeProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{2}
}
func (x *RevokeProposalItem) GetProposalID() string {
if x != nil {
return x.ProposalID
}
return ""
}
type VoteProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"`
Vote AutonomyVoteOption `protobuf:"varint,3,opt,name=vote,proto3,enum=types.AutonomyVoteOption" json:"vote,omitempty"`
}
func (x *VoteProposalItem) Reset() {
*x = VoteProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *VoteProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VoteProposalItem) ProtoMessage() {}
func (x *VoteProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VoteProposalItem.ProtoReflect.Descriptor instead.
func (*VoteProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{3}
}
func (x *VoteProposalItem) GetProposalID() string {
if x != nil {
return x.ProposalID
}
return ""
}
func (x *VoteProposalItem) GetApprove() bool {
if x != nil {
return x.Approve
}
return false
}
func (x *VoteProposalItem) GetVote() AutonomyVoteOption {
if x != nil {
return x.Vote
}
return AutonomyVoteOption_NOJOIN
}
type TerminateProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
}
func (x *TerminateProposalItem) Reset() {
*x = TerminateProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TerminateProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TerminateProposalItem) ProtoMessage() {}
func (x *TerminateProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TerminateProposalItem.ProtoReflect.Descriptor instead.
func (*TerminateProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{4}
}
func (x *TerminateProposalItem) GetProposalID() string {
if x != nil {
return x.ProposalID
}
return ""
}
// receipt
type ReceiptProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Prev *AutonomyProposalItem `protobuf:"bytes,1,opt,name=prev,proto3" json:"prev,omitempty"`
Current *AutonomyProposalItem `protobuf:"bytes,2,opt,name=current,proto3" json:"current,omitempty"`
}
func (x *ReceiptProposalItem) Reset() {
*x = ReceiptProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReceiptProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReceiptProposalItem) ProtoMessage() {}
func (x *ReceiptProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReceiptProposalItem.ProtoReflect.Descriptor instead.
func (*ReceiptProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{5}
}
func (x *ReceiptProposalItem) GetPrev() *AutonomyProposalItem {
if x != nil {
return x.Prev
}
return nil
}
func (x *ReceiptProposalItem) GetCurrent() *AutonomyProposalItem {
if x != nil {
return x.Current
}
return nil
}
type LocalProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PropItem *AutonomyProposalItem `protobuf:"bytes,1,opt,name=propItem,proto3" json:"propItem,omitempty"`
Comments []string `protobuf:"bytes,2,rep,name=comments,proto3" json:"comments,omitempty"`
}
func (x *LocalProposalItem) Reset() {
*x = LocalProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LocalProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LocalProposalItem) ProtoMessage() {}
func (x *LocalProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LocalProposalItem.ProtoReflect.Descriptor instead.
func (*LocalProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{6}
}
func (x *LocalProposalItem) GetPropItem() *AutonomyProposalItem {
if x != nil {
return x.PropItem
}
return nil
}
func (x *LocalProposalItem) GetComments() []string {
if x != nil {
return x.Comments
}
return nil
}
// query
type ReqQueryProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
Count int32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`
Direction int32 `protobuf:"varint,4,opt,name=direction,proto3" json:"direction,omitempty"`
Height int64 `protobuf:"varint,5,opt,name=height,proto3" json:"height,omitempty"`
Index int32 `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"`
}
func (x *ReqQueryProposalItem) Reset() {
*x = ReqQueryProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReqQueryProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReqQueryProposalItem) ProtoMessage() {}
func (x *ReqQueryProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReqQueryProposalItem.ProtoReflect.Descriptor instead.
func (*ReqQueryProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{7}
}
func (x *ReqQueryProposalItem) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *ReqQueryProposalItem) GetAddr() string {
if x != nil {
return x.Addr
}
return ""
}
func (x *ReqQueryProposalItem) GetCount() int32 {
if x != nil {
return x.Count
}
return 0
}
func (x *ReqQueryProposalItem) GetDirection() int32 {
if x != nil {
return x.Direction
}
return 0
}
func (x *ReqQueryProposalItem) GetHeight() int64 {
if x != nil {
return x.Height
}
return 0
}
func (x *ReqQueryProposalItem) GetIndex() int32 {
if x != nil {
return x.Index
}
return 0
}
type ReplyQueryProposalItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PropItems []*AutonomyProposalItem `protobuf:"bytes,1,rep,name=propItems,proto3" json:"propItems,omitempty"`
}
func (x *ReplyQueryProposalItem) Reset() {
*x = ReplyQueryProposalItem{}
if protoimpl.UnsafeEnabled {
mi := &file_item_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReplyQueryProposalItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReplyQueryProposalItem) ProtoMessage() {}
func (x *ReplyQueryProposalItem) ProtoReflect() protoreflect.Message {
mi := &file_item_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReplyQueryProposalItem.ProtoReflect.Descriptor instead.
func (*ReplyQueryProposalItem) Descriptor() ([]byte, []int) {
return file_item_proto_rawDescGZIP(), []int{8}
}
func (x *ReplyQueryProposalItem) GetPropItems() []*AutonomyProposalItem {
if x != nil {
return x.PropItems
}
return nil
}
var File_item_proto protoreflect.FileDescriptor
var file_item_proto_rawDesc = []byte{
0x0a, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x74, 0x79,
0x70, 0x65, 0x73, 0x1a, 0x0d, 0x6c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0xc3, 0x02, 0x0a, 0x14, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2f, 0x0a, 0x08, 0x70,
0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74,
0x65, 0x6d, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2b, 0x0a, 0x07,
0x63, 0x75, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x52, 0x07, 0x63, 0x75, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x61,
0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64,
0x73, 0x12, 0x35, 0x0a, 0x0c, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65,
0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0c, 0x62, 0x6f, 0x61, 0x72,
0x64, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65,
0x69, 0x67, 0x68, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67,
0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28,
0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72,
0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0xd6, 0x02, 0x0a, 0x0c, 0x50, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x65, 0x61,
0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x79, 0x65, 0x61, 0x72, 0x12, 0x14, 0x0a,
0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x6f,
0x6e, 0x74, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x78, 0x48,
0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x54,
0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x78, 0x65, 0x63, 0x18, 0x05, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x65, 0x78, 0x65, 0x63, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73,
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x10, 0x73,
0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18,
0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x65, 0x6e, 0x64, 0x42, 0x6c,
0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0e, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12,
0x2e, 0x0a, 0x12, 0x72, 0x65, 0x61, 0x6c, 0x45, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48,
0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x72, 0x65, 0x61,
0x6c, 0x45, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12,
0x30, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x42, 0x6c,
0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x70, 0x72,
0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75,
0x6d, 0x22, 0x34, 0x0a, 0x12, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x7b, 0x0a, 0x10, 0x56, 0x6f, 0x74, 0x65, 0x50,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x70,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x61,
0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x61, 0x70,
0x70, 0x72, 0x6f, 0x76, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f,
0x6e, 0x6f, 0x6d, 0x79, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04,
0x76, 0x6f, 0x74, 0x65, 0x22, 0x37, 0x0a, 0x15, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74,
0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1e, 0x0a,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x7d, 0x0a,
0x13, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x49, 0x74, 0x65, 0x6d, 0x12, 0x2f, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e,
0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52,
0x04, 0x70, 0x72, 0x65, 0x76, 0x12, 0x35, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41,
0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49,
0x74, 0x65, 0x6d, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x68, 0x0a, 0x11,
0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65,
0x6d, 0x12, 0x37, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f,
0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d,
0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f,
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f,
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x71, 0x51, 0x75,
0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x12,
0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04,
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52,
0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78,
0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x53, 0x0a,
0x16, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x39, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x70, 0x49,
0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x70, 0x49, 0x74, 0x65,
0x6d, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_item_proto_rawDescOnce sync.Once
file_item_proto_rawDescData = file_item_proto_rawDesc
)
func file_item_proto_rawDescGZIP() []byte {
file_item_proto_rawDescOnce.Do(func() {
file_item_proto_rawDescData = protoimpl.X.CompressGZIP(file_item_proto_rawDescData)
})
return file_item_proto_rawDescData
}
var file_item_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_item_proto_goTypes = []interface{}{
(*AutonomyProposalItem)(nil), // 0: types.AutonomyProposalItem
(*ProposalItem)(nil), // 1: types.ProposalItem
(*RevokeProposalItem)(nil), // 2: types.RevokeProposalItem
(*VoteProposalItem)(nil), // 3: types.VoteProposalItem
(*TerminateProposalItem)(nil), // 4: types.TerminateProposalItem
(*ReceiptProposalItem)(nil), // 5: types.ReceiptProposalItem
(*LocalProposalItem)(nil), // 6: types.LocalProposalItem
(*ReqQueryProposalItem)(nil), // 7: types.ReqQueryProposalItem
(*ReplyQueryProposalItem)(nil), // 8: types.ReplyQueryProposalItem
(*RuleConfig)(nil), // 9: types.RuleConfig
(*VoteResult)(nil), // 10: types.VoteResult
(AutonomyVoteOption)(0), // 11: types.AutonomyVoteOption
}
var file_item_proto_depIdxs = []int32{
1, // 0: types.AutonomyProposalItem.propItem:type_name -> types.ProposalItem
9, // 1: types.AutonomyProposalItem.curRule:type_name -> types.RuleConfig
10, // 2: types.AutonomyProposalItem.boardVoteRes:type_name -> types.VoteResult
11, // 3: types.VoteProposalItem.vote:type_name -> types.AutonomyVoteOption
0, // 4: types.ReceiptProposalItem.prev:type_name -> types.AutonomyProposalItem
0, // 5: types.ReceiptProposalItem.current:type_name -> types.AutonomyProposalItem
0, // 6: types.LocalProposalItem.propItem:type_name -> types.AutonomyProposalItem
0, // 7: types.ReplyQueryProposalItem.propItems:type_name -> types.AutonomyProposalItem
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_item_proto_init() }
func file_item_proto_init() {
if File_item_proto != nil {
return
}
file_lcommon_proto_init()
if !protoimpl.UnsafeEnabled {
file_item_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AutonomyProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RevokeProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VoteProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TerminateProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReceiptProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LocalProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReqQueryProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_item_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReplyQueryProposalItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_item_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_item_proto_goTypes,
DependencyIndexes: file_item_proto_depIdxs,
MessageInfos: file_item_proto_msgTypes,
}.Build()
File_item_proto = out.File
file_item_proto_rawDesc = nil
file_item_proto_goTypes = nil
file_item_proto_depIdxs = nil
}
......@@ -15,6 +15,8 @@ var name string
var (
//ForkAutonomyDelRule fork for delete boards member rules
ForkAutonomyDelRule = "ForkAutonomyDelRule"
//ForkAutonomyEnableItem fork for add autonomy item support
ForkAutonomyEnableItem = "ForkAutonomyEnableItem"
)
func init() {
......@@ -28,6 +30,7 @@ func init() {
func InitFork(cfg *types.Chain33Config) {
cfg.RegisterDappFork(AutonomyX, "Enable", 0)
cfg.RegisterDappFork(AutonomyX, ForkAutonomyDelRule, 9500000)
cfg.RegisterDappFork(AutonomyX, ForkAutonomyEnableItem, 10000000)
}
//InitExecutor ...
......@@ -78,6 +81,11 @@ func (a *AutonomyType) GetLogMap() map[int64]*types.LogInfo {
TyLogRvkPropChange: {Ty: reflect.TypeOf(ReceiptProposalChange{}), Name: "LogRvkPropChange"},
TyLogVotePropChange: {Ty: reflect.TypeOf(ReceiptProposalChange{}), Name: "LogVotePropChange"},
TyLogTmintPropChange: {Ty: reflect.TypeOf(ReceiptProposalChange{}), Name: "LogTmintPropChange"},
TyLogPropItem: {Ty: reflect.TypeOf(ReceiptProposalItem{}), Name: "LogPropItem"},
TyLogRvkPropItem: {Ty: reflect.TypeOf(ReceiptProposalItem{}), Name: "LogRvkPropItem"},
TyLogVotePropItem: {Ty: reflect.TypeOf(ReceiptProposalItem{}), Name: "LogVotePropItem"},
TyLogTmintPropItem: {Ty: reflect.TypeOf(ReceiptProposalItem{}), Name: "LogTmintPropItem"},
}
}
......@@ -112,5 +120,10 @@ func (a *AutonomyType) GetTypeMap() map[string]int32 {
"RvkPropChange": AutonomyActionRvkPropChange,
"VotePropChange": AutonomyActionVotePropChange,
"TmintPropChange": AutonomyActionTmintPropChange,
"PropItem": AutonomyActionPropItem,
"RvkPropItem": AutonomyActionRvkPropItem,
"VotePropItem": AutonomyActionVotePropItem,
"TmintPropItem": AutonomyActionTmintPropItem,
}
}
......@@ -426,7 +426,7 @@ function para_create_nodegroup() {
echo "=========== # para chain approve node group ============="
##approve
txhash=$(${PARA_CLI} send para nodegroup approve -i "$id" -c 6 -k 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc)
txhash=$(${PARA_CLI} send para nodegroup approve -i "$id" -a "" -c 6 -k 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
......
......@@ -6,7 +6,6 @@ package executor
import (
dbm "github.com/33cn/chain33/common/db"
manager "github.com/33cn/chain33/system/dapp/manage/types"
"github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
"github.com/pkg/errors"
......@@ -14,8 +13,8 @@ import (
// IsSuperManager is supper manager or not
func isSuperManager(cfg *types.Chain33Config, addr string) bool {
confManager := types.ConfSub(cfg, manager.ManageX)
for _, m := range confManager.GStrList("superManager") {
confMix := types.ConfSub(cfg, mixTy.MixX)
for _, m := range confMix.GStrList("mixApprs") {
if addr == m {
return true
}
......
......@@ -544,7 +544,7 @@ function para_create_nodegroup_gamechain() {
echo "=========== # game para chain approve node group ============="
##approve
txhash=$(${CLI} --paraName user.p.game. send para nodegroup approve -i "$id" -c 5 -k "${SUPER_KEY}")
txhash=$(${CLI} --paraName user.p.game. send para nodegroup approve -i "$id" -a "" -c 5 -k "${SUPER_KEY}")
echo "tx=$txhash"
query_tx "${PARA_CLI5}" "${txhash}"
......@@ -718,7 +718,7 @@ function para_create_nodegroup() {
echo "=========== # para chain approve node group ============="
##approve
txhash=$(${PARA_CLI} send para nodegroup approve -i "$id" -c 6 -k "${SUPER_KEY}")
txhash=$(${PARA_CLI} send para nodegroup approve -i "$id" -a "" -c 6 -k "${SUPER_KEY}")
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
......@@ -758,7 +758,7 @@ function para_create_nodegroup() {
fi
##approve
txhash=$(${PARA_CLI} send para nodegroup approve -i "$modifyid" -c 5 -k "${SUPER_KEY}")
txhash=$(${PARA_CLI} send para nodegroup approve -i "$modifyid" -a "" -c 5 -k "${SUPER_KEY}")
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
......@@ -850,7 +850,7 @@ function para_create_supervision_nodegroup_quit() {
echo "=========== # para chain approve supervision node group 28 ============="
##approve
txhash=$(${PARA_CLI} send para supervision_node approve -i "$id" -c 6 -k "${SUPER_KEY}")
txhash=$(${PARA_CLI} send para supervision_node approve -i "$id" -a "" -c 6 -k "${SUPER_KEY}")
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
......@@ -865,7 +865,7 @@ function para_create_supervision_nodegroup_quit() {
query_tx "${PARA_CLI}" "${txhash}"
check_balance_1ka "$balancePre" -6
check_supervision_node_group_list 3 "$id"
check_supervision_node_group_list 3 "$txhash"
check_supervision_node_addr_status 3 "$ADDR_28"
check_supervision_node_addrs null
echo "=========== # ${FUNCNAME} end ============="
......@@ -885,7 +885,7 @@ function para_create_supervision_nodegroup_approve() {
echo "=========== # para chain approve supervision node group 28 ============="
##approve
txhash=$(${PARA_CLI} send para supervision_node approve -i "$id" -c 6 -k "${SUPER_KEY}")
txhash=$(${PARA_CLI} send para supervision_node approve -i "$id" -a "" -c 6 -k "${SUPER_KEY}")
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
......
......@@ -363,7 +363,6 @@ func addNodeJoinFlags(cmd *cobra.Command) {
_ = cmd.MarkFlagRequired("addr")
cmd.Flags().Float64P("coins", "c", 0, "frozen coins amount, should not less nodegroup's setting")
_ = cmd.MarkFlagRequired("coins")
}
......@@ -908,7 +907,6 @@ func addNodeGroupApplyCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("blspubs", "p", "", "bls sign pub key for addr's private key,split by ',' (optional)")
cmd.Flags().Float64P("coins", "c", 0, "coins amount to frozen, not less config")
_ = cmd.MarkFlagRequired("coins")
}
......@@ -946,12 +944,24 @@ func nodeGroupApply(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal()
}
func nodeGroupApproveCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "approve",
Short: "approve for para chain's super node group application",
Run: nodeGroupApprove,
}
addNodeGroupApproveCmdFlags(cmd)
return cmd
}
func addNodeGroupApproveCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("id", "i", "", "apply id for nodegroup ")
_ = cmd.MarkFlagRequired("id")
cmd.Flags().StringP("autonomyId", "a", "", "autonomy approved id ")
_ = cmd.MarkFlagRequired("autonomyId")
cmd.Flags().Float64P("coins", "c", 0, "coins amount to frozen, not less config")
_ = cmd.MarkFlagRequired("coins")
}
......@@ -959,6 +969,7 @@ func nodeGroupApprove(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
id, _ := cmd.Flags().GetString("id")
coins, _ := cmd.Flags().GetFloat64("coins")
autonomyId, _ := cmd.Flags().GetString("autonomyId")
if !strings.HasPrefix(paraName, "user.p") {
_, _ = fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
......@@ -975,7 +986,7 @@ func nodeGroupApprove(cmd *cobra.Command, args []string) {
fmt.Fprintln(os.Stderr, errors.Wrapf(err, "FormatFloatDisplay2Value.coins"))
return
}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 2, Id: id, CoinsFrozen: coinsInt64}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 2, Id: id, CoinsFrozen: coinsInt64, AutonomyItemID: autonomyId}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
ActionName: "NodeGroupConfig",
......@@ -986,13 +997,13 @@ func nodeGroupApprove(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal()
}
func nodeGroupApproveCmd() *cobra.Command {
func nodeGroupQuitCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "approve",
Short: "approve for para chain's super node group application",
Run: nodeGroupApprove,
Use: "quit",
Short: "quit for para chain's super node group application",
Run: nodeGroupQuit,
}
addNodeGroupApproveCmdFlags(cmd)
addNodeGroupQuitCmdFlags(cmd)
return cmd
}
......@@ -1005,6 +1016,7 @@ func addNodeGroupQuitCmdFlags(cmd *cobra.Command) {
func nodeGroupQuit(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
id, _ := cmd.Flags().GetString("id")
if !strings.HasPrefix(paraName, "user.p") {
_, _ = fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
......@@ -1021,13 +1033,13 @@ func nodeGroupQuit(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal()
}
func nodeGroupQuitCmd() *cobra.Command {
func nodeGroupModifyCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "quit",
Short: "quit for para chain's super node group application",
Run: nodeGroupQuit,
Use: "modify",
Short: "modify for para chain's super node group parameters",
Run: nodeGroupModify,
}
addNodeGroupQuitCmdFlags(cmd)
addNodeGroupModifyCmdFlags(cmd)
return cmd
}
......@@ -1066,16 +1078,6 @@ func nodeGroupModify(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal()
}
func nodeGroupModifyCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "modify",
Short: "modify for para chain's super node group parameters",
Run: nodeGroupModify,
}
addNodeGroupModifyCmdFlags(cmd)
return cmd
}
// IsSyncCmd query parachain is sync
func IsSyncCmd() *cobra.Command {
cmd := &cobra.Command{
......@@ -1645,7 +1647,6 @@ func addSupervisionNodeApplyCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("blspub", "p", "", "bls sign pub key for addr's private key")
cmd.Flags().Float64P("coins", "c", 0, "coins amount to frozen, not less config")
_ = cmd.MarkFlagRequired("coins")
}
func supervisionNodeApply(cmd *cobra.Command, args []string) {
......@@ -1658,7 +1659,7 @@ func supervisionNodeApply(cmd *cobra.Command, args []string) {
_, _ = fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 1, Addr: addr, BlsPubKey: blspub, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 1, Addrs: addr, BlsPubKeys: blspub, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
ActionName: "SupervisionNodeConfig",
......@@ -1684,13 +1685,16 @@ func addSupervisionNodeApproveCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("id", "i", "", "apply id for supervision node ")
_ = cmd.MarkFlagRequired("id")
cmd.Flags().StringP("autonomyId", "a", "", "autonomy approved id ")
_ = cmd.MarkFlagRequired("autonomyId")
cmd.Flags().Float64P("coins", "c", 0, "coins amount to frozen, not less config")
_ = cmd.MarkFlagRequired("coins")
}
func supervisionNodeApprove(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
id, _ := cmd.Flags().GetString("id")
autonomyId, _ := cmd.Flags().GetString("autonomyId")
coins, _ := cmd.Flags().GetFloat64("coins")
if !strings.HasPrefix(paraName, "user.p") {
......@@ -1698,7 +1702,7 @@ func supervisionNodeApprove(cmd *cobra.Command, args []string) {
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 2, Id: id, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 2, Id: id, AutonomyItemID: autonomyId, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
ActionName: "SupervisionNodeConfig",
......@@ -1732,7 +1736,7 @@ func supervisionNodeQuit(cmd *cobra.Command, args []string) {
_, _ = fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 3, Addr: opAddr}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 3, Addrs: opAddr}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
ActionName: "SupervisionNodeConfig",
......@@ -1766,7 +1770,7 @@ func supervisionNodeCancel(cmd *cobra.Command, args []string) {
_, _ = fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 4, Id: id}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 4, Id: id}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
ActionName: "SupervisionNodeConfig",
......@@ -1833,7 +1837,7 @@ func supervisionNodeListInfo(cmd *cobra.Command, args []string) {
}
params.Payload = types.MustPBToJSON(&req)
var res pt.RespParacrossNodeAddrs
var res pt.RespParacrossNodeGroups
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
}
......
......@@ -127,7 +127,7 @@ func (e *Paracross) Exec_ParaBindMiner(payload *pt.ParaBindMinerCmd, tx *types.T
}
//Exec_SupervisionNodeConfig exec Supervision node config
func (e *Paracross) Exec_SupervisionNodeConfig(payload *pt.ParaNodeAddrConfig, tx *types.Transaction, index int) (*types.Receipt, error) {
func (e *Paracross) Exec_SupervisionNodeConfig(payload *pt.ParaNodeGroupConfig, tx *types.Transaction, index int) (*types.Receipt, error) {
a := newAction(e, tx)
return a.SupervisionNodeConfig(payload)
}
......@@ -137,22 +137,22 @@ func (e *Paracross) ExecDelLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig
return &set, nil
}
func (e *Paracross) ExecDelLocal_SupervisionNodeConfig(payload *pt.ParaNodeAddrConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
func (e *Paracross) ExecDelLocal_SupervisionNodeConfig(payload *pt.ParaNodeGroupConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
var set types.LocalDBSet
for _, log := range receiptData.Logs {
if log.Ty == pt.TyLogParaSupervisionNodeConfig {
var g pt.ReceiptParaNodeConfig
var g pt.ReceiptParaNodeGroupConfig
err := types.Decode(log.Log, &g)
if err != nil {
return nil, err
}
if g.Prev != nil {
set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Prev.Status, g.Current.TargetAddr, g.Current.Id), Value: types.Encode(g.Prev)})
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Prev.Status, g.Current.TargetAddrs, g.Current.Id), Value: types.Encode(g.Prev)})
}
set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Current.Status, g.Current.TargetAddr, g.Current.Id), Value: nil})
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Current.Status, g.Current.TargetAddrs, g.Current.Id), Value: nil})
}
}
return &set, nil
......
......@@ -141,22 +141,22 @@ func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, t
return &set, nil
}
func (e *Paracross) ExecLocal_SupervisionNodeConfig(payload *pt.ParaNodeAddrConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
func (e *Paracross) ExecLocal_SupervisionNodeConfig(payload *pt.ParaNodeGroupConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
var set types.LocalDBSet
for _, log := range receiptData.Logs {
if log.Ty == pt.TyLogParaSupervisionNodeConfig {
var g pt.ReceiptParaNodeConfig
var g pt.ReceiptParaNodeGroupConfig
err := types.Decode(log.Log, &g)
if err != nil {
return nil, err
}
if g.Prev != nil {
set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Prev.Status, g.Current.TargetAddr, g.Current.Id), Value: nil})
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Prev.Status, g.Current.TargetAddrs, g.Current.Id), Value: nil})
}
set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Current.Status, g.Current.TargetAddr, g.Current.Id), Value: types.Encode(g.Current)})
Key: calcLocalSupervisionNodeStatusTitle(g.Current.Title, g.Current.Status, g.Current.TargetAddrs, g.Current.Id), Value: types.Encode(g.Current)})
}
}
return &set, nil
......
......@@ -281,12 +281,12 @@ func (p *Paracross) Query_ListSupervisionNodeStatusInfo(in *pt.ReqParacrossNodeI
prefix = calcLocalSupervisionNodeStatusTitlePrefix(in.Title, in.Status)
}
resp, err := listNodeStatus(p.GetLocalDB(), prefix)
resp, err := listNodeGroupStatus(p.GetLocalDB(), prefix)
if err != nil {
return resp, err
}
addrs := resp.(*pt.RespParacrossNodeAddrs)
addrs := resp.(*pt.RespParacrossNodeGroups)
for _, id := range addrs.Ids {
id.Id = getParaNodeIDSuffix(id.Id)
}
......
......@@ -957,12 +957,42 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
return receipt, nil
}
func (a *action) checkApproveOp(config *pt.ParaNodeGroupConfig) error {
cfg := a.api.GetConfig()
//fork之后采用 autonomy 检查模式
confManager := types.ConfSub(cfg, manager.ManageX)
autonomyExec := confManager.GStr(types.AutonomyCfgKey)
if cfg.IsDappFork(a.height, pt.ParaX, pt.ForkParaAutonomySuperGroup) && len(autonomyExec) > 0 {
//去autonomy 合约检验是否id approved, 成功 err返回nil
_, err := a.api.QueryChain(&types.ChainExecutor{
Driver: autonomyExec,
FuncName: "IsAutonomyApprovedItem",
Param: types.Encode(&types.ReqMultiStrings{Datas: []string{config.AutonomyItemID, config.Id}}),
})
if err != nil {
return errors.Wrapf(err, "query autonomy,approveid=%s,hashId=%s", config.AutonomyItemID, config.Id)
}
return nil
}
//fork之前检查是否from superManager
if !isSuperManager(cfg, a.fromaddr) {
return errors.Wrapf(types.ErrNotAllow, "node group approve not super manager:%s", a.fromaddr)
}
return nil
}
// NodeGroupApprove super addr approve the node group apply
func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
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() {
err := a.checkApproveOp(config)
if err != nil {
return nil, err
}
}
id, err := getNodeGroupID(cfg, a.db, config.Title, a.exec.GetMainHeight(), config.Id)
......
package executor
import (
"strings"
"github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/types"
......@@ -26,8 +28,8 @@ func makeParaSupervisionNodeGroupReceipt(title string, prev, current *types.Conf
}
}
func makeSupervisionNodeConfigReceipt(fromAddr string, config *pt.ParaNodeAddrConfig, prev, current *pt.ParaNodeIdStatus) *types.Receipt {
log := &pt.ReceiptParaNodeConfig{
func makeSupervisionNodeConfigReceipt(fromAddr string, config *pt.ParaNodeGroupConfig, prev, current *pt.ParaNodeGroupStatus) *types.Receipt {
log := &pt.ReceiptParaNodeGroupConfig{
Addr: fromAddr,
Config: config,
Prev: prev,
......@@ -68,14 +70,13 @@ func makeParaSupervisionNodeStatusReceipt(fromAddr string, prev, current *pt.Par
}
}
func getSupervisionNodeID(db dbm.KV, title string, id string) (*pt.ParaNodeIdStatus, error) {
id = calcParaSupervisionNodeIDKey(title, id)
func getSupervisionNodeID(db dbm.KV, id string) (*pt.ParaNodeGroupStatus, error) {
val, err := getDb(db, []byte(id))
if err != nil {
return nil, err
}
var status pt.ParaNodeIdStatus
var status pt.ParaNodeGroupStatus
err = types.Decode(val, &status)
return &status, err
}
......@@ -124,14 +125,14 @@ func (a *action) updateSupervisionNodeGroup(title, addr string, add bool) (*type
return receipt, nil
}
func (a *action) checkValidSupervisionNode(config *pt.ParaNodeAddrConfig) (bool, error) {
func (a *action) checkValidSupervisionNode(config *pt.ParaNodeGroupConfig) (bool, error) {
key := calcParaSupervisionNodeGroupAddrsKey(config.Title)
nodes, _, err := getNodes(a.db, key)
if err != nil && !(isNotFound(err) || errors.Cause(err) == pt.ErrTitleNotExist) {
return false, errors.Wrapf(err, "getNodes for title:%s", config.Title)
}
if validNode(config.Addr, nodes) {
if validNode(config.Addrs, nodes) {
return true, nil
}
return false, nil
......@@ -173,16 +174,16 @@ func (a *action) supervisionNodeGroupCreate(title, targetAddrs string) (*types.R
}
//由于propasal id 和quit id分开,quit id不知道对应addr proposal id的coinfrozen信息,需要维护一个围绕addr的数据库结构信息
func (a *action) updateSupervisionNodeAddrStatus(stat *pt.ParaNodeIdStatus) (*types.Receipt, error) {
addrStat, err := getNodeAddr(a.db, stat.Title, stat.TargetAddr)
func (a *action) updateSupervisionNodeAddrStatus(stat *pt.ParaNodeGroupStatus) (*types.Receipt, error) {
addrStat, err := getNodeAddr(a.db, stat.Title, stat.TargetAddrs)
if err != nil {
if !isNotFound(err) {
return nil, errors.Wrapf(err, "nodeAddr:%s get error", stat.TargetAddr)
return nil, errors.Wrapf(err, "nodeAddr:%s get error", stat.TargetAddrs)
}
addrStat = &pt.ParaNodeAddrIdStatus{}
addrStat.Title = stat.Title
addrStat.Addr = stat.TargetAddr
addrStat.BlsPubKey = stat.BlsPubKey
addrStat.Addr = stat.TargetAddrs
addrStat.BlsPubKey = stat.BlsPubKeys
addrStat.Status = pt.ParacrossSupervisionNodeApprove
addrStat.ProposalId = stat.Id
addrStat.QuitId = ""
......@@ -191,9 +192,9 @@ func (a *action) updateSupervisionNodeAddrStatus(stat *pt.ParaNodeIdStatus) (*ty
preStat := *addrStat
if stat.Status == pt.ParacrossSupervisionNodeQuit {
proposalStat, err := getNodeID(a.db, addrStat.ProposalId)
proposalStat, err := getSupervisionNodeID(a.db, addrStat.ProposalId)
if err != nil {
return nil, errors.Wrapf(err, "nodeAddr:%s quiting wrong proposeid:%s", stat.TargetAddr, addrStat.ProposalId)
return nil, errors.Wrapf(err, "nodeAddr:%s quiting wrong proposeid:%s", stat.TargetAddrs, addrStat.ProposalId)
}
addrStat.Status = stat.Status
......@@ -217,16 +218,20 @@ func (a *action) updateSupervisionNodeAddrStatus(stat *pt.ParaNodeIdStatus) (*ty
}
}
func (a *action) supervisionNodeApply(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
func (a *action) supervisionNodeApply(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
// 必须要有授权节点 监督节点才有意义 判断是否存在授权节点
addrExist, err := a.checkValidNode(config)
if strings.Contains(config.Addrs, ",") {
return nil, errors.Wrapf(types.ErrInvalidParam, "not support multi addr currently,addrs=%s", config.Addrs)
}
nodeCfg := &pt.ParaNodeAddrConfig{Title: config.Title, Addr: config.Addrs}
addrExist, err := a.checkValidNode(nodeCfg)
if err != nil {
return nil, err
}
// 不能跟授权节点一致
if addrExist {
return nil, errors.Wrapf(pt.ErrParaNodeAddrExisted, "supervisionNodeGroup Apply Addr existed:%s in super group", config.Addr)
return nil, errors.Wrapf(pt.ErrParaNodeAddrExisted, "supervisionNodeGroup Apply Addr existed:%s in super group", config.Addrs)
}
// 判断 node 是否已经申请
......@@ -235,7 +240,7 @@ func (a *action) supervisionNodeApply(config *pt.ParaNodeAddrConfig) (*types.Rec
return nil, err
}
if addrExist {
return nil, errors.Wrapf(pt.ErrParaSupervisionNodeAddrExisted, "supervisionNodeGroup Apply Addr existed:%s", config.Addr)
return nil, errors.Wrapf(pt.ErrParaSupervisionNodeAddrExisted, "supervisionNodeGroup Apply Addr existed:%s", config.Addrs)
}
// 在主链上冻结金额
......@@ -249,12 +254,12 @@ func (a *action) supervisionNodeApply(config *pt.ParaNodeAddrConfig) (*types.Rec
receipt = mergeReceipt(receipt, r)
}
stat := &pt.ParaNodeIdStatus{
stat := &pt.ParaNodeGroupStatus{
Id: calcParaSupervisionNodeIDKey(config.Title, common.ToHex(a.txhash)),
Status: pt.ParacrossSupervisionNodeApply,
Title: config.Title,
TargetAddr: config.Addr,
BlsPubKey: config.BlsPubKey,
TargetAddrs: config.Addrs,
BlsPubKeys: config.BlsPubKeys,
CoinsFrozen: config.CoinsFrozen,
FromAddr: a.fromaddr,
Height: a.height,
......@@ -265,14 +270,17 @@ func (a *action) supervisionNodeApply(config *pt.ParaNodeAddrConfig) (*types.Rec
return receipt, nil
}
func (a *action) supervisionNodeApprove(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
func (a *action) supervisionNodeApprove(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
cfg := a.api.GetConfig()
//只在主链检查
if !cfg.IsPara() && !isSuperManager(cfg, a.fromaddr) {
return nil, errors.Wrapf(types.ErrNotAllow, "node group approve not supervision manager:%s", a.fromaddr)
//只在主链检查, 主链检查失败不会同步到平行链,主链成功,平行链默认成功
if !cfg.IsPara() {
err := a.checkApproveOp(config)
if err != nil {
return nil, err
}
}
apply, err := getSupervisionNodeID(a.db, config.Title, config.Id)
apply, err := getSupervisionNodeID(a.db, calcParaSupervisionNodeIDKey(config.Title, config.Id))
if err != nil {
return nil, err
}
......@@ -292,21 +300,21 @@ func (a *action) supervisionNodeApprove(config *pt.ParaNodeAddrConfig) (*types.R
receipt := &types.Receipt{Ty: types.ExecOk}
if !exist {
// 监督账户组不存在
r, err := a.supervisionNodeGroupCreate(apply.Title, apply.TargetAddr)
r, err := a.supervisionNodeGroupCreate(apply.Title, apply.TargetAddrs)
if err != nil {
return nil, errors.Wrapf(err, "nodegroup create:title:%s,addrs:%s", config.Title, apply.TargetAddr)
return nil, errors.Wrapf(err, "nodegroup create:title:%s,addrs:%s", config.Title, apply.TargetAddrs)
}
receipt = mergeReceipt(receipt, r)
} else {
// 监督账户组已经存在
r, err := a.updateSupervisionNodeGroup(config.Title, apply.TargetAddr, true)
r, err := a.updateSupervisionNodeGroup(config.Title, apply.TargetAddrs, true)
if err != nil {
return nil, err
}
receipt = mergeReceipt(receipt, r)
}
copyStat := proto.Clone(apply).(*pt.ParaNodeIdStatus)
copyStat := proto.Clone(apply).(*pt.ParaNodeGroupStatus)
apply.Status = pt.ParacrossSupervisionNodeApprove
apply.Height = a.height
......@@ -321,31 +329,31 @@ func (a *action) supervisionNodeApprove(config *pt.ParaNodeAddrConfig) (*types.R
return receipt, nil
}
func (a *action) supervisionNodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
func (a *action) supervisionNodeQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
addrExist, err := a.checkValidSupervisionNode(config)
if err != nil {
return nil, err
}
if !addrExist {
return nil, errors.Wrapf(pt.ErrParaSupervisionNodeAddrNotExisted, "nodeAddr not existed:%s", config.Addr)
return nil, errors.Wrapf(pt.ErrParaSupervisionNodeAddrNotExisted, "nodeAddr not existed:%s", config.Addrs)
}
status, err := getNodeAddr(a.db, config.Title, config.Addr)
status, err := getNodeAddr(a.db, config.Title, config.Addrs)
if err != nil {
return nil, errors.Wrapf(err, "nodeAddr:%s get error", config.Addr)
return nil, errors.Wrapf(err, "nodeAddr:%s get error", config.Addrs)
}
if status.Status != pt.ParacrossSupervisionNodeApprove {
return nil, errors.Wrapf(pt.ErrParaSupervisionNodeAddrNotExisted, "nodeAddr:%s status:%d", config.Addr, status.Status)
return nil, errors.Wrapf(pt.ErrParaSupervisionNodeAddrNotExisted, "nodeAddr:%s status:%d", config.Addrs, status.Status)
}
cfg := a.api.GetConfig()
stat := &pt.ParaNodeIdStatus{
Id: status.ProposalId,
Status: pt.ParacrossSupervisionNodeQuit,
Title: config.Title,
TargetAddr: config.Addr,
FromAddr: a.fromaddr,
Height: a.height,
stat := &pt.ParaNodeGroupStatus{
Id: calcParaSupervisionNodeIDKey(config.Title, common.ToHex(a.txhash)),
Status: pt.ParacrossSupervisionNodeQuit,
Title: config.Title,
TargetAddrs: config.Addrs,
FromAddr: a.fromaddr,
Height: a.height,
}
//只能提案发起人或超级节点可以撤销
......@@ -366,7 +374,7 @@ func (a *action) supervisionNodeQuit(config *pt.ParaNodeAddrConfig) (*types.Rece
}
receipt = mergeReceipt(receipt, r)
r, err = a.updateSupervisionNodeGroup(config.Title, stat.TargetAddr, false)
r, err = a.updateSupervisionNodeGroup(config.Title, stat.TargetAddrs, false)
if err != nil {
return nil, err
}
......@@ -384,9 +392,9 @@ func (a *action) supervisionNodeQuit(config *pt.ParaNodeAddrConfig) (*types.Rece
return receipt, nil
}
func (a *action) supervisionNodeCancel(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
func (a *action) supervisionNodeCancel(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
cfg := a.api.GetConfig()
status, err := getSupervisionNodeID(a.db, config.Title, config.Id)
status, err := getSupervisionNodeID(a.db, calcParaSupervisionNodeIDKey(config.Title, config.Id))
if err != nil {
return nil, err
}
......@@ -412,7 +420,7 @@ func (a *action) supervisionNodeCancel(config *pt.ParaNodeAddrConfig) (*types.Re
receipt = mergeReceipt(receipt, r)
}
copyStat := proto.Clone(status).(*pt.ParaNodeIdStatus)
copyStat := proto.Clone(status).(*pt.ParaNodeGroupStatus)
status.Status = pt.ParacrossSupervisionNodeCancel
status.Height = a.height
......@@ -422,24 +430,24 @@ func (a *action) supervisionNodeCancel(config *pt.ParaNodeAddrConfig) (*types.Re
return receipt, nil
}
func (a *action) supervisionNodeModify(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
addrStat, err := getNodeAddr(a.db, config.Title, config.Addr)
func (a *action) supervisionNodeModify(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
addrStat, err := getNodeAddr(a.db, config.Title, config.Addrs)
if err != nil {
return nil, errors.Wrapf(err, "nodeAddr:%s get error", config.Addr)
return nil, errors.Wrapf(err, "nodeAddr:%s get error", config.Addrs)
}
// 只能提案发起人
if a.fromaddr != config.Addr {
return nil, errors.Wrapf(types.ErrNotAllow, "addr create by:%s,not by:%s", config.Addr, a.fromaddr)
if a.fromaddr != config.Addrs {
return nil, errors.Wrapf(types.ErrNotAllow, "addr create by:%s,not by:%s", config.Addrs, a.fromaddr)
}
preStat := *addrStat
addrStat.BlsPubKey = config.BlsPubKey
addrStat.BlsPubKey = config.BlsPubKeys
return makeParaSupervisionNodeStatusReceipt(a.fromaddr, &preStat, addrStat), nil
}
func (a *action) SupervisionNodeConfig(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
func (a *action) SupervisionNodeConfig(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
cfg := a.api.GetConfig()
if !validTitle(cfg, config.Title) {
return nil, pt.ErrInvalidTitle
......
......@@ -7,7 +7,7 @@ import (
)
// createRawSupervisionNodeConfigTx create raw tx for node config
func createRawSupervisionNodeConfigTx(config *pt.ParaNodeAddrConfig) *types.Transaction {
func createRawSupervisionNodeConfigTx(config *pt.ParaNodeGroupConfig) *types.Transaction {
action := &pt.ParacrossAction{
Ty: pt.ParacrossActionSupervisionNodeConfig,
Value: &pt.ParacrossAction_SupervisionNodeConfig{SupervisionNodeConfig: config},
......@@ -32,10 +32,10 @@ func (suite *NodeManageTestSuite) testSupervisionExec() {
func (suite *NodeManageTestSuite) testSupervisionNodeConfigCancel(addr, privKey string) {
// Apply
config := &pt.ParaNodeAddrConfig{
config := &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeApply,
Addr: addr,
Addrs: addr,
}
tx := createRawSupervisionNodeConfigTx(config)
receipt := nodeCommit(suite, privKey, tx)
......@@ -46,7 +46,7 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigCancel(addr, privKey
suite.Nil(err)
// cancel
config = &pt.ParaNodeAddrConfig{
config = &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeCancel,
Id: getParaNodeIDSuffix(g.Current.Id),
......@@ -57,10 +57,10 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigCancel(addr, privKey
}
func (suite *NodeManageTestSuite) testSupervisionNodeConfigApprove(addr, privKey string) {
config := &pt.ParaNodeAddrConfig{
config := &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeApply,
Addr: addr,
Addrs: addr,
}
tx := createRawSupervisionNodeConfigTx(config)
receipt := nodeCommit(suite, privKey, tx)
......@@ -70,7 +70,7 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigApprove(addr, privKey
err := types.Decode(receipt.Logs[0].Log, &g)
suite.Nil(err)
config = &pt.ParaNodeAddrConfig{
config = &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Id: getParaNodeIDSuffix(g.Current.Id),
Op: pt.ParacrossSupervisionNodeApprove,
......@@ -81,20 +81,20 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigApprove(addr, privKey
}
func (suite *NodeManageTestSuite) testSupervisionNodeError() {
config := &pt.ParaNodeAddrConfig{
config := &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeApply,
Addr: Account1M3,
Addrs: Account1M3,
}
tx := createRawSupervisionNodeConfigTx(config)
tx, _ = signTx(suite.Suite, tx, PrivKey1M3)
_, err := suite.exec.Exec(tx, 0)
suite.NotNil(err)
config = &pt.ParaNodeAddrConfig{
config = &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeApply,
Addr: "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4",
Addrs: "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4",
}
tx = createRawSupervisionNodeConfigTx(config)
tx, _ = signTx(suite.Suite, tx, PrivKey1KS)
......@@ -103,10 +103,10 @@ func (suite *NodeManageTestSuite) testSupervisionNodeError() {
}
func (suite *NodeManageTestSuite) testSupervisionNodeQuit() {
config := &pt.ParaNodeAddrConfig{
config := &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeQuit,
Addr: Account1Ku,
Addrs: Account1Ku,
}
tx := createRawSupervisionNodeConfigTx(config)
receipt := nodeCommit(suite, PrivKey1Ku, tx)
......@@ -123,11 +123,11 @@ func (suite *NodeManageTestSuite) testSupervisionNodeQuit() {
}
func (suite *NodeManageTestSuite) testSupervisionNodeModify() {
config := &pt.ParaNodeAddrConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeModify,
Addr: Account14K,
BlsPubKey: Bls14K,
config := &pt.ParaNodeGroupConfig{
Title: chain33TestCfg.GetTitle(),
Op: pt.ParacrossSupervisionNodeModify,
Addrs: Account14K,
BlsPubKeys: Bls14K,
}
tx := createRawSupervisionNodeConfigTx(config)
receipt := nodeCommit(suite, PrivKey14K, tx)
......
......@@ -125,6 +125,7 @@ message ParaNodeGroupConfig {
string addrs = 4;
int64 coinsFrozen = 5;
string blsPubKeys = 6;
string autonomyItemID = 7;
}
message ParaNodeGroupStatus {
......@@ -356,7 +357,7 @@ message ParacrossAction {
ParaStageConfig selfStageConfig = 11;
CrossAssetTransfer crossAssetTransfer = 12;
ParaBindMinerCmd paraBindMiner = 13;
ParaNodeAddrConfig supervisionNodeConfig = 14;
ParaNodeGroupConfig supervisionNodeConfig = 14;
}
int32 ty = 2;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,19 +19,23 @@ var (
// ForkCommitTx main chain support paracross commit tx
ForkCommitTx = "ForkParacrossCommitTx"
// MainForkParacrossCommitTx 平行链配置项对应主链的ForkCommitTx 高度
// 同一个fork,同一份代码在主链和平行链需要执行高度一致,需要平行链配置主链fork高度
MainForkParacrossCommitTx = "mainForkParacrossCommitTx"
// ForkLoopCheckCommitTxDone 循环检查共识交易done的fork
ForkLoopCheckCommitTxDone = "ForkLoopCheckCommitTxDone"
// MainLoopCheckCommitTxDoneForkHeight 平行链的配置项,对应主链的ForkLoopCheckCommitTxDone高度
MainLoopCheckCommitTxDoneForkHeight = "mainLoopCheckCommitTxDoneForkHeight"
//MainForkParaSupervision = "mainForkParaSupervision"
// ForkParaSelfConsStages 平行链自共识分阶段共识
ForkParaSelfConsStages = "ForkParaSelfConsStages"
// ForkParaAssetTransferRbk 平行链资产转移平行链失败主链回滚
ForkParaAssetTransferRbk = "ForkParaAssetTransferRbk"
// ForkParaSupervision 平行链新增监督节点
ForkParaSupervision = "ForkParaSupervision"
//ForkParaAutonomySuperGroup 分叉之后autonomy授权共识账户组,之前是配置超级管理员授权
ForkParaAutonomySuperGroup = "ForkParaAutonomySuperGroup"
//只在平行链开启的分叉
// ForkParaSelfConsStages 平行链自共识分阶段共识
ForkParaSelfConsStages = "ForkParaSelfConsStages"
// ForkParaFullMinerHeight 平行链全挖矿开启高度
ForkParaFullMinerHeight = "ForkParaFullMinerHeight"
// ForkParaRootHash 平行链按照ForkRootHash计算rootHash高度,在之前版本中平行链侧计算txRootHash没有提供正确的主链高度计算,需要分叉
......@@ -65,6 +69,7 @@ func InitFork(cfg *types.Chain33Config) {
cfg.RegisterDappFork(ParaX, ForkLoopCheckCommitTxDone, 3230000)
cfg.RegisterDappFork(ParaX, ForkParaAssetTransferRbk, 4500000)
cfg.RegisterDappFork(ParaX, ForkParaSupervision, 6000000)
cfg.RegisterDappFork(ParaX, ForkParaAutonomySuperGroup, 10200000)
//只在平行链启用
cfg.RegisterDappFork(ParaX, ForkParaSelfConsStages, types.MaxHeight)
......@@ -122,7 +127,7 @@ func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo {
TyLogParaStageGroupUpdate: {Ty: reflect.TypeOf(ReceiptSelfConsStagesUpdate{}), Name: "LogParaSelfConfStagesUpdate"},
TyLogParaBindMinerAddr: {Ty: reflect.TypeOf(ReceiptParaBindMinerInfo{}), Name: "TyLogParaBindMinerAddrUpdate"},
TyLogParaBindMinerNode: {Ty: reflect.TypeOf(ReceiptParaNodeBindListUpdate{}), Name: "TyLogParaBindNodeListUpdate"},
TyLogParaSupervisionNodeConfig: {Ty: reflect.TypeOf(ReceiptParaNodeConfig{}), Name: "LogParaSupervisionNodeConfig"},
TyLogParaSupervisionNodeConfig: {Ty: reflect.TypeOf(ReceiptParaNodeGroupConfig{}), Name: "LogParaSupervisionNodeConfig"},
TyLogParaSupervisionNodeGroupAddrsUpdate: {Ty: reflect.TypeOf(types.ReceiptConfig{}), Name: "LogParaSupervisionNodeGroupAddrsUpdate"},
TyLogParaSupervisionNodeStatusUpdate: {Ty: reflect.TypeOf(ReceiptParaNodeAddrStatUpdate{}), Name: "LogParaSupervisionNodeStatusUpdate"},
}
......
......@@ -236,6 +236,7 @@ ForkTokenCheck= 0
[fork.sub.manage]
Enable=0
ForkManageExec=0
ForkManageAutonomyEnable=-1
[fork.sub.valnode]
Enable=0
......@@ -255,6 +256,7 @@ ForkParaAssetTransferRbk=0
ForkParaFullMinerHeight=0
ForkParaSupervision=0
ForkParaRootHash=0
#nodegroup approve需要经过autonomy board成员审批,平行链不开启
ForkParaAutonomySuperGroup=-1
[fork.sub.qbftNode]
Enable=0
......@@ -295,6 +295,7 @@ ForkBadRepeatSecret=0
[fork.sub.manage]
Enable=0
ForkManageExec=100000
ForkManageAutonomyEnable=-1
[fork.sub.token]
Enable=0
......@@ -324,6 +325,7 @@ ForkParaAssetTransferRbk=0
ForkParaFullMinerHeight=0
ForkParaSupervision=0
ForkParaRootHash=0
ForkParaAutonomySuperGroup=-1
[fork.sub.evm]
Enable=0
......@@ -402,6 +404,7 @@ ForkUnfreezeIDX= 0
[fork.sub.autonomy]
Enable=0
ForkAutonomyDelRule=0
ForkAutonomyEnableItem=0
[fork.sub.jsvm]
Enable=0
......
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