Commit 16a6af19 authored by QM's avatar QM

update

parent ce1f3c5f
...@@ -125,10 +125,6 @@ function base_init() { ...@@ -125,10 +125,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
......
...@@ -10,8 +10,6 @@ source "./publicTest.sh" ...@@ -10,8 +10,6 @@ source "./publicTest.sh"
{ {
propKey="0xfd0c4a8a1efcd221ee0f36b7d4f57d8ff843cb8bc193b39c7863332d355acafa" propKey="0xfd0c4a8a1efcd221ee0f36b7d4f57d8ff843cb8bc193b39c7863332d355acafa"
propAddr="15VUiygdxMSZ3rykwe742yomp2cPJ9Tfve" propAddr="15VUiygdxMSZ3rykwe742yomp2cPJ9Tfve"
#votePrKey="1c3e6cac2f887e1ab9180e2d5772dc4ba01accb8d4df434faba097003eb35482"
#voteAddr="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx"
votePrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" #14KEKbYtKKQm4wMthSK9J4La4nAiidGozt votePrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" #14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
......
...@@ -10,8 +10,7 @@ RED='\033[1;31m' ...@@ -10,8 +10,7 @@ RED='\033[1;31m'
GRE='\033[1;32m' GRE='\033[1;32m'
NOC='\033[0m' NOC='\033[0m'
# 出错退出前拷贝日志文件 function exit_test() {
function exit_cp_file() {
exit 1 exit 1
} }
...@@ -21,95 +20,6 @@ function get_docker_addr() { ...@@ -21,95 +20,6 @@ function get_docker_addr() {
echo "${dockerAddr}" echo "${dockerAddr}"
} }
# 杀死进程ebrelayer 进程 $1进程名称
function kill_ebrelayer() {
# shellcheck disable=SC2009
ps -ef | grep "${1}"
# shellcheck disable=SC2009
pid=$(ps -ef | grep "${1}" | grep -v 'grep' | awk '{print $2}' | xargs)
if [ "${pid}" == "" ]; then
echo "not find ${1} pid"
return
fi
kill -9 "${pid}"
sleep 1
# shellcheck disable=SC2009
pid=$(ps -ef | grep "${1}" | grep -v 'grep' | awk '{print $2}' | xargs)
if [ "${pid}" != "" ]; then
echo "kill ${1} failed"
kill -9 "${pid}"
fi
sleep 1
}
# 判断结果是否正确
function cli_ret() {
set +x
if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong parameter${NOC}"
exit_cp_file
fi
ok=$(echo "${1}" | jq -r .isOK)
if [[ ${ok} != "true" ]]; then
echo -e "${RED}failed to ${2}${NOC}"
exit_cp_file
fi
local jqMsg=".msg"
if [[ $# -ge 3 ]]; then
jqMsg="${3}"
fi
msg=$(echo "${1}" | jq -r "${jqMsg}")
if [[ $# -eq 4 ]]; then
if [ "$(echo "$msg < $4" | bc)" -eq 1 ] || [ "$(echo "$msg > $4" | bc)" -eq 1 ]; then
echo -e "${RED}The balance is not correct${NOC}"
exit_cp_file
fi
fi
set -x
echo "${msg}"
}
# 判断 chain33 金额是否正确
function balance_ret() {
set +x
if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong parameter${NOC}"
exit_cp_file
fi
local balance=$(echo "${1}" | jq -r ".balance")
if [ "$(echo "$balance < $2" | bc)" -eq 1 ] || [ "$(echo "$balance > $2" | bc)" -eq 1 ]; then
echo -e "${RED}The balance is not correct${NOC}"
exit_cp_file
fi
set -x
echo "${balance}"
}
# 查询关键字所在行然后删除 ${1}文件名称 ${2}关键字
function delete_line() {
line=$(cat -n "${1}" | grep "${2}" | awk '{print $1}' | xargs | awk '{print $1}')
if [ "${line}" ]; then
sed -i "${line}"'d' "${1}" # 删除行
fi
}
# 查询关键字所在行然后删除 ${1}文件名称 ${2}关键字
function delete_line_show() {
local line=$(cat -n "${1}" | grep "${2}" | awk '{print $1}' | xargs | awk '{print $1}')
if [ "${line}" ]; then
sed -i "${line}"'d' "${1}" # 删除行
line=$((line - 1))
fi
echo "${line}"
}
# chain33 区块等待 $1:cli 路径 $2:等待高度 # chain33 区块等待 $1:cli 路径 $2:等待高度
function block_wait() { function block_wait() {
set +x set +x
...@@ -117,7 +27,7 @@ function block_wait() { ...@@ -117,7 +27,7 @@ function block_wait() {
if [[ $# -lt 1 ]]; then if [[ $# -lt 1 ]]; then
echo -e "${RED}wrong block_wait parameter${NOC}" echo -e "${RED}wrong block_wait parameter${NOC}"
exit_cp_file exit_test
fi fi
local cur_height=$(${CLI} block last_header | jq ".height") local cur_height=$(${CLI} block last_header | jq ".height")
...@@ -145,12 +55,12 @@ function check_tx() { ...@@ -145,12 +55,12 @@ function check_tx() {
if [[ $# -lt 2 ]]; then if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong check_tx parameters${NOC}" echo -e "${RED}wrong check_tx parameters${NOC}"
exit_cp_file exit_test
fi fi
if [[ ${2} == "" ]]; then if [[ ${2} == "" ]]; then
echo -e "${RED}wrong check_tx txHash is empty${NOC}" echo -e "${RED}wrong check_tx txHash is empty${NOC}"
exit_cp_file exit_test
fi fi
local count=0 local count=0
...@@ -174,19 +84,7 @@ function check_tx() { ...@@ -174,19 +84,7 @@ function check_tx() {
ty=$(${CLI} tx query -s "${2}" | jq .receipt.ty) ty=$(${CLI} tx query -s "${2}" | jq .receipt.ty)
if [[ ${ty} != 2 ]]; then if [[ ${ty} != 2 ]]; then
echo -e "${RED}check tx error, hash is ${2}${NOC}" echo -e "${RED}check tx error, hash is ${2}${NOC}"
exit_cp_file exit_test
fi
}
function check_number() {
if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong check number parameters${NOC}"
exit_cp_file
fi
if [ "$(echo "$1 < $2" | bc)" -eq 1 ] || [ "$(echo "$1 > $2" | bc)" -eq 1 ]; then
echo -e "${RED}error number, expect ${1}, get ${2}${NOC}"
exit_cp_file
fi fi
} }
...@@ -194,13 +92,13 @@ function check_number() { ...@@ -194,13 +92,13 @@ function check_number() {
function check_addr() { function check_addr() {
if [[ $# -lt 2 ]]; then if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong check number parameters${NOC}" echo -e "${RED}wrong check number parameters${NOC}"
exit_cp_file exit_test
fi fi
addr=$(echo "${1}" | jq -r ".acc.addr") addr=$(echo "${1}" | jq -r ".acc.addr")
if [[ ${addr} != "${2}" ]]; then if [[ ${addr} != "${2}" ]]; then
echo -e "${RED}error addr, expect ${1}, get ${2}${NOC}" echo -e "${RED}error addr, expect ${1}, get ${2}${NOC}"
exit_cp_file exit_test
fi fi
} }
...@@ -209,12 +107,12 @@ function is_equal() { ...@@ -209,12 +107,12 @@ function is_equal() {
set +x set +x
if [[ $# -lt 2 ]]; then if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong parameter${NOC}" echo -e "${RED}wrong parameter${NOC}"
exit_cp_file exit_test
fi fi
if [[ $1 != "$2" ]]; then if [[ $1 != "$2" ]]; then
echo -e "${RED}$1 != ${2}${NOC}" echo -e "${RED}$1 != ${2}${NOC}"
exit_cp_file exit_test
fi fi
set -x set -x
...@@ -225,12 +123,12 @@ function is_not_equal() { ...@@ -225,12 +123,12 @@ function is_not_equal() {
set +x set +x
if [[ $# -lt 2 ]]; then if [[ $# -lt 2 ]]; then
echo -e "${RED}wrong parameter${NOC}" echo -e "${RED}wrong parameter${NOC}"
exit_cp_file exit_test
fi fi
if [[ $1 == "$2" ]]; then if [[ $1 == "$2" ]]; then
echo -e "${RED}$1 == ${2}${NOC}" echo -e "${RED}$1 == ${2}${NOC}"
exit_cp_file exit_test
fi fi
set -x set -x
...@@ -254,18 +152,13 @@ function import_addr() { ...@@ -254,18 +152,13 @@ function import_addr() {
function InitChain33Account() { function InitChain33Account() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
import_addr "${propKey}" "prop" "${propAddr}" 1000 {
# shellcheck disable=SC2154 import_addr "${propKey}" "prop" "${propAddr}" 1000
import_addr "${votePrKey2}" "vote2" "${voteAddr2}" 100 import_addr "${votePrKey2}" "vote2" "${voteAddr2}" 100
# shellcheck disable=SC2154 import_addr "${votePrKey3}" "vote3" "${voteAddr3}" 100
import_addr "${votePrKey3}" "vote3" "${voteAddr3}" 100 import_addr "${changeKey}" "changeTest" "${changeAddr}" 10
# import_addr "${votePrKey}" "vote" "${voteAddr}" 3200 }
# shellcheck disable=SC2154
import_addr "${changeKey}" "changeTest" "${changeAddr}" 10
autonomyAddr=$(${Chain33Cli} exec addr -e autonomy) autonomyAddr=$(${Chain33Cli} exec addr -e autonomy)
hash=$(${Chain33Cli} send coins transfer -a 900 -n test -t "${autonomyAddr}" -k "${propKey}") hash=$(${Chain33Cli} send coins transfer -a 900 -n test -t "${autonomyAddr}" -k "${propKey}")
check_tx "${Chain33Cli}" "${hash}" check_tx "${Chain33Cli}" "${hash}"
......
...@@ -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) {
......
...@@ -184,10 +184,6 @@ func revokeProposalChangeTx(parm *auty.RevokeProposalChange) (*types.Transaction ...@@ -184,10 +184,6 @@ 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)
//chainCfg := types.NewChain33Config(cfgstring)
//chainCfg.SetDappFork("autonomy","Enable",1)
//chainCfg.SetDappFork("autonomy","ForkAutonomyDelRule",100)
//api.On("GetConfig", mock.Anything).Return(chainCfg, nil)
api.On("GetConfig", mock.Anything).Return(chainTestCfg, nil) 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)
...@@ -240,7 +236,6 @@ func voteProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB ...@@ -240,7 +236,6 @@ 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 { if record.appr {
opt.Vote = auty.AutonomyVoteOption_APPROVE opt.Vote = auty.AutonomyVoteOption_APPROVE
...@@ -369,7 +364,6 @@ func voteErrorProposalChange(t *testing.T, env *ExecEnv, exec drivers.Driver, st ...@@ -369,7 +364,6 @@ 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 { if record.appr {
opt.Vote = auty.AutonomyVoteOption_APPROVE opt.Vote = auty.AutonomyVoteOption_APPROVE
......
...@@ -372,7 +372,6 @@ func voteProposalProject(t *testing.T, env *ExecEnv, exec drivers.Driver, stateD ...@@ -372,7 +372,6 @@ 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 { if record.appr {
opt.Vote = auty.AutonomyVoteOption_APPROVE opt.Vote = auty.AutonomyVoteOption_APPROVE
......
...@@ -318,7 +318,6 @@ func voteProposalRule(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB d ...@@ -318,7 +318,6 @@ 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 { if record.appr {
......
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