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) {
......
......@@ -77,9 +77,12 @@ type Arg struct {
Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
}
func (m *Arg) Reset() { *m = Arg{} }
func (m *Arg) Reset() { *m = Arg{} }
func (m *Arg) String() string { return proto.CompactTextString(m) }
func (*Arg) ProtoMessage() {}
func (*Arg) ProtoMessage() {}
func (*Arg) Descriptor() ([]byte, []int) {
return fileDescriptor_4371b204df3ab2da, []int{0}
}
......
......@@ -29,9 +29,12 @@ type Uint64Slice struct {
Slice []uint64 `protobuf:"varint,1,rep,packed,name=slice,proto3" json:"slice,omitempty"`
}
func (m *Uint64Slice) Reset() { *m = Uint64Slice{} }
func (m *Uint64Slice) Reset() { *m = Uint64Slice{} }
func (m *Uint64Slice) String() string { return proto.CompactTextString(m) }
func (*Uint64Slice) ProtoMessage() {}
func (*Uint64Slice) ProtoMessage() {}
func (*Uint64Slice) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{0}
}
......@@ -79,9 +82,12 @@ type StringUint64Map struct {
Vals []uint64 `protobuf:"varint,2,rep,packed,name=vals,proto3" json:"vals,omitempty"`
}
func (m *StringUint64Map) Reset() { *m = StringUint64Map{} }
func (m *StringUint64Map) Reset() { *m = StringUint64Map{} }
func (m *StringUint64Map) String() string { return proto.CompactTextString(m) }
func (*StringUint64Map) ProtoMessage() {}
func (*StringUint64Map) ProtoMessage() {}
func (*StringUint64Map) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{1}
}
......@@ -136,9 +142,12 @@ type StringUint64SliceMap struct {
Vals []*Uint64Slice `protobuf:"bytes,2,rep,name=vals,proto3" json:"vals,omitempty"`
}
func (m *StringUint64SliceMap) Reset() { *m = StringUint64SliceMap{} }
func (m *StringUint64SliceMap) Reset() { *m = StringUint64SliceMap{} }
func (m *StringUint64SliceMap) String() string { return proto.CompactTextString(m) }
func (*StringUint64SliceMap) ProtoMessage() {}
func (*StringUint64SliceMap) ProtoMessage() {}
func (*StringUint64SliceMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{2}
}
......@@ -193,9 +202,12 @@ type VerifiedIndex struct {
Valid bool `protobuf:"varint,2,opt,name=valid,proto3" json:"valid,omitempty"`
}
func (m *VerifiedIndex) Reset() { *m = VerifiedIndex{} }
func (m *VerifiedIndex) Reset() { *m = VerifiedIndex{} }
func (m *VerifiedIndex) String() string { return proto.CompactTextString(m) }
func (*VerifiedIndex) ProtoMessage() {}
func (*VerifiedIndex) ProtoMessage() {}
func (*VerifiedIndex) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{3}
}
......@@ -249,9 +261,12 @@ type VerifiedIndexSlice struct {
Slice []*VerifiedIndex `protobuf:"bytes,1,rep,name=slice,proto3" json:"slice,omitempty"`
}
func (m *VerifiedIndexSlice) Reset() { *m = VerifiedIndexSlice{} }
func (m *VerifiedIndexSlice) Reset() { *m = VerifiedIndexSlice{} }
func (m *VerifiedIndexSlice) String() string { return proto.CompactTextString(m) }
func (*VerifiedIndexSlice) ProtoMessage() {}
func (*VerifiedIndexSlice) ProtoMessage() {}
func (*VerifiedIndexSlice) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{4}
}
......@@ -299,9 +314,12 @@ type StringVerifiedIndexMap struct {
Vals []*VerifiedIndex `protobuf:"bytes,2,rep,name=vals,proto3" json:"vals,omitempty"`
}
func (m *StringVerifiedIndexMap) Reset() { *m = StringVerifiedIndexMap{} }
func (m *StringVerifiedIndexMap) Reset() { *m = StringVerifiedIndexMap{} }
func (m *StringVerifiedIndexMap) String() string { return proto.CompactTextString(m) }
func (*StringVerifiedIndexMap) ProtoMessage() {}
func (*StringVerifiedIndexMap) ProtoMessage() {}
func (*StringVerifiedIndexMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{5}
}
......@@ -356,9 +374,12 @@ type StringVerifiedIndexSliceMap struct {
Vals []*VerifiedIndexSlice `protobuf:"bytes,2,rep,name=vals,proto3" json:"vals,omitempty"`
}
func (m *StringVerifiedIndexSliceMap) Reset() { *m = StringVerifiedIndexSliceMap{} }
func (m *StringVerifiedIndexSliceMap) Reset() { *m = StringVerifiedIndexSliceMap{} }
func (m *StringVerifiedIndexSliceMap) String() string { return proto.CompactTextString(m) }
func (*StringVerifiedIndexSliceMap) ProtoMessage() {}
func (*StringVerifiedIndexSliceMap) ProtoMessage() {}
func (*StringVerifiedIndexSliceMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{6}
}
......
......@@ -35,9 +35,12 @@ type Block struct {
Extra []byte `protobuf:"bytes,5,opt,name=extra,proto3" json:"extra,omitempty"`
}
func (m *Block) Reset() { *m = Block{} }
func (m *Block) Reset() { *m = Block{} }
func (m *Block) String() string { return proto.CompactTextString(m) }
func (*Block) ProtoMessage() {}
func (*Block) ProtoMessage() {}
func (*Block) Descriptor() ([]byte, []int) {
return fileDescriptor_8e550b1f5926e92d, []int{0}
}
......@@ -105,9 +108,12 @@ type BlockHeader struct {
Bloom *github_com_meshplus_bitxhub_kit_types.Bloom `protobuf:"bytes,8,opt,name=Bloom,proto3,customtype=github.com/meshplus/bitxhub-kit/types.Bloom" json:"Bloom,omitempty"`
}
func (m *BlockHeader) Reset() { *m = BlockHeader{} }
func (m *BlockHeader) Reset() { *m = BlockHeader{} }
func (m *BlockHeader) String() string { return proto.CompactTextString(m) }
func (*BlockHeader) ProtoMessage() {}
func (*BlockHeader) ProtoMessage() {}
func (*BlockHeader) Descriptor() ([]byte, []int) {
return fileDescriptor_8e550b1f5926e92d, []int{1}
}
......
This diff is collapsed.
......@@ -156,9 +156,12 @@ type BxhTransaction struct {
Extra []byte `protobuf:"bytes,11,opt,name=extra,proto3" json:"extra,omitempty"`
}
func (m *BxhTransaction) Reset() { *m = BxhTransaction{} }
func (m *BxhTransaction) Reset() { *m = BxhTransaction{} }
func (m *BxhTransaction) String() string { return proto.CompactTextString(m) }
func (*BxhTransaction) ProtoMessage() {}
func (*BxhTransaction) ProtoMessage() {}
func (*BxhTransaction) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{0}
}
......@@ -258,9 +261,12 @@ type TransactionData struct {
Extra []byte `protobuf:"bytes,5,opt,name=extra,proto3" json:"extra,omitempty"`
}
func (m *TransactionData) Reset() { *m = TransactionData{} }
func (m *TransactionData) Reset() { *m = TransactionData{} }
func (m *TransactionData) String() string { return proto.CompactTextString(m) }
func (*TransactionData) ProtoMessage() {}
func (*TransactionData) ProtoMessage() {}
func (*TransactionData) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{1}
}
......@@ -336,9 +342,12 @@ type InvokePayload struct {
Args []*Arg `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"`
}
func (m *InvokePayload) Reset() { *m = InvokePayload{} }
func (m *InvokePayload) Reset() { *m = InvokePayload{} }
func (m *InvokePayload) String() string { return proto.CompactTextString(m) }
func (*InvokePayload) ProtoMessage() {}
func (*InvokePayload) ProtoMessage() {}
func (*InvokePayload) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{2}
}
......@@ -394,9 +403,12 @@ type TransactionMeta struct {
Index uint64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *TransactionMeta) Reset() { *m = TransactionMeta{} }
func (m *TransactionMeta) Reset() { *m = TransactionMeta{} }
func (m *TransactionMeta) String() string { return proto.CompactTextString(m) }
func (*TransactionMeta) ProtoMessage() {}
func (*TransactionMeta) ProtoMessage() {}
func (*TransactionMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{3}
}
......@@ -459,9 +471,12 @@ type CrosschainTransactionExtra struct {
Ret []byte `protobuf:"bytes,3,opt,name=ret,proto3" json:"ret,omitempty"`
}
func (m *CrosschainTransactionExtra) Reset() { *m = CrosschainTransactionExtra{} }
func (m *CrosschainTransactionExtra) Reset() { *m = CrosschainTransactionExtra{} }
func (m *CrosschainTransactionExtra) String() string { return proto.CompactTextString(m) }
func (*CrosschainTransactionExtra) ProtoMessage() {}
func (*CrosschainTransactionExtra) ProtoMessage() {}
func (*CrosschainTransactionExtra) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{4}
}
......@@ -523,9 +538,12 @@ type TransactionTracingMeta struct {
ConfirmHash []byte `protobuf:"bytes,2,opt,name=confirm_hash,json=confirmHash,proto3" json:"confirm_hash,omitempty"`
}
func (m *TransactionTracingMeta) Reset() { *m = TransactionTracingMeta{} }
func (m *TransactionTracingMeta) Reset() { *m = TransactionTracingMeta{} }
func (m *TransactionTracingMeta) String() string { return proto.CompactTextString(m) }
func (*TransactionTracingMeta) ProtoMessage() {}
func (*TransactionTracingMeta) ProtoMessage() {}
func (*TransactionTracingMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{5}
}
......@@ -580,9 +598,12 @@ type TransactionSlice struct {
Txs []*BxhTransaction `protobuf:"bytes,2,rep,name=txs,proto3" json:"txs,omitempty"`
}
func (m *TransactionSlice) Reset() { *m = TransactionSlice{} }
func (m *TransactionSlice) Reset() { *m = TransactionSlice{} }
func (m *TransactionSlice) String() string { return proto.CompactTextString(m) }
func (*TransactionSlice) ProtoMessage() {}
func (*TransactionSlice) ProtoMessage() {}
func (*TransactionSlice) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{6}
}
......@@ -642,9 +663,12 @@ type AssetExchangeInfo struct {
AssetOnDst uint64 `protobuf:"varint,7,opt,name=asset_on_dst,json=assetOnDst,proto3" json:"asset_on_dst,omitempty"`
}
func (m *AssetExchangeInfo) Reset() { *m = AssetExchangeInfo{} }
func (m *AssetExchangeInfo) Reset() { *m = AssetExchangeInfo{} }
func (m *AssetExchangeInfo) String() string { return proto.CompactTextString(m) }
func (*AssetExchangeInfo) ProtoMessage() {}
func (*AssetExchangeInfo) ProtoMessage() {}
func (*AssetExchangeInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{7}
}
......
......@@ -33,9 +33,12 @@ type ChainMeta struct {
InterchainTxCount uint64 `protobuf:"varint,3,opt,name=interchain_tx_count,json=interchainTxCount,proto3" json:"interchain_tx_count,omitempty"`
}
func (m *ChainMeta) Reset() { *m = ChainMeta{} }
func (m *ChainMeta) Reset() { *m = ChainMeta{} }
func (m *ChainMeta) String() string { return proto.CompactTextString(m) }
func (*ChainMeta) ProtoMessage() {}
func (*ChainMeta) ProtoMessage() {}
func (*ChainMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_d4d91b2d037e7a44, []int{0}
}
......
......@@ -30,9 +30,12 @@ type CommitEvent struct {
LocalList []bool `protobuf:"varint,2,rep,packed,name=local_list,json=localList,proto3" json:"local_list,omitempty"`
}
func (m *CommitEvent) Reset() { *m = CommitEvent{} }
func (m *CommitEvent) Reset() { *m = CommitEvent{} }
func (m *CommitEvent) String() string { return proto.CompactTextString(m) }
func (*CommitEvent) ProtoMessage() {}
func (*CommitEvent) ProtoMessage() {}
func (*CommitEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_db7163399a465f48, []int{0}
}
......
......@@ -117,9 +117,12 @@ type IBTP struct {
Extra []byte `protobuf:"bytes,10,opt,name=extra,proto3" json:"extra,omitempty"`
}
func (m *IBTP) Reset() { *m = IBTP{} }
func (m *IBTP) Reset() { *m = IBTP{} }
func (m *IBTP) String() string { return proto.CompactTextString(m) }
func (*IBTP) ProtoMessage() {}
func (*IBTP) ProtoMessage() {}
func (*IBTP) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{0}
}
......@@ -230,9 +233,12 @@ type Payload struct {
Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
}
func (m *Payload) Reset() { *m = Payload{} }
func (m *Payload) Reset() { *m = Payload{} }
func (m *Payload) String() string { return proto.CompactTextString(m) }
func (*Payload) ProtoMessage() {}
func (*Payload) ProtoMessage() {}
func (*Payload) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{1}
}
......@@ -293,9 +299,12 @@ type Content struct {
ArgsRb [][]byte `protobuf:"bytes,8,rep,name=argsRb,proto3" json:"argsRb,omitempty"`
}
func (m *Content) Reset() { *m = Content{} }
func (m *Content) Reset() { *m = Content{} }
func (m *Content) String() string { return proto.CompactTextString(m) }
func (*Content) ProtoMessage() {}
func (*Content) ProtoMessage() {}
func (*Content) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{2}
}
......@@ -391,9 +400,12 @@ type IBTPs struct {
Ibtps []*IBTP `protobuf:"bytes,1,rep,name=ibtps,proto3" json:"ibtps,omitempty"`
}
func (m *IBTPs) Reset() { *m = IBTPs{} }
func (m *IBTPs) Reset() { *m = IBTPs{} }
func (m *IBTPs) String() string { return proto.CompactTextString(m) }
func (*IBTPs) ProtoMessage() {}
func (*IBTPs) ProtoMessage() {}
func (*IBTPs) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{3}
}
......
......@@ -35,9 +35,12 @@ type IBTPX struct {
IsValid bool `protobuf:"varint,6,opt,name=IsValid,proto3" json:"IsValid,omitempty"`
}
func (m *IBTPX) Reset() { *m = IBTPX{} }
func (m *IBTPX) Reset() { *m = IBTPX{} }
func (m *IBTPX) String() string { return proto.CompactTextString(m) }
func (*IBTPX) ProtoMessage() {}
func (*IBTPX) ProtoMessage() {}
func (*IBTPX) Descriptor() ([]byte, []int) {
return fileDescriptor_8402d80e061d514a, []int{0}
}
......
......@@ -32,9 +32,12 @@ type InterchainMetaS struct {
L2Roots []github_com_meshplus_bitxhub_kit_types.Hash `protobuf:"bytes,2,rep,name=l2Roots,proto3,customtype=github.com/meshplus/bitxhub-kit/types.Hash" json:"l2Roots,omitempty"`
}
func (m *InterchainMetaS) Reset() { *m = InterchainMetaS{} }
func (m *InterchainMetaS) Reset() { *m = InterchainMetaS{} }
func (m *InterchainMetaS) String() string { return proto.CompactTextString(m) }
func (*InterchainMetaS) ProtoMessage() {}
func (*InterchainMetaS) ProtoMessage() {}
func (*InterchainMetaS) Descriptor() ([]byte, []int) {
return fileDescriptor_d2602fcc2fbd6b2a, []int{0}
}
......@@ -84,9 +87,12 @@ type InterchainS struct {
SourceReceiptCounter *StringUint64Map `protobuf:"bytes,4,opt,name=SourceReceiptCounter,proto3" json:"SourceReceiptCounter,omitempty"`
}
func (m *InterchainS) Reset() { *m = InterchainS{} }
func (m *InterchainS) Reset() { *m = InterchainS{} }
func (m *InterchainS) String() string { return proto.CompactTextString(m) }
func (*InterchainS) ProtoMessage() {}
func (*InterchainS) ProtoMessage() {}
func (*InterchainS) Descriptor() ([]byte, []int) {
return fileDescriptor_d2602fcc2fbd6b2a, []int{1}
}
......
......@@ -87,9 +87,12 @@ type Message struct {
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{0}
}
......@@ -151,9 +154,12 @@ type Pack struct {
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *Pack) Reset() { *m = Pack{} }
func (m *Pack) Reset() { *m = Pack{} }
func (m *Pack) String() string { return proto.CompactTextString(m) }
func (*Pack) ProtoMessage() {}
func (*Pack) ProtoMessage() {}
func (*Pack) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{1}
}
......@@ -208,9 +214,12 @@ type PeerInfo struct {
Tag string `protobuf:"bytes,2,opt,name=Tag,proto3" json:"Tag,omitempty"`
}
func (m *PeerInfo) Reset() { *m = PeerInfo{} }
func (m *PeerInfo) Reset() { *m = PeerInfo{} }
func (m *PeerInfo) String() string { return proto.CompactTextString(m) }
func (*PeerInfo) ProtoMessage() {}
func (*PeerInfo) ProtoMessage() {}
func (*PeerInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{2}
}
......
......@@ -31,9 +31,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Empty struct{}
func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{0}
}
......@@ -75,9 +78,12 @@ type InitializeRequest struct {
Extra []byte `protobuf:"bytes,3,opt,name=extra,proto3" json:"extra,omitempty"`
}
func (m *InitializeRequest) Reset() { *m = InitializeRequest{} }
func (m *InitializeRequest) Reset() { *m = InitializeRequest{} }
func (m *InitializeRequest) String() string { return proto.CompactTextString(m) }
func (*InitializeRequest) ProtoMessage() {}
func (*InitializeRequest) ProtoMessage() {}
func (*InitializeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{1}
}
......@@ -140,9 +146,12 @@ type SubmitIBTPResponse struct {
Result *IBTP `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"`
}
func (m *SubmitIBTPResponse) Reset() { *m = SubmitIBTPResponse{} }
func (m *SubmitIBTPResponse) Reset() { *m = SubmitIBTPResponse{} }
func (m *SubmitIBTPResponse) String() string { return proto.CompactTextString(m) }
func (*SubmitIBTPResponse) ProtoMessage() {}
func (*SubmitIBTPResponse) ProtoMessage() {}
func (*SubmitIBTPResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{2}
}
......@@ -204,9 +213,12 @@ type RollbackIBTPRequest struct {
SrcChain bool `protobuf:"varint,2,opt,name=srcChain,proto3" json:"srcChain,omitempty"`
}
func (m *RollbackIBTPRequest) Reset() { *m = RollbackIBTPRequest{} }
func (m *RollbackIBTPRequest) Reset() { *m = RollbackIBTPRequest{} }
func (m *RollbackIBTPRequest) String() string { return proto.CompactTextString(m) }
func (*RollbackIBTPRequest) ProtoMessage() {}
func (*RollbackIBTPRequest) ProtoMessage() {}
func (*RollbackIBTPRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{3}
}
......@@ -261,9 +273,12 @@ type RollbackIBTPResponse struct {
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
}
func (m *RollbackIBTPResponse) Reset() { *m = RollbackIBTPResponse{} }
func (m *RollbackIBTPResponse) Reset() { *m = RollbackIBTPResponse{} }
func (m *RollbackIBTPResponse) String() string { return proto.CompactTextString(m) }
func (*RollbackIBTPResponse) ProtoMessage() {}
func (*RollbackIBTPResponse) ProtoMessage() {}
func (*RollbackIBTPResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{4}
}
......@@ -318,9 +333,12 @@ type GetOutMessageRequest struct {
Idx uint64 `protobuf:"varint,2,opt,name=idx,proto3" json:"idx,omitempty"`
}
func (m *GetOutMessageRequest) Reset() { *m = GetOutMessageRequest{} }
func (m *GetOutMessageRequest) Reset() { *m = GetOutMessageRequest{} }
func (m *GetOutMessageRequest) String() string { return proto.CompactTextString(m) }
func (*GetOutMessageRequest) ProtoMessage() {}
func (*GetOutMessageRequest) ProtoMessage() {}
func (*GetOutMessageRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{5}
}
......@@ -375,9 +393,12 @@ type GetInMessageRequest struct {
Idx uint64 `protobuf:"varint,2,opt,name=idx,proto3" json:"idx,omitempty"`
}
func (m *GetInMessageRequest) Reset() { *m = GetInMessageRequest{} }
func (m *GetInMessageRequest) Reset() { *m = GetInMessageRequest{} }
func (m *GetInMessageRequest) String() string { return proto.CompactTextString(m) }
func (*GetInMessageRequest) ProtoMessage() {}
func (*GetInMessageRequest) ProtoMessage() {}
func (*GetInMessageRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{6}
}
......@@ -431,9 +452,12 @@ type GetInMessageResponse struct {
Result [][]byte `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"`
}
func (m *GetInMessageResponse) Reset() { *m = GetInMessageResponse{} }
func (m *GetInMessageResponse) Reset() { *m = GetInMessageResponse{} }
func (m *GetInMessageResponse) String() string { return proto.CompactTextString(m) }
func (*GetInMessageResponse) ProtoMessage() {}
func (*GetInMessageResponse) ProtoMessage() {}
func (*GetInMessageResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{7}
}
......@@ -480,9 +504,12 @@ type GetMetaResponse struct {
Meta map[string]uint64 `protobuf:"bytes,1,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (m *GetMetaResponse) Reset() { *m = GetMetaResponse{} }
func (m *GetMetaResponse) Reset() { *m = GetMetaResponse{} }
func (m *GetMetaResponse) String() string { return proto.CompactTextString(m) }
func (*GetMetaResponse) ProtoMessage() {}
func (*GetMetaResponse) ProtoMessage() {}
func (*GetMetaResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{8}
}
......@@ -529,9 +556,12 @@ type NameResponse struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
}
func (m *NameResponse) Reset() { *m = NameResponse{} }
func (m *NameResponse) Reset() { *m = NameResponse{} }
func (m *NameResponse) String() string { return proto.CompactTextString(m) }
func (*NameResponse) ProtoMessage() {}
func (*NameResponse) ProtoMessage() {}
func (*NameResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{9}
}
......@@ -578,9 +608,12 @@ type TypeResponse struct {
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
}
func (m *TypeResponse) Reset() { *m = TypeResponse{} }
func (m *TypeResponse) Reset() { *m = TypeResponse{} }
func (m *TypeResponse) String() string { return proto.CompactTextString(m) }
func (*TypeResponse) ProtoMessage() {}
func (*TypeResponse) ProtoMessage() {}
func (*TypeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_22a625af4bc1cc87, []int{10}
}
......
......@@ -64,9 +64,12 @@ type Receipt struct {
ContractAddress *github_com_meshplus_bitxhub_kit_types.Address `protobuf:"bytes,9,opt,name=contract_address,json=contractAddress,proto3,customtype=github.com/meshplus/bitxhub-kit/types.Address" json:"contract_address,omitempty"`
}
func (m *Receipt) Reset() { *m = Receipt{} }
func (m *Receipt) Reset() { *m = Receipt{} }
func (m *Receipt) String() string { return proto.CompactTextString(m) }
func (*Receipt) ProtoMessage() {}
func (*Receipt) ProtoMessage() {}
func (*Receipt) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{0}
}
......@@ -148,9 +151,12 @@ type Receipts struct {
Receipts []*Receipt `protobuf:"bytes,1,rep,name=receipts,proto3" json:"receipts,omitempty"`
}
func (m *Receipts) Reset() { *m = Receipts{} }
func (m *Receipts) Reset() { *m = Receipts{} }
func (m *Receipts) String() string { return proto.CompactTextString(m) }
func (*Receipts) ProtoMessage() {}
func (*Receipts) ProtoMessage() {}
func (*Receipts) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{1}
}
......@@ -201,9 +207,12 @@ type Event struct {
Interchain bool `protobuf:"varint,3,opt,name=interchain,proto3" json:"interchain,omitempty"`
}
func (m *Event) Reset() { *m = Event{} }
func (m *Event) Reset() { *m = Event{} }
func (m *Event) String() string { return proto.CompactTextString(m) }
func (*Event) ProtoMessage() {}
func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{2}
}
......@@ -265,9 +274,12 @@ type EvmLog struct {
Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed,omitempty"`
}
func (m *EvmLog) Reset() { *m = EvmLog{} }
func (m *EvmLog) Reset() { *m = EvmLog{} }
func (m *EvmLog) String() string { return proto.CompactTextString(m) }
func (*EvmLog) ProtoMessage() {}
func (*EvmLog) ProtoMessage() {}
func (*EvmLog) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{3}
}
......
......@@ -54,9 +54,11 @@ type Transactions struct {
Transactions []Transaction
}
func (txs *Transactions) Reset() { *txs = Transactions{} }
func (txs *Transactions) Reset() { *txs = Transactions{} }
func (txs *Transactions) String() string { return proto.CompactTextString(txs) }
func (txs *Transactions) ProtoMessage() {}
func (txs *Transactions) ProtoMessage() {}
func (txs *Transactions) MarshalTo(data []byte) (int, error) {
txsData, err := txs.Marshal()
......
......@@ -32,9 +32,12 @@ type VpInfo struct {
Hosts []string `protobuf:"bytes,4,rep,name=hosts,proto3" json:"hosts,omitempty"`
}
func (m *VpInfo) Reset() { *m = VpInfo{} }
func (m *VpInfo) Reset() { *m = VpInfo{} }
func (m *VpInfo) String() string { return proto.CompactTextString(m) }
func (*VpInfo) ProtoMessage() {}
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