Commit 27e44da6 authored by suyanlong's avatar suyanlong

make fmt

parent 65c121b8
Pipeline #8004 failed with stages
......@@ -340,7 +340,6 @@ func getAppchain(ctx *cli.Context) error {
constant.AppchainMgrContractAddr.Address(),
"GetAppchain", nil, rpcx.String(id),
)
if err != nil {
return err
}
......@@ -364,7 +363,7 @@ func getAppchain(ctx *cli.Context) error {
return nil
}
//TODO
// TODO
func loadClient(keyPath string, grpcAddrs []string, ctx *cli.Context) (rpcx.Client, error) {
repoRoot, err := repo.PathRootWithDefault(ctx.GlobalString("repo"))
if err != nil {
......
......@@ -138,7 +138,7 @@ func updateMasterRule(ctx *cli.Context) error {
return nil
}
//TODO
// TODO
func bindRule(ctx *cli.Context) error {
ruleAddr := ctx.String("addr")
method := ctx.String("method")
......
......@@ -30,14 +30,14 @@ func main() {
}
app.Commands = []cli.Command{
//appchainBxhCMD,
//client.LoadClientCMD(),
// appchainBxhCMD,
// client.LoadClientCMD(),
idCMD,
initCMD,
interchainCMD,
p2pCMD,
toolCMD,
//ruleCMD,
// ruleCMD,
startCMD,
versionCMD,
governanceCMD,
......
......@@ -19,13 +19,11 @@ import (
"github.com/urfave/cli"
)
var (
startCMD = cli.Command{
Name: "start",
Usage: "Start a long-running daemon process",
Action: start,
}
)
var startCMD = cli.Command{
Name: "start",
Usage: "Start a long-running daemon process",
Action: start,
}
func start(ctx *cli.Context) error {
fmt.Println(getVersion(true))
......@@ -81,7 +79,7 @@ func start(ctx *cli.Context) error {
}
func handleShutdown(sidecar internal.Launcher, wg *sync.WaitGroup) {
var stop = make(chan os.Signal)
stop := make(chan os.Signal)
signal.Notify(stop, syscall.SIGTERM)
signal.Notify(stop, syscall.SIGINT)
......
......@@ -16,79 +16,79 @@ const (
//go:generate mockgen -destination mock_client/mock_client.go -package mock_client -source client.go
type Client interface {
//Close all connections between link33 and the client.
// Close all connections between link33 and the client.
Stop() error
//Reset ecdsa key.
// Reset ecdsa key.
SetPrivateKey(crypto.PrivateKey)
//Send a readonly transaction to link33. If the transaction is writable,
// Send a readonly transaction to link33. If the transaction is writable,
// this transaction will not be executed and error wil be returned.
SendView(tx *pb.BxhTransaction) (*pb.Receipt, error)
//Send a signed transaction to link33. If the signature is illegal,
//the transaction hash will be obtained but the transaction receipt is illegal.
// Send a signed transaction to link33. If the signature is illegal,
// the transaction hash will be obtained but the transaction receipt is illegal.
SendTransaction(tx *pb.BxhTransaction, opts *TransactOpts) (string, error)
//Send transaction to link33 and get the receipt.
// Send transaction to link33 and get the receipt.
SendTransactionWithReceipt(tx *pb.BxhTransaction, opts *TransactOpts) (*pb.Receipt, error)
//Get the receipt by transaction hash,
//the status of the receipt is a sign of whether the transaction is successful.
// Get the receipt by transaction hash,
// the status of the receipt is a sign of whether the transaction is successful.
GetReceipt(hash string) (*pb.Receipt, error)
//Get transaction from link33 by transaction hash.
// Get transaction from link33 by transaction hash.
GetTransaction(hash string) (*pb.GetTransactionResponse, error)
//Get the current blockchain situation of link33.
// Get the current blockchain situation of link33.
GetChainMeta() (*pb.ChainMeta, error)
//Get blocks of the specified block height range.
// Get blocks of the specified block height range.
GetBlocks(start uint64, end uint64) (*pb.GetBlocksResponse, error)
//Obtain block information from link33.
//The block header contains the basic information of the block,
//and the block body contains all the transactions packaged.
// Obtain block information from link33.
// The block header contains the basic information of the block,
// and the block body contains all the transactions packaged.
GetBlock(value string, blockType pb.GetBlockRequest_Type) (*pb.Block, error)
//Get the status of the blockchain from link33, normal or abnormal.
// Get the status of the blockchain from link33, normal or abnormal.
GetChainStatus() (*pb.Response, error)
//Get the validators from link33.
// Get the validators from link33.
GetValidators() (*pb.Response, error)
//Get the current network situation of link33.
// Get the current network situation of link33.
GetNetworkMeta() (*pb.Response, error)
//Get account balance from link33 by address.
// Get account balance from link33 by address.
GetAccountBalance(address string) (*pb.Response, error)
//Get the missing block header from link33.
// Get the missing block header from link33.
GetBlockHeader(ctx context.Context, begin, end uint64, ch chan<- *pb.BlockHeader) error
//Get the missing block header from link33.
// Get the missing block header from link33.
GetInterchainTxWrappers(ctx context.Context, pid string, begin, end uint64, ch chan<- *pb.InterchainTxWrappers) error
//Subscribe to event notifications from link33.
// Subscribe to event notifications from link33.
Subscribe(context.Context, pb.SubscriptionRequest_Type, []byte) (<-chan interface{}, error)
//Deploy the contract, the contract address will be returned when the deployment is successful.
// Deploy the contract, the contract address will be returned when the deployment is successful.
DeployContract(contract []byte, opts *TransactOpts) (contractAddr *types.Address, err error)
//GenerateContractTx generates signed transaction to invoke contract
// GenerateContractTx generates signed transaction to invoke contract
GenerateContractTx(vmType pb.TransactionData_VMType, address *types.Address, method string, args ...*pb.Arg) (*pb.BxhTransaction, error)
// GenerateIBTPTx generates interchain tx with ibtp specified
GenerateIBTPTx(ibtp *pb.IBTP) (*pb.BxhTransaction, error)
//Call the contract according to the contract type, contract address,
//contract method, and contract method parameters
// Call the contract according to the contract type, contract address,
// contract method, and contract method parameters
InvokeContract(vmType pb.TransactionData_VMType, address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error)
//Invoke the BVM contract, BVM is link33's blot contract.
// Invoke the BVM contract, BVM is link33's blot contract.
InvokeBVMContract(address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error)
//Invoke the XVM contract, XVM is WebAssembly contract.
// Invoke the XVM contract, XVM is WebAssembly contract.
InvokeXVMContract(address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error)
// Get link33's signatures specified by id and type.
......@@ -112,13 +112,13 @@ type Client interface {
// IPFSGetToLocal gets from ipfs and saves to local file path
IPFSGetToLocal(path string, localfPath string) (*pb.Response, error)
//Check whethe there is a master sidecar connect to the link33.
// Check whethe there is a master sidecar connect to the link33.
CheckMasterSidecar(address string) (*pb.Response, error)
//Set the master sidecar connect to the link33.
// Set the master sidecar connect to the link33.
SetMasterSidecar(address string, index string, timeout int64) (*pb.Response, error)
//Update the master sidecar status
// Update the master sidecar status
HeartBeat(address string, index string) (*pb.Response, error)
}
......
......@@ -33,6 +33,7 @@ func Bytes(content []byte) *pb.Arg {
func Bool(b bool) *pb.Arg {
return generateArg(pb.Arg_Bool, []byte(fmt.Sprintf("%v", b)))
}
func generateArg(typ pb.Arg_Type, content []byte) *pb.Arg {
return &pb.Arg{
Type: typ,
......
......@@ -49,9 +49,9 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
nodePrivKey, err := repo.LoadNodePrivateKey(repoRoot)
tool.Asset(err)
var (
//ck checker.Checker
//cryptor txcrypto.Cryptor
//apiServer *apiServer.Server
// ck checker.Checker
// cryptor txcrypto.Cryptor
// apiServer *apiServer.Server
)
r := router.NewRouter(loggers.Logger(loggers.Router))
pm, err := peermgr.New(config, r, nodePrivKey, privateKey, 1, loggers.Logger(loggers.PeerMgr))
......
......@@ -258,7 +258,7 @@ func (a *appChain) ListenIBTP() <-chan *pb.IBTP {
// QueryIBTP queries interchain tx recorded in appchain given ibtp id
func (a *appChain) QueryIBTP(to string, id string) (*pb.IBTP, error) {
//func (a *appChain) QueryIBTP(id string) (*pb.IBTP, error) {
// func (a *appChain) QueryIBTP(id string) (*pb.IBTP, error) {
// TODO(xcc): Encapsulate as a function
args := strings.Split(id, "-")
if len(args) != 3 {
......
......@@ -7,7 +7,7 @@ type Monitor interface {
// listen on interchain ibtp from appchain
ListenIBTP() <-chan *pb.IBTP
// query historical ibtp by its id
//QueryIBTP(id string) (*pb.IBTP, error)
// QueryIBTP(id string) (*pb.IBTP, error)
QueryIBTP(to string, id string) (*pb.IBTP, error)
// QueryLatestMeta queries latest index map of ibtps threw on appchain
QueryOuterMeta() map[string]uint64
......
......@@ -14,7 +14,7 @@ func (a *appChain) Type() string {
return a.client.Type()
}
//TODO appchain
// TODO appchain
func (a *appChain) Tag() string {
return a.client.Type()
}
......@@ -25,9 +25,9 @@ func (a *appChain) Name() string {
// Send 接收的数据只能是IBTPX相关的结构,以及查询完成,需要同步返回的数据
func (a *appChain) Send(msg *pb.Message) (*pb.Message, error) {
//TODO 调用该执行。
//a.ExecuteIBTP()
//a.Rollback()
// TODO 调用该执行。
// a.ExecuteIBTP()
// a.Rollback()
t := msg.Type
switch {
case t == pb.Message_IBTP_SEND:
......@@ -41,7 +41,7 @@ func (a *appChain) Send(msg *pb.Message) (*pb.Message, error) {
if err != nil {
return nil, err
}
if ibtp == nil { //TODO
if ibtp == nil { // TODO
return nil, errors.New("ibtp wrong")
}
if ibtp.Type == pb.IBTP_RECEIPT_FAILURE || pb.IBTP_RECEIPT_SUCCESS == ibtp.Type {
......@@ -70,9 +70,9 @@ func (a *appChain) Send(msg *pb.Message) (*pb.Message, error) {
}
func (a *appChain) AsyncSend(msg *pb.Message) error {
//TODO 调用该执行。
//a.ExecuteIBTP()
//a.Rollback()
// TODO 调用该执行。
// a.ExecuteIBTP()
// a.Rollback()
panic("implement me")
}
......@@ -84,7 +84,7 @@ func (a *appChain) ListenIBTPX() <-chan *pb.Message {
for {
select {
case ibtp := <-ibtpCh:
//TODO ibtp to ibtpx
// TODO ibtp to ibtpx
data, _ := ibtp.Marshal()
msg := pb.Msg(pb.Message_IBTP_SEND, true, data)
a.msgCh <- msg
......
......@@ -2,8 +2,7 @@ package checker
import "github.com/link33/sidecar/model/pb"
type MockChecker struct {
}
type MockChecker struct{}
func (ck *MockChecker) Check(ibtp *pb.IBTP) error {
return nil
......
......@@ -79,8 +79,7 @@ func getIBTP(t *testing.T, index uint64, typ pb.IBTP_Type, fid, tid, proofPath s
}
// MockAppchainMgr================================================
type MockAppchainMgr struct {
}
type MockAppchainMgr struct{}
func (m MockAppchainMgr) ChangeStatus(id, trigger string, extra []byte) (bool, []byte) {
return true, nil
......
......@@ -31,10 +31,10 @@ func TestLogger(t *testing.T) {
},
}
InitializeLogger(config)
api := Logger(ApiServer) //TODO
api := Logger(ApiServer) // TODO
require.NotNil(t, api)
//api.Info("-------")
//mangerLoggerLevel := w.loggers[Manger].Logger.Level.String()
//t.Log(mangerLoggerLevel)
//require.Equal(t, config.Log.Module.Manger, mangerLoggerLevel)
// api.Info("-------")
// mangerLoggerLevel := w.loggers[Manger].Logger.Level.String()
// t.Log(mangerLoggerLevel)
// require.Equal(t, config.Log.Module.Manger, mangerLoggerLevel)
}
......@@ -14,7 +14,7 @@ type Manager struct {
logger logrus.FieldLogger
appchainMgr appchainmgr.AppchainMgr
pm peermgr.PeerManager
//router router.Router
// router router.Router
}
func (mgr *Manager) Start() error {
......
......@@ -35,7 +35,7 @@ func loadPeers(peers []string, privateKey crypto2.PrivKey) (string, map[string]*
}
for _, p := range peers {
//p: 127.0.0.1:4567/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64
// p: 127.0.0.1:4567/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64
if strings.HasSuffix(p, id.String()) {
idx := strings.LastIndex(p, "/p2p/")
if idx == -1 {
......
......@@ -12,9 +12,7 @@ import (
)
func TestLoadPeers(t *testing.T) {
var (
port = 4567
)
port := 4567
var peers []string
var nodeKeys []crypto.PrivateKey
var ids []string
......
......@@ -59,7 +59,7 @@ func (l *local) Send(msg *pb.Message) (*pb.Message, error) {
return nil, nil
}
//需要异步处理的数据
// 需要异步处理的数据
func (l *local) AsyncSend(msg *pb.Message) error {
// 先获取消息类型,做出判断是否路由,判断是异步还是同步。
// 然后做出IBTPX消息,对from、to做路由判断,以及同步异步完成。
......@@ -71,7 +71,7 @@ func (l *local) AsyncSend(msg *pb.Message) error {
if err != nil {
return err
}
//TODO
// TODO
if ibtpx.Ibtp.GetTo() == l.ID() {
return errors.New("message type error")
}
......@@ -82,7 +82,6 @@ func (l *local) AsyncSend(msg *pb.Message) error {
// 注册信息
// 分发节点信息
// 接收与sidecar节点相关的信息流
}
return nil
}
......@@ -105,6 +104,6 @@ func (l *local) HandleGetPeerInfoMessage(p port.Port, message *pb.Message) {
}
}
//涉及到同步异步的问题。
//一、根据目的地址转发(异步完成);(这种情况其实就是返回一个ack给绑定对应的port dev,还是根据消息类型判断)。
//二、根据消息类型转发(同步情况:需要立马返回结果;异步情况:需要返回一个ack,给绑定对应的port dev,所以找到对应的port dev 很关键!)。
// 涉及到同步异步的问题。
// 一、根据目的地址转发(异步完成);(这种情况其实就是返回一个ack给绑定对应的port dev,还是根据消息类型判断)。
// 二、根据消息类型转发(同步情况:需要立马返回结果;异步情况:需要返回一个ack,给绑定对应的port dev,所以找到对应的port dev 很关键!)。
......@@ -7,8 +7,10 @@ import (
"github.com/link33/sidecar/model/pb"
)
type MessageHandler func(port.Port, *pb.Message)
type ConnectHandler func(string)
type (
MessageHandler func(port.Port, *pb.Message)
ConnectHandler func(string)
)
//go:generate mockgen -destination mock_peermgr/mock_peermgr.go -package mock_peermgr -source peermgr.go
type PeerManager interface {
......
......@@ -228,6 +228,7 @@ func prepare(t *testing.T) (*Swarm, []string, *Swarm, *pb.Message, string, strin
return swarm, ids, mockSwarm, mockMsg, mockMultiAddr, mockId
}
func genKeysAndConfig(t *testing.T, peerCnt int, mode string) ([]crypto.PrivateKey, []crypto.PrivateKey, *repo.Config, []string) {
var nodeKeys []crypto.PrivateKey
var privKeys []crypto.PrivateKey
......@@ -267,8 +268,7 @@ func genKeysAndConfig(t *testing.T, peerCnt int, mode string) ([]crypto.PrivateK
}
//=======================================================================
type MockStream struct {
}
type MockStream struct{}
func (ms *MockStream) RemotePeerID() string {
return ""
......@@ -317,8 +317,7 @@ func (ms *MockStream) Read(time.Duration) ([]byte, error) {
}
//=======================================================================
type MockStreamHandler struct {
}
type MockStreamHandler struct{}
// get peer new stream true:reusable stream false:non reusable stream
func (msh *MockStreamHandler) GetStream(string, bool) (network.Stream, error) {
......@@ -327,12 +326,10 @@ func (msh *MockStreamHandler) GetStream(string, bool) (network.Stream, error) {
// release stream
func (msh *MockStreamHandler) ReleaseStream(network.Stream) {
}
//=======================================================================
type MockPeerHandler struct {
}
type MockPeerHandler struct{}
// get local peer id
func (mph *MockPeerHandler) PeerID() string {
......@@ -380,8 +377,7 @@ func (mph *MockPeerHandler) GetRemotePubKey(id peer2.ID) (libp2pcry.PubKey, erro
}
//=======================================================================
type MockDHTHandler struct {
}
type MockDHTHandler struct{}
// searches for a peer with peer id
func (mdhth *MockDHTHandler) FindPeer(string) (peer2.AddrInfo, error) {
......@@ -455,12 +451,10 @@ func (mn *MockNetwork) Disconnect(string) error {
// SetConnectionCallback sets the callback after connecting
func (mn *MockNetwork) SetConnectCallback(network.ConnectCallback) {
}
// SetMessageHandler sets message handler
func (mn *MockNetwork) SetMessageHandler(network.MessageHandler) {
}
// AsyncSend sends message to peer with peer id.
......
......@@ -61,7 +61,7 @@ func New(config *repo.Config, router router.Router, nodePrivKey crypto.PrivateKe
return nil, fmt.Errorf("load peers: %w", err)
}
var protocolIDs = []string{protocolID}
protocolIDs := []string{protocolID}
p2p, err := network.New(
network.WithLocalAddr(ll),
network.WithPrivateKey(libp2pPrivKey),
......@@ -125,7 +125,7 @@ func (swarm *Swarm) Start() error {
return fmt.Errorf("p2p module start: %w", err)
}
//need to connect one other sidecar at least
// need to connect one other sidecar at least
wg := &sync.WaitGroup{}
wg.Add(1)
......@@ -224,7 +224,7 @@ func (swarm *Swarm) HandleIBTPX(pt port.Port, m *pb.Message) {
if is {
ps, iss := p.(*sidecar)
if iss {
//ps.rev <- m
// ps.rev <- m
ps.Receive(m)
}
} else {
......@@ -360,8 +360,10 @@ func (swarm *Swarm) FindProviders(id string) (string, error) {
sidecarId, err := swarm.Connect(&provider)
if err != nil {
swarm.logger.WithFields(logrus.Fields{"peerId": sidecarId,
"cid": provider.ID.String()}).Error("connect error: ", err)
swarm.logger.WithFields(logrus.Fields{
"peerId": sidecarId,
"cid": provider.ID.String(),
}).Error("connect error: ", err)
continue
}
return sidecarId, nil
......
......@@ -4,8 +4,8 @@ package port
type Type int
const (
Hub = "hub" //Hub: 同步数据,同步元数据等。
Sidecar = "sidecar" //SideCar节点
Appchain = "appchain" //区块链客户端
Hub = "hub" // Hub: 同步数据,同步元数据等。
Sidecar = "sidecar" // SideCar节点
Appchain = "appchain" // 区块链客户端
Local = "local"
)
......@@ -5,9 +5,9 @@ import (
"sync"
)
//获取唯一hub
//根据类型获取port
//根据ID获取
// 获取唯一hub
// 根据类型获取port
// 根据ID获取
type PortMap struct {
rw sync.RWMutex
peerPort map[string]Port
......
......@@ -10,9 +10,9 @@ import (
)
const (
DirectMode = "direct" //直连模式
DirectMode = "direct" // 直连模式
RelayMode = "relay" //
UnionMode = "union" //联盟模式,中继架构。代表的是部署架构,不够灵活。不能随时变动。
UnionMode = "union" // 联盟模式,中继架构。代表的是部署架构,不够灵活。不能随时变动。
)
// Config represents the necessary config data for starting sidecar
......
......@@ -57,7 +57,7 @@ var RootPath string
// account file and so on.
func Initialize(repoRoot string) error {
if _, err := os.Stat(repoRoot); os.IsNotExist(err) {
err := os.MkdirAll(repoRoot, 0755)
err := os.MkdirAll(repoRoot, 0o755)
if err != nil {
return err
}
......@@ -83,12 +83,12 @@ func Initialize(repoRoot string) error {
p := filepath.Join(repoRoot, s)
dir := filepath.Dir(p)
if _, err := os.Stat(dir); os.IsNotExist(err) {
err := os.MkdirAll(dir, 0755)
err := os.MkdirAll(dir, 0o755)
if err != nil {
return err
}
}
return ioutil.WriteFile(p, []byte(file.String()), 0644)
return ioutil.WriteFile(p, []byte(file.String()), 0o644)
}); err != nil {
return err
}
......
......@@ -18,26 +18,26 @@ type Router interface {
Load(key string) (value port.Port, ok bool)
//InPut(ibtp *pb.IBTP) chan *pb.IBTP
//OutPut(ibtp *pb.IBTP) chan *pb.IBTP
//代替上面两个方法
//Router(ibtp *pb.IBTP) chan *pb.IBTP
// InPut(ibtp *pb.IBTP) chan *pb.IBTP
// OutPut(ibtp *pb.IBTP) chan *pb.IBTP
// 代替上面两个方法
// Router(ibtp *pb.IBTP) chan *pb.IBTP
}
//路由规则,根据路由表,rules接口, 这个放到交易内部。可以让用户决定。并且签名。
// 路由规则,根据路由表,rules接口, 这个放到交易内部。可以让用户决定。并且签名。
// 1、广播
// 2、单一路由,指定路由标识。
// 3、p2p模式的路由,
// 4、中继路由
// 5、定制化:
//验证规则
//1、收集多个节点
//2、收集指定节点
//3、收集共识节点
// 验证规则
// 1、收集多个节点
// 2、收集指定节点
// 3、收集共识节点
// 即满足多个条件
//路由规则优先级:
//1、用户交易内部的路由规则最高。
//2、用户在程序设定。
//3、系统默认。
// 路由规则优先级:
// 1、用户交易内部的路由规则最高。
// 2、用户在程序设定。
// 3、系统默认。
......@@ -47,7 +47,7 @@ func (r *router) Stop() error {
return nil
}
//TODO
// TODO
func (r *router) Add(p port.Port) error {
r.portMap.Add(p)
go func() {
......@@ -88,12 +88,13 @@ func (r *router) Adds(p []port.Port) error {
func (r *router) Load(key string) (value port.Port, ok bool) {
return r.portMap.Load(key)
}
func (r *router) Remove(p port.Port) error {
r.portMap.Remove(p)
return nil
}
//路由的有那些数据?需要区分!!!
// 路由的有那些数据?需要区分!!!
func (r *router) Route(msg *pb.Message) error {
if msg == nil {
r.logger.Error("msg = nil")
......@@ -106,7 +107,7 @@ func (r *router) Route(msg *pb.Message) error {
if !r.isRouter(ibtpx) {
return nil
}
//本网关签名
// 本网关签名
if !r.isSign(ibtpx) {
r.sign(ibtpx)
}
......@@ -157,10 +158,10 @@ func (r *router) Route(msg *pb.Message) error {
}
switch {
case pp.Type() == port.Sidecar:
return pp.AsyncSend(msg) //转发给其它的sidecar节点或者本身local节点。
case pp.Type() == port.Hub: //发给hub appchain TODO 本机找到的appchain只能是自己的appchain
return pp.AsyncSend(msg) // 转发给其它的sidecar节点或者本身local节点。
case pp.Type() == port.Hub: // 发给hub appchain TODO 本机找到的appchain只能是自己的appchain
return pp.AsyncSend(msg)
case pp.Type() == port.Appchain: //TODO 本机找到的appchain只能是自己的appchain
case pp.Type() == port.Appchain: // TODO 本机找到的appchain只能是自己的appchain
switch msg.Type {
case pb.Message_IBTP_SEND:
ret, err := send()
......@@ -168,9 +169,9 @@ func (r *router) Route(msg *pb.Message) error {
r.logger.Error(err)
return err
}
return r.Route(ret) //返回值,重新路由; send返回值需要调换from , to;
//d,_ := ret.Marshal()
//msg = pb.Msg(pb.Message_IBTP_RECEIPT_SEND,true,d)
return r.Route(ret) // 返回值,重新路由; send返回值需要调换from , to;
// d,_ := ret.Marshal()
// msg = pb.Msg(pb.Message_IBTP_RECEIPT_SEND,true,d)
case pb.Message_IBTP_RECEIPT_SEND:
err = asyncSend()
if err != nil {
......@@ -188,7 +189,7 @@ func (r *router) Route(msg *pb.Message) error {
return nil
}
}
//规则判断 转发给其它的sidecar节点
// 规则判断 转发给其它的sidecar节点
method := strings.ToLower(ibtpx.RouteMethod)
if md, is := r.methodMap[method]; is {
ports := md(ibtpx.RouteMethodArg)
......@@ -206,14 +207,14 @@ func (r *router) Route(msg *pb.Message) error {
func (r *router) isRouter(ibtpx *pb.IBTPX) bool {
mode := ibtpx.Mode
//本网关已签名、中继链已背书、to是本网关内部的appchain,即顺利通过并转发,否则打断。
// 本网关已签名、中继链已背书、to是本网关内部的appchain,即顺利通过并转发,否则打断。
if !((r.isSign(ibtpx) && mode == repo.RelayMode && r.isEndorse(ibtpx)) || !r.isSign(ibtpx)) {
return false
}
return true
}
//TODO
// TODO
func (r *router) firstRoute(msg *pb.Message) {
p := r.portMap.RandRouterPort()
_ = p.AsyncSend(msg)
......
......@@ -31,31 +31,31 @@ type Syncer interface {
// if error occurs, user need to reconstruct this ibtp cause it means ibtp is invalid on bitxhub
SendIBTP(ibtp *pb.IBTP) error
//GetAppchains gets appchains from bitxhub node
//GetAppchains() ([]*appchainmgr.Appchain, error)
// GetAppchains gets appchains from bitxhub node
// GetAppchains() ([]*appchainmgr.Appchain, error)
////GetInterchainById gets interchain meta by appchain id
//GetInterchainById(from string) *pb.Interchain
// RegisterRecoverHandler registers handler that recover ibtps from bitxhub
//RegisterRecoverHandler(RecoverUnionHandler) error
// RegisterRecoverHandler(RecoverUnionHandler) error
// RegisterAppchainHandler registers handler that fetch appchains information
//RegisterAppchainHandler(handler AppchainHandler) error
// RegisterAppchainHandler(handler AppchainHandler) error
RegisterRollbackHandler(handler RollbackHandler) error
}
type Handler interface {
//GetAppchains gets appchains from bitxhub node
// GetAppchains gets appchains from bitxhub node
GetAppchains() ([]*appchainmgr.Appchain, error)
//GetInterchainById gets interchain meta by appchain id
// GetInterchainById gets interchain meta by appchain id
GetInterchainById(from string) *pb.Interchain
//RegisterRecoverHandler registers handler that recover ibtps from bitxhub
// RegisterRecoverHandler registers handler that recover ibtps from bitxhub
RegisterRecoverHandler(RecoverUnionHandler) error
//RegisterAppchainHandler registers handler that fetch appchains information
// RegisterAppchainHandler registers handler that fetch appchains information
RegisterAppchainHandler(handler AppchainHandler) error
}
......@@ -156,16 +156,15 @@ func (syncer *WrapperSyncer) syncInterchainTxWrappers() {
return
}
}
}
//持续监听事件,
// 持续监听事件,
for {
select {
case <-syncer.ctx.Done():
return
default:
//开启监听
// 开启监听
ch := syncer.getWrappersChannel()
err := retry.Retry(func(attempt uint) error {
......@@ -181,7 +180,6 @@ func (syncer *WrapperSyncer) syncInterchainTxWrappers() {
return nil
}, strategy.Wait(1*time.Second))
if err != nil {
syncer.logger.Panic(err)
}
......@@ -220,7 +218,7 @@ func (syncer *WrapperSyncer) getWrappersChannel() chan *pb.InterchainTxWrappers
select {
case <-syncer.ctx.Done():
return
case h, ok := <-rawCh: //监听订阅消息
case h, ok := <-rawCh: // 监听订阅消息
if !ok {
close(ch)
return
......
......@@ -162,7 +162,7 @@ func TestSyncHeader002(t *testing.T) {
h3 := getBlockHeader(root, 3)
// mock invalid tx wrapper
w4, _ := getTxWrapper(t, txs, txs1, 4)
//w4.InterchainTxWrappers[0].Transactions = w4.InterchainTxWrappers[0].TransactionHashes[1:]
// w4.InterchainTxWrappers[0].Transactions = w4.InterchainTxWrappers[0].TransactionHashes[1:]
syncWrapperCh := make(chan interface{}, 4)
meta := &pb.ChainMeta{
......@@ -614,13 +614,13 @@ func getTxWrapper(t *testing.T, interchainTxs []*pb.BxhTransaction, innerchainTx
}
}
var l2roots []types.Hash
//var interchainTxHashes []types.Hash
// var interchainTxHashes []types.Hash
hashes := make([]merkletree.Content, 0, len(interchainTxs))
for i := 0; i < len(verifiedTxs); i++ {
//interchainHash, err := verifiedTxs[i].CalculateHash()
//require.Nil(t, err)
// interchainHash, err := verifiedTxs[i].CalculateHash()
// require.Nil(t, err)
hashes = append(hashes, verifiedTxs[i])
//interchainTxHashes = append(interchainTxHashes, *interchainHash)
// interchainTxHashes = append(interchainTxHashes, *interchainHash)
}
tree, err := merkletree.NewTree(hashes)
......
......@@ -13,9 +13,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -81,9 +83,11 @@ func (*Arg) ProtoMessage() {}
func (*Arg) Descriptor() ([]byte, []int) {
return fileDescriptor_4371b204df3ab2da, []int{0}
}
func (m *Arg) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Arg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Arg.Marshal(b, m, deterministic)
......@@ -96,12 +100,15 @@ func (m *Arg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Arg) XXX_Merge(src proto.Message) {
xxx_messageInfo_Arg.Merge(m, src)
}
func (m *Arg) XXX_Size() int {
return m.Size()
}
func (m *Arg) XXX_DiscardUnknown() {
xxx_messageInfo_Arg.DiscardUnknown(m)
}
......@@ -211,6 +218,7 @@ func encodeVarintArg(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *Arg) Size() (n int) {
if m == nil {
return 0
......@@ -233,9 +241,11 @@ func (m *Arg) Size() (n int) {
func sovArg(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozArg(x uint64) (n int) {
return sovArg(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Arg) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -362,6 +372,7 @@ func (m *Arg) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipArg(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -13,9 +13,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -33,9 +35,11 @@ func (*Uint64Slice) ProtoMessage() {}
func (*Uint64Slice) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{0}
}
func (m *Uint64Slice) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Uint64Slice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Uint64Slice.Marshal(b, m, deterministic)
......@@ -48,12 +52,15 @@ func (m *Uint64Slice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil
}
}
func (m *Uint64Slice) XXX_Merge(src proto.Message) {
xxx_messageInfo_Uint64Slice.Merge(m, src)
}
func (m *Uint64Slice) XXX_Size() int {
return m.Size()
}
func (m *Uint64Slice) XXX_DiscardUnknown() {
xxx_messageInfo_Uint64Slice.DiscardUnknown(m)
}
......@@ -78,9 +85,11 @@ func (*StringUint64Map) ProtoMessage() {}
func (*StringUint64Map) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{1}
}
func (m *StringUint64Map) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *StringUint64Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_StringUint64Map.Marshal(b, m, deterministic)
......@@ -93,12 +102,15 @@ func (m *StringUint64Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return b[:n], nil
}
}
func (m *StringUint64Map) XXX_Merge(src proto.Message) {
xxx_messageInfo_StringUint64Map.Merge(m, src)
}
func (m *StringUint64Map) XXX_Size() int {
return m.Size()
}
func (m *StringUint64Map) XXX_DiscardUnknown() {
xxx_messageInfo_StringUint64Map.DiscardUnknown(m)
}
......@@ -130,9 +142,11 @@ func (*StringUint64SliceMap) ProtoMessage() {}
func (*StringUint64SliceMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{2}
}
func (m *StringUint64SliceMap) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *StringUint64SliceMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_StringUint64SliceMap.Marshal(b, m, deterministic)
......@@ -145,12 +159,15 @@ func (m *StringUint64SliceMap) XXX_Marshal(b []byte, deterministic bool) ([]byte
return b[:n], nil
}
}
func (m *StringUint64SliceMap) XXX_Merge(src proto.Message) {
xxx_messageInfo_StringUint64SliceMap.Merge(m, src)
}
func (m *StringUint64SliceMap) XXX_Size() int {
return m.Size()
}
func (m *StringUint64SliceMap) XXX_DiscardUnknown() {
xxx_messageInfo_StringUint64SliceMap.DiscardUnknown(m)
}
......@@ -182,9 +199,11 @@ func (*VerifiedIndex) ProtoMessage() {}
func (*VerifiedIndex) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{3}
}
func (m *VerifiedIndex) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *VerifiedIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_VerifiedIndex.Marshal(b, m, deterministic)
......@@ -197,12 +216,15 @@ func (m *VerifiedIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return b[:n], nil
}
}
func (m *VerifiedIndex) XXX_Merge(src proto.Message) {
xxx_messageInfo_VerifiedIndex.Merge(m, src)
}
func (m *VerifiedIndex) XXX_Size() int {
return m.Size()
}
func (m *VerifiedIndex) XXX_DiscardUnknown() {
xxx_messageInfo_VerifiedIndex.DiscardUnknown(m)
}
......@@ -233,9 +255,11 @@ func (*VerifiedIndexSlice) ProtoMessage() {}
func (*VerifiedIndexSlice) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{4}
}
func (m *VerifiedIndexSlice) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *VerifiedIndexSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_VerifiedIndexSlice.Marshal(b, m, deterministic)
......@@ -248,12 +272,15 @@ func (m *VerifiedIndexSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return b[:n], nil
}
}
func (m *VerifiedIndexSlice) XXX_Merge(src proto.Message) {
xxx_messageInfo_VerifiedIndexSlice.Merge(m, src)
}
func (m *VerifiedIndexSlice) XXX_Size() int {
return m.Size()
}
func (m *VerifiedIndexSlice) XXX_DiscardUnknown() {
xxx_messageInfo_VerifiedIndexSlice.DiscardUnknown(m)
}
......@@ -278,9 +305,11 @@ func (*StringVerifiedIndexMap) ProtoMessage() {}
func (*StringVerifiedIndexMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{5}
}
func (m *StringVerifiedIndexMap) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *StringVerifiedIndexMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_StringVerifiedIndexMap.Marshal(b, m, deterministic)
......@@ -293,12 +322,15 @@ func (m *StringVerifiedIndexMap) XXX_Marshal(b []byte, deterministic bool) ([]by
return b[:n], nil
}
}
func (m *StringVerifiedIndexMap) XXX_Merge(src proto.Message) {
xxx_messageInfo_StringVerifiedIndexMap.Merge(m, src)
}
func (m *StringVerifiedIndexMap) XXX_Size() int {
return m.Size()
}
func (m *StringVerifiedIndexMap) XXX_DiscardUnknown() {
xxx_messageInfo_StringVerifiedIndexMap.DiscardUnknown(m)
}
......@@ -330,9 +362,11 @@ func (*StringVerifiedIndexSliceMap) ProtoMessage() {}
func (*StringVerifiedIndexSliceMap) Descriptor() ([]byte, []int) {
return fileDescriptor_0cc45f6ac745dd88, []int{6}
}
func (m *StringVerifiedIndexSliceMap) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *StringVerifiedIndexSliceMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_StringVerifiedIndexSliceMap.Marshal(b, m, deterministic)
......@@ -345,12 +379,15 @@ func (m *StringVerifiedIndexSliceMap) XXX_Marshal(b []byte, deterministic bool)
return b[:n], nil
}
}
func (m *StringVerifiedIndexSliceMap) XXX_Merge(src proto.Message) {
xxx_messageInfo_StringVerifiedIndexSliceMap.Merge(m, src)
}
func (m *StringVerifiedIndexSliceMap) XXX_Size() int {
return m.Size()
}
func (m *StringVerifiedIndexSliceMap) XXX_DiscardUnknown() {
xxx_messageInfo_StringVerifiedIndexSliceMap.DiscardUnknown(m)
}
......@@ -719,6 +756,7 @@ func encodeVarintBasic(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *Uint64Slice) Size() (n int) {
if m == nil {
return 0
......@@ -853,9 +891,11 @@ func (m *StringVerifiedIndexSliceMap) Size() (n int) {
func sovBasic(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozBasic(x uint64) (n int) {
return sovBasic(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Uint64Slice) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -982,6 +1022,7 @@ func (m *Uint64Slice) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *StringUint64Map) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1140,6 +1181,7 @@ func (m *StringUint64Map) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *StringUint64SliceMap) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1256,6 +1298,7 @@ func (m *StringUint64SliceMap) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *VerifiedIndex) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1345,6 +1388,7 @@ func (m *VerifiedIndex) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *VerifiedIndexSlice) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1429,6 +1473,7 @@ func (m *VerifiedIndexSlice) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *StringVerifiedIndexMap) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1545,6 +1590,7 @@ func (m *StringVerifiedIndexMap) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *StringVerifiedIndexSliceMap) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1661,6 +1707,7 @@ func (m *StringVerifiedIndexSliceMap) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipBasic(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -15,9 +15,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -39,9 +41,11 @@ func (*Block) ProtoMessage() {}
func (*Block) Descriptor() ([]byte, []int) {
return fileDescriptor_8e550b1f5926e92d, []int{0}
}
func (m *Block) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Block.Marshal(b, m, deterministic)
......@@ -54,12 +58,15 @@ func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Block) XXX_Merge(src proto.Message) {
xxx_messageInfo_Block.Merge(m, src)
}
func (m *Block) XXX_Size() int {
return m.Size()
}
func (m *Block) XXX_DiscardUnknown() {
xxx_messageInfo_Block.DiscardUnknown(m)
}
......@@ -104,9 +111,11 @@ func (*BlockHeader) ProtoMessage() {}
func (*BlockHeader) Descriptor() ([]byte, []int) {
return fileDescriptor_8e550b1f5926e92d, []int{1}
}
func (m *BlockHeader) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *BlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_BlockHeader.Marshal(b, m, deterministic)
......@@ -119,12 +128,15 @@ func (m *BlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil
}
}
func (m *BlockHeader) XXX_Merge(src proto.Message) {
xxx_messageInfo_BlockHeader.Merge(m, src)
}
func (m *BlockHeader) XXX_Size() int {
return m.Size()
}
func (m *BlockHeader) XXX_DiscardUnknown() {
xxx_messageInfo_BlockHeader.DiscardUnknown(m)
}
......@@ -374,6 +386,7 @@ func encodeVarintBlock(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *Block) Size() (n int) {
if m == nil {
return 0
......@@ -445,9 +458,11 @@ func (m *BlockHeader) Size() (n int) {
func sovBlock(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozBlock(x uint64) (n int) {
return sovBlock(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Block) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -675,6 +690,7 @@ func (m *Block) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *BlockHeader) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -975,6 +991,7 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipBlock(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
This diff is collapsed.
This diff is collapsed.
......@@ -15,9 +15,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -160,9 +162,11 @@ func (*BxhTransaction) ProtoMessage() {}
func (*BxhTransaction) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{0}
}
func (m *BxhTransaction) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *BxhTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_BxhTransaction.Marshal(b, m, deterministic)
......@@ -175,12 +179,15 @@ func (m *BxhTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return b[:n], nil
}
}
func (m *BxhTransaction) XXX_Merge(src proto.Message) {
xxx_messageInfo_BxhTransaction.Merge(m, src)
}
func (m *BxhTransaction) XXX_Size() int {
return m.Size()
}
func (m *BxhTransaction) XXX_DiscardUnknown() {
xxx_messageInfo_BxhTransaction.DiscardUnknown(m)
}
......@@ -257,9 +264,11 @@ func (*TransactionData) ProtoMessage() {}
func (*TransactionData) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{1}
}
func (m *TransactionData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TransactionData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TransactionData.Marshal(b, m, deterministic)
......@@ -272,12 +281,15 @@ func (m *TransactionData) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return b[:n], nil
}
}
func (m *TransactionData) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransactionData.Merge(m, src)
}
func (m *TransactionData) XXX_Size() int {
return m.Size()
}
func (m *TransactionData) XXX_DiscardUnknown() {
xxx_messageInfo_TransactionData.DiscardUnknown(m)
}
......@@ -330,9 +342,11 @@ func (*InvokePayload) ProtoMessage() {}
func (*InvokePayload) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{2}
}
func (m *InvokePayload) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *InvokePayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_InvokePayload.Marshal(b, m, deterministic)
......@@ -345,12 +359,15 @@ func (m *InvokePayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return b[:n], nil
}
}
func (m *InvokePayload) XXX_Merge(src proto.Message) {
xxx_messageInfo_InvokePayload.Merge(m, src)
}
func (m *InvokePayload) XXX_Size() int {
return m.Size()
}
func (m *InvokePayload) XXX_DiscardUnknown() {
xxx_messageInfo_InvokePayload.DiscardUnknown(m)
}
......@@ -383,9 +400,11 @@ func (*TransactionMeta) ProtoMessage() {}
func (*TransactionMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{3}
}
func (m *TransactionMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TransactionMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TransactionMeta.Marshal(b, m, deterministic)
......@@ -398,12 +417,15 @@ func (m *TransactionMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return b[:n], nil
}
}
func (m *TransactionMeta) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransactionMeta.Merge(m, src)
}
func (m *TransactionMeta) XXX_Size() int {
return m.Size()
}
func (m *TransactionMeta) XXX_DiscardUnknown() {
xxx_messageInfo_TransactionMeta.DiscardUnknown(m)
}
......@@ -443,9 +465,11 @@ func (*CrosschainTransactionExtra) ProtoMessage() {}
func (*CrosschainTransactionExtra) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{4}
}
func (m *CrosschainTransactionExtra) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *CrosschainTransactionExtra) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_CrosschainTransactionExtra.Marshal(b, m, deterministic)
......@@ -458,12 +482,15 @@ func (m *CrosschainTransactionExtra) XXX_Marshal(b []byte, deterministic bool) (
return b[:n], nil
}
}
func (m *CrosschainTransactionExtra) XXX_Merge(src proto.Message) {
xxx_messageInfo_CrosschainTransactionExtra.Merge(m, src)
}
func (m *CrosschainTransactionExtra) XXX_Size() int {
return m.Size()
}
func (m *CrosschainTransactionExtra) XXX_DiscardUnknown() {
xxx_messageInfo_CrosschainTransactionExtra.DiscardUnknown(m)
}
......@@ -502,9 +529,11 @@ func (*TransactionTracingMeta) ProtoMessage() {}
func (*TransactionTracingMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{5}
}
func (m *TransactionTracingMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TransactionTracingMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TransactionTracingMeta.Marshal(b, m, deterministic)
......@@ -517,12 +546,15 @@ func (m *TransactionTracingMeta) XXX_Marshal(b []byte, deterministic bool) ([]by
return b[:n], nil
}
}
func (m *TransactionTracingMeta) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransactionTracingMeta.Merge(m, src)
}
func (m *TransactionTracingMeta) XXX_Size() int {
return m.Size()
}
func (m *TransactionTracingMeta) XXX_DiscardUnknown() {
xxx_messageInfo_TransactionTracingMeta.DiscardUnknown(m)
}
......@@ -554,9 +586,11 @@ func (*TransactionSlice) ProtoMessage() {}
func (*TransactionSlice) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{6}
}
func (m *TransactionSlice) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TransactionSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TransactionSlice.Marshal(b, m, deterministic)
......@@ -569,12 +603,15 @@ func (m *TransactionSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
return b[:n], nil
}
}
func (m *TransactionSlice) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransactionSlice.Merge(m, src)
}
func (m *TransactionSlice) XXX_Size() int {
return m.Size()
}
func (m *TransactionSlice) XXX_DiscardUnknown() {
xxx_messageInfo_TransactionSlice.DiscardUnknown(m)
}
......@@ -611,9 +648,11 @@ func (*AssetExchangeInfo) ProtoMessage() {}
func (*AssetExchangeInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_3eb90b06bee49601, []int{7}
}
func (m *AssetExchangeInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AssetExchangeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AssetExchangeInfo.Marshal(b, m, deterministic)
......@@ -626,12 +665,15 @@ func (m *AssetExchangeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, e
return b[:n], nil
}
}
func (m *AssetExchangeInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_AssetExchangeInfo.Merge(m, src)
}
func (m *AssetExchangeInfo) XXX_Size() int {
return m.Size()
}
func (m *AssetExchangeInfo) XXX_DiscardUnknown() {
xxx_messageInfo_AssetExchangeInfo.DiscardUnknown(m)
}
......@@ -1217,6 +1259,7 @@ func encodeVarintBxhTransaction(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *BxhTransaction) Size() (n int) {
if m == nil {
return 0
......@@ -1423,9 +1466,11 @@ func (m *AssetExchangeInfo) Size() (n int) {
func sovBxhTransaction(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozBxhTransaction(x uint64) (n int) {
return sovBxhTransaction(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *BxhTransaction) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1813,6 +1858,7 @@ func (m *BxhTransaction) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *TransactionData) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1991,6 +2037,7 @@ func (m *TransactionData) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *InvokePayload) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -2110,6 +2157,7 @@ func (m *InvokePayload) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *TransactionMeta) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -2235,6 +2283,7 @@ func (m *TransactionMeta) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *CrosschainTransactionExtra) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -2361,6 +2410,7 @@ func (m *CrosschainTransactionExtra) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *TransactionTracingMeta) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -2482,6 +2532,7 @@ func (m *TransactionTracingMeta) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *TransactionSlice) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -2588,6 +2639,7 @@ func (m *TransactionSlice) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *AssetExchangeInfo) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -2839,6 +2891,7 @@ func (m *AssetExchangeInfo) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipBxhTransaction(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -15,9 +15,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -37,9 +39,11 @@ func (*ChainMeta) ProtoMessage() {}
func (*ChainMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_d4d91b2d037e7a44, []int{0}
}
func (m *ChainMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ChainMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ChainMeta.Marshal(b, m, deterministic)
......@@ -52,12 +56,15 @@ func (m *ChainMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *ChainMeta) XXX_Merge(src proto.Message) {
xxx_messageInfo_ChainMeta.Merge(m, src)
}
func (m *ChainMeta) XXX_Size() int {
return m.Size()
}
func (m *ChainMeta) XXX_DiscardUnknown() {
xxx_messageInfo_ChainMeta.DiscardUnknown(m)
}
......@@ -159,6 +166,7 @@ func encodeVarintChain(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *ChainMeta) Size() (n int) {
if m == nil {
return 0
......@@ -181,9 +189,11 @@ func (m *ChainMeta) Size() (n int) {
func sovChain(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozChain(x uint64) (n int) {
return sovChain(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *ChainMeta) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -310,6 +320,7 @@ func (m *ChainMeta) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipChain(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -13,9 +13,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -34,9 +36,11 @@ func (*CommitEvent) ProtoMessage() {}
func (*CommitEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_db7163399a465f48, []int{0}
}
func (m *CommitEvent) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *CommitEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_CommitEvent.Marshal(b, m, deterministic)
......@@ -49,12 +53,15 @@ func (m *CommitEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil
}
}
func (m *CommitEvent) XXX_Merge(src proto.Message) {
xxx_messageInfo_CommitEvent.Merge(m, src)
}
func (m *CommitEvent) XXX_Size() int {
return m.Size()
}
func (m *CommitEvent) XXX_DiscardUnknown() {
xxx_messageInfo_CommitEvent.DiscardUnknown(m)
}
......@@ -146,6 +153,7 @@ func encodeVarintCommit(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *CommitEvent) Size() (n int) {
if m == nil {
return 0
......@@ -172,9 +180,11 @@ func sovCommit(x uint64) (n int) {
}
return n
}
func sozCommit(x uint64) (n int) {
return sovCommit(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *CommitEvent) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -334,6 +344,7 @@ func (m *CommitEvent) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipCommit(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -13,9 +13,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -121,9 +123,11 @@ func (*IBTP) ProtoMessage() {}
func (*IBTP) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{0}
}
func (m *IBTP) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *IBTP) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_IBTP.Marshal(b, m, deterministic)
......@@ -136,12 +140,15 @@ func (m *IBTP) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *IBTP) XXX_Merge(src proto.Message) {
xxx_messageInfo_IBTP.Merge(m, src)
}
func (m *IBTP) XXX_Size() int {
return m.Size()
}
func (m *IBTP) XXX_DiscardUnknown() {
xxx_messageInfo_IBTP.DiscardUnknown(m)
}
......@@ -229,9 +236,11 @@ func (*Payload) ProtoMessage() {}
func (*Payload) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{1}
}
func (m *Payload) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Payload.Marshal(b, m, deterministic)
......@@ -244,12 +253,15 @@ func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Payload) XXX_Merge(src proto.Message) {
xxx_messageInfo_Payload.Merge(m, src)
}
func (m *Payload) XXX_Size() int {
return m.Size()
}
func (m *Payload) XXX_DiscardUnknown() {
xxx_messageInfo_Payload.DiscardUnknown(m)
}
......@@ -287,9 +299,11 @@ func (*Content) ProtoMessage() {}
func (*Content) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{2}
}
func (m *Content) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Content.Marshal(b, m, deterministic)
......@@ -302,12 +316,15 @@ func (m *Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Content) XXX_Merge(src proto.Message) {
xxx_messageInfo_Content.Merge(m, src)
}
func (m *Content) XXX_Size() int {
return m.Size()
}
func (m *Content) XXX_DiscardUnknown() {
xxx_messageInfo_Content.DiscardUnknown(m)
}
......@@ -380,9 +397,11 @@ func (*IBTPs) ProtoMessage() {}
func (*IBTPs) Descriptor() ([]byte, []int) {
return fileDescriptor_7576a0a5bf0190a3, []int{3}
}
func (m *IBTPs) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *IBTPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_IBTPs.Marshal(b, m, deterministic)
......@@ -395,12 +414,15 @@ func (m *IBTPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *IBTPs) XXX_Merge(src proto.Message) {
xxx_messageInfo_IBTPs.Merge(m, src)
}
func (m *IBTPs) XXX_Size() int {
return m.Size()
}
func (m *IBTPs) XXX_DiscardUnknown() {
xxx_messageInfo_IBTPs.DiscardUnknown(m)
}
......@@ -731,6 +753,7 @@ func encodeVarintIbtp(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *IBTP) Size() (n int) {
if m == nil {
return 0
......@@ -858,9 +881,11 @@ func (m *IBTPs) Size() (n int) {
func sovIbtp(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozIbtp(x uint64) (n int) {
return sovIbtp(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *IBTP) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1202,6 +1227,7 @@ func (m *IBTP) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Payload) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1306,6 +1332,7 @@ func (m *Payload) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Content) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1612,6 +1639,7 @@ func (m *Content) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *IBTPs) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1696,6 +1724,7 @@ func (m *IBTPs) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipIbtp(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -13,9 +13,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -39,9 +41,11 @@ func (*IBTPX) ProtoMessage() {}
func (*IBTPX) Descriptor() ([]byte, []int) {
return fileDescriptor_8402d80e061d514a, []int{0}
}
func (m *IBTPX) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *IBTPX) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_IBTPX.Marshal(b, m, deterministic)
......@@ -54,12 +58,15 @@ func (m *IBTPX) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *IBTPX) XXX_Merge(src proto.Message) {
xxx_messageInfo_IBTPX.Merge(m, src)
}
func (m *IBTPX) XXX_Size() int {
return m.Size()
}
func (m *IBTPX) XXX_DiscardUnknown() {
xxx_messageInfo_IBTPX.DiscardUnknown(m)
}
......@@ -219,6 +226,7 @@ func encodeVarintIbtpx(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *IBTPX) Size() (n int) {
if m == nil {
return 0
......@@ -258,9 +266,11 @@ func (m *IBTPX) Size() (n int) {
func sovIbtpx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozIbtpx(x uint64) (n int) {
return sovIbtpx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *IBTPX) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -495,6 +505,7 @@ func (m *IBTPX) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipIbtpx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -15,9 +15,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -36,9 +38,11 @@ func (*InterchainMetaS) ProtoMessage() {}
func (*InterchainMetaS) Descriptor() ([]byte, []int) {
return fileDescriptor_d2602fcc2fbd6b2a, []int{0}
}
func (m *InterchainMetaS) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *InterchainMetaS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_InterchainMetaS.Marshal(b, m, deterministic)
......@@ -51,12 +55,15 @@ func (m *InterchainMetaS) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return b[:n], nil
}
}
func (m *InterchainMetaS) XXX_Merge(src proto.Message) {
xxx_messageInfo_InterchainMetaS.Merge(m, src)
}
func (m *InterchainMetaS) XXX_Size() int {
return m.Size()
}
func (m *InterchainMetaS) XXX_DiscardUnknown() {
xxx_messageInfo_InterchainMetaS.DiscardUnknown(m)
}
......@@ -83,9 +90,11 @@ func (*InterchainS) ProtoMessage() {}
func (*InterchainS) Descriptor() ([]byte, []int) {
return fileDescriptor_d2602fcc2fbd6b2a, []int{1}
}
func (m *InterchainS) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *InterchainS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_InterchainS.Marshal(b, m, deterministic)
......@@ -98,12 +107,15 @@ func (m *InterchainS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil
}
}
func (m *InterchainS) XXX_Merge(src proto.Message) {
xxx_messageInfo_InterchainS.Merge(m, src)
}
func (m *InterchainS) XXX_Size() int {
return m.Size()
}
func (m *InterchainS) XXX_DiscardUnknown() {
xxx_messageInfo_InterchainS.DiscardUnknown(m)
}
......@@ -296,6 +308,7 @@ func encodeVarintInterchainMeta(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *InterchainMetaS) Size() (n int) {
if m == nil {
return 0
......@@ -343,9 +356,11 @@ func (m *InterchainS) Size() (n int) {
func sovInterchainMeta(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozInterchainMeta(x uint64) (n int) {
return sovInterchainMeta(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *InterchainMetaS) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -470,6 +485,7 @@ func (m *InterchainMetaS) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *InterchainS) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -663,6 +679,7 @@ func (m *InterchainS) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipInterchainMeta(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -13,9 +13,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -33,7 +35,7 @@ const (
Message_APPCHAIN_GET Message_Type = 4
Message_INTERCHAIN_META_GET Message_Type = 5
Message_RULE_DEPLOY Message_Type = 6
//异步完成
// 异步完成
Message_IBTP_GET Message_Type = 7
Message_IBTP_SEND Message_Type = 8
Message_IBTP_RECEIPT_SEND Message_Type = 9
......@@ -91,9 +93,11 @@ func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{0}
}
func (m *Message) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Message.Marshal(b, m, deterministic)
......@@ -106,12 +110,15 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Message) XXX_Merge(src proto.Message) {
xxx_messageInfo_Message.Merge(m, src)
}
func (m *Message) XXX_Size() int {
return m.Size()
}
func (m *Message) XXX_DiscardUnknown() {
xxx_messageInfo_Message.DiscardUnknown(m)
}
......@@ -150,9 +157,11 @@ func (*Pack) ProtoMessage() {}
func (*Pack) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{1}
}
func (m *Pack) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Pack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Pack.Marshal(b, m, deterministic)
......@@ -165,12 +174,15 @@ func (m *Pack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Pack) XXX_Merge(src proto.Message) {
xxx_messageInfo_Pack.Merge(m, src)
}
func (m *Pack) XXX_Size() int {
return m.Size()
}
func (m *Pack) XXX_DiscardUnknown() {
xxx_messageInfo_Pack.DiscardUnknown(m)
}
......@@ -202,9 +214,11 @@ func (*PeerInfo) ProtoMessage() {}
func (*PeerInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{2}
}
func (m *PeerInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_PeerInfo.Marshal(b, m, deterministic)
......@@ -217,12 +231,15 @@ func (m *PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *PeerInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_PeerInfo.Merge(m, src)
}
func (m *PeerInfo) XXX_Size() int {
return m.Size()
}
func (m *PeerInfo) XXX_DiscardUnknown() {
xxx_messageInfo_PeerInfo.DiscardUnknown(m)
}
......@@ -415,6 +432,7 @@ func encodeVarintMessage(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *Message) Size() (n int) {
if m == nil {
return 0
......@@ -471,9 +489,11 @@ func (m *PeerInfo) Size() (n int) {
func sovMessage(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozMessage(x uint64) (n int) {
return sovMessage(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Message) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -611,6 +631,7 @@ func (m *Message) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Pack) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -715,6 +736,7 @@ func (m *Pack) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *PeerInfo) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -829,6 +851,7 @@ func (m *PeerInfo) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipMessage(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
This diff is collapsed.
......@@ -42,7 +42,7 @@ type Log struct {
Removed bool `json:"removed"`
}
//MarshalJSON marshals as JSON.
// MarshalJSON marshals as JSON.
func (l EvmLog) MarshalJSON() ([]byte, error) {
var enc Log
......
......@@ -15,9 +15,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -68,9 +70,11 @@ func (*Receipt) ProtoMessage() {}
func (*Receipt) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{0}
}
func (m *Receipt) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Receipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Receipt.Marshal(b, m, deterministic)
......@@ -83,12 +87,15 @@ func (m *Receipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Receipt) XXX_Merge(src proto.Message) {
xxx_messageInfo_Receipt.Merge(m, src)
}
func (m *Receipt) XXX_Size() int {
return m.Size()
}
func (m *Receipt) XXX_DiscardUnknown() {
xxx_messageInfo_Receipt.DiscardUnknown(m)
}
......@@ -147,9 +154,11 @@ func (*Receipts) ProtoMessage() {}
func (*Receipts) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{1}
}
func (m *Receipts) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Receipts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Receipts.Marshal(b, m, deterministic)
......@@ -162,12 +171,15 @@ func (m *Receipts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Receipts) XXX_Merge(src proto.Message) {
xxx_messageInfo_Receipts.Merge(m, src)
}
func (m *Receipts) XXX_Size() int {
return m.Size()
}
func (m *Receipts) XXX_DiscardUnknown() {
xxx_messageInfo_Receipts.DiscardUnknown(m)
}
......@@ -195,9 +207,11 @@ func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{2}
}
func (m *Event) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Event.Marshal(b, m, deterministic)
......@@ -210,12 +224,15 @@ func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Event) XXX_Merge(src proto.Message) {
xxx_messageInfo_Event.Merge(m, src)
}
func (m *Event) XXX_Size() int {
return m.Size()
}
func (m *Event) XXX_DiscardUnknown() {
xxx_messageInfo_Event.DiscardUnknown(m)
}
......@@ -254,9 +271,11 @@ func (*EvmLog) ProtoMessage() {}
func (*EvmLog) Descriptor() ([]byte, []int) {
return fileDescriptor_ace1d6eb38fad2c8, []int{3}
}
func (m *EvmLog) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EvmLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EvmLog.Marshal(b, m, deterministic)
......@@ -269,12 +288,15 @@ func (m *EvmLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *EvmLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_EvmLog.Merge(m, src)
}
func (m *EvmLog) XXX_Size() int {
return m.Size()
}
func (m *EvmLog) XXX_DiscardUnknown() {
xxx_messageInfo_EvmLog.DiscardUnknown(m)
}
......@@ -682,6 +704,7 @@ func encodeVarintReceipt(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *Receipt) Size() (n int) {
if m == nil {
return 0
......@@ -810,9 +833,11 @@ func (m *EvmLog) Size() (n int) {
func sovReceipt(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozReceipt(x uint64) (n int) {
return sovReceipt(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Receipt) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1145,6 +1170,7 @@ func (m *Receipt) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Receipts) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1232,6 +1258,7 @@ func (m *Receipts) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Event) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1374,6 +1401,7 @@ func (m *Event) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *EvmLog) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -1678,6 +1706,7 @@ func (m *EvmLog) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipReceipt(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -13,9 +13,11 @@ import (
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -36,9 +38,11 @@ func (*VpInfo) ProtoMessage() {}
func (*VpInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_7477e72a440db3af, []int{0}
}
func (m *VpInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *VpInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_VpInfo.Marshal(b, m, deterministic)
......@@ -51,12 +55,15 @@ func (m *VpInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *VpInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_VpInfo.Merge(m, src)
}
func (m *VpInfo) XXX_Size() int {
return m.Size()
}
func (m *VpInfo) XXX_DiscardUnknown() {
xxx_messageInfo_VpInfo.DiscardUnknown(m)
}
......@@ -173,6 +180,7 @@ func encodeVarintVpInfo(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *VpInfo) Size() (n int) {
if m == nil {
return 0
......@@ -202,9 +210,11 @@ func (m *VpInfo) Size() (n int) {
func sovVpInfo(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozVpInfo(x uint64) (n int) {
return sovVpInfo(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *VpInfo) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
......@@ -373,6 +383,7 @@ func (m *VpInfo) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipVpInfo(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
......
......@@ -147,7 +147,7 @@ type GRPCClient struct {
func (g *GRPCClient) Initialize(configPath string, ID string, extra []byte) error {
g.DID = ID
_, err := g.client.Initialize(g.doneContext, &pb.InitializeRequest{
SidecarId: "", //TODO
SidecarId: "", // TODO
ConfigPath: configPath,
Extra: extra,
})
......
......@@ -14,7 +14,7 @@ type Kernel interface {
// Client defines the interface that interacts with appchain 与 appchain交互。
//go:generate mockgen -destination mock_client/mock_client.go -package mock_client -source interface.go
type Client interface { //业务实现委托接口。需要实现的那有些。
type Client interface { // 业务实现委托接口。需要实现的那有些。
internal.Launcher
Kernel
Bind(kern Kernel)
......
......@@ -22,13 +22,13 @@ var (
// 宿主机进程在启动时也设置Plugins,即ClientConfig中设置Plugins时,不需要指明其实现者。
// PluginMap is the map of plugins we can dispense.
var PluginMap = map[string]plugin.Plugin{
PluginName: &AppchainGRPCPlugin{}, //宿主机进程的插件集
PluginName: &AppchainGRPCPlugin{}, // 宿主机进程的插件集
}
// 插件实现
// This is the implementation of plugin.GRPCPlugin so we can serve/consume this.
type AppchainGRPCPlugin struct {
plugin.Plugin //要嵌入(net/rpc)插件接口,是反射的作用。整个接口体需要实现:GRPCPlugin、plugin.Plugin两个接口,而plugin.Plugin并没有使用,嵌入进去即可。
plugin.Plugin // 要嵌入(net/rpc)插件接口,是反射的作用。整个接口体需要实现:GRPCPlugin、plugin.Plugin两个接口,而plugin.Plugin并没有使用,嵌入进去即可。
// Concrete implementation, written in Go. This is only used for plugins
// that are written in Go.
Impl Client
......@@ -42,7 +42,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客户端的方法是自动生成的
client: pb.NewAppchainPluginClient(c), // 创建gRPC客户端的方法是自动生成的
doneContext: ctx,
}, nil
}
......
......@@ -52,7 +52,6 @@ func TestGRPCServer_Error(t *testing.T) {
_, err = grpcServer.GetCallbackMeta(ctx, nil)
require.NotNil(t, err)
}
func TestGRPCServer(t *testing.T) {
......@@ -398,8 +397,7 @@ func (mc *mockAppchainPluginClient) Type(ctx context.Context, in *pb.Empty, opts
var _ pb.AppchainPluginClient = &mockAppchainPluginClient{}
//====================================
type mockAppchainPlugin_GetIBTPClient struct {
}
type mockAppchainPlugin_GetIBTPClient struct{}
func (m mockAppchainPlugin_GetIBTPClient) Recv() (*pb.IBTP, error) {
return nil, nil
......@@ -433,8 +431,7 @@ func (m mockAppchainPlugin_GetIBTPClient) RecvMsg(interface{}) error {
var _ pb.AppchainPlugin_GetIBTPClient = &mockAppchainPlugin_GetIBTPClient{}
//==================================
type mockAppchainPlugin_GetIBTPServer struct {
}
type mockAppchainPlugin_GetIBTPServer struct{}
func (m mockAppchainPlugin_GetIBTPServer) Send(ibtp *pb.IBTP) error {
return nil
......
......@@ -31,7 +31,8 @@ func CreateClient(sidecarID string, appchainConfig repo.Appchain, extra []byte)
Cmd: exec.Command("sh", "-c", pluginPath),
Logger: logger,
AllowedProtocols: []plugin.Protocol{
plugin.ProtocolGRPC}, //只支持grpc
plugin.ProtocolGRPC,
}, // 只支持grpc
})
// Connect via RPC
......@@ -79,7 +80,8 @@ func CreateClients(appchainConfigs repo.Appchains, extra []byte) []Client {
Cmd: exec.Command("sh", "-c", pluginPath),
Logger: logger,
AllowedProtocols: []plugin.Protocol{
plugin.ProtocolGRPC}, //只支持grpc
plugin.ProtocolGRPC,
}, // 只支持grpc
})
// Connect via RPC
rpcClient, err := kernel.Client()
......
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