Commit e05d655b authored by mdj33's avatar mdj33 Committed by vipwzw

added ci modify

parent 3752bba3
......@@ -19,7 +19,7 @@ import (
var (
consensusInterval = 10 //about 1 new block interval
minerInterval = 25 //5s的主块间隔后分叉概率增加,25s可以消除一些分叉回退
minerInterval = 10 //5s的主块间隔后分叉概率增加,10s可以消除一些分叉回退
)
type commitMsgClient struct {
......
......@@ -178,92 +178,6 @@ function para_transfer2exec() {
echo "${hash1}"
}
function para_create_nodegroup_test() {
echo "=========== # para chain create node group ============="
##apply
txhash=$(${PARA_CLI} send para nodegroup -o 1 -a "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -c 5 -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
id=$(${PARA_CLI} tx query -s "${txhash}" | jq -r ".receipt.logs[0].log.current.id")
if [ -z "$id" ]; then
${PARA_CLI} tx query -s "${txhash}"
echo "group id not getted"
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "20.0000" ]; then
echo "apply coinfrozen error balance=$balance"
exit 1
fi
echo "=========== # para chain quit node group ============="
##quit
txhash=$(${PARA_CLI} send para nodegroup -o 3 -i "$id" -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
newid=$(${PARA_CLI} para nodegroup_list -s 3 | jq -r ".ids[0].id")
if [ -z "$newid" ]; then
${PARA_CLI} para nodegroup_list -s 3
echo "quit status error "
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".balance")
if [ "$balance" != "100.0000" ]; then
echo "quit coinfrozen error balance=$balance"
exit 1
fi
}
function para_create_nodegroup() {
para_create_nodegroup_test
echo "=========== # para chain create node group again ============="
##apply
txhash=$(${PARA_CLI} send para nodegroup -o 1 -a "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY,1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -c 5 -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
id=$(${PARA_CLI} tx query -s "${txhash}" | jq -r ".receipt.logs[0].log.current.id")
if [ -z "$id" ]; then
${PARA_CLI} tx query -s "${txhash}"
echo "group id not getted"
exit 1
fi
echo "=========== # para chain approve node group ============="
##approve
txhash=$(${PARA_CLI} send para nodegroup -o 2 -i "$id" -c 5 -k 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
status=$(${PARA_CLI} para nodegroup_status -t user.p.para. | jq -r ".status")
if [ "$status" != 2 ]; then
echo "status not approve status=$status"
exit 1
fi
${PARA_CLI} para nodegroup_addrs -t user.p.para.
echo "=========== # para chain quit node group fail ============="
##quit fail
txhash=$(${PARA_CLI} send para nodegroup -o 3 -i "$id" -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b)
echo "tx=$txhash"
query_tx "${CLI}" "${txhash}"
status=$(${CLI} para nodegroup_status -t user.p.para. | jq -r ".status")
if [ "$status" != 2 ]; then
echo "status quit not approve status=$status"
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "25.0000" ]; then
echo "quit fail coinfrozen error balance=$balance"
exit 1
fi
}
function para_create_manage_nodegroup() {
echo "=========== # para chain send config ============="
......@@ -507,6 +421,178 @@ function para_cross_transfer_withdraw_for_token() {
done
}
function para_create_nodegroup_test() {
echo "=========== # para chain create node group test ============="
##apply
txhash=$(${PARA_CLI} send para nodegroup -o 1 -a "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -c 5 -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
id=$(${PARA_CLI} tx query -s "${txhash}" | jq -r ".receipt.logs[0].log.current.id")
if [ -z "$id" ]; then
${PARA_CLI} tx query -s "${txhash}"
echo "group id not getted"
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "20.0000" ]; then
echo "apply coinfrozen error balance=$balance"
exit 1
fi
echo "=========== # para chain quit node group ============="
##quit
txhash=$(${PARA_CLI} send para nodegroup -o 3 -i "$id" -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
newid=$(${PARA_CLI} para nodegroup_list -s 3 | jq -r ".ids[0].id")
if [ -z "$newid" ]; then
${PARA_CLI} para nodegroup_list -s 3
echo "quit status error "
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".balance")
if [ "$balance" != "100.0000" ]; then
echo "quit coinfrozen error balance=$balance"
exit 1
fi
}
function para_create_nodegroup() {
para_create_nodegroup_test
echo "=========== # para chain create node group again ============="
##apply
txhash=$(${PARA_CLI} send para nodegroup -o 1 -a "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY,1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -c 6 -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
id=$(${PARA_CLI} tx query -s "${txhash}" | jq -r ".receipt.logs[0].log.current.id")
if [ -z "$id" ]; then
${PARA_CLI} tx query -s "${txhash}"
echo "group id not getted"
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "30.0000" ]; then
echo "apply coinfrozen error balance=$balance"
exit 1
fi
echo "=========== # para chain approve node group ============="
##approve
txhash=$(${PARA_CLI} send para nodegroup -o 2 -i "$id" -c 6 -k 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
status=$(${PARA_CLI} para nodegroup_status -t user.p.para. | jq -r ".status")
if [ "$status" != 2 ]; then
echo "status not approve status=$status"
exit 1
fi
${PARA_CLI} para nodegroup_addrs -t user.p.para.
echo "=========== # para chain quit node group fail ============="
##quit fail
txhash=$(${PARA_CLI} send para nodegroup -o 3 -i "$id" -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b)
echo "tx=$txhash"
query_tx "${CLI}" "${txhash}"
status=$(${CLI} para nodegroup_status -t user.p.para. | jq -r ".status")
if [ "$status" != 2 ]; then
echo "status quit not approve status=$status"
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "30.0000" ]; then
echo "quit fail coinfrozen error balance=$balance"
exit 1
fi
echo "=========== # para chain modify node group coin=5 ============="
txhash=$(${PARA_CLI} send para nodegroup -o 4 -c 5 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b)
echo "tx=$txhash"
query_tx "${CLI}" "${txhash}"
modifyid=$(${PARA_CLI} para nodegroup_list -s 4 | jq -r ".ids[0].id")
if [ -z "$modifyid" ]; then
${PARA_CLI} para nodegroup_list -s 4
echo "query modify error "
exit 1
fi
##approve
txhash=$(${PARA_CLI} send para nodegroup -o 2 -i "$modifyid" -c 5 -k 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
id=$(${PARA_CLI} para nodegroup_status -t user.p.para. | jq -r ".id")
if [ "$modifyid" != "$id" ]; then
echo " approve new id wrong"
${PARA_CLI} para nodegroup_status -t user.p.para.
exit 1
fi
coins=$(${PARA_CLI} para nodegroup_status -t user.p.para. | jq -r ".coinsFrozen")
if [ "$coins" != "500000000" ]; then
echo " approve new coins wrong"
${PARA_CLI} para nodegroup_status -t user.p.para.
exit 1
fi
}
function para_nodegroup_behalf_quit_test() {
echo "=========== # para chain behalf node quit ============="
id=$(${PARA_CLI} para node_status -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -t user.p.para. | jq -r ".id")
if [ -z "${id}" ]; then
echo "wrong id "
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1
fi
hash=$(${PARA_CLI} send para node -o 3 -i "$id" -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b)
echo "${hash}"
query_tx "${PARA_CLI}" "${hash}"
status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status")
if [ "${status}" != "3" ]; then
echo "wrong vote status"
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1
fi
${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
hash=$(${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
echo "${hash}"
query_tx "${PARA_CLI}" "${hash}"
status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status")
if [ "${status}" != "4" ]; then
echo "wrong vote status"
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1
fi
node=$(${PARA_CLI} para nodegroup_addrs -t user.p.para. | jq -r '.value|contains("1E5")')
if [ "${node}" == "true" ]; then
echo "wrong node group addr"
${PARA_CLI} para nodegroup_addrs -t user.p.para.
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "24.0000" ]; then
echo "unfrozen coinfrozen error balance=$balance"
exit 1
fi
}
function para_nodemanage_node_join() {
echo "================# para node manage test ================="
balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".balance")
......@@ -535,7 +621,7 @@ function para_nodemanage_node_behalf_join() {
query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "28.0000" ]; then
if [ "$balance" != "32.0000" ]; then
echo "1Ka frozen coinfrozen error balance=$balance"
exit 1
fi
......@@ -552,7 +638,7 @@ function para_nodemanage_node_behalf_join() {
query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "37.0000" ]; then
if [ "$balance" != "41.0000" ]; then
echo "frozen coinfrozen error balance=$balance"
exit 1
fi
......@@ -569,7 +655,7 @@ function para_nodemanage_node_behalf_join() {
query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "29.0000" ]; then
if [ "$balance" != "33.0000" ]; then
echo "unfrozen coinfrozen error balance=$balance"
exit 1
fi
......@@ -605,54 +691,6 @@ function para_nodemanage_quit_test() {
}
function para_nodegroup_behalf_quit_test() {
echo "=========== # para chain behalf node quit ============="
id=$(${PARA_CLI} para node_status -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -t user.p.para. | jq -r ".id")
if [ -z "${id}" ]; then
echo "wrong id "
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1
fi
hash=$(${PARA_CLI} send para node -o 3 -i "$id" -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b)
echo "${hash}"
query_tx "${PARA_CLI}" "${hash}"
status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status")
if [ "${status}" != "3" ]; then
echo "wrong vote status"
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1
fi
${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
hash=$(${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
echo "${hash}"
query_tx "${PARA_CLI}" "${hash}"
status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status")
if [ "${status}" != "4" ]; then
echo "wrong vote status"
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1
fi
node=$(${PARA_CLI} para nodegroup_addrs -t user.p.para. | jq -r '.value|contains("1E5")')
if [ "${node}" == "true" ]; then
echo "wrong node group addr"
${PARA_CLI} para nodegroup_addrs -t user.p.para.
exit 1
fi
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "20.0000" ]; then
echo "unfrozen coinfrozen error balance=$balance"
exit 1
fi
}
function para_nodemanage_test() {
para_nodemanage_quit_test
......@@ -767,7 +805,7 @@ function para_nodemanage_test() {
query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
if [ "$balance" != "20.0000" ]; then
if [ "$balance" != "24.0000" ]; then
echo "unfrozen coinfrozen error balance=$balance"
exit 1
fi
......@@ -807,8 +845,6 @@ function paracross() {
elif [ "${2}" == "test" ]; then
para_test "${1}"
# dapp_rpc_test "${3}"
fi
if [ "${2}" == "forkInit" ]; then
......
......@@ -271,8 +271,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
return receipt, nil
}
clog.Error("nodeaccount.nodeJoin key exist", "addr", config.Addr, "status", stat)
return nil, pt.ErrParaNodeAddrExisted
return nil, errors.Wrapf(pt.ErrParaNodeAddrExisted, "nodeAddr existed:%s,status:%d", config.Addr,stat.Status)
}
......@@ -649,8 +648,7 @@ func (a *action) nodeGroupCoinsActive(createAddr string, configCoinsFrozen int64
func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
addrs := getConfigAddrs(config.Addrs)
if len(addrs) == 0 {
clog.Error("node group apply addrs null", "addrs", config.Addrs)
return nil, types.ErrInvalidParam
return nil, errors.Wrapf(types.ErrInvalidParam, "node group apply addrs null:%s", config.Addrs)
}
receipt := &types.Receipt{Ty: types.ExecOk}
......@@ -711,8 +709,7 @@ func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt,
//approved or quited
if status.Status != pt.ParacrossNodeGroupApply {
clog.Error("node group apply not apply", "status", status.Status)
return nil, pt.ErrParaNodeGroupStatusWrong
return nil, errors.Wrapf(pt.ErrParaNodeGroupStatusWrong, "node group apply not apply:%d", status.Status)
}
applyAddrs := strings.Split(status.TargetAddrs, ",")
......@@ -747,8 +744,7 @@ func (a *action) nodeGroupApproveModify(config *pt.ParaNodeGroupConfig, modify *
//approve modify case
if modify.CoinsFrozen < config.CoinsFrozen {
clog.Error("nodeGroupApprove id not enough coins", "id.coins", modify.CoinsFrozen, "config.coins", config.CoinsFrozen)
return nil, pt.ErrParaNodeGroupFrozenCoinsNotEnough
return nil, errors.Wrapf(pt.ErrParaNodeGroupFrozenCoinsNotEnough, "id not enough coins modify:%d,config:%d", modify.CoinsFrozen,config.CoinsFrozen)
}
receipt := &types.Receipt{Ty: types.ExecOk}
......@@ -784,8 +780,7 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
}
if apply.CoinsFrozen < config.CoinsFrozen {
clog.Error("nodeGroupApprove id not enough coins", "id.coins", apply.CoinsFrozen, "config.coins", config.CoinsFrozen)
return nil, pt.ErrParaNodeGroupFrozenCoinsNotEnough
return nil, errors.Wrapf(pt.ErrParaNodeGroupFrozenCoinsNotEnough, "id not enough coins apply:%d,config:%d", apply.CoinsFrozen,config.CoinsFrozen)
}
receipt := &types.Receipt{Ty: types.ExecOk}
......@@ -814,8 +809,7 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
// NodeGroupApprove super addr approve the node group apply
func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
if !isSuperManager(a.fromaddr) {
clog.Error("node group approve not super manager", "addr", a.fromaddr)
return nil, types.ErrNotAllow
return nil, errors.Wrapf(types.ErrNotAllow, "node group approve not super manager:%s", a.fromaddr)
}
id, err := getNodeGroupID(a.db, config.Id)
......@@ -835,8 +829,7 @@ func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receip
return a.nodeGroupApproveApply(config, id)
}
clog.Error("nodeGroupApprove id wrong status", "status", id.Status, "id", config.Id)
return nil, pt.ErrParaNodeGroupStatusWrong
return nil, errors.Wrapf(pt.ErrParaNodeGroupStatusWrong, "nodeGroupApprove id wrong status:%d,id:%s", id.Status,config.Id)
}
......
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