Commit 4f2480d4 authored by QM's avatar QM

Merge remote-tracking branch 'upstream/master' into issues898_para_add_supervision_0923

parents 30115e85 84435b3c
...@@ -134,10 +134,6 @@ function base_init() { ...@@ -134,10 +134,6 @@ function base_init() {
#relay genesis #relay genesis
sed -i $sedfix 's/^genesis="12qyocayNF7.*/genesis="1G5Cjy8LuQex2fuYv3gzb7B8MxAnxLEqt3"/g' chain33.toml sed -i $sedfix 's/^genesis="12qyocayNF7.*/genesis="1G5Cjy8LuQex2fuYv3gzb7B8MxAnxLEqt3"/g' chain33.toml
#autonomy
sed -i $sedfix 's/^useBalance=.*/useBalance=true/g' chain33.toml
sed -i $sedfix 's/^total="16htvcBNS.*/total="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx"/g' chain33.toml
if [ "$DAPP" == "x2ethereum" ]; then if [ "$DAPP" == "x2ethereum" ]; then
sed -i $sedfix 's/^enableReduceLocaldb=.*/enableReduceLocaldb=false/g' chain33.toml sed -i $sedfix 's/^enableReduceLocaldb=.*/enableReduceLocaldb=false/g' chain33.toml
sed -i $sedfix 's/^enablePushSubscribe=.*/enablePushSubscribe=true/g' chain33.toml sed -i $sedfix 's/^enablePushSubscribe=.*/enablePushSubscribe=true/g' chain33.toml
......
...@@ -372,6 +372,7 @@ ForkUnfreezeIDX= 0 ...@@ -372,6 +372,7 @@ ForkUnfreezeIDX= 0
[fork.sub.autonomy] [fork.sub.autonomy]
Enable=0 Enable=0
ForkAutonomyDelRule=0
[fork.sub.jsvm] [fork.sub.jsvm]
Enable=0 Enable=0
......
...@@ -4,6 +4,10 @@ strpwd=$(pwd) ...@@ -4,6 +4,10 @@ strpwd=$(pwd)
strcmd=${strpwd##*dapp/} strcmd=${strpwd##*dapp/}
strapp=${strcmd%/cmd*} strapp=${strcmd%/cmd*}
OUT_DIR="${1}/$strapp"
mkdir -p "${OUT_DIR}"
cp ./build/* "${OUT_DIR}"
OUT_TESTDIR="${1}/dapptest/$strapp" OUT_TESTDIR="${1}/dapptest/$strapp"
mkdir -p "${OUT_TESTDIR}" mkdir -p "${OUT_TESTDIR}"
cp ./test/* "${OUT_TESTDIR}" cp ./test/* "${OUT_TESTDIR}"
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set -x
set +e
source "./publicTest.sh"
# shellcheck disable=SC2034
{
propKey="0xfd0c4a8a1efcd221ee0f36b7d4f57d8ff843cb8bc193b39c7863332d355acafa"
propAddr="15VUiygdxMSZ3rykwe742yomp2cPJ9Tfve"
votePrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" #14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
voteAddr2="1EbDHAXpoiewjPLX9uqoz38HsKqMXayZrF"
votePrKey2="B0BB75BC49A787A71F4834DA18614763B53A18291ECE6B5EDEC3AD19D150C3E7" #1EbDHAXpoiewjPLX9uqoz38HsKqMXayZrF
voteAddr3="1KcCVZLSQYRUwE5EXTsAoQs9LuJW6xwfQa"
votePrKey3="2AFF1981291355322C7A6308D46A9C9BA311AA21D94F36B43FC6A6021A1334CF"
boardsAddr="1N578zmVzVR7RxLfnp7XAeDmAy499Jw3q2
, 1DZ1kL9x3rRwz7EZjcLt1kMYu6Zdp3MjGR
, 1HUYR1Mzb91m3dmsEE1vPrv7BsAHmEtVzM
, 1JHmVgchSLjszN9LAYa3gds811c4BH2J51
, 14TDcn95hxHbpySPtxGDK3aY6qDNuk5idg
, 1EpbYadEAcwbrxuh6Ph2qyJZhMY9F9CCCv
, 1NqfXb3YotDTPuShgSAhrBH28ETzCrsZx2
, 138xSezQUi9kynnAZR23kWBwHvDSRX8JDK
, 18bncBidkwRaUYPaqa9Rc58tWeRT2C5tfL
, 16z3gEvRGof8cnQRvicV8BdY54fUfnBo8A
, 1DpzRWk9SYnEvuGrFsJPFvMVRSYRHaCbtU
, 1JSQbsb1hfB6CLzwzVZZEtai4da8m59obK
, 12bRYKMsLSbN5upxoSenypWrygVuQh8rM5
, 1Ew4Cpcfh1u1EeRkYPwVc4PRaSnz4D2eph
, 156yPWN3eeZ4yPiwHRifu41FmrTVPavXQ5
, 192YKhdAkFm18KLcGumM8JeDgWrnpSdo93
, 12kXgBxsKzUmhfX5Mnv9EKRNGjQXhZzDFd
, 1HmyNGYj2xyMmQDTpcuheLKXKBe5rj3QpQ
, 1HGPrjc6H7yBzFV5yCbibvnSUGUgdDNQi3
, 19WGov4b7wLf4f8JHMRDnJsGVNMDzap38w
, 1HmRa1jAnzJ5SpJRrUWqUki6hx1u33Nbq4
, 168Sn1DXnLrZHTcAM9stD6t2P49fNuJfJ9
, 13KTf57aCkVVJYNJBXBBveiA5V811SrLcT
, 1JQwQWsShTHC4zxHzbUfYQK4kRBriUQdEe
, 1NHuKqoKe3hyv52PF8XBAyaTmJWAqA2Jbb"
# shellcheck disable=SC2206
arrayAddr=(${boardsAddr//,/ })
lenAddr=${#arrayAddr[@]}
for ((i = 0; i < lenAddr - 1; i++)); do
boards=$(echo "${boards}${arrayAddr[i]}-")
done
# shellcheck disable=SC2116
boards=$(echo "${boards}${arrayAddr[lenAddr - 1]}")
boardsPrKey="fa54751118c8159ade22c253f85945a4dd2030b1cf2502eaf785d0a4f5ad7e35
,da9371ea52f1fc9d72e75dbc9836774895cd0966fd53c83f5e2c92d878903693
,ad9731261c40c68fee96f7b846408fa33d1f3dc2a27bdb3694ec8f3aa153a98b
,e902d23ad26052cec64e9ed9055853327787b3bf26eb4646a6d6c1bb516f9fcd
,b3af59368bcc6779aecb4e7fbf0cc4040f8f8329eb7632d580be4b6d3be15357
,fd9284c11707b571e347b8f44c54aae89c0810d410a7c1f9613326358c564a5e
,b013948c123986aadc2525bfe9935dd07972e14b250b938153e763f917ada8d3
,5641e3aba9ce0660665cd1a816d1b50267b5bc5f337f73e6ceed0cc5ececa7d2
,5a7631b7101252d685bf2b4ba2f11a72fb867faeaa545064ce8d0901ffc3cb17
,c9d0d2639c0c0f2b275e5bf8a2797122af110316a4e8e1fe03c39693f5028c93
,00b4e3ac1365b89d68c8d5b07b3505cd614408b0d9c8c88df564d4e072deb401
,aa139d3f16c1785b2a9171d7863bc4ee9d45115cc0fa71a14c43536c933d1659
,33f111573a4613477f8291928a9bae012a74fc9858acb22c9c65ecf7844b63f2
,44e43dd0f769bb99638b9cc3c7468225ff703f69c17e9c4751d04e45fdc6c4a0
,9a75d6c779846fe2ad4a36021fe9d08652ca69ce09ab39ad874d921a5ec41716
,f5ca6b2ad545bd4b854871b18c8d37d2fe8c3625e91be86a204c4086f28e8d0f
,89504608a03590e5a4d8c1c82b75e908b28f9963587c85b96b628d238d3a4d1a
,fa653545ae52403665fb803ef410c4d3d7f74628b6d3f92218968ad496e4f81b
,227df96a414e26e85c7d87a12296344e6a731ce73e424ba9845cb305ec963843
,64259075bf2e5a74334442f5048ceaf8427f6097e2dac99c0e463785c7768550
,3b812d92b5c365d698255f55c3f0dca027c2f89f2409c51a6297bcf3343c11e6
,cd284cd17456b73619fa609bb9e3105e8eff5d059c5e0b6eb1effbebd4d64144
,e892212221b3b58211b90194365f4662764b6d5474ef2961ef77c909e31eeed3
,9d19a2e9a440187010634f4f08ce36e2bc7b521581436a99f05568be94dc66ea
,45d4ce009e25e6d5e00d8d3a50565944b2e3604aa473680a656b242d9acbff35"
# shellcheck disable=SC2206
arrayKey=(${boardsPrKey//,/ })
changeKey="0x7503333e74190abdfa10b9e5e3a225136ea7ed1f5beeeb710b1f3933a083b2c5"
changeAddr="15MP8oQXW9UuzbfMsUyVy4ThStm9ZH7hgG"
changeKey2="0x38d12b36d8d84a80131db15f2a067e2706f8367c933c075b3b3cefa3a864ad15"
changeAddr2="1Kubv93zSatYRq6eHdBa4BkMBwtB2UpQum"
minerAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
Chain33Cli="../../chain33-cli"
proposalRuleID=""
proposalBoardID=""
proposalProjectID=""
start=0
end=0
last_header=0
boardApproveRatio=50
pubOpposeRatio=33
proposalAmount=2000000000
largeProjectAmount=100000000000000
publicPeriod=172800
pubAttendRatio=60
pubApproveRatio=65
}
function update_last_header() {
last_header=$(${Chain33Cli} block last_header | jq -r ".height")
local h=100
if [ "$#" -eq 1 ]; then
h=$1
fi
start=$((last_header + h))
end=$((start + 20 + 720))
}
function sign_and_send() {
local raw="$1"
local key="$2"
data=$(${Chain33Cli} wallet sign -d "${raw}" -k "${key}")
hash=$(${Chain33Cli} wallet send -d "${data}")
check_tx "${Chain33Cli}" "${hash}"
echo "${hash}"
}
function proposalRuleTx() {
raw=$(${Chain33Cli} autonomy proposalRule -e "${end}" -s "${start}" -l 1000000 -p 20 -r ${boardApproveRatio} -a ${pubAttendRatio} -v ${pubApproveRatio} -o ${pubOpposeRatio} -u ${publicPeriod})
sign_and_send "${raw}" "${propKey}"
proposalRuleID="${hash}"
}
# $1 status
function showRule_status() {
local status=$1
result=$(${Chain33Cli} autonomy showRule -p "${proposalRuleID}" -y 0 | jq -r ".propRules[0].status")
is_equal "${result}" "${status}"
result=$(${Chain33Cli} autonomy showRule -p "${proposalRuleID}" -y 1 -s "${status}")
is_not_equal "${result}" "ErrNotFound"
}
function check_activeRule() {
result=$(${Chain33Cli} autonomy showActiveRule | jq -r ".boardApproveRatio")
is_equal "${result}" "${boardApproveRatio}"
result=$(${Chain33Cli} autonomy showActiveRule | jq -r ".pubOpposeRatio")
is_equal "${result}" "${pubOpposeRatio}"
result=$(${Chain33Cli} autonomy showActiveRule | jq -r ".publicPeriod")
is_equal "${result}" "${publicPeriod}"
result=$(${Chain33Cli} autonomy showActiveRule | jq -r ".pubAttendRatio")
is_equal "${result}" "${pubAttendRatio}"
result=$(${Chain33Cli} autonomy showActiveRule | jq -r ".pubApproveRatio")
is_equal "${result}" "${pubApproveRatio}"
}
function testProposalRule() {
# proposal
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
update_last_header 10
proposalRuleTx
#vote
block_wait "${Chain33Cli}" 10
raw=$(${Chain33Cli} autonomy voteRule -r 1 -p "${proposalRuleID}")
sign_and_send "${raw}" "${votePrKey}"
raw=$(${Chain33Cli} autonomy voteRule -r 1 -p "${proposalRuleID}")
sign_and_send "${raw}" "${votePrKey2}"
raw=$(${Chain33Cli} autonomy voteRule -r 1 -p "${proposalRuleID}")
sign_and_send "${raw}" "${votePrKey3}"
showRule_status 4
check_activeRule
#test revoke
update_last_header
proposalRuleTx
raw=$(${Chain33Cli} autonomy revokeRule -p "${proposalRuleID}")
sign_and_send "${raw}" "${propKey}"
showRule_status 2
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function proposalBoardTx() {
raw=$(${Chain33Cli} autonomy proposalBoard -e "${end}" -s "${start}" -u 3 -b "${boards}")
sign_and_send "${raw}" "${propKey}"
proposalBoardID="${hash}"
}
# $1 status
function showBoard_status() {
local status=$1
result=$(${Chain33Cli} autonomy showBoard -p "${proposalBoardID}" -y 0 | jq -r ".propBoards[0].status")
is_equal "${result}" "${status}"
result=$(${Chain33Cli} autonomy showBoard -p "${proposalBoardID}" -y 1 -s "${status}")
is_not_equal "${result}" "ErrNotFound"
}
function check_activeBoard() {
${Chain33Cli} autonomy showActiveBoard
for ((i = 0; i < lenAddr; i++)); do
ret=$(${Chain33Cli} autonomy showActiveBoard | jq -r ".boards[$i]")
if [ "${arrayAddr[i]}" != "${ret}" ]; then
exit 1
fi
done
}
function testProposalBoard() {
#proposal
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
update_last_header 10
proposalBoardTx
#vote
block_wait "${Chain33Cli}" 10
raw=$(${Chain33Cli} autonomy voteBoard -r 1 -p "${proposalBoardID}")
sign_and_send "${raw}" "${votePrKey}"
raw=$(${Chain33Cli} autonomy voteBoard -r 1 -p "${proposalBoardID}")
sign_and_send "${raw}" "${votePrKey2}"
#query
showBoard_status 4
check_activeBoard
#test revoke
update_last_header
proposalBoardTx
raw=$(${Chain33Cli} autonomy revokeBoard -p "${proposalBoardID}")
sign_and_send "${raw}" "${propKey}"
showBoard_status 2
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function proposalProjectTx() {
raw=$(${Chain33Cli} autonomy proposalProject -e "${end}" -s "${start}" -a 1 -o "${propAddr}")
sign_and_send "${raw}" "${propKey}"
proposalProjectID="${hash}"
}
function showProject_status() {
local status=$1
result=$(${Chain33Cli} autonomy showProject -p "${proposalProjectID}" -y 0 | jq -r ".propProjects[0].status")
is_equal "${result}" "${status}"
result=$(${Chain33Cli} autonomy showProject -p "${proposalProjectID}" -y 1 -s "${status}")
is_not_equal "${result}" "ErrNotFound"
}
function testProposalProject() {
# proposal
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
update_last_header 10
proposalProjectTx
#vote
block_wait "${Chain33Cli}" 10
for ((i = 0; i < 13; i++)); do
raw=$(${Chain33Cli} autonomy voteProject -r 1 -p "${proposalProjectID}")
sign_and_send "${raw}" "${arrayKey[$i]}"
done
#query
showProject_status 5
#test revoke
update_last_header
proposalProjectTx
raw=$(${Chain33Cli} autonomy revokeProject -p "${proposalProjectID}")
sign_and_send "${raw}" "${propKey}"
showProject_status 2
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function proposalChangeTx() {
local addr=$1
local key=$2
raw=$(${Chain33Cli} autonomy proposalChange -e "${end}" -s "${start}" -c "${addr}")
sign_and_send "${raw}" "${key}"
proposalChangeID="${hash}"
}
function showChange_status() {
local status=$1
result=$(${Chain33Cli} autonomy showChange -p "${proposalChangeID}" -y 0 | jq -r ".propChanges[0].status")
is_equal "${result}" "${status}"
result=$(${Chain33Cli} autonomy showChange -p "${proposalChangeID}" -y 1 -s "${status}")
is_not_equal "${result}" "ErrNotFound"
}
function testProposalChange() {
# proposal
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
#init
autonomyAddr=$(${Chain33Cli} exec addr -e autonomy)
hash=$(${Chain33Cli} send coins transfer -a 20 -n test -t "${autonomyAddr}" -k "${arrayKey[20]}")
check_tx "${Chain33Cli}" "${hash}"
hash=$(${Chain33Cli} send coins transfer -a 20 -n test -t "${autonomyAddr}" -k "${arrayKey[21]}")
check_tx "${Chain33Cli}" "${hash}"
update_last_header 10
proposalChangeTx "${changeAddr}" "${arrayKey[20]}"
ret=$(${Chain33Cli} autonomy showActiveBoard | jq -r ".boards[20]")
if [ "${arrayAddr[20]}" != "${ret}" ]; then
exit 1
fi
#vote
block_wait "${Chain33Cli}" 10
for ((i = 0; i < 13; i++)); do
raw=$(${Chain33Cli} autonomy voteChange -r 1 -p "${proposalChangeID}")
sign_and_send "${raw}" "${arrayKey[$i]}"
done
ret=$(${Chain33Cli} autonomy showActiveBoard | jq -r ".boards[20]")
if [ "${changeAddr}" != "${ret}" ]; then
exit 1
fi
#query
showChange_status 4
#test revoke
update_last_header
proposalChangeTx "${changeAddr2}" "${arrayKey[21]}"
raw=$(${Chain33Cli} autonomy revokeChange -p "${proposalChangeID}")
sign_and_send "${raw}" "${arrayKey[21]}"
showChange_status 2
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function testProposalTerminate() {
#test terminate
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
update_last_header 10
proposalRuleTx
update_last_header 10
proposalBoardTx
update_last_header 10
proposalProjectTx
update_last_header 10
proposalChangeTx "${changeAddr2}" "${arrayKey[21]}"
block_wait "${Chain33Cli}" 850
raw=$(${Chain33Cli} autonomy terminateRule -p "${proposalRuleID}")
sign_and_send "${raw}" "${propKey}"
showRule_status 4
raw=$(${Chain33Cli} autonomy terminateBoard -p "${proposalBoardID}")
sign_and_send "${raw}" "${propKey}"
showBoard_status 4
raw=$(${Chain33Cli} autonomy terminateProject -p "${proposalProjectID}")
sign_and_send "${raw}" "${propKey}"
showProject_status 5
raw=$(${Chain33Cli} autonomy terminateChange -p "${proposalChangeID}")
sign_and_send "${raw}" "${arrayKey[21]}"
showChange_status 4
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function mainTest() {
# shellcheck disable=SC2154
docker_chain33_ip=$(get_docker_addr "${dockerNamePrefix}_chain33_1")
Chain33Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8801"
InitChain33Account
testProposalRule
testProposalBoard
testProposalProject
testProposalChange
testProposalTerminate
}
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
# shellcheck disable=SC2155
set -x
set -e
#color
RED='\033[1;31m'
GRE='\033[1;32m'
NOC='\033[0m'
function exit_test() {
exit 1
}
# $1 dockerName
function get_docker_addr() {
local dockerAddr=$(docker inspect "${1}" | jq ".[].NetworkSettings.Networks" | grep "IPAddress" | awk '{ print $2}' | sed 's/\"//g' | sed 's/,//g')
echo "${dockerAddr}"
}
# chain33 区块等待 $1:cli 路径 $2:等待高度
function block_wait() {
set +x
local CLI=${1}
if [[ $# -lt 1 ]]; then
echo -e "${RED}wrong block_wait parameter${NOC}"
exit_test
fi
local cur_height=$(${CLI} block last_header | jq ".height")
local expect=$((cur_height + ${2}))
local count=0
while true; do
new_height=$(${CLI} block last_header | jq ".height")
if [[ ${new_height} -ge ${expect} ]]; then
break
fi
count=$((count + 1))
sleep 1
done
count=$((count + 1))
set -x
echo -e "${GRE}chain33 wait new block $count s, cur height=$expect,old=$cur_height${NOC}"
}
# 检查交易是否执行成功 $1:cli 路径 $2:交易hash
function check_tx() {
set +x
local CLI=${1}
if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong check_tx parameters${NOC}"
exit_test
fi
if [[ ${2} == "" ]]; then
echo -e "${RED}wrong check_tx txHash is empty${NOC}"
exit_test
fi
local count=0
while true; do
ty=$(${CLI} tx query -s "${2}" | jq .receipt.ty)
if [[ ${ty} != "" ]]; then
break
fi
count=$((count + 1))
sleep 1
if [[ ${count} -ge 100 ]]; then
echo "chain33 query tx for too long"
break
fi
done
set -x
ty=$(${CLI} tx query -s "${2}" | jq .receipt.ty)
if [[ ${ty} != 2 ]]; then
echo -e "${RED}check tx error, hash is ${2}${NOC}"
exit_test
fi
}
# 检查地址是否匹配 $1返回结果 $2匹配地址
function check_addr() {
if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong check number parameters${NOC}"
exit_test
fi
addr=$(echo "${1}" | jq -r ".acc.addr")
if [[ ${addr} != "${2}" ]]; then
echo -e "${RED}error addr, expect ${1}, get ${2}${NOC}"
exit_test
fi
}
# 判断结果 $1 和 $2 是否相等
function is_equal() {
set +x
if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong parameter${NOC}"
exit_test
fi
if [[ $1 != "$2" ]]; then
echo -e "${RED}$1 != ${2}${NOC}"
exit_test
fi
set -x
}
# 判断结果 $1 和 $2 是否不相等
function is_not_equal() {
set +x
if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong parameter${NOC}"
exit_test
fi
if [[ $1 == "$2" ]]; then
echo -e "${RED}$1 == ${2}${NOC}"
exit_test
fi
set -x
}
# import_key and transfer $1 key, $2 label, $3 addr, $4 transfer amount
function import_addr() {
local key="$1"
local label="$2"
local addr="$3"
# shellcheck disable=SC2154
result=$(${Chain33Cli} account import_key -k "${key}" -l "${label}")
check_addr "${result}" "${addr}"
if [ "$#" -eq 4 ]; then
# shellcheck disable=SC2154
hash=$(${Chain33Cli} send coins transfer -a "$4" -n test -t "${addr}" -k "${minerAddr}")
check_tx "${Chain33Cli}" "${hash}"
fi
}
function InitChain33Account() {
# shellcheck disable=SC2154
{
import_addr "${propKey}" "prop" "${propAddr}" 1000
import_addr "${votePrKey2}" "vote2" "${voteAddr2}" 100
import_addr "${votePrKey3}" "vote3" "${voteAddr3}" 100
import_addr "${changeKey}" "changeTest" "${changeAddr}" 10
}
autonomyAddr=$(${Chain33Cli} exec addr -e autonomy)
hash=$(${Chain33Cli} send coins transfer -a 900 -n test -t "${autonomyAddr}" -k "${propKey}")
check_tx "${Chain33Cli}" "${hash}"
local count=0
# shellcheck disable=SC2154
# shellcheck disable=SC2068
for key in ${arrayKey[@]}; do
import_addr "${key}" "board${count}" "${arrayAddr[count]}" 100
count=$((count + 1))
done
}
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
source "./autonomyTest.sh"
function autonomy() {
if [ "${2}" == "test" ]; then
echo "========================== autonomy test =========================="
set +e
set -x
mainTest
echo "========================== autonomy test end =========================="
fi
}
...@@ -8,13 +8,20 @@ HTTP="" ...@@ -8,13 +8,20 @@ HTTP=""
EXECTOR="" EXECTOR=""
EXECTOR_ADDR="" EXECTOR_ADDR=""
TICKET_EXECTOR=""
TICKET_ADDR=""
propKey="0xfd0c4a8a1efcd221ee0f36b7d4f57d8ff843cb8bc193b39c7863332d355acafa" propKey="0xfd0c4a8a1efcd221ee0f36b7d4f57d8ff843cb8bc193b39c7863332d355acafa"
propAddr="15VUiygdxMSZ3rykwe742yomp2cPJ9Tfve" propAddr="15VUiygdxMSZ3rykwe742yomp2cPJ9Tfve"
votePrKey="1c3e6cac2f887e1ab9180e2d5772dc4ba01accb8d4df434faba097003eb35482" #votePrKey="1c3e6cac2f887e1ab9180e2d5772dc4ba01accb8d4df434faba097003eb35482"
voteAddr="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx" #voteAddr="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx"
voteAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
votePrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" #14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
voteAddr2="1EbDHAXpoiewjPLX9uqoz38HsKqMXayZrF"
votePrKey2="B0BB75BC49A787A71F4834DA18614763B53A18291ECE6B5EDEC3AD19D150C3E7" #1EbDHAXpoiewjPLX9uqoz38HsKqMXayZrF
voteAddr3="1KcCVZLSQYRUwE5EXTsAoQs9LuJW6xwfQa"
votePrKey3="2AFF1981291355322C7A6308D46A9C9BA311AA21D94F36B43FC6A6021A1334CF"
proposalRuleID="" proposalRuleID=""
proposalBoardID="" proposalBoardID=""
...@@ -43,7 +50,12 @@ boardsAddr=( ...@@ -43,7 +50,12 @@ boardsAddr=(
"1HGPrjc6H7yBzFV5yCbibvnSUGUgdDNQi3" "1HGPrjc6H7yBzFV5yCbibvnSUGUgdDNQi3"
"19WGov4b7wLf4f8JHMRDnJsGVNMDzap38w" "19WGov4b7wLf4f8JHMRDnJsGVNMDzap38w"
"1HmRa1jAnzJ5SpJRrUWqUki6hx1u33Nbq4" "1HmRa1jAnzJ5SpJRrUWqUki6hx1u33Nbq4"
"168Sn1DXnLrZHTcAM9stD6t2P49fNuJfJ9"
"13KTf57aCkVVJYNJBXBBveiA5V811SrLcT"
"1JQwQWsShTHC4zxHzbUfYQK4kRBriUQdEe"
"1NHuKqoKe3hyv52PF8XBAyaTmJWAqA2Jbb"
) )
boardsPrKey=( boardsPrKey=(
"fa54751118c8159ade22c253f85945a4dd2030b1cf2502eaf785d0a4f5ad7e35" "fa54751118c8159ade22c253f85945a4dd2030b1cf2502eaf785d0a4f5ad7e35"
"da9371ea52f1fc9d72e75dbc9836774895cd0966fd53c83f5e2c92d878903693" "da9371ea52f1fc9d72e75dbc9836774895cd0966fd53c83f5e2c92d878903693"
...@@ -66,6 +78,10 @@ boardsPrKey=( ...@@ -66,6 +78,10 @@ boardsPrKey=(
"227df96a414e26e85c7d87a12296344e6a731ce73e424ba9845cb305ec963843" "227df96a414e26e85c7d87a12296344e6a731ce73e424ba9845cb305ec963843"
"64259075bf2e5a74334442f5048ceaf8427f6097e2dac99c0e463785c7768550" "64259075bf2e5a74334442f5048ceaf8427f6097e2dac99c0e463785c7768550"
"3b812d92b5c365d698255f55c3f0dca027c2f89f2409c51a6297bcf3343c11e6" "3b812d92b5c365d698255f55c3f0dca027c2f89f2409c51a6297bcf3343c11e6"
"0xcd284cd17456b73619fa609bb9e3105e8eff5d059c5e0b6eb1effbebd4d64144"
"0xe892212221b3b58211b90194365f4662764b6d5474ef2961ef77c909e31eeed3"
"0x9d19a2e9a440187010634f4f08ce36e2bc7b521581436a99f05568be94dc66ea"
"0x45d4ce009e25e6d5e00d8d3a50565944b2e3604aa473680a656b242d9acbff35"
) )
boards=' boards='
...@@ -91,11 +107,7 @@ boards=' ...@@ -91,11 +107,7 @@ boards='
"'${boardsAddr[19]}'", "'${boardsAddr[19]}'",
"'${boardsAddr[20]}'" "'${boardsAddr[20]}'"
' '
chain33_para_init() {
ip=$1
chain33_ImportPrivkey "${votePrKey}" "${voteAddr}" "autonomytest" "${ip}"
chain33_SendToAddress "12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" "$voteAddr" 630000000000 "${ip}"
}
chain33_applyCoinsNOLimit() { chain33_applyCoinsNOLimit() {
echo "chain33_getMainChainCoins" echo "chain33_getMainChainCoins"
if [ "$#" -lt 3 ]; then if [ "$#" -lt 3 ]; then
...@@ -108,6 +120,7 @@ chain33_applyCoinsNOLimit() { ...@@ -108,6 +120,7 @@ chain33_applyCoinsNOLimit() {
local poolAddr="1PcGKYYoLn1PLLJJodc1UpgWGeFAQasAkx" local poolAddr="1PcGKYYoLn1PLLJJodc1UpgWGeFAQasAkx"
chain33_SendToAddress "${poolAddr}" "${targetAddr}" "$count" "${ip}" chain33_SendToAddress "${poolAddr}" "${targetAddr}" "$count" "${ip}"
chain33_QueryBalance "${targetAddr}" "${ip}"
} }
handleBoards() { handleBoards() {
...@@ -116,8 +129,10 @@ handleBoards() { ...@@ -116,8 +129,10 @@ handleBoards() {
echo "${boardsPrKey[$i]}" echo "${boardsPrKey[$i]}"
lab="board_"${i} lab="board_"${i}
chain33_ImportPrivkey "${boardsPrKey[$i]}" "${boardsAddr[$i]}" "${lab}" "${ip}" chain33_ImportPrivkey "${boardsPrKey[$i]}" "${boardsAddr[$i]}" "${lab}" "${ip}"
chain33_applyCoins "${boardsAddr[$i]}" 100000000 "${ip}" chain33_applyCoins "${boardsAddr[$i]}" 5000000000 "${ip}"
chain33_SendToAddress "${boardsAddr[$i]}" "$EXECTOR_ADDR" 4000000000 "$HTTP"
done done
# 金额要转入合约中
} }
txQuery() { txQuery() {
...@@ -132,9 +147,9 @@ txQuery() { ...@@ -132,9 +147,9 @@ txQuery() {
proposalBoardTx() { proposalBoardTx() {
local start=$1 local start=$1
local end=$2 local end=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropBoard", "payload":{"boards": ['"${boards}"'],"startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropBoard", "payload":{"boardUpdate": 3,"boards": ['"${boards}"'],"startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}"
proposalBoardID=$RAW_TX_HASH proposalBoardID=$RAW_TX_HASH
echo "proposalBoardID = $proposalBoardID" echo "proposalBoardID = $proposalBoardID"
...@@ -144,9 +159,9 @@ proposalBoardTx() { ...@@ -144,9 +159,9 @@ proposalBoardTx() {
voteBoardTx() { voteBoardTx() {
local ID=$1 local ID=$1
local privk=$2 local privk=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropBoard", "payload":{"proposalID": "'"${ID}"'","approve": true}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropBoard", "payload":{"proposalID": "'"${ID}"'","voteOption":1}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}"
echo "$RAW_TX_HASH" echo "$RAW_TX_HASH"
txQuery "$FUNCNAME" txQuery "$FUNCNAME"
...@@ -155,10 +170,11 @@ voteBoardTx() { ...@@ -155,10 +170,11 @@ voteBoardTx() {
revokeProposalTx() { revokeProposalTx() {
local ID=$1 local ID=$1
local funcName=$2 local funcName=$2
local key=$3
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"'"${funcName}"'", "payload":{"proposalID": "'"${ID}"'"}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"'"${funcName}"'", "payload":{"proposalID": "'"${ID}"'"}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${key}" "${HTTP}"
echo "$RAW_TX_HASH" echo "$RAW_TX_HASH"
txQuery "$FUNCNAME" txQuery "$FUNCNAME"
} }
...@@ -168,7 +184,7 @@ terminateProposalTx() { ...@@ -168,7 +184,7 @@ terminateProposalTx() {
local funcName=$2 local funcName=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"'"${funcName}"'", "payload":{"proposalID": "'"${ID}"'"}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"'"${funcName}"'", "payload":{"proposalID": "'"${ID}"'"}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}"
echo "$RAW_TX_HASH" echo "$RAW_TX_HASH"
txQuery "$FUNCNAME" txQuery "$FUNCNAME"
...@@ -179,7 +195,7 @@ queryProposal() { ...@@ -179,7 +195,7 @@ queryProposal() {
local funcName=$2 local funcName=$2
local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"'"${funcName}"'","payload":{"data":"'"${ID}"'"}}]}' local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"'"${funcName}"'","payload":{"data":"'"${ID}"'"}}]}'
resok='(.error|not)' resok='(.error|not)'
chain33_Http "$req" ${HTTP} "$resok" "$FUNCNAME" chain33_Http "$req" "${HTTP}" "$resok" "$FUNCNAME"
} }
listProposal() { listProposal() {
...@@ -189,46 +205,49 @@ listProposal() { ...@@ -189,46 +205,49 @@ listProposal() {
local direct=0 local direct=0
local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"'"${funcName}"'","payload":{"status":"'"${status}"'", "addr":"'"${addr}"'", "count":1, "direction":"'"${direct}"'"}}]}' local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"'"${funcName}"'","payload":{"status":"'"${status}"'", "addr":"'"${addr}"'", "count":1, "direction":"'"${direct}"'"}}]}'
resok='(.error|not)' resok='(.error|not)'
chain33_Http "$req" ${HTTP} "$resok" "$FUNCNAME" chain33_Http "$req" "${HTTP}" "$resok" "$FUNCNAME ${funcName}"
} }
queryActivePropBoard() { queryActivePropBoard() {
local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"GetActiveBoard","payload":{"data":"1"}}]}' local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"GetActiveBoard","payload":{"data":"1"}}]}'
resok='(.error|not)' resok='(.error|not)'
chain33_Http "$req" ${HTTP} "$resok" "$FUNCNAME" chain33_Http "$req" "${HTTP}" "$resok" "$FUNCNAME"
} }
testProposalBoard() { testProposalBoard() {
#proposal #proposal
chain33_LastBlockHeight ${HTTP} echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 20 + 720)) end=$((start + 20 + 720))
proposalBoardTx ${start} ${end} proposalBoardTx ${start} ${end}
#vote #vote
chain33_BlockWait 100 "$HTTP" chain33_BlockWait 100 "$HTTP"
voteBoardTx "${proposalBoardID}" "${votePrKey}" voteBoardTx "${proposalBoardID}" "${votePrKey}"
voteBoardTx "${proposalBoardID}" "${votePrKey2}"
#query #query
queryProposal "${proposalBoardID}" "GetProposalBoard" queryProposal "${proposalBoardID}" "GetProposalBoard"
listProposal 4 "ListProposalBoard" listProposal 4 "ListProposalBoard"
queryActivePropBoard queryActivePropBoard
#test revoke #test revoke
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalBoardTx ${start} ${end} proposalBoardTx ${start} ${end}
revokeProposalTx "${proposalBoardID}" "RvkPropBoard" revokeProposalTx "${proposalBoardID}" "RvkPropBoard" "${propKey}"
queryProposal "${proposalBoardID}" "GetProposalBoard" queryProposal "${proposalBoardID}" "GetProposalBoard"
listProposal 2 "ListProposalBoard" listProposal 2 "ListProposalBoard"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
proposalRuleTx() { proposalRuleTx() {
local start=$1 local start=$1
local end=$2 local end=$2
local propAmount=$3 local propAmount=$3
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropRule", "payload":{"ruleCfg": {"proposalAmount" : '"${propAmount}"'},"startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropRule", "payload":{"ruleCfg": {"proposalAmount" : '"${propAmount}"',"boardApproveRatio":50,"pubOpposeRatio":33,"largeProjectAmount":100000000000000,"publicPeriod":172800,"pubAttendRatio":60,"pubApproveRatio":60},"startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}"
proposalRuleID=$RAW_TX_HASH proposalRuleID=$RAW_TX_HASH
echo "proposalRuleID = $proposalRuleID" echo "proposalRuleID = $proposalRuleID"
...@@ -238,9 +257,9 @@ proposalRuleTx() { ...@@ -238,9 +257,9 @@ proposalRuleTx() {
voteRuleTx() { voteRuleTx() {
local ID=$1 local ID=$1
local privk=$2 local privk=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropRule", "payload":{"proposalID": "'"${ID}"'","approve": true}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropRule", "payload":{"proposalID": "'"${ID}"'", "vote":1}}]}' # "approve": true,
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}"
echo "$RAW_TX_HASH" echo "$RAW_TX_HASH"
txQuery "$FUNCNAME" txQuery "$FUNCNAME"
...@@ -249,31 +268,36 @@ voteRuleTx() { ...@@ -249,31 +268,36 @@ voteRuleTx() {
queryActivePropRule() { queryActivePropRule() {
local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"GetActiveRule","payload":{"data":"1"}}]}' local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"GetActiveRule","payload":{"data":"1"}}]}'
resok='(.error|not)' resok='(.error|not)'
chain33_Http "$req" ${HTTP} "$resok" "$FUNCNAME" chain33_Http "$req" "${HTTP}" "$resok" "$FUNCNAME"
} }
testProposalRule() { testProposalRule() {
# proposal # proposal
chain33_LastBlockHeight ${HTTP} echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 20 + 720)) end=$((start + 20 + 720))
proposalRuleTx ${start} ${end} 2000000000 proposalRuleTx ${start} ${end} 2000000000
#vote #vote
chain33_BlockWait 100 "$HTTP" chain33_BlockWait 100 "$HTTP"
voteRuleTx "${proposalRuleID}" ${votePrKey} voteRuleTx "${proposalRuleID}" ${votePrKey}
voteRuleTx "${proposalRuleID}" "${votePrKey2}"
voteRuleTx "${proposalRuleID}" "${votePrKey3}"
#query #query
queryProposal "${proposalRuleID}" "GetProposalRule" queryProposal "${proposalRuleID}" "GetProposalRule"
listProposal 4 "ListProposalRule" listProposal 4 "ListProposalRule"
queryActivePropRule queryActivePropRule
#test revoke #test revoke
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalRuleTx ${start} ${end} 2000000000 proposalRuleTx ${start} ${end} 2000000000
revokeProposalTx "${proposalRuleID}" "RvkPropRule" revokeProposalTx "${proposalRuleID}" "RvkPropRule" "${propKey}"
queryProposal "${proposalRuleID}" "GetProposalRule" queryProposal "${proposalRuleID}" "GetProposalRule"
listProposal 2 "ListProposalRule" listProposal 2 "ListProposalRule"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
proposalProjectTx() { proposalProjectTx() {
...@@ -283,7 +307,7 @@ proposalProjectTx() { ...@@ -283,7 +307,7 @@ proposalProjectTx() {
local toAddr=$4 local toAddr=$4
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropProject", "payload":{"amount" : '"${amount}"', "toAddr" : "'"${toAddr}"'","startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropProject", "payload":{"amount" : '"${amount}"', "toAddr" : "'"${toAddr}"'","startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}"
proposalProjectID=$RAW_TX_HASH proposalProjectID=$RAW_TX_HASH
echo "proposalProjectID = $proposalProjectID" echo "proposalProjectID = $proposalProjectID"
...@@ -293,9 +317,9 @@ proposalProjectTx() { ...@@ -293,9 +317,9 @@ proposalProjectTx() {
voteProjectTx() { voteProjectTx() {
local ID=$1 local ID=$1
local privk=$2 local privk=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropProject", "payload":{"proposalID": "'"${ID}"'","approve": true}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropProject", "payload":{"proposalID": "'"${ID}"'","vote":1}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}"
echo "$RAW_TX_HASH" echo "$RAW_TX_HASH"
txQuery "$FUNCNAME" txQuery "$FUNCNAME"
...@@ -303,7 +327,8 @@ voteProjectTx() { ...@@ -303,7 +327,8 @@ voteProjectTx() {
testProposalProject() { testProposalProject() {
# proposal # proposal
chain33_LastBlockHeight ${HTTP} echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 20 + 720)) end=$((start + 20 + 720))
proposalProjectTx ${start} ${end} 100000000 ${propAddr} proposalProjectTx ${start} ${end} 100000000 ${propAddr}
...@@ -316,13 +341,14 @@ testProposalProject() { ...@@ -316,13 +341,14 @@ testProposalProject() {
queryProposal "${proposalProjectID}" "GetProposalProject" queryProposal "${proposalProjectID}" "GetProposalProject"
listProposal 5 "ListProposalProject" listProposal 5 "ListProposalProject"
#test revoke #test revoke
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalProjectTx ${start} ${end} 100000000 ${propAddr} proposalProjectTx ${start} ${end} 100000000 ${propAddr}
revokeProposalTx "${proposalProjectID}" "RvkPropProject" revokeProposalTx "${proposalProjectID}" "RvkPropProject" "${propKey}"
queryProposal "${proposalProjectID}" "GetProposalProject" queryProposal "${proposalProjectID}" "GetProposalProject"
listProposal 2 "ListProposalProject" listProposal 2 "ListProposalProject"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
proposalChangeTx() { proposalChangeTx() {
...@@ -330,10 +356,11 @@ proposalChangeTx() { ...@@ -330,10 +356,11 @@ proposalChangeTx() {
local end=$2 local end=$2
local addr=$3 local addr=$3
local cancel=$4 local cancel=$4
local key=$5
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropChange", "payload":{"changes" : [{"cancel": '"${cancel}"', "addr":"'"${addr}"'"}],"startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"PropChange", "payload":{"changes" : [{"cancel": '"${cancel}"', "addr":"'"${addr}"'"}],"startBlockHeight":'"${start}"',"endBlockHeight":'"${end}"'}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${propKey}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${key}" "${HTTP}"
proposalChangeID=$RAW_TX_HASH proposalChangeID=$RAW_TX_HASH
echo "proposalChangeID = $proposalChangeID" echo "proposalChangeID = $proposalChangeID"
txQuery "$FUNCNAME" txQuery "$FUNCNAME"
...@@ -342,9 +369,9 @@ proposalChangeTx() { ...@@ -342,9 +369,9 @@ proposalChangeTx() {
voteChangeTx() { voteChangeTx() {
local ID=$1 local ID=$1
local privk=$2 local privk=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropChange", "payload":{"proposalID": "'"${ID}"'","approve": true}}]}' local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"VotePropChange", "payload":{"proposalID": "'"${ID}"'","vote":1}}]}'
echo "${req}" echo "${req}"
chain33_Http "$req" ${HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result" chain33_Http "$req" "${HTTP}" '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}" chain33_SignAndSendTx "${RETURN_RESP}" "${privk}" "${HTTP}"
echo "$RAW_TX_HASH" echo "$RAW_TX_HASH"
txQuery "$FUNCNAME" txQuery "$FUNCNAME"
...@@ -352,10 +379,11 @@ voteChangeTx() { ...@@ -352,10 +379,11 @@ voteChangeTx() {
testProposalChange() { testProposalChange() {
# proposal # proposal
chain33_LastBlockHeight ${HTTP} echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 20 + 720)) end=$((start + 20 + 720))
proposalChangeTx ${start} ${end} "${boardsAddr[20]}" true proposalChangeTx ${start} ${end} "${boardsAddr[21]}" true "${boardsPrKey[0]}"
chain33_BlockWait 100 "$HTTP" chain33_BlockWait 100 "$HTTP"
#vote #vote
for ((i = 0; i < 11; i++)); do for ((i = 0; i < 11; i++)); do
...@@ -366,36 +394,38 @@ testProposalChange() { ...@@ -366,36 +394,38 @@ testProposalChange() {
listProposal 4 "ListProposalChange" listProposal 4 "ListProposalChange"
#test revoke #test revoke
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalChangeTx ${start} ${end} "${boardsAddr[20]}" false proposalChangeTx ${start} ${end} "${boardsAddr[22]}" true "${boardsPrKey[1]}"
revokeProposalTx "${proposalChangeID}" "RvkPropChange" revokeProposalTx "${proposalChangeID}" "RvkPropChange" "${boardsPrKey[1]}"
queryProposal "${proposalChangeID}" "GetProposalChange" queryProposal "${proposalChangeID}" "GetProposalChange"
listProposal 2 "ListProposalChange" listProposal 2 "ListProposalChange"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
testProposalTerminate() { testProposalTerminate() {
#test terminate #test terminate
chain33_LastBlockHeight ${HTTP} echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalRuleTx ${start} ${end} 2000000000 proposalRuleTx ${start} ${end} 2000000000
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalBoardTx ${start} ${end} proposalBoardTx ${start} ${end}
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalProjectTx ${start} ${end} 100000000 ${propAddr} proposalProjectTx ${start} ${end} 100000000 ${propAddr}
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight "${HTTP}"
start=$((LAST_BLOCK_HEIGHT + 100)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720)) end=$((start + 120 + 720))
proposalChangeTx ${start} ${end} "${boardsAddr[20]}" false proposalChangeTx ${start} ${end} "${boardsAddr[23]}" true "${boardsPrKey[2]}"
chain33_BlockWait 940 "$HTTP" chain33_BlockWait 940 "$HTTP"
...@@ -414,10 +444,12 @@ testProposalTerminate() { ...@@ -414,10 +444,12 @@ testProposalTerminate() {
terminateProposalTx "${proposalChangeID}" "TmintPropChange" terminateProposalTx "${proposalChangeID}" "TmintPropChange"
queryProposal "${proposalChangeID}" "GetProposalChange" queryProposal "${proposalChangeID}" "GetProposalChange"
listProposal 4 "ListProposalChange" listProposal 4 "ListProposalChange"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function run_testcases() { function run_testcases() {
echo "run_testcases" echo "run_testcases"
testProposalRule testProposalRule
testProposalBoard testProposalBoard
testProposalProject testProposalProject
...@@ -430,47 +462,45 @@ init() { ...@@ -430,47 +462,45 @@ init() {
echo "ipara=$ispara" echo "ipara=$ispara"
if [ "$ispara" == true ]; then if [ "$ispara" == true ]; then
EXECTOR_ADDR=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.autonomy"}]}' ${HTTP} | jq -r ".result") EXECTOR_ADDR=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.autonomy"}]}' "${HTTP}" | jq -r ".result")
EXECTOR="user.p.para.autonomy" EXECTOR="user.p.para.autonomy"
TICKET_ADDR=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.ticket"}]}' ${HTTP} | jq -r ".result")
TICKET_EXECTOR="user.p.para.ticket"
else else
EXECTOR_ADDR=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"autonomy"}]}' ${HTTP} | jq -r ".result") EXECTOR_ADDR=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"autonomy"}]}' "${HTTP}" | jq -r ".result")
EXECTOR="autonomy" EXECTOR="autonomy"
TICKET_ADDR=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"ticket"}]}' ${HTTP} | jq -r ".result")
TICKET_EXECTOR="ticket"
fi fi
echo "EXECTOR_ADDR=$EXECTOR_ADDR" echo "EXECTOR_ADDR=$EXECTOR_ADDR"
local main_ip=${HTTP//8901/8801} local main_ip=${HTTP//8901/8801}
chain33_ImportPrivkey "${propKey}" "${propAddr}" "prop" "${main_ip}" chain33_ImportPrivkey "${propKey}" "${propAddr}" "prop" "${main_ip}"
chain33_ImportPrivkey "${votePrKey2}" "${voteAddr2}" "voteAddr2" "${main_ip}"
chain33_ImportPrivkey "${votePrKey3}" "${voteAddr3}" "voteAddr3" "${main_ip}"
if [ "$ispara" == false ]; then if [ "$ispara" == false ]; then
chain33_applyCoinsNOLimit "$propAddr" 100000000000 "${main_ip}" chain33_applyCoinsNOLimit "$propAddr" 100000000000 "${main_ip}"
chain33_QueryBalance "${propAddr}" "$main_ip" chain33_applyCoinsNOLimit "${voteAddr}" 10000000000 "${main_ip}"
chain33_applyCoinsNOLimit "${voteAddr2}" 10000000000 "${main_ip}"
chain33_applyCoinsNOLimit "${voteAddr3}" 10000000000 "${main_ip}"
else else
chain33_applyCoins "$propAddr" 1000000000 "${main_ip}" chain33_applyCoinsNOLimit "$propAddr" 1000000000 "${main_ip}"
chain33_QueryBalance "${propAddr}" "$main_ip"
#主链投票账户转帐 #主链投票账户转帐
handleBoards "$main_ip" handleBoards "$main_ip"
local para_ip="${HTTP}" local para_ip="${HTTP}"
chain33_ImportPrivkey "${propKey}" "${propAddr}" "prop" "$para_ip" chain33_ImportPrivkey "${propKey}" "${propAddr}" "prop" "$para_ip"
chain33_ImportPrivkey "${votePrKey2}" "${voteAddr2}" "voteAddr2" "${para_ip}"
chain33_ImportPrivkey "${votePrKey3}" "${voteAddr3}" "voteAddr3" "${para_ip}"
#平行链中账户转帐 #平行链中账户转帐
chain33_applyCoinsNOLimit "$propAddr" 100000000000 "$para_ip" chain33_applyCoinsNOLimit "$propAddr" 100000000000 "$para_ip"
chain33_QueryBalance "$propAddr" "$para_ip" chain33_applyCoinsNOLimit "${voteAddr}" 10000000000 "${para_ip}"
chain33_para_init "$para_ip" chain33_applyCoinsNOLimit "${voteAddr2}" 10000000000 "${para_ip}"
chain33_applyCoinsNOLimit "${voteAddr3}" 10000000000 "${para_ip}"
fi fi
# 往合约中转 # 往合约中转
chain33_SendToAddress "$propAddr" "$EXECTOR_ADDR" 90000000000 "$HTTP" chain33_SendToAddress "$propAddr" "$EXECTOR_ADDR" 90000000000 "$HTTP"
chain33_QueryExecBalance "$propAddr" "$EXECTOR" "$HTTP" chain33_QueryExecBalance "$propAddr" "$EXECTOR" "$HTTP"
# 往ticket合约中转帐
chain33_SendToAddress "$voteAddr" "$TICKET_ADDR" 300100000000 "$HTTP"
chain33_QueryExecBalance "$voteAddr" "$TICKET_EXECTOR" "$HTTP"
# 往投票账户中转帐 # 往投票账户中转帐
handleBoards "$HTTP" handleBoards "$HTTP"
} }
......
...@@ -88,7 +88,7 @@ func addProposalBoardFlags(cmd *cobra.Command) { ...@@ -88,7 +88,7 @@ func addProposalBoardFlags(cmd *cobra.Command) {
cmd.Flags().Int32P("month", "m", 0, "month") cmd.Flags().Int32P("month", "m", 0, "month")
cmd.Flags().Int32P("day", "d", 0, "day") cmd.Flags().Int32P("day", "d", 0, "day")
cmd.Flags().BoolP("update", "u", false, "replace or update boards, default is replace(false); update(true)") cmd.Flags().Int32P("update", "u", 1, "addr delete or replace boards, 1:add, 2:delete, 3:replace all, default is 1")
cmd.Flags().Int64P("startBlock", "s", 0, "start block height") cmd.Flags().Int64P("startBlock", "s", 0, "start block height")
cmd.MarkFlagRequired("startBlock") cmd.MarkFlagRequired("startBlock")
cmd.Flags().Int64P("endBlock", "e", 0, "end block height") cmd.Flags().Int64P("endBlock", "e", 0, "end block height")
...@@ -106,7 +106,7 @@ func proposalBoard(cmd *cobra.Command, args []string) { ...@@ -106,7 +106,7 @@ func proposalBoard(cmd *cobra.Command, args []string) {
month, _ := cmd.Flags().GetInt32("month") month, _ := cmd.Flags().GetInt32("month")
day, _ := cmd.Flags().GetInt32("day") day, _ := cmd.Flags().GetInt32("day")
update, _ := cmd.Flags().GetBool("update") update, _ := cmd.Flags().GetInt32("update")
startBlock, _ := cmd.Flags().GetInt64("startBlock") startBlock, _ := cmd.Flags().GetInt64("startBlock")
endBlock, _ := cmd.Flags().GetInt64("endBlock") endBlock, _ := cmd.Flags().GetInt64("endBlock")
boardstr, _ := cmd.Flags().GetString("boards") boardstr, _ := cmd.Flags().GetString("boards")
...@@ -117,7 +117,7 @@ func proposalBoard(cmd *cobra.Command, args []string) { ...@@ -117,7 +117,7 @@ func proposalBoard(cmd *cobra.Command, args []string) {
Year: year, Year: year,
Month: month, Month: month,
Day: day, Day: day,
Update: update, BoardUpdate: auty.BoardUpdate(update),
Boards: boards, Boards: boards,
StartBlockHeight: startBlock, StartBlockHeight: startBlock,
EndBlockHeight: endBlock, EndBlockHeight: endBlock,
...@@ -191,7 +191,8 @@ func VoteProposalBoardCmd() *cobra.Command { ...@@ -191,7 +191,8 @@ func VoteProposalBoardCmd() *cobra.Command {
func addVoteProposalBoardFlags(cmd *cobra.Command) { func addVoteProposalBoardFlags(cmd *cobra.Command) {
cmd.Flags().StringP("proposalID", "p", "", "proposal ID") cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.MarkFlagRequired("proposalID") cmd.MarkFlagRequired("proposalID")
cmd.Flags().Int32P("approve", "r", 1, "is approve, default true")
cmd.Flags().Int32P("approve", "r", 1, "1:approve, 2:oppose, 3:quit, default 1")
cmd.Flags().StringP("originAddr", "o", "", "origin address: addr1-addr2......addrN") cmd.Flags().StringP("originAddr", "o", "", "origin address: addr1-addr2......addrN")
} }
...@@ -203,12 +204,6 @@ func voteProposalBoard(cmd *cobra.Command, args []string) { ...@@ -203,12 +204,6 @@ func voteProposalBoard(cmd *cobra.Command, args []string) {
approve, _ := cmd.Flags().GetInt32("approve") approve, _ := cmd.Flags().GetInt32("approve")
originAddr, _ := cmd.Flags().GetString("originAddr") originAddr, _ := cmd.Flags().GetString("originAddr")
var isapp bool
if approve == 0 {
isapp = false
} else {
isapp = true
}
var originAddrs []string var originAddrs []string
if len(originAddr) > 0 { if len(originAddr) > 0 {
originAddrs = strings.Split(originAddr, "-") originAddrs = strings.Split(originAddr, "-")
...@@ -216,8 +211,8 @@ func voteProposalBoard(cmd *cobra.Command, args []string) { ...@@ -216,8 +211,8 @@ func voteProposalBoard(cmd *cobra.Command, args []string) {
params := &auty.VoteProposalBoard{ params := &auty.VoteProposalBoard{
ProposalID: ID, ProposalID: ID,
Approve: isapp,
OriginAddr: originAddrs, OriginAddr: originAddrs,
VoteOption: auty.AutonomyVoteOption(approve),
} }
payLoad, err := json.Marshal(params) payLoad, err := json.Marshal(params)
if err != nil { if err != nil {
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
package commands package commands
import ( import (
"strings"
"encoding/json" "encoding/json"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient" jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
...@@ -36,8 +34,8 @@ func addProposalChangeFlags(cmd *cobra.Command) { ...@@ -36,8 +34,8 @@ func addProposalChangeFlags(cmd *cobra.Command) {
cmd.Flags().Int64P("endBlock", "e", 0, "end block height") cmd.Flags().Int64P("endBlock", "e", 0, "end block height")
cmd.MarkFlagRequired("endBlock") cmd.MarkFlagRequired("endBlock")
cmd.Flags().StringP("changes", "c", "", "addr1-true*addr2-false*addr3-true*......*addrN-false (1<=N<20)") cmd.Flags().StringP("change", "c", "", "addr")
cmd.MarkFlagRequired("changes") cmd.MarkFlagRequired("change")
} }
func proposalChange(cmd *cobra.Command, args []string) { func proposalChange(cmd *cobra.Command, args []string) {
...@@ -49,29 +47,12 @@ func proposalChange(cmd *cobra.Command, args []string) { ...@@ -49,29 +47,12 @@ func proposalChange(cmd *cobra.Command, args []string) {
startBlock, _ := cmd.Flags().GetInt64("startBlock") startBlock, _ := cmd.Flags().GetInt64("startBlock")
endBlock, _ := cmd.Flags().GetInt64("endBlock") endBlock, _ := cmd.Flags().GetInt64("endBlock")
changestr, _ := cmd.Flags().GetString("changes") changeAddrstr, _ := cmd.Flags().GetString("change")
changeStr := strings.Split(changestr, "*")
var changes []*auty.Change var changes []*auty.Change
for _, chStr := range changeStr { change := &auty.Change{Cancel: true, Addr: changeAddrstr}
per := strings.Split(chStr, "-") changes = append(changes, change)
if len(per) == 2 {
if per[1] == "true" {
change := &auty.Change{
Cancel: true,
Addr: per[0],
}
changes = append(changes, change)
} else if per[1] == "false" {
change := &auty.Change{
Cancel: false,
Addr: per[0],
}
changes = append(changes, change)
}
}
}
params := &auty.ProposalChange{ params := &auty.ProposalChange{
Year: year, Year: year,
Month: month, Month: month,
...@@ -148,7 +129,7 @@ func VoteProposalChangeCmd() *cobra.Command { ...@@ -148,7 +129,7 @@ func VoteProposalChangeCmd() *cobra.Command {
func addVoteProposalChangeFlags(cmd *cobra.Command) { func addVoteProposalChangeFlags(cmd *cobra.Command) {
cmd.Flags().StringP("proposalID", "p", "", "proposal ID") cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.MarkFlagRequired("proposalID") cmd.MarkFlagRequired("proposalID")
cmd.Flags().Int32P("approve", "r", 1, "is approve, default true") cmd.Flags().Int32P("approve", "r", 1, "1:approve, 2:oppose, 3:quit, default 1")
} }
func voteProposalChange(cmd *cobra.Command, args []string) { func voteProposalChange(cmd *cobra.Command, args []string) {
...@@ -157,16 +138,9 @@ func voteProposalChange(cmd *cobra.Command, args []string) { ...@@ -157,16 +138,9 @@ func voteProposalChange(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
approve, _ := cmd.Flags().GetInt32("approve") approve, _ := cmd.Flags().GetInt32("approve")
var isapp bool
if approve == 0 {
isapp = false
} else {
isapp = true
}
params := &auty.VoteProposalChange{ params := &auty.VoteProposalChange{
ProposalID: ID, ProposalID: ID,
Approve: isapp, Vote: auty.AutonomyVoteOption(approve),
} }
payLoad, err := json.Marshal(params) payLoad, err := json.Marshal(params)
if err != nil { if err != nil {
......
...@@ -54,7 +54,6 @@ func addProposalProjectFlags(cmd *cobra.Command) { ...@@ -54,7 +54,6 @@ func addProposalProjectFlags(cmd *cobra.Command) {
cmd.Flags().Int64P("endBlock", "e", 0, "end block height") cmd.Flags().Int64P("endBlock", "e", 0, "end block height")
cmd.MarkFlagRequired("endBlock") cmd.MarkFlagRequired("endBlock")
cmd.Flags().Int32P("projectNeedBlockNum", "n", 0, "project complete need time(unit is block number)") cmd.Flags().Int32P("projectNeedBlockNum", "n", 0, "project complete need time(unit is block number)")
cmd.MarkFlagRequired("projectNeedBlockNum")
} }
func proposalProject(cmd *cobra.Command, args []string) { func proposalProject(cmd *cobra.Command, args []string) {
...@@ -171,7 +170,7 @@ func VoteProposalProjectCmd() *cobra.Command { ...@@ -171,7 +170,7 @@ func VoteProposalProjectCmd() *cobra.Command {
func addVoteProposalProjectFlags(cmd *cobra.Command) { func addVoteProposalProjectFlags(cmd *cobra.Command) {
cmd.Flags().StringP("proposalID", "p", "", "proposal ID") cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.MarkFlagRequired("proposalID") cmd.MarkFlagRequired("proposalID")
cmd.Flags().Int32P("approve", "r", 1, "is approve, default true") cmd.Flags().Int32P("approve", "r", 1, "1:approve, 2:oppose, 3:quit, default 1")
} }
func voteProposalProject(cmd *cobra.Command, args []string) { func voteProposalProject(cmd *cobra.Command, args []string) {
...@@ -180,16 +179,10 @@ func voteProposalProject(cmd *cobra.Command, args []string) { ...@@ -180,16 +179,10 @@ func voteProposalProject(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
approve, _ := cmd.Flags().GetInt32("approve") approve, _ := cmd.Flags().GetInt32("approve")
var isapp bool
if approve == 0 {
isapp = false
} else {
isapp = true
}
params := &auty.VoteProposalProject{ params := &auty.VoteProposalProject{
ProposalID: ID, ProposalID: ID,
Approve: isapp, Vote: auty.AutonomyVoteOption(approve),
} }
payLoad, err := json.Marshal(params) payLoad, err := json.Marshal(params)
if err != nil { if err != nil {
......
...@@ -47,6 +47,8 @@ func addProposalRuleFlags(cmd *cobra.Command) { ...@@ -47,6 +47,8 @@ func addProposalRuleFlags(cmd *cobra.Command) {
cmd.Flags().Int64P("proposalAmount", "p", 0, "proposal cost amount") cmd.Flags().Int64P("proposalAmount", "p", 0, "proposal cost amount")
cmd.Flags().Int64P("largeProjectAmount", "l", 0, "large project amount threshold") cmd.Flags().Int64P("largeProjectAmount", "l", 0, "large project amount threshold")
cmd.Flags().Int32P("publicPeriod", "u", 0, "public time") cmd.Flags().Int32P("publicPeriod", "u", 0, "public time")
cmd.Flags().Int32P("pubAttendRatio", "a", 0, "public attend ratio(unit is %)")
cmd.Flags().Int32P("pubApproveRatio", "v", 0, "public approve ratio(unit is %)")
} }
func proposalRule(cmd *cobra.Command, args []string) { func proposalRule(cmd *cobra.Command, args []string) {
...@@ -65,6 +67,8 @@ func proposalRule(cmd *cobra.Command, args []string) { ...@@ -65,6 +67,8 @@ func proposalRule(cmd *cobra.Command, args []string) {
proposalAmount, _ := cmd.Flags().GetInt64("proposalAmount") proposalAmount, _ := cmd.Flags().GetInt64("proposalAmount")
largeProjectAmount, _ := cmd.Flags().GetInt64("largeProjectAmount") largeProjectAmount, _ := cmd.Flags().GetInt64("largeProjectAmount")
publicPeriod, _ := cmd.Flags().GetInt32("publicPeriod") publicPeriod, _ := cmd.Flags().GetInt32("publicPeriod")
pubAttendRatio, _ := cmd.Flags().GetInt32("pubAttendRatio")
pubApproveRatio, _ := cmd.Flags().GetInt32("pubApproveRatio")
cfg, err := commandtypes.GetChainConfig(rpcLaddr) cfg, err := commandtypes.GetChainConfig(rpcLaddr)
if err != nil { if err != nil {
...@@ -82,6 +86,8 @@ func proposalRule(cmd *cobra.Command, args []string) { ...@@ -82,6 +86,8 @@ func proposalRule(cmd *cobra.Command, args []string) {
ProposalAmount: proposalAmount * cfg.CoinPrecision, ProposalAmount: proposalAmount * cfg.CoinPrecision,
LargeProjectAmount: largeProjectAmount * cfg.CoinPrecision, LargeProjectAmount: largeProjectAmount * cfg.CoinPrecision,
PublicPeriod: publicPeriod, PublicPeriod: publicPeriod,
PubAttendRatio: pubAttendRatio,
PubApproveRatio: pubApproveRatio,
}, },
StartBlockHeight: startBlock, StartBlockHeight: startBlock,
EndBlockHeight: endBlock, EndBlockHeight: endBlock,
...@@ -154,7 +160,7 @@ func VoteProposalRuleCmd() *cobra.Command { ...@@ -154,7 +160,7 @@ func VoteProposalRuleCmd() *cobra.Command {
func addVoteProposalRuleFlags(cmd *cobra.Command) { func addVoteProposalRuleFlags(cmd *cobra.Command) {
cmd.Flags().StringP("proposalID", "p", "", "proposal ID") cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
cmd.MarkFlagRequired("proposalID") cmd.MarkFlagRequired("proposalID")
cmd.Flags().Int32P("approve", "r", 1, "is approve, default true") cmd.Flags().Int32P("approve", "r", 1, "1:approve, 2:oppose, 3:quit, default 1")
cmd.Flags().StringP("originAddr", "o", "", "origin address: addr1-addr2......addrN") cmd.Flags().StringP("originAddr", "o", "", "origin address: addr1-addr2......addrN")
} }
...@@ -165,12 +171,6 @@ func voteProposalRule(cmd *cobra.Command, args []string) { ...@@ -165,12 +171,6 @@ func voteProposalRule(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
approve, _ := cmd.Flags().GetInt32("approve") approve, _ := cmd.Flags().GetInt32("approve")
originAddr, _ := cmd.Flags().GetString("originAddr") originAddr, _ := cmd.Flags().GetString("originAddr")
var isapp bool
if approve == 0 {
isapp = false
} else {
isapp = true
}
var originAddrs []string var originAddrs []string
if len(originAddr) > 0 { if len(originAddr) > 0 {
...@@ -179,8 +179,8 @@ func voteProposalRule(cmd *cobra.Command, args []string) { ...@@ -179,8 +179,8 @@ func voteProposalRule(cmd *cobra.Command, args []string) {
params := &auty.VoteProposalRule{ params := &auty.VoteProposalRule{
ProposalID: ID, ProposalID: ID,
Approve: isapp,
OriginAddr: originAddrs, OriginAddr: originAddrs,
Vote: auty.AutonomyVoteOption(approve),
} }
payLoad, err := json.Marshal(params) payLoad, err := json.Marshal(params)
if err != nil { if err != nil {
......
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
type subConfig struct { type subConfig struct {
Total string `json:"total"` Total string `json:"total"`
UseBalance bool `json:"useBalance"` UseBalance bool `json:"useBalance"`
Execer string `json:"execer"`
} }
var ( var (
......
...@@ -407,7 +407,6 @@ func checkExecLocalBoard(t *testing.T, kvdb db.KVDB, cur *auty.AutonomyProposalB ...@@ -407,7 +407,6 @@ func checkExecLocalBoard(t *testing.T, kvdb db.KVDB, cur *auty.AutonomyProposalB
assert.Equal(t, prop.Address, cur.Address) assert.Equal(t, prop.Address, cur.Address)
assert.Equal(t, prop.Height, cur.Height) assert.Equal(t, prop.Height, cur.Height)
assert.Equal(t, prop.Index, cur.Index) assert.Equal(t, prop.Index, cur.Index)
} }
func saveKvs(sdb db.DB, kvs []*types.KeyValue) { func saveKvs(sdb db.DB, kvs []*types.KeyValue) {
......
...@@ -12,6 +12,7 @@ import ( ...@@ -12,6 +12,7 @@ import (
"github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/pkg/errors"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
ticket "github.com/33cn/plugin/plugin/dapp/ticket/executor" ticket "github.com/33cn/plugin/plugin/dapp/ticket/executor"
...@@ -51,60 +52,79 @@ func newAction(a *Autonomy, tx *types.Transaction, index int32) *action { ...@@ -51,60 +52,79 @@ func newAction(a *Autonomy, tx *types.Transaction, index int32) *action {
a.GetBlockTime(), a.GetHeight(), index, dapp.ExecAddress(string(tx.Execer))} a.GetBlockTime(), a.GetHeight(), index, dapp.ExecAddress(string(tx.Execer))}
} }
func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) { func (a *action) getPropBoard(prob *auty.ProposalBoard) (*auty.ActiveBoard, error) {
if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height || mpBd, err := filterPropBoard(prob.Boards)
prob.StartBlockHeight+startEndBlockPeriod > prob.EndBlockHeight { if err != nil {
alog.Error("propBoard height invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight", return nil, err
prob.EndBlockHeight, "height", a.height)
return nil, auty.ErrSetBlockHeight
} }
if len(prob.Boards) == 0 {
alog.Error("propBoard ", "proposal boards number is zero", len(prob.Boards)) switch prob.BoardUpdate {
return nil, auty.ErrBoardNumber case auty.BoardUpdate_REPLACEALL:
return &auty.ActiveBoard{Boards: prob.Boards}, nil
case auty.BoardUpdate_ADDBoard:
return a.addPropBoard(prob, mpBd)
case auty.BoardUpdate_DELBoard:
return a.delPropBoard(prob, mpBd)
default:
return nil, errors.Wrapf(types.ErrInvalidParam, "board update param=%d", prob.BoardUpdate)
}
}
func (a *action) getOldPropBoard(prob *auty.ProposalBoard) (*auty.ActiveBoard, error) {
mpBd, err := filterPropBoard(prob.Boards)
if err != nil {
return nil, err
}
//replace all
if !prob.Update {
return &auty.ActiveBoard{
Boards: prob.Boards,
}, nil
} }
// only add member
return a.addPropBoard(prob, mpBd)
}
func filterPropBoard(boards []string) (map[string]struct{}, error) {
mpBd := make(map[string]struct{}) mpBd := make(map[string]struct{})
for _, board := range prob.Boards { for _, board := range boards {
if err := address.CheckAddress(board); err != nil { if err := address.CheckAddress(board); err != nil {
alog.Error("propBoard ", "addr", board, "check toAddr error", err) return nil, errors.Wrapf(types.ErrInvalidAddress, "addr=%s", board)
return nil, types.ErrInvalidAddress
} }
// 提案board重复地址去重复 // 提案board重复地址去重复
if _, ok := mpBd[board]; ok { if _, ok := mpBd[board]; ok {
err := auty.ErrRepeatAddr return nil, errors.Wrapf(auty.ErrRepeatAddr, "propBoard addr=%s repeated", board)
alog.Error("propBoard ", "addr", board, "propBoard have repeat addr ", err)
return nil, err
} }
mpBd[board] = struct{}{} mpBd[board] = struct{}{}
} }
return mpBd, nil
}
func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height ||
prob.StartBlockHeight+startEndBlockPeriod > prob.EndBlockHeight {
alog.Error("propBoard height invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight",
prob.EndBlockHeight, "height", a.height)
return nil, auty.ErrSetBlockHeight
}
if len(prob.Boards) == 0 {
alog.Error("propBoard ", "proposal boards number is zero", len(prob.Boards))
return nil, auty.ErrBoardNumber
}
var act *auty.ActiveBoard var act *auty.ActiveBoard
var err error var err error
if prob.Update { cfg := a.api.GetConfig()
act, err = a.getActiveBoard() if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if err != nil { act, err = a.getPropBoard(prob)
alog.Error("propBoard ", "addr", a.fromaddr, "execaddr", a.execaddr, "getActiveBoard failed", err)
return nil, err
}
for _, board := range act.Boards {
if _, ok := mpBd[board]; ok {
err := auty.ErrRepeatAddr
alog.Error("propBoard ", "addr", board, "propBoard update have repeat addr in boards", err)
return nil, err
}
}
for _, board := range act.Revboards {
if _, ok := mpBd[board]; ok {
err := auty.ErrRepeatAddr
alog.Error("propBoard ", "addr", board, "propBoard update have repeat addr in revboards ", err)
return nil, err
}
}
act.Boards = append(act.Boards, prob.Boards...)
} else { } else {
act = &auty.ActiveBoard{ act, err = a.getOldPropBoard(prob)
Boards: prob.Boards, }
} if err != nil {
return nil, errors.Wrap(err, "getPropBoard")
} }
if len(act.Boards) > maxBoards || len(act.Boards) < minBoards { if len(act.Boards) > maxBoards || len(act.Boards) < minBoards {
...@@ -224,8 +244,8 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -224,8 +244,8 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
start := cur.GetPropBoard().StartBlockHeight start := cur.GetPropBoard().StartBlockHeight
end := cur.GetPropBoard().EndBlockHeight end := cur.GetPropBoard().EndBlockHeight
real := cur.GetPropBoard().RealEndBlockHeight realHeight := cur.GetPropBoard().RealEndBlockHeight
if a.height < start || a.height > end || real != 0 { if a.height < start || a.height > end || realHeight != 0 {
err := auty.ErrVotePeriod err := auty.ErrVotePeriod
alog.Error("votePropBoard ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID", alog.Error("votePropBoard ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err) voteProb.ProposalID, "err", err)
...@@ -280,10 +300,27 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -280,10 +300,27 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
voteProb.ProposalID, "err", err) voteProb.ProposalID, "err", err)
return nil, err return nil, err
} }
if voteProb.Approve {
cur.VoteResult.ApproveVotes += vtCouts cfg := a.api.GetConfig()
//fork之后增加了弃权选项
if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
switch voteProb.VoteOption {
case auty.AutonomyVoteOption_APPROVE:
cur.VoteResult.ApproveVotes += vtCouts
case auty.AutonomyVoteOption_OPPOSE:
cur.VoteResult.OpposeVotes += vtCouts
case auty.AutonomyVoteOption_QUIT:
cur.VoteResult.QuitVotes += vtCouts
default:
return nil, errors.Wrapf(types.ErrInvalidParam, "vote option=%d", voteProb.VoteOption)
}
} else { } else {
cur.VoteResult.OpposeVotes += vtCouts if voteProb.Approve {
cur.VoteResult.ApproveVotes += vtCouts
} else {
cur.VoteResult.OpposeVotes += vtCouts
}
} }
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
...@@ -300,12 +337,20 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -300,12 +337,20 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
kv = append(kv, receipt.KV...) kv = append(kv, receipt.KV...)
} }
if cur.VoteResult.TotalVotes != 0 && if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes != 0 && if isApproved(cur.VoteResult.TotalVotes, cur.VoteResult.ApproveVotes, cur.VoteResult.OpposeVotes, cur.VoteResult.QuitVotes,
float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 && cur.CurRule.PubAttendRatio, cur.CurRule.PubApproveRatio) {
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 { cur.VoteResult.Pass = true
cur.VoteResult.Pass = true cur.PropBoard.RealEndBlockHeight = a.height
cur.PropBoard.RealEndBlockHeight = a.height }
} else {
if cur.VoteResult.TotalVotes != 0 &&
cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes != 0 &&
float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true
cur.PropBoard.RealEndBlockHeight = a.height
}
} }
key := propBoardID(voteProb.ProposalID) key := propBoardID(voteProb.ProposalID)
...@@ -320,8 +365,14 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -320,8 +365,14 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
// 更新当前具有权利的董事会成员 // 更新当前具有权利的董事会成员
if cur.VoteResult.Pass { if cur.VoteResult.Pass {
if !cur.PropBoard.Update { // 非update才进行高度重写 if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
cur.Board.StartHeight = a.height if cur.PropBoard.BoardUpdate == auty.BoardUpdate_REPLACEALL {
cur.Board.StartHeight = a.height
}
} else {
if !cur.PropBoard.Update { // 非update才进行高度重写
cur.Board.StartHeight = a.height
}
} }
kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value: types.Encode(cur.Board)}) kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value: types.Encode(cur.Board)})
} }
...@@ -336,6 +387,26 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -336,6 +387,26 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
//统计参与率的时候,计算弃权票,但是统计赞成率的时候,忽略弃权票。比如10票,4票赞成,3票反对,2票弃权,那么参与率是 90%, 赞成 4/7 反对 3/7
func isApproved(totalVotes, approveVotes, opposeVotes, quitVotes, attendRation, approveRatio int32) bool {
if attendRation <= 0 {
attendRation = pubAttendRatio
}
if approveRatio <= 0 {
approveRatio = pubApproveRatio
}
//参与率计算弃权票
attendVotes := approveVotes + opposeVotes + quitVotes
//赞成率,忽略弃权票
validVotes := approveVotes + opposeVotes
if totalVotes != 0 && attendVotes != 0 &&
attendVotes*100 > attendRation*totalVotes &&
approveVotes*100 > approveRatio*validVotes {
return true
}
return false
}
func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.Receipt, error) { func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.Receipt, error) {
cur, err := a.getProposalBoard(tmintProb.ProposalID) cur, err := a.getProposalBoard(tmintProb.ProposalID)
if err != nil { if err != nil {
...@@ -371,11 +442,16 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types. ...@@ -371,11 +442,16 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
cur.VoteResult.TotalVotes = vtCouts cur.VoteResult.TotalVotes = vtCouts
} }
if float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 && if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 { cur.VoteResult.Pass = isApproved(cur.VoteResult.TotalVotes, cur.VoteResult.ApproveVotes, cur.VoteResult.OpposeVotes, cur.VoteResult.QuitVotes,
cur.VoteResult.Pass = true cur.CurRule.PubAttendRatio, cur.CurRule.PubApproveRatio)
} else { } else {
cur.VoteResult.Pass = false if float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true
} else {
cur.VoteResult.Pass = false
}
} }
cur.PropBoard.RealEndBlockHeight = a.height cur.PropBoard.RealEndBlockHeight = a.height
...@@ -399,8 +475,14 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types. ...@@ -399,8 +475,14 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
// 更新当前具有权利的董事会成员 // 更新当前具有权利的董事会成员
if cur.VoteResult.Pass { if cur.VoteResult.Pass {
if !cur.PropBoard.Update { // 非update才进行高度重写 if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
cur.Board.StartHeight = a.height if cur.PropBoard.BoardUpdate == auty.BoardUpdate_REPLACEALL {
cur.Board.StartHeight = a.height
}
} else {
if !cur.PropBoard.Update { // 非update才进行高度重写
cur.Board.StartHeight = a.height
}
} }
kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value: types.Encode(cur.Board)}) kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value: types.Encode(cur.Board)})
} }
...@@ -416,11 +498,12 @@ func (a *action) getTotalVotes(height int64) (int32, error) { ...@@ -416,11 +498,12 @@ func (a *action) getTotalVotes(height int64) (int32, error) {
if subcfg.Total != "" { if subcfg.Total != "" {
addr = subcfg.Total addr = subcfg.Total
} }
account, err := a.getStartHeightVoteAccount(addr, "", height) voteAccount, err := a.getStartHeightVoteAccount(addr, "", height)
if err != nil { if err != nil {
return 0, err return 0, err
} }
return int32(account.Balance / (ticketPrice * a.api.GetConfig().GetCoinPrecision())), nil return int32(voteAccount.Balance / (ticketPrice * a.api.GetConfig().GetCoinPrecision())), nil
} }
func (a *action) verifyMinerAddr(addrs []string, bindAddr string) (string, error) { func (a *action) verifyMinerAddr(addrs []string, bindAddr string) (string, error) {
...@@ -457,13 +540,17 @@ func (a *action) batchGetAddressVotes(addrs []string, height int64) (int32, erro ...@@ -457,13 +540,17 @@ func (a *action) batchGetAddressVotes(addrs []string, height int64) (int32, erro
} }
func (a *action) getAddressVotes(addr string, height int64) (int32, error) { func (a *action) getAddressVotes(addr string, height int64) (int32, error) {
account, err := a.getStartHeightVoteAccount(addr, ticketName, height) execer := ticketName
if subcfg.Execer != "" {
execer = subcfg.Execer
}
voteAccount, err := a.getStartHeightVoteAccount(addr, execer, height)
if err != nil { if err != nil {
return 0, err return 0, err
} }
amount := account.Frozen amount := voteAccount.Frozen
if subcfg.UseBalance { if subcfg.UseBalance {
amount = account.Balance amount = voteAccount.Balance
} }
return int32(amount / (ticketPrice * a.api.GetConfig().GetCoinPrecision())), nil return int32(amount / (ticketPrice * a.api.GetConfig().GetCoinPrecision())), nil
} }
...@@ -481,16 +568,16 @@ func (a *action) getStartHeightVoteAccount(addr, execer string, height int64) (* ...@@ -481,16 +568,16 @@ func (a *action) getStartHeightVoteAccount(addr, execer string, height int64) (*
stateHash := common.ToHex(head.Items[0].StateHash) stateHash := common.ToHex(head.Items[0].StateHash)
account, err := a.coinsAccount.GetBalance(a.api, &types.ReqBalance{ accounts, err := a.coinsAccount.GetBalance(a.api, &types.ReqBalance{
Addresses: []string{addr}, Addresses: []string{addr},
Execer: execer, Execer: execer,
StateHash: stateHash, StateHash: stateHash,
}) })
if err != nil || len(account) == 0 { if err != nil || len(accounts) == 0 {
alog.Error("GetStartVoteAccount ", "addr", addr, "height", height, "GetBalance failed", err) alog.Error("GetStartVoteAccount ", "addr", addr, "height", height, "GetBalance failed", err)
return nil, err return nil, err
} }
return account[0], nil return accounts[0], nil
} }
func (a *action) getProposalBoard(ID string) (*auty.AutonomyProposalBoard, error) { func (a *action) getProposalBoard(ID string) (*auty.AutonomyProposalBoard, error) {
...@@ -507,21 +594,37 @@ func (a *action) getProposalBoard(ID string) (*auty.AutonomyProposalBoard, error ...@@ -507,21 +594,37 @@ func (a *action) getProposalBoard(ID string) (*auty.AutonomyProposalBoard, error
} }
func (a *action) getActiveRule() (*auty.RuleConfig, error) { func (a *action) getActiveRule() (*auty.RuleConfig, error) {
cfg := a.api.GetConfig()
// 获取当前生效提案规则,并且将不修改的规则补齐 // 获取当前生效提案规则,并且将不修改的规则补齐
rule := &auty.RuleConfig{} rule := &auty.RuleConfig{}
value, err := a.db.Get(activeRuleID()) value, err := a.db.Get(activeRuleID())
cfg := a.api.GetConfig()
if err == nil { if err == nil {
err = types.Decode(value, rule) err = types.Decode(value, rule)
if err != nil { if err != nil {
return nil, err return nil, err
} }
//在fork之前可能有修改了规则,但是这两个值没有修改到
if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if rule.PubApproveRatio <= 0 {
rule.PubApproveRatio = pubApproveRatio
}
if rule.PubAttendRatio <= 0 {
rule.PubAttendRatio = pubAttendRatio
}
}
} else { // 载入系统默认值 } else { // 载入系统默认值
rule.BoardApproveRatio = boardApproveRatio rule.BoardApproveRatio = boardApproveRatio
rule.PubOpposeRatio = pubOpposeRatio rule.PubOpposeRatio = pubOpposeRatio
rule.ProposalAmount = proposalAmount * cfg.GetCoinPrecision() rule.ProposalAmount = proposalAmount * cfg.GetCoinPrecision()
rule.LargeProjectAmount = largeProjectAmount * cfg.GetCoinPrecision() rule.LargeProjectAmount = largeProjectAmount * cfg.GetCoinPrecision()
rule.PublicPeriod = publicPeriod rule.PublicPeriod = publicPeriod
if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
rule.PubAttendRatio = pubAttendRatio
rule.PubApproveRatio = pubApproveRatio
}
} }
return rule, nil return rule, nil
} }
...@@ -550,6 +653,77 @@ func (a *action) checkVotesRecord(addrs []string, key []byte) (*auty.VotesRecord ...@@ -550,6 +653,77 @@ func (a *action) checkVotesRecord(addrs []string, key []byte) (*auty.VotesRecord
return &votes, nil return &votes, nil
} }
//新增addr场景,任一probAddr在当前board里即返回true
func checkAddrInBoard(act *auty.ActiveBoard, probAddrs map[string]struct{}) bool {
for _, board := range act.Boards {
if _, ok := probAddrs[board]; ok {
alog.Info("propBoard repeated addr in boards", "addr", board)
return true
}
}
for _, board := range act.Revboards {
if _, ok := probAddrs[board]; ok {
alog.Info("propBoard repeated addr in revboards", "addr", board)
return true
}
}
return false
}
func (a *action) addPropBoard(prob *auty.ProposalBoard, mpBd map[string]struct{}) (*auty.ActiveBoard, error) {
// only add member
act, err := a.getActiveBoard()
if err != nil {
alog.Error("propBoard ", "addr", a.fromaddr, "execaddr", a.execaddr, "getActiveBoard failed", err)
return nil, err
}
if checkAddrInBoard(act, mpBd) {
return nil, errors.Wrap(auty.ErrRepeatAddr, "repeated addr in current boards")
}
act.Boards = append(act.Boards, prob.Boards...)
return act, nil
}
//删除addr场景,若任一proposal addr不存在 则返回true,
func checkAddrNotInBoard(act *auty.ActiveBoard, prob *auty.ProposalBoard) error {
actBoards := make(map[string]bool)
for _, board := range act.Boards {
actBoards[board] = true
}
for _, addr := range prob.Boards {
if !actBoards[addr] {
return errors.Wrapf(types.ErrNotFound, "addr=%s not in boards", addr)
}
}
return nil
}
//这里只考虑Board,不考虑revBoard
func (a *action) delPropBoard(prob *auty.ProposalBoard, mpBd map[string]struct{}) (*auty.ActiveBoard, error) {
act, err := a.getActiveBoard()
if err != nil {
alog.Error("propBoard ", "addr", a.fromaddr, "execaddr", a.execaddr, "getActiveBoard failed", err)
return nil, err
}
err = checkAddrNotInBoard(act, prob)
if err != nil {
return nil, err
}
var newBoard []string
for _, board := range act.Boards {
if _, ok := mpBd[board]; !ok {
newBoard = append(newBoard, board)
}
}
act.Boards = newBoard
return act, nil
}
// getReceiptLog 根据提案信息获取log // getReceiptLog 根据提案信息获取log
// 状态变化: // 状态变化:
func getReceiptLog(pre, cur *auty.AutonomyProposalBoard, ty int32) *types.ReceiptLog { func getReceiptLog(pre, cur *auty.AutonomyProposalBoard, ty int32) *types.ReceiptLog {
......
...@@ -23,6 +23,7 @@ import ( ...@@ -23,6 +23,7 @@ import (
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
ticket "github.com/33cn/plugin/plugin/dapp/ticket/executor" ticket "github.com/33cn/plugin/plugin/dapp/ticket/executor"
ticketTy "github.com/33cn/plugin/plugin/dapp/ticket/types" ticketTy "github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
) )
...@@ -195,57 +196,96 @@ func TestPropBoard(t *testing.T) { ...@@ -195,57 +196,96 @@ func TestPropBoard(t *testing.T) {
opts := []*auty.ProposalBoard{ opts := []*auty.ProposalBoard{
{ // ErrRepeatAddr { // ErrRepeatAddr
Update: true, BoardUpdate: auty.BoardUpdate_ADDBoard,
Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", "18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"}, Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", "18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"},
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // ErrRepeatAddr { // ErrRepeatAddr
Update: true, BoardUpdate: auty.BoardUpdate_ADDBoard,
Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", AddrA}, Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", AddrA},
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // ErrBoardNumber { // ErrBoardNumber
Update: true, BoardUpdate: auty.BoardUpdate_ADDBoard,
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // 正常 { // 正常
Update: true, BoardUpdate: auty.BoardUpdate_ADDBoard,
Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"}, Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"},
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // ErrRepeatAddr { // ErrRepeatAddr
Update: false, BoardUpdate: auty.BoardUpdate_REPLACEALL,
Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", "18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"}, Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", "18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"},
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // ErrBoardNumber { // ErrBoardNumber
Update: false, BoardUpdate: auty.BoardUpdate_REPLACEALL,
Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", AddrA}, Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6", AddrA},
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // 正常 { // 正常
Update: false, BoardUpdate: auty.BoardUpdate_REPLACEALL,
Boards: boards, Boards: boards,
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // ErrNotFound
BoardUpdate: auty.BoardUpdate_DELBoard,
Boards: []string{"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"},
StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
},
{ // ErrNotFound
BoardUpdate: auty.BoardUpdate_DELBoard,
Boards: []string{Addr17, "18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"},
StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
},
{ // ErrBoardNumber
BoardUpdate: auty.BoardUpdate_DELBoard,
Boards: []string{Addr16, Addr17},
StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
},
{ // ErrRepeatAddr
BoardUpdate: auty.BoardUpdate_DELBoard,
Boards: []string{Addr17, Addr17},
StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
},
{ // 正常
BoardUpdate: auty.BoardUpdate_DELBoard,
Boards: []string{Addr17},
StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
},
} }
result := []error{ result := []error{
auty.ErrRepeatAddr, auty.ErrRepeatAddr,
auty.ErrRepeatAddr, auty.ErrRepeatAddr,
auty.ErrBoardNumber, auty.ErrBoardNumber,
nil, nil,
auty.ErrRepeatAddr, auty.ErrRepeatAddr,
auty.ErrBoardNumber, auty.ErrBoardNumber,
nil, nil,
types.ErrNotFound,
types.ErrNotFound,
auty.ErrBoardNumber,
auty.ErrRepeatAddr,
nil,
} }
lenBoards := []int{0, 0, 0, 22, 0, 0, 21, 0, 0, 0, 0, 20}
InitBoard(stateDB) InitBoard(stateDB)
exec.SetStateDB(stateDB) exec.SetStateDB(stateDB)
...@@ -255,8 +295,14 @@ func TestPropBoard(t *testing.T) { ...@@ -255,8 +295,14 @@ func TestPropBoard(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
pbtx, err = signTx(pbtx, PrivKeyA) pbtx, err = signTx(pbtx, PrivKeyA)
assert.NoError(t, err) assert.NoError(t, err)
_, err = exec.Exec(pbtx, i) receipt, err := exec.Exec(pbtx, i)
assert.Equal(t, err, result[i]) assert.Equal(t, errors.Cause(err), result[i])
if receipt != nil {
var stat auty.AutonomyProposalBoard
err := types.Decode(receipt.KV[1].Value, &stat)
assert.NoError(t, err)
assert.Equal(t, len(stat.Board.Boards), lenBoards[i])
}
} }
} }
...@@ -290,6 +336,7 @@ func testPropBoard(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm. ...@@ -290,6 +336,7 @@ func testPropBoard(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.
Month: 7, Month: 7,
Day: 10, Day: 10,
Boards: boards, Boards: boards,
BoardUpdate: auty.BoardUpdate_REPLACEALL,
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
} }
...@@ -423,19 +470,19 @@ func voteProposalBoard(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB ...@@ -423,19 +470,19 @@ func voteProposalBoard(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB
// 4人参与投票,3人赞成票,1人反对票 // 4人参与投票,3人赞成票,1人反对票
type record struct { type record struct {
priv string priv string
appr bool vote auty.AutonomyVoteOption
origin []string origin []string
} }
records := []record{ records := []record{
{priv: PrivKeyA, appr: false}, {priv: PrivKeyA, vote: auty.AutonomyVoteOption_OPPOSE},
{priv: PrivKey1, appr: true, origin: []string{AddrB, AddrC, AddrD}}, {priv: PrivKey1, vote: auty.AutonomyVoteOption_APPROVE, origin: []string{AddrB, AddrC, AddrD}},
} }
InitMinerAddr(stateDB, []string{AddrB, AddrC, AddrD}, Addr1) InitMinerAddr(stateDB, []string{AddrB, AddrC, AddrD}, Addr1)
for i, record := range records { for i, record := range records {
opt := &auty.VoteProposalBoard{ opt := &auty.VoteProposalBoard{
ProposalID: proposalID, ProposalID: proposalID,
Approve: record.appr, VoteOption: record.vote,
OriginAddr: record.origin, OriginAddr: record.origin,
} }
tx, err := voteProposalBoardTx(opt) tx, err := voteProposalBoardTx(opt)
......
...@@ -27,11 +27,11 @@ var boardOpt = &table.Option{ ...@@ -27,11 +27,11 @@ var boardOpt = &table.Option{
//NewBoardTable 新建表 //NewBoardTable 新建表
func NewBoardTable(kvdb db.KV) *table.Table { func NewBoardTable(kvdb db.KV) *table.Table {
rowmeta := NewBoardRow() rowmeta := NewBoardRow()
table, err := table.NewTable(rowmeta, kvdb, boardOpt) newTable, err := table.NewTable(rowmeta, kvdb, boardOpt)
if err != nil { if err != nil {
panic(err) panic(err)
} }
return table return newTable
} }
//BoardRow table meta 结构 //BoardRow table meta 结构
......
...@@ -8,8 +8,10 @@ import ( ...@@ -8,8 +8,10 @@ import (
"sort" "sort"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/pkg/errors"
) )
func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) { func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) {
...@@ -30,11 +32,21 @@ func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) { ...@@ -30,11 +32,21 @@ func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) {
alog.Error("propChange ", "addr", a.fromaddr, "execaddr", a.execaddr, "getActiveBoard failed", err) alog.Error("propChange ", "addr", a.fromaddr, "execaddr", a.execaddr, "getActiveBoard failed", err)
return nil, err return nil, err
} }
// 检查是否符合提案修改 // 检查是否符合提案修改
new, err := a.checkChangeable(act, prob.Changes) var newBoard *auty.ActiveBoard
if err != nil { if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
alog.Error("propChange ", "addr", a.fromaddr, "execaddr", a.execaddr, "checkChangeable failed", err) //替换成员方案
return nil, err newBoard, err = a.replaceBoard(act, prob.Changes)
if err != nil {
return nil, err
}
} else {
newBoard, err = a.checkChangeable(act, prob.Changes)
if err != nil {
alog.Error("propChange ", "addr", a.fromaddr, "execaddr", a.execaddr, "checkChangeable failed", err)
return nil, err
}
} }
// 获取当前生效提案规则,并且将不修改的规则补齐 // 获取当前生效提案规则,并且将不修改的规则补齐
...@@ -59,7 +71,7 @@ func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) { ...@@ -59,7 +71,7 @@ func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) {
cur := &auty.AutonomyProposalChange{ cur := &auty.AutonomyProposalChange{
PropChange: prob, PropChange: prob,
CurRule: rule, CurRule: rule,
Board: new, Board: newBoard,
VoteResult: &auty.VoteResult{TotalVotes: int32(len(act.Boards))}, VoteResult: &auty.VoteResult{TotalVotes: int32(len(act.Boards))},
Status: auty.AutonomyStatusProposalChange, Status: auty.AutonomyStatusProposalChange,
Address: a.fromaddr, Address: a.fromaddr,
...@@ -151,8 +163,8 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei ...@@ -151,8 +163,8 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei
start := cur.GetPropChange().StartBlockHeight start := cur.GetPropChange().StartBlockHeight
end := cur.GetPropChange().EndBlockHeight end := cur.GetPropChange().EndBlockHeight
real := cur.GetPropChange().RealEndBlockHeight realHeight := cur.GetPropChange().RealEndBlockHeight
if a.height < start || a.height > end || real != 0 { if a.height < start || a.height > end || realHeight != 0 {
err := auty.ErrVotePeriod err := auty.ErrVotePeriod
alog.Error("votePropChange ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID", alog.Error("votePropChange ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err) voteProb.ProposalID, "err", err)
...@@ -167,20 +179,32 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei ...@@ -167,20 +179,32 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei
return nil, err return nil, err
} }
// 董事会成员验证 cfg := a.api.GetConfig()
// 董事会成员验证,把剔除的原成员放回来
mpBd := make(map[string]struct{}) mpBd := make(map[string]struct{})
for _, b := range cur.Board.Boards { if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
mpBd[b] = struct{}{} for _, b := range cur.Board.Boards {
} if b == cur.PropChange.Changes[0].Addr {
for _, ch := range cur.PropChange.Changes { mpBd[cur.Address] = struct{}{}
if ch.Cancel { continue
mpBd[ch.Addr] = struct{}{} }
} else { mpBd[b] = struct{}{}
if _, ok := mpBd[ch.Addr]; ok { }
delete(mpBd, ch.Addr) } else {
for _, b := range cur.Board.Boards {
mpBd[b] = struct{}{}
}
for _, ch := range cur.PropChange.Changes {
if ch.Cancel {
mpBd[ch.Addr] = struct{}{}
} else {
if _, ok := mpBd[ch.Addr]; ok {
delete(mpBd, ch.Addr)
}
} }
} }
} }
if _, ok := mpBd[a.fromaddr]; !ok { if _, ok := mpBd[a.fromaddr]; !ok {
err = auty.ErrNoActiveBoard err = auty.ErrNoActiveBoard
alog.Error("votePropChange ", "addr", a.fromaddr, "this addr is not active board member", alog.Error("votePropChange ", "addr", a.fromaddr, "this addr is not active board member",
...@@ -191,10 +215,23 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei ...@@ -191,10 +215,23 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei
// 更新投票记录 // 更新投票记录
votes.Address = append(votes.Address, a.fromaddr) votes.Address = append(votes.Address, a.fromaddr)
if voteProb.Approve { if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
cur.VoteResult.ApproveVotes++ switch voteProb.Vote {
case auty.AutonomyVoteOption_APPROVE:
cur.VoteResult.ApproveVotes++
case auty.AutonomyVoteOption_OPPOSE:
cur.VoteResult.OpposeVotes++
case auty.AutonomyVoteOption_QUIT:
cur.VoteResult.QuitVotes++
default:
return nil, errors.Wrapf(types.ErrInvalidParam, "vote option=%d", voteProb.Vote)
}
} else { } else {
cur.VoteResult.OpposeVotes++ if voteProb.Approve {
cur.VoteResult.ApproveVotes++
} else {
cur.VoteResult.OpposeVotes++
}
} }
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
...@@ -319,6 +356,56 @@ func (a *action) getProposalChange(ID string) (*auty.AutonomyProposalChange, err ...@@ -319,6 +356,56 @@ func (a *action) getProposalChange(ID string) (*auty.AutonomyProposalChange, err
return cur, nil return cur, nil
} }
//新的方案只允许替换board里面的成员,而且是本用户申请,不允许从revBoard恢复
func (a *action) replaceBoard(act *auty.ActiveBoard, change []*auty.Change) (*auty.ActiveBoard, error) {
//一个成员只允许替换一个新的
if len(change) > 1 {
return nil, errors.Wrapf(types.ErrInvalidParam, "only allow one addr to be replaced,change=%d", len(change))
}
//只允许替换,不允许恢复操作
if !change[0].Cancel || len(change[0].Addr) <= 0 {
return nil, errors.Wrapf(types.ErrInvalidParam, "cancel=false not allow to addr=%s", change[0].Addr)
}
if err := address.CheckAddress(change[0].Addr); err != nil {
return nil, err
}
mpBd := make(map[string]struct{})
mpRbd := make(map[string]struct{})
for _, b := range act.Boards {
mpBd[b] = struct{}{}
}
for _, b := range act.Revboards {
mpRbd[b] = struct{}{}
}
//发起者必须是董事会成员
if _, ok := mpBd[a.fromaddr]; !ok {
return nil, errors.Wrap(types.ErrNotAllow, "from addr should be in boards")
}
//待替换地址不能在board和revBoard里面
if _, ok := mpBd[change[0].Addr]; ok {
return nil, errors.Wrapf(types.ErrNotAllow, "new addr=%s in boards", change[0].Addr)
}
if _, ok := mpRbd[change[0].Addr]; ok {
return nil, errors.Wrapf(types.ErrNotAllow, "new addr=%s in rev boards", change[0].Addr)
}
//替换board
for i, k := range act.Boards {
if k == a.fromaddr {
act.Boards[i] = change[0].Addr
break
}
}
//当前地址追加到revBoards
act.Revboards = append(act.Revboards, a.fromaddr)
return act, nil
}
func (a *action) checkChangeable(act *auty.ActiveBoard, change []*auty.Change) (*auty.ActiveBoard, error) { func (a *action) checkChangeable(act *auty.ActiveBoard, change []*auty.Change) (*auty.ActiveBoard, error) {
mpBd := make(map[string]struct{}) mpBd := make(map[string]struct{})
mpRbd := make(map[string]struct{}) mpRbd := make(map[string]struct{})
...@@ -348,19 +435,19 @@ func (a *action) checkChangeable(act *auty.ActiveBoard, change []*auty.Change) ( ...@@ -348,19 +435,19 @@ func (a *action) checkChangeable(act *auty.ActiveBoard, change []*auty.Change) (
if len(mpBd) > maxBoards || len(mpBd) < minBoards { if len(mpBd) > maxBoards || len(mpBd) < minBoards {
return nil, auty.ErrBoardNumber return nil, auty.ErrBoardNumber
} }
new := &auty.ActiveBoard{ newBoard := &auty.ActiveBoard{
Amount: act.Amount, Amount: act.Amount,
StartHeight: act.StartHeight, StartHeight: act.StartHeight,
} }
for k := range mpBd { for k := range mpBd {
new.Boards = append(new.Boards, k) newBoard.Boards = append(newBoard.Boards, k)
} }
sort.Strings(new.Boards) sort.Strings(newBoard.Boards)
for k := range mpRbd { for k := range mpRbd {
new.Revboards = append(new.Revboards, k) newBoard.Revboards = append(newBoard.Revboards, k)
} }
sort.Strings(new.Revboards) sort.Strings(newBoard.Revboards)
return new, nil return newBoard, nil
} }
// getReceiptLog 根据提案信息获取log // getReceiptLog 根据提案信息获取log
......
...@@ -7,6 +7,8 @@ package executor ...@@ -7,6 +7,8 @@ package executor
import ( import (
"testing" "testing"
"github.com/33cn/chain33/util"
"github.com/33cn/chain33/account" "github.com/33cn/chain33/account"
apimock "github.com/33cn/chain33/client/mocks" apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
...@@ -76,7 +78,7 @@ func testPropChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm ...@@ -76,7 +78,7 @@ func testPropChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm
Year: 2019, Year: 2019,
Month: 7, Month: 7,
Day: 10, Day: 10,
Changes: []*auty.Change{{Cancel: true, Addr: AddrA}, {Cancel: false, Addr: Addr18}}, Changes: []*auty.Change{{Cancel: true, Addr: Addr19}},
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
} }
...@@ -86,24 +88,24 @@ func testPropChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm ...@@ -86,24 +88,24 @@ func testPropChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(pbtx, int(1)) receipt, err := exec.Exec(pbtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
// local // local
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(pbtx, receiptData, int(1)) set, err := exec.ExecLocal(pbtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
...@@ -115,8 +117,8 @@ func testPropChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm ...@@ -115,8 +117,8 @@ func testPropChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Frozen) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Frozen)
} }
func propChangeTx(parm *auty.ProposalChange) (*types.Transaction, error) { func propChangeTx(parm *auty.ProposalChange) (*types.Transaction, error) {
...@@ -140,33 +142,33 @@ func revokeProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, state ...@@ -140,33 +142,33 @@ func revokeProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, state
rtx, err = signTx(rtx, PrivKeyA) rtx, err = signTx(rtx, PrivKeyA)
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(rtx, int(1)) receipt, err := exec.Exec(rtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(rtx, receiptData, int(1)) set, err := exec.ExecLocal(rtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(rtx, receiptData, int(1)) set, err = exec.ExecDelLocal(rtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
} }
func revokeProposalChangeTx(parm *auty.RevokeProposalChange) (*types.Transaction, error) { func revokeProposalChangeTx(parm *auty.RevokeProposalChange) (*types.Transaction, error) {
...@@ -182,6 +184,7 @@ func revokeProposalChangeTx(parm *auty.RevokeProposalChange) (*types.Transaction ...@@ -182,6 +184,7 @@ func revokeProposalChangeTx(parm *auty.RevokeProposalChange) (*types.Transaction
func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
api := new(apimock.QueueProtocolAPI) api := new(apimock.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(chainTestCfg, nil)
api.On("StoreList", mock.Anything).Return(&types.StoreListReply{}, nil) api.On("StoreList", mock.Anything).Return(&types.StoreListReply{}, nil)
api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil) api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil)
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
...@@ -233,7 +236,11 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB ...@@ -233,7 +236,11 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB
for _, record := range records { for _, record := range records {
opt := &auty.VoteProposalChange{ opt := &auty.VoteProposalChange{
ProposalID: proposalID, ProposalID: proposalID,
Approve: record.appr, }
if record.appr {
opt.Vote = auty.AutonomyVoteOption_APPROVE
} else {
opt.Vote = auty.AutonomyVoteOption_OPPOSE
} }
tx, err := voteProposalChangeTx(opt) tx, err := voteProposalChangeTx(opt)
assert.NoError(t, err) assert.NoError(t, err)
...@@ -242,25 +249,25 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB ...@@ -242,25 +249,25 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB
// 设定当前高度为投票高度 // 设定当前高度为投票高度
exec.SetEnv(env.startHeight, env.blockTime, env.difficulty) exec.SetEnv(env.startHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
...@@ -278,10 +285,10 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB ...@@ -278,10 +285,10 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB
// balance // balance
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Balance) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Balance)
// status // status
value, err := stateDB.Get(propChangeID(proposalID)) value, err := stateDB.Get(propChangeID(proposalID))
assert.NoError(t, err) assert.NoError(t, err)
...@@ -297,12 +304,13 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB ...@@ -297,12 +304,13 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB
act := &auty.ActiveBoard{} act := &auty.ActiveBoard{}
err = types.Decode(value, act) err = types.Decode(value, act)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, act.Revboards[0], AddrA) assert.Equal(t, act.Revboards[0], Addr18)
assert.Equal(t, len(act.Boards), len(boards)) assert.Equal(t, len(act.Boards), len(boards))
} }
func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
api := new(apimock.QueueProtocolAPI) api := new(apimock.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(chainTestCfg, nil)
api.On("StoreList", mock.Anything).Return(&types.StoreListReply{}, nil) api.On("StoreList", mock.Anything).Return(&types.StoreListReply{}, nil)
api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil) api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil)
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
...@@ -356,7 +364,11 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st ...@@ -356,7 +364,11 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st
for i, record := range records { for i, record := range records {
opt := &auty.VoteProposalChange{ opt := &auty.VoteProposalChange{
ProposalID: proposalID, ProposalID: proposalID,
Approve: record.appr, }
if record.appr {
opt.Vote = auty.AutonomyVoteOption_APPROVE
} else {
opt.Vote = auty.AutonomyVoteOption_OPPOSE
} }
tx, err := voteProposalChangeTx(opt) tx, err := voteProposalChangeTx(opt)
assert.NoError(t, err) assert.NoError(t, err)
...@@ -365,7 +377,7 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st ...@@ -365,7 +377,7 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st
// 设定当前高度为投票高度 // 设定当前高度为投票高度
exec.SetEnv(env.startHeight, env.blockTime, env.difficulty) exec.SetEnv(env.startHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
if i < 2 { if i < 2 {
assert.Equal(t, err, auty.ErrNoActiveBoard) assert.Equal(t, err, auty.ErrNoActiveBoard)
} else { } else {
...@@ -373,20 +385,20 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st ...@@ -373,20 +385,20 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
...@@ -405,10 +417,10 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st ...@@ -405,10 +417,10 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st
// balance // balance
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Balance) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Balance)
// status // status
value, err := stateDB.Get(propChangeID(proposalID)) value, err := stateDB.Get(propChangeID(proposalID))
assert.NoError(t, err) assert.NoError(t, err)
...@@ -424,7 +436,7 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st ...@@ -424,7 +436,7 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st
act := &auty.ActiveBoard{} act := &auty.ActiveBoard{}
err = types.Decode(value, act) err = types.Decode(value, act)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, act.Revboards[0], AddrA) assert.Equal(t, act.Revboards[0], Addr18)
assert.Equal(t, len(act.Boards), len(boards)) assert.Equal(t, len(act.Boards), len(boards))
} }
...@@ -465,35 +477,35 @@ func terminateProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st ...@@ -465,35 +477,35 @@ func terminateProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st
tx, err = signTx(tx, PrivKeyA) tx, err = signTx(tx, PrivKeyA)
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.endHeight+1, env.blockTime, env.difficulty) exec.SetEnv(env.endHeight+1, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
} }
func terminateProposalChangeTx(parm *auty.TerminateProposalChange) (*types.Transaction, error) { func terminateProposalChangeTx(parm *auty.TerminateProposalChange) (*types.Transaction, error) {
...@@ -577,6 +589,43 @@ func TestCheckChangeable(t *testing.T) { ...@@ -577,6 +589,43 @@ func TestCheckChangeable(t *testing.T) {
assert.Equal(t, err, auty.ErrChangeBoardAddr) assert.Equal(t, err, auty.ErrChangeBoardAddr)
} }
func TestReplaceBoard(t *testing.T) {
at := newTestAutonomy()
signer := util.HexToPrivkey(PrivKey17)
tx := &types.Transaction{}
tx.Sign(types.SECP256K1, signer)
action := newAction(at, tx, 0)
act := &auty.ActiveBoard{
Boards: boards,
}
// 一个成员只允许替换一个新的
changes := []*auty.Change{
{Cancel: true, Addr: Addr18},
{Cancel: true, Addr: Addr19},
}
_, err := action.replaceBoard(act, changes)
assert.ErrorIs(t, err, types.ErrInvalidParam)
// 只允许替换,不允许恢复操作
changes = []*auty.Change{{Cancel: false, Addr: Addr18}}
_, err = action.replaceBoard(act, changes)
assert.ErrorIs(t, err, types.ErrInvalidParam)
// 替换一个不存在地址
changes = []*auty.Change{{Cancel: true, Addr: "0x1111111111"}}
_, err = action.replaceBoard(act, changes)
assert.NotNil(t, err)
// 正常替换一个地址
changes = []*auty.Change{{Cancel: true, Addr: Addr18}}
cur, err := action.replaceBoard(act, changes)
assert.NoError(t, err)
assert.Equal(t, cur.Boards[20], Addr18)
assert.Equal(t, cur.Revboards[0], Addr17)
}
func TestCopyAutonomyProposalChange(t *testing.T) { func TestCopyAutonomyProposalChange(t *testing.T) {
assert.Nil(t, copyAutonomyProposalChange(nil)) assert.Nil(t, copyAutonomyProposalChange(nil))
cur := &auty.AutonomyProposalChange{ cur := &auty.AutonomyProposalChange{
......
...@@ -27,11 +27,11 @@ var changeOpt = &table.Option{ ...@@ -27,11 +27,11 @@ var changeOpt = &table.Option{
//NewChangeTable 新建表 //NewChangeTable 新建表
func NewChangeTable(kvdb db.KV) *table.Table { func NewChangeTable(kvdb db.KV) *table.Table {
rowmeta := NewChangeRow() rowmeta := NewChangeRow()
table, err := table.NewTable(rowmeta, kvdb, changeOpt) newTable, err := table.NewTable(rowmeta, kvdb, changeOpt)
if err != nil { if err != nil {
panic(err) panic(err)
} }
return table return newTable
} }
//ChangeRow table meta 结构 //ChangeRow table meta 结构
......
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/pkg/errors"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
) )
...@@ -184,8 +185,8 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec ...@@ -184,8 +185,8 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
start := cur.GetPropProject().StartBlockHeight start := cur.GetPropProject().StartBlockHeight
end := cur.GetPropProject().EndBlockHeight end := cur.GetPropProject().EndBlockHeight
real := cur.GetPropProject().RealEndBlockHeight realHeight := cur.GetPropProject().RealEndBlockHeight
if a.height < start || a.height > end || real != 0 { if a.height < start || a.height > end || realHeight != 0 {
err := auty.ErrVotePeriod err := auty.ErrVotePeriod
alog.Error("votePropProject ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID", alog.Error("votePropProject ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err) voteProb.ProposalID, "err", err)
...@@ -217,11 +218,25 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec ...@@ -217,11 +218,25 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
// 更新已经投票地址 // 更新已经投票地址
votes.Address = append(votes.Address, a.fromaddr) votes.Address = append(votes.Address, a.fromaddr)
// 更新投票结果 // 更新投票结果
if voteProb.Approve { if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
cur.BoardVoteRes.ApproveVotes++ 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)
}
} else { } else {
cur.BoardVoteRes.OpposeVotes++ if voteProb.Approve {
cur.BoardVoteRes.ApproveVotes++
} else {
cur.BoardVoteRes.OpposeVotes++
}
} }
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
......
...@@ -20,8 +20,8 @@ import ( ...@@ -20,8 +20,8 @@ import (
) )
const ( const (
testProjectAmount int64 = types.DefaultCoinPrecision * 100 // 工程需要资金 testProjectAmount = types.DefaultCoinPrecision * 100 // 工程需要资金
testFundAmount int64 = types.DefaultCoinPrecision * 1000 // 工程需要资金 testFundAmount = types.DefaultCoinPrecision * 1000 // 工程需要资金
) )
func InitBoard(stateDB dbm.KV) { func InitBoard(stateDB dbm.KV) {
...@@ -29,7 +29,7 @@ func InitBoard(stateDB dbm.KV) { ...@@ -29,7 +29,7 @@ func InitBoard(stateDB dbm.KV) {
act := &auty.ActiveBoard{ act := &auty.ActiveBoard{
Boards: boards, Boards: boards,
} }
stateDB.Set(activeBoardID(), types.Encode(act)) _ = stateDB.Set(activeBoardID(), types.Encode(act))
} }
func InitRule(stateDB dbm.KV) { func InitRule(stateDB dbm.KV) {
...@@ -41,7 +41,7 @@ func InitRule(stateDB dbm.KV) { ...@@ -41,7 +41,7 @@ func InitRule(stateDB dbm.KV) {
LargeProjectAmount: 100 * types.DefaultCoinPrecision, LargeProjectAmount: 100 * types.DefaultCoinPrecision,
PublicPeriod: publicPeriod, PublicPeriod: publicPeriod,
} }
stateDB.Set(activeRuleID(), types.Encode(rule)) _ = stateDB.Set(activeRuleID(), types.Encode(rule))
} }
func InitFund(stateDB dbm.KV, amount int64) { func InitFund(stateDB dbm.KV, amount int64) {
...@@ -175,7 +175,7 @@ func TestBoardPeriodAmount(t *testing.T) { ...@@ -175,7 +175,7 @@ func TestBoardPeriodAmount(t *testing.T) {
Amount: maxBoardPeriodAmount*types.DefaultCoinPrecision - 100, Amount: maxBoardPeriodAmount*types.DefaultCoinPrecision - 100,
StartHeight: 10, StartHeight: 10,
} }
stateDB.Set(activeBoardID(), types.Encode(act)) _ = stateDB.Set(activeBoardID(), types.Encode(act))
opt1 := &auty.ProposalProject{ opt1 := &auty.ProposalProject{
Year: 2019, Year: 2019,
...@@ -192,19 +192,19 @@ func TestBoardPeriodAmount(t *testing.T) { ...@@ -192,19 +192,19 @@ func TestBoardPeriodAmount(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight+boardPeriod+1, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight+boardPeriod+1, env.blockTime, env.difficulty)
receipt, err := exec.Exec(pbtx, int(1)) receipt, err := exec.Exec(pbtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
// check // check
value, err := stateDB.Get(activeBoardID()) value, err := stateDB.Get(activeBoardID())
assert.NoError(t, err) assert.NoError(t, err)
nact := &auty.ActiveBoard{} nact := &auty.ActiveBoard{}
types.Decode(value, nact) _ = types.Decode(value, nact)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, int64(0), nact.Amount) assert.Equal(t, int64(0), nact.Amount)
} }
...@@ -225,23 +225,23 @@ func testPropProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB db ...@@ -225,23 +225,23 @@ func testPropProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB db
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(pbtx, int(1)) receipt, err := exec.Exec(pbtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(pbtx, receiptData, int(1)) set, err := exec.ExecLocal(pbtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
...@@ -253,8 +253,8 @@ func testPropProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB db ...@@ -253,8 +253,8 @@ func testPropProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB db
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Frozen) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Frozen)
} }
func propProjectTx(parm *auty.ProposalProject) (*types.Transaction, error) { func propProjectTx(parm *auty.ProposalProject) (*types.Transaction, error) {
...@@ -278,34 +278,34 @@ func revokeProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stat ...@@ -278,34 +278,34 @@ func revokeProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stat
rtx, err = signTx(rtx, PrivKeyA) rtx, err = signTx(rtx, PrivKeyA)
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(rtx, int(1)) receipt, err := exec.Exec(rtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(rtx, receiptData, int(1)) set, err := exec.ExecLocal(rtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(rtx, receiptData, int(1)) set, err = exec.ExecDelLocal(rtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
} }
func revokeProposalProjectTx(parm *auty.RevokeProposalProject) (*types.Transaction, error) { func revokeProposalProjectTx(parm *auty.RevokeProposalProject) (*types.Transaction, error) {
...@@ -321,6 +321,7 @@ func revokeProposalProjectTx(parm *auty.RevokeProposalProject) (*types.Transacti ...@@ -321,6 +321,7 @@ func revokeProposalProjectTx(parm *auty.RevokeProposalProject) (*types.Transacti
func voteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func voteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
api := new(apimock.QueueProtocolAPI) api := new(apimock.QueueProtocolAPI)
api.On("GetConfig", mock.Anything).Return(chainTestCfg, nil)
api.On("StoreList", mock.Anything).Return(&types.StoreListReply{}, nil) api.On("StoreList", mock.Anything).Return(&types.StoreListReply{}, nil)
api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil) api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil)
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
...@@ -371,7 +372,11 @@ func voteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateD ...@@ -371,7 +372,11 @@ func voteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateD
for _, record := range records { for _, record := range records {
opt := &auty.VoteProposalProject{ opt := &auty.VoteProposalProject{
ProposalID: proposalID, ProposalID: proposalID,
Approve: record.appr, }
if record.appr {
opt.Vote = auty.AutonomyVoteOption_APPROVE
} else {
opt.Vote = auty.AutonomyVoteOption_OPPOSE
} }
tx, err := voteProposalProjectTx(opt) tx, err := voteProposalProjectTx(opt)
assert.NoError(t, err) assert.NoError(t, err)
...@@ -380,25 +385,25 @@ func voteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateD ...@@ -380,25 +385,25 @@ func voteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateD
// 设定当前高度为投票高度 // 设定当前高度为投票高度
exec.SetEnv(env.startHeight, env.blockTime, env.difficulty) exec.SetEnv(env.startHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
...@@ -438,12 +443,12 @@ func checkVoteProposalProjectResult(t *testing.T, stateDB dbm.KV, proposalID str ...@@ -438,12 +443,12 @@ func checkVoteProposalProjectResult(t *testing.T, stateDB dbm.KV, proposalID str
// balance // balance
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Balance) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Balance)
account = accCoin.LoadExecAccount(AddrD, autonomyAddr) accountAddr = accCoin.LoadExecAccount(AddrD, autonomyAddr)
assert.Equal(t, testProjectAmount, account.Balance) assert.Equal(t, testProjectAmount, accountAddr.Balance)
// 更新董事会累计审批金 // 更新董事会累计审批金
value, err = stateDB.Get(activeBoardID()) value, err = stateDB.Get(activeBoardID())
assert.NoError(t, err) assert.NoError(t, err)
...@@ -505,25 +510,25 @@ func pubVoteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, sta ...@@ -505,25 +510,25 @@ func pubVoteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, sta
// 设定当前高度为投票高度 // 设定当前高度为投票高度
exec.SetEnv(env.startHeight, env.blockTime, env.difficulty) exec.SetEnv(env.startHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
...@@ -556,12 +561,12 @@ func checkPubVoteProposalProjectResult(t *testing.T, stateDB dbm.KV, proposalID ...@@ -556,12 +561,12 @@ func checkPubVoteProposalProjectResult(t *testing.T, stateDB dbm.KV, proposalID
// balance // balance
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
account = accCoin.LoadExecAccount(AddrD, autonomyAddr) accountAddr = accCoin.LoadExecAccount(AddrD, autonomyAddr)
assert.Equal(t, int64(0), account.Balance) assert.Equal(t, int64(0), accountAddr.Balance)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Balance) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Balance)
// 更新董事会累计审批金 // 更新董事会累计审批金
value, err = stateDB.Get(activeBoardID()) value, err = stateDB.Get(activeBoardID())
...@@ -610,33 +615,33 @@ func terminateProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, s ...@@ -610,33 +615,33 @@ func terminateProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, s
tx, err = signTx(tx, PrivKeyA) tx, err = signTx(tx, PrivKeyA)
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.endHeight+1, env.blockTime, env.difficulty) exec.SetEnv(env.endHeight+1, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
} }
func terminateProposalProjectTx(parm *auty.TerminateProposalProject) (*types.Transaction, error) { func terminateProposalProjectTx(parm *auty.TerminateProposalProject) (*types.Transaction, error) {
......
...@@ -27,11 +27,11 @@ var projectOpt = &table.Option{ ...@@ -27,11 +27,11 @@ var projectOpt = &table.Option{
//NewProjectTable 新建表 //NewProjectTable 新建表
func NewProjectTable(kvdb db.KV) *table.Table { func NewProjectTable(kvdb db.KV) *table.Table {
rowmeta := NewProjectRow() rowmeta := NewProjectRow()
table, err := table.NewTable(rowmeta, kvdb, projectOpt) newTable, err := table.NewTable(rowmeta, kvdb, projectOpt)
if err != nil { if err != nil {
panic(err) panic(err)
} }
return table return newTable
} }
//ProjectRow table meta 结构 //ProjectRow table meta 结构
......
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/pkg/errors"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/system/dapp"
...@@ -18,10 +19,24 @@ const ( ...@@ -18,10 +19,24 @@ const (
minBoardApproveRatio = 50 minBoardApproveRatio = 50
// 最大董事会赞成率 // 最大董事会赞成率
maxBoardApproveRatio = 66 maxBoardApproveRatio = 66
// 最小全体持票人否决率 // 最小全体持票人否决率
minPubOpposeRatio = 33 minPubOpposeRatio = 33
// 最大全体持票人否决率 // 最大全体持票人否决率
maxPubOpposeRatio = 50 maxPubOpposeRatio = 50
// 可以调整,但是可能需要进行范围的限制:参与率最低设置为 50%, 最高设置为 80%,赞成率,最低 50.1%,最高80% ??? 最低 50.1% ????
//不能设置太低和太高,太低就容易作弊,太高则有可能很难达到
// 最小全体持票人参与率
minPubAttendRatio = 50
// 最大全体持票人参与率
maxPubAttendRatio = 80
// 最小全体持票人赞成率
minPubApproveRatio = 50
// 最大全体持票人赞成率
maxPubApproveRatio = 80
// 最小公示周期 // 最小公示周期
minPublicPeriod int32 = 17280 * 7 minPublicPeriod int32 = 17280 * 7
// 最大公示周期 // 最大公示周期
...@@ -36,19 +51,27 @@ const ( ...@@ -36,19 +51,27 @@ const (
maxProposalAmount = 2000 maxProposalAmount = 2000
) )
func checkParaInvalid(param, min, max int64) bool {
if param > max || param < min {
return true
}
return false
}
func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) { func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
cfg := a.api.GetConfig() cfg := a.api.GetConfig()
//如果全小于等于0,则说明该提案规则参数不正确 //如果全小于等于0,则说明该提案规则参数不正确
if prob.RuleCfg == nil || prob.RuleCfg.BoardApproveRatio <= 0 && prob.RuleCfg.PubOpposeRatio <= 0 && if prob.RuleCfg == nil {
prob.RuleCfg.ProposalAmount <= 0 && prob.RuleCfg.LargeProjectAmount <= 0 && prob.RuleCfg.PublicPeriod <= 0 {
alog.Error("propRule ", "ProposalRule RuleCfg invaild or have no modify param", prob.RuleCfg) alog.Error("propRule ", "ProposalRule RuleCfg invaild or have no modify param", prob.RuleCfg)
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
if (prob.RuleCfg.BoardApproveRatio > 0 && (prob.RuleCfg.BoardApproveRatio > maxBoardApproveRatio || prob.RuleCfg.BoardApproveRatio < minBoardApproveRatio)) || if checkParaInvalid(int64(prob.RuleCfg.BoardApproveRatio), minBoardApproveRatio, maxBoardApproveRatio) ||
(prob.RuleCfg.PubOpposeRatio > 0 && (prob.RuleCfg.PubOpposeRatio > maxPubOpposeRatio || prob.RuleCfg.PubOpposeRatio < minPubOpposeRatio)) || checkParaInvalid(int64(prob.RuleCfg.PubOpposeRatio), minPubOpposeRatio, maxPubOpposeRatio) ||
(prob.RuleCfg.PublicPeriod > 0 && (prob.RuleCfg.PublicPeriod > maxPublicPeriod || prob.RuleCfg.PublicPeriod < minPublicPeriod)) || checkParaInvalid(int64(prob.RuleCfg.PublicPeriod), int64(minPublicPeriod), int64(maxPublicPeriod)) ||
(prob.RuleCfg.LargeProjectAmount > 0 && (prob.RuleCfg.LargeProjectAmount > maxLargeProjectAmount*cfg.GetCoinPrecision() || prob.RuleCfg.LargeProjectAmount < minLargeProjectAmount*cfg.GetCoinPrecision())) || checkParaInvalid(prob.RuleCfg.LargeProjectAmount, minLargeProjectAmount*cfg.GetCoinPrecision(), maxLargeProjectAmount*cfg.GetCoinPrecision()) ||
(prob.RuleCfg.ProposalAmount > 0 && (prob.RuleCfg.ProposalAmount > maxProposalAmount*cfg.GetCoinPrecision() || prob.RuleCfg.ProposalAmount < minProposalAmount*cfg.GetCoinPrecision())) { checkParaInvalid(prob.RuleCfg.ProposalAmount, minProposalAmount*cfg.GetCoinPrecision(), maxProposalAmount*cfg.GetCoinPrecision()) ||
checkParaInvalid(int64(prob.RuleCfg.PubAttendRatio), minPubAttendRatio, maxPubAttendRatio) ||
checkParaInvalid(int64(prob.RuleCfg.PubApproveRatio), minPubApproveRatio, maxPubApproveRatio) {
alog.Error("propRule RuleCfg invaild", "ruleCfg", prob.RuleCfg) alog.Error("propRule RuleCfg invaild", "ruleCfg", prob.RuleCfg)
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
...@@ -173,8 +196,8 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt, ...@@ -173,8 +196,8 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
start := cur.GetPropRule().StartBlockHeight start := cur.GetPropRule().StartBlockHeight
end := cur.GetPropRule().EndBlockHeight end := cur.GetPropRule().EndBlockHeight
real := cur.GetPropRule().RealEndBlockHeight realHeight := cur.GetPropRule().RealEndBlockHeight
if a.height < start || a.height > end || real != 0 { if a.height < start || a.height > end || realHeight != 0 {
err := auty.ErrVotePeriod err := auty.ErrVotePeriod
alog.Error("votePropRule ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID", alog.Error("votePropRule ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err) voteProb.ProposalID, "err", err)
...@@ -230,10 +253,24 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt, ...@@ -230,10 +253,24 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
voteProb.ProposalID, "err", err) voteProb.ProposalID, "err", err)
return nil, err return nil, err
} }
if voteProb.Approve { cfg := a.api.GetConfig()
cur.VoteResult.ApproveVotes += vtCouts if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
switch voteProb.Vote {
case auty.AutonomyVoteOption_APPROVE:
cur.VoteResult.ApproveVotes += vtCouts
case auty.AutonomyVoteOption_OPPOSE:
cur.VoteResult.OpposeVotes += vtCouts
case auty.AutonomyVoteOption_QUIT:
cur.VoteResult.QuitVotes += vtCouts
default:
return nil, errors.Wrapf(types.ErrInvalidParam, "wrong vote value=%d", voteProb.Vote)
}
} else { } else {
cur.VoteResult.OpposeVotes += vtCouts if voteProb.Approve {
cur.VoteResult.ApproveVotes += vtCouts
} else {
cur.VoteResult.OpposeVotes += vtCouts
}
} }
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
...@@ -250,12 +287,20 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt, ...@@ -250,12 +287,20 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
kv = append(kv, receipt.KV...) kv = append(kv, receipt.KV...)
} }
if cur.VoteResult.TotalVotes != 0 && if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes != 0 && if isApproved(cur.VoteResult.TotalVotes, cur.VoteResult.ApproveVotes, cur.VoteResult.OpposeVotes, cur.VoteResult.QuitVotes,
float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 && cur.CurRule.PubAttendRatio, cur.CurRule.PubApproveRatio) {
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 { cur.VoteResult.Pass = true
cur.VoteResult.Pass = true cur.PropRule.RealEndBlockHeight = a.height
cur.PropRule.RealEndBlockHeight = a.height }
} else {
if cur.VoteResult.TotalVotes != 0 &&
cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes != 0 &&
float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true
cur.PropRule.RealEndBlockHeight = a.height
}
} }
key := propRuleID(voteProb.ProposalID) key := propRuleID(voteProb.ProposalID)
...@@ -320,11 +365,16 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re ...@@ -320,11 +365,16 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
cur.VoteResult.TotalVotes = vtCouts cur.VoteResult.TotalVotes = vtCouts
} }
if float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 && if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 { cur.VoteResult.Pass = isApproved(cur.VoteResult.TotalVotes, cur.VoteResult.ApproveVotes, cur.VoteResult.OpposeVotes, cur.VoteResult.QuitVotes,
cur.VoteResult.Pass = true cur.CurRule.PubAttendRatio, cur.CurRule.PubApproveRatio)
} else { } else {
cur.VoteResult.Pass = false if float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) > float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) > float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true
} else {
cur.VoteResult.Pass = false
}
} }
cur.PropRule.RealEndBlockHeight = a.height cur.PropRule.RealEndBlockHeight = a.height
...@@ -450,21 +500,28 @@ func upgradeRule(cur, modify *auty.RuleConfig) *auty.RuleConfig { ...@@ -450,21 +500,28 @@ func upgradeRule(cur, modify *auty.RuleConfig) *auty.RuleConfig {
if cur == nil || modify == nil { if cur == nil || modify == nil {
return nil return nil
} }
new := *cur newConfig := *cur
if modify.BoardApproveRatio > 0 { if modify.BoardApproveRatio > 0 {
new.BoardApproveRatio = modify.BoardApproveRatio newConfig.BoardApproveRatio = modify.BoardApproveRatio
} }
if modify.PubOpposeRatio > 0 { if modify.PubOpposeRatio > 0 {
new.PubOpposeRatio = modify.PubOpposeRatio newConfig.PubOpposeRatio = modify.PubOpposeRatio
} }
if modify.ProposalAmount > 0 { if modify.ProposalAmount > 0 {
new.ProposalAmount = modify.ProposalAmount newConfig.ProposalAmount = modify.ProposalAmount
} }
if modify.LargeProjectAmount > 0 { if modify.LargeProjectAmount > 0 {
new.LargeProjectAmount = modify.LargeProjectAmount newConfig.LargeProjectAmount = modify.LargeProjectAmount
} }
if modify.PublicPeriod > 0 { if modify.PublicPeriod > 0 {
new.PublicPeriod = modify.PublicPeriod newConfig.PublicPeriod = modify.PublicPeriod
}
if modify.PubAttendRatio > 0 {
newConfig.PubAttendRatio = modify.PubAttendRatio
} }
return &new if modify.PubApproveRatio > 0 {
newConfig.PubApproveRatio = modify.PubApproveRatio
}
return &newConfig
} }
...@@ -25,6 +25,8 @@ const ( ...@@ -25,6 +25,8 @@ const (
testProposalAmount = minProposalAmount * types.DefaultCoinPrecision * 2 testProposalAmount = minProposalAmount * types.DefaultCoinPrecision * 2
testLargeProjectAmount = minLargeProjectAmount * 2 * types.DefaultCoinPrecision testLargeProjectAmount = minLargeProjectAmount * 2 * types.DefaultCoinPrecision
testPublicPeriod = minPublicPeriod testPublicPeriod = minPublicPeriod
testPubAttendRatio int32 = maxPubAttendRatio
testPubApproveRatio int32 = minPubApproveRatio
) )
func TestPropRule(t *testing.T) { func TestPropRule(t *testing.T) {
...@@ -42,6 +44,8 @@ func TestPropRule(t *testing.T) { ...@@ -42,6 +44,8 @@ func TestPropRule(t *testing.T) {
ProposalAmount: maxProposalAmount * types.DefaultCoinPrecision, ProposalAmount: maxProposalAmount * types.DefaultCoinPrecision,
LargeProjectAmount: maxLargeProjectAmount * types.DefaultCoinPrecision, LargeProjectAmount: maxLargeProjectAmount * types.DefaultCoinPrecision,
PublicPeriod: maxPublicPeriod, PublicPeriod: maxPublicPeriod,
PubAttendRatio: maxPubAttendRatio,
PubApproveRatio: maxPubApproveRatio,
}, },
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
...@@ -53,6 +57,8 @@ func TestPropRule(t *testing.T) { ...@@ -53,6 +57,8 @@ func TestPropRule(t *testing.T) {
ProposalAmount: minProposalAmount * types.DefaultCoinPrecision, ProposalAmount: minProposalAmount * types.DefaultCoinPrecision,
LargeProjectAmount: minLargeProjectAmount * types.DefaultCoinPrecision, LargeProjectAmount: minLargeProjectAmount * types.DefaultCoinPrecision,
PublicPeriod: minPublicPeriod, PublicPeriod: minPublicPeriod,
PubAttendRatio: minPubAttendRatio,
PubApproveRatio: minPubApproveRatio,
}, },
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
...@@ -64,6 +70,8 @@ func TestPropRule(t *testing.T) { ...@@ -64,6 +70,8 @@ func TestPropRule(t *testing.T) {
ProposalAmount: minProposalAmount*types.DefaultCoinPrecision - 1, ProposalAmount: minProposalAmount*types.DefaultCoinPrecision - 1,
LargeProjectAmount: minLargeProjectAmount*types.DefaultCoinPrecision - 1, LargeProjectAmount: minLargeProjectAmount*types.DefaultCoinPrecision - 1,
PublicPeriod: minPublicPeriod - 1, PublicPeriod: minPublicPeriod - 1,
PubAttendRatio: minPubAttendRatio - 1,
PubApproveRatio: minPubApproveRatio - 1,
}, },
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
...@@ -75,6 +83,8 @@ func TestPropRule(t *testing.T) { ...@@ -75,6 +83,8 @@ func TestPropRule(t *testing.T) {
ProposalAmount: maxProposalAmount*types.DefaultCoinPrecision + 1, ProposalAmount: maxProposalAmount*types.DefaultCoinPrecision + 1,
LargeProjectAmount: maxLargeProjectAmount*types.DefaultCoinPrecision + 1, LargeProjectAmount: maxLargeProjectAmount*types.DefaultCoinPrecision + 1,
PublicPeriod: maxPublicPeriod + 1, PublicPeriod: maxPublicPeriod + 1,
PubAttendRatio: maxPubAttendRatio + 1,
PubApproveRatio: maxPubApproveRatio + 1,
}, },
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
...@@ -86,6 +96,8 @@ func TestPropRule(t *testing.T) { ...@@ -86,6 +96,8 @@ func TestPropRule(t *testing.T) {
ProposalAmount: minProposalAmount*types.DefaultCoinPrecision + 1, ProposalAmount: minProposalAmount*types.DefaultCoinPrecision + 1,
LargeProjectAmount: minLargeProjectAmount*types.DefaultCoinPrecision + 1, LargeProjectAmount: minLargeProjectAmount*types.DefaultCoinPrecision + 1,
PublicPeriod: minPublicPeriod + 1, PublicPeriod: minPublicPeriod + 1,
PubAttendRatio: minPubAttendRatio + 1,
PubApproveRatio: minPubApproveRatio + 1,
}, },
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
...@@ -147,6 +159,8 @@ func testPropRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.K ...@@ -147,6 +159,8 @@ func testPropRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.K
ProposalAmount: testProposalAmount, ProposalAmount: testProposalAmount,
LargeProjectAmount: testLargeProjectAmount, LargeProjectAmount: testLargeProjectAmount,
PublicPeriod: testPublicPeriod, PublicPeriod: testPublicPeriod,
PubAttendRatio: testPubAttendRatio,
PubApproveRatio: testPubApproveRatio,
}, },
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
...@@ -157,23 +171,23 @@ func testPropRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.K ...@@ -157,23 +171,23 @@ func testPropRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.K
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(pbtx, int(1)) receipt, err := exec.Exec(pbtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(pbtx, receiptData, int(1)) set, err := exec.ExecLocal(pbtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
...@@ -185,8 +199,8 @@ func testPropRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.K ...@@ -185,8 +199,8 @@ func testPropRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.K
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Frozen) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Frozen)
} }
func propRuleTx(parm *auty.ProposalRule) (*types.Transaction, error) { func propRuleTx(parm *auty.ProposalRule) (*types.Transaction, error) {
...@@ -210,33 +224,33 @@ func revokeProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB ...@@ -210,33 +224,33 @@ func revokeProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB
rtx, err = signTx(rtx, PrivKeyA) rtx, err = signTx(rtx, PrivKeyA)
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(rtx, int(1)) receipt, err := exec.Exec(rtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(rtx, receiptData, int(1)) set, err := exec.ExecLocal(rtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(rtx, receiptData, int(1)) set, err = exec.ExecDelLocal(rtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
// check rule // check rule
au := newTestAutonomy() au := newTestAutonomy()
au.SetStateDB(stateDB) au.SetStateDB(stateDB)
...@@ -304,9 +318,13 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d ...@@ -304,9 +318,13 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d
for i, record := range records { for i, record := range records {
opt := &auty.VoteProposalRule{ opt := &auty.VoteProposalRule{
ProposalID: proposalID, ProposalID: proposalID,
Approve: record.appr,
OriginAddr: record.origin, OriginAddr: record.origin,
} }
if record.appr {
opt.Vote = auty.AutonomyVoteOption_APPROVE
} else {
opt.Vote = auty.AutonomyVoteOption_OPPOSE
}
tx, err := voteProposalRuleTx(opt) tx, err := voteProposalRuleTx(opt)
assert.NoError(t, err) assert.NoError(t, err)
tx, err = signTx(tx, record.priv) tx, err = signTx(tx, record.priv)
...@@ -314,25 +332,25 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d ...@@ -314,25 +332,25 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d
// 设定当前高度为投票高度 // 设定当前高度为投票高度
exec.SetEnv(env.startHeight, env.blockTime, env.difficulty) exec.SetEnv(env.startHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
...@@ -354,10 +372,10 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d ...@@ -354,10 +372,10 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d
// balance // balance
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Balance) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Balance)
// status // status
value, err := stateDB.Get(propRuleID(proposalID)) value, err := stateDB.Get(propRuleID(proposalID))
assert.NoError(t, err) assert.NoError(t, err)
...@@ -379,6 +397,8 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d ...@@ -379,6 +397,8 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d
assert.Equal(t, rule.ProposalAmount, testProposalAmount) assert.Equal(t, rule.ProposalAmount, testProposalAmount)
assert.Equal(t, rule.LargeProjectAmount, testLargeProjectAmount) assert.Equal(t, rule.LargeProjectAmount, testLargeProjectAmount)
assert.Equal(t, rule.PublicPeriod, testPublicPeriod) assert.Equal(t, rule.PublicPeriod, testPublicPeriod)
assert.Equal(t, rule.PubAttendRatio, testPubAttendRatio)
assert.Equal(t, rule.PubApproveRatio, testPubApproveRatio)
} }
func voteProposalRuleTx(parm *auty.VoteProposalRule) (*types.Transaction, error) { func voteProposalRuleTx(parm *auty.VoteProposalRule) (*types.Transaction, error) {
...@@ -419,35 +439,35 @@ func terminateProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stat ...@@ -419,35 +439,35 @@ func terminateProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stat
tx, err = signTx(tx, PrivKeyA) tx, err = signTx(tx, PrivKeyA)
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.endHeight+1, env.blockTime, env.difficulty) exec.SetEnv(env.endHeight+1, env.blockTime, env.difficulty)
receipt, err := exec.Exec(tx, int(1)) receipt, err := exec.Exec(tx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
if save { if save {
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(tx, receiptData, int(1)) set, err := exec.ExecLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
if save { if save {
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
} }
// del // del
set, err = exec.ExecDelLocal(tx, receiptData, int(1)) set, err = exec.ExecDelLocal(tx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, int64(0), account.Frozen) assert.Equal(t, int64(0), accountAddr.Frozen)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, account.Balance) assert.Equal(t, proposalAmount*types.DefaultCoinPrecision, accountAddr.Balance)
// check rule // check rule
au := newTestAutonomy() au := newTestAutonomy()
...@@ -524,8 +544,8 @@ func TestCopyAutonomyProposalRule(t *testing.T) { ...@@ -524,8 +544,8 @@ func TestCopyAutonomyProposalRule(t *testing.T) {
} }
func TestUpgradeRule(t *testing.T) { func TestUpgradeRule(t *testing.T) {
new := upgradeRule(nil, &auty.RuleConfig{}) newRule := upgradeRule(nil, &auty.RuleConfig{})
assert.Nil(t, new) assert.Nil(t, newRule)
cur := &auty.RuleConfig{ cur := &auty.RuleConfig{
BoardApproveRatio: 2, BoardApproveRatio: 2,
PubOpposeRatio: 3, PubOpposeRatio: 3,
...@@ -540,13 +560,13 @@ func TestUpgradeRule(t *testing.T) { ...@@ -540,13 +560,13 @@ func TestUpgradeRule(t *testing.T) {
LargeProjectAmount: 0, LargeProjectAmount: 0,
PublicPeriod: 0, PublicPeriod: 0,
} }
new = upgradeRule(cur, modify) newRule = upgradeRule(cur, modify)
assert.NotNil(t, new) assert.NotNil(t, newRule)
assert.Equal(t, new.BoardApproveRatio, cur.BoardApproveRatio) assert.Equal(t, newRule.BoardApproveRatio, cur.BoardApproveRatio)
assert.Equal(t, new.PubOpposeRatio, cur.PubOpposeRatio) assert.Equal(t, newRule.PubOpposeRatio, cur.PubOpposeRatio)
assert.Equal(t, new.ProposalAmount, cur.ProposalAmount) assert.Equal(t, newRule.ProposalAmount, cur.ProposalAmount)
assert.Equal(t, new.LargeProjectAmount, cur.LargeProjectAmount) assert.Equal(t, newRule.LargeProjectAmount, cur.LargeProjectAmount)
assert.Equal(t, new.PublicPeriod, cur.PublicPeriod) assert.Equal(t, newRule.PublicPeriod, cur.PublicPeriod)
modify = &auty.RuleConfig{ modify = &auty.RuleConfig{
BoardApproveRatio: 20, BoardApproveRatio: 20,
...@@ -555,13 +575,13 @@ func TestUpgradeRule(t *testing.T) { ...@@ -555,13 +575,13 @@ func TestUpgradeRule(t *testing.T) {
LargeProjectAmount: 50, LargeProjectAmount: 50,
PublicPeriod: 60, PublicPeriod: 60,
} }
new = upgradeRule(cur, modify) newRule = upgradeRule(cur, modify)
assert.NotNil(t, new) assert.NotNil(t, newRule)
assert.Equal(t, new.BoardApproveRatio, modify.BoardApproveRatio) assert.Equal(t, newRule.BoardApproveRatio, modify.BoardApproveRatio)
assert.Equal(t, new.PubOpposeRatio, modify.PubOpposeRatio) assert.Equal(t, newRule.PubOpposeRatio, modify.PubOpposeRatio)
assert.Equal(t, new.ProposalAmount, modify.ProposalAmount) assert.Equal(t, newRule.ProposalAmount, modify.ProposalAmount)
assert.Equal(t, new.LargeProjectAmount, modify.LargeProjectAmount) assert.Equal(t, newRule.LargeProjectAmount, modify.LargeProjectAmount)
assert.Equal(t, new.PublicPeriod, modify.PublicPeriod) assert.Equal(t, newRule.PublicPeriod, modify.PublicPeriod)
} }
func TestTransfer(t *testing.T) { func TestTransfer(t *testing.T) {
...@@ -576,20 +596,20 @@ func TestTransfer(t *testing.T) { ...@@ -576,20 +596,20 @@ func TestTransfer(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(pbtx, int(1)) receipt, err := exec.Exec(pbtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
// check // check
accCoin := account.NewCoinsAccount(chainTestCfg) accCoin := account.NewCoinsAccount(chainTestCfg)
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, autonomyAddr) accountAddr := accCoin.LoadExecAccount(AddrA, autonomyAddr)
assert.Equal(t, total-types.DefaultCoinPrecision*190, account.Balance) assert.Equal(t, total-types.DefaultCoinPrecision*190, accountAddr.Balance)
account = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr) accountAddr = accCoin.LoadExecAccount(autonomyAddr, autonomyAddr)
assert.Equal(t, types.DefaultCoinPrecision*190, account.Balance) assert.Equal(t, types.DefaultCoinPrecision*190, accountAddr.Balance)
} }
func transferFundTx(parm *auty.TransferFund) (*types.Transaction, error) { func transferFundTx(parm *auty.TransferFund) (*types.Transaction, error) {
...@@ -620,20 +640,20 @@ func TestComment(t *testing.T) { ...@@ -620,20 +640,20 @@ func TestComment(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty) exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(pbtx, int(1)) receipt, err := exec.Exec(pbtx, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, receipt) assert.NotNil(t, receipt)
for _, kv := range receipt.KV { for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value) _ = stateDB.Set(kv.Key, kv.Value)
} }
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs} receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(pbtx, receiptData, int(1)) set, err := exec.ExecLocal(pbtx, receiptData, 1)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, set) assert.NotNil(t, set)
for _, kv := range set.KV { for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value) _ = kvdb.Set(kv.Key, kv.Value)
} }
// check // check
......
...@@ -27,11 +27,11 @@ var ruleOpt = &table.Option{ ...@@ -27,11 +27,11 @@ var ruleOpt = &table.Option{
//NewRuleTable 新建表 //NewRuleTable 新建表
func NewRuleTable(kvdb db.KV) *table.Table { func NewRuleTable(kvdb db.KV) *table.Table {
rowmeta := NewRuleRow() rowmeta := NewRuleRow()
table, err := table.NewTable(rowmeta, kvdb, ruleOpt) newTable, err := table.NewTable(rowmeta, kvdb, ruleOpt)
if err != nil { if err != nil {
panic(err) panic(err)
} }
return table return newTable
} }
//RuleRow table meta 结构 //RuleRow table meta 结构
......
...@@ -25,6 +25,16 @@ message AutonomyProposalBoard { ...@@ -25,6 +25,16 @@ message AutonomyProposalBoard {
string proposalID = 9; string proposalID = 9;
} }
enum BoardUpdate {
INV = 0;
//新增
ADDBoard = 1;
//剔除
DELBoard = 2;
//整体替换
REPLACEALL = 3;
}
// action // action
message ProposalBoard { message ProposalBoard {
// 提案时间 // 提案时间
...@@ -41,6 +51,10 @@ message ProposalBoard { ...@@ -41,6 +51,10 @@ message ProposalBoard {
int64 startBlockHeight = 6; // 提案开始投票高度 int64 startBlockHeight = 6; // 提案开始投票高度
int64 endBlockHeight = 7; // 提案结束投票高度 int64 endBlockHeight = 7; // 提案结束投票高度
int64 realEndBlockHeight = 8; // 实际提案结束投票高度 int64 realEndBlockHeight = 8; // 实际提案结束投票高度
//代替update,并扩展
BoardUpdate boardUpdate = 9;
} }
message RevokeProposalBoard { message RevokeProposalBoard {
...@@ -50,7 +64,10 @@ message RevokeProposalBoard { ...@@ -50,7 +64,10 @@ message RevokeProposalBoard {
message VoteProposalBoard { message VoteProposalBoard {
string proposalID = 1; string proposalID = 1;
bool approve = 2; bool approve = 2;
//真正投票地址
repeated string originAddr = 3; repeated string originAddr = 3;
//代替approve,并增加了弃权选项
AutonomyVoteOption voteOption = 4;
} }
message TerminateProposalBoard { message TerminateProposalBoard {
......
...@@ -54,6 +54,7 @@ message RevokeProposalChange { ...@@ -54,6 +54,7 @@ message RevokeProposalChange {
message VoteProposalChange { message VoteProposalChange {
string proposalID = 1; string proposalID = 1;
bool approve = 2; bool approve = 2;
AutonomyVoteOption vote = 3;
} }
message TerminateProposalChange { message TerminateProposalChange {
......
...@@ -16,6 +16,8 @@ message VoteResult { ...@@ -16,6 +16,8 @@ message VoteResult {
int32 opposeVotes = 3; int32 opposeVotes = 3;
// 是否通过 // 是否通过
bool pass = 4; bool pass = 4;
//弃权票
int32 quitVotes = 5;
} }
message PublicVote { message PublicVote {
...@@ -44,6 +46,22 @@ message RuleConfig { ...@@ -44,6 +46,22 @@ message RuleConfig {
int64 largeProjectAmount = 4; int64 largeProjectAmount = 4;
// 重大项目公示时间(以区块数为单位) // 重大项目公示时间(以区块数为单位)
int32 publicPeriod = 5; int32 publicPeriod = 5;
// 全体持票人参与率
int32 pubAttendRatio = 6;
// 全体持票人赞成率
int32 pubApproveRatio = 7;
}
//三种投票选项
enum AutonomyVoteOption {
NOJOIN = 0;
//支持
APPROVE = 1;
//反对
OPPOSE = 2;
//弃权
QUIT = 3;
} }
message ActiveBoard { message ActiveBoard {
......
...@@ -59,6 +59,7 @@ message RevokeProposalProject { ...@@ -59,6 +59,7 @@ message RevokeProposalProject {
message VoteProposalProject { message VoteProposalProject {
string proposalID = 1; string proposalID = 1;
bool approve = 2; bool approve = 2;
AutonomyVoteOption vote = 3;
} }
message PubVoteProposalProject { message PubVoteProposalProject {
......
...@@ -44,6 +44,7 @@ message VoteProposalRule { ...@@ -44,6 +44,7 @@ message VoteProposalRule {
string proposalID = 1; string proposalID = 1;
bool approve = 2; bool approve = 2;
repeated string originAddr = 3; repeated string originAddr = 3;
AutonomyVoteOption vote = 4;
} }
message TerminateProposalRule { message TerminateProposalRule {
......
...@@ -25,6 +25,61 @@ const ( ...@@ -25,6 +25,61 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type BoardUpdate int32
const (
BoardUpdate_INV BoardUpdate = 0
//新增
BoardUpdate_ADDBoard BoardUpdate = 1
//剔除
BoardUpdate_DELBoard BoardUpdate = 2
//整体替换
BoardUpdate_REPLACEALL BoardUpdate = 3
)
// Enum value maps for BoardUpdate.
var (
BoardUpdate_name = map[int32]string{
0: "INV",
1: "ADDBoard",
2: "DELBoard",
3: "REPLACEALL",
}
BoardUpdate_value = map[string]int32{
"INV": 0,
"ADDBoard": 1,
"DELBoard": 2,
"REPLACEALL": 3,
}
)
func (x BoardUpdate) Enum() *BoardUpdate {
p := new(BoardUpdate)
*p = x
return p
}
func (x BoardUpdate) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (BoardUpdate) Descriptor() protoreflect.EnumDescriptor {
return file_board_proto_enumTypes[0].Descriptor()
}
func (BoardUpdate) Type() protoreflect.EnumType {
return &file_board_proto_enumTypes[0]
}
func (x BoardUpdate) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use BoardUpdate.Descriptor instead.
func (BoardUpdate) EnumDescriptor() ([]byte, []int) {
return file_board_proto_rawDescGZIP(), []int{0}
}
type AutonomyProposalBoard struct { type AutonomyProposalBoard struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -158,6 +213,8 @@ type ProposalBoard struct { ...@@ -158,6 +213,8 @@ type ProposalBoard struct {
StartBlockHeight int64 `protobuf:"varint,6,opt,name=startBlockHeight,proto3" json:"startBlockHeight,omitempty"` // 提案开始投票高度 StartBlockHeight int64 `protobuf:"varint,6,opt,name=startBlockHeight,proto3" json:"startBlockHeight,omitempty"` // 提案开始投票高度
EndBlockHeight int64 `protobuf:"varint,7,opt,name=endBlockHeight,proto3" json:"endBlockHeight,omitempty"` // 提案结束投票高度 EndBlockHeight int64 `protobuf:"varint,7,opt,name=endBlockHeight,proto3" json:"endBlockHeight,omitempty"` // 提案结束投票高度
RealEndBlockHeight int64 `protobuf:"varint,8,opt,name=realEndBlockHeight,proto3" json:"realEndBlockHeight,omitempty"` // 实际提案结束投票高度 RealEndBlockHeight int64 `protobuf:"varint,8,opt,name=realEndBlockHeight,proto3" json:"realEndBlockHeight,omitempty"` // 实际提案结束投票高度
//代替update,并扩展
BoardUpdate BoardUpdate `protobuf:"varint,9,opt,name=boardUpdate,proto3,enum=types.BoardUpdate" json:"boardUpdate,omitempty"`
} }
func (x *ProposalBoard) Reset() { func (x *ProposalBoard) Reset() {
...@@ -248,6 +305,13 @@ func (x *ProposalBoard) GetRealEndBlockHeight() int64 { ...@@ -248,6 +305,13 @@ func (x *ProposalBoard) GetRealEndBlockHeight() int64 {
return 0 return 0
} }
func (x *ProposalBoard) GetBoardUpdate() BoardUpdate {
if x != nil {
return x.BoardUpdate
}
return BoardUpdate_INV
}
type RevokeProposalBoard struct { type RevokeProposalBoard struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -300,9 +364,12 @@ type VoteProposalBoard struct { ...@@ -300,9 +364,12 @@ type VoteProposalBoard struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"` Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"`
//真正投票地址
OriginAddr []string `protobuf:"bytes,3,rep,name=originAddr,proto3" json:"originAddr,omitempty"` OriginAddr []string `protobuf:"bytes,3,rep,name=originAddr,proto3" json:"originAddr,omitempty"`
//代替approve,并增加了弃权选项
VoteOption AutonomyVoteOption `protobuf:"varint,4,opt,name=voteOption,proto3,enum=types.AutonomyVoteOption" json:"voteOption,omitempty"`
} }
func (x *VoteProposalBoard) Reset() { func (x *VoteProposalBoard) Reset() {
...@@ -358,6 +425,13 @@ func (x *VoteProposalBoard) GetOriginAddr() []string { ...@@ -358,6 +425,13 @@ func (x *VoteProposalBoard) GetOriginAddr() []string {
return nil return nil
} }
func (x *VoteProposalBoard) GetVoteOption() AutonomyVoteOption {
if x != nil {
return x.VoteOption
}
return AutonomyVoteOption_NOJOIN
}
type TerminateProposalBoard struct { type TerminateProposalBoard struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -677,7 +751,7 @@ var file_board_proto_rawDesc = []byte{ ...@@ -677,7 +751,7 @@ var file_board_proto_rawDesc = []byte{
0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x08, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x08,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 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, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0xff, 0x01, 0x0a, 0x0d, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0xb5, 0x02, 0x0a, 0x0d,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a,
0x04, 0x79, 0x65, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x79, 0x65, 0x61, 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, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
...@@ -693,53 +767,65 @@ var file_board_proto_rawDesc = []byte{ ...@@ -693,53 +767,65 @@ var file_board_proto_rawDesc = []byte{
0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2e, 0x0a, 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, 0x12, 0x72, 0x65, 0x61, 0x6c, 0x45, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69,
0x67, 0x68, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x72, 0x65, 0x61, 0x6c, 0x45, 0x67, 0x68, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x72, 0x65, 0x61, 0x6c, 0x45,
0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x35, 0x0a, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x34, 0x0a,
0x13, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x0b, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01,
0x6f, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6f, 0x61, 0x72, 0x64,
0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x55, 0x70, 0x64,
0x61, 0x6c, 0x49, 0x44, 0x22, 0x6d, 0x0a, 0x11, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x61, 0x74, 0x65, 0x22, 0x35, 0x0a, 0x13, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f,
0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0xa8, 0x01, 0x0a, 0x11, 0x56,
0x72, 0x6f, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64,
0x6f, 0x76, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01,
0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44,
0x64, 0x64, 0x72, 0x22, 0x38, 0x0a, 0x16, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x08, 0x52, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x72,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a,
0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x80, 0x01, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x39, 0x0a, 0x0a, 0x76, 0x6f,
0x0a, 0x14, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19,
0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x30, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76, 0x18, 0x01, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x56,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x6f, 0x74, 0x65, 0x4f,
0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x16, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61,
0x72, 0x64, 0x52, 0x04, 0x70, 0x72, 0x65, 0x76, 0x12, 0x36, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12,
0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20,
0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22,
0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x80, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x22, 0x66, 0x0a, 0x12, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x30, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76,
0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x34, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41,
0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42,
0x6f, 0x61, 0x72, 0x64, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x04, 0x70, 0x72, 0x65, 0x76, 0x12, 0x36, 0x0a, 0x07, 0x63, 0x75,
0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79,
0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa5, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x71, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70,
0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65,
0x72, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x6e, 0x74, 0x22, 0x66, 0x0a, 0x12, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x34, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x70,
0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x42, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x64, 0x12, 0x1a,
0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa5, 0x01, 0x0a, 0x15, 0x52,
0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x65, 0x71, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42,
0x64, 0x65, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01,
0x22, 0x57, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04,
0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x3c, 0x0a, 0x0a, 0x70, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72,
0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x0a, 0x70, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63,
0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05,
0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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, 0x57, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x3c, 0x0a,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f,
0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x52,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x2a, 0x42, 0x0a, 0x0b, 0x42,
0x6f, 0x61, 0x72, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e,
0x56, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x44, 0x44, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x10,
0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x4c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x10, 0x02, 0x12,
0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x41, 0x4c, 0x4c, 0x10, 0x03, 0x42,
0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (
...@@ -754,35 +840,40 @@ func file_board_proto_rawDescGZIP() []byte { ...@@ -754,35 +840,40 @@ func file_board_proto_rawDescGZIP() []byte {
return file_board_proto_rawDescData return file_board_proto_rawDescData
} }
var file_board_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_board_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_board_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_board_proto_goTypes = []interface{}{ var file_board_proto_goTypes = []interface{}{
(*AutonomyProposalBoard)(nil), // 0: types.AutonomyProposalBoard (BoardUpdate)(0), // 0: types.BoardUpdate
(*ProposalBoard)(nil), // 1: types.ProposalBoard (*AutonomyProposalBoard)(nil), // 1: types.AutonomyProposalBoard
(*RevokeProposalBoard)(nil), // 2: types.RevokeProposalBoard (*ProposalBoard)(nil), // 2: types.ProposalBoard
(*VoteProposalBoard)(nil), // 3: types.VoteProposalBoard (*RevokeProposalBoard)(nil), // 3: types.RevokeProposalBoard
(*TerminateProposalBoard)(nil), // 4: types.TerminateProposalBoard (*VoteProposalBoard)(nil), // 4: types.VoteProposalBoard
(*ReceiptProposalBoard)(nil), // 5: types.ReceiptProposalBoard (*TerminateProposalBoard)(nil), // 5: types.TerminateProposalBoard
(*LocalProposalBoard)(nil), // 6: types.LocalProposalBoard (*ReceiptProposalBoard)(nil), // 6: types.ReceiptProposalBoard
(*ReqQueryProposalBoard)(nil), // 7: types.ReqQueryProposalBoard (*LocalProposalBoard)(nil), // 7: types.LocalProposalBoard
(*ReplyQueryProposalBoard)(nil), // 8: types.ReplyQueryProposalBoard (*ReqQueryProposalBoard)(nil), // 8: types.ReqQueryProposalBoard
(*RuleConfig)(nil), // 9: types.RuleConfig (*ReplyQueryProposalBoard)(nil), // 9: types.ReplyQueryProposalBoard
(*ActiveBoard)(nil), // 10: types.ActiveBoard (*RuleConfig)(nil), // 10: types.RuleConfig
(*VoteResult)(nil), // 11: types.VoteResult (*ActiveBoard)(nil), // 11: types.ActiveBoard
(*VoteResult)(nil), // 12: types.VoteResult
(AutonomyVoteOption)(0), // 13: types.AutonomyVoteOption
} }
var file_board_proto_depIdxs = []int32{ var file_board_proto_depIdxs = []int32{
1, // 0: types.AutonomyProposalBoard.propBoard:type_name -> types.ProposalBoard 2, // 0: types.AutonomyProposalBoard.propBoard:type_name -> types.ProposalBoard
9, // 1: types.AutonomyProposalBoard.curRule:type_name -> types.RuleConfig 10, // 1: types.AutonomyProposalBoard.curRule:type_name -> types.RuleConfig
10, // 2: types.AutonomyProposalBoard.board:type_name -> types.ActiveBoard 11, // 2: types.AutonomyProposalBoard.board:type_name -> types.ActiveBoard
11, // 3: types.AutonomyProposalBoard.voteResult:type_name -> types.VoteResult 12, // 3: types.AutonomyProposalBoard.voteResult:type_name -> types.VoteResult
0, // 4: types.ReceiptProposalBoard.prev:type_name -> types.AutonomyProposalBoard 0, // 4: types.ProposalBoard.boardUpdate:type_name -> types.BoardUpdate
0, // 5: types.ReceiptProposalBoard.current:type_name -> types.AutonomyProposalBoard 13, // 5: types.VoteProposalBoard.voteOption:type_name -> types.AutonomyVoteOption
0, // 6: types.LocalProposalBoard.propBd:type_name -> types.AutonomyProposalBoard 1, // 6: types.ReceiptProposalBoard.prev:type_name -> types.AutonomyProposalBoard
0, // 7: types.ReplyQueryProposalBoard.propBoards:type_name -> types.AutonomyProposalBoard 1, // 7: types.ReceiptProposalBoard.current:type_name -> types.AutonomyProposalBoard
8, // [8:8] is the sub-list for method output_type 1, // 8: types.LocalProposalBoard.propBd:type_name -> types.AutonomyProposalBoard
8, // [8:8] is the sub-list for method input_type 1, // 9: types.ReplyQueryProposalBoard.propBoards:type_name -> types.AutonomyProposalBoard
8, // [8:8] is the sub-list for extension type_name 10, // [10:10] is the sub-list for method output_type
8, // [8:8] is the sub-list for extension extendee 10, // [10:10] is the sub-list for method input_type
0, // [0:8] is the sub-list for field type_name 10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
} }
func init() { file_board_proto_init() } func init() { file_board_proto_init() }
...@@ -906,13 +997,14 @@ func file_board_proto_init() { ...@@ -906,13 +997,14 @@ func file_board_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_board_proto_rawDesc, RawDescriptor: file_board_proto_rawDesc,
NumEnums: 0, NumEnums: 1,
NumMessages: 9, NumMessages: 9,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
GoTypes: file_board_proto_goTypes, GoTypes: file_board_proto_goTypes,
DependencyIndexes: file_board_proto_depIdxs, DependencyIndexes: file_board_proto_depIdxs,
EnumInfos: file_board_proto_enumTypes,
MessageInfos: file_board_proto_msgTypes, MessageInfos: file_board_proto_msgTypes,
}.Build() }.Build()
File_board_proto = out.File File_board_proto = out.File
......
...@@ -347,8 +347,9 @@ type VoteProposalChange struct { ...@@ -347,8 +347,9 @@ type VoteProposalChange struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,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 *VoteProposalChange) Reset() { func (x *VoteProposalChange) Reset() {
...@@ -397,6 +398,13 @@ func (x *VoteProposalChange) GetApprove() bool { ...@@ -397,6 +398,13 @@ func (x *VoteProposalChange) GetApprove() bool {
return false return false
} }
func (x *VoteProposalChange) GetVote() AutonomyVoteOption {
if x != nil {
return x.Vote
}
return AutonomyVoteOption_NOJOIN
}
type TerminateProposalChange struct { type TerminateProposalChange struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -739,48 +747,51 @@ var file_change_proto_rawDesc = []byte{ ...@@ -739,48 +747,51 @@ var file_change_proto_rawDesc = []byte{
0x64, 0x72, 0x22, 0x36, 0x0a, 0x14, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x64, 0x72, 0x22, 0x36, 0x0a, 0x14, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72,
0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 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, 0x4e, 0x0a, 0x12, 0x56, 0x6f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x7d, 0x0a, 0x12, 0x56, 0x6f,
0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 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, 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, 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, 0x22, 0x39, 0x0a, 0x17, 0x54, 0x65, 0x08, 0x52, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x76, 0x6f,
0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74,
0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x22, 0x39, 0x0a, 0x17, 0x54, 0x65, 0x72,
0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x83, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68,
0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x31, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x83, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74,
0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x04, 0x70, 0x72, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x31,
0x65, 0x76, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74,
0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f,
0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x04, 0x70, 0x72, 0x65,
0x67, 0x65, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x68, 0x0a, 0x13, 0x4c, 0x76, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
0x6f, 0x63, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e,
0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67,
0x65, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x68, 0x0a, 0x13, 0x4c, 0x6f,
0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x63, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67,
0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa6, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x71, 0x51, 0x75, 0x65, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x70, 0x42, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa6, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x71, 0x51, 0x75, 0x65, 0x72,
0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12,
0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18,
0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63,
0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x5b, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e,
0x0a, 0x18, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04,
0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x3f, 0x0a, 0x0b, 0x70, 0x72, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52,
0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x5b, 0x0a,
0x70, 0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x18, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x3f, 0x0a, 0x0b, 0x70, 0x72, 0x6f,
0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d,
0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0b, 0x70,
0x72, 0x6f, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e,
0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
...@@ -810,6 +821,7 @@ var file_change_proto_goTypes = []interface{}{ ...@@ -810,6 +821,7 @@ var file_change_proto_goTypes = []interface{}{
(*RuleConfig)(nil), // 10: types.RuleConfig (*RuleConfig)(nil), // 10: types.RuleConfig
(*ActiveBoard)(nil), // 11: types.ActiveBoard (*ActiveBoard)(nil), // 11: types.ActiveBoard
(*VoteResult)(nil), // 12: types.VoteResult (*VoteResult)(nil), // 12: types.VoteResult
(AutonomyVoteOption)(0), // 13: types.AutonomyVoteOption
} }
var file_change_proto_depIdxs = []int32{ var file_change_proto_depIdxs = []int32{
1, // 0: types.AutonomyProposalChange.propChange:type_name -> types.ProposalChange 1, // 0: types.AutonomyProposalChange.propChange:type_name -> types.ProposalChange
...@@ -817,15 +829,16 @@ var file_change_proto_depIdxs = []int32{ ...@@ -817,15 +829,16 @@ var file_change_proto_depIdxs = []int32{
11, // 2: types.AutonomyProposalChange.board:type_name -> types.ActiveBoard 11, // 2: types.AutonomyProposalChange.board:type_name -> types.ActiveBoard
12, // 3: types.AutonomyProposalChange.voteResult:type_name -> types.VoteResult 12, // 3: types.AutonomyProposalChange.voteResult:type_name -> types.VoteResult
2, // 4: types.ProposalChange.changes:type_name -> types.Change 2, // 4: types.ProposalChange.changes:type_name -> types.Change
0, // 5: types.ReceiptProposalChange.prev:type_name -> types.AutonomyProposalChange 13, // 5: types.VoteProposalChange.vote:type_name -> types.AutonomyVoteOption
0, // 6: types.ReceiptProposalChange.current:type_name -> types.AutonomyProposalChange 0, // 6: types.ReceiptProposalChange.prev:type_name -> types.AutonomyProposalChange
0, // 7: types.LocalProposalChange.propBd:type_name -> types.AutonomyProposalChange 0, // 7: types.ReceiptProposalChange.current:type_name -> types.AutonomyProposalChange
0, // 8: types.ReplyQueryProposalChange.propChanges:type_name -> types.AutonomyProposalChange 0, // 8: types.LocalProposalChange.propBd:type_name -> types.AutonomyProposalChange
9, // [9:9] is the sub-list for method output_type 0, // 9: types.ReplyQueryProposalChange.propChanges:type_name -> types.AutonomyProposalChange
9, // [9:9] is the sub-list for method input_type 10, // [10:10] is the sub-list for method output_type
9, // [9:9] is the sub-list for extension type_name 10, // [10:10] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension extendee 10, // [10:10] is the sub-list for extension type_name
0, // [0:9] is the sub-list for field type_name 10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
} }
func init() { file_change_proto_init() } func init() { file_change_proto_init() }
......
...@@ -25,6 +25,62 @@ const ( ...@@ -25,6 +25,62 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
//三种投票选项
type AutonomyVoteOption int32
const (
AutonomyVoteOption_NOJOIN AutonomyVoteOption = 0
//支持
AutonomyVoteOption_APPROVE AutonomyVoteOption = 1
//反对
AutonomyVoteOption_OPPOSE AutonomyVoteOption = 2
//弃权
AutonomyVoteOption_QUIT AutonomyVoteOption = 3
)
// Enum value maps for AutonomyVoteOption.
var (
AutonomyVoteOption_name = map[int32]string{
0: "NOJOIN",
1: "APPROVE",
2: "OPPOSE",
3: "QUIT",
}
AutonomyVoteOption_value = map[string]int32{
"NOJOIN": 0,
"APPROVE": 1,
"OPPOSE": 2,
"QUIT": 3,
}
)
func (x AutonomyVoteOption) Enum() *AutonomyVoteOption {
p := new(AutonomyVoteOption)
*p = x
return p
}
func (x AutonomyVoteOption) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (AutonomyVoteOption) Descriptor() protoreflect.EnumDescriptor {
return file_lcommon_proto_enumTypes[0].Descriptor()
}
func (AutonomyVoteOption) Type() protoreflect.EnumType {
return &file_lcommon_proto_enumTypes[0]
}
func (x AutonomyVoteOption) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use AutonomyVoteOption.Descriptor instead.
func (AutonomyVoteOption) EnumDescriptor() ([]byte, []int) {
return file_lcommon_proto_rawDescGZIP(), []int{0}
}
type VoteResult struct { type VoteResult struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -38,6 +94,8 @@ type VoteResult struct { ...@@ -38,6 +94,8 @@ type VoteResult struct {
OpposeVotes int32 `protobuf:"varint,3,opt,name=opposeVotes,proto3" json:"opposeVotes,omitempty"` OpposeVotes int32 `protobuf:"varint,3,opt,name=opposeVotes,proto3" json:"opposeVotes,omitempty"`
// 是否通过 // 是否通过
Pass bool `protobuf:"varint,4,opt,name=pass,proto3" json:"pass,omitempty"` Pass bool `protobuf:"varint,4,opt,name=pass,proto3" json:"pass,omitempty"`
//弃权票
QuitVotes int32 `protobuf:"varint,5,opt,name=quitVotes,proto3" json:"quitVotes,omitempty"`
} }
func (x *VoteResult) Reset() { func (x *VoteResult) Reset() {
...@@ -100,6 +158,13 @@ func (x *VoteResult) GetPass() bool { ...@@ -100,6 +158,13 @@ func (x *VoteResult) GetPass() bool {
return false return false
} }
func (x *VoteResult) GetQuitVotes() int32 {
if x != nil {
return x.QuitVotes
}
return 0
}
type PublicVote struct { type PublicVote struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -237,6 +302,10 @@ type RuleConfig struct { ...@@ -237,6 +302,10 @@ type RuleConfig struct {
LargeProjectAmount int64 `protobuf:"varint,4,opt,name=largeProjectAmount,proto3" json:"largeProjectAmount,omitempty"` LargeProjectAmount int64 `protobuf:"varint,4,opt,name=largeProjectAmount,proto3" json:"largeProjectAmount,omitempty"`
// 重大项目公示时间(以区块数为单位) // 重大项目公示时间(以区块数为单位)
PublicPeriod int32 `protobuf:"varint,5,opt,name=publicPeriod,proto3" json:"publicPeriod,omitempty"` PublicPeriod int32 `protobuf:"varint,5,opt,name=publicPeriod,proto3" json:"publicPeriod,omitempty"`
// 全体持票人参与率
PubAttendRatio int32 `protobuf:"varint,6,opt,name=pubAttendRatio,proto3" json:"pubAttendRatio,omitempty"`
// 全体持票人赞成率
PubApproveRatio int32 `protobuf:"varint,7,opt,name=pubApproveRatio,proto3" json:"pubApproveRatio,omitempty"`
} }
func (x *RuleConfig) Reset() { func (x *RuleConfig) Reset() {
...@@ -306,6 +375,20 @@ func (x *RuleConfig) GetPublicPeriod() int32 { ...@@ -306,6 +375,20 @@ func (x *RuleConfig) GetPublicPeriod() int32 {
return 0 return 0
} }
func (x *RuleConfig) GetPubAttendRatio() int32 {
if x != nil {
return x.PubAttendRatio
}
return 0
}
func (x *RuleConfig) GetPubApproveRatio() int32 {
if x != nil {
return x.PubApproveRatio
}
return 0
}
type ActiveBoard struct { type ActiveBoard struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -381,7 +464,7 @@ var File_lcommon_proto protoreflect.FileDescriptor ...@@ -381,7 +464,7 @@ var File_lcommon_proto protoreflect.FileDescriptor
var file_lcommon_proto_rawDesc = []byte{ var file_lcommon_proto_rawDesc = []byte{
0x0a, 0x0d, 0x6c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x0d, 0x6c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x86, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x6f, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x6f,
0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65,
...@@ -389,33 +472,40 @@ var file_lcommon_proto_rawDesc = []byte{ ...@@ -389,33 +472,40 @@ var file_lcommon_proto_rawDesc = []byte{
0x72, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x70,
0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b,
0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70,
0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x61, 0x73, 0x73, 0x22, 0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x61, 0x73, 0x73, 0x12,
0x86, 0x01, 0x0a, 0x0a, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1c, 0x1c, 0x0a, 0x09, 0x71, 0x75, 0x69, 0x74, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01,
0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x28, 0x05, 0x52, 0x09, 0x71, 0x75, 0x69, 0x74, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x22, 0x86, 0x01,
0x08, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x0a, 0x0a, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09,
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f,
0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x74, 0x61, 0x6c, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
0x05, 0x52, 0x0b, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x18, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70,
0x0a, 0x07, 0x70, 0x75, 0x62, 0x50, 0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x70, 0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x07, 0x70, 0x75, 0x62, 0x50, 0x61, 0x73, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x56, 0x6f, 0x74, 0x65, 0x0b, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07,
0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x70, 0x75, 0x62, 0x50, 0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70,
0x73, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x75, 0x62, 0x50, 0x61, 0x73, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x56, 0x6f, 0x74, 0x65, 0x73, 0x52,
0x73, 0x22, 0xde, 0x01, 0x0a, 0x0a, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
0x12, 0x2c, 0x0a, 0x11, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22,
0x52, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x62, 0x6f, 0x61, 0xb0, 0x02, 0x0a, 0x0a, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c,
0x72, 0x64, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x26, 0x0a, 0x11, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x52, 0x61,
0x0a, 0x0e, 0x70, 0x75, 0x62, 0x4f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x74, 0x69, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x62, 0x6f, 0x61, 0x72, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x70, 0x75, 0x62, 0x4f, 0x70, 0x70, 0x6f, 0x73, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x26, 0x0a, 0x0e,
0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x70, 0x75, 0x62, 0x4f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x02,
0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x70, 0x75, 0x62, 0x4f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x52,
0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2e, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x0a, 0x12, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6d, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x70, 0x72,
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x6c, 0x61, 0x72, 0x67, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x12,
0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75,
0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x05, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x50,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x65, 0x72, 0x69, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c,
0x6f, 0x64, 0x22, 0x7d, 0x0a, 0x0b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x42, 0x6f, 0x61, 0x72, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01,
0x28, 0x05, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64,
0x12, 0x26, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x41, 0x74, 0x74, 0x65, 0x6e, 0x64, 0x52, 0x61, 0x74,
0x69, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x70, 0x75, 0x62, 0x41, 0x74, 0x74,
0x65, 0x6e, 0x64, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x28, 0x0a, 0x0f, 0x70, 0x75, 0x62, 0x41,
0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28,
0x05, 0x52, 0x0f, 0x70, 0x75, 0x62, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x74,
0x69, 0x6f, 0x22, 0x7d, 0x0a, 0x0b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x42, 0x6f, 0x61, 0x72,
0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x09, 0x52, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x76, 0x09, 0x52, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x76,
0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65,
...@@ -423,8 +513,12 @@ var file_lcommon_proto_rawDesc = []byte{ ...@@ -423,8 +513,12 @@ var file_lcommon_proto_rawDesc = []byte{
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68,
0x74, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x74, 0x2a, 0x43, 0x0a, 0x12, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x56, 0x6f, 0x74,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x4a, 0x4f, 0x49,
0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x45, 0x10, 0x01,
0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x50, 0x50, 0x4f, 0x53, 0x45, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04,
0x51, 0x55, 0x49, 0x54, 0x10, 0x03, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79, 0x70,
0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
...@@ -439,13 +533,15 @@ func file_lcommon_proto_rawDescGZIP() []byte { ...@@ -439,13 +533,15 @@ func file_lcommon_proto_rawDescGZIP() []byte {
return file_lcommon_proto_rawDescData return file_lcommon_proto_rawDescData
} }
var file_lcommon_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_lcommon_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_lcommon_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_lcommon_proto_goTypes = []interface{}{ var file_lcommon_proto_goTypes = []interface{}{
(*VoteResult)(nil), // 0: types.VoteResult (AutonomyVoteOption)(0), // 0: types.AutonomyVoteOption
(*PublicVote)(nil), // 1: types.PublicVote (*VoteResult)(nil), // 1: types.VoteResult
(*VotesRecord)(nil), // 2: types.VotesRecord (*PublicVote)(nil), // 2: types.PublicVote
(*RuleConfig)(nil), // 3: types.RuleConfig (*VotesRecord)(nil), // 3: types.VotesRecord
(*ActiveBoard)(nil), // 4: types.ActiveBoard (*RuleConfig)(nil), // 4: types.RuleConfig
(*ActiveBoard)(nil), // 5: types.ActiveBoard
} }
var file_lcommon_proto_depIdxs = []int32{ var file_lcommon_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method output_type
...@@ -527,13 +623,14 @@ func file_lcommon_proto_init() { ...@@ -527,13 +623,14 @@ func file_lcommon_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_lcommon_proto_rawDesc, RawDescriptor: file_lcommon_proto_rawDesc,
NumEnums: 0, NumEnums: 1,
NumMessages: 5, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
GoTypes: file_lcommon_proto_goTypes, GoTypes: file_lcommon_proto_goTypes,
DependencyIndexes: file_lcommon_proto_depIdxs, DependencyIndexes: file_lcommon_proto_depIdxs,
EnumInfos: file_lcommon_proto_enumTypes,
MessageInfos: file_lcommon_proto_msgTypes, MessageInfos: file_lcommon_proto_msgTypes,
}.Build() }.Build()
File_lcommon_proto = out.File File_lcommon_proto = out.File
......
...@@ -364,8 +364,9 @@ type VoteProposalProject struct { ...@@ -364,8 +364,9 @@ type VoteProposalProject struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,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 *VoteProposalProject) Reset() { func (x *VoteProposalProject) Reset() {
...@@ -414,6 +415,13 @@ func (x *VoteProposalProject) GetApprove() bool { ...@@ -414,6 +415,13 @@ func (x *VoteProposalProject) GetApprove() bool {
return false return false
} }
func (x *VoteProposalProject) GetVote() AutonomyVoteOption {
if x != nil {
return x.Vote
}
return AutonomyVoteOption_NOJOIN
}
type PubVoteProposalProject struct { type PubVoteProposalProject struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -834,56 +842,59 @@ var file_project_proto_rawDesc = []byte{ ...@@ -834,56 +842,59 @@ var file_project_proto_rawDesc = []byte{
0x0a, 0x15, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x0a, 0x15, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 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, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x4f, 0x0a, 0x13, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x7e, 0x0a, 0x13, 0x56, 0x6f, 0x74, 0x65, 0x50,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1e,
0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 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, 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, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x22, 0x70, 0x0a, 0x16, 0x50, 0x75, 0x62, 0x56, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65,
0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41,
0x63, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x6e, 0x52, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x22, 0x70, 0x0a, 0x16, 0x50, 0x75, 0x62, 0x56, 0x6f,
0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63,
0x28, 0x08, 0x52, 0x06, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18,
0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49,
0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x22, 0x3a, 0x0a, 0x18, 0x54, 0x65, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x08, 0x52, 0x06, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x72, 0x69,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6f,
0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x22, 0x3a, 0x0a, 0x18, 0x54, 0x65, 0x72,
0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x86, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x63, 0x65, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72,
0x70, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x74, 0x12, 0x32, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f,
0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x86, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70,
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x04, 0x70, 0x72, 0x65, 0x76, 0x12, 0x38, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50,
0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x04,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x70, 0x72, 0x65, 0x76, 0x12, 0x38, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18,
0x6c, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x75,
0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x38, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72,
0x72, 0x6a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x6c,
0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50,
0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x38, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72,
0x6a, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x6a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa7, 0x01, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c,
0x0a, 0x17, 0x52, 0x65, 0x71, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6a,
0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03,
0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa7, 0x01, 0x0a,
0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x52, 0x65, 0x71, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20,
0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69,
0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64,
0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x5f, 0x0a, 0x19, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67,
0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74,
0x6a, 0x65, 0x63, 0x74, 0x12, 0x42, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
0x65, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x5f, 0x0a, 0x19, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x51,
0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a,
0x73, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x63, 0x74, 0x12, 0x42, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x50, 0x72, 0x6f, 0x6a, 0x65,
0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65,
0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x6e, 0x6f, 0x6d, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73,
0x61, 0x6c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x50,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79,
0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
...@@ -913,21 +924,23 @@ var file_project_proto_goTypes = []interface{}{ ...@@ -913,21 +924,23 @@ var file_project_proto_goTypes = []interface{}{
(*RuleConfig)(nil), // 10: types.RuleConfig (*RuleConfig)(nil), // 10: types.RuleConfig
(*VoteResult)(nil), // 11: types.VoteResult (*VoteResult)(nil), // 11: types.VoteResult
(*PublicVote)(nil), // 12: types.PublicVote (*PublicVote)(nil), // 12: types.PublicVote
(AutonomyVoteOption)(0), // 13: types.AutonomyVoteOption
} }
var file_project_proto_depIdxs = []int32{ var file_project_proto_depIdxs = []int32{
1, // 0: types.AutonomyProposalProject.propProject:type_name -> types.ProposalProject 1, // 0: types.AutonomyProposalProject.propProject:type_name -> types.ProposalProject
10, // 1: types.AutonomyProposalProject.curRule:type_name -> types.RuleConfig 10, // 1: types.AutonomyProposalProject.curRule:type_name -> types.RuleConfig
11, // 2: types.AutonomyProposalProject.boardVoteRes:type_name -> types.VoteResult 11, // 2: types.AutonomyProposalProject.boardVoteRes:type_name -> types.VoteResult
12, // 3: types.AutonomyProposalProject.pubVote:type_name -> types.PublicVote 12, // 3: types.AutonomyProposalProject.pubVote:type_name -> types.PublicVote
0, // 4: types.ReceiptProposalProject.prev:type_name -> types.AutonomyProposalProject 13, // 4: types.VoteProposalProject.vote:type_name -> types.AutonomyVoteOption
0, // 5: types.ReceiptProposalProject.current:type_name -> types.AutonomyProposalProject 0, // 5: types.ReceiptProposalProject.prev:type_name -> types.AutonomyProposalProject
0, // 6: types.LocalProposalProject.propPrj:type_name -> types.AutonomyProposalProject 0, // 6: types.ReceiptProposalProject.current:type_name -> types.AutonomyProposalProject
0, // 7: types.ReplyQueryProposalProject.propProjects:type_name -> types.AutonomyProposalProject 0, // 7: types.LocalProposalProject.propPrj:type_name -> types.AutonomyProposalProject
8, // [8:8] is the sub-list for method output_type 0, // 8: types.ReplyQueryProposalProject.propProjects:type_name -> types.AutonomyProposalProject
8, // [8:8] is the sub-list for method input_type 9, // [9:9] is the sub-list for method output_type
8, // [8:8] is the sub-list for extension type_name 9, // [9:9] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension extendee 9, // [9:9] is the sub-list for extension type_name
0, // [0:8] is the sub-list for field type_name 9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
} }
func init() { file_project_proto_init() } func init() { file_project_proto_init() }
......
...@@ -280,9 +280,10 @@ type VoteProposalRule struct { ...@@ -280,9 +280,10 @@ type VoteProposalRule struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"` Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"`
OriginAddr []string `protobuf:"bytes,3,rep,name=originAddr,proto3" json:"originAddr,omitempty"` OriginAddr []string `protobuf:"bytes,3,rep,name=originAddr,proto3" json:"originAddr,omitempty"`
Vote AutonomyVoteOption `protobuf:"varint,4,opt,name=vote,proto3,enum=types.AutonomyVoteOption" json:"vote,omitempty"`
} }
func (x *VoteProposalRule) Reset() { func (x *VoteProposalRule) Reset() {
...@@ -338,6 +339,13 @@ func (x *VoteProposalRule) GetOriginAddr() []string { ...@@ -338,6 +339,13 @@ func (x *VoteProposalRule) GetOriginAddr() []string {
return nil return nil
} }
func (x *VoteProposalRule) GetVote() AutonomyVoteOption {
if x != nil {
return x.Vote
}
return AutonomyVoteOption_NOJOIN
}
type TerminateProposalRule struct { type TerminateProposalRule struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -1071,13 +1079,16 @@ var file_rule_proto_rawDesc = []byte{ ...@@ -1071,13 +1079,16 @@ var file_rule_proto_rawDesc = []byte{
0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65,
0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 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, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x44,
0x22, 0x6c, 0x0a, 0x10, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x22, 0x9b, 0x01, 0x0a, 0x10, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x52, 0x75, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f,
0x61, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x18, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x12, 0x1e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x12,
0x0a, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x03, 0x1e, 0x0a, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20,
0x28, 0x09, 0x52, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x22, 0x37, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12,
0x2d, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x18, 0x04, 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, 0x0a, 0x15, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x6f,
0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 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, 0x73, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f,
...@@ -1187,23 +1198,25 @@ var file_rule_proto_goTypes = []interface{}{ ...@@ -1187,23 +1198,25 @@ var file_rule_proto_goTypes = []interface{}{
(*ReplyQueryProposalComment)(nil), // 14: types.ReplyQueryProposalComment (*ReplyQueryProposalComment)(nil), // 14: types.ReplyQueryProposalComment
(*RuleConfig)(nil), // 15: types.RuleConfig (*RuleConfig)(nil), // 15: types.RuleConfig
(*VoteResult)(nil), // 16: types.VoteResult (*VoteResult)(nil), // 16: types.VoteResult
(AutonomyVoteOption)(0), // 17: types.AutonomyVoteOption
} }
var file_rule_proto_depIdxs = []int32{ var file_rule_proto_depIdxs = []int32{
1, // 0: types.AutonomyProposalRule.propRule:type_name -> types.ProposalRule 1, // 0: types.AutonomyProposalRule.propRule:type_name -> types.ProposalRule
15, // 1: types.AutonomyProposalRule.curRule:type_name -> types.RuleConfig 15, // 1: types.AutonomyProposalRule.curRule:type_name -> types.RuleConfig
16, // 2: types.AutonomyProposalRule.voteResult:type_name -> types.VoteResult 16, // 2: types.AutonomyProposalRule.voteResult:type_name -> types.VoteResult
15, // 3: types.ProposalRule.ruleCfg:type_name -> types.RuleConfig 15, // 3: types.ProposalRule.ruleCfg:type_name -> types.RuleConfig
0, // 4: types.ReceiptProposalRule.prev:type_name -> types.AutonomyProposalRule 17, // 4: types.VoteProposalRule.vote:type_name -> types.AutonomyVoteOption
0, // 5: types.ReceiptProposalRule.current:type_name -> types.AutonomyProposalRule 0, // 5: types.ReceiptProposalRule.prev:type_name -> types.AutonomyProposalRule
0, // 6: types.LocalProposalRule.propRule:type_name -> types.AutonomyProposalRule 0, // 6: types.ReceiptProposalRule.current:type_name -> types.AutonomyProposalRule
0, // 7: types.ReplyQueryProposalRule.propRules:type_name -> types.AutonomyProposalRule 0, // 7: types.LocalProposalRule.propRule:type_name -> types.AutonomyProposalRule
10, // 8: types.ReceiptProposalComment.cmt:type_name -> types.Comment 0, // 8: types.ReplyQueryProposalRule.propRules:type_name -> types.AutonomyProposalRule
13, // 9: types.ReplyQueryProposalComment.rltCmt:type_name -> types.RelationCmt 10, // 9: types.ReceiptProposalComment.cmt:type_name -> types.Comment
10, // [10:10] is the sub-list for method output_type 13, // 10: types.ReplyQueryProposalComment.rltCmt:type_name -> types.RelationCmt
10, // [10:10] is the sub-list for method input_type 11, // [11:11] is the sub-list for method output_type
10, // [10:10] is the sub-list for extension type_name 11, // [11:11] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension extendee 11, // [11:11] is the sub-list for extension type_name
0, // [0:10] is the sub-list for field type_name 11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
} }
func init() { file_rule_proto_init() } func init() { file_rule_proto_init() }
......
...@@ -12,6 +12,11 @@ import ( ...@@ -12,6 +12,11 @@ import (
var name string var name string
var (
//ForkAutonomyDelRule fork for delete boards member rules
ForkAutonomyDelRule = "ForkAutonomyDelRule"
)
func init() { func init() {
name = AutonomyX name = AutonomyX
types.AllowUserExec = append(types.AllowUserExec, []byte(name)) types.AllowUserExec = append(types.AllowUserExec, []byte(name))
...@@ -22,6 +27,7 @@ func init() { ...@@ -22,6 +27,7 @@ func init() {
//InitFork ... //InitFork ...
func InitFork(cfg *types.Chain33Config) { func InitFork(cfg *types.Chain33Config) {
cfg.RegisterDappFork(AutonomyX, "Enable", 0) cfg.RegisterDappFork(AutonomyX, "Enable", 0)
cfg.RegisterDappFork(AutonomyX, ForkAutonomyDelRule, 9500000)
} }
//InitExecutor ... //InitExecutor ...
......
...@@ -399,6 +399,7 @@ ForkUnfreezeIDX= 0 ...@@ -399,6 +399,7 @@ ForkUnfreezeIDX= 0
[fork.sub.autonomy] [fork.sub.autonomy]
Enable=0 Enable=0
ForkAutonomyDelRule=0
[fork.sub.jsvm] [fork.sub.jsvm]
Enable=0 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