Repository: 33cn/plugin (go)

Issue:
nodegroup id的前缀信息需要程序内部处理
mavl-paracross-id-nodegroup.txid,对外只能呈现txid部分，前缀部分要程序附加上，防止引起安全问题

Pull request:
超级节点id 屏蔽mavl- 前缀
fixes #580

Patch:
diff --git a/Makefile b/Makefile
index 18049b894..87d3f5fde 100644
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,9 @@ SRC_CLI := github.com/33cn/plugin/cli
 APP := build/chain33
 CHAIN33=github.com/33cn/chain33
 CHAIN33_VERSION=$(shell nl go.mod |grep "github.com/33cn/chain33" |awk '{print $$3}')
-export CHAIN33_PATH=${GOPATH}/pkg/mod/github.com/33cn/chain33@${CHAIN33_VERSION}
-export PLUGIN_PATH=${GOPATH}/src/github.com/33cn/plugin
+GO_PATH=$(shell go env GOPATH)
+export CHAIN33_PATH=${GO_PATH}/pkg/mod/github.com/33cn/chain33@${CHAIN33_VERSION}
+export PLUGIN_PATH=${GO_PATH}/src/github.com/33cn/plugin
 BUILD_FLAGS = -ldflags "-X ${CHAIN33_PATH}/common/version.GitCommit=`git rev-parse --short=8 HEAD`"
 LDFLAGS := -ldflags "-w -s"
 PKG_LIST_VET := `go list ./... | grep -v "vendor" | grep -v plugin/dapp/evm/executor/vm/common/crypto/bn256`
@@ -27,7 +28,7 @@ default: depends build
 build: depends
 	go build $(BUILD_FLAGS) -v -i -o $(APP)
 	go build $(BUILD_FLAGS) -v -i -o $(CLI) $(SRC_CLI)
-	@cp chain33.toml $(CHAIN33_PATH)/build/system-test-rpc.sh build/
+	@cp chain33.toml  $(CHAIN33_PATH)/build/system-test-rpc.sh build/
 	@cp chain33.para.toml build/ci/paracross/
 
 
diff --git a/appveyor.yml b/appveyor.yml
index a4d00a0db..62423ef83 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -9,7 +9,9 @@ clone_folder: c:\gopath\src\github.com\33cn\plugin
 environment:
   GOPATH: c:\gopath
   DEPTESTBYPASS501: 1
-  GOVERSION: 1.9
+  GOVERSION: 1.12
+  GO111MODULE: on
+  
 
 #init:
 #  - git config --global core.autocrlf input
@@ -23,6 +25,7 @@ install:
   - msiexec /i go%GOVERSION%.windows-amd64.msi /q
 #  - choco install bzr
   - set Path=c:\go\bin;c:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial\%Path%
+  - set GO111MODULE=on
   - go version
   - go env
 
diff --git a/build/docker-compose.sh b/build/docker-compose.sh
index 9a7aaf2f7..bb85adfe4 100755
--- a/build/docker-compose.sh
+++ b/build/docker-compose.sh
@@ -234,6 +234,31 @@ function block_wait() {
     echo "wait new block $count s, cur height=$expect,old=$cur_height"
 }
 
+function block_wait2height() {
+    if [ "$#" -lt 3 ]; then
+        echo "wrong block_wait params"
+        exit 1
+    fi
+    local count=0
+    local new_height=0
+    local expect=${2}
+    local isPara=${3}
+
+    while true; do
+        new_height=$(${1} block last_header | jq ".height")
+        if [ "$isPara" == "1" ]; then
+            ${1} para blocks -s "$new_height" -e "$new_height"
+            new_height=$(${1} para blocks -s "$new_height" -e "$new_height" | jq ".items[0].mainHeight")
+        fi
+        if [ "${new_height}" -ge "${expect}" ]; then
+            break
+        fi
+        count=$((count + 1))
+        sleep 1
+    done
+    echo "wait new block $count s, cur_height=$new_height,expect=$expect"
+}
+
 function check_docker_status() {
     status=$(docker-compose ps | grep chain33_1 | awk '{print $6}')
     statusPara=$(docker-compose ps | grep chain33_1 | awk '{print $3}')
diff --git a/go.mod b/go.mod
index f56034f33..0ee043899 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/33cn/plugin
 go 1.12
 
 require (
-	github.com/33cn/chain33 v0.0.0-20190823042135-d05c4b3b53e3
+	github.com/33cn/chain33 v0.0.0-20190823170527-b17a0bf285c4
 	github.com/BurntSushi/toml v0.3.1
 	github.com/NebulousLabs/Sia v1.3.7
 	github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac
diff --git a/go.sum b/go.sum
index 61473fb2b..0a180351d 100644
--- a/go.sum
+++ b/go.sum
@@ -1,6 +1,6 @@
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
-github.com/33cn/chain33 v0.0.0-20190823042135-d05c4b3b53e3 h1:MU2A1//oeTZPYXdn0kvwMDevQpboK469+xre8t5VYH4=
-github.com/33cn/chain33 v0.0.0-20190823042135-d05c4b3b53e3/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
+github.com/33cn/chain33 v0.0.0-20190823170527-b17a0bf285c4 h1:gZoxmpkc4rB7cWxaYWPIGQUT9lmX7ao1QEYgCsc6eAA=
+github.com/33cn/chain33 v0.0.0-20190823170527-b17a0bf285c4/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
 github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 h1:PqzgE6kAMi81xWQA2QIVxjWkFHptGgC547vchpUbtFo=
 github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
@@ -26,7 +26,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
-github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
 github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
 github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac h1:/zx+Hglw2JN/pwVam1Z8cTCTl4pWyrbvOn2oooqCQSs=
 github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ=
@@ -60,9 +59,7 @@ github.com/dgraph-io/badger v1.5.4 h1:gVTrpUTbbr/T24uvoCaqY2KSHfNLVGm0w+hbee2HMe
 github.com/dgraph-io/badger v1.5.4/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ=
 github.com/dgryski/go-farm v0.0.0-20180109070241-2de33835d102 h1:afESQBXJEnj3fu+34X//E8Wg3nEbMJxJkwSc0tPePK0=
 github.com/dgryski/go-farm v0.0.0-20180109070241-2de33835d102/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
-github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
-github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
@@ -92,7 +89,6 @@ github.com/haltingstate/secp256k1-go v0.0.0-20151224084235-572209b26df6 h1:HE4YD
 github.com/haltingstate/secp256k1-go v0.0.0-20151224084235-572209b26df6/go.mod h1:73mKQiY8bLnscfGakn57WAJZTzT0eSUAy3qgMQNR/DI=
 github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
 github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
-github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo=
 github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
@@ -131,9 +127,7 @@ github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ=
 github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
 github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
 github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
 github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -238,14 +232,12 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
 gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
 gopkg.in/go-playground/webhooks.v5 v5.2.0/go.mod h1:LZbya/qLVdbqDR1aKrGuWV6qbia2zCYSR5dpom2SInQ=
 gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3 h1:AFxeG48hTWHhDTQDk/m2gorfVHUEa9vo3tp3D7TzwjI=
 gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
 gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI=
 gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78=
-gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
 gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs=
 gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk=
diff --git a/plugin/consensus/para/para.go b/plugin/consensus/para/para.go
index 38f13139d..a39d1b3ba 100644
--- a/plugin/consensus/para/para.go
+++ b/plugin/consensus/para/para.go
@@ -41,7 +41,6 @@ const (
 	defaultMainBlockHashForkHeight  int64 = 209186          //calc block hash fork height in main chain
 	mainParaSelfConsensusForkHeight int64 = types.MaxHeight //para chain self consensus height switch, must >= ForkParacrossCommitTx of main
 	mainForkParacrossCommitTx       int64 = types.MaxHeight //support paracross commit tx fork height in main chain: ForkParacrossCommitTx
-	batchFetchBlockCount            int64 = 1000
 )
 
 var (
@@ -131,7 +130,10 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
 	}
 
 	if subcfg.BatchFetchBlockCount <= 0 {
-		subcfg.BatchFetchBlockCount = batchFetchBlockCount
+		subcfg.BatchFetchBlockCount = types.MaxBlockCountPerTime
+	}
+	if subcfg.BatchFetchBlockCount > types.MaxBlockCountPerTime {
+		panic(fmt.Sprintf("BatchFetchBlockCount=%d should be more than %d ", subcfg.BatchFetchBlockCount, types.MaxBlockCountPerTime))
 	}
 
 	pk, err := hex.DecodeString(minerPrivateKey)
diff --git a/plugin/consensus/para/paramultidownload.go b/plugin/consensus/para/paramultidownload.go
index c9668d23b..3b92666a3 100644
--- a/plugin/consensus/para/paramultidownload.go
+++ b/plugin/consensus/para/paramultidownload.go
@@ -105,6 +105,7 @@ func (m *multiDldClient) testConn(conn *connectCli, inv *inventory) {
 	}()
 
 	t := time.NewTimer(time.Second * time.Duration(conn.timeout))
+	defer t.Stop()
 	select {
 	case <-t.C:
 		plog.Info("multiServerDownload.testconn ip timeout", "ip", conn.ip)
@@ -115,7 +116,6 @@ func (m *multiDldClient) testConn(conn *connectCli, inv *inventory) {
 			m.conns = append(m.conns, conn)
 			m.mtx.Unlock()
 		}
-		t.Stop()
 		return
 	}
 }
@@ -470,16 +470,15 @@ func requestMainBlockWithTime(inv *inventory) *types.ParaTxDetails {
 	}()
 
 	t := time.NewTimer(time.Second * time.Duration(inv.connCli.timeout))
+	defer t.Stop()
 	select {
 	case <-t.C:
 		plog.Debug("requestMainBlockWithTime timeout", "start", inv.start, "end", inv.end, "ip", inv.connCli.ip)
 		return nil
 	case ret, ok := <-retCh:
 		if !ok {
-			t.Stop()
 			return nil
 		}
-		t.Stop()
 		return ret
 	}
 }
diff --git a/plugin/dapp/paracross/executor/kv.go b/plugin/dapp/paracross/executor/kv.go
index 6804cd4e4..5dc3bb7de 100644
--- a/plugin/dapp/paracross/executor/kv.go
+++ b/plugin/dapp/paracross/executor/kv.go
@@ -7,9 +7,15 @@ package executor
 import (
 	"fmt"
 
+	"strings"
+
 	"github.com/33cn/chain33/types"
 )
 
+const (
+	paraNodeIDUnifyPrefix = "mavl-paracross-title-node"
+)
+
 var (
 	title                     string
 	titleHeight               string
@@ -17,8 +23,8 @@ var (
 	paraConfigNodes           string //平行链自组织配置的nodes，最初是从manager同步过来
 	paraConfigNodeAddr        string //平行链配置节点账户
 	paraNodeGroupStatusAddrs  string //正在申请的addrs
-	paraNodeID                string
-	paraNodeGroupID           string
+	paraNodeIDPrefix          string
+	paraNodeGroupIDPrefix     string
 	localTx                   string
 	localTitle                string
 	localTitleHeight          string
@@ -35,8 +41,8 @@ func setPrefix() {
 	paraConfigNodes = "mavl-paracross-nodes-title-"
 	paraConfigNodeAddr = "mavl-paracross-nodes-titleAddr-"
 	paraNodeGroupStatusAddrs = "mavl-paracross-nodegroup-apply-title-"
-	paraNodeID = "mavl-paracross-title-nodeid-"
-	paraNodeGroupID = "mavl-paracross-title-nodegroupid-"
+	paraNodeIDPrefix = "mavl-paracross-title-nodeid-"
+	paraNodeGroupIDPrefix = "mavl-paracross-title-nodegroupid-"
 	localTx = "LODB-paracross-titleHeightAddr-"
 	localTitle = "LODB-paracross-title-"
 	localTitleHeight = "LODB-paracross-titleHeight-"
@@ -79,11 +85,31 @@ func calcParaNodeGroupStatusKey(title string) []byte {
 }
 
 func calcParaNodeIDKey(title, hash string) string {
-	return fmt.Sprintf(paraNodeID+"%s-%s", title, hash)
+	return fmt.Sprintf(paraNodeIDPrefix+"%s-%s", title, hash)
 }
 
 func calcParaNodeGroupIDKey(title, hash string) string {
-	return fmt.Sprintf(paraNodeGroupID+"%s-%s", title, hash)
+	return fmt.Sprintf(paraNodeGroupIDPrefix+"%s-%s", title, hash)
+}
+
+func getParaNodeIDSuffix(id string) string {
+	if !strings.HasPrefix(id, paraNodeIDUnifyPrefix) {
+		return id
+	}
+
+	ids := strings.Split(id, "-")
+	txID := ids[len(ids)-1]
+	if strings.HasPrefix(txID, "0x") {
+		return txID
+	}
+	//对于nodegroup 创建的"mavl-paracross-title-nodegroupid-user.p.para.-0xb6cd0274587...a61e444e9f848a4c02d7b-1"特殊场景
+	if len(ids) > 1 {
+		txID = ids[len(ids)-2] + "-" + txID
+		if strings.HasPrefix(txID, "0x") {
+			return txID
+		}
+	}
+	return id
 }
 
 func calcLocalTxKey(title string, height int64, addr string) []byte {
diff --git a/plugin/dapp/paracross/executor/query.go b/plugin/dapp/paracross/executor/query.go
index 839a3c32d..0cd1ad9d9 100644
--- a/plugin/dapp/paracross/executor/query.go
+++ b/plugin/dapp/paracross/executor/query.go
@@ -90,19 +90,46 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
 	if err != nil {
 		return nil, err
 	}
+	mainHeight, err := p.getMainHeight()
+	if err != nil {
+		return nil, err
+	}
+	if pt.IsParaForkHeight(mainHeight, pt.ForkLoopCheckCommitTxDone) {
+		stat.QuitId = getParaNodeIDSuffix(stat.QuitId)
+		stat.ProposalId = getParaNodeIDSuffix(stat.ProposalId)
+	}
 	return stat, nil
 }
 
+func (p *Paracross) getMainHeight() (int64, error) {
+	mainHeight := p.GetMainHeight()
+	if types.IsPara() {
+		block, err := p.GetAPI().GetBlocks(&types.ReqBlocks{Start: p.GetHeight(), End: p.GetHeight()})
+		if err != nil || block == nil || len(block.Items) == 0 {
+			return -1, types.ErrBlockExist
+		}
+		mainHeight = block.Items[0].Block.MainHeight
+	}
+	return mainHeight, 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)
+	mainHeight, err := p.getMainHeight()
+	if err != nil {
+		return nil, err
+	}
+	stat, err := getNodeIDWithFork(p.GetStateDB(), in.Title, mainHeight, in.Id)
 	if err != nil {
 		return nil, err
 	}
+
+	if pt.IsParaForkHeight(mainHeight, pt.ForkLoopCheckCommitTxDone) {
+		stat.Id = getParaNodeIDSuffix(stat.Id)
+	}
 	return stat, nil
 }
 
@@ -111,7 +138,22 @@ func (p *Paracross) Query_ListNodeStatusInfo(in *pt.ReqParacrossNodeInfo) (types
 	if in == nil || in.Title == "" {
 		return nil, types.ErrInvalidParam
 	}
-	return listLocalNodeStatus(p.GetLocalDB(), in.Title, in.Status)
+	resp, err := listLocalNodeStatus(p.GetLocalDB(), in.Title, in.Status)
+	if err != nil {
+		return resp, err
+	}
+	mainHeight, err := p.getMainHeight()
+	if err != nil {
+		return nil, err
+	}
+	if !pt.IsParaForkHeight(mainHeight, pt.ForkLoopCheckCommitTxDone) {
+		return resp, err
+	}
+	addrs := resp.(*pt.RespParacrossNodeAddrs)
+	for _, id := range addrs.Ids {
+		id.Id = getParaNodeIDSuffix(id.Id)
+	}
+	return resp, nil
 }
 
 //Query_GetNodeGroupStatus get specific node addr info
@@ -120,9 +162,16 @@ func (p *Paracross) Query_GetNodeGroupStatus(in *pt.ReqParacrossNodeInfo) (types
 		return nil, types.ErrInvalidParam
 	}
 	stat, err := getNodeGroupStatus(p.GetStateDB(), in.Title)
+	if err != nil {
+		return stat, err
+	}
+	mainHeight, err := p.getMainHeight()
 	if err != nil {
 		return nil, err
 	}
+	if pt.IsParaForkHeight(mainHeight, pt.ForkLoopCheckCommitTxDone) {
+		stat.Id = getParaNodeIDSuffix(stat.Id)
+	}
 	return stat, nil
 }
 
@@ -131,7 +180,22 @@ func (p *Paracross) Query_ListNodeGroupStatus(in *pt.ReqParacrossNodeInfo) (type
 	if in == nil {
 		return nil, types.ErrInvalidParam
 	}
-	return listLocalNodeGroupStatus(p.GetLocalDB(), in.Status)
+	resp, err := listLocalNodeGroupStatus(p.GetLocalDB(), in.Status)
+	if err != nil {
+		return resp, err
+	}
+	mainHeight, err := p.getMainHeight()
+	if err != nil {
+		return nil, err
+	}
+	if pt.IsParaForkHeight(mainHeight, pt.ForkLoopCheckCommitTxDone) {
+		addrs := resp.(*pt.RespParacrossNodeGroups)
+		for _, id := range addrs.Ids {
+			id.Id = getParaNodeIDSuffix(id.Id)
+		}
+	}
+
+	return resp, nil
 }
 
 //Query_ListTitles query paracross titles list
diff --git a/plugin/dapp/paracross/executor/superaccount.go b/plugin/dapp/paracross/executor/superaccount.go
index f746035be..ed29b1423 100644
--- a/plugin/dapp/paracross/executor/superaccount.go
+++ b/plugin/dapp/paracross/executor/superaccount.go
@@ -57,6 +57,14 @@ func getNodeID(db dbm.KV, id string) (*pt.ParaNodeIdStatus, error) {
 	return &status, err
 }
 
+//分叉之前 id是"mavl-paracros-...0x12342308b"格式，分叉以后只支持输入为去掉了mavl-paracross前缀的交易id，系统会为id加上前缀
+func getNodeIDWithFork(db dbm.KV, title string, height int64, id string) (*pt.ParaNodeIdStatus, error) {
+	if pt.IsParaForkHeight(height, pt.ForkLoopCheckCommitTxDone) {
+		id = calcParaNodeIDKey(title, id)
+	}
+	return getNodeID(db, id)
+}
+
 func getNodeGroupStatus(db dbm.KV, title string) (*pt.ParaNodeGroupStatus, error) {
 	key := calcParaNodeGroupStatusKey(title)
 	val, err := db.Get(key)
@@ -77,7 +85,11 @@ func getDb(db dbm.KV, key []byte) ([]byte, error) {
 	return val, nil
 }
 
-func getNodeGroupID(db dbm.KV, id string) (*pt.ParaNodeGroupStatus, error) {
+//分叉之前 id是"mavl-paracros-...0x12342308b"格式，分叉以后只支持输入为去掉了mavl-paracross前缀的交易id，系统会为id加上前缀
+func getNodeGroupID(db dbm.KV, title string, height int64, id string) (*pt.ParaNodeGroupStatus, error) {
+	if pt.IsParaForkHeight(height, pt.ForkLoopCheckCommitTxDone) {
+		id = calcParaNodeGroupIDKey(title, id)
+	}
 	val, err := getDb(db, []byte(id))
 	if err != nil {
 		return nil, err
@@ -253,43 +265,25 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
 	}
 
 	addrStat, err := getNodeAddr(a.db, config.Title, config.Addr)
-	if err != nil {
-		if !isNotFound(err) {
-			return nil, err
-		}
-		clog.Info("first time add node addr", "title", config.Title, "addr", config.Addr)
-		stat := &pt.ParaNodeIdStatus{
-			Id:          calcParaNodeIDKey(config.Title, common.ToHex(a.txhash)),
-			Status:      pt.ParacrossNodeJoining,
-			Title:       config.Title,
-			TargetAddr:  config.Addr,
-			FromAddr:    a.fromaddr,
-			Votes:       &pt.ParaNodeVoteDetail{},
-			CoinsFrozen: config.CoinsFrozen,
-			Height:      a.height}
-		r := makeNodeConfigReceipt(a.fromaddr, config, nil, stat)
-		receipt.KV = append(receipt.KV, r.KV...)
-		receipt.Logs = append(receipt.Logs, r.Logs...)
-		return receipt, nil
+	if err != nil && !isNotFound(err) {
+		return nil, errors.Wrapf(err, "nodeJoin get title=%s,nodeAddr=%s", config.Title, config.Addr)
 	}
-
-	if addrStat.Status == pt.ParacrossNodeQuited {
-		stat := &pt.ParaNodeIdStatus{
-			Id:          calcParaNodeIDKey(config.Title, common.ToHex(a.txhash)),
-			Status:      pt.ParacrossNodeJoining,
-			Title:       config.Title,
-			TargetAddr:  config.Addr,
-			FromAddr:    a.fromaddr,
-			Votes:       &pt.ParaNodeVoteDetail{},
-			CoinsFrozen: config.CoinsFrozen,
-			Height:      a.height}
-		r := makeNodeConfigReceipt(a.fromaddr, config, nil, stat)
-		receipt.KV = append(receipt.KV, r.KV...)
-		receipt.Logs = append(receipt.Logs, r.Logs...)
-		return receipt, nil
-
+	if addrStat != nil && addrStat.Status != pt.ParacrossNodeQuited {
+		return nil, errors.Wrapf(pt.ErrParaNodeAddrExisted, "nodeJoin nodeAddr existed:%s,status:%d", config.Addr, addrStat.Status)
 	}
-	return nil, errors.Wrapf(pt.ErrParaNodeAddrExisted, "nodeAddr existed:%s,status:%d", config.Addr, addrStat.Status)
+	stat := &pt.ParaNodeIdStatus{
+		Id:          calcParaNodeIDKey(config.Title, common.ToHex(a.txhash)),
+		Status:      pt.ParacrossNodeJoining,
+		Title:       config.Title,
+		TargetAddr:  config.Addr,
+		FromAddr:    a.fromaddr,
+		Votes:       &pt.ParaNodeVoteDetail{},
+		CoinsFrozen: config.CoinsFrozen,
+		Height:      a.height}
+	r := makeNodeConfigReceipt(a.fromaddr, config, nil, stat)
+	receipt.KV = append(receipt.KV, r.KV...)
+	receipt.Logs = append(receipt.Logs, r.Logs...)
+	return receipt, nil
 
 }
 
@@ -323,7 +317,7 @@ func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
 }
 
 func (a *action) nodeCancel(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
-	stat, err := getNodeID(a.db, config.Id)
+	stat, err := getNodeIDWithFork(a.db, config.Title, a.exec.GetMainHeight(), config.Id)
 	if err != nil {
 		return nil, err
 	}
@@ -504,7 +498,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
 		return nil, errors.Wrapf(pt.ErrNodeNotForTheTitle, "not validNode:%s", a.fromaddr)
 	}
 
-	stat, err := getNodeID(a.db, config.Id)
+	stat, err := getNodeIDWithFork(a.db, config.Title, a.exec.GetMainHeight(), config.Id)
 	if err != nil {
 		return nil, err
 	}
@@ -818,7 +812,7 @@ func (a *action) nodeGroupModify(config *pt.ParaNodeGroupConfig) (*types.Receipt
 }
 
 func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt, error) {
-	status, err := getNodeGroupID(a.db, config.Id)
+	status, err := getNodeGroupID(a.db, config.Title, a.exec.GetMainHeight(), config.Id)
 	if err != nil {
 		return nil, err
 	}
@@ -937,7 +931,7 @@ func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receip
 		return nil, errors.Wrapf(types.ErrNotAllow, "node group approve not super manager:%s", a.fromaddr)
 	}
 
-	id, err := getNodeGroupID(a.db, config.Id)
+	id, err := getNodeGroupID(a.db, config.Title, a.exec.GetMainHeight(), config.Id)
 	if err != nil {
 		return nil, err
 	}


Test patch:
diff --git a/plugin/dapp/paracross/cmd/build/testcase.sh b/plugin/dapp/paracross/cmd/build/testcase.sh
index 01db35dc3..2118b983d 100644
--- a/plugin/dapp/paracross/cmd/build/testcase.sh
+++ b/plugin/dapp/paracross/cmd/build/testcase.sh
@@ -8,6 +8,7 @@ MAIN_CLI="docker exec ${NODE3} /root/chain33-cli"
 
 PARANAME="para"
 PARA_COIN_FROZEN="5.0000"
+MainLoopCheckForkHeight="60"
 
 xsedfix=""
 if [ "$(uname)" == "Darwin" ]; then
@@ -40,7 +41,7 @@ function para_set_toml() {
 
     sed -i $xsedfix 's/^MainForkParacrossCommitTx=.*/MainForkParacrossCommitTx=10/g' "${1}"
     sed -i $xsedfix 's/^MainParaSelfConsensusForkHeight=.*/MainParaSelfConsensusForkHeight=50/g' "${1}"
-    sed -i $xsedfix 's/^MainLoopCheckCommitTxDoneForkHeight=.*/MainLoopCheckCommitTxDoneForkHeight=60/g' "${1}"
+    sed -i $xsedfix 's/^MainLoopCheckCommitTxDoneForkHeight=.*/MainLoopCheckCommitTxDoneForkHeight='''$MainLoopCheckForkHeight'''/g' "${1}"
     sed -i $xsedfix 's/^FetchFilterParaTxsEnable=.*/FetchFilterParaTxsEnable=1/g' "${1}"
 
     # rpc
@@ -448,13 +449,7 @@ function para_create_nodegroup_test() {
     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
+    id=$txhash
 
     balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
     if [ "$balance" != "20.0000" ]; then
@@ -489,13 +484,8 @@ function para_create_nodegroup() {
     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=$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"
@@ -573,13 +563,7 @@ function para_nodegroup_behalf_quit_test() {
     hash=$(${PARA_CLI} send para node -o 3 -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b)
     echo "${hash}"
     query_tx "${PARA_CLI}" "${hash}"
-
-    id=$(${PARA_CLI} tx query -s "${hash}" | jq -r ".receipt.logs[0].log.current.id")
-    if [ -z "${id}" ]; then
-        echo "wrong id "
-        ${PARA_CLI} tx query -s "${hash}"
-        exit 1
-    fi
+    id=$hash
 
     ${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
@@ -622,7 +606,7 @@ function para_nodemanage_cancel_test() {
     hash=$(${PARA_CLI} send para node -o 1 -c 5 -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
     echo "${hash}"
     query_tx "${PARA_CLI}" "${hash}"
-
+    id=$hash
     balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".frozen")
     if [ "$balance" != "$PARA_COIN_FROZEN" ]; then
         echo "frozen coinfrozen error balance=$balance"
@@ -630,12 +614,6 @@ function para_nodemanage_cancel_test() {
     fi
 
     echo "=========== # para chain node cancel ============="
-    id=$(${PARA_CLI} tx query -s "${hash}" | jq -r ".receipt.logs[0].log.current.id")
-    if [ -z "$id" ]; then
-        echo "id not found"
-        ${PARA_CLI} tx query -s "${hash}"
-        exit 1
-    fi
     hash=$(${PARA_CLI} send para node -o 4 -i "$id" -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
     echo "${hash}"
     query_tx "${PARA_CLI}" "${hash}"
@@ -667,13 +645,7 @@ function para_nodemanage_test() {
         echo "frozen coinfrozen error balance=$balance"
         exit 1
     fi
-
-    id=$(${PARA_CLI} tx query -s "${hash}" | jq -r ".receipt.logs[0].log.current.id")
-    if [ -z "$id" ]; then
-        echo "id not found"
-        ${PARA_CLI} tx query -s "${hash}"
-        exit 1
-    fi
+    id=$hash
     echo "=========== # para chain node vote ============="
 
     ${PARA_CLI} send para node -o 2 -i "$id" -v 2 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
@@ -712,13 +684,7 @@ function para_nodemanage_test() {
     txhash=$(${PARA_CLI} send para node -o 3 -a 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
     echo "${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
-        echo "id not found"
-        ${PARA_CLI} tx query -s "${txhash}"
-        exit 1
-    fi
+    id=$txhash
 
     echo "=========== # para chain node vote quit ============="
     ${PARA_CLI} send para node -o 2 -i "$id" -v 2 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
@@ -755,6 +721,7 @@ function para_nodemanage_node_behalf_join() {
     hash=$(${PARA_CLI} send para node -o 1 -c 8 -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
     echo "${hash}"
     query_tx "${PARA_CLI}" "${hash}"
+    node1_id=$hash
 
     balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
     if [ "$balance" != "32.0000" ]; then
@@ -768,17 +735,11 @@ function para_nodemanage_node_behalf_join() {
         exit 1
     fi
 
-    node1_id=$(${PARA_CLI} tx query -s "${hash}" | jq -r ".receipt.logs[0].log.current.id")
-    if [ -z "$node1_id" ]; then
-        echo "id not found"
-        ${PARA_CLI} tx query -s "${hash}"
-        exit 1
-    fi
-
     echo "=========== # para chain new node join 2============="
     hash=$(${PARA_CLI} send para node -o 1 -c 9 -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -k 0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5)
     echo "${hash}"
     query_tx "${PARA_CLI}" "${hash}"
+    id=$hash
 
     balance=$(${CLI} account balance -a 1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj -e paracross | jq -r ".frozen")
     if [ "$balance" != "41.0000" ]; then
@@ -786,13 +747,6 @@ function para_nodemanage_node_behalf_join() {
         exit 1
     fi
 
-    id=$(${PARA_CLI} tx query -s "${hash}" | jq -r ".receipt.logs[0].log.current.id")
-    if [ -z "$id" ]; then
-        echo "id not found"
-        ${PARA_CLI} tx query -s "${hash}"
-        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)
@@ -854,13 +808,7 @@ function para_nodemanage_node_behalf_join() {
     hash=$(${PARA_CLI} send para node -o 3 -a 1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB -k 0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d)
     echo "${hash}"
     query_tx "${PARA_CLI}" "${hash}"
-
-    id=$(${PARA_CLI} tx query -s "${hash}" | jq -r ".receipt.logs[0].log.current.id")
-    if [ -z "$id" ]; then
-        echo "id not found"
-        ${PARA_CLI} tx query -s "${hash}"
-        exit 1
-    fi
+    id=$hash
 
     echo "=========== # para chain node2 vote quit ============="
     ${PARA_CLI} send para node -o 2 -i "$id" -v 1 -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
@@ -950,6 +898,7 @@ function privacy_transfer_test() {
 
 function para_test() {
     echo "=========== # para chain test ============="
+    block_wait2height "${PARA_CLI}" $MainLoopCheckForkHeight "1"
     para_create_nodegroup
     para_nodegroup_behalf_quit_test
     para_nodemanage_cancel_test
diff --git a/plugin/dapp/paracross/executor/superaccount_test.go b/plugin/dapp/paracross/executor/superaccount_test.go
index 392ad3924..dd665a9ce 100644
--- a/plugin/dapp/paracross/executor/superaccount_test.go
+++ b/plugin/dapp/paracross/executor/superaccount_test.go
@@ -354,3 +354,16 @@ func TestUpdateVotes(t *testing.T) {
 	assert.Equal(t, []string{"BB", "CC"}, stat.Votes.Addrs)
 	assert.Equal(t, []string{"no", "no"}, stat.Votes.Votes)
 }
+
+func TestGetNodeIdSuffix(t *testing.T) {
+	txID := "0xb6cd0274aa5f839fa2291ecfbfc626b494aacac7587a61e444e9f848a4c02d7b"
+	id := "mavl-paracross-title-nodegroupid-user.p.para.-0xb6cd0274aa5f839fa2291ecfbfc626b494aacac7587a61e444e9f848a4c02d7b"
+	rtID := getParaNodeIDSuffix(id)
+	assert.Equal(t, txID, rtID)
+
+	txID = "0xb6cd0274aa5f839fa2291ecfbfc626b494aacac7587a61e444e9f848a4c02d7b-1"
+	id = "mavl-paracross-title-nodegroupid-user.p.para.-0xb6cd0274aa5f839fa2291ecfbfc626b494aacac7587a61e444e9f848a4c02d7b-1"
+	rtID = getParaNodeIDSuffix(id)
+	assert.Equal(t, txID, rtID)
+
+}