Commit 07fca01d authored by QM's avatar QM Committed by vipwzw

repair issue 968

parent 1310ccf2
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# shellcheck disable=SC2128 # shellcheck disable=SC2128
# shellcheck source=/dev/null # shellcheck source=/dev/null
source ../dapp-test-common.sh source ../dapp-test-common.sh
set -x
HTTP="" HTTP=""
...@@ -15,7 +16,10 @@ propAddr="15VUiygdxMSZ3rykwe742yomp2cPJ9Tfve" ...@@ -15,7 +16,10 @@ propAddr="15VUiygdxMSZ3rykwe742yomp2cPJ9Tfve"
votePrKey="1c3e6cac2f887e1ab9180e2d5772dc4ba01accb8d4df434faba097003eb35482" votePrKey="1c3e6cac2f887e1ab9180e2d5772dc4ba01accb8d4df434faba097003eb35482"
voteAddr="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx" voteAddr="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx"
proposalID="" proposalRuleID=""
proposalBoardID=""
proposalProjectID=""
proposalChangeID=""
boardsAddr=( boardsAddr=(
"1N578zmVzVR7RxLfnp7XAeDmAy499Jw3q2" "1N578zmVzVR7RxLfnp7XAeDmAy499Jw3q2"
...@@ -116,6 +120,15 @@ handleBoards() { ...@@ -116,6 +120,15 @@ handleBoards() {
done done
} }
txQuery () {
ty=$(curl -ksd '{"method":"Chain33.QueryTransaction","params":[{"hash":"'"$RAW_TX_HASH"'"}]}' "${HTTP}" | jq -r ".result.receipt.ty")
if [[ ${ty} != 2 ]]; then
txQueryShow=$(curl -ksd '{"method":"Chain33.QueryTransaction","params":[{"hash":"'"$RAW_TX_HASH"'"}]}' "${HTTP}" | jq -r ".result")
echo "$txQueryShow"
echo_rst "$1 query_tx" 1
fi
}
proposalBoardTx() { proposalBoardTx() {
local start=$1 local start=$1
local end=$2 local end=$2
...@@ -123,9 +136,9 @@ proposalBoardTx() { ...@@ -123,9 +136,9 @@ proposalBoardTx() {
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}"
proposalID=$RAW_TX_HASH proposalBoardID=$RAW_TX_HASH
echo "$proposalID" echo "proposalBoardID = $proposalBoardID"
echo_rst "proposalBoard query_tx" "$?" txQuery "$FUNCNAME"
} }
voteBoardTx() { voteBoardTx() {
...@@ -136,7 +149,7 @@ voteBoardTx() { ...@@ -136,7 +149,7 @@ voteBoardTx() {
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"
echo_rst "voteBoard query_tx" "$?" txQuery "$FUNCNAME"
} }
revokeProposalTx() { revokeProposalTx() {
...@@ -147,7 +160,7 @@ revokeProposalTx() { ...@@ -147,7 +160,7 @@ revokeProposalTx() {
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"
echo_rst "revoke Proposal $funcName query_tx" "$?" txQuery "$FUNCNAME"
} }
terminateProposalTx() { terminateProposalTx() {
...@@ -158,7 +171,7 @@ terminateProposalTx() { ...@@ -158,7 +171,7 @@ terminateProposalTx() {
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"
echo_rst "terminate Proposal $funcName query_tx" "$?" txQuery "$FUNCNAME"
} }
queryProposal() { queryProposal() {
...@@ -188,24 +201,24 @@ queryActivePropBoard() { ...@@ -188,24 +201,24 @@ queryActivePropBoard() {
testProposalBoard() { testProposalBoard() {
#proposal #proposal
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 10)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 20 + 720)) end=$((start + 20 + 720))
proposalBoardTx ${start} ${end} proposalBoardTx ${start} ${end}
#vote #vote
chain33_BlockWait 10 "$HTTP" chain33_BlockWait 100 "$HTTP"
voteBoardTx "${proposalID}" "${votePrKey}" voteBoardTx "${proposalBoardID}" "${votePrKey}"
#query #query
queryProposal "${proposalID}" "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 "${proposalID}" "RvkPropBoard" revokeProposalTx "${proposalBoardID}" "RvkPropBoard"
terminateProposalTx "${proposalID}" "TmintPropBoard" queryProposal "${proposalBoardID}" "GetProposalBoard"
queryProposal "${proposalID}" "GetProposalBoard"
listProposal 2 "ListProposalBoard" listProposal 2 "ListProposalBoard"
} }
...@@ -217,9 +230,9 @@ proposalRuleTx() { ...@@ -217,9 +230,9 @@ proposalRuleTx() {
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}"
proposalID=$RAW_TX_HASH proposalRuleID=$RAW_TX_HASH
echo "$proposalID" echo "proposalRuleID = $proposalRuleID"
echo_rst "proposalRule query_tx" "$?" txQuery "$FUNCNAME"
} }
voteRuleTx() { voteRuleTx() {
...@@ -230,7 +243,7 @@ voteRuleTx() { ...@@ -230,7 +243,7 @@ voteRuleTx() {
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"
echo_rst "voteRule query_tx" "$?" txQuery "$FUNCNAME"
} }
queryActivePropRule() { queryActivePropRule() {
...@@ -242,24 +255,24 @@ queryActivePropRule() { ...@@ -242,24 +255,24 @@ queryActivePropRule() {
testProposalRule() { testProposalRule() {
# proposal # proposal
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 10)) 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 10 "$HTTP" chain33_BlockWait 100 "$HTTP"
voteRuleTx "${proposalID}" ${votePrKey} voteRuleTx "${proposalRuleID}" ${votePrKey}
#query #query
queryProposal "${proposalID}" "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 "${proposalID}" "RvkPropRule" revokeProposalTx "${proposalRuleID}" "RvkPropRule"
terminateProposalTx "${proposalID}" "TmintPropRule" queryProposal "${proposalRuleID}" "GetProposalRule"
queryProposal "${proposalID}" "GetProposalRule"
listProposal 2 "ListProposalRule" listProposal 2 "ListProposalRule"
} }
...@@ -272,9 +285,9 @@ proposalProjectTx() { ...@@ -272,9 +285,9 @@ proposalProjectTx() {
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}"
proposalID=$RAW_TX_HASH proposalProjectID=$RAW_TX_HASH
echo "$proposalID" echo "proposalProjectID = $proposalProjectID"
echo_rst "proposalRule query_tx" "$?" txQuery "$FUNCNAME"
} }
voteProjectTx() { voteProjectTx() {
...@@ -285,31 +298,30 @@ voteProjectTx() { ...@@ -285,31 +298,30 @@ voteProjectTx() {
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"
echo_rst "voteRule query_tx" "$?" txQuery "$FUNCNAME"
} }
testProposalProject() { testProposalProject() {
# proposal # proposal
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 10)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 20 + 720)) end=$((start + 20 + 720))
proposalProjectTx ${start} ${end} 100000000 ${propAddr} proposalProjectTx ${start} ${end} 100000000 ${propAddr}
chain33_BlockWait 10 "$HTTP" chain33_BlockWait 100 "$HTTP"
#vote #vote
for ((i = 0; i < 11; i++)); do for ((i = 0; i < 11; i++)); do
voteProjectTx "${proposalID}" "${boardsPrKey[$i]}" voteProjectTx "${proposalProjectID}" "${boardsPrKey[$i]}"
done done
#query #query
queryProposal "${proposalID}" "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 "${proposalID}" "RvkPropProject" revokeProposalTx "${proposalProjectID}" "RvkPropProject"
terminateProposalTx "${proposalID}" "TmintPropProject" queryProposal "${proposalProjectID}" "GetProposalProject"
queryProposal "${proposalID}" "GetProposalProject"
listProposal 2 "ListProposalProject" listProposal 2 "ListProposalProject"
} }
...@@ -322,9 +334,9 @@ proposalChangeTx() { ...@@ -322,9 +334,9 @@ proposalChangeTx() {
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}"
proposalID=$RAW_TX_HASH proposalChangeID=$RAW_TX_HASH
echo "$proposalID" echo "proposalChangeID = $proposalChangeID"
echo_rst "proposalChange query_tx" "$?" txQuery "$FUNCNAME"
} }
voteChangeTx() { voteChangeTx() {
...@@ -335,34 +347,84 @@ voteChangeTx() { ...@@ -335,34 +347,84 @@ voteChangeTx() {
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"
echo_rst "voteRule query_tx" "$?" txQuery "$FUNCNAME"
} }
testProposalChange() { testProposalChange() {
# proposal # proposal
chain33_LastBlockHeight ${HTTP} chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 10)) start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 20 + 720)) end=$((start + 20 + 720))
proposalChangeTx ${start} ${end} "${boardsAddr[20]}" true proposalChangeTx ${start} ${end} "${boardsAddr[20]}" true
chain33_BlockWait 10 "$HTTP" chain33_BlockWait 100 "$HTTP"
#vote #vote
for ((i = 0; i < 14; i++)); do for ((i = 0; i < 11; i++)); do
voteChangeTx "${proposalID}" "${boardsPrKey[$i]}" voteChangeTx "${proposalChangeID}" "${boardsPrKey[$i]}"
done done
#query #query
queryProposal "${proposalID}" "GetProposalChange" queryProposal "${proposalChangeID}" "GetProposalChange"
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[20]}" false
revokeProposalTx "${proposalID}" "RvkPropChange" revokeProposalTx "${proposalChangeID}" "RvkPropChange"
terminateProposalTx "${proposalID}" "TmintPropChange" queryProposal "${proposalChangeID}" "GetProposalChange"
queryProposal "${proposalID}" "GetProposalChange"
listProposal 2 "ListProposalChange" listProposal 2 "ListProposalChange"
} }
testProposalTerminate() {
#test terminate
chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720))
proposalRuleTx ${start} ${end} 2000000000
chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720))
proposalBoardTx ${start} ${end}
chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720))
proposalProjectTx ${start} ${end} 100000000 ${propAddr}
chain33_LastBlockHeight ${HTTP}
start=$((LAST_BLOCK_HEIGHT + 100))
end=$((start + 120 + 720))
proposalChangeTx ${start} ${end} "${boardsAddr[20]}" false
chain33_BlockWait 940 "$HTTP"
terminateProposalTx "${proposalRuleID}" "TmintPropRule"
queryProposal "${proposalRuleID}" "GetProposalRule"
listProposal 4 "ListProposalRule"
terminateProposalTx "${proposalBoardID}" "TmintPropBoard"
queryProposal "${proposalBoardID}" "GetProposalBoard"
listProposal 4 "ListProposalBoard"
terminateProposalTx "${proposalProjectID}" "TmintPropProject"
queryProposal "${proposalProjectID}" "GetProposalProject"
listProposal 5 "ListProposalProject"
terminateProposalTx "${proposalChangeID}" "TmintPropChange"
queryProposal "${proposalChangeID}" "GetProposalChange"
listProposal 4 "ListProposalChange"
}
function run_testcases() {
echo "run_testcases"
testProposalRule
testProposalBoard
testProposalProject
testProposalChange
testProposalTerminate
}
init() { init() {
ispara=$(echo '"'"${HTTP}"'"' | jq '.|contains("8901")') ispara=$(echo '"'"${HTTP}"'"' | jq '.|contains("8901")')
echo "ipara=$ispara" echo "ipara=$ispara"
...@@ -413,14 +475,6 @@ init() { ...@@ -413,14 +475,6 @@ init() {
handleBoards "$HTTP" handleBoards "$HTTP"
} }
function run_testcases() {
echo "run_testcases"
testProposalRule
testProposalBoard
testProposalProject
testProposalChange
}
function rpc_test() { function rpc_test() {
chain33_RpcTestBegin autonomy chain33_RpcTestBegin autonomy
...@@ -438,7 +492,6 @@ function rpc_test() { ...@@ -438,7 +492,6 @@ function rpc_test() {
fi fi
chain33_RpcTestRst autonomy "$CASE_ERR" chain33_RpcTestRst autonomy "$CASE_ERR"
} }
chain33_debug_function rpc_test "$1" chain33_debug_function rpc_test "$1"
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