Commit 48dbbc8b authored by 张振华's avatar 张振华

Merge branch 'master' into guess-rpc-test

parents 16d381fc e3d68c56
...@@ -18,8 +18,8 @@ import ( ...@@ -18,8 +18,8 @@ import (
) )
var ( var (
consensusInterval = 16 //about 1 new block interval consensusInterval = 10 //about 1 new block interval
minerInterval = 5 minerInterval = 10 //5s的主块间隔后分叉概率增加,10s可以消除一些分叉回退
) )
type commitMsgClient struct { type commitMsgClient struct {
......
...@@ -137,7 +137,6 @@ function para_transfer() { ...@@ -137,7 +137,6 @@ function para_transfer() {
block_wait "${CLI}" 2 block_wait "${CLI}" 2
# para_create_manage_nodegroup # para_create_manage_nodegroup
para_create_nodegroup
echo "=========== # config token blacklist =============" echo "=========== # config token blacklist ============="
#token precreate #token precreate
...@@ -179,87 +178,6 @@ function para_transfer2exec() { ...@@ -179,87 +178,6 @@ function para_transfer2exec() {
echo "${hash1}" 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}"
status=$(${PARA_CLI} para nodegroup_status -t user.p.para. | jq -r ".status")
if [ "$status" != 1 ]; then
echo "status not apply status=$status"
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 -a "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -c 5 -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "tx=$txhash"
query_tx "${PARA_CLI}" "${txhash}"
status=$(${PARA_CLI} para nodegroup_status -t user.p.para. | jq -r ".status")
if [ "$status" != 3 ]; then
echo "status not quit status=$status"
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}"
status=$(${PARA_CLI} para nodegroup_status -t user.p.para. | jq -r ".status")
if [ "$status" != 1 ]; then
echo "status not apply status=$status"
exit 1
fi
echo "=========== # para chain approve node group ============="
##approve
txhash=$(${PARA_CLI} send para nodegroup -o 2 -a "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY,1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4, 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR, 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k, 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs," -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 -a "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY,1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -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() { function para_create_manage_nodegroup() {
echo "=========== # para chain send config =============" echo "=========== # para chain send config ============="
para_configkey "${CLI}" "paracross-nodes-user.p.${PARANAME}." "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4" para_configkey "${CLI}" "paracross-nodes-user.p.${PARANAME}." "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
...@@ -396,7 +314,7 @@ function para_cross_transfer_withdraw() { ...@@ -396,7 +314,7 @@ function para_cross_transfer_withdraw() {
sleep 15 sleep 15
${CLI} send para asset_withdraw --title user.p.para. -a 0.7 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01 ${CLI} send para asset_withdraw --title user.p.para. -a 0.7 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01
local times=100 local times=200
while true; do while true; do
acc=$(${CLI} account balance -e paracross -a 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq -r ".balance") acc=$(${CLI} account balance -e paracross -a 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq -r ".balance")
echo "account balance is ${acc}, expect 9.3 " echo "account balance is ${acc}, expect 9.3 "
...@@ -502,6 +420,180 @@ function para_cross_transfer_withdraw_for_token() { ...@@ -502,6 +420,180 @@ function para_cross_transfer_withdraw_for_token() {
done 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
echo "query modify error "
${PARA_CLI} para nodegroup_list -s 4
modifyid=$(${PARA_CLI} tx query -s "${txhash}" | jq -r ".receipt.logs[0].log.current.id")
if [ -z "$modifyid" ]; then
${PARA_CLI} tx query -s "${txhash}"
echo "group id not getted"
exit 1
fi
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() { function para_nodemanage_node_join() {
echo "================# para node manage test =================" echo "================# para node manage test ================="
balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".balance") balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".balance")
...@@ -511,7 +603,7 @@ function para_nodemanage_node_join() { ...@@ -511,7 +603,7 @@ function para_nodemanage_node_join() {
fi fi
echo "=========== # para chain new node join =============" echo "=========== # para chain new node join ============="
hash=$(${PARA_CLI} send para node -o join -c 5 -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588) hash=$(${PARA_CLI} send para node -o 1 -c 5 -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
...@@ -525,12 +617,12 @@ function para_nodemanage_node_join() { ...@@ -525,12 +617,12 @@ function para_nodemanage_node_join() {
function para_nodemanage_node_behalf_join() { function para_nodemanage_node_behalf_join() {
echo "=========== # para chain new node join 1 =============" echo "=========== # para chain new node join 1 ============="
hash=$(${PARA_CLI} send para node -o join -c 8 -a 1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5) hash=$(${PARA_CLI} send para node -o 1 -c 8 -a 1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen") 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" echo "1Ka frozen coinfrozen error balance=$balance"
exit 1 exit 1
fi fi
...@@ -542,23 +634,29 @@ function para_nodemanage_node_behalf_join() { ...@@ -542,23 +634,29 @@ function para_nodemanage_node_behalf_join() {
fi fi
echo "=========== # para chain new node join 2=============" echo "=========== # para chain new node join 2============="
hash=$(${PARA_CLI} send para node -o join -c 9 -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5) hash=$(${PARA_CLI} send para node -o 1 -c 9 -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen") 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" echo "frozen coinfrozen error balance=$balance"
exit 1 exit 1
fi fi
echo "=========== # para chain node 1 quit =============" echo "=========== # para chain node 1 quit ============="
hash=$(${PARA_CLI} send para node -o quit -a 1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH -k 0xfdf2bbff853ecff2e7b86b2a8b45726c6538ca7d1403dc94e50131ef379bdca0) id=$(${PARA_CLI} para node_status -a 1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH -t user.p.para. | jq -r ".id")
if [ -z "${id}" ]; then
echo "wrong id "
${PARA_CLI} para node_status -t user.p.para. -a 1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH
exit 1
fi
hash=$(${PARA_CLI} send para node -o 3 -i "$id" -k 0xfdf2bbff853ecff2e7b86b2a8b45726c6538ca7d1403dc94e50131ef379bdca0)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen") 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" echo "unfrozen coinfrozen error balance=$balance"
exit 1 exit 1
fi fi
...@@ -569,45 +667,22 @@ function para_nodemanage_quit_test() { ...@@ -569,45 +667,22 @@ function para_nodemanage_quit_test() {
para_nodemanage_node_join para_nodemanage_node_join
echo "=========== # para chain node quit =============" echo "=========== # para chain node quit ============="
hash=$(${PARA_CLI} send para node -o quit -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588) id=$(${PARA_CLI} para node_status -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -t user.p.para. | jq -r ".id")
echo "${hash}" if [ -z "${id}" ]; then
query_tx "${PARA_CLI}" "${hash}" echo "wrong id "
balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".frozen")
if [ "$balance" == "$PARA_COIN_FROZEN" ]; then
echo "unfrozen coinfrozen error balance=$balance"
exit 1
fi
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 ${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1 exit 1
fi fi
hash=$(${PARA_CLI} send para node -o 3 -i "$id" -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
}
function para_nodegroup_behalf_quit_test() {
echo "=========== # para chain behalf node quit ============="
hash=$(${PARA_CLI} send para node -o quit -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status") balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".frozen")
if [ "${status}" != "3" ]; then if [ "$balance" == "$PARA_COIN_FROZEN" ]; then
echo "wrong vote status" echo "unfrozen coinfrozen error balance=$balance"
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1 exit 1
fi fi
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
hash=$(${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
echo "${hash}"
query_tx "${PARA_CLI}" "${hash}"
status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status") status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status")
if [ "${status}" != "4" ]; then if [ "${status}" != "4" ]; then
echo "wrong vote status" echo "wrong vote status"
...@@ -615,19 +690,6 @@ function para_nodegroup_behalf_quit_test() { ...@@ -615,19 +690,6 @@ function para_nodegroup_behalf_quit_test() {
exit 1 exit 1
fi 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() { function para_nodemanage_test() {
...@@ -635,9 +697,15 @@ function para_nodemanage_test() { ...@@ -635,9 +697,15 @@ function para_nodemanage_test() {
para_nodemanage_node_join para_nodemanage_node_join
echo "=========== # para chain node vote =============" echo "=========== # para chain node vote ============="
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b id=$(${PARA_CLI} para node_status -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -t user.p.para. | jq -r ".id")
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4 if [ -z "${id}" ]; then
hash=$(${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115) echo "wrong id "
${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
hash=$(${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
...@@ -656,11 +724,11 @@ function para_nodemanage_test() { ...@@ -656,11 +724,11 @@ function para_nodemanage_test() {
fi fi
echo "=========== # para chain node quit =============" echo "=========== # para chain node quit ============="
hash=$(${PARA_CLI} send para node -o quit -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588) hash=$(${PARA_CLI} send para node -o 3 -i "$id" -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
status=$(${PARA_CLI} para node_list -t user.p.para. -s 3 | jq -r ".addrs[0].applyAddr") status=$(${PARA_CLI} para node_list -t user.p.para. -s 3 | jq -r ".ids[0].targetAddr")
if [ "${status}" != "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY" ]; then if [ "${status}" != "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY" ]; then
echo "wrong join status" echo "wrong join status"
${PARA_CLI} para node_list -t user.p.para. -s 3 ${PARA_CLI} para node_list -t user.p.para. -s 3
...@@ -668,10 +736,10 @@ function para_nodemanage_test() { ...@@ -668,10 +736,10 @@ function para_nodemanage_test() {
fi fi
echo "=========== # para chain node vote quit =============" echo "=========== # para chain node vote quit ============="
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b ${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4 ${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588 ${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
hash=$(${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115) hash=$(${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
...@@ -697,10 +765,15 @@ function para_nodemanage_test() { ...@@ -697,10 +765,15 @@ function para_nodemanage_test() {
echo "=========== # para chain behalf node vote test =============" echo "=========== # para chain behalf node vote test ============="
para_nodemanage_node_behalf_join para_nodemanage_node_behalf_join
id=$(${PARA_CLI} para node_status -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -t user.p.para. | jq -r ".id")
${PARA_CLI} send para node -o vote -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -v yes -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b if [ -z "${id}" ]; then
${PARA_CLI} send para node -o vote -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -v yes -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4 echo "wrong id "
hash=$(${PARA_CLI} send para node -o vote -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -v yes -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115) ${PARA_CLI} para node_status -t user.p.para. -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
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
hash=$(${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
...@@ -719,20 +792,20 @@ function para_nodemanage_test() { ...@@ -719,20 +792,20 @@ function para_nodemanage_test() {
fi fi
echo "=========== # para chain node quit =============" echo "=========== # para chain node quit ============="
hash=$(${PARA_CLI} send para node -o quit -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -k 0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d) hash=$(${PARA_CLI} send para node -o 3 -i "$id" -k 0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
echo "=========== # para chain node vote quit =============" echo "=========== # para chain node vote quit ============="
${PARA_CLI} send para node -o vote -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -v yes -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b ${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${PARA_CLI} send para node -o vote -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -v yes -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4 ${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
${PARA_CLI} send para node -o vote -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -v yes -k 0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d ${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d
hash=$(${PARA_CLI} send para node -o vote -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -v yes -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115) hash=$(${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
echo "${hash}" echo "${hash}"
query_tx "${PARA_CLI}" "${hash}" query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen") 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" echo "unfrozen coinfrozen error balance=$balance"
exit 1 exit 1
fi fi
...@@ -754,6 +827,7 @@ function para_nodemanage_test() { ...@@ -754,6 +827,7 @@ function para_nodemanage_test() {
function para_test() { function para_test() {
echo "=========== # para chain test =============" echo "=========== # para chain test ============="
para_create_nodegroup
para_nodegroup_behalf_quit_test para_nodegroup_behalf_quit_test
para_nodemanage_test para_nodemanage_test
token_create "${PARA_CLI}" token_create "${PARA_CLI}"
...@@ -771,7 +845,6 @@ function paracross() { ...@@ -771,7 +845,6 @@ function paracross() {
elif [ "${2}" == "test" ]; then elif [ "${2}" == "test" ]; then
para_test "${1}" para_test "${1}"
dapp_rpc_test "${3}"
fi fi
if [ "${2}" == "forkInit" ]; then if [ "${2}" == "forkInit" ]; then
......
...@@ -251,36 +251,25 @@ func CreateRawNodeManageCmd() *cobra.Command { ...@@ -251,36 +251,25 @@ func CreateRawNodeManageCmd() *cobra.Command {
} }
func addNodeManageFlags(cmd *cobra.Command) { func addNodeManageFlags(cmd *cobra.Command) {
cmd.Flags().StringP("operation", "o", "", "operation:join,quit,vote") cmd.Flags().Uint32P("operation", "o", 0, "operation:1:join,2:vote,3:quit")
cmd.MarkFlagRequired("operation") cmd.MarkFlagRequired("operation")
cmd.Flags().StringP("addr", "a", "", "operating target addr") cmd.Flags().StringP("addr", "a", "", "operating target addr")
cmd.MarkFlagRequired("addrs")
cmd.Flags().StringP("value", "v", "", "vote value: yes,no") cmd.Flags().StringP("id", "i", "", "operating target id")
cmd.Flags().Float64P("coins_frozen", "c", 0, "join to frozen coins amount, not less config")
cmd.Flags().Uint32P("value", "v", 1, "vote value: 1:yes,2:no")
cmd.Flags().Float64P("coins_frozen", "c", 0, "frozen coins amount, should not less nodegroup's")
} }
func createNodeTx(cmd *cobra.Command, args []string) { func createNodeTx(cmd *cobra.Command, args []string) {
op, _ := cmd.Flags().GetString("operation") op, _ := cmd.Flags().GetUint32("operation")
opAddr, _ := cmd.Flags().GetString("addr") opAddr, _ := cmd.Flags().GetString("addr")
val, _ := cmd.Flags().GetString("value") id, _ := cmd.Flags().GetString("id")
val, _ := cmd.Flags().GetUint32("value")
coins, _ := cmd.Flags().GetFloat64("coins_frozen") coins, _ := cmd.Flags().GetFloat64("coins_frozen")
if op != "vote" && op != "quit" && op != "join" { payload := &pt.ParaNodeAddrConfig{Op: op, Id: id, Value: val, Addr: opAddr, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
fmt.Println("operation should be one of join,quit,vote")
return
}
if opAddr == "" {
fmt.Println("addr parameter should not be null")
return
}
if op == "vote" && (val != "yes" && val != "no") {
fmt.Println("vote operation value parameter require yes or no value")
return
}
payload := &pt.ParaNodeAddrConfig{Op: op, Value: val, Addr: opAddr, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{ params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pt.ParaX), Execer: types.ExecName(pt.ParaX),
ActionName: "NodeConfig", ActionName: "NodeConfig",
...@@ -305,11 +294,12 @@ func CreateNodeGroupApplyCmd() *cobra.Command { ...@@ -305,11 +294,12 @@ func CreateNodeGroupApplyCmd() *cobra.Command {
} }
func addNodeGroupApplyCmdFlags(cmd *cobra.Command) { func addNodeGroupApplyCmdFlags(cmd *cobra.Command) {
cmd.Flags().Uint32P("operation", "o", 0, "operation:1:apply,2:approve,3:quit") cmd.Flags().Uint32P("operation", "o", 0, "operation:1:apply,2:approve,3:quit,4:modify")
cmd.MarkFlagRequired("operation") cmd.MarkFlagRequired("operation")
cmd.Flags().StringP("id", "i", "", "apply id for nodegroup ")
cmd.Flags().StringP("addrs", "a", "", "addrs apply for super node,split by ',' ") cmd.Flags().StringP("addrs", "a", "", "addrs apply for super node,split by ',' ")
cmd.MarkFlagRequired("addrs")
cmd.Flags().Float64P("coins_frozen", "c", 0, "coins amount to frozen, not less config") cmd.Flags().Float64P("coins_frozen", "c", 0, "coins amount to frozen, not less config")
...@@ -318,18 +308,10 @@ func addNodeGroupApplyCmdFlags(cmd *cobra.Command) { ...@@ -318,18 +308,10 @@ func addNodeGroupApplyCmdFlags(cmd *cobra.Command) {
func nodeGroupApply(cmd *cobra.Command, args []string) { func nodeGroupApply(cmd *cobra.Command, args []string) {
op, _ := cmd.Flags().GetUint32("operation") op, _ := cmd.Flags().GetUint32("operation")
addrs, _ := cmd.Flags().GetString("addrs") addrs, _ := cmd.Flags().GetString("addrs")
id, _ := cmd.Flags().GetString("id")
coins, _ := cmd.Flags().GetFloat64("coins_frozen") coins, _ := cmd.Flags().GetFloat64("coins_frozen")
if op == 0 || op > 3 { payload := &pt.ParaNodeGroupConfig{Op: op, Id: id, Addrs: addrs, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
fmt.Println("operation should be one of 1:apply,2:approve,3:quit")
return
}
if addrs == "" {
fmt.Println("addrs should not be nil")
return
}
payload := &pt.ParaNodeGroupConfig{Op: op, Addrs: addrs, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{ params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pt.ParaX), Execer: types.ExecName(pt.ParaX),
ActionName: "NodeGroupConfig", ActionName: "NodeGroupConfig",
...@@ -486,7 +468,7 @@ func addNodeBodyCmdFlags(cmd *cobra.Command) { ...@@ -486,7 +468,7 @@ func addNodeBodyCmdFlags(cmd *cobra.Command) {
cmd.MarkFlagRequired("title") cmd.MarkFlagRequired("title")
cmd.Flags().StringP("addr", "a", "", "addr apply for super user") cmd.Flags().StringP("addr", "a", "", "addr apply for super user")
cmd.MarkFlagRequired("addr") cmd.Flags().StringP("id", "i", "", "id apply for super user")
} }
...@@ -494,12 +476,14 @@ func nodeInfo(cmd *cobra.Command, args []string) { ...@@ -494,12 +476,14 @@ func nodeInfo(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
title, _ := cmd.Flags().GetString("title") title, _ := cmd.Flags().GetString("title")
addr, _ := cmd.Flags().GetString("addr") addr, _ := cmd.Flags().GetString("addr")
id, _ := cmd.Flags().GetString("id")
params := pt.ReqParacrossNodeInfo{ params := pt.ReqParacrossNodeInfo{
Title: title, Title: title,
Addr: addr, Addr: addr,
Id: id,
} }
var res pt.ParaNodeAddrStatus var res pt.ParaNodeIdStatus
ctx := jsonclient.NewRPCCtx(rpcLaddr, "paracross.GetNodeStatus", params, &res) ctx := jsonclient.NewRPCCtx(rpcLaddr, "paracross.GetNodeStatus", params, &res)
ctx.Run() ctx.Run()
} }
......
...@@ -77,7 +77,7 @@ func getConfigManageNodes(db dbm.KV, title string) (map[string]struct{}, []strin ...@@ -77,7 +77,7 @@ func getConfigManageNodes(db dbm.KV, title string) (map[string]struct{}, []strin
} }
func getParacrossNodes(db dbm.KV, title string) (map[string]struct{}, []string, error) { func getParacrossNodes(db dbm.KV, title string) (map[string]struct{}, []string, error) {
key := calcParaNodeGroupKey(title) key := calcParaNodeGroupAddrsKey(title)
return getNodes(db, key) return getNodes(db, key)
} }
...@@ -418,7 +418,12 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error ...@@ -418,7 +418,12 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
return receipt, nil return receipt, nil
} }
if enableParacrossTransfer && commit.Status.Height > 0 && len(commit.Status.CrossTxHashs) > 0 { haveCrossTxs := len(commit.Status.CrossTxHashs) > 0
if commit.Status.Height > 0 && types.IsDappFork(commit.Status.MainBlockHeight, pt.ParaX, pt.ForkCommitTx) && commit.Status.CrossTxHashs[0] == nil {
haveCrossTxs = false
}
if enableParacrossTransfer && commit.Status.Height > 0 && haveCrossTxs {
clog.Debug("paracross.Commit commitDone", "do cross", "") clog.Debug("paracross.Commit commitDone", "do cross", "")
crossTxReceipt, err := a.execCrossTxs(commit) crossTxReceipt, err := a.execCrossTxs(commit)
if err != nil { if err != nil {
...@@ -459,10 +464,10 @@ func (a *action) execCrossTx(tx *types.TransactionDetail, commit *pt.ParacrossCo ...@@ -459,10 +464,10 @@ func (a *action) execCrossTx(tx *types.TransactionDetail, commit *pt.ParacrossCo
} }
func getCrossTxHashs(api client.QueueProtocolAPI, commit *pt.ParacrossCommitAction) ([][]byte, []byte, error) { func getCrossTxHashs(api client.QueueProtocolAPI, commit *pt.ParacrossCommitAction) ([][]byte, []byte, error) {
crossTxHashs := commit.Status.CrossTxHashs
crossTxResult := commit.Status.CrossTxResult
if types.IsDappFork(commit.Status.MainBlockHeight, pt.ParaX, pt.ForkCommitTx) { if types.IsDappFork(commit.Status.MainBlockHeight, pt.ParaX, pt.ForkCommitTx) {
if len(commit.Status.CrossTxHashs) == 0 { if len(commit.Status.CrossTxHashs) == 0 {
clog.Error("getCrossTxHashs len=0", "paraHeight", commit.Status.Height,
"mainHeight", commit.Status.MainBlockHeight, "mainHash", hex.EncodeToString(commit.Status.MainBlockHash))
return nil, nil, types.ErrCheckTxHash return nil, nil, types.ErrCheckTxHash
} }
blockDetail, err := GetBlock(api, commit.Status.MainBlockHash) blockDetail, err := GetBlock(api, commit.Status.MainBlockHash)
...@@ -479,23 +484,32 @@ func getCrossTxHashs(api client.QueueProtocolAPI, commit *pt.ParacrossCommitActi ...@@ -479,23 +484,32 @@ func getCrossTxHashs(api client.QueueProtocolAPI, commit *pt.ParacrossCommitActi
baseCheckTxHash := CalcTxHashsHash(baseHashs) baseCheckTxHash := CalcTxHashsHash(baseHashs)
crossCheckHash := CalcTxHashsHash(paraCrossHashs) crossCheckHash := CalcTxHashsHash(paraCrossHashs)
if !bytes.Equal(commit.Status.CrossTxHashs[0], crossCheckHash) { if !bytes.Equal(commit.Status.CrossTxHashs[0], crossCheckHash) {
clog.Error("getCrossTxHashs para hash not equal", "main.crossHash", hex.EncodeToString(crossCheckHash), clog.Error("getCrossTxHashs para hash not equal", "paraHeight", commit.Status.Height,
"mainHeight", commit.Status.MainBlockHeight, "mainHash", hex.EncodeToString(commit.Status.MainBlockHash),
"main.crossHash", hex.EncodeToString(crossCheckHash),
"commit.crossHash", hex.EncodeToString(commit.Status.CrossTxHashs[0]), "commit.crossHash", hex.EncodeToString(commit.Status.CrossTxHashs[0]),
"main.baseHash", hex.EncodeToString(baseCheckTxHash), "commit.baseHash", hex.EncodeToString(commit.Status.TxHashs[0])) "main.baseHash", hex.EncodeToString(baseCheckTxHash), "commit.baseHash", hex.EncodeToString(commit.Status.TxHashs[0]))
for _, hash := range baseHashs {
clog.Error("getCrossTxHashs base tx hash", "txhash", hex.EncodeToString(hash))
}
for _, hash := range paraCrossHashs {
clog.Error("getCrossTxHashs paracross tx hash", "txhash", hex.EncodeToString(hash))
}
return nil, nil, types.ErrCheckTxHash return nil, nil, types.ErrCheckTxHash
} }
//只获取跨链tx //只获取跨链tx
crossTxHashs = paraCrossHashs
rst, err := hex.DecodeString(string(commit.Status.CrossTxResult)) rst, err := hex.DecodeString(string(commit.Status.CrossTxResult))
if err != nil { if err != nil {
clog.Error("getCrossTxHashs decode string", "CrossTxResult", string(commit.Status.CrossTxResult), clog.Error("getCrossTxHashs decode string", "CrossTxResult", string(commit.Status.CrossTxResult),
"commit.height", commit.Status.Height) "commit.height", commit.Status.Height)
return nil, nil, types.ErrInvalidParam return nil, nil, types.ErrInvalidParam
} }
crossTxResult = rst
return paraCrossHashs, rst, nil
} }
return crossTxHashs, crossTxResult, nil
return commit.Status.CrossTxHashs, commit.Status.CrossTxResult, nil
} }
func (a *action) execCrossTxs(commit *pt.ParacrossCommitAction) (*types.Receipt, error) { func (a *action) execCrossTxs(commit *pt.ParacrossCommitAction) (*types.Receipt, error) {
......
...@@ -64,11 +64,11 @@ func (e *Paracross) ExecDelLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx * ...@@ -64,11 +64,11 @@ func (e *Paracross) ExecDelLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *
} }
if g.Prev != nil { if g.Prev != nil {
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeTitleStatus(g.Current.Title, g.Current.ApplyAddr, g.Prev.Status), Value: types.Encode(g.Prev)}) Key: calcLocalNodeTitleStatus(g.Current.Title, g.Prev.Status, g.Prev.Id), Value: types.Encode(g.Prev)})
} }
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeTitleStatus(g.Current.Title, g.Current.ApplyAddr, g.Current.Status), Value: nil}) Key: calcLocalNodeTitleStatus(g.Current.Title, g.Current.Status, g.Current.Id), Value: nil})
} else if log.Ty == pt.TyLogParaNodeVoteDone { } else if log.Ty == pt.TyLogParaNodeVoteDone {
var g pt.ReceiptParaNodeVoteDone var g pt.ReceiptParaNodeVoteDone
err := types.Decode(log.Log, &g) err := types.Decode(log.Log, &g)
...@@ -86,8 +86,7 @@ func (e *Paracross) ExecDelLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx * ...@@ -86,8 +86,7 @@ func (e *Paracross) ExecDelLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *
func (e *Paracross) ExecDelLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (e *Paracross) ExecDelLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
var set types.LocalDBSet var set types.LocalDBSet
for _, log := range receiptData.Logs { for _, log := range receiptData.Logs {
if log.Ty == pt.TyLogParaNodeGroupApply || log.Ty == pt.TyLogParaNodeGroupApprove || if log.Ty == pt.TyLogParaNodeGroupConfig {
log.Ty == pt.TyLogParaNodeGroupQuit {
var g pt.ReceiptParaNodeGroupConfig var g pt.ReceiptParaNodeGroupConfig
err := types.Decode(log.Log, &g) err := types.Decode(log.Log, &g)
if err != nil { if err != nil {
...@@ -95,11 +94,11 @@ func (e *Paracross) ExecDelLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig ...@@ -95,11 +94,11 @@ func (e *Paracross) ExecDelLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig
} }
if g.Prev != nil { if g.Prev != nil {
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeGroupStatusTitle(g.Prev.Status, g.Current.Title), Value: types.Encode(g.Prev)}) Key: calcLocalNodeGroupStatusTitle(g.Prev.Status, g.Current.Title, g.Current.Id), Value: types.Encode(g.Prev)})
} }
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeGroupStatusTitle(g.Current.Status, g.Current.Title), Value: nil}) Key: calcLocalNodeGroupStatusTitle(g.Current.Status, g.Current.Title, g.Current.Id), Value: nil})
} }
} }
return &set, nil return &set, nil
......
...@@ -67,11 +67,11 @@ func (e *Paracross) ExecLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *typ ...@@ -67,11 +67,11 @@ func (e *Paracross) ExecLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *typ
} }
if g.Prev != nil { if g.Prev != nil {
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeTitleStatus(g.Current.Title, g.Current.ApplyAddr, g.Prev.Status), Value: nil}) Key: calcLocalNodeTitleStatus(g.Current.Title, g.Prev.Status, g.Current.Id), Value: nil})
} }
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeTitleStatus(g.Current.Title, g.Current.ApplyAddr, g.Current.Status), Key: calcLocalNodeTitleStatus(g.Current.Title, g.Current.Status, g.Current.Id),
Value: types.Encode(g.Current)}) Value: types.Encode(g.Current)})
} else if log.Ty == pt.TyLogParaNodeVoteDone { } else if log.Ty == pt.TyLogParaNodeVoteDone {
var g pt.ReceiptParaNodeVoteDone var g pt.ReceiptParaNodeVoteDone
...@@ -90,8 +90,7 @@ func (e *Paracross) ExecLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *typ ...@@ -90,8 +90,7 @@ func (e *Paracross) ExecLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *typ
func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
var set types.LocalDBSet var set types.LocalDBSet
for _, log := range receiptData.Logs { for _, log := range receiptData.Logs {
if log.Ty == pt.TyLogParaNodeGroupApply || log.Ty == pt.TyLogParaNodeGroupApprove || if log.Ty == pt.TyLogParaNodeGroupConfig {
log.Ty == pt.TyLogParaNodeGroupQuit {
var g pt.ReceiptParaNodeGroupConfig var g pt.ReceiptParaNodeGroupConfig
err := types.Decode(log.Log, &g) err := types.Decode(log.Log, &g)
if err != nil { if err != nil {
...@@ -99,11 +98,11 @@ func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, t ...@@ -99,11 +98,11 @@ func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, t
} }
if g.Prev != nil { if g.Prev != nil {
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeGroupStatusTitle(g.Prev.Status, g.Current.Title), Value: nil}) Key: calcLocalNodeGroupStatusTitle(g.Prev.Status, g.Current.Title, g.Current.Id), Value: nil})
} }
set.KV = append(set.KV, &types.KeyValue{ set.KV = append(set.KV, &types.KeyValue{
Key: calcLocalNodeGroupStatusTitle(g.Current.Status, g.Current.Title), Value: types.Encode(g.Current)}) Key: calcLocalNodeGroupStatusTitle(g.Current.Status, g.Current.Title, g.Current.Id), Value: types.Encode(g.Current)})
} }
} }
return &set, nil return &set, nil
......
...@@ -16,7 +16,9 @@ var ( ...@@ -16,7 +16,9 @@ var (
managerConfigNodes string //manager 合约配置的nodes managerConfigNodes string //manager 合约配置的nodes
paraConfigNodes string //平行链自组织配置的nodes,最初是从manager同步过来 paraConfigNodes string //平行链自组织配置的nodes,最初是从manager同步过来
paraConfigNodeAddr string //平行链配置节点账户 paraConfigNodeAddr string //平行链配置节点账户
paraNodeGroupApplyAddrs string paraNodeGroupStatusAddrs string //正在申请的addrs
paraNodeID string
paraNodeGroupID string
localTx string localTx string
localTitle string localTitle string
localTitleHeight string localTitleHeight string
...@@ -32,7 +34,9 @@ func setPrefix() { ...@@ -32,7 +34,9 @@ func setPrefix() {
managerConfigNodes = "paracross-nodes-" managerConfigNodes = "paracross-nodes-"
paraConfigNodes = "mavl-paracross-nodes-title-" paraConfigNodes = "mavl-paracross-nodes-title-"
paraConfigNodeAddr = "mavl-paracross-nodes-titleAddr-" paraConfigNodeAddr = "mavl-paracross-nodes-titleAddr-"
paraNodeGroupApplyAddrs = "mavl-paracross-nodegroup-apply-title-" paraNodeGroupStatusAddrs = "mavl-paracross-nodegroup-apply-title-"
paraNodeID = "mavl-paracross-title-nodeid-"
paraNodeGroupID = "mavl-paracross-title-nodegroupid-"
localTx = "LODB-paracross-titleHeightAddr-" localTx = "LODB-paracross-titleHeightAddr-"
localTitle = "LODB-paracross-title-" localTitle = "LODB-paracross-title-"
localTitleHeight = "LODB-paracross-titleHeight-" localTitleHeight = "LODB-paracross-titleHeight-"
...@@ -62,7 +66,7 @@ func calcManageConfigNodesKey(title string) []byte { ...@@ -62,7 +66,7 @@ func calcManageConfigNodesKey(title string) []byte {
return []byte(types.ManageKey(key)) return []byte(types.ManageKey(key))
} }
func calcParaNodeGroupKey(title string) []byte { func calcParaNodeGroupAddrsKey(title string) []byte {
return []byte(fmt.Sprintf(paraConfigNodes+"%s", title)) return []byte(fmt.Sprintf(paraConfigNodes+"%s", title))
} }
...@@ -70,8 +74,16 @@ func calcParaNodeAddrKey(title string, addr string) []byte { ...@@ -70,8 +74,16 @@ func calcParaNodeAddrKey(title string, addr string) []byte {
return []byte(fmt.Sprintf(paraConfigNodeAddr+"%s-%s", title, addr)) return []byte(fmt.Sprintf(paraConfigNodeAddr+"%s-%s", title, addr))
} }
func calcParaNodeGroupApplyKey(title string) []byte { func calcParaNodeGroupStatusKey(title string) []byte {
return []byte(fmt.Sprintf(paraNodeGroupApplyAddrs+"%s", title)) return []byte(fmt.Sprintf(paraNodeGroupStatusAddrs+"%s", title))
}
func calcParaNodeIDKey(title, hash string) string {
return fmt.Sprintf(paraNodeID+"%s-%s", title, hash)
}
func calcParaNodeGroupIDKey(title, hash string) string {
return fmt.Sprintf(paraNodeGroupID+"%s-%s", title, hash)
} }
func calcLocalTxKey(title string, height int64, addr string) []byte { func calcLocalTxKey(title string, height int64, addr string) []byte {
...@@ -90,22 +102,30 @@ func calcLocalAssetKey(hash []byte) []byte { ...@@ -90,22 +102,30 @@ func calcLocalAssetKey(hash []byte) []byte {
return []byte(fmt.Sprintf(localAssetKey+"%s", hash)) return []byte(fmt.Sprintf(localAssetKey+"%s", hash))
} }
func calcLocalNodeTitleStatus(title, addr string, status int32) []byte { func calcLocalNodeTitleStatus(title string, status int32, id string) []byte {
return []byte(fmt.Sprintf(localNodeTitleStatus+"%s-%02d-%s", title, status, addr)) return []byte(fmt.Sprintf(localNodeTitleStatus+"%s-%02d-%s", title, status, id))
} }
func calcLocalNodeStatusPrefix(title string, status int32) []byte { func calcLocalNodeStatusPrefix(title string, status int32) []byte {
return []byte(fmt.Sprintf(localNodeTitleStatus+"%s-%02d", title, status)) return []byte(fmt.Sprintf(localNodeTitleStatus+"%s-%02d-", title, status))
}
func calcLocalNodeTitlePrefix(title string) []byte {
return []byte(fmt.Sprintf(localNodeTitleStatus+"%s-", title))
} }
func calcLocalNodeTitleDone(title, addr string) []byte { func calcLocalNodeTitleDone(title, addr string) []byte {
return []byte(fmt.Sprintf(localNodeTitleDone+"%s-%s", title, addr)) return []byte(fmt.Sprintf(localNodeTitleDone+"%s-%s", title, addr))
} }
func calcLocalNodeGroupStatusTitle(status int32, title string) []byte { func calcLocalNodeGroupStatusTitle(status int32, title, id string) []byte {
return []byte(fmt.Sprintf(localNodeGroupStatusTitle+"%02d-%s", status, title)) return []byte(fmt.Sprintf(localNodeGroupStatusTitle+"%02d-%s-%s", status, title, id))
} }
func calcLocalNodeGroupStatusPrefix(status int32) []byte { func calcLocalNodeGroupStatusPrefix(status int32) []byte {
return []byte(fmt.Sprintf(localNodeGroupStatusTitle+"%02d", status)) return []byte(fmt.Sprintf(localNodeGroupStatusTitle+"%02d-", status))
}
func calcLocalNodeGroupAllPrefix() []byte {
return []byte(fmt.Sprintf(localNodeGroupStatusTitle))
} }
...@@ -75,7 +75,7 @@ func (p *Paracross) Query_GetNodeGroupAddrs(in *pt.ReqParacrossNodeInfo) (types. ...@@ -75,7 +75,7 @@ func (p *Paracross) Query_GetNodeGroupAddrs(in *pt.ReqParacrossNodeInfo) (types.
nodes = append(nodes, k) nodes = append(nodes, k)
} }
var reply types.ReplyConfig var reply types.ReplyConfig
reply.Key = string(calcParaNodeGroupKey(in.GetTitle())) reply.Key = string(calcParaNodeGroupAddrsKey(in.GetTitle()))
reply.Value = fmt.Sprint(nodes) reply.Value = fmt.Sprint(nodes)
return &reply, nil return &reply, nil
} }
...@@ -85,7 +85,24 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me ...@@ -85,7 +85,24 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
if in == nil || in.Title == "" || in.Addr == "" { if in == nil || in.Title == "" || in.Addr == "" {
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
stat, err := getNodeAddr(p.GetStateDB(), in.Title, in.Addr) addrStat, err := getNodeAddr(p.GetStateDB(), in.Title, in.Addr)
if err != nil {
return nil, err
}
stat, err := getNodeID(p.GetStateDB(), addrStat.ProposalId)
if err != nil {
return nil, err
}
return stat, nil
}
//Query_GetNodeIdInfo get specific node addr info
func (p *Paracross) Query_GetNodeIdInfo(in *pt.ReqParacrossNodeInfo) (types.Message, error) {
if in == nil || in.Title == "" || in.Id == "" {
return nil, types.ErrInvalidParam
}
stat, err := getNodeID(p.GetStateDB(), in.Id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -114,7 +131,7 @@ func (p *Paracross) Query_GetNodeGroupStatus(in *pt.ReqParacrossNodeInfo) (types ...@@ -114,7 +131,7 @@ func (p *Paracross) Query_GetNodeGroupStatus(in *pt.ReqParacrossNodeInfo) (types
//Query_ListNodeGroupStatus list node info by status //Query_ListNodeGroupStatus list node info by status
func (p *Paracross) Query_ListNodeGroupStatus(in *pt.ReqParacrossNodeInfo) (types.Message, error) { func (p *Paracross) Query_ListNodeGroupStatus(in *pt.ReqParacrossNodeInfo) (types.Message, error) {
if in == nil || in.Status == 0 { if in == nil {
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
return listLocalNodeGroupStatus(p.GetLocalDB(), in.Status) return listLocalNodeGroupStatus(p.GetLocalDB(), in.Status)
...@@ -212,7 +229,7 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) { ...@@ -212,7 +229,7 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) {
MostSameCommit: st.MostSameCommit, MostSameCommit: st.MostSameCommit,
Title: st.Title, Title: st.Title,
Height: st.Height, Height: st.Height,
StateHash: hex.EncodeToString(st.StateHash), StateHash: common.ToHex(st.StateHash),
TxCounts: st.TxCounts, TxCounts: st.TxCounts,
TxResult: hex.EncodeToString(st.TxResult), TxResult: hex.EncodeToString(st.TxResult),
} }
...@@ -230,12 +247,12 @@ func listNodeStatus(db dbm.KVDB, prefix []byte) (types.Message, error) { ...@@ -230,12 +247,12 @@ func listNodeStatus(db dbm.KVDB, prefix []byte) (types.Message, error) {
var resp pt.RespParacrossNodeAddrs var resp pt.RespParacrossNodeAddrs
for _, r := range res { for _, r := range res {
var st pt.ParaNodeAddrStatus var st pt.ParaNodeIdStatus
err = types.Decode(r, &st) err = types.Decode(r, &st)
if err != nil { if err != nil {
panic(err) panic(err)
} }
resp.Addrs = append(resp.Addrs, &st) resp.Ids = append(resp.Ids, &st)
} }
return &resp, nil return &resp, nil
} }
...@@ -253,19 +270,31 @@ func listNodeGroupStatus(db dbm.KVDB, prefix []byte) (types.Message, error) { ...@@ -253,19 +270,31 @@ func listNodeGroupStatus(db dbm.KVDB, prefix []byte) (types.Message, error) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
resp.Addrs = append(resp.Addrs, &st) resp.Ids = append(resp.Ids, &st)
} }
return &resp, nil return &resp, nil
} }
//按状态遍历 //按状态遍历
func listLocalNodeStatus(db dbm.KVDB, title string, status int32) (types.Message, error) { func listLocalNodeStatus(db dbm.KVDB, title string, status int32) (types.Message, error) {
prefix := calcLocalNodeStatusPrefix(title, status) var prefix []byte
if status == 0 {
prefix = calcLocalNodeTitlePrefix(title)
} else {
prefix = calcLocalNodeStatusPrefix(title, status)
}
return listNodeStatus(db, prefix) return listNodeStatus(db, prefix)
} }
func listLocalNodeGroupStatus(db dbm.KVDB, status int32) (types.Message, error) { func listLocalNodeGroupStatus(db dbm.KVDB, status int32) (types.Message, error) {
prefix := calcLocalNodeGroupStatusPrefix(status) var prefix []byte
if status == 0 {
prefix = calcLocalNodeGroupAllPrefix()
} else {
prefix = calcLocalNodeGroupStatusPrefix(status)
}
return listNodeGroupStatus(db, prefix) return listNodeGroupStatus(db, prefix)
} }
...@@ -287,7 +316,7 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error ...@@ -287,7 +316,7 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
MostSameCommit: st.MostSameCommit, MostSameCommit: st.MostSameCommit,
Title: st.Title, Title: st.Title,
Height: st.Height, Height: st.Height,
StateHash: hex.EncodeToString(st.StateHash), StateHash: common.ToHex(st.StateHash),
TxCounts: st.TxCounts, TxCounts: st.TxCounts,
TxResult: hex.EncodeToString(st.TxResult), TxResult: hex.EncodeToString(st.TxResult),
}, nil }, nil
......
...@@ -62,8 +62,10 @@ func getMiners(detail *pt.ParacrossStatusDetails, blockHash []byte) []string { ...@@ -62,8 +62,10 @@ func getMiners(detail *pt.ParacrossStatusDetails, blockHash []byte) []string {
// //
func mergeReceipt(receipt1, receipt2 *types.Receipt) *types.Receipt { func mergeReceipt(receipt1, receipt2 *types.Receipt) *types.Receipt {
if receipt2 != nil {
receipt1.KV = append(receipt1.KV, receipt2.KV...)
receipt1.Logs = append(receipt1.Logs, receipt2.Logs...)
}
receipt1.KV = append(receipt1.KV, receipt2.KV...)
receipt1.Logs = append(receipt1.Logs, receipt2.Logs...)
return receipt1 return receipt1
} }
...@@ -10,6 +10,9 @@ import ( ...@@ -10,6 +10,9 @@ import (
"strings" "strings"
"strconv"
"github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/system/dapp"
manager "github.com/33cn/chain33/system/dapp/manage/types" manager "github.com/33cn/chain33/system/dapp/manage/types"
...@@ -31,20 +34,31 @@ func deepCopy(dst, src interface{}) error { ...@@ -31,20 +34,31 @@ func deepCopy(dst, src interface{}) error {
return gob.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(dst) return gob.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(dst)
} }
func getNodeAddr(db dbm.KV, title, addr string) (*pt.ParaNodeAddrStatus, error) { func getNodeAddr(db dbm.KV, title, addr string) (*pt.ParaNodeAddrIdStatus, error) {
key := calcParaNodeAddrKey(title, addr) key := calcParaNodeAddrKey(title, addr)
val, err := db.Get(key) val, err := db.Get(key)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var status pt.ParaNodeAddrStatus var status pt.ParaNodeAddrIdStatus
err = types.Decode(val, &status)
return &status, err
}
func getNodeID(db dbm.KV, id string) (*pt.ParaNodeIdStatus, error) {
val, err := getDb(db, []byte(id))
if err != nil {
return nil, err
}
var status pt.ParaNodeIdStatus
err = types.Decode(val, &status) err = types.Decode(val, &status)
return &status, err return &status, err
} }
func getNodeGroupStatus(db dbm.KV, title string) (*pt.ParaNodeGroupStatus, error) { func getNodeGroupStatus(db dbm.KV, title string) (*pt.ParaNodeGroupStatus, error) {
key := calcParaNodeGroupApplyKey(title) key := calcParaNodeGroupStatusKey(title)
val, err := db.Get(key) val, err := db.Get(key)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -55,25 +69,29 @@ func getNodeGroupStatus(db dbm.KV, title string) (*pt.ParaNodeGroupStatus, error ...@@ -55,25 +69,29 @@ func getNodeGroupStatus(db dbm.KV, title string) (*pt.ParaNodeGroupStatus, error
return &status, err return &status, err
} }
func saveDb(db dbm.KV, key []byte, status types.Message) error { func getDb(db dbm.KV, key []byte) ([]byte, error) {
val := types.Encode(status) val, err := db.Get(key)
return db.Set(key, val) if err != nil {
return nil, err
}
return val, nil
} }
func saveNodeAddr(db dbm.KV, title, addr string, status types.Message) error { func getNodeGroupID(db dbm.KV, id string) (*pt.ParaNodeGroupStatus, error) {
key := calcParaNodeAddrKey(title, addr) val, err := getDb(db, []byte(id))
return saveDb(db, key, status) if err != nil {
} return nil, err
}
func saveNodeGroup(db dbm.KV, title string, status types.Message) error { var status pt.ParaNodeGroupStatus
key := calcParaNodeGroupApplyKey(title) err = types.Decode(val, &status)
return saveDb(db, key, status) return &status, err
} }
func makeVoteDoneReceipt(config *pt.ParaNodeAddrConfig, totalCount, commitCount, most int, pass string, status int32) *types.Receipt { func makeVoteDoneReceipt(config *pt.ParaNodeIdStatus, totalCount, commitCount, most int, pass string, status int32) *types.Receipt {
log := &pt.ReceiptParaNodeVoteDone{ log := &pt.ReceiptParaNodeVoteDone{
Title: config.Title, Title: config.Title,
TargetAddr: config.Addr, TargetAddr: config.TargetAddr,
TotalNodes: int32(totalCount), TotalNodes: int32(totalCount),
TotalVote: int32(commitCount), TotalVote: int32(commitCount),
MostVote: int32(most), MostVote: int32(most),
...@@ -93,10 +111,11 @@ func makeVoteDoneReceipt(config *pt.ParaNodeAddrConfig, totalCount, commitCount, ...@@ -93,10 +111,11 @@ func makeVoteDoneReceipt(config *pt.ParaNodeAddrConfig, totalCount, commitCount,
} }
} }
func makeNodeConfigReceipt(addr string, config *pt.ParaNodeAddrConfig, prev, current *pt.ParaNodeAddrStatus) *types.Receipt { func makeNodeConfigReceipt(fromAddr string, config *pt.ParaNodeAddrConfig, prev, current *pt.ParaNodeIdStatus) *types.Receipt {
key := calcParaNodeAddrKey(config.Title, config.Addr) key := calcParaNodeAddrKey(current.Title, current.TargetAddr)
val := &pt.ParaNodeAddrIdStatus{ProposalId: current.Id}
log := &pt.ReceiptParaNodeConfig{ log := &pt.ReceiptParaNodeConfig{
Addr: addr, Addr: fromAddr,
Config: config, Config: config,
Prev: prev, Prev: prev,
Current: current, Current: current,
...@@ -104,7 +123,8 @@ func makeNodeConfigReceipt(addr string, config *pt.ParaNodeAddrConfig, prev, cur ...@@ -104,7 +123,8 @@ func makeNodeConfigReceipt(addr string, config *pt.ParaNodeAddrConfig, prev, cur
return &types.Receipt{ return &types.Receipt{
Ty: types.ExecOk, Ty: types.ExecOk,
KV: []*types.KeyValue{ KV: []*types.KeyValue{
{Key: key, Value: types.Encode(current)}, {Key: []byte(current.Id), Value: types.Encode(current)},
{Key: key, Value: types.Encode(val)},
}, },
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{ {
...@@ -115,8 +135,28 @@ func makeNodeConfigReceipt(addr string, config *pt.ParaNodeAddrConfig, prev, cur ...@@ -115,8 +135,28 @@ func makeNodeConfigReceipt(addr string, config *pt.ParaNodeAddrConfig, prev, cur
} }
} }
func makeParaNodeGroupApplyReiceipt(title, addr string, prev, current *pt.ParaNodeGroupStatus, logTy int32) *types.Receipt { func makeNodeGroupIDReceipt(addr string, prev, current *pt.ParaNodeGroupStatus) *types.Receipt {
key := calcParaNodeGroupApplyKey(title) log := &pt.ReceiptParaNodeGroupConfig{
Addr: addr,
Prev: prev,
Current: current,
}
return &types.Receipt{
Ty: types.ExecOk,
KV: []*types.KeyValue{
{Key: []byte(current.Id), Value: types.Encode(current)},
},
Logs: []*types.ReceiptLog{
{
Ty: pt.TyLogParaNodeGroupConfig,
Log: types.Encode(log),
},
},
}
}
func makeParaNodeGroupStatusReceipt(title string, addr string, prev, current *pt.ParaNodeGroupStatus) *types.Receipt {
key := calcParaNodeGroupStatusKey(title)
log := &pt.ReceiptParaNodeGroupConfig{ log := &pt.ReceiptParaNodeGroupConfig{
Addr: addr, Addr: addr,
Prev: prev, Prev: prev,
...@@ -129,15 +169,15 @@ func makeParaNodeGroupApplyReiceipt(title, addr string, prev, current *pt.ParaNo ...@@ -129,15 +169,15 @@ func makeParaNodeGroupApplyReiceipt(title, addr string, prev, current *pt.ParaNo
}, },
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{ {
Ty: logTy, Ty: pt.TyLogParaNodeGroupStatusUpdate,
Log: types.Encode(log), Log: types.Encode(log),
}, },
}, },
} }
} }
func makeParaNodeGroupReiceipt(title string, prev, current *types.ConfigItem) *types.Receipt { func makeParaNodeGroupReceipt(title string, prev, current *types.ConfigItem) *types.Receipt {
key := calcParaNodeGroupKey(title) key := calcParaNodeGroupAddrsKey(title)
log := &types.ReceiptConfig{Prev: prev, Current: current} log := &types.ReceiptConfig{Prev: prev, Current: current}
return &types.Receipt{ return &types.Receipt{
Ty: types.ExecOk, Ty: types.ExecOk,
...@@ -146,7 +186,7 @@ func makeParaNodeGroupReiceipt(title string, prev, current *types.ConfigItem) *t ...@@ -146,7 +186,7 @@ func makeParaNodeGroupReiceipt(title string, prev, current *types.ConfigItem) *t
}, },
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{ {
Ty: pt.TyLogParaNodeGroupUpdate, Ty: pt.TyLogParaNodeGroupAddrsUpdate,
Log: types.Encode(log), Log: types.Encode(log),
}, },
}, },
...@@ -169,8 +209,6 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -169,8 +209,6 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
} }
if config.CoinsFrozen < nodeGroupStatus.CoinsFrozen { if config.CoinsFrozen < nodeGroupStatus.CoinsFrozen {
clog.Error("nodeJoin coinfrozen not enough", "title", config.Title, "addr", config.Addr,
"config", config.CoinsFrozen, "nodegroupConfig", nodeGroupStatus.CoinsFrozen)
return nil, errors.Wrapf(pt.ErrParaNodeGroupFrozenCoinsNotEnough, return nil, errors.Wrapf(pt.ErrParaNodeGroupFrozenCoinsNotEnough,
"coinFrozen not enough:%d,expected:%d", config.CoinsFrozen, nodeGroupStatus.CoinsFrozen) "coinFrozen not enough:%d,expected:%d", config.CoinsFrozen, nodeGroupStatus.CoinsFrozen)
} }
...@@ -185,114 +223,116 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -185,114 +223,116 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
} }
stat, err := getNodeAddr(a.db, config.Title, config.Addr) addrStat, err := getNodeAddr(a.db, config.Title, config.Addr)
if err != nil { if err != nil {
if !isNotFound(err) { if !isNotFound(err) {
return nil, err return nil, err
} }
clog.Info("first time add node addr", "title", config.Title, "addr", config.Addr) clog.Info("first time add node addr", "title", config.Title, "addr", config.Addr)
stat := &pt.ParaNodeAddrStatus{Status: pt.ParacrossNodeAdding, stat := &pt.ParaNodeIdStatus{
Id: calcParaNodeIDKey(config.Title, common.ToHex(a.txhash)),
Status: pt.ParacrossNodeJoining,
Title: config.Title, Title: config.Title,
ApplyAddr: config.Addr, TargetAddr: config.Addr,
FromAddr: a.fromaddr, FromAddr: a.fromaddr,
Votes: &pt.ParaNodeVoteDetail{}, Votes: &pt.ParaNodeVoteDetail{},
CoinsFrozen: config.CoinsFrozen} CoinsFrozen: config.CoinsFrozen,
saveNodeAddr(a.db, config.Title, config.Addr, stat) Height: a.height}
r := makeNodeConfigReceipt(a.fromaddr, config, nil, stat) r := makeNodeConfigReceipt(a.fromaddr, config, nil, stat)
receipt.KV = append(receipt.KV, r.KV...) receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil return receipt, nil
} }
var copyStat pt.ParaNodeAddrStatus stat, err := getNodeID(a.db, addrStat.ProposalId)
if err != nil {
clog.Error("nodeaccount.getNodeID fail", "err", err.Error())
return nil, err
}
var copyStat pt.ParaNodeIdStatus
err = deepCopy(&copyStat, stat) err = deepCopy(&copyStat, stat)
if err != nil { if err != nil {
clog.Error("nodeaccount.nodeJoin deep copy fail", "copy", copyStat, "stat", stat) clog.Error("nodeaccount.nodeJoin deep copy fail", "copy", copyStat, "stat", stat)
return nil, err return nil, err
} }
if stat.Status != pt.ParacrossNodeQuited { if stat.Status == pt.ParacrossNodeQuited {
clog.Error("nodeaccount.nodeJoin key exist", "addr", config.Addr, "status", stat) stat = &pt.ParaNodeIdStatus{
return nil, pt.ErrParaNodeAddrExisted Id: calcParaNodeIDKey(config.Title, common.ToHex(a.txhash)),
} Status: pt.ParacrossNodeJoining,
stat = &pt.ParaNodeAddrStatus{ Title: config.Title,
Status: pt.ParacrossNodeAdding, TargetAddr: config.Addr,
Title: config.Title, FromAddr: a.fromaddr,
ApplyAddr: config.Addr, Votes: &pt.ParaNodeVoteDetail{},
FromAddr: a.fromaddr, CoinsFrozen: config.CoinsFrozen,
Votes: &pt.ParaNodeVoteDetail{}, Height: a.height}
CoinsFrozen: config.CoinsFrozen} r := makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat)
saveNodeAddr(a.db, config.Title, config.Addr, stat) receipt.KV = append(receipt.KV, r.KV...)
r := makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat) receipt.Logs = append(receipt.Logs, r.Logs...)
receipt.KV = append(receipt.KV, r.KV...) return receipt, nil
receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil }
return nil, errors.Wrapf(pt.ErrParaNodeAddrExisted, "nodeAddr existed:%s,status:%d", config.Addr, stat.Status)
} }
func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) { func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
stat, err := getNodeAddr(a.db, config.Title, config.Addr) stat, err := getNodeID(a.db, config.Id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
//代替别人退出或者自己退出都允许,但代替别人退出时候创建账户也必须匹配 if config.Title != stat.Title {
if a.fromaddr != stat.FromAddr && a.fromaddr != config.Addr { return nil, errors.Wrapf(pt.ErrNodeNotForTheTitle, "config title:%s,id title:%s", config.Title, stat.Title)
clog.Error("nodeaccount.nodeQuit wrong addr", "createAddr", stat.FromAddr, "confAddr", config.Addr, "fromAddr", a.fromaddr)
return nil, types.ErrNotAllow
} }
if stat.Status == pt.ParacrossNodeQuiting || stat.Status == pt.ParacrossNodeQuited { var copyStat pt.ParaNodeIdStatus
clog.Error("nodeaccount.nodeQuit wrong status", "status", stat) err = deepCopy(&copyStat, stat)
return nil, errors.Wrapf(pt.ErrParaUnSupportNodeOper, "nodeAddr %s was quit status:%d", config.Addr, stat.Status) if err != nil {
clog.Error("nodeaccount.nodeQuit deep copy fail", "copy", copyStat, "stat", stat)
return nil, err
} }
if stat.Status == pt.ParacrossNodeJoined {
if stat.Status == pt.ParacrossNodeAdded {
nodes, _, err := getParacrossNodes(a.db, config.Title) nodes, _, err := getParacrossNodes(a.db, config.Title)
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "getNodes for title:%s", config.Title) return nil, errors.Wrapf(err, "getNodes for title:%s", config.Title)
} }
if !validNode(config.Addr, nodes) { if !validNode(stat.TargetAddr, nodes) {
return nil, errors.Wrapf(pt.ErrParaNodeAddrNotExisted, "nodeAddr not existed:%s", config.Addr) return nil, errors.Wrapf(pt.ErrParaNodeAddrNotExisted, "nodeAddr not existed:%s", stat.TargetAddr)
} }
//不允许最后一个账户退出 //不允许最后一个账户退出
if len(nodes) == 1 { if len(nodes) == 1 {
return nil, errors.Wrapf(pt.ErrParaNodeGroupLastAddr, "nodeAddr last one:%s", config.Addr) return nil, errors.Wrapf(pt.ErrParaNodeGroupLastAddr, "nodeAddr last one:%s", stat.TargetAddr)
} }
}
var copyStat pt.ParaNodeAddrStatus
err = deepCopy(&copyStat, stat)
if err != nil {
clog.Error("nodeaccount.nodeQuit deep copy fail", "copy", copyStat, "stat", stat)
return nil, err
}
if stat.Status == pt.ParacrossNodeAdded {
stat.Status = pt.ParacrossNodeQuiting stat.Status = pt.ParacrossNodeQuiting
stat.Height = a.height
stat.Votes = &pt.ParaNodeVoteDetail{} stat.Votes = &pt.ParaNodeVoteDetail{}
saveNodeAddr(a.db, config.Title, config.Addr, stat)
return makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat), nil return makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat), nil
} }
//still adding status, quit directly if stat.Status == pt.ParacrossNodeJoining {
receipt := &types.Receipt{Ty: types.ExecOk} //still adding status, quit directly
if !types.IsPara() { receipt := &types.Receipt{Ty: types.ExecOk}
r, err := a.nodeGroupCoinsActive(stat.FromAddr, stat.CoinsFrozen, 1) if !types.IsPara() {
if err != nil { r, err := a.nodeGroupCoinsActive(stat.FromAddr, stat.CoinsFrozen, 1)
return nil, err if err != nil {
return nil, err
}
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
} }
stat.Status = pt.ParacrossNodeQuited
stat.Height = a.height
stat.Votes = &pt.ParaNodeVoteDetail{}
r := makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat)
receipt.KV = append(receipt.KV, r.KV...) receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
}
stat.Status = pt.ParacrossNodeQuited return receipt, nil
stat.Votes = &pt.ParaNodeVoteDetail{} }
saveNodeAddr(a.db, config.Title, config.Addr, stat)
r := makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil return nil, errors.Wrapf(pt.ErrParaUnSupportNodeOper, "nodeid %s was quit status:%d", config.Id, stat.Status)
} }
...@@ -306,10 +346,10 @@ func isSuperManager(addr string) bool { ...@@ -306,10 +346,10 @@ func isSuperManager(addr string) bool {
return false return false
} }
func getMostVote(stat *pt.ParaNodeAddrStatus) (int, string) { func getMostVote(stat *pt.ParaNodeIdStatus) (int, int) {
var ok, nok int var ok, nok int
for _, v := range stat.GetVotes().Votes { for _, v := range stat.GetVotes().Votes {
if v == pt.ParaNodeVoteYes { if v == pt.ParaNodeVoteStr[pt.ParaNodeVoteYes] {
ok++ ok++
} else { } else {
nok++ nok++
...@@ -332,9 +372,7 @@ func (a *action) superManagerVoteProc(title string) error { ...@@ -332,9 +372,7 @@ func (a *action) superManagerVoteProc(title string) error {
if err != nil { if err != nil {
return err return err
} }
if status.Status != pt.ParacrossNodeGroupApprove {
return pt.ErrParaNodeGroupStatusWrong
}
confStopBlocks := conf.GInt("paraConsensusStopBlocks") confStopBlocks := conf.GInt("paraConsensusStopBlocks")
data, err := a.exec.paracrossGetHeight(title) data, err := a.exec.paracrossGetHeight(title)
if err != nil { if err != nil {
...@@ -373,12 +411,16 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -373,12 +411,16 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
return nil, errors.Wrapf(pt.ErrNodeNotForTheTitle, "not validNode:%s", a.fromaddr) return nil, errors.Wrapf(pt.ErrNodeNotForTheTitle, "not validNode:%s", a.fromaddr)
} }
stat, err := getNodeAddr(a.db, config.Title, config.Addr) stat, err := getNodeID(a.db, config.Id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var copyStat pt.ParaNodeAddrStatus if config.Title != stat.Title {
return nil, errors.Wrapf(pt.ErrNodeNotForTheTitle, "config title:%s,id title:%s", config.Title, stat.Title)
}
var copyStat pt.ParaNodeIdStatus
err = deepCopy(&copyStat, stat) err = deepCopy(&copyStat, stat)
if err != nil { if err != nil {
clog.Error("nodeaccount.nodevOTE deep copy fail", "copy", copyStat, "stat", stat) clog.Error("nodeaccount.nodevOTE deep copy fail", "copy", copyStat, "stat", stat)
...@@ -390,10 +432,10 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -390,10 +432,10 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
} }
found, index := hasVoted(stat.Votes.Addrs, a.fromaddr) found, index := hasVoted(stat.Votes.Addrs, a.fromaddr)
if found { if found {
stat.Votes.Votes[index] = config.Value stat.Votes.Votes[index] = pt.ParaNodeVoteStr[config.Value]
} else { } else {
stat.Votes.Addrs = append(stat.Votes.Addrs, a.fromaddr) stat.Votes.Addrs = append(stat.Votes.Addrs, a.fromaddr)
stat.Votes.Votes = append(stat.Votes.Votes, config.Value) stat.Votes.Votes = append(stat.Votes.Votes, pt.ParaNodeVoteStr[config.Value])
} }
most, vote := getMostVote(stat) most, vote := getMostVote(stat)
if !isCommitDone(stat, nodes, most) { if !isCommitDone(stat, nodes, most) {
...@@ -411,63 +453,62 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -411,63 +453,62 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
//超级用户投yes票,共识停止了一定高度就可以通过,防止当前所有授权节点都忘掉私钥场景 //超级用户投yes票,共识停止了一定高度就可以通过,防止当前所有授权节点都忘掉私钥场景
if !(superManagerPass && most > 0 && vote == pt.ParaNodeVoteYes) { if !(superManagerPass && most > 0 && vote == pt.ParaNodeVoteYes) {
saveNodeAddr(a.db, config.Title, config.Addr, stat)
return makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat), nil return makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat), nil
} }
} }
clog.Info("paracross.nodeVote ----pass", "most", most, "pass", vote) clog.Info("paracross.nodeVote ----pass", "most", most, "pass", vote)
var receiptGroup *types.Receipt receipt := &types.Receipt{Ty: types.ExecOk}
if vote == pt.ParaNodeVoteNo { if vote == pt.ParaNodeVoteNo {
// 对已经在group里面的node,直接投票remove,对正在申请中的adding or quiting状态保持不变,对quited的保持不变 // 对已经在group里面的node,直接投票remove,对正在申请中的adding or quiting状态保持不变,对quited的保持不变
if stat.Status == pt.ParacrossNodeAdded { if stat.Status == pt.ParacrossNodeJoined {
receiptGroup, err = unpdateNodeGroup(a.db, config.Title, config.Addr, false) r, err := unpdateNodeGroup(a.db, config.Title, stat.TargetAddr, false)
if err != nil { if err != nil {
return nil, err return nil, err
} }
receipt = mergeReceipt(receipt, r)
stat.Status = pt.ParacrossNodeQuited stat.Status = pt.ParacrossNodeQuited
stat.Height = a.height
if !types.IsPara() { if !types.IsPara() {
r, err := a.nodeGroupCoinsActive(stat.FromAddr, stat.CoinsFrozen, 1) r, err := a.nodeGroupCoinsActive(stat.FromAddr, stat.CoinsFrozen, 1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
receiptGroup.KV = append(receiptGroup.KV, r.KV...) receipt = mergeReceipt(receipt, r)
receiptGroup.Logs = append(receiptGroup.Logs, r.Logs...)
} }
} }
} else { } else {
if stat.Status == pt.ParacrossNodeAdding { if stat.Status == pt.ParacrossNodeJoining {
receiptGroup, err = unpdateNodeGroup(a.db, config.Title, config.Addr, true) r, err := unpdateNodeGroup(a.db, config.Title, stat.TargetAddr, true)
if err != nil { if err != nil {
return nil, err return nil, err
} }
stat.Status = pt.ParacrossNodeAdded stat.Status = pt.ParacrossNodeJoined
stat.Height = a.height
receipt = mergeReceipt(receipt, r)
} else if stat.Status == pt.ParacrossNodeQuiting { } else if stat.Status == pt.ParacrossNodeQuiting {
receiptGroup, err = unpdateNodeGroup(a.db, config.Title, config.Addr, false) r, err := unpdateNodeGroup(a.db, config.Title, stat.TargetAddr, false)
if err != nil { if err != nil {
return nil, err return nil, err
} }
stat.Status = pt.ParacrossNodeQuited stat.Status = pt.ParacrossNodeQuited
stat.Height = a.height
receipt = mergeReceipt(receipt, r)
if !types.IsPara() { if !types.IsPara() {
r, err := a.nodeGroupCoinsActive(stat.FromAddr, stat.CoinsFrozen, 1) r, err := a.nodeGroupCoinsActive(stat.FromAddr, stat.CoinsFrozen, 1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
receiptGroup.KV = append(receiptGroup.KV, r.KV...) receipt = mergeReceipt(receipt, r)
receiptGroup.Logs = append(receiptGroup.Logs, r.Logs...)
} }
} }
} }
saveNodeAddr(a.db, config.Title, config.Addr, stat) r := makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat)
receipt := makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat) receipt = mergeReceipt(receipt, r)
if receiptGroup != nil {
receipt.KV = append(receipt.KV, receiptGroup.KV...) receiptDone := makeVoteDoneReceipt(stat, len(nodes), len(stat.Votes.Addrs), most, pt.ParaNodeVoteStr[vote], stat.Status)
receipt.Logs = append(receipt.Logs, receiptGroup.Logs...) receipt = mergeReceipt(receipt, receiptDone)
}
receiptDone := makeVoteDoneReceipt(config, len(nodes), len(stat.Votes.Addrs), most, vote, stat.Status)
receipt.KV = append(receipt.KV, receiptDone.KV...)
receipt.Logs = append(receipt.Logs, receiptDone.Logs...)
return receipt, nil return receipt, nil
} }
...@@ -475,7 +516,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -475,7 +516,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
func unpdateNodeGroup(db dbm.KV, title, addr string, add bool) (*types.Receipt, error) { func unpdateNodeGroup(db dbm.KV, title, addr string, add bool) (*types.Receipt, error) {
var item types.ConfigItem var item types.ConfigItem
key := calcParaNodeGroupKey(title) key := calcParaNodeGroupAddrsKey(title)
value, err := db.Get(key) value, err := db.Get(key)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -512,18 +553,10 @@ func unpdateNodeGroup(db dbm.KV, title, addr string, add bool) (*types.Receipt, ...@@ -512,18 +553,10 @@ func unpdateNodeGroup(db dbm.KV, title, addr string, add bool) (*types.Receipt,
} }
} }
return makeParaNodeGroupReiceipt(title, &copyItem, &item), nil return makeParaNodeGroupReceipt(title, &copyItem, &item), nil
}
func (a *action) checkConfig(title string) error {
if !validTitle(title) {
return pt.ErrInvalidTitle
}
return nil
} }
func getAddrGroup(addr string) []string { func getConfigAddrs(addr string) []string {
addr = strings.Trim(addr, " ") addr = strings.Trim(addr, " ")
if addr == "" { if addr == "" {
return nil return nil
...@@ -549,7 +582,7 @@ func getAddrGroup(addr string) []string { ...@@ -549,7 +582,7 @@ func getAddrGroup(addr string) []string {
} }
func (a *action) checkNodeGroupExist(title string) error { func (a *action) checkNodeGroupExist(title string) error {
key := calcParaNodeGroupKey(title) key := calcParaNodeGroupAddrsKey(title)
value, err := a.db.Get(key) value, err := a.db.Get(key)
if err != nil && !isNotFound(err) { if err != nil && !isNotFound(err) {
return err return err
...@@ -613,19 +646,9 @@ func (a *action) nodeGroupCoinsActive(createAddr string, configCoinsFrozen int64 ...@@ -613,19 +646,9 @@ func (a *action) nodeGroupCoinsActive(createAddr string, configCoinsFrozen int64
// NodeGroupApply // NodeGroupApply
func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) { func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
status, err := getNodeGroupStatus(a.db, config.Title) addrs := getConfigAddrs(config.Addrs)
if err != nil && !isNotFound(err) {
return nil, err
}
if status != nil && status.Status != pt.ParacrossNodeGroupQuit {
clog.Error("node group apply exist", "status", status.Status)
return nil, pt.ErrParaNodeGroupExisted
}
addrs := getAddrGroup(config.Addrs)
if len(addrs) == 0 { if len(addrs) == 0 {
clog.Error("node group apply addrs null", "addrs", config.Addrs) return nil, errors.Wrapf(types.ErrInvalidParam, "node group apply addrs null:%s", config.Addrs)
return nil, types.ErrInvalidParam
} }
receipt := &types.Receipt{Ty: types.ExecOk} receipt := &types.Receipt{Ty: types.ExecOk}
...@@ -640,15 +663,34 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt, ...@@ -640,15 +663,34 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
} }
stat := &pt.ParaNodeGroupStatus{Status: pt.ParacrossNodeGroupApply, stat := &pt.ParaNodeGroupStatus{
Id: calcParaNodeGroupIDKey(config.Title, common.ToHex(a.txhash)),
Status: pt.ParacrossNodeGroupApply,
Title: config.Title,
TargetAddrs: strings.Join(addrs, ","),
CoinsFrozen: config.CoinsFrozen,
MainHeight: a.exec.GetMainHeight(),
EmptyBlockInterval: config.EmptyBlockInterval,
FromAddr: a.fromaddr,
Height: a.height}
r := makeNodeGroupIDReceipt(a.fromaddr, nil, stat)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil
}
func (a *action) nodeGroupModify(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
receipt := &types.Receipt{Ty: types.ExecOk}
stat := &pt.ParaNodeGroupStatus{
Id: calcParaNodeGroupIDKey(config.Title, common.ToHex(a.txhash)),
Status: pt.ParacrossNodeGroupModify,
Title: config.Title, Title: config.Title,
ApplyAddr: strings.Join(addrs, ","),
CoinsFrozen: config.CoinsFrozen, CoinsFrozen: config.CoinsFrozen,
MainHeight: a.exec.GetMainHeight(), MainHeight: a.exec.GetMainHeight(),
EmptyBlockInterval: config.EmptyBlockInterval, EmptyBlockInterval: config.EmptyBlockInterval,
FromAddr: a.fromaddr} Height: a.height}
saveNodeGroup(a.db, config.Title, stat) r := makeNodeGroupIDReceipt(a.fromaddr, nil, stat)
r := makeParaNodeGroupApplyReiceipt(config.Title, a.fromaddr, status, stat, pt.TyLogParaNodeGroupApply)
receipt.KV = append(receipt.KV, r.KV...) receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
...@@ -656,29 +698,26 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt, ...@@ -656,29 +698,26 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
} }
func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) { func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
status, err := getNodeGroupStatus(a.db, config.Title) status, err := getNodeGroupID(a.db, config.Id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if status.Status != pt.ParacrossNodeGroupApply {
clog.Error("node group apply exist", "status", status.Status)
return nil, pt.ErrParaNodeGroupStatusWrong
}
if status.FromAddr != a.fromaddr { if config.Title != status.Title {
clog.Error("node group create addr err", "createAddr", status.FromAddr, "currAddr", a.fromaddr) return nil, errors.Wrapf(pt.ErrNodeNotForTheTitle, "config title:%s,id title:%s", config.Title, status.Title)
return nil, types.ErrNotAllow
} }
applyAddrs, err := checkNodeGroupAddrsMatch(status.ApplyAddr, config.Addrs) //approved or quited
if err != nil { if status.Status != pt.ParacrossNodeGroupApply {
return nil, err return nil, errors.Wrapf(pt.ErrParaNodeGroupStatusWrong, "node group apply not apply:%d", status.Status)
} }
applyAddrs := strings.Split(status.TargetAddrs, ",")
receipt := &types.Receipt{Ty: types.ExecOk} receipt := &types.Receipt{Ty: types.ExecOk}
//main chain //main chain
if !types.IsPara() { if !types.IsPara() {
r, err := a.nodeGroupCoinsActive(a.fromaddr, status.CoinsFrozen, int64(len(applyAddrs))) r, err := a.nodeGroupCoinsActive(status.FromAddr, status.CoinsFrozen, int64(len(applyAddrs)))
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -686,133 +725,145 @@ func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt, ...@@ -686,133 +725,145 @@ func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt,
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
} }
stat := &pt.ParaNodeGroupStatus{Status: pt.ParacrossNodeGroupQuit, copyStat := *status
Title: config.Title, status.Status = pt.ParacrossNodeGroupQuit
ApplyAddr: status.ApplyAddr, status.Height = a.height
CoinsFrozen: status.CoinsFrozen,
MainHeight: a.exec.GetMainHeight(), r := makeNodeGroupIDReceipt(a.fromaddr, &copyStat, status)
EmptyBlockInterval: status.EmptyBlockInterval,
FromAddr: a.fromaddr}
saveNodeGroup(a.db, config.Title, stat)
r := makeParaNodeGroupApplyReiceipt(config.Title, a.fromaddr, status, stat, pt.TyLogParaNodeGroupQuit)
receipt.KV = append(receipt.KV, r.KV...) receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil return receipt, nil
} }
func checkNodeGroupAddrsMatch(applyAddr, confAddr string) ([]string, error) { func (a *action) nodeGroupApproveModify(config *pt.ParaNodeGroupConfig, modify *pt.ParaNodeGroupStatus) (*types.Receipt, error) {
confAddrs := getAddrGroup(confAddr) stat, err := getNodeGroupStatus(a.db, config.Title)
applyAddrs := strings.Split(applyAddr, ",") if err != nil {
return nil, err
applys := make(map[string]bool)
configs := make(map[string]bool)
diff := []string{}
for _, addr := range applyAddrs {
applys[addr] = true
}
for _, addr := range confAddrs {
configs[addr] = true
} }
if len(applys) != len(configs) {
clog.Error("node group addrs count not match", "apply", applyAddr, "quit", confAddr) //approve modify case
return nil, pt.ErrParaNodeGroupAddrNotMatch if modify.CoinsFrozen < config.CoinsFrozen {
return nil, errors.Wrapf(pt.ErrParaNodeGroupFrozenCoinsNotEnough, "id not enough coins modify:%d,config:%d", modify.CoinsFrozen, config.CoinsFrozen)
} }
for _, addr := range confAddrs { receipt := &types.Receipt{Ty: types.ExecOk}
if !applys[addr] { copyModify := *modify
diff = append(diff, addr) modify.Status = pt.ParacrossNodeGroupApprove
} modify.Height = a.height
r := makeNodeGroupIDReceipt(a.fromaddr, &copyModify, modify)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
//对已经approved group和addrs不再统一修改active&frozen改动的coins,因为可能有些addr已经退出group了,没退出的,退出时候按最初设置解冻
// 这里只修改参数,对后面再加入的节点起作用
copyStat := *stat
stat.Id = modify.Id
stat.CoinsFrozen = modify.CoinsFrozen
stat.EmptyBlockInterval = modify.EmptyBlockInterval
stat.MainHeight = a.exec.GetMainHeight()
stat.Height = a.height
r = makeParaNodeGroupStatusReceipt(config.Title, a.fromaddr, &copyStat, stat)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil
}
func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt.ParaNodeGroupStatus) (*types.Receipt, error) {
err := a.checkNodeGroupExist(config.Title)
if err != nil {
return nil, err
} }
if len(diff) > 0 {
clog.Error("node group addrs not match", "apply", applyAddr, "quit", confAddr) if apply.CoinsFrozen < config.CoinsFrozen {
return nil, pt.ErrParaNodeGroupAddrNotMatch return nil, errors.Wrapf(pt.ErrParaNodeGroupFrozenCoinsNotEnough, "id not enough coins apply:%d,config:%d", apply.CoinsFrozen, config.CoinsFrozen)
} }
return confAddrs, nil
receipt := &types.Receipt{Ty: types.ExecOk}
//create the node group
r := a.nodeGroupCreate(apply)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
copyStat := *apply
apply.Status = pt.ParacrossNodeGroupApprove
apply.MainHeight = a.exec.GetMainHeight()
apply.Height = a.height
r = makeNodeGroupIDReceipt(a.fromaddr, &copyStat, apply)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
r = makeParaNodeGroupStatusReceipt(config.Title, a.fromaddr, nil, apply)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil
} }
// NodeGroupApprove super addr approve the node group apply // NodeGroupApprove super addr approve the node group apply
func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) { func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
if !isSuperManager(a.fromaddr) { if !isSuperManager(a.fromaddr) {
clog.Error("node group approve not super manager", "addr", a.fromaddr) return nil, errors.Wrapf(types.ErrNotAllow, "node group approve not super manager:%s", a.fromaddr)
return nil, types.ErrNotAllow
} }
status, err := getNodeGroupStatus(a.db, config.Title) id, err := getNodeGroupID(a.db, config.Id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if status.Status != pt.ParacrossNodeGroupApply {
clog.Error("node group approve not apply status", "status", status.Status)
return nil, pt.ErrParaNodeGroupStatusWrong
}
if status.CoinsFrozen < config.CoinsFrozen { if config.Title != id.Title {
clog.Error("node group approve not apply status", "status", status.Status) return nil, errors.Wrapf(pt.ErrNodeNotForTheTitle, "config title:%s,id title:%s", config.Title, id.Title)
return nil, pt.ErrParaNodeGroupFrozenCoinsNotEnough
} }
applyAddrs, err := checkNodeGroupAddrsMatch(status.ApplyAddr, config.Addrs)
if err != nil { if id.Status == pt.ParacrossNodeGroupModify {
return nil, err return a.nodeGroupApproveModify(config, id)
} }
receipt := &types.Receipt{Ty: types.ExecOk} if id.Status == pt.ParacrossNodeGroupApply {
//create the node group return a.nodeGroupApproveApply(config, id)
r, err := a.nodeGroupCreate(config.Title, applyAddrs, status.CoinsFrozen, status.FromAddr)
if err != nil {
return nil, err
} }
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
stat := &pt.ParaNodeGroupStatus{Status: pt.ParacrossNodeGroupApprove, return nil, errors.Wrapf(pt.ErrParaNodeGroupStatusWrong, "nodeGroupApprove id wrong status:%d,id:%s", id.Status, config.Id)
Title: config.Title,
ApplyAddr: status.ApplyAddr,
CoinsFrozen: status.CoinsFrozen,
MainHeight: a.exec.GetMainHeight(),
EmptyBlockInterval: status.EmptyBlockInterval,
FromAddr: status.FromAddr}
saveNodeGroup(a.db, config.Title, stat)
r = makeParaNodeGroupApplyReiceipt(config.Title, a.fromaddr, status, stat, pt.TyLogParaNodeGroupApprove)
receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...)
return receipt, nil
} }
func (a *action) nodeGroupCreate(title string, nodes []string, coinFrozen int64, createAddr string) (*types.Receipt, error) { func (a *action) nodeGroupCreate(status *pt.ParaNodeGroupStatus) *types.Receipt {
nodes := strings.Split(status.TargetAddrs, ",")
var item types.ConfigItem var item types.ConfigItem
key := calcParaNodeGroupKey(title) key := calcParaNodeGroupAddrsKey(status.Title)
item.Key = string(key) item.Key = string(key)
emptyValue := &types.ArrayConfig{Value: make([]string, 0)} emptyValue := &types.ArrayConfig{Value: make([]string, 0)}
arr := types.ConfigItem_Arr{Arr: emptyValue} arr := types.ConfigItem_Arr{Arr: emptyValue}
item.Value = &arr item.Value = &arr
item.GetArr().Value = append(item.GetArr().Value, nodes...) item.GetArr().Value = append(item.GetArr().Value, nodes...)
item.Addr = a.fromaddr item.Addr = a.fromaddr
a.db.Set(key, types.Encode(&item))
receipt := makeParaNodeGroupReiceipt(title, nil, &item) receipt := makeParaNodeGroupReceipt(status.Title, nil, &item)
//update addr status //update addr status
for _, addr := range nodes { for i, addr := range nodes {
stat := &pt.ParaNodeAddrStatus{Status: pt.ParacrossNodeAdded, stat := &pt.ParaNodeIdStatus{
Title: title, Id: status.Id + "-" + strconv.Itoa(i),
ApplyAddr: addr, Status: pt.ParacrossNodeJoined,
Votes: &pt.ParaNodeVoteDetail{}, Title: status.Title,
CoinsFrozen: coinFrozen, TargetAddr: addr,
FromAddr: createAddr} Votes: &pt.ParaNodeVoteDetail{Addrs: []string{a.fromaddr}, Votes: []string{"yes"}},
saveNodeAddr(a.db, title, addr, stat) CoinsFrozen: status.CoinsFrozen,
config := &pt.ParaNodeAddrConfig{ FromAddr: status.FromAddr,
Title: title, Height: a.height}
Addr: addr,
CoinsFrozen: coinFrozen, r := makeNodeConfigReceipt(a.fromaddr, nil, nil, stat)
}
r := makeNodeConfigReceipt(a.fromaddr, config, nil, stat)
receipt.KV = append(receipt.KV, r.KV...) receipt.KV = append(receipt.KV, r.KV...)
receipt.Logs = append(receipt.Logs, r.Logs...) receipt.Logs = append(receipt.Logs, r.Logs...)
} }
return receipt, nil return receipt
} }
//NodeGroupConfig support super node group config //NodeGroupConfig support super node group config
...@@ -821,12 +872,11 @@ func (a *action) NodeGroupConfig(config *pt.ParaNodeGroupConfig) (*types.Receipt ...@@ -821,12 +872,11 @@ func (a *action) NodeGroupConfig(config *pt.ParaNodeGroupConfig) (*types.Receipt
return nil, pt.ErrInvalidTitle return nil, pt.ErrInvalidTitle
} }
s := strings.Trim(config.Addrs, " ")
if len(s) == 0 {
return nil, types.ErrInvalidParam
}
if config.Op == pt.ParacrossNodeGroupApply { if config.Op == pt.ParacrossNodeGroupApply {
s := strings.Trim(config.Addrs, " ")
if len(s) == 0 {
return nil, types.ErrInvalidParam
}
err := a.checkNodeGroupExist(config.Title) err := a.checkNodeGroupExist(config.Title)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -834,14 +884,19 @@ func (a *action) NodeGroupConfig(config *pt.ParaNodeGroupConfig) (*types.Receipt ...@@ -834,14 +884,19 @@ func (a *action) NodeGroupConfig(config *pt.ParaNodeGroupConfig) (*types.Receipt
return a.nodeGroupApply(config) return a.nodeGroupApply(config)
} else if config.Op == pt.ParacrossNodeGroupApprove { } else if config.Op == pt.ParacrossNodeGroupApprove {
err := a.checkNodeGroupExist(config.Title) if config.Id == "" {
if err != nil { return nil, types.ErrInvalidParam
return nil, err
} }
return a.nodeGroupApprove(config) return a.nodeGroupApprove(config)
} else if config.Op == pt.ParacrossNodeGroupQuit { } else if config.Op == pt.ParacrossNodeGroupQuit {
if config.Id == "" {
return nil, types.ErrInvalidParam
}
return a.nodeGroupQuit(config) return a.nodeGroupQuit(config)
} else if config.Op == pt.ParacrossNodeGroupModify {
return a.nodeGroupModify(config)
} }
return nil, pt.ErrParaUnSupportNodeOper return nil, pt.ErrParaUnSupportNodeOper
...@@ -858,9 +913,15 @@ func (a *action) NodeConfig(config *pt.ParaNodeAddrConfig) (*types.Receipt, erro ...@@ -858,9 +913,15 @@ func (a *action) NodeConfig(config *pt.ParaNodeAddrConfig) (*types.Receipt, erro
return a.nodeJoin(config) return a.nodeJoin(config)
} else if config.Op == pt.ParaNodeQuit { } else if config.Op == pt.ParaNodeQuit {
if config.Id == "" {
return nil, types.ErrInvalidParam
}
return a.nodeQuit(config) return a.nodeQuit(config)
} else if config.Op == pt.ParaNodeVote { } else if config.Op == pt.ParaNodeVote {
if config.Id == "" || config.Value >= pt.ParaNodeVoteEnd {
return nil, types.ErrInvalidParam
}
return a.nodeVote(config) return a.nodeVote(config)
} }
......
...@@ -74,7 +74,7 @@ func (suite *NodeManageTestSuite) SetupSuite() { ...@@ -74,7 +74,7 @@ func (suite *NodeManageTestSuite) SetupSuite() {
} }
func (suite *NodeManageTestSuite) TestSetup() { func (suite *NodeManageTestSuite) TestSetup() {
nodeConfigKey := calcParaNodeGroupKey(Title) nodeConfigKey := calcParaNodeGroupAddrsKey(Title)
suite.T().Log(string(nodeConfigKey)) suite.T().Log(string(nodeConfigKey))
_, err := suite.stateDB.Get(nodeConfigKey) _, err := suite.stateDB.Get(nodeConfigKey)
if err != nil { if err != nil {
...@@ -96,6 +96,11 @@ func nodeCommitImpl(suite suite.Suite, exec *Paracross, privkeyStr string, tx *t ...@@ -96,6 +96,11 @@ func nodeCommitImpl(suite suite.Suite, exec *Paracross, privkeyStr string, tx *t
assert.NotNil(suite.T(), receipt) assert.NotNil(suite.T(), receipt)
assert.Nil(suite.T(), err) assert.Nil(suite.T(), err)
for _, v := range receipt.KV {
if err := exec.GetStateDB().Set(v.Key, v.Value); err != nil {
panic(err)
}
}
return return
} }
...@@ -104,52 +109,52 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) ...@@ -104,52 +109,52 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt)
assert.Len(suite.T(), receipt.KV, 1) assert.Len(suite.T(), receipt.KV, 1)
assert.Len(suite.T(), receipt.Logs, 1) assert.Len(suite.T(), receipt.Logs, 1)
var stat pt.ParaNodeAddrStatus var stat pt.ParaNodeIdStatus
err := types.Decode(receipt.KV[0].Value, &stat) err := types.Decode(receipt.KV[0].Value, &stat)
assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed") assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed")
//suite.T().Log("titleHeight", titleHeight) //suite.T().Log("titleHeight", titleHeight)
assert.Equal(suite.T(), int32(pt.TyLogParaNodeGroupApply), receipt.Logs[0].Ty) assert.Equal(suite.T(), int32(pt.TyLogParaNodeGroupConfig), receipt.Logs[0].Ty)
assert.Equal(suite.T(), int32(pt.ParacrossNodeGroupApply), stat.Status) assert.Equal(suite.T(), int32(pt.ParacrossNodeGroupApply), stat.Status)
} }
func checkGroupApproveReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) { func checkGroupApproveReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk)) assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk))
assert.Len(suite.T(), receipt.KV, 6) assert.Len(suite.T(), receipt.KV, 11)
assert.Len(suite.T(), receipt.Logs, 6) assert.Len(suite.T(), receipt.Logs, 7)
len := len(receipt.KV) len := len(receipt.KV)
var stat pt.ParaNodeAddrStatus var stat pt.ParaNodeIdStatus
err := types.Decode(receipt.KV[len-1].Value, &stat) err := types.Decode(receipt.KV[len-1].Value, &stat)
assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed") assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed")
//suite.T().Log("titleHeight", titleHeight) //suite.T().Log("ty len-1", receipt.Logs[lenLogs-1].Ty,"len",lenLogs)
assert.Equal(suite.T(), int32(pt.TyLogParaNodeGroupApprove), receipt.Logs[len-1].Ty) assert.Equal(suite.T(), int32(pt.TyLogParaNodeGroupStatusUpdate), receipt.Logs[7-1].Ty)
assert.Equal(suite.T(), int32(pt.ParacrossNodeGroupApprove), stat.Status) assert.Equal(suite.T(), int32(pt.ParacrossNodeGroupApprove), stat.Status)
} }
func checkJoinReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) { func checkJoinReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk)) assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk))
assert.Len(suite.T(), receipt.KV, 1) assert.Len(suite.T(), receipt.KV, 2)
assert.Len(suite.T(), receipt.Logs, 1) assert.Len(suite.T(), receipt.Logs, 1)
var stat pt.ParaNodeAddrStatus var stat pt.ParaNodeIdStatus
err := types.Decode(receipt.KV[0].Value, &stat) err := types.Decode(receipt.KV[0].Value, &stat)
assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed") assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed")
//suite.T().Log("titleHeight", titleHeight) //suite.T().Log("titleHeight", titleHeight)
assert.Equal(suite.T(), int32(pt.TyLogParaNodeConfig), receipt.Logs[0].Ty) assert.Equal(suite.T(), int32(pt.TyLogParaNodeConfig), receipt.Logs[0].Ty)
assert.Equal(suite.T(), int32(pt.ParacrossNodeAdding), stat.Status) assert.Equal(suite.T(), int32(pt.ParacrossNodeJoining), stat.Status)
assert.NotNil(suite.T(), stat.Votes) assert.NotNil(suite.T(), stat.Votes)
} }
func checkQuitReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) { func checkQuitReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk)) assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk))
assert.Len(suite.T(), receipt.KV, 1) assert.Len(suite.T(), receipt.KV, 2)
assert.Len(suite.T(), receipt.Logs, 1) assert.Len(suite.T(), receipt.Logs, 1)
var stat pt.ParaNodeAddrStatus var stat pt.ParaNodeIdStatus
err := types.Decode(receipt.KV[0].Value, &stat) err := types.Decode(receipt.KV[0].Value, &stat)
assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed") assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed")
//suite.T().Log("titleHeight", titleHeight) //suite.T().Log("titleHeight", titleHeight)
...@@ -161,10 +166,8 @@ func checkQuitReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) { ...@@ -161,10 +166,8 @@ func checkQuitReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
func checkVoteReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count int) { func checkVoteReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count int) {
assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk)) assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk))
assert.Len(suite.T(), receipt.KV, 1)
assert.Len(suite.T(), receipt.Logs, 1)
var stat pt.ParaNodeAddrStatus var stat pt.ParaNodeIdStatus
err := types.Decode(receipt.KV[0].Value, &stat) err := types.Decode(receipt.KV[0].Value, &stat)
assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed") assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed")
assert.Len(suite.T(), stat.Votes.Votes, count) assert.Len(suite.T(), stat.Votes.Votes, count)
...@@ -172,43 +175,47 @@ func checkVoteReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count ...@@ -172,43 +175,47 @@ func checkVoteReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count
} }
func checkVoteDoneReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count int, join bool) { func checkVoteDoneReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count int, join bool) {
suite.NotNil(receipt)
assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk)) assert.Equal(suite.T(), receipt.Ty, int32(types.ExecOk))
assert.Len(suite.T(), receipt.KV, 2)
assert.Len(suite.T(), receipt.Logs, 3)
var stat pt.ParaNodeAddrStatus suite.T().Log("checkVoteDoneReceipt", "kvlen", len(receipt.KV))
err := types.Decode(receipt.KV[0].Value, &stat)
assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed")
assert.Len(suite.T(), stat.Votes.Votes, count)
var item types.ConfigItem _, arry, err := getParacrossNodes(suite.stateDB, Title)
err = types.Decode(receipt.KV[1].Value, &item) suite.Suite.Nil(err)
assert.Nil(suite.T(), err, "decode ParaNodeAddrStatus failed")
if join { if join {
suite.Contains(item.GetArr().Value, Account14K) suite.Contains(arry, Account14K)
} else { } else {
suite.NotContains(item.GetArr().Value, Account14K) suite.NotContains(arry, Account14K)
} }
} }
func voteTest(suite *NodeManageTestSuite, addr string, join bool) { func voteTest(suite *NodeManageTestSuite, id string, join bool) {
var count int
config := &pt.ParaNodeAddrConfig{ config := &pt.ParaNodeAddrConfig{
Op: pt.ParaNodeVote, Op: pt.ParaNodeVote,
Addr: addr, Id: id,
Value: pt.ParaNodeVoteYes, Value: pt.ParaNodeVoteYes,
} }
tx, err := pt.CreateRawNodeConfigTx(config) tx, err := pt.CreateRawNodeConfigTx(config)
suite.Nil(err) suite.Nil(err)
count++
receipt := nodeCommit(suite, PrivKeyA, tx) receipt := nodeCommit(suite, PrivKeyA, tx)
checkVoteReceipt(suite, receipt, 1) checkVoteReceipt(suite, receipt, count)
count++
receipt = nodeCommit(suite, PrivKeyB, tx) receipt = nodeCommit(suite, PrivKeyB, tx)
checkVoteReceipt(suite, receipt, 2) checkVoteReceipt(suite, receipt, count)
count++
if !join {
receipt = nodeCommit(suite, PrivKey14K, tx)
checkVoteReceipt(suite, receipt, count)
count++
}
receipt = nodeCommit(suite, PrivKeyC, tx) receipt = nodeCommit(suite, PrivKeyC, tx)
checkVoteDoneReceipt(suite, receipt, 3, join) checkVoteDoneReceipt(suite, receipt, count, join)
} }
func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() { func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
...@@ -222,9 +229,14 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() { ...@@ -222,9 +229,14 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
receipt := nodeCommit(suite, PrivKeyB, tx) receipt := nodeCommit(suite, PrivKeyB, tx)
checkGroupApplyReceipt(suite, receipt) checkGroupApplyReceipt(suite, receipt)
suite.Equal(int32(pt.TyLogParaNodeGroupConfig), receipt.Logs[0].Ty)
var g pt.ReceiptParaNodeGroupConfig
err = types.Decode(receipt.Logs[0].Log, &g)
suite.Nil(err)
config = &pt.ParaNodeGroupConfig{ config = &pt.ParaNodeGroupConfig{
Addrs: applyAddrs, Id: g.Current.Id,
Op: pt.ParacrossNodeGroupQuit, Op: pt.ParacrossNodeGroupQuit,
} }
tx, err = pt.CreateRawNodeGroupApplyTx(config) tx, err = pt.CreateRawNodeGroupApplyTx(config)
suite.Nil(err) suite.Nil(err)
...@@ -247,9 +259,14 @@ func (suite *NodeManageTestSuite) testNodeGroupConfig() { ...@@ -247,9 +259,14 @@ func (suite *NodeManageTestSuite) testNodeGroupConfig() {
receipt := nodeCommit(suite, PrivKeyB, tx) receipt := nodeCommit(suite, PrivKeyB, tx)
checkGroupApplyReceipt(suite, receipt) checkGroupApplyReceipt(suite, receipt)
suite.Equal(int32(pt.TyLogParaNodeGroupConfig), receipt.Logs[0].Ty)
var g pt.ReceiptParaNodeGroupConfig
err = types.Decode(receipt.Logs[0].Log, &g)
suite.Nil(err)
config = &pt.ParaNodeGroupConfig{ config = &pt.ParaNodeGroupConfig{
Addrs: applyAddrs, Id: g.Current.Id,
Op: pt.ParacrossNodeGroupApprove, Op: pt.ParacrossNodeGroupApprove,
} }
tx, err = pt.CreateRawNodeGroupApplyTx(config) tx, err = pt.CreateRawNodeGroupApplyTx(config)
suite.Nil(err) suite.Nil(err)
...@@ -271,13 +288,18 @@ func (suite *NodeManageTestSuite) testNodeConfig() { ...@@ -271,13 +288,18 @@ func (suite *NodeManageTestSuite) testNodeConfig() {
receipt := nodeCommit(suite, PrivKey14K, tx) receipt := nodeCommit(suite, PrivKey14K, tx)
checkJoinReceipt(suite, receipt) checkJoinReceipt(suite, receipt)
suite.Equal(int32(pt.TyLogParaNodeConfig), receipt.Logs[0].Ty)
var g pt.ReceiptParaNodeConfig
err = types.Decode(receipt.Logs[0].Log, &g)
suite.Nil(err)
//vote test //vote test
voteTest(suite, Account14K, true) voteTest(suite, g.Current.Id, true)
//Quit test //Quit test
config = &pt.ParaNodeAddrConfig{ config = &pt.ParaNodeAddrConfig{
Op: pt.ParaNodeQuit, Op: pt.ParaNodeQuit,
Addr: Account1MC, Id: g.Current.Id,
} }
tx, err = pt.CreateRawNodeConfigTx(config) tx, err = pt.CreateRawNodeConfigTx(config)
suite.Nil(err) suite.Nil(err)
...@@ -285,7 +307,7 @@ func (suite *NodeManageTestSuite) testNodeConfig() { ...@@ -285,7 +307,7 @@ func (suite *NodeManageTestSuite) testNodeConfig() {
checkQuitReceipt(suite, receipt) checkQuitReceipt(suite, receipt)
//vote test //vote test
voteTest(suite, Account1MC, false) voteTest(suite, g.Current.Id, false)
} }
func (suite *NodeManageTestSuite) TestExec() { func (suite *NodeManageTestSuite) TestExec() {
...@@ -310,22 +332,22 @@ func (suite *NodeManageTestSuite) TearDownSuite() { ...@@ -310,22 +332,22 @@ func (suite *NodeManageTestSuite) TearDownSuite() {
func TestGetAddrGroup(t *testing.T) { func TestGetAddrGroup(t *testing.T) {
addrs := " 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4, 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR, 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k, ,,, 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs , " addrs := " 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4, 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR, 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k, ,,, 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs , "
retAddrs := getAddrGroup(addrs) retAddrs := getConfigAddrs(addrs)
expectAddrs := []string{"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4", "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR", "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k", "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"} expectAddrs := []string{"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4", "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR", "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k", "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"}
assert.Equal(t, expectAddrs, retAddrs) assert.Equal(t, expectAddrs, retAddrs)
addrs = " 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 , , " addrs = " 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 , , "
retAddrs = getAddrGroup(addrs) retAddrs = getConfigAddrs(addrs)
expectAddrs = []string{"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"} expectAddrs = []string{"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"}
assert.Equal(t, expectAddrs, retAddrs) assert.Equal(t, expectAddrs, retAddrs)
addrs = " , " addrs = " , "
ret := getAddrGroup(addrs) ret := getConfigAddrs(addrs)
assert.Equal(t, []string(nil), ret) assert.Equal(t, []string(nil), ret)
assert.Equal(t, 0, len(ret)) assert.Equal(t, 0, len(ret))
addrs = " " addrs = " "
ret = getAddrGroup(addrs) ret = getConfigAddrs(addrs)
assert.Equal(t, []string(nil), ret) assert.Equal(t, []string(nil), ret)
assert.Equal(t, 0, len(ret)) assert.Equal(t, 0, len(ret))
......
...@@ -47,71 +47,77 @@ message ParacrossConsensusStatus { ...@@ -47,71 +47,77 @@ message ParacrossConsensusStatus {
string consensBlockHash = 4; string consensBlockHash = 4;
} }
message ParaNodeAddrConfig{ message ParaNodeAddrConfig {
string title = 1; string title = 1;
string op = 2; uint32 op = 2;
string addr = 3; string id = 3;
string value = 4; string addr = 4;
int64 coinsFrozen = 5; uint32 value = 5;
int64 coinsFrozen = 6;
} }
message ParaNodeVoteDetail{ message ParaNodeVoteDetail {
repeated string addrs = 1; repeated string addrs = 1;
repeated string votes = 2; repeated string votes = 2;
} }
message ParaNodeAddrStatus{ message ParaNodeAddrIdStatus {
int32 status = 1; string proposalId = 1;
string title = 2; }
string applyAddr = 3;
int64 coinsFrozen = 4; message ParaNodeIdStatus {
ParaNodeVoteDetail votes = 5; string id = 1;
string fromAddr = 6; int32 status = 2;
string title = 3;
string targetAddr = 4;
int64 coinsFrozen = 5;
ParaNodeVoteDetail votes = 6;
string fromAddr = 7;
int64 height = 8;
} }
message ReceiptParaNodeConfig { message ReceiptParaNodeConfig {
string addr = 1; string addr = 1;
ParaNodeAddrConfig config = 2; ParaNodeAddrConfig config = 2;
ParaNodeAddrStatus prev = 3; ParaNodeIdStatus prev = 3;
ParaNodeAddrStatus current = 4; ParaNodeIdStatus current = 4;
} }
message ReceiptParaNodeVoteRecord {
string fromAddr = 1;
string voteAddr = 2;
int32 value = 3;
}
message ReceiptParaNodeVoteDone { message ReceiptParaNodeVoteDone {
string title = 1; string id = 1;
string targetAddr = 2; string title = 2;
int32 totalNodes = 3; string targetAddr = 3;
int32 totalVote = 4; int32 totalNodes = 4;
int32 mostVote = 5; int32 totalVote = 5;
string voteRst = 6; int32 mostVote = 6;
int32 doneStatus = 7; string voteRst = 7;
int32 doneStatus = 8;
} }
message ParaNodeGroupConfig { message ParaNodeGroupConfig {
string title = 1; string title = 1;
uint32 op = 2; uint32 op = 2;
string addrs = 3; string id = 3;
int64 coinsFrozen = 4; string addrs = 4;
uint32 emptyBlockInterval = 5; int64 coinsFrozen = 5;
uint32 emptyBlockInterval = 6;
} }
message ParaNodeGroupStatus { message ParaNodeGroupStatus {
int32 status = 1; string id = 1;
string title = 2; int32 status = 2;
string applyAddr = 3; string title = 3;
int64 coinsFrozen = 4; string targetAddrs = 4;
uint32 emptyBlockInterval = 5; int64 coinsFrozen = 5;
int64 mainHeight = 6; uint32 emptyBlockInterval = 6;
string fromAddr = 7; int64 mainHeight = 7;
string fromAddr = 8;
int64 height = 9;
} }
message ReceiptParaNodeGroupConfig { message ReceiptParaNodeGroupConfig {
...@@ -125,16 +131,18 @@ message ReceiptParaNodeGroupConfig { ...@@ -125,16 +131,18 @@ message ReceiptParaNodeGroupConfig {
// node query // node query
message ReqParacrossNodeInfo { message ReqParacrossNodeInfo {
string title = 1; string title = 1;
string addr = 2; string id = 2;
int32 status = 3; string addr = 3;
int32 status = 4;
} }
message RespParacrossNodeAddrs { message RespParacrossNodeAddrs {
repeated ParaNodeAddrStatus addrs = 1; repeated ParaNodeIdStatus ids = 1;
} }
message RespParacrossNodeGroups { message RespParacrossNodeGroups {
repeated ParaNodeGroupStatus addrs = 1; repeated ParaNodeGroupStatus ids = 1;
} }
message ParaBlock2MainMap { message ParaBlock2MainMap {
......
...@@ -180,13 +180,26 @@ func (c *Jrpc) GetBlock2MainInfo(req *types.ReqBlocks, result *interface{}) erro ...@@ -180,13 +180,26 @@ func (c *Jrpc) GetBlock2MainInfo(req *types.ReqBlocks, result *interface{}) erro
} }
// GetNodeStatus get super node status // GetNodeStatus get super node status
func (c *channelClient) GetNodeStatus(ctx context.Context, req *pt.ReqParacrossNodeInfo) (*pt.ParaNodeAddrStatus, error) { func (c *channelClient) GetNodeStatus(ctx context.Context, req *pt.ReqParacrossNodeInfo) (*pt.ParaNodeIdStatus, error) {
r := *req r := *req
data, err := c.Query(pt.GetExecName(), "GetNodeAddrInfo", &r) data, err := c.Query(pt.GetExecName(), "GetNodeAddrInfo", &r)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if resp, ok := data.(*pt.ParaNodeAddrStatus); ok { if resp, ok := data.(*pt.ParaNodeIdStatus); ok {
return resp, nil
}
return nil, types.ErrDecode
}
// GetNodeStatus get super node status
func (c *channelClient) GetNodeIDStatus(ctx context.Context, req *pt.ReqParacrossNodeInfo) (*pt.ParaNodeIdStatus, error) {
r := *req
data, err := c.Query(pt.GetExecName(), "GetNodeIdInfo", &r)
if err != nil {
return nil, err
}
if resp, ok := data.(*pt.ParaNodeIdStatus); ok {
return resp, nil return resp, nil
} }
return nil, types.ErrDecode return nil, types.ErrDecode
...@@ -194,7 +207,20 @@ func (c *channelClient) GetNodeStatus(ctx context.Context, req *pt.ReqParacrossN ...@@ -194,7 +207,20 @@ func (c *channelClient) GetNodeStatus(ctx context.Context, req *pt.ReqParacrossN
// GetNodeStatus get super node status // GetNodeStatus get super node status
func (c *Jrpc) GetNodeStatus(req *pt.ReqParacrossNodeInfo, result *interface{}) error { func (c *Jrpc) GetNodeStatus(req *pt.ReqParacrossNodeInfo, result *interface{}) error {
data, err := c.cli.GetNodeStatus(context.Background(), req) if req == nil || (req.Addr == "" && req.Id == "") {
return types.ErrInvalidParam
}
var data *pt.ParaNodeIdStatus
var err error
if req.Addr != "" {
data, err = c.cli.GetNodeStatus(context.Background(), req)
}
if req.Id != "" {
data, err = c.cli.GetNodeIDStatus(context.Background(), req)
}
*result = data *result = data
return err return err
} }
......
...@@ -47,8 +47,6 @@ var ( ...@@ -47,8 +47,6 @@ var (
ErrParaNodeGroupFrozenCoinsNotEnough = errors.New("ErrParaNodeGroupFrozenCoinsNotEnough") ErrParaNodeGroupFrozenCoinsNotEnough = errors.New("ErrParaNodeGroupFrozenCoinsNotEnough")
//ErrParaNodeGroupStatusWrong node group process wrong status //ErrParaNodeGroupStatusWrong node group process wrong status
ErrParaNodeGroupStatusWrong = errors.New("ErrParaNodeGroupStatusWrong") ErrParaNodeGroupStatusWrong = errors.New("ErrParaNodeGroupStatusWrong")
//ErrParaNodeGroupAddrNotMatch group addrs not match with apply
ErrParaNodeGroupAddrNotMatch = errors.New("ErrParaNodeGroupAddrNotMatch")
//ErrParaConsensStopBlocksNotReach consensus stop blocks not reach //ErrParaConsensStopBlocksNotReach consensus stop blocks not reach
ErrParaConsensStopBlocksNotReach = errors.New("ErrParaConsensStopBlocksNotReach") ErrParaConsensStopBlocksNotReach = errors.New("ErrParaConsensStopBlocksNotReach")
) )
...@@ -37,12 +37,11 @@ const ( ...@@ -37,12 +37,11 @@ const (
// TyLogParaAssetDeposit asset deposit log key // TyLogParaAssetDeposit asset deposit log key
TyLogParaAssetDeposit = 656 TyLogParaAssetDeposit = 656
// TyLogParaNodeConfig config super node log key // TyLogParaNodeConfig config super node log key
TyLogParaNodeConfig = 657 TyLogParaNodeConfig = 657
TyLogParaNodeVoteDone = 658 TyLogParaNodeVoteDone = 658
TyLogParaNodeGroupUpdate = 659 TyLogParaNodeGroupAddrsUpdate = 659
TyLogParaNodeGroupApply = 660 TyLogParaNodeGroupConfig = 660
TyLogParaNodeGroupApprove = 661 TyLogParaNodeGroupStatusUpdate = 664
TyLogParaNodeGroupQuit = 662
) )
type paracrossCommitTx struct { type paracrossCommitTx struct {
...@@ -90,19 +89,27 @@ const ( ...@@ -90,19 +89,27 @@ const (
// node config op // node config op
const ( const (
ParaNodeJoin = "join" ParaNodeJoin = iota + 1
ParaNodeQuit = "quit" ParaNodeVote
ParaNodeVote = "vote" ParaNodeQuit
)
ParaNodeVoteYes = "yes" // node vote op
ParaNodeVoteNo = "no" const (
ParaNodeVoteInvalid = iota
ParaNodeVoteYes
ParaNodeVoteNo
ParaNodeVoteEnd
) )
// ParaNodeVoteStr ...
var ParaNodeVoteStr = []string{"invalid", "yes", "no"}
const ( const (
// ParacrossNodeAdding apply for adding group // ParacrossNodeJoining apply for adding group
ParacrossNodeAdding = iota + 1 ParacrossNodeJoining = iota + 1
// ParacrossNodeAdded pass to add by votes // ParacrossNodeJoined pass to add by votes
ParacrossNodeAdded ParacrossNodeJoined
// ParacrossNodeQuiting apply for quiting // ParacrossNodeQuiting apply for quiting
ParacrossNodeQuiting ParacrossNodeQuiting
// ParacrossNodeQuited pass to quite by votes // ParacrossNodeQuited pass to quite by votes
...@@ -116,6 +123,8 @@ const ( ...@@ -116,6 +123,8 @@ const (
ParacrossNodeGroupApprove ParacrossNodeGroupApprove
//ParacrossNodeGroupQuit applyer quit the apply when not be approved //ParacrossNodeGroupQuit applyer quit the apply when not be approved
ParacrossNodeGroupQuit ParacrossNodeGroupQuit
//ParacrossNodeGroupModify applyer modify some parameters
ParacrossNodeGroupModify
) )
var ( var (
...@@ -179,6 +188,7 @@ func createRawCommitTx(status *ParacrossNodeStatus, name string, fee int64) (*ty ...@@ -179,6 +188,7 @@ func createRawCommitTx(status *ParacrossNodeStatus, name string, fee int64) (*ty
func CreateRawNodeConfigTx(config *ParaNodeAddrConfig) (*types.Transaction, error) { func CreateRawNodeConfigTx(config *ParaNodeAddrConfig) (*types.Transaction, error) {
config.Title = types.GetTitle() config.Title = types.GetTitle()
config.Addr = strings.Trim(config.Addr, " ") config.Addr = strings.Trim(config.Addr, " ")
config.Id = strings.Trim(config.Id, " ")
action := &ParacrossAction{ action := &ParacrossAction{
Ty: ParacrossActionNodeConfig, Ty: ParacrossActionNodeConfig,
...@@ -195,6 +205,7 @@ func CreateRawNodeConfigTx(config *ParaNodeAddrConfig) (*types.Transaction, erro ...@@ -195,6 +205,7 @@ func CreateRawNodeConfigTx(config *ParaNodeAddrConfig) (*types.Transaction, erro
func CreateRawNodeGroupApplyTx(apply *ParaNodeGroupConfig) (*types.Transaction, error) { func CreateRawNodeGroupApplyTx(apply *ParaNodeGroupConfig) (*types.Transaction, error) {
apply.Title = types.GetTitle() apply.Title = types.GetTitle()
apply.EmptyBlockInterval = 4 apply.EmptyBlockInterval = 4
apply.Id = strings.Trim(apply.Id, " ")
interval := types.Conf("config.consensus.sub.para").GInt("emptyBlockInterval") interval := types.Conf("config.consensus.sub.para").GInt("emptyBlockInterval")
if interval > 0 { if interval > 0 {
apply.EmptyBlockInterval = uint32(interval) apply.EmptyBlockInterval = uint32(interval)
......
...@@ -359,10 +359,11 @@ func (m *ParacrossConsensusStatus) GetConsensBlockHash() string { ...@@ -359,10 +359,11 @@ func (m *ParacrossConsensusStatus) GetConsensBlockHash() string {
type ParaNodeAddrConfig struct { type ParaNodeAddrConfig struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Op string `protobuf:"bytes,2,opt,name=op,proto3" json:"op,omitempty"` Op uint32 `protobuf:"varint,2,opt,name=op,proto3" json:"op,omitempty"`
Addr string `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"` Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` Addr string `protobuf:"bytes,4,opt,name=addr,proto3" json:"addr,omitempty"`
CoinsFrozen int64 `protobuf:"varint,5,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"` Value uint32 `protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"`
CoinsFrozen int64 `protobuf:"varint,6,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -400,10 +401,17 @@ func (m *ParaNodeAddrConfig) GetTitle() string { ...@@ -400,10 +401,17 @@ func (m *ParaNodeAddrConfig) GetTitle() string {
return "" return ""
} }
func (m *ParaNodeAddrConfig) GetOp() string { func (m *ParaNodeAddrConfig) GetOp() uint32 {
if m != nil { if m != nil {
return m.Op return m.Op
} }
return 0
}
func (m *ParaNodeAddrConfig) GetId() string {
if m != nil {
return m.Id
}
return "" return ""
} }
...@@ -414,11 +422,11 @@ func (m *ParaNodeAddrConfig) GetAddr() string { ...@@ -414,11 +422,11 @@ func (m *ParaNodeAddrConfig) GetAddr() string {
return "" return ""
} }
func (m *ParaNodeAddrConfig) GetValue() string { func (m *ParaNodeAddrConfig) GetValue() uint32 {
if m != nil { if m != nil {
return m.Value return m.Value
} }
return "" return 0
} }
func (m *ParaNodeAddrConfig) GetCoinsFrozen() int64 { func (m *ParaNodeAddrConfig) GetCoinsFrozen() int64 {
...@@ -475,90 +483,145 @@ func (m *ParaNodeVoteDetail) GetVotes() []string { ...@@ -475,90 +483,145 @@ func (m *ParaNodeVoteDetail) GetVotes() []string {
return nil return nil
} }
type ParaNodeAddrStatus struct { type ParaNodeAddrIdStatus struct {
Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` ProposalId string `protobuf:"bytes,1,opt,name=proposalId,proto3" json:"proposalId,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
ApplyAddr string `protobuf:"bytes,3,opt,name=applyAddr,proto3" json:"applyAddr,omitempty"` XXX_unrecognized []byte `json:"-"`
CoinsFrozen int64 `protobuf:"varint,4,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"` XXX_sizecache int32 `json:"-"`
Votes *ParaNodeVoteDetail `protobuf:"bytes,5,opt,name=votes,proto3" json:"votes,omitempty"` }
FromAddr string `protobuf:"bytes,6,opt,name=fromAddr,proto3" json:"fromAddr,omitempty"`
func (m *ParaNodeAddrIdStatus) Reset() { *m = ParaNodeAddrIdStatus{} }
func (m *ParaNodeAddrIdStatus) String() string { return proto.CompactTextString(m) }
func (*ParaNodeAddrIdStatus) ProtoMessage() {}
func (*ParaNodeAddrIdStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_6a397e38c9ea6747, []int{7}
}
func (m *ParaNodeAddrIdStatus) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ParaNodeAddrIdStatus.Unmarshal(m, b)
}
func (m *ParaNodeAddrIdStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ParaNodeAddrIdStatus.Marshal(b, m, deterministic)
}
func (m *ParaNodeAddrIdStatus) XXX_Merge(src proto.Message) {
xxx_messageInfo_ParaNodeAddrIdStatus.Merge(m, src)
}
func (m *ParaNodeAddrIdStatus) XXX_Size() int {
return xxx_messageInfo_ParaNodeAddrIdStatus.Size(m)
}
func (m *ParaNodeAddrIdStatus) XXX_DiscardUnknown() {
xxx_messageInfo_ParaNodeAddrIdStatus.DiscardUnknown(m)
}
var xxx_messageInfo_ParaNodeAddrIdStatus proto.InternalMessageInfo
func (m *ParaNodeAddrIdStatus) GetProposalId() string {
if m != nil {
return m.ProposalId
}
return ""
}
type ParaNodeIdStatus struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
TargetAddr string `protobuf:"bytes,4,opt,name=targetAddr,proto3" json:"targetAddr,omitempty"`
CoinsFrozen int64 `protobuf:"varint,5,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"`
Votes *ParaNodeVoteDetail `protobuf:"bytes,6,opt,name=votes,proto3" json:"votes,omitempty"`
FromAddr string `protobuf:"bytes,7,opt,name=fromAddr,proto3" json:"fromAddr,omitempty"`
Height int64 `protobuf:"varint,8,opt,name=height,proto3" json:"height,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *ParaNodeAddrStatus) Reset() { *m = ParaNodeAddrStatus{} } func (m *ParaNodeIdStatus) Reset() { *m = ParaNodeIdStatus{} }
func (m *ParaNodeAddrStatus) String() string { return proto.CompactTextString(m) } func (m *ParaNodeIdStatus) String() string { return proto.CompactTextString(m) }
func (*ParaNodeAddrStatus) ProtoMessage() {} func (*ParaNodeIdStatus) ProtoMessage() {}
func (*ParaNodeAddrStatus) Descriptor() ([]byte, []int) { func (*ParaNodeIdStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_6a397e38c9ea6747, []int{7} return fileDescriptor_6a397e38c9ea6747, []int{8}
} }
func (m *ParaNodeAddrStatus) XXX_Unmarshal(b []byte) error { func (m *ParaNodeIdStatus) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ParaNodeAddrStatus.Unmarshal(m, b) return xxx_messageInfo_ParaNodeIdStatus.Unmarshal(m, b)
} }
func (m *ParaNodeAddrStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *ParaNodeIdStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ParaNodeAddrStatus.Marshal(b, m, deterministic) return xxx_messageInfo_ParaNodeIdStatus.Marshal(b, m, deterministic)
} }
func (m *ParaNodeAddrStatus) XXX_Merge(src proto.Message) { func (m *ParaNodeIdStatus) XXX_Merge(src proto.Message) {
xxx_messageInfo_ParaNodeAddrStatus.Merge(m, src) xxx_messageInfo_ParaNodeIdStatus.Merge(m, src)
} }
func (m *ParaNodeAddrStatus) XXX_Size() int { func (m *ParaNodeIdStatus) XXX_Size() int {
return xxx_messageInfo_ParaNodeAddrStatus.Size(m) return xxx_messageInfo_ParaNodeIdStatus.Size(m)
} }
func (m *ParaNodeAddrStatus) XXX_DiscardUnknown() { func (m *ParaNodeIdStatus) XXX_DiscardUnknown() {
xxx_messageInfo_ParaNodeAddrStatus.DiscardUnknown(m) xxx_messageInfo_ParaNodeIdStatus.DiscardUnknown(m)
} }
var xxx_messageInfo_ParaNodeAddrStatus proto.InternalMessageInfo var xxx_messageInfo_ParaNodeIdStatus proto.InternalMessageInfo
func (m *ParaNodeIdStatus) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ParaNodeAddrStatus) GetStatus() int32 { func (m *ParaNodeIdStatus) GetStatus() int32 {
if m != nil { if m != nil {
return m.Status return m.Status
} }
return 0 return 0
} }
func (m *ParaNodeAddrStatus) GetTitle() string { func (m *ParaNodeIdStatus) GetTitle() string {
if m != nil { if m != nil {
return m.Title return m.Title
} }
return "" return ""
} }
func (m *ParaNodeAddrStatus) GetApplyAddr() string { func (m *ParaNodeIdStatus) GetTargetAddr() string {
if m != nil { if m != nil {
return m.ApplyAddr return m.TargetAddr
} }
return "" return ""
} }
func (m *ParaNodeAddrStatus) GetCoinsFrozen() int64 { func (m *ParaNodeIdStatus) GetCoinsFrozen() int64 {
if m != nil { if m != nil {
return m.CoinsFrozen return m.CoinsFrozen
} }
return 0 return 0
} }
func (m *ParaNodeAddrStatus) GetVotes() *ParaNodeVoteDetail { func (m *ParaNodeIdStatus) GetVotes() *ParaNodeVoteDetail {
if m != nil { if m != nil {
return m.Votes return m.Votes
} }
return nil return nil
} }
func (m *ParaNodeAddrStatus) GetFromAddr() string { func (m *ParaNodeIdStatus) GetFromAddr() string {
if m != nil { if m != nil {
return m.FromAddr return m.FromAddr
} }
return "" return ""
} }
func (m *ParaNodeIdStatus) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
type ReceiptParaNodeConfig struct { type ReceiptParaNodeConfig struct {
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
Config *ParaNodeAddrConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` Config *ParaNodeAddrConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
Prev *ParaNodeAddrStatus `protobuf:"bytes,3,opt,name=prev,proto3" json:"prev,omitempty"` Prev *ParaNodeIdStatus `protobuf:"bytes,3,opt,name=prev,proto3" json:"prev,omitempty"`
Current *ParaNodeAddrStatus `protobuf:"bytes,4,opt,name=current,proto3" json:"current,omitempty"` Current *ParaNodeIdStatus `protobuf:"bytes,4,opt,name=current,proto3" json:"current,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -568,7 +631,7 @@ func (m *ReceiptParaNodeConfig) Reset() { *m = ReceiptParaNodeConfig{} } ...@@ -568,7 +631,7 @@ func (m *ReceiptParaNodeConfig) Reset() { *m = ReceiptParaNodeConfig{} }
func (m *ReceiptParaNodeConfig) String() string { return proto.CompactTextString(m) } func (m *ReceiptParaNodeConfig) String() string { return proto.CompactTextString(m) }
func (*ReceiptParaNodeConfig) ProtoMessage() {} func (*ReceiptParaNodeConfig) ProtoMessage() {}
func (*ReceiptParaNodeConfig) Descriptor() ([]byte, []int) { func (*ReceiptParaNodeConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_6a397e38c9ea6747, []int{8} return fileDescriptor_6a397e38c9ea6747, []int{9}
} }
func (m *ReceiptParaNodeConfig) XXX_Unmarshal(b []byte) error { func (m *ReceiptParaNodeConfig) XXX_Unmarshal(b []byte) error {
...@@ -603,83 +666,29 @@ func (m *ReceiptParaNodeConfig) GetConfig() *ParaNodeAddrConfig { ...@@ -603,83 +666,29 @@ func (m *ReceiptParaNodeConfig) GetConfig() *ParaNodeAddrConfig {
return nil return nil
} }
func (m *ReceiptParaNodeConfig) GetPrev() *ParaNodeAddrStatus { func (m *ReceiptParaNodeConfig) GetPrev() *ParaNodeIdStatus {
if m != nil { if m != nil {
return m.Prev return m.Prev
} }
return nil return nil
} }
func (m *ReceiptParaNodeConfig) GetCurrent() *ParaNodeAddrStatus { func (m *ReceiptParaNodeConfig) GetCurrent() *ParaNodeIdStatus {
if m != nil { if m != nil {
return m.Current return m.Current
} }
return nil return nil
} }
type ReceiptParaNodeVoteRecord struct {
FromAddr string `protobuf:"bytes,1,opt,name=fromAddr,proto3" json:"fromAddr,omitempty"`
VoteAddr string `protobuf:"bytes,2,opt,name=voteAddr,proto3" json:"voteAddr,omitempty"`
Value int32 `protobuf:"varint,3,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReceiptParaNodeVoteRecord) Reset() { *m = ReceiptParaNodeVoteRecord{} }
func (m *ReceiptParaNodeVoteRecord) String() string { return proto.CompactTextString(m) }
func (*ReceiptParaNodeVoteRecord) ProtoMessage() {}
func (*ReceiptParaNodeVoteRecord) Descriptor() ([]byte, []int) {
return fileDescriptor_6a397e38c9ea6747, []int{9}
}
func (m *ReceiptParaNodeVoteRecord) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiptParaNodeVoteRecord.Unmarshal(m, b)
}
func (m *ReceiptParaNodeVoteRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReceiptParaNodeVoteRecord.Marshal(b, m, deterministic)
}
func (m *ReceiptParaNodeVoteRecord) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReceiptParaNodeVoteRecord.Merge(m, src)
}
func (m *ReceiptParaNodeVoteRecord) XXX_Size() int {
return xxx_messageInfo_ReceiptParaNodeVoteRecord.Size(m)
}
func (m *ReceiptParaNodeVoteRecord) XXX_DiscardUnknown() {
xxx_messageInfo_ReceiptParaNodeVoteRecord.DiscardUnknown(m)
}
var xxx_messageInfo_ReceiptParaNodeVoteRecord proto.InternalMessageInfo
func (m *ReceiptParaNodeVoteRecord) GetFromAddr() string {
if m != nil {
return m.FromAddr
}
return ""
}
func (m *ReceiptParaNodeVoteRecord) GetVoteAddr() string {
if m != nil {
return m.VoteAddr
}
return ""
}
func (m *ReceiptParaNodeVoteRecord) GetValue() int32 {
if m != nil {
return m.Value
}
return 0
}
type ReceiptParaNodeVoteDone struct { type ReceiptParaNodeVoteDone struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
TargetAddr string `protobuf:"bytes,2,opt,name=targetAddr,proto3" json:"targetAddr,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
TotalNodes int32 `protobuf:"varint,3,opt,name=totalNodes,proto3" json:"totalNodes,omitempty"` TargetAddr string `protobuf:"bytes,3,opt,name=targetAddr,proto3" json:"targetAddr,omitempty"`
TotalVote int32 `protobuf:"varint,4,opt,name=totalVote,proto3" json:"totalVote,omitempty"` TotalNodes int32 `protobuf:"varint,4,opt,name=totalNodes,proto3" json:"totalNodes,omitempty"`
MostVote int32 `protobuf:"varint,5,opt,name=mostVote,proto3" json:"mostVote,omitempty"` TotalVote int32 `protobuf:"varint,5,opt,name=totalVote,proto3" json:"totalVote,omitempty"`
VoteRst string `protobuf:"bytes,6,opt,name=voteRst,proto3" json:"voteRst,omitempty"` MostVote int32 `protobuf:"varint,6,opt,name=mostVote,proto3" json:"mostVote,omitempty"`
DoneStatus int32 `protobuf:"varint,7,opt,name=doneStatus,proto3" json:"doneStatus,omitempty"` VoteRst string `protobuf:"bytes,7,opt,name=voteRst,proto3" json:"voteRst,omitempty"`
DoneStatus int32 `protobuf:"varint,8,opt,name=doneStatus,proto3" json:"doneStatus,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -710,6 +719,13 @@ func (m *ReceiptParaNodeVoteDone) XXX_DiscardUnknown() { ...@@ -710,6 +719,13 @@ func (m *ReceiptParaNodeVoteDone) XXX_DiscardUnknown() {
var xxx_messageInfo_ReceiptParaNodeVoteDone proto.InternalMessageInfo var xxx_messageInfo_ReceiptParaNodeVoteDone proto.InternalMessageInfo
func (m *ReceiptParaNodeVoteDone) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ReceiptParaNodeVoteDone) GetTitle() string { func (m *ReceiptParaNodeVoteDone) GetTitle() string {
if m != nil { if m != nil {
return m.Title return m.Title
...@@ -762,9 +778,10 @@ func (m *ReceiptParaNodeVoteDone) GetDoneStatus() int32 { ...@@ -762,9 +778,10 @@ func (m *ReceiptParaNodeVoteDone) GetDoneStatus() int32 {
type ParaNodeGroupConfig struct { type ParaNodeGroupConfig struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Op uint32 `protobuf:"varint,2,opt,name=op,proto3" json:"op,omitempty"` Op uint32 `protobuf:"varint,2,opt,name=op,proto3" json:"op,omitempty"`
Addrs string `protobuf:"bytes,3,opt,name=addrs,proto3" json:"addrs,omitempty"` Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
CoinsFrozen int64 `protobuf:"varint,4,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"` Addrs string `protobuf:"bytes,4,opt,name=addrs,proto3" json:"addrs,omitempty"`
EmptyBlockInterval uint32 `protobuf:"varint,5,opt,name=emptyBlockInterval,proto3" json:"emptyBlockInterval,omitempty"` CoinsFrozen int64 `protobuf:"varint,5,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"`
EmptyBlockInterval uint32 `protobuf:"varint,6,opt,name=emptyBlockInterval,proto3" json:"emptyBlockInterval,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -809,6 +826,13 @@ func (m *ParaNodeGroupConfig) GetOp() uint32 { ...@@ -809,6 +826,13 @@ func (m *ParaNodeGroupConfig) GetOp() uint32 {
return 0 return 0
} }
func (m *ParaNodeGroupConfig) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ParaNodeGroupConfig) GetAddrs() string { func (m *ParaNodeGroupConfig) GetAddrs() string {
if m != nil { if m != nil {
return m.Addrs return m.Addrs
...@@ -831,13 +855,15 @@ func (m *ParaNodeGroupConfig) GetEmptyBlockInterval() uint32 { ...@@ -831,13 +855,15 @@ func (m *ParaNodeGroupConfig) GetEmptyBlockInterval() uint32 {
} }
type ParaNodeGroupStatus struct { type ParaNodeGroupStatus struct {
Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
ApplyAddr string `protobuf:"bytes,3,opt,name=applyAddr,proto3" json:"applyAddr,omitempty"` Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
CoinsFrozen int64 `protobuf:"varint,4,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"` TargetAddrs string `protobuf:"bytes,4,opt,name=targetAddrs,proto3" json:"targetAddrs,omitempty"`
EmptyBlockInterval uint32 `protobuf:"varint,5,opt,name=emptyBlockInterval,proto3" json:"emptyBlockInterval,omitempty"` CoinsFrozen int64 `protobuf:"varint,5,opt,name=coinsFrozen,proto3" json:"coinsFrozen,omitempty"`
MainHeight int64 `protobuf:"varint,6,opt,name=mainHeight,proto3" json:"mainHeight,omitempty"` EmptyBlockInterval uint32 `protobuf:"varint,6,opt,name=emptyBlockInterval,proto3" json:"emptyBlockInterval,omitempty"`
FromAddr string `protobuf:"bytes,7,opt,name=fromAddr,proto3" json:"fromAddr,omitempty"` MainHeight int64 `protobuf:"varint,7,opt,name=mainHeight,proto3" json:"mainHeight,omitempty"`
FromAddr string `protobuf:"bytes,8,opt,name=fromAddr,proto3" json:"fromAddr,omitempty"`
Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -868,6 +894,13 @@ func (m *ParaNodeGroupStatus) XXX_DiscardUnknown() { ...@@ -868,6 +894,13 @@ func (m *ParaNodeGroupStatus) XXX_DiscardUnknown() {
var xxx_messageInfo_ParaNodeGroupStatus proto.InternalMessageInfo var xxx_messageInfo_ParaNodeGroupStatus proto.InternalMessageInfo
func (m *ParaNodeGroupStatus) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ParaNodeGroupStatus) GetStatus() int32 { func (m *ParaNodeGroupStatus) GetStatus() int32 {
if m != nil { if m != nil {
return m.Status return m.Status
...@@ -882,9 +915,9 @@ func (m *ParaNodeGroupStatus) GetTitle() string { ...@@ -882,9 +915,9 @@ func (m *ParaNodeGroupStatus) GetTitle() string {
return "" return ""
} }
func (m *ParaNodeGroupStatus) GetApplyAddr() string { func (m *ParaNodeGroupStatus) GetTargetAddrs() string {
if m != nil { if m != nil {
return m.ApplyAddr return m.TargetAddrs
} }
return "" return ""
} }
...@@ -917,6 +950,13 @@ func (m *ParaNodeGroupStatus) GetFromAddr() string { ...@@ -917,6 +950,13 @@ func (m *ParaNodeGroupStatus) GetFromAddr() string {
return "" return ""
} }
func (m *ParaNodeGroupStatus) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
type ReceiptParaNodeGroupConfig struct { type ReceiptParaNodeGroupConfig struct {
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
Config *ParaNodeGroupConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` Config *ParaNodeGroupConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
...@@ -983,8 +1023,9 @@ func (m *ReceiptParaNodeGroupConfig) GetCurrent() *ParaNodeGroupStatus { ...@@ -983,8 +1023,9 @@ func (m *ReceiptParaNodeGroupConfig) GetCurrent() *ParaNodeGroupStatus {
// node query // node query
type ReqParacrossNodeInfo struct { type ReqParacrossNodeInfo struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
Status int32 `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"` Addr string `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -1022,6 +1063,13 @@ func (m *ReqParacrossNodeInfo) GetTitle() string { ...@@ -1022,6 +1063,13 @@ func (m *ReqParacrossNodeInfo) GetTitle() string {
return "" return ""
} }
func (m *ReqParacrossNodeInfo) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ReqParacrossNodeInfo) GetAddr() string { func (m *ReqParacrossNodeInfo) GetAddr() string {
if m != nil { if m != nil {
return m.Addr return m.Addr
...@@ -1037,10 +1085,10 @@ func (m *ReqParacrossNodeInfo) GetStatus() int32 { ...@@ -1037,10 +1085,10 @@ func (m *ReqParacrossNodeInfo) GetStatus() int32 {
} }
type RespParacrossNodeAddrs struct { type RespParacrossNodeAddrs struct {
Addrs []*ParaNodeAddrStatus `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs,omitempty"` Ids []*ParaNodeIdStatus `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *RespParacrossNodeAddrs) Reset() { *m = RespParacrossNodeAddrs{} } func (m *RespParacrossNodeAddrs) Reset() { *m = RespParacrossNodeAddrs{} }
...@@ -1068,15 +1116,15 @@ func (m *RespParacrossNodeAddrs) XXX_DiscardUnknown() { ...@@ -1068,15 +1116,15 @@ func (m *RespParacrossNodeAddrs) XXX_DiscardUnknown() {
var xxx_messageInfo_RespParacrossNodeAddrs proto.InternalMessageInfo var xxx_messageInfo_RespParacrossNodeAddrs proto.InternalMessageInfo
func (m *RespParacrossNodeAddrs) GetAddrs() []*ParaNodeAddrStatus { func (m *RespParacrossNodeAddrs) GetIds() []*ParaNodeIdStatus {
if m != nil { if m != nil {
return m.Addrs return m.Ids
} }
return nil return nil
} }
type RespParacrossNodeGroups struct { type RespParacrossNodeGroups struct {
Addrs []*ParaNodeGroupStatus `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs,omitempty"` Ids []*ParaNodeGroupStatus `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -1107,9 +1155,9 @@ func (m *RespParacrossNodeGroups) XXX_DiscardUnknown() { ...@@ -1107,9 +1155,9 @@ func (m *RespParacrossNodeGroups) XXX_DiscardUnknown() {
var xxx_messageInfo_RespParacrossNodeGroups proto.InternalMessageInfo var xxx_messageInfo_RespParacrossNodeGroups proto.InternalMessageInfo
func (m *RespParacrossNodeGroups) GetAddrs() []*ParaNodeGroupStatus { func (m *RespParacrossNodeGroups) GetIds() []*ParaNodeGroupStatus {
if m != nil { if m != nil {
return m.Addrs return m.Ids
} }
return nil return nil
} }
...@@ -2477,9 +2525,9 @@ func init() { ...@@ -2477,9 +2525,9 @@ func init() {
proto.RegisterType((*ParacrossConsensusStatus)(nil), "types.ParacrossConsensusStatus") proto.RegisterType((*ParacrossConsensusStatus)(nil), "types.ParacrossConsensusStatus")
proto.RegisterType((*ParaNodeAddrConfig)(nil), "types.ParaNodeAddrConfig") proto.RegisterType((*ParaNodeAddrConfig)(nil), "types.ParaNodeAddrConfig")
proto.RegisterType((*ParaNodeVoteDetail)(nil), "types.ParaNodeVoteDetail") proto.RegisterType((*ParaNodeVoteDetail)(nil), "types.ParaNodeVoteDetail")
proto.RegisterType((*ParaNodeAddrStatus)(nil), "types.ParaNodeAddrStatus") proto.RegisterType((*ParaNodeAddrIdStatus)(nil), "types.ParaNodeAddrIdStatus")
proto.RegisterType((*ParaNodeIdStatus)(nil), "types.ParaNodeIdStatus")
proto.RegisterType((*ReceiptParaNodeConfig)(nil), "types.ReceiptParaNodeConfig") proto.RegisterType((*ReceiptParaNodeConfig)(nil), "types.ReceiptParaNodeConfig")
proto.RegisterType((*ReceiptParaNodeVoteRecord)(nil), "types.ReceiptParaNodeVoteRecord")
proto.RegisterType((*ReceiptParaNodeVoteDone)(nil), "types.ReceiptParaNodeVoteDone") proto.RegisterType((*ReceiptParaNodeVoteDone)(nil), "types.ReceiptParaNodeVoteDone")
proto.RegisterType((*ParaNodeGroupConfig)(nil), "types.ParaNodeGroupConfig") proto.RegisterType((*ParaNodeGroupConfig)(nil), "types.ParaNodeGroupConfig")
proto.RegisterType((*ParaNodeGroupStatus)(nil), "types.ParaNodeGroupStatus") proto.RegisterType((*ParaNodeGroupStatus)(nil), "types.ParaNodeGroupStatus")
...@@ -2508,116 +2556,119 @@ func init() { ...@@ -2508,116 +2556,119 @@ func init() {
func init() { proto.RegisterFile("paracross.proto", fileDescriptor_6a397e38c9ea6747) } func init() { proto.RegisterFile("paracross.proto", fileDescriptor_6a397e38c9ea6747) }
var fileDescriptor_6a397e38c9ea6747 = []byte{ var fileDescriptor_6a397e38c9ea6747 = []byte{
// 1743 bytes of a gzipped FileDescriptorProto // 1788 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x18, 0x4b, 0x6f, 0x1c, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcd, 0x6f, 0x23, 0x4b,
0x73, 0x67, 0x9f, 0xde, 0xb2, 0xbd, 0xb6, 0x3b, 0xb1, 0xb3, 0xd9, 0x2f, 0x5f, 0xb2, 0x1a, 0x05, 0x11, 0xf7, 0xf8, 0xdb, 0x95, 0xd8, 0x49, 0xfa, 0x6d, 0xb2, 0xc6, 0x3c, 0xf2, 0xac, 0xd1, 0x03,
0x64, 0xa1, 0xe0, 0x04, 0x1b, 0x05, 0xa1, 0x08, 0x81, 0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, 0xc8, 0x29, 0xbb,
0x36, 0x44, 0xee, 0x96, 0xd8, 0x0d, 0xa8, 0xef, 0x88, 0xdd, 0x93, 0xb0, 0x5f, 0x74, 0xcd, 0x92, 0x30, 0x0f, 0x0b, 0x15, 0xab, 0x0a, 0x77, 0xb0, 0x36, 0xbf, 0xfc, 0x0a, 0xbb, 0x80, 0x5e, 0xe6,
0x06, 0x77, 0xc4, 0x96, 0x3f, 0x3a, 0x3c, 0x92, 0x1f, 0xc6, 0x6e, 0xe9, 0x59, 0x9d, 0xfe, 0xa0, 0xcd, 0x7b, 0x6a, 0xfb, 0x64, 0xe3, 0x94, 0x90, 0x89, 0x5f, 0x61, 0x9f, 0xc3, 0xee, 0x99, 0x50,
0x6f, 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x57, 0x1a, 0xc4, 0x9e, 0x17, 0x00, 0x00, 0x94, 0x5a, 0xf9, 0x96, 0xd9, 0x2b, 0xd4, 0x62, 0x5a, 0x0c, 0xf6, 0xcb, 0x6a, 0x48, 0xdc, 0xaf,
0xb0, 0x07, 0xd0, 0x3c, 0x97, 0x17, 0xb7, 0xd1, 0xb8, 0x0c, 0xcd, 0x9e, 0x21, 0xcf, 0xe5, 0x69,
0xb0, 0xb8, 0x9e, 0xaa, 0x9f, 0x24, 0x7e, 0xe5, 0x75, 0x93, 0xfe, 0x94, 0x7f, 0xf8, 0x9f, 0x00,
0x00, 0x00, 0xff, 0xff, 0xd3, 0xee, 0x12, 0x0b, 0xf1, 0x17, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -54,19 +54,18 @@ func (p *ParacrossType) GetName() string { ...@@ -54,19 +54,18 @@ func (p *ParacrossType) GetName() string {
// GetLogMap get receipt log map // GetLogMap get receipt log map
func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo { func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo {
return map[int64]*types.LogInfo{ return map[int64]*types.LogInfo{
TyLogParacrossCommit: {Ty: reflect.TypeOf(ReceiptParacrossCommit{}), Name: "LogParacrossCommit"}, TyLogParacrossCommit: {Ty: reflect.TypeOf(ReceiptParacrossCommit{}), Name: "LogParacrossCommit"},
TyLogParacrossCommitDone: {Ty: reflect.TypeOf(ReceiptParacrossDone{}), Name: "LogParacrossCommitDone"}, TyLogParacrossCommitDone: {Ty: reflect.TypeOf(ReceiptParacrossDone{}), Name: "LogParacrossCommitDone"},
TyLogParacrossCommitRecord: {Ty: reflect.TypeOf(ReceiptParacrossRecord{}), Name: "LogParacrossCommitRecord"}, TyLogParacrossCommitRecord: {Ty: reflect.TypeOf(ReceiptParacrossRecord{}), Name: "LogParacrossCommitRecord"},
TyLogParaAssetWithdraw: {Ty: reflect.TypeOf(types.ReceiptAccountTransfer{}), Name: "LogParaAssetWithdraw"}, TyLogParaAssetWithdraw: {Ty: reflect.TypeOf(types.ReceiptAccountTransfer{}), Name: "LogParaAssetWithdraw"},
TyLogParaAssetTransfer: {Ty: reflect.TypeOf(types.ReceiptAccountTransfer{}), Name: "LogParaAssetTransfer"}, TyLogParaAssetTransfer: {Ty: reflect.TypeOf(types.ReceiptAccountTransfer{}), Name: "LogParaAssetTransfer"},
TyLogParaAssetDeposit: {Ty: reflect.TypeOf(types.ReceiptAccountTransfer{}), Name: "LogParaAssetDeposit"}, TyLogParaAssetDeposit: {Ty: reflect.TypeOf(types.ReceiptAccountTransfer{}), Name: "LogParaAssetDeposit"},
TyLogParacrossMiner: {Ty: reflect.TypeOf(ReceiptParacrossMiner{}), Name: "LogParacrossMiner"}, TyLogParacrossMiner: {Ty: reflect.TypeOf(ReceiptParacrossMiner{}), Name: "LogParacrossMiner"},
TyLogParaNodeConfig: {Ty: reflect.TypeOf(ReceiptParaNodeConfig{}), Name: "LogParaNodeConfig"}, TyLogParaNodeConfig: {Ty: reflect.TypeOf(ReceiptParaNodeConfig{}), Name: "LogParaNodeConfig"},
TyLogParaNodeGroupUpdate: {Ty: reflect.TypeOf(types.ReceiptConfig{}), Name: "LogParaNodeGroupUpdate"}, TyLogParaNodeGroupAddrsUpdate: {Ty: reflect.TypeOf(types.ReceiptConfig{}), Name: "LogParaNodeGroupAddrsUpdate"},
TyLogParaNodeVoteDone: {Ty: reflect.TypeOf(ReceiptParaNodeVoteDone{}), Name: "LogParaNodeVoteDone"}, TyLogParaNodeVoteDone: {Ty: reflect.TypeOf(ReceiptParaNodeVoteDone{}), Name: "LogParaNodeVoteDone"},
TyLogParaNodeGroupApply: {Ty: reflect.TypeOf(ReceiptParaNodeGroupConfig{}), Name: "LogParaNodeGroupApply"}, TyLogParaNodeGroupConfig: {Ty: reflect.TypeOf(ReceiptParaNodeGroupConfig{}), Name: "LogParaNodeGroupConfig"},
TyLogParaNodeGroupApprove: {Ty: reflect.TypeOf(ReceiptParaNodeGroupConfig{}), Name: "LogParaNodeGroupApprove"}, TyLogParaNodeGroupStatusUpdate: {Ty: reflect.TypeOf(ReceiptParaNodeGroupConfig{}), Name: "LogParaNodeGroupStatusUpdate"},
TyLogParaNodeGroupQuit: {Ty: reflect.TypeOf(ReceiptParaNodeGroupConfig{}), Name: "LogParaNodeGroupQuit"},
} }
} }
......
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