Commit 3098180c authored by suyanlong's avatar suyanlong

Add make goimports

parent 23e599af
Pipeline #8006 failed with stages
......@@ -161,6 +161,8 @@ build-dep:
@go install mvdan.cc/sh/v3/cmd/shfmt@latest
@go install mvdan.cc/sh/v3/cmd/gosh@latest
@go install mvdan.cc/unparam@latest
@go install github.com/incu6us/goimports-reviser@master
# @apt install clang-format or brew isntall clang-format
# @apt install shellcheck or brew install shellcheck
......@@ -168,6 +170,9 @@ build-dep:
aligner:
@aligner -r -c "//" -e ".go" -i ./internal/repo/a_repo-packr.go comment
goimports:
@goimports-reviser -dir-path ./ -project-name github.com/link33/sidecar -format -rm-unused
aligner-check:
@aligner -r -c "//" -e ".go" -i ./internal/repo/a_repo-packr.go check
......
......@@ -7,15 +7,15 @@ import (
"net/http"
"path/filepath"
"github.com/gin-gonic/gin"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/link33/sidecar/cmd/sidecar/client"
"github.com/link33/sidecar/internal/peermgr"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/pb"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/sirupsen/logrus"
)
type Server struct {
......
......@@ -7,14 +7,15 @@ import (
"io/ioutil"
"path/filepath"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/constant"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/meshplus/bitxhub-kit/hexutil"
"github.com/tidwall/gjson"
"github.com/urfave/cli"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/constant"
)
var appchainBxhCMD = cli.Command{
......
......@@ -6,11 +6,12 @@ import (
"io/ioutil"
"strconv"
"github.com/link33/sidecar/internal/repo"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/urfave/cli"
"github.com/link33/sidecar/internal/repo"
)
type Approve struct {
......
......@@ -7,8 +7,9 @@ import (
"net/http"
"strings"
"github.com/link33/sidecar/internal/repo"
"github.com/urfave/cli"
"github.com/link33/sidecar/internal/repo"
)
const (
......
......@@ -3,9 +3,10 @@ package main
import (
"fmt"
"github.com/urfave/cli"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/constant"
"github.com/urfave/cli"
)
var governanceCMD = cli.Command{
......
......@@ -4,9 +4,10 @@ import (
"fmt"
"path/filepath"
"github.com/link33/sidecar/internal/repo"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/urfave/cli"
"github.com/link33/sidecar/internal/repo"
)
var idCMD = cli.Command{
......
......@@ -6,9 +6,10 @@ import (
"os"
"path/filepath"
"github.com/link33/sidecar/internal/repo"
"github.com/meshplus/bitxhub-kit/fileutil"
"github.com/urfave/cli"
"github.com/link33/sidecar/internal/repo"
)
var initCMD = cli.Command{
......
......@@ -3,11 +3,12 @@ package main
import (
"fmt"
"github.com/meshplus/bitxhub-kit/types"
"github.com/urfave/cli"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/constant"
"github.com/meshplus/bitxhub-kit/types"
"github.com/urfave/cli"
)
var interchainCMD = cli.Command{
......
......@@ -5,9 +5,10 @@ import (
crypto2 "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/link33/sidecar/internal/repo"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/urfave/cli"
"github.com/link33/sidecar/internal/repo"
)
var p2pCMD = cli.Command{
......
......@@ -5,10 +5,11 @@ import (
"io/ioutil"
"github.com/fatih/color"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/constant"
"github.com/tidwall/gjson"
"github.com/urfave/cli"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/constant"
)
var ruleCMD = cli.Command{
......
......@@ -11,12 +11,13 @@ import (
"syscall"
"time"
"github.com/meshplus/bitxhub-kit/log"
"github.com/urfave/cli"
"github.com/link33/sidecar/internal"
"github.com/link33/sidecar/internal/app"
"github.com/link33/sidecar/internal/loggers"
"github.com/link33/sidecar/internal/repo"
"github.com/meshplus/bitxhub-kit/log"
"github.com/urfave/cli"
)
var startCMD = cli.Command{
......
......@@ -8,11 +8,11 @@ import (
crypto2 "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/link33/sidecar/tool"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/urfave/cli"
"github.com/link33/sidecar/tool"
)
var toolCMD = cli.Command{
......
......@@ -3,8 +3,9 @@ package main
import (
"fmt"
"github.com/link33/sidecar"
"github.com/urfave/cli"
"github.com/link33/sidecar"
)
var versionCMD = cli.Command{
......
......@@ -3,9 +3,10 @@ package rpcx
import (
"context"
"github.com/link33/sidecar/model/pb"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/types"
"github.com/link33/sidecar/model/pb"
)
type SubscriptionType int
......
......@@ -9,10 +9,11 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
rpcx "github.com/link33/sidecar/hub/client"
pb "github.com/link33/sidecar/model/pb"
crypto "github.com/meshplus/bitxhub-kit/crypto"
types "github.com/meshplus/bitxhub-kit/types"
rpcx "github.com/link33/sidecar/hub/client"
pb "github.com/link33/sidecar/model/pb"
)
// MockClient is a mock of Client interface.
......
......@@ -9,11 +9,12 @@ import (
"github.com/Rican7/retry"
"github.com/Rican7/retry/strategy"
"github.com/sirupsen/logrus"
"github.com/link33/sidecar/internal/port"
"github.com/link33/sidecar/internal/txcrypto"
"github.com/link33/sidecar/model/pb"
"github.com/link33/sidecar/pkg/plugins"
"github.com/sirupsen/logrus"
)
type AppChain interface {
......
......@@ -8,6 +8,7 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
pb "github.com/link33/sidecar/model/pb"
)
......
......@@ -8,6 +8,7 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
pb "github.com/link33/sidecar/model/pb"
)
......
......@@ -6,9 +6,10 @@ import (
"testing"
"time"
"github.com/link33/sidecar/model/pb"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/stretchr/testify/require"
"github.com/link33/sidecar/model/pb"
)
const (
......
package loggers
import (
"github.com/link33/sidecar/internal/repo"
"github.com/meshplus/bitxhub-kit/log"
"github.com/sirupsen/logrus"
"github.com/link33/sidecar/internal/repo"
)
const (
......
......@@ -3,11 +3,12 @@ package manger
import (
"encoding/json"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/sirupsen/logrus"
"github.com/link33/sidecar/internal/peermgr"
"github.com/link33/sidecar/internal/port"
"github.com/link33/sidecar/model/pb"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/sirupsen/logrus"
)
type Manager struct {
......
......@@ -9,6 +9,7 @@ import (
gomock "github.com/golang/mock/gomock"
peer "github.com/libp2p/go-libp2p-core/peer"
peermgr "github.com/link33/sidecar/internal/peermgr"
port "github.com/link33/sidecar/internal/port"
pb "github.com/link33/sidecar/model/pb"
......
......@@ -2,6 +2,7 @@ package peermgr
import (
"github.com/libp2p/go-libp2p-core/peer"
"github.com/link33/sidecar/internal"
"github.com/link33/sidecar/internal/port"
"github.com/link33/sidecar/model/pb"
......
......@@ -7,16 +7,17 @@ import (
libp2pcry "github.com/libp2p/go-libp2p-core/crypto"
peer2 "github.com/libp2p/go-libp2p-core/peer"
"github.com/link33/sidecar/internal/port"
"github.com/link33/sidecar/internal/repo"
router2 "github.com/link33/sidecar/internal/router"
"github.com/link33/sidecar/model/pb"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/meshplus/bitxhub-kit/log"
network "github.com/meshplus/go-lightp2p"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
"github.com/link33/sidecar/internal/port"
"github.com/link33/sidecar/internal/repo"
router2 "github.com/link33/sidecar/internal/router"
"github.com/link33/sidecar/model/pb"
)
var routerTmp router2.Router
......
......@@ -10,13 +10,14 @@ import (
"github.com/Rican7/retry/strategy"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/meshplus/bitxhub-kit/crypto"
network "github.com/meshplus/go-lightp2p"
"github.com/sirupsen/logrus"
"github.com/link33/sidecar/internal/port"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/internal/router"
"github.com/link33/sidecar/model/pb"
"github.com/meshplus/bitxhub-kit/crypto"
network "github.com/meshplus/go-lightp2p"
"github.com/sirupsen/logrus"
)
const (
......
......@@ -8,6 +8,7 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
port "github.com/link33/sidecar/internal/port"
pb "github.com/link33/sidecar/model/pb"
)
......
......@@ -5,11 +5,12 @@ import (
"errors"
"strings"
"github.com/sirupsen/logrus"
"github.com/link33/sidecar/internal/checker"
"github.com/link33/sidecar/internal/port"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/pb"
"github.com/sirupsen/logrus"
)
type router struct {
......
......@@ -6,12 +6,12 @@ import (
"github.com/Rican7/retry"
"github.com/Rican7/retry/strategy"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/meshplus/bitxhub-kit/types"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/constant"
"github.com/link33/sidecar/model/pb"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/meshplus/bitxhub-kit/types"
)
const (
......
package syncer
import (
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/internal/repo"
"github.com/meshplus/bitxhub-kit/storage"
"github.com/sirupsen/logrus"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/internal/repo"
)
type Config struct {
......
package syncer
import (
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/pb"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
)
type IBTPHandler func(ibtp *pb.IBTP)
......
......@@ -8,9 +8,10 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
appchain_mgr "github.com/meshplus/bitxhub-core/appchain-mgr"
syncer "github.com/link33/sidecar/internal/syncer"
pb "github.com/link33/sidecar/model/pb"
appchain_mgr "github.com/meshplus/bitxhub-core/appchain-mgr"
)
// MockSyncer is a mock of Syncer interface.
......
......@@ -11,11 +11,12 @@ import (
"github.com/Rican7/retry"
"github.com/Rican7/retry/strategy"
"github.com/cbergoon/merkletree"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/pb"
"github.com/meshplus/bitxhub-kit/storage"
"github.com/meshplus/bitxhub-kit/types"
"github.com/sirupsen/logrus"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/pb"
)
var _ Syncer = (*WrapperSyncer)(nil)
......
......@@ -14,11 +14,6 @@ import (
"github.com/cbergoon/merkletree"
"github.com/golang/mock/gomock"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/hub/client/mock_client"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/constant"
"github.com/link33/sidecar/model/pb"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/meshplus/bitxhub-core/governance"
"github.com/meshplus/bitxhub-kit/crypto"
......@@ -27,6 +22,12 @@ import (
"github.com/meshplus/bitxhub-kit/storage/leveldb"
"github.com/meshplus/bitxhub-kit/types"
"github.com/stretchr/testify/require"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/hub/client/mock_client"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/constant"
"github.com/link33/sidecar/model/pb"
)
const (
......
......@@ -3,9 +3,8 @@ package txcrypto
import (
"fmt"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/btcsuite/btcd/btcec"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/ecdh"
"github.com/meshplus/bitxhub-kit/crypto/sym"
......
package txcrypto
import (
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/constant"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym/ecdsa"
"github.com/meshplus/bitxhub-kit/crypto/ecdh"
"github.com/meshplus/bitxhub-kit/crypto/sym"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/model/constant"
)
type RelayCryptor struct {
......
......@@ -5,13 +5,14 @@ import (
"testing"
"github.com/golang/mock/gomock"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/hub/client/mock_client"
"github.com/link33/sidecar/model/pb"
"github.com/meshplus/bitxhub-core/appchain-mgr/mock_appchainMgr"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/stretchr/testify/require"
rpcx "github.com/link33/sidecar/hub/client"
"github.com/link33/sidecar/hub/client/mock_client"
"github.com/link33/sidecar/model/pb"
)
func TestRelayCryptor(t *testing.T) {
......
......@@ -78,8 +78,11 @@ type Arg struct {
}
func (m *Arg) Reset() { *m = Arg{} }
func (m *Arg) String() string { return proto.CompactTextString(m) }
func (*Arg) ProtoMessage() {}
func (*Arg) Descriptor() ([]byte, []int) {
return fileDescriptor_4371b204df3ab2da, []int{0}
}
......
......@@ -30,8 +30,11 @@ type Uint64Slice struct {
}
func (m *Uint64Slice) Reset() { *m = Uint64Slice{} }
func (m *Uint64Slice) String() string { return proto.CompactTextString(m) }
func (*Uint64Slice) ProtoMessage() {}
func (*Uint64Slice) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{0}
}
......@@ -80,8 +83,11 @@ type StringUint64Map struct {
}
func (m *StringUint64Map) Reset() { *m = StringUint64Map{} }
func (m *StringUint64Map) String() string { return proto.CompactTextString(m) }
func (*StringUint64Map) ProtoMessage() {}
func (*StringUint64Map) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{1}
}
......@@ -137,8 +143,11 @@ type StringUint64SliceMap struct {
}
func (m *StringUint64SliceMap) Reset() { *m = StringUint64SliceMap{} }
func (m *StringUint64SliceMap) String() string { return proto.CompactTextString(m) }
func (*StringUint64SliceMap) ProtoMessage() {}
func (*StringUint64SliceMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{2}
}
......@@ -194,8 +203,11 @@ type VerifiedIndex struct {
}
func (m *VerifiedIndex) Reset() { *m = VerifiedIndex{} }
func (m *VerifiedIndex) String() string { return proto.CompactTextString(m) }
func (*VerifiedIndex) ProtoMessage() {}
func (*VerifiedIndex) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{3}
}
......@@ -250,8 +262,11 @@ type VerifiedIndexSlice struct {
}
func (m *VerifiedIndexSlice) Reset() { *m = VerifiedIndexSlice{} }
func (m *VerifiedIndexSlice) String() string { return proto.CompactTextString(m) }
func (*VerifiedIndexSlice) ProtoMessage() {}
func (*VerifiedIndexSlice) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{4}
}
......@@ -300,8 +315,11 @@ type StringVerifiedIndexMap struct {
}
func (m *StringVerifiedIndexMap) Reset() { *m = StringVerifiedIndexMap{} }
func (m *StringVerifiedIndexMap) String() string { return proto.CompactTextString(m) }
func (*StringVerifiedIndexMap) ProtoMessage() {}
func (*StringVerifiedIndexMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{5}
}
......@@ -357,8 +375,11 @@ type StringVerifiedIndexSliceMap struct {
}
func (m *StringVerifiedIndexSliceMap) Reset() { *m = StringVerifiedIndexSliceMap{} }
func (m *StringVerifiedIndexSliceMap) String() string { return proto.CompactTextString(m) }
func (*StringVerifiedIndexSliceMap) ProtoMessage() {}
func (*StringVerifiedIndexSliceMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{6}
}
......
......@@ -36,8 +36,11 @@ type Block struct {
}
func (m *Block) Reset() { *m = Block{} }
func (m *Block) String() string { return proto.CompactTextString(m) }
func (*Block) ProtoMessage() {}
func (*Block) Descriptor() ([]byte, []int) {
return fileDescriptor_8e550b1f5926e92d, []int{0}
}
......@@ -106,8 +109,11 @@ type BlockHeader struct {
}
func (m *BlockHeader) Reset() { *m = BlockHeader{} }
func (m *BlockHeader) String() string { return proto.CompactTextString(m) }
func (*BlockHeader) ProtoMessage() {}
func (*BlockHeader) Descriptor() ([]byte, []int) {
return fileDescriptor_8e550b1f5926e92d, []int{1}
}
......
......@@ -209,8 +209,11 @@ type GetBlockHeaderRequest struct {
}
func (m *GetBlockHeaderRequest) Reset() { *m = GetBlockHeaderRequest{} }
func (m *GetBlockHeaderRequest) String() string { return proto.CompactTextString(m) }
func (*GetBlockHeaderRequest) ProtoMessage() {}
func (*GetBlockHeaderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{0}
}
......@@ -267,8 +270,11 @@ type GetInterchainTxWrappersRequest struct {
}
func (m *GetInterchainTxWrappersRequest) Reset() { *m = GetInterchainTxWrappersRequest{} }
func (m *GetInterchainTxWrappersRequest) String() string { return proto.CompactTextString(m) }
func (*GetInterchainTxWrappersRequest) ProtoMessage() {}
func (*GetInterchainTxWrappersRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{1}
}
......@@ -330,8 +336,11 @@ type TransactionHashMsg struct {
}
func (m *TransactionHashMsg) Reset() { *m = TransactionHashMsg{} }
func (m *TransactionHashMsg) String() string { return proto.CompactTextString(m) }
func (*TransactionHashMsg) ProtoMessage() {}
func (*TransactionHashMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{2}
}
......@@ -380,8 +389,11 @@ type GetBlockRequest struct {
}
func (m *GetBlockRequest) Reset() { *m = GetBlockRequest{} }
func (m *GetBlockRequest) String() string { return proto.CompactTextString(m) }
func (*GetBlockRequest) ProtoMessage() {}
func (*GetBlockRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{3}
}
......@@ -436,8 +448,11 @@ type Request struct {
}
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{4}
}
......@@ -485,8 +500,11 @@ type Response struct {
}
func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{5}
}
......@@ -534,8 +552,11 @@ type SignResponse struct {
}
func (m *SignResponse) Reset() { *m = SignResponse{} }
func (m *SignResponse) String() string { return proto.CompactTextString(m) }
func (*SignResponse) ProtoMessage() {}
func (*SignResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{6}
}
......@@ -583,8 +604,11 @@ type Address struct {
}
func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{7}
}
......@@ -633,8 +657,11 @@ type GetBlocksRequest struct {
}
func (m *GetBlocksRequest) Reset() { *m = GetBlocksRequest{} }
func (m *GetBlocksRequest) String() string { return proto.CompactTextString(m) }
func (*GetBlocksRequest) ProtoMessage() {}
func (*GetBlocksRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{8}
}
......@@ -689,8 +716,11 @@ type GetBlocksResponse struct {
}
func (m *GetBlocksResponse) Reset() { *m = GetBlocksResponse{} }
func (m *GetBlocksResponse) String() string { return proto.CompactTextString(m) }
func (*GetBlocksResponse) ProtoMessage() {}
func (*GetBlocksResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{9}
}
......@@ -739,8 +769,11 @@ type GetBlockHeadersRequest struct {
}
func (m *GetBlockHeadersRequest) Reset() { *m = GetBlockHeadersRequest{} }
func (m *GetBlockHeadersRequest) String() string { return proto.CompactTextString(m) }
func (*GetBlockHeadersRequest) ProtoMessage() {}
func (*GetBlockHeadersRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{10}
}
......@@ -795,8 +828,11 @@ type GetBlockHeadersResponse struct {
}
func (m *GetBlockHeadersResponse) Reset() { *m = GetBlockHeadersResponse{} }
func (m *GetBlockHeadersResponse) String() string { return proto.CompactTextString(m) }
func (*GetBlockHeadersResponse) ProtoMessage() {}
func (*GetBlockHeadersResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{11}
}
......@@ -845,8 +881,11 @@ type SubscriptionRequest struct {
}
func (m *SubscriptionRequest) Reset() { *m = SubscriptionRequest{} }
func (m *SubscriptionRequest) String() string { return proto.CompactTextString(m) }
func (*SubscriptionRequest) ProtoMessage() {}
func (*SubscriptionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{12}
}
......@@ -902,8 +941,11 @@ type GetMultiSignsRequest struct {
}
func (m *GetMultiSignsRequest) Reset() { *m = GetMultiSignsRequest{} }
func (m *GetMultiSignsRequest) String() string { return proto.CompactTextString(m) }
func (*GetMultiSignsRequest) ProtoMessage() {}
func (*GetMultiSignsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{13}
}
......@@ -959,8 +1001,11 @@ type GetTransactionResponse struct {
}
func (m *GetTransactionResponse) Reset() { *m = GetTransactionResponse{} }
func (m *GetTransactionResponse) String() string { return proto.CompactTextString(m) }
func (*GetTransactionResponse) ProtoMessage() {}
func (*GetTransactionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{14}
}
......@@ -1016,8 +1061,11 @@ type VerifiedTx struct {
}
func (m *VerifiedTx) Reset() { *m = VerifiedTx{} }
func (m *VerifiedTx) String() string { return proto.CompactTextString(m) }
func (*VerifiedTx) ProtoMessage() {}
func (*VerifiedTx) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{15}
}
......@@ -1074,8 +1122,11 @@ type InterchainTxWrapper struct {
}
func (m *InterchainTxWrapper) Reset() { *m = InterchainTxWrapper{} }
func (m *InterchainTxWrapper) String() string { return proto.CompactTextString(m) }
func (*InterchainTxWrapper) ProtoMessage() {}
func (*InterchainTxWrapper) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{16}
}
......@@ -1130,8 +1181,11 @@ type InterchainTxWrappers struct {
}
func (m *InterchainTxWrappers) Reset() { *m = InterchainTxWrappers{} }
func (m *InterchainTxWrappers) String() string { return proto.CompactTextString(m) }
func (*InterchainTxWrappers) ProtoMessage() {}
func (*InterchainTxWrappers) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{17}
}
......@@ -1180,8 +1234,11 @@ type GetTPSRequest struct {
}
func (m *GetTPSRequest) Reset() { *m = GetTPSRequest{} }
func (m *GetTPSRequest) String() string { return proto.CompactTextString(m) }
func (*GetTPSRequest) ProtoMessage() {}
func (*GetTPSRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{18}
}
......@@ -1236,8 +1293,11 @@ type DelVPNodeRequest struct {
}
func (m *DelVPNodeRequest) Reset() { *m = DelVPNodeRequest{} }
func (m *DelVPNodeRequest) String() string { return proto.CompactTextString(m) }
func (*DelVPNodeRequest) ProtoMessage() {}
func (*DelVPNodeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{19}
}
......@@ -1287,8 +1347,11 @@ type SidecarInfo struct {
}
func (m *SidecarInfo) Reset() { *m = SidecarInfo{} }
func (m *SidecarInfo) String() string { return proto.CompactTextString(m) }
func (*SidecarInfo) ProtoMessage() {}
func (*SidecarInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{20}
}
......@@ -1351,8 +1414,11 @@ type CheckSidecarResponse struct {
}
func (m *CheckSidecarResponse) Reset() { *m = CheckSidecarResponse{} }
func (m *CheckSidecarResponse) String() string { return proto.CompactTextString(m) }
func (*CheckSidecarResponse) ProtoMessage() {}
func (*CheckSidecarResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{21}
}
......@@ -1407,8 +1473,11 @@ type HeartBeatRespones struct {
}
func (m *HeartBeatRespones) Reset() { *m = HeartBeatRespones{} }
func (m *HeartBeatRespones) String() string { return proto.CompactTextString(m) }
func (*HeartBeatRespones) ProtoMessage() {}
func (*HeartBeatRespones) Descriptor() ([]byte, []int) {
return fileDescriptor_f209535e190f2bed, []int{22}
}
......
......@@ -157,8 +157,11 @@ type BxhTransaction struct {
}
func (m *BxhTransaction) Reset() { *m = BxhTransaction{} }
func (m *BxhTransaction) String() string { return proto.CompactTextString(m) }
func (*BxhTransaction) ProtoMessage() {}
func (*BxhTransaction) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{0}
}
......@@ -259,8 +262,11 @@ type TransactionData struct {
}
func (m *TransactionData) Reset() { *m = TransactionData{} }
func (m *TransactionData) String() string { return proto.CompactTextString(m) }
func (*TransactionData) ProtoMessage() {}
func (*TransactionData) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{1}
}
......@@ -337,8 +343,11 @@ type InvokePayload struct {
}
func (m *InvokePayload) Reset() { *m = InvokePayload{} }
func (m *InvokePayload) String() string { return proto.CompactTextString(m) }
func (*InvokePayload) ProtoMessage() {}
func (*InvokePayload) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{2}
}
......@@ -395,8 +404,11 @@ type TransactionMeta struct {
}
func (m *TransactionMeta) Reset() { *m = TransactionMeta{} }
func (m *TransactionMeta) String() string { return proto.CompactTextString(m) }
func (*TransactionMeta) ProtoMessage() {}
func (*TransactionMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{3}
}
......@@ -460,8 +472,11 @@ type CrosschainTransactionExtra struct {
}
func (m *CrosschainTransactionExtra) Reset() { *m = CrosschainTransactionExtra{} }
func (m *CrosschainTransactionExtra) String() string { return proto.CompactTextString(m) }
func (*CrosschainTransactionExtra) ProtoMessage() {}
func (*CrosschainTransactionExtra) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{4}
}
......@@ -524,8 +539,11 @@ type TransactionTracingMeta struct {
}
func (m *TransactionTracingMeta) Reset() { *m = TransactionTracingMeta{} }
func (m *TransactionTracingMeta) String() string { return proto.CompactTextString(m) }
func (*TransactionTracingMeta) ProtoMessage() {}
func (*TransactionTracingMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{5}
}
......@@ -581,8 +599,11 @@ type TransactionSlice struct {
}
func (m *TransactionSlice) Reset() { *m = TransactionSlice{} }
func (m *TransactionSlice) String() string { return proto.CompactTextString(m) }
func (*TransactionSlice) ProtoMessage() {}
func (*TransactionSlice) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{6}
}
......@@ -643,8 +664,11 @@ type AssetExchangeInfo struct {
}
func (m *AssetExchangeInfo) Reset() { *m = AssetExchangeInfo{} }
func (m *AssetExchangeInfo) String() string { return proto.CompactTextString(m) }
func (*AssetExchangeInfo) ProtoMessage() {}
func (*AssetExchangeInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{7}
}
......
......@@ -34,8 +34,11 @@ type ChainMeta struct {
}
func (m *ChainMeta) Reset() { *m = ChainMeta{} }
func (m *ChainMeta) String() string { return proto.CompactTextString(m) }
func (*ChainMeta) ProtoMessage() {}
func (*ChainMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_d4d91b2d037e7a44, []int{0}
}
......
......@@ -31,8 +31,11 @@ type CommitEvent struct {
}
func (m *CommitEvent) Reset() { *m = CommitEvent{} }
func (m *CommitEvent) String() string { return proto.CompactTextString(m) }
func (*CommitEvent) ProtoMessage() {}
func (*CommitEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_db7163399a465f48, []int{0}
}
......
......@@ -118,8 +118,11 @@ type IBTP struct {
}
func (m *IBTP) Reset() { *m = IBTP{} }
func (m *IBTP) String() string { return proto.CompactTextString(m) }
func (*IBTP) ProtoMessage() {}
func (*IBTP) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{0}
}
......@@ -231,8 +234,11 @@ type Payload struct {
}
func (m *Payload) Reset() { *m = Payload{} }
func (m *Payload) String() string { return proto.CompactTextString(m) }
func (*Payload) ProtoMessage() {}
func (*Payload) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{1}
}
......@@ -294,8 +300,11 @@ type Content struct {
}
func (m *Content) Reset() { *m = Content{} }
func (m *Content) String() string { return proto.CompactTextString(m) }
func (*Content) ProtoMessage() {}
func (*Content) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{2}
}
......@@ -392,8 +401,11 @@ type IBTPs struct {
}
func (m *IBTPs) Reset() { *m = IBTPs{} }
func (m *IBTPs) String() string { return proto.CompactTextString(m) }
func (*IBTPs) ProtoMessage() {}
func (*IBTPs) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{3}
}
......
......@@ -36,8 +36,11 @@ type IBTPX struct {
}
func (m *IBTPX) Reset() { *m = IBTPX{} }
func (m *IBTPX) String() string { return proto.CompactTextString(m) }
func (*IBTPX) ProtoMessage() {}
func (*IBTPX) Descriptor() ([]byte, []int) {
return fileDescriptor_8402d80e061d514a, []int{0}
}
......
......@@ -33,8 +33,11 @@ type InterchainMetaS struct {
}
func (m *InterchainMetaS) Reset() { *m = InterchainMetaS{} }
func (m *InterchainMetaS) String() string { return proto.CompactTextString(m) }
func (*InterchainMetaS) ProtoMessage() {}
func (*InterchainMetaS) Descriptor() ([]byte, []int) {
return fileDescriptor_d2602fcc2fbd6b2a, []int{0}
}
......@@ -85,8 +88,11 @@ type InterchainS struct {
}
func (m *InterchainS) Reset() { *m = InterchainS{} }
func (m *InterchainS) String() string { return proto.CompactTextString(m) }
func (*InterchainS) ProtoMessage() {}
func (*InterchainS) Descriptor() ([]byte, []int) {
return fileDescriptor_d2602fcc2fbd6b2a, []int{1}
}
......
......@@ -88,8 +88,11 @@ type Message struct {
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{0}
}
......@@ -152,8 +155,11 @@ type Pack struct {
}
func (m *Pack) Reset() { *m = Pack{} }
func (m *Pack) String() string { return proto.CompactTextString(m) }
func (*Pack) ProtoMessage() {}
func (*Pack) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{1}
}
......@@ -209,8 +215,11 @@ type PeerInfo struct {
}
func (m *PeerInfo) Reset() { *m = PeerInfo{} }
func (m *PeerInfo) String() string { return proto.CompactTextString(m) }
func (*PeerInfo) ProtoMessage() {}
func (*PeerInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{2}
}
......
......@@ -32,8 +32,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Empty struct{}
func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{0}
}
......@@ -76,8 +79,11 @@ type InitializeRequest struct {
}
func (m *InitializeRequest) Reset() { *m = InitializeRequest{} }
func (m *InitializeRequest) String() string { return proto.CompactTextString(m) }
func (*InitializeRequest) ProtoMessage() {}
func (*InitializeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{1}
}
......@@ -141,8 +147,11 @@ type SubmitIBTPResponse struct {
}
func (m *SubmitIBTPResponse) Reset() { *m = SubmitIBTPResponse{} }
func (m *SubmitIBTPResponse) String() string { return proto.CompactTextString(m) }
func (*SubmitIBTPResponse) ProtoMessage() {}
func (*SubmitIBTPResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{2}
}
......@@ -205,8 +214,11 @@ type RollbackIBTPRequest struct {
}
func (m *RollbackIBTPRequest) Reset() { *m = RollbackIBTPRequest{} }
func (m *RollbackIBTPRequest) String() string { return proto.CompactTextString(m) }
func (*RollbackIBTPRequest) ProtoMessage() {}
func (*RollbackIBTPRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{3}
}
......@@ -262,8 +274,11 @@ type RollbackIBTPResponse struct {
}
func (m *RollbackIBTPResponse) Reset() { *m = RollbackIBTPResponse{} }
func (m *RollbackIBTPResponse) String() string { return proto.CompactTextString(m) }
func (*RollbackIBTPResponse) ProtoMessage() {}
func (*RollbackIBTPResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{4}
}
......@@ -319,8 +334,11 @@ type GetOutMessageRequest struct {
}
func (m *GetOutMessageRequest) Reset() { *m = GetOutMessageRequest{} }
func (m *GetOutMessageRequest) String() string { return proto.CompactTextString(m) }
func (*GetOutMessageRequest) ProtoMessage() {}
func (*GetOutMessageRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{5}
}
......@@ -376,8 +394,11 @@ type GetInMessageRequest struct {
}
func (m *GetInMessageRequest) Reset() { *m = GetInMessageRequest{} }
func (m *GetInMessageRequest) String() string { return proto.CompactTextString(m) }
func (*GetInMessageRequest) ProtoMessage() {}
func (*GetInMessageRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{6}
}
......@@ -432,8 +453,11 @@ type GetInMessageResponse struct {
}
func (m *GetInMessageResponse) Reset() { *m = GetInMessageResponse{} }
func (m *GetInMessageResponse) String() string { return proto.CompactTextString(m) }
func (*GetInMessageResponse) ProtoMessage() {}
func (*GetInMessageResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{7}
}
......@@ -481,8 +505,11 @@ type GetMetaResponse struct {
}
func (m *GetMetaResponse) Reset() { *m = GetMetaResponse{} }
func (m *GetMetaResponse) String() string { return proto.CompactTextString(m) }
func (*GetMetaResponse) ProtoMessage() {}
func (*GetMetaResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{8}
}
......@@ -530,8 +557,11 @@ type NameResponse struct {
}
func (m *NameResponse) Reset() { *m = NameResponse{} }
func (m *NameResponse) String() string { return proto.CompactTextString(m) }
func (*NameResponse) ProtoMessage() {}
func (*NameResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{9}
}
......@@ -579,8 +609,11 @@ type TypeResponse struct {
}
func (m *TypeResponse) Reset() { *m = TypeResponse{} }
func (m *TypeResponse) String() string { return proto.CompactTextString(m) }
func (*TypeResponse) ProtoMessage() {}
func (*TypeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{10}
}
......
......@@ -65,8 +65,11 @@ type Receipt struct {
}
func (m *Receipt) Reset() { *m = Receipt{} }
func (m *Receipt) String() string { return proto.CompactTextString(m) }
func (*Receipt) ProtoMessage() {}
func (*Receipt) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{0}
}
......@@ -149,8 +152,11 @@ type Receipts struct {
}
func (m *Receipts) Reset() { *m = Receipts{} }
func (m *Receipts) String() string { return proto.CompactTextString(m) }
func (*Receipts) ProtoMessage() {}
func (*Receipts) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{1}
}
......@@ -202,8 +208,11 @@ type Event struct {
}
func (m *Event) Reset() { *m = Event{} }
func (m *Event) String() string { return proto.CompactTextString(m) }
func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{2}
}
......@@ -266,8 +275,11 @@ type EvmLog struct {
}
func (m *EvmLog) Reset() { *m = EvmLog{} }
func (m *EvmLog) String() string { return proto.CompactTextString(m) }
func (*EvmLog) ProtoMessage() {}
func (*EvmLog) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{3}
}
......
......@@ -55,7 +55,9 @@ type Transactions struct {
}
func (txs *Transactions) Reset() { *txs = Transactions{} }
func (txs *Transactions) String() string { return proto.CompactTextString(txs) }
func (txs *Transactions) ProtoMessage() {}
func (txs *Transactions) MarshalTo(data []byte) (int, error) {
......
......@@ -33,8 +33,11 @@ type VpInfo struct {
}
func (m *VpInfo) Reset() { *m = VpInfo{} }
func (m *VpInfo) String() string { return proto.CompactTextString(m) }
func (*VpInfo) ProtoMessage() {}
func (*VpInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_7477e72a440db3af, []int{0}
}
......
......@@ -6,6 +6,7 @@ import (
"github.com/Rican7/retry"
"github.com/Rican7/retry/strategy"
"github.com/link33/sidecar/model/pb"
)
......
......@@ -3,7 +3,6 @@ package plugins
import (
"github.com/link33/sidecar/internal"
"github.com/link33/sidecar/model/pb"
//"github.com/link33/sidecar/internal/port"
)
//go:generate mockgen -destination mock_client/mock_client.go -package mock_client -source interface.go
......
......@@ -8,6 +8,7 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
pb "github.com/link33/sidecar/model/pb"
plugins "github.com/link33/sidecar/pkg/plugins"
)
......
......@@ -4,8 +4,9 @@ import (
"context"
"github.com/hashicorp/go-plugin"
"github.com/link33/sidecar/model/pb"
"google.golang.org/grpc"
"github.com/link33/sidecar/model/pb"
)
// Handshake is a common handshake that is shared by plugin and host.
......@@ -43,7 +44,7 @@ func (p *AppchainGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Serve
func (p *AppchainGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
return &GRPCClient{
client: pb.NewAppchainPluginClient(c), // 创建gRPC客户端的方法是自动生成的
doneContext: ctx,
DoneContext: ctx,
}, nil
}
......
......@@ -7,6 +7,7 @@ import (
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin"
"github.com/link33/sidecar/internal/repo"
)
......
package plugins
package test
import (
"context"
......@@ -7,12 +7,14 @@ import (
"time"
"github.com/golang/mock/gomock"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/pb"
"github.com/link33/sidecar/pkg/plugins/mock_client"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"github.com/link33/sidecar/internal/repo"
"github.com/link33/sidecar/model/pb"
"github.com/link33/sidecar/pkg/plugins"
"github.com/link33/sidecar/pkg/plugins/mock_client"
)
const (
......@@ -29,7 +31,7 @@ func TestCreateClient(t *testing.T) {
Plugin: "appchain_plugin",
}
_, _, err := CreateClient(from, appchainConfig, make([]byte, 0))
_, _, err := plugins.CreateClient(from, appchainConfig, make([]byte, 0))
require.NotNil(t, err)
}
......@@ -38,7 +40,7 @@ func TestGRPCServer_Error(t *testing.T) {
mockCtl := gomock.NewController(t)
mockCtl.Finish()
cli := mock_client.NewMockClient(mockCtl)
grpcServer := GRPCServer{cli}
grpcServer := plugins.GRPCServer{cli}
cli.EXPECT().GetInMeta().Return(nil, fmt.Errorf("get in meta error")).AnyTimes()
cli.EXPECT().GetOutMeta().Return(nil, fmt.Errorf("get out meta error")).AnyTimes()
......@@ -59,7 +61,7 @@ func TestGRPCServer(t *testing.T) {
mockCtl := gomock.NewController(t)
mockCtl.Finish()
cli := mock_client.NewMockClient(mockCtl)
grpcServer := GRPCServer{cli}
grpcServer := plugins.GRPCServer{cli}
initReq := &pb.InitializeRequest{
ConfigPath: configPath,
SidecarId: from,
......@@ -181,7 +183,7 @@ func TestGRPCClient(t *testing.T) {
ibtp, err := grpcClient.GetOutMessage(to, uint64(1))
require.Nil(t, err)
require.Equal(t, to, ibtp.To)
require.Equal(t, uint64(1), ibtp.Index)
require.Equal(t, uint64(1), ibtp.Nonce)
_, err = grpcClient.GetInMessage(from, uint64(1))
require.Nil(t, err)
......@@ -214,7 +216,7 @@ func TestGRPCClient(t *testing.T) {
ibtp = &pb.IBTP{
From: "from",
To: "to",
Index: 1,
Nonce: 1,
}
_, err = grpcClient.GetReceipt(ibtp)
require.Nil(t, err)
......@@ -227,7 +229,7 @@ func TestAppchainGRPCPlugin_GRPCClient(t *testing.T) {
mockCtl := gomock.NewController(t)
mockCtl.Finish()
cli := mock_client.NewMockClient(mockCtl)
grpcPlugin := AppchainGRPCPlugin{
grpcPlugin := plugins.AppchainGRPCPlugin{
Impl: cli,
}
......@@ -239,7 +241,7 @@ func TestAppchainGRPCPlugin_GRPCServer(t *testing.T) {
mockCtl := gomock.NewController(t)
mockCtl.Finish()
cli := mock_client.NewMockClient(mockCtl)
grpcPlugin := AppchainGRPCPlugin{
grpcPlugin := plugins.AppchainGRPCPlugin{
Impl: cli,
}
......@@ -248,11 +250,8 @@ func TestAppchainGRPCPlugin_GRPCServer(t *testing.T) {
})
}
func getGRPCClient(ctx context.Context, mc *mockAppchainPluginClient) (*GRPCClient, error) {
return &GRPCClient{
client: mc,
doneContext: ctx,
}, nil
func getGRPCClient(ctx context.Context, mc *mockAppchainPluginClient) (*plugins.GRPCClient, error) {
return &plugins.GRPCClient{}, nil
}
//==========================================================
......@@ -300,7 +299,7 @@ func (mc *mockAppchainPluginClient) SubmitIBTP(ctx context.Context, in *pb.IBTP,
func (mc *mockAppchainPluginClient) GetOutMessage(ctx context.Context, in *pb.GetOutMessageRequest, opts ...grpc.CallOption) (*pb.IBTP, error) {
return &pb.IBTP{
To: in.To,
Index: in.Idx,
Nonce: in.Idx,
Timestamp: time.Now().UnixNano(),
}, nil
}
......@@ -368,7 +367,7 @@ func (mc *mockAppchainPluginClient) GetReceipt(ctx context.Context, in *pb.IBTP,
return &pb.IBTP{
From: in.From,
To: in.To,
Index: in.Index,
Nonce: in.Nonce,
Timestamp: time.Now().UnixNano(),
Type: pb.IBTP_RECEIPT_SUCCESS,
}, nil
......
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