Commit 7bce9c1a authored by jzhe's avatar jzhe

feat:handle ibtp-2.0

parent 4e3c0b70
...@@ -8,6 +8,6 @@ bin ...@@ -8,6 +8,6 @@ bin
cover.out cover.out
cover.html cover.html
coverage.txt coverage.txt
/example/contracts/src/broker/vendor/ example/contracts/src/broker/vendor/
/example/contracts/src/data_swapper/vendor/ example/contracts/src/data_swapper/vendor/
/example/contracts/src/transfer/vendor/ example/contracts/src/transfer/vendor/
...@@ -21,7 +21,6 @@ import ( ...@@ -21,7 +21,6 @@ import (
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
"github.com/hyperledger/fabric/common/util" "github.com/hyperledger/fabric/common/util"
"github.com/meshplus/bitxhub-model/pb" "github.com/meshplus/bitxhub-model/pb"
"github.com/meshplus/bitxid"
"github.com/meshplus/pier/pkg/plugins" "github.com/meshplus/pier/pkg/plugins"
) )
...@@ -36,9 +35,11 @@ var ( ...@@ -36,9 +35,11 @@ var (
var _ plugins.Client = (*Client)(nil) var _ plugins.Client = (*Client)(nil)
const ( const (
GetInnerMetaMethod = "getInnerMeta" // get last index of each source chain executing tx GetInnerMetaMethod = "getInnerMeta" // get last index of each source chain executing tx
GetOutMetaMethod = "getOuterMeta" // get last index of each receiving chain crosschain event GetOutMetaMethod = "getOuterMeta" // get last index of each receiving chain crosschain event
GetCallbackMetaMethod = "getCallbackMeta" // get last index of each receiving chain callback tx GetCallbackMetaMethod = "getCallbackMeta" // get last index of each receiving chain callback tx
GetDstRollbackMeta = "getDstRollbackMeta" // get last index of each receiving chain dst roll back tx
GetChainId = "getChainId"
GetInMessageMethod = "getInMessage" GetInMessageMethod = "getInMessage"
GetOutMessageMethod = "getOutMessage" GetOutMessageMethod = "getOutMessage"
PollingEventMethod = "pollingEvent" PollingEventMethod = "pollingEvent"
...@@ -56,14 +57,16 @@ type ContractMeta struct { ...@@ -56,14 +57,16 @@ type ContractMeta struct {
} }
type Client struct { type Client struct {
meta *ContractMeta meta *ContractMeta
consumer *Consumer consumer *Consumer
eventC chan *pb.IBTP eventC chan *pb.IBTP
appchainID string appchainID string
name string name string
outMeta map[string]uint64 serviceMeta map[string]*pb.Interchain
ticker *time.Ticker ticker *time.Ticker
done chan bool done chan bool
timeoutHeight int64
config *Config
} }
type CallFunc struct { type CallFunc struct {
...@@ -73,11 +76,11 @@ type CallFunc struct { ...@@ -73,11 +76,11 @@ type CallFunc struct {
func (c *Client) Initialize(configPath, appchainID string, extra []byte) error { func (c *Client) Initialize(configPath, appchainID string, extra []byte) error {
eventC := make(chan *pb.IBTP) eventC := make(chan *pb.IBTP)
fabricConfig, err := UnmarshalConfig(configPath) config, err := UnmarshalConfig(configPath)
if err != nil { if err != nil {
return fmt.Errorf("unmarshal config for plugin :%w", err) return fmt.Errorf("unmarshal config for plugin :%w", err)
} }
fabricConfig := config.Fabric
contractmeta := &ContractMeta{ contractmeta := &ContractMeta{
EventFilter: fabricConfig.EventFilter, EventFilter: fabricConfig.EventFilter,
Username: fabricConfig.Username, Username: fabricConfig.Username,
...@@ -86,12 +89,12 @@ func (c *Client) Initialize(configPath, appchainID string, extra []byte) error { ...@@ -86,12 +89,12 @@ func (c *Client) Initialize(configPath, appchainID string, extra []byte) error {
ORG: fabricConfig.Org, ORG: fabricConfig.Org,
} }
m := make(map[string]uint64) m := make(map[string]*pb.Interchain)
if err := json.Unmarshal(extra, &m); err != nil { if err := json.Unmarshal(extra, &m); err != nil {
return fmt.Errorf("unmarshal extra for plugin :%w", err) return fmt.Errorf("unmarshal extra for plugin :%w", err)
} }
if m == nil { if m == nil {
m = make(map[string]uint64) m = make(map[string]*pb.Interchain)
} }
mgh, err := newFabricHandler(contractmeta.EventFilter, eventC, appchainID) mgh, err := newFabricHandler(contractmeta.EventFilter, eventC, appchainID)
...@@ -110,10 +113,11 @@ func (c *Client) Initialize(configPath, appchainID string, extra []byte) error { ...@@ -110,10 +113,11 @@ func (c *Client) Initialize(configPath, appchainID string, extra []byte) error {
c.meta = contractmeta c.meta = contractmeta
c.appchainID = appchainID c.appchainID = appchainID
c.name = fabricConfig.Name c.name = fabricConfig.Name
c.outMeta = m c.serviceMeta = m
c.ticker = time.NewTicker(2 * time.Second) c.ticker = time.NewTicker(2 * time.Second)
c.done = done c.done = done
c.timeoutHeight = fabricConfig.TimeoutHeight
c.config = config
return nil return nil
} }
...@@ -128,44 +132,44 @@ func (c *Client) polling() { ...@@ -128,44 +132,44 @@ func (c *Client) polling() {
for { for {
select { select {
case <-c.ticker.C: case <-c.ticker.C:
args, err := json.Marshal(c.outMeta) outMeta, err := c.GetOutMeta()
if err != nil {
logger.Error("Marshal outMeta of plugin", "error", err.Error())
continue
}
request := channel.Request{
ChaincodeID: c.meta.CCID,
Fcn: PollingEventMethod,
Args: [][]byte{args},
}
var response channel.Response
response, err = c.consumer.ChannelClient.Execute(request)
if err != nil {
logger.Error("Polling events from contract", "error", err.Error())
continue
}
if response.Payload == nil {
continue
}
proof, err := c.getProof(response)
if err != nil { if err != nil {
continue continue
} }
for servicePair, index := range outMeta {
srcChainServiceID, dstChainServiceID, err := parseServicePair(servicePair)
if err != nil {
logger.Error("Polling out invalid service pair",
"servicePair", servicePair,
"index", index,
"error", err.Error())
continue
}
meta, ok := c.serviceMeta[srcChainServiceID]
if !ok {
meta = &pb.Interchain{
ID: srcChainServiceID,
InterchainCounter: make(map[string]uint64),
ReceiptCounter: make(map[string]uint64),
SourceInterchainCounter: make(map[string]uint64),
SourceReceiptCounter: make(map[string]uint64),
}
c.serviceMeta[srcChainServiceID] = meta
}
evs := make([]*Event, 0) for i := meta.InterchainCounter[dstChainServiceID] + 1; i <= index; i++ {
if err := json.Unmarshal(response.Payload, &evs); err != nil { ibtp, err := c.GetOutMessage(servicePair, i)
logger.Error("Unmarshal response payload", "error", err.Error()) if err != nil {
continue logger.Error("Polling out message",
} "servicePair", servicePair,
for _, ev := range evs { "index", i,
ev.Proof = proof "error", err.Error())
c.eventC <- ev.Convert2IBTP(c.appchainID, pb.IBTP_INTERCHAIN) continue
if c.outMeta == nil { }
c.outMeta = make(map[string]uint64)
c.eventC <- ibtp
meta.InterchainCounter[dstChainServiceID]++
} }
c.outMeta[string(bitxid.DID(ev.DstContractDID).GetChainDID())]++
} }
case <-c.done: case <-c.done:
logger.Info("Stop long polling") logger.Info("Stop long polling")
...@@ -234,11 +238,12 @@ func (c *Client) GetIBTP() chan *pb.IBTP { ...@@ -234,11 +238,12 @@ func (c *Client) GetIBTP() chan *pb.IBTP {
} }
func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) { func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) {
pd := &pb.Payload{}
ret := &pb.SubmitIBTPResponse{} ret := &pb.SubmitIBTPResponse{}
pd := &pb.Payload{}
if err := pd.Unmarshal(ibtp.Payload); err != nil { if err := pd.Unmarshal(ibtp.Payload); err != nil {
return ret, fmt.Errorf("ibtp payload unmarshal: %w", err) return nil, fmt.Errorf("ibtp payload unmarshal: %w", err)
} }
content := &pb.Content{} content := &pb.Content{}
if err := content.Unmarshal(pd.Content); err != nil { if err := content.Unmarshal(pd.Content); err != nil {
return ret, fmt.Errorf("ibtp content unmarshal: %w", err) return ret, fmt.Errorf("ibtp content unmarshal: %w", err)
...@@ -248,20 +253,35 @@ func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) { ...@@ -248,20 +253,35 @@ func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) {
return nil, fmt.Errorf("invalid ibtp category") return nil, fmt.Errorf("invalid ibtp category")
} }
logger.Info("submit ibtp", "id", ibtp.ID(), "contract", content.DstContractId, "func", content.Func) var (
for i, arg := range content.Args { err error
logger.Info("arg", strconv.Itoa(i), string(arg)) serviceID string
srcChainServiceID string
)
if ibtp.Category() == pb.IBTP_REQUEST {
srcChainServiceID = ibtp.From
_, _, serviceID, err = parseChainServiceID(ibtp.To)
} else {
srcChainServiceID = ibtp.To
_, _, serviceID, err = parseChainServiceID(ibtp.From)
} }
if ibtp.Category() == pb.IBTP_RESPONSE && content.Func == "" { if ibtp.Category() == pb.IBTP_RESPONSE && content.Func == "" || ibtp.Type == pb.IBTP_ROLLBACK {
logger.Info("InvokeIndexUpdate", "ibtp", ibtp.ID()) logger.Info("InvokeIndexUpdate", "ibtp", ibtp.ID())
_, resp, err := c.InvokeIndexUpdate(ibtp.From, ibtp.Index, ibtp.Category()) _, resp, err := c.InvokeIndexUpdate(srcChainServiceID, ibtp.Index, serviceID, ibtp.Category())
if err != nil { if err != nil {
return nil, err return nil, err
} }
ret.Status = resp.OK ret.Status = resp.OK
ret.Message = resp.Message ret.Message = resp.Message
if ibtp.Type == pb.IBTP_ROLLBACK {
ret.Result, err = c.generateCallback(ibtp, nil, ret.Status)
if err != nil {
return nil, err
}
}
return ret, nil return ret, nil
} }
...@@ -276,13 +296,13 @@ func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) { ...@@ -276,13 +296,13 @@ func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) {
ret.Status = false ret.Status = false
ret.Message = fmt.Sprintf("marshal ibtp %s func %s and args: %s", ibtp.ID(), callFunc.Func, err.Error()) ret.Message = fmt.Sprintf("marshal ibtp %s func %s and args: %s", ibtp.ID(), callFunc.Func, err.Error())
res, _, err := c.InvokeIndexUpdate(ibtp.From, ibtp.Index, ibtp.Category()) res, _, err := c.InvokeIndexUpdate(ibtp.From, ibtp.Index, serviceID, ibtp.Category())
if err != nil { if err != nil {
return nil, err return nil, err
} }
chResp = res chResp = res
} else { } else {
res, resp, err := c.InvokeInterchain(ibtp.From, ibtp.Index, content.DstContractId, ibtp.Category(), bizData) res, resp, err := c.InvokeInterchain(ibtp.From, ibtp.Index, serviceID, uint64(ibtp.Category()), bizData)
if err != nil { if err != nil {
return nil, fmt.Errorf("invoke interchain for ibtp %s to call %s: %w", ibtp.ID(), content.Func, err) return nil, fmt.Errorf("invoke interchain for ibtp %s to call %s: %w", ibtp.ID(), content.Func, err)
} }
...@@ -305,20 +325,18 @@ func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) { ...@@ -305,20 +325,18 @@ func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) {
return ret, err return ret, err
} }
ret.Result, err = c.generateCallback(ibtp, result, proof, ret.Status) ret.Result, err = c.generateCallback(ibtp, result, ret.Status)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ret.Result.Proof = proof
return ret, nil return ret, nil
} }
func (c *Client) InvokeInterchain(from string, index uint64, destAddr string, category pb.IBTP_Category, bizCallData []byte) (*channel.Response, *Response, error) { func (c *Client) InvokeInterchain(from string, index uint64, destAddr string, reqType uint64, bizCallData []byte) (*channel.Response, *Response, error) {
req := "true" args := util.ToChaincodeArgs(from, strconv.FormatUint(index, 10), destAddr, strconv.FormatUint(reqType, 10))
if category == pb.IBTP_RESPONSE {
req = "false"
}
args := util.ToChaincodeArgs(from, strconv.FormatUint(index, 10), destAddr, req)
args = append(args, bizCallData) args = append(args, bizCallData)
request := channel.Request{ request := channel.Request{
ChaincodeID: c.meta.CCID, ChaincodeID: c.meta.CCID,
...@@ -358,8 +376,8 @@ func (c *Client) InvokeInterchain(from string, index uint64, destAddr string, ca ...@@ -358,8 +376,8 @@ func (c *Client) InvokeInterchain(from string, index uint64, destAddr string, ca
return &res, response, nil return &res, response, nil
} }
func (c *Client) GetOutMessage(to string, idx uint64) (*pb.IBTP, error) { func (c *Client) GetOutMessage(servicePair string, idx uint64) (*pb.IBTP, error) {
args := util.ToChaincodeArgs(to, strconv.FormatUint(idx, 10)) args := util.ToChaincodeArgs(servicePair, strconv.FormatUint(idx, 10))
request := channel.Request{ request := channel.Request{
ChaincodeID: c.meta.CCID, ChaincodeID: c.meta.CCID,
Fcn: GetOutMessageMethod, Fcn: GetOutMessageMethod,
...@@ -379,11 +397,11 @@ func (c *Client) GetOutMessage(to string, idx uint64) (*pb.IBTP, error) { ...@@ -379,11 +397,11 @@ func (c *Client) GetOutMessage(to string, idx uint64) (*pb.IBTP, error) {
return c.unpackIBTP(&response, pb.IBTP_INTERCHAIN, proof) return c.unpackIBTP(&response, pb.IBTP_INTERCHAIN, proof)
} }
func (c *Client) GetInMessage(from string, index uint64) ([][]byte, error) { func (c *Client) GetInMessage(servicePair string, index uint64) ([][]byte, error) {
request := channel.Request{ request := channel.Request{
ChaincodeID: c.meta.CCID, ChaincodeID: c.meta.CCID,
Fcn: GetInMessageMethod, Fcn: GetInMessageMethod,
Args: util.ToChaincodeArgs(from, strconv.FormatUint(index, 10)), Args: util.ToChaincodeArgs(servicePair, strconv.FormatUint(index, 10)),
} }
var response channel.Response var response channel.Response
...@@ -457,7 +475,7 @@ func (c *Client) CommitCallback(ibtp *pb.IBTP) error { ...@@ -457,7 +475,7 @@ func (c *Client) CommitCallback(ibtp *pb.IBTP) error {
// @ibtp is the original ibtp merged from this appchain // @ibtp is the original ibtp merged from this appchain
func (c *Client) RollbackIBTP(ibtp *pb.IBTP, isSrcChain bool) (*pb.RollbackIBTPResponse, error) { func (c *Client) RollbackIBTP(ibtp *pb.IBTP, isSrcChain bool) (*pb.RollbackIBTPResponse, error) {
ret := &pb.RollbackIBTPResponse{} ret := &pb.RollbackIBTPResponse{Status: true}
pd := &pb.Payload{} pd := &pb.Payload{}
if err := pd.Unmarshal(ibtp.Payload); err != nil { if err := pd.Unmarshal(ibtp.Payload); err != nil {
return nil, fmt.Errorf("ibtp payload unmarshal: %w", err) return nil, fmt.Errorf("ibtp payload unmarshal: %w", err)
...@@ -467,22 +485,47 @@ func (c *Client) RollbackIBTP(ibtp *pb.IBTP, isSrcChain bool) (*pb.RollbackIBTPR ...@@ -467,22 +485,47 @@ func (c *Client) RollbackIBTP(ibtp *pb.IBTP, isSrcChain bool) (*pb.RollbackIBTPR
return ret, fmt.Errorf("ibtp content unmarshal: %w", err) return ret, fmt.Errorf("ibtp content unmarshal: %w", err)
} }
// only support rollback for interchainCharge if content.Rollback == "" {
if content.Func != "interchainCharge" { logger.Info("rollback function is empty, ignore it", "func", content.Func, "callback", content.Callback, "rollback", content.Rollback)
return nil, nil return nil, nil
} }
var (
bizData []byte
err error
serviceID string
srcChainServiceID string
rollbackFunc string
rollbackArgs [][]byte
reqType uint64
)
if isSrcChain {
rollbackFunc = content.Rollback
rollbackArgs = content.ArgsRb
srcChainServiceID = ibtp.To
_, _, serviceID, err = parseChainServiceID(ibtp.From)
reqType = 1
} else {
rollbackFunc = content.Func
rollbackArgs = content.Args
rollbackArgs[len(rollbackArgs)-1] = []byte("true")
srcChainServiceID = ibtp.From
_, _, serviceID, err = parseChainServiceID(ibtp.To)
reqType = 2
}
callFunc := CallFunc{ callFunc := CallFunc{
Func: content.Rollback, Func: rollbackFunc,
Args: content.ArgsRb, Args: rollbackArgs,
} }
bizData, err := json.Marshal(callFunc) bizData, err = json.Marshal(callFunc)
if err != nil { if err != nil {
return ret, err return ret, err
} }
// pb.IBTP_RESPONSE indicates it is to update callback counter // pb.IBTP_RESPONSE indicates it is to update callback counter
_, resp, err := c.InvokeInterchain(ibtp.To, ibtp.Index, content.SrcContractId, pb.IBTP_RESPONSE, bizData) _, resp, err := c.InvokeInterchain(srcChainServiceID, ibtp.Index, serviceID, reqType, bizData)
if err != nil { if err != nil {
return nil, fmt.Errorf("invoke interchain for ibtp %s to call %s: %w", ibtp.ID(), content.Rollback, err) return nil, fmt.Errorf("invoke interchain for ibtp %s to call %s: %w", ibtp.ID(), content.Rollback, err)
} }
...@@ -494,11 +537,15 @@ func (c *Client) RollbackIBTP(ibtp *pb.IBTP, isSrcChain bool) (*pb.RollbackIBTPR ...@@ -494,11 +537,15 @@ func (c *Client) RollbackIBTP(ibtp *pb.IBTP, isSrcChain bool) (*pb.RollbackIBTPR
} }
func (c *Client) IncreaseInMeta(original *pb.IBTP) (*pb.IBTP, error) { func (c *Client) IncreaseInMeta(original *pb.IBTP) (*pb.IBTP, error) {
ibtp, err := c.generateCallback(original, nil, nil, false) ibtp, err := c.generateCallback(original, nil, false)
if err != nil { if err != nil {
return nil, err return nil, err
} }
_, _, err = c.InvokeIndexUpdate(original.From, original.Index, original.Category()) _, _, serviceID, err := parseChainServiceID(ibtp.To)
if err != nil {
return nil, err
}
_, _, err = c.InvokeIndexUpdate(original.From, original.Index, serviceID, original.Category())
if err != nil { if err != nil {
logger.Error("update in meta", "ibtp_id", original.ID(), "error", err.Error()) logger.Error("update in meta", "ibtp_id", original.ID(), "error", err.Error())
} }
...@@ -506,7 +553,7 @@ func (c *Client) IncreaseInMeta(original *pb.IBTP) (*pb.IBTP, error) { ...@@ -506,7 +553,7 @@ func (c *Client) IncreaseInMeta(original *pb.IBTP) (*pb.IBTP, error) {
} }
func (c *Client) GetReceipt(ibtp *pb.IBTP) (*pb.IBTP, error) { func (c *Client) GetReceipt(ibtp *pb.IBTP) (*pb.IBTP, error) {
result, err := c.GetInMessage(ibtp.From, ibtp.Index) result, err := c.GetInMessage(ibtp.ServicePair(), ibtp.Index)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -515,15 +562,12 @@ func (c *Client) GetReceipt(ibtp *pb.IBTP) (*pb.IBTP, error) { ...@@ -515,15 +562,12 @@ func (c *Client) GetReceipt(ibtp *pb.IBTP) (*pb.IBTP, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return c.generateCallback(ibtp, result[1:], nil, status) return c.generateCallback(ibtp, result[1:], status)
} }
func (c Client) InvokeIndexUpdate(from string, index uint64, category pb.IBTP_Category) (*channel.Response, *Response, error) { func (c Client) InvokeIndexUpdate(from string, index uint64, serviceId string, category pb.IBTP_Category) (*channel.Response, *Response, error) {
req := "true" reqType := strconv.FormatUint(uint64(category), 10)
if category == pb.IBTP_RESPONSE { args := util.ToChaincodeArgs(from, strconv.FormatUint(index, 10), serviceId, reqType)
req = "false"
}
args := util.ToChaincodeArgs(from, strconv.FormatUint(index, 10), req)
request := channel.Request{ request := channel.Request{
ChaincodeID: c.meta.CCID, ChaincodeID: c.meta.CCID,
Fcn: InvokeIndexUpdateMethod, Fcn: InvokeIndexUpdateMethod,
...@@ -543,13 +587,60 @@ func (c Client) InvokeIndexUpdate(from string, index uint64, category pb.IBTP_Ca ...@@ -543,13 +587,60 @@ func (c Client) InvokeIndexUpdate(from string, index uint64, category pb.IBTP_Ca
return &res, response, nil return &res, response, nil
} }
func (c *Client) GetSrcRollbackMeta() (map[string]uint64, error) {
panic("implement me")
}
func (c *Client) GetDstRollbackMeta() (map[string]uint64, error) {
request := channel.Request{
ChaincodeID: c.meta.CCID,
Fcn: GetDstRollbackMeta,
}
var response channel.Response
response, err := c.consumer.ChannelClient.Execute(request)
if err != nil {
return nil, err
}
return c.unpackMap(response)
}
func (c *Client) GetServices() []string {
var services []string
for _, service := range c.config.Services {
services = append(services, service.ID)
}
return services
}
func (c *Client) GetChainID() (string, string) {
request := channel.Request{
ChaincodeID: c.meta.CCID,
Fcn: GetChainId,
}
response, err := c.consumer.ChannelClient.Execute(request)
if err != nil || response.Payload == nil {
return "", ""
}
chainIds := strings.Split(string(response.Payload), "-")
if len(chainIds) != 2 {
return "", ""
}
return chainIds[0], chainIds[1]
}
func (c *Client) unpackIBTP(response *channel.Response, ibtpType pb.IBTP_Type, proof []byte) (*pb.IBTP, error) { func (c *Client) unpackIBTP(response *channel.Response, ibtpType pb.IBTP_Type, proof []byte) (*pb.IBTP, error) {
ret := &Event{} ret := &Event{}
if err := json.Unmarshal(response.Payload, ret); err != nil { if err := json.Unmarshal(response.Payload, ret); err != nil {
return nil, err return nil, err
} }
ret.Proof = proof ibtp := ret.Convert2IBTP(c.timeoutHeight, ibtpType)
return ret.Convert2IBTP(c.appchainID, ibtpType), nil ibtp.Proof = proof
return ibtp, nil
} }
func (c *Client) unpackMap(response channel.Response) (map[string]uint64, error) { func (c *Client) unpackMap(response channel.Response) (map[string]uint64, error) {
...@@ -602,3 +693,25 @@ func main() { ...@@ -602,3 +693,25 @@ func main() {
logger.Info("Plugin server down") logger.Info("Plugin server down")
} }
func parseChainServiceID(id string) (string, string, string, error) {
splits := strings.Split(id, ":")
if len(splits) != 3 {
return "", "", "", fmt.Errorf("invalid chain service ID: %s", id)
}
return splits[0], splits[1], splits[2], nil
}
func parseServicePair(servicePair string) (string, string, error) {
splits := strings.Split(servicePair, "-")
if len(splits) != 2 {
return "", "", fmt.Errorf("invalid service pair: %s", servicePair)
}
return splits[0], splits[1], nil
}
func genServicePair(from, to string) string {
return fmt.Sprintf("%s-%s", from, to)
}
...@@ -11,29 +11,44 @@ const ( ...@@ -11,29 +11,44 @@ const (
ConfigName = "fabric.toml" ConfigName = "fabric.toml"
) )
type Config struct {
Fabric Fabric `toml:"fabric" json:"fabric"`
Services []Service `mapstructure:"services" json:"services"`
}
type Fabric struct { type Fabric struct {
Addr string `toml:"addr" json:"addr"` Addr string `toml:"addr" json:"addr"`
Name string `toml:"name" json:"name"` Name string `toml:"name" json:"name"`
EventFilter string `mapstructure:"event_filter" toml:"event_filter" json:"event_filter"` EventFilter string `mapstructure:"event_filter" toml:"event_filter" json:"event_filter"`
Username string `toml:"username" json:"username"` Username string `toml:"username" json:"username"`
CCID string `toml:"ccid" json:"ccid"` CCID string `toml:"ccid" json:"ccid"`
ChannelId string `mapstructure:"channel_id" toml:"channel_id" json:"channel_id"` ChannelId string `mapstructure:"channel_id" toml:"channel_id" json:"channel_id"`
Org string `toml:"org" json:"org"` Org string `toml:"org" json:"org"`
TimeoutHeight int64 `mapstructure:"timeout_height" json:"timeout_height"`
ChainID string `mapstructure:"chain_id" json:"chain_id"`
}
type Service struct {
ID string `toml:"id" json:"id"`
Name string `toml:"name" json:"name"`
Type string `toml:"type" json:"type"`
} }
func DefaultConfig() *Fabric { func DefaultConfig() *Config {
return &Fabric{ return &Config{
Addr: "40.125.164.122:10053", Fabric: Fabric{
Name: "fabric", Addr: "40.125.164.122:10053",
EventFilter: "CrosschainEventName", Name: "fabric",
Username: "Admin", EventFilter: "CrosschainEventName",
CCID: "Broker-001", Username: "Admin",
ChannelId: "mychannel", CCID: "Broker-001",
Org: "org2", ChannelId: "mychannel",
Org: "org2",
},
Services: nil,
} }
} }
func UnmarshalConfig(configPath string) (*Fabric, error) { func UnmarshalConfig(configPath string) (*Config, error) {
viper.SetConfigFile(filepath.Join(configPath, ConfigName)) viper.SetConfigFile(filepath.Join(configPath, ConfigName))
viper.SetConfigType("toml") viper.SetConfigType("toml")
viper.AutomaticEnv() viper.AutomaticEnv()
......
[fabric]
addr = "host.docker.internal:7053" addr = "host.docker.internal:7053"
event_filter = "interchain-event-name" event_filter = "interchain-event-name"
username = "Admin" username = "Admin"
ccid = "broker" ccid = "broker"
channel_id = "mychannel" channel_id = "mychannel"
org = "org2" org = "org2"
\ No newline at end of file timeout_height = 10
chain_id = "3"
[[services]]
id = "mychannel&transfer"
name = "transfer"
[[services]]
id = "mychannel&data_swapper"
name = "data_swapper"
\ No newline at end of file
package main package main
import ( import (
"fmt"
"strings" "strings"
"time"
"github.com/cloudflare/cfssl/log" "github.com/cloudflare/cfssl/log"
"github.com/meshplus/bitxhub-model/pb" "github.com/meshplus/bitxhub-model/pb"
"github.com/meshplus/bitxid"
) )
type Event struct { type Event struct {
Index uint64 `json:"index"` Index uint64 `json:"index"`
DstContractDID string `json:"dst_contract_did"` DstFullID string `json:"dst_full_id"`
SrcContractID string `json:"src_contract_id"` SrcFullID string `json:"src_full_id"`
Func string `json:"func"` Func string `json:"func"`
Args string `json:"args"` Args string `json:"args"`
Callback string `json:"callback"` Argscb string `json:"argscb"`
Argscb string `json:"argscb"` Argsrb string `json:"argsrb"`
Rollback string `json:"rollback"`
Argsrb string `json:"argsrb"`
Proof []byte `json:"proof"`
Extra []byte `json:"extra"`
} }
func (ev *Event) Convert2IBTP(srcMethod string, ibtpType pb.IBTP_Type) *pb.IBTP { func (ev *Event) Convert2IBTP(timeoutHeight int64, ibtpType pb.IBTP_Type) *pb.IBTP {
pd, err := ev.encryptPayload() pd, err := ev.encryptPayload()
if err != nil { if err != nil {
log.Fatalf("Get ibtp payload :%s", err) log.Fatalf("Get ibtp payload :%s", err)
} }
return &pb.IBTP{ return &pb.IBTP{
From: srcMethod, From: ev.SrcFullID,
To: string(bitxid.DID(ev.DstContractDID).GetChainDID()), To: ev.DstFullID,
Index: ev.Index, Index: ev.Index,
Type: ibtpType, Type: ibtpType,
Timestamp: time.Now().UnixNano(), TimeoutHeight: timeoutHeight,
Proof: ev.Proof, Payload: pd,
Payload: pd,
Extra: ev.Extra,
} }
} }
...@@ -51,15 +44,17 @@ func handleArgs(args string) [][]byte { ...@@ -51,15 +44,17 @@ func handleArgs(args string) [][]byte {
} }
func (ev *Event) encryptPayload() ([]byte, error) { func (ev *Event) encryptPayload() ([]byte, error) {
funcSplit := strings.Split(ev.Func, ",")
if len(funcSplit) != 3 {
return nil, fmt.Errorf("ibtp func not is (func, callback,rollback)")
}
content := &pb.Content{ content := &pb.Content{
SrcContractId: ev.SrcContractID, Func: funcSplit[0],
DstContractId: bitxid.DID(ev.DstContractDID).GetAddress(), Args: handleArgs(ev.Args),
Func: ev.Func, Callback: funcSplit[1],
Args: handleArgs(ev.Args), ArgsCb: handleArgs(ev.Argscb),
Callback: ev.Callback, Rollback: funcSplit[2],
ArgsCb: handleArgs(ev.Argscb), ArgsRb: handleArgs(ev.Argsrb),
Rollback: ev.Rollback,
ArgsRb: handleArgs(ev.Argsrb),
} }
data, err := content.Marshal() data, err := content.Marshal()
if err != nil { if err != nil {
......
No preview for this file type
...@@ -16,25 +16,26 @@ const ( ...@@ -16,25 +16,26 @@ const (
innerMeta = "inner-meta" innerMeta = "inner-meta"
outterMeta = "outter-meta" outterMeta = "outter-meta"
callbackMeta = "callback-meta" callbackMeta = "callback-meta"
dstRollbackMeta = "dst-rollback-meta"
whiteList = "white-list" whiteList = "white-list"
adminList = "admin-list" adminList = "admin-list"
passed = "1" passed = "1"
rejected = "2" rejected = "2"
delimiter = "&" delimiter = "&"
bxhID = "bxh-id"
appchainID = "appchain-id"
) )
type Broker struct{} type Broker struct{}
type Event struct { type Event struct {
Index uint64 `json:"index"` Index uint64 `json:"index"`
DstContractDID string `json:"dst_contract_did"` DstFullID string `json:"dst_full_id"`
SrcContractID string `json:"src_contract_id"` SrcFullID string `json:"src_full_id"`
Func string `json:"func"` Func string `json:"func"`
Args string `json:"args"` Args string `json:"args"`
Callback string `json:"callback"` Argscb string `json:"argscb"`
Argscb string `json:"argscb"` Argsrb string `json:"argsrb"`
Rollback string `json:"rollback"`
Argsrb string `json:"argsrb"`
} }
type CallFunc struct { type CallFunc struct {
...@@ -59,8 +60,10 @@ func (broker *Broker) Init(stub shim.ChaincodeStubInterface) pb.Response { ...@@ -59,8 +60,10 @@ func (broker *Broker) Init(stub shim.ChaincodeStubInterface) pb.Response {
if err != nil { if err != nil {
return shim.Error(fmt.Sprintf("Initialize admin list fail %s", err.Error())) return shim.Error(fmt.Sprintf("Initialize admin list fail %s", err.Error()))
} }
args := make([]string, 2)
return broker.initialize(stub, args)
return broker.initialize(stub)
} }
func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response { func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
...@@ -84,8 +87,12 @@ func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response { ...@@ -84,8 +87,12 @@ func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
return broker.getInnerMeta(stub) return broker.getInnerMeta(stub)
case "getOuterMeta": case "getOuterMeta":
return broker.getOuterMeta(stub) return broker.getOuterMeta(stub)
case "getDstRollbackMeta":
return broker.getDstRollbackMeta(stub)
case "getCallbackMeta": case "getCallbackMeta":
return broker.getCallbackMeta(stub) return broker.getCallbackMeta(stub)
case "getChainId":
return broker.getChainId(stub)
case "getInMessage": case "getInMessage":
return broker.getInMessage(stub, args) return broker.getInMessage(stub, args)
case "getOutMessage": case "getOutMessage":
...@@ -95,7 +102,7 @@ func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response { ...@@ -95,7 +102,7 @@ func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
case "pollingEvent": case "pollingEvent":
return broker.pollingEvent(stub, args) return broker.pollingEvent(stub, args)
case "initialize": case "initialize":
return broker.initialize(stub) return broker.initialize(stub, args)
case "invokeInterchain": case "invokeInterchain":
return broker.invokeInterchain(stub, args) return broker.invokeInterchain(stub, args)
case "invokeIndexUpdate": case "invokeIndexUpdate":
...@@ -107,10 +114,26 @@ func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response { ...@@ -107,10 +114,26 @@ func (broker *Broker) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
} }
} }
func (broker *Broker) initialize(stub shim.ChaincodeStubInterface) pb.Response { func (broker *Broker) initialize(stub shim.ChaincodeStubInterface, args []string) pb.Response {
if onlyAdmin := broker.onlyAdmin(stub); !onlyAdmin {
return shim.Error("caller is not admin")
}
if len(args) != 2 {
return shim.Error("incorrect number of arguments, expecting 2")
}
if err := stub.PutState(bxhID, []byte(args[0])); err != nil {
return shim.Error(err.Error())
}
if err := stub.PutState(appchainID, []byte(args[1])); err != nil {
return shim.Error(err.Error())
}
inCounter := make(map[string]uint64) inCounter := make(map[string]uint64)
outCounter := make(map[string]uint64) outCounter := make(map[string]uint64)
callbackCounter := make(map[string]uint64) callbackCounter := make(map[string]uint64)
dstRollbackCounter := make(map[string]uint64)
if err := broker.putMap(stub, innerMeta, inCounter); err != nil { if err := broker.putMap(stub, innerMeta, inCounter); err != nil {
return shim.Error(err.Error()) return shim.Error(err.Error())
...@@ -124,54 +147,50 @@ func (broker *Broker) initialize(stub shim.ChaincodeStubInterface) pb.Response { ...@@ -124,54 +147,50 @@ func (broker *Broker) initialize(stub shim.ChaincodeStubInterface) pb.Response {
return shim.Error(err.Error()) return shim.Error(err.Error())
} }
if err := broker.putMap(stub, dstRollbackMeta, dstRollbackCounter); err != nil {
return shim.Error(err.Error())
}
return shim.Success(nil) return shim.Success(nil)
} }
// EmitInterchainEvent
// string destContractDID,
// string func,
// string args,
// string callback;
// string argsCb;
// string rollback;
// string argsRb;
func (broker *Broker) EmitInterchainEvent(stub shim.ChaincodeStubInterface, args []string) pb.Response { func (broker *Broker) EmitInterchainEvent(stub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 7 { if len(args) != 5 {
return shim.Error("incorrect number of arguments, expecting 7") return shim.Error("incorrect number of arguments, expecting 7")
} }
destContractDID := args[0] dstServiceID := args[0]
destChainMethod := parseMethod(destContractDID) cid, err := getChaincodeID(stub)
if destChainMethod == "" { if err != nil {
return ErrInvalidDID(destContractDID) return shim.Error(err.Error())
} }
outMeta, err := broker.getMap(stub, outterMeta) curFullID, err := broker.genFullServiceID(stub, cid)
if err != nil { if err != nil {
return shim.Error(err.Error()) return shim.Error(err.Error())
} }
if _, ok := outMeta[destChainMethod]; !ok { outServicePair := genServicePair(curFullID, dstServiceID)
outMeta[destChainMethod] = 0
}
cid, err := getChaincodeID(stub) outMeta, err := broker.getMap(stub, outterMeta)
if err != nil { if err != nil {
return shim.Error(err.Error()) return shim.Error(err.Error())
} }
if _, ok := outMeta[outServicePair]; !ok {
outMeta[outServicePair] = 0
}
tx := &Event{ tx := &Event{
Index: outMeta[destChainMethod] + 1, Index: outMeta[outServicePair] + 1,
DstContractDID: destContractDID, DstFullID: dstServiceID,
SrcContractID: cid, SrcFullID: curFullID,
Func: args[1], Func: args[1],
Args: args[2], Args: args[2],
Callback: args[3], Argscb: args[3],
Argscb: args[4], Argsrb: args[4],
Rollback: args[5],
Argsrb: args[6],
} }
outMeta[destChainMethod]++ outMeta[outServicePair]++
txValue, err := json.Marshal(tx) txValue, err := json.Marshal(tx)
if err != nil { if err != nil {
...@@ -179,7 +198,7 @@ func (broker *Broker) EmitInterchainEvent(stub shim.ChaincodeStubInterface, args ...@@ -179,7 +198,7 @@ func (broker *Broker) EmitInterchainEvent(stub shim.ChaincodeStubInterface, args
} }
// persist out message // persist out message
key := broker.outMsgKey(destChainMethod, strconv.FormatUint(tx.Index, 10)) key := broker.outMsgKey(outServicePair, strconv.FormatUint(tx.Index, 10))
if err := stub.PutState(key, txValue); err != nil { if err := stub.PutState(key, txValue); err != nil {
return shim.Error(fmt.Errorf("persist event: %w", err).Error()) return shim.Error(fmt.Errorf("persist event: %w", err).Error())
} }
...@@ -285,17 +304,24 @@ func (broker *Broker) pollingEvent(stub shim.ChaincodeStubInterface, args []stri ...@@ -285,17 +304,24 @@ func (broker *Broker) pollingEvent(stub shim.ChaincodeStubInterface, args []stri
return shim.Success(ret) return shim.Success(ret)
} }
func (broker *Broker) updateIndex(stub shim.ChaincodeStubInterface, sourceChainMethod, sequenceNum string, isReq bool) error { func (broker *Broker) updateIndex(stub shim.ChaincodeStubInterface, srcChainServiceID, sequenceNum string, dstAddr string, reqType uint64) error {
if isReq { curServiceID, err := broker.genFullServiceID(stub, dstAddr)
if err := broker.checkIndex(stub, sourceChainMethod, sequenceNum, innerMeta); err != nil { if err != nil {
return err
}
if reqType == 0 {
inServicePair := genServicePair(srcChainServiceID, curServiceID)
if err := broker.checkIndex(stub, inServicePair, sequenceNum, innerMeta); err != nil {
return err return err
} }
if err := broker.markInCounter(stub, sourceChainMethod); err != nil { if err := broker.markInCounter(stub, inServicePair); err != nil {
return err return err
} }
} else { } else if reqType == 1 {
if err := broker.checkIndex(stub, sourceChainMethod, sequenceNum, callbackMeta); err != nil { outServicePair := genServicePair(curServiceID, srcChainServiceID)
if err := broker.checkIndex(stub, outServicePair, sequenceNum, callbackMeta); err != nil {
return err return err
} }
...@@ -303,7 +329,19 @@ func (broker *Broker) updateIndex(stub shim.ChaincodeStubInterface, sourceChainM ...@@ -303,7 +329,19 @@ func (broker *Broker) updateIndex(stub shim.ChaincodeStubInterface, sourceChainM
if err != nil { if err != nil {
return err return err
} }
if err := broker.markCallbackCounter(stub, sourceChainMethod, idx); err != nil { if err := broker.markCallbackCounter(stub, outServicePair, idx); err != nil {
return err
}
} else if reqType == 2 {
inServicePair := genServicePair(srcChainServiceID, curServiceID)
if err := broker.checkIndex(stub, inServicePair, sequenceNum, dstRollbackMeta); err != nil {
return err
}
idx, err := strconv.ParseUint(sequenceNum, 10, 64)
if err != nil {
return err
}
if err := broker.markDstRollbackCounter(stub, inServicePair, idx); err != nil {
return err return err
} }
} }
...@@ -316,34 +354,67 @@ func (broker *Broker) invokeIndexUpdate(stub shim.ChaincodeStubInterface, args [ ...@@ -316,34 +354,67 @@ func (broker *Broker) invokeIndexUpdate(stub shim.ChaincodeStubInterface, args [
return errorResponse("incorrect number of arguments, expecting 3") return errorResponse("incorrect number of arguments, expecting 3")
} }
sourceChainMethod := args[0] srcServiceID := args[0]
sequenceNum := args[1] sequenceNum := args[1]
isReq, err := strconv.ParseBool(args[2]) dstAddr := args[2]
reqType, err := strconv.ParseUint(args[3], 10, 64)
if err != nil { if err != nil {
return errorResponse(fmt.Sprintf("cannot parse %s to bool", args[3])) return errorResponse(fmt.Sprintf("cannot parse %s to uint64", args[3]))
} }
if err := broker.updateIndex(stub, sourceChainMethod, sequenceNum, isReq); err != nil { if err := broker.updateIndex(stub, srcServiceID, sequenceNum, dstAddr, reqType); err != nil {
return errorResponse(err.Error()) return errorResponse(err.Error())
} }
return successResponse(nil) return successResponse(nil)
} }
func (broker *Broker) getChainId(stub shim.ChaincodeStubInterface) pb.Response {
bxhId, err := stub.GetState(bxhID)
if err != nil {
return shim.Error(err.Error())
}
appchainId, err := stub.GetState(appchainID)
if err != nil {
return shim.Error(err.Error())
}
return successResponse([]byte(fmt.Sprintf("%s-%s", bxhId, appchainId)))
}
func (broker *Broker) genFullServiceID(stub shim.ChaincodeStubInterface, serviceId string) (string, error) {
bxhId, err := stub.GetState(bxhID)
if err != nil {
return "", err
}
appchainId, err := stub.GetState(appchainID)
if err != nil {
return "", err
}
return fmt.Sprintf("%s:%s:%s", bxhId, appchainId, serviceId), nil
}
func genServicePair(from, to string) string {
return fmt.Sprintf("%s-%s", from, to)
}
func (broker *Broker) invokeInterchain(stub shim.ChaincodeStubInterface, args []string) pb.Response { func (broker *Broker) invokeInterchain(stub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 5 { if len(args) != 5 {
return errorResponse("incorrect number of arguments, expecting 5") return errorResponse("incorrect number of arguments, expecting 5")
} }
srcChainMethod := args[0] srcChainServiceID := args[0]
sequenceNum := args[1] sequenceNum := args[1]
targetCID := args[2] targetCID := args[2]
isReq, err := strconv.ParseBool(args[3]) reqType, err := strconv.ParseUint(args[3], 10, 64)
if err != nil { if err != nil {
return errorResponse(fmt.Sprintf("cannot parse %s to bool", args[3])) return errorResponse(fmt.Sprintf("cannot parse %s to uint64", args[3]))
} }
if err := broker.updateIndex(stub, srcChainMethod, sequenceNum, isReq); err != nil { if err := broker.updateIndex(stub, srcChainServiceID, sequenceNum, targetCID, reqType); err != nil {
return errorResponse(err.Error()) return errorResponse(err.Error())
} }
...@@ -365,7 +436,13 @@ func (broker *Broker) invokeInterchain(stub shim.ChaincodeStubInterface, args [] ...@@ -365,7 +436,13 @@ func (broker *Broker) invokeInterchain(stub shim.ChaincodeStubInterface, args []
return errorResponse(fmt.Sprintf("invoke chaincode '%s' function %s err: %s", splitedCID[1], callFunc.Func, response.Message)) return errorResponse(fmt.Sprintf("invoke chaincode '%s' function %s err: %s", splitedCID[1], callFunc.Func, response.Message))
} }
inKey := broker.inMsgKey(srcChainMethod, sequenceNum) curServiceID, err := broker.genFullServiceID(stub, targetCID)
if err != nil {
return errorResponse(err.Error())
}
inServicePair := genServicePair(srcChainServiceID, curServiceID)
inKey := broker.inMsgKey(inServicePair, sequenceNum)
value, err := json.Marshal(response) value, err := json.Marshal(response)
if err != nil { if err != nil {
return errorResponse(err.Error()) return errorResponse(err.Error())
......
module github.com/meshplus/broker
go 1.13
require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.29.1 // indirect
github.com/fsouza/go-dockerclient v1.7.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hyperledger/fabric v1.4.3
github.com/hyperledger/fabric-amcl v0.0.0-20210603140002-2670f91851c8 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/onsi/gomega v1.14.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/sykesm/zap-logfmt v0.0.4 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
google.golang.org/grpc v1.39.0 // indirect
)
replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strconv" "strconv"
"strings"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim" "github.com/hyperledger/fabric/core/chaincode/shim"
...@@ -201,23 +200,3 @@ func (broker *Broker) checkWhitelist(stub shim.ChaincodeStubInterface, function ...@@ -201,23 +200,3 @@ func (broker *Broker) checkWhitelist(stub shim.ChaincodeStubInterface, function
return broker.onlyWhitelist(stub) return broker.onlyWhitelist(stub)
} }
func (broker *Broker) validDID(did string) bool {
s := strings.Split(did, ":")
if len(s) != 4 || s[0] != "did" || s[1] == "" || s[2] == "" || s[3] == "" {
return false
}
return true
}
func parseMethod(did string) string {
s := strings.Split(did, ":")
if len(s) != 4 || s[0] != "did" || s[1] == "" || s[2] == "" || s[3] == "" {
return ""
}
return fmt.Sprintf("%s:%s:%s:.", s[0], s[1], s[2])
}
func ErrInvalidDID(did string) pb.Response {
return errorResponse(fmt.Sprintf("Invalid did format for %s", did))
}
...@@ -21,9 +21,6 @@ func (broker *Broker) getOutMessage(stub shim.ChaincodeStubInterface, args []str ...@@ -21,9 +21,6 @@ func (broker *Broker) getOutMessage(stub shim.ChaincodeStubInterface, args []str
} }
destChainMethod := args[0] destChainMethod := args[0]
sequenceNum := args[1] sequenceNum := args[1]
if !broker.validDID(destChainMethod) {
return ErrInvalidDID(destChainMethod)
}
key := broker.outMsgKey(destChainMethod, sequenceNum) key := broker.outMsgKey(destChainMethod, sequenceNum)
v, err := stub.GetState(key) v, err := stub.GetState(key)
if err != nil { if err != nil {
...@@ -45,12 +42,9 @@ func (broker *Broker) getInMessage(stub shim.ChaincodeStubInterface, args []stri ...@@ -45,12 +42,9 @@ func (broker *Broker) getInMessage(stub shim.ChaincodeStubInterface, args []stri
if len(args) < 2 { if len(args) < 2 {
return shim.Error("incorrect number of arguments, expecting 2") return shim.Error("incorrect number of arguments, expecting 2")
} }
sourceChainMethod := args[0] inServicePair := args[0]
sequenceNum := args[1] sequenceNum := args[1]
if !broker.validDID(sourceChainMethod) { key := broker.inMsgKey(inServicePair, sequenceNum)
return ErrInvalidDID(sourceChainMethod)
}
key := broker.inMsgKey(sourceChainMethod, sequenceNum)
v, err := stub.GetState(key) v, err := stub.GetState(key)
if err != nil { if err != nil {
return shim.Error(err.Error()) return shim.Error(err.Error())
...@@ -66,6 +60,14 @@ func (broker *Broker) getCallbackMeta(stub shim.ChaincodeStubInterface) pb.Respo ...@@ -66,6 +60,14 @@ func (broker *Broker) getCallbackMeta(stub shim.ChaincodeStubInterface) pb.Respo
return shim.Success(v) return shim.Success(v)
} }
func (broker *Broker) getDstRollbackMeta(stub shim.ChaincodeStubInterface) pb.Response {
v, err := stub.GetState(dstRollbackMeta)
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(v)
}
func (broker *Broker) markInCounter(stub shim.ChaincodeStubInterface, from string) error { func (broker *Broker) markInCounter(stub shim.ChaincodeStubInterface, from string) error {
inMeta, err := broker.getMap(stub, innerMeta) inMeta, err := broker.getMap(stub, innerMeta)
if err != nil { if err != nil {
...@@ -86,3 +88,15 @@ func (broker *Broker) markCallbackCounter(stub shim.ChaincodeStubInterface, from ...@@ -86,3 +88,15 @@ func (broker *Broker) markCallbackCounter(stub shim.ChaincodeStubInterface, from
return broker.putMap(stub, callbackMeta, meta) return broker.putMap(stub, callbackMeta, meta)
} }
func (broker *Broker) markDstRollbackCounter(stub shim.ChaincodeStubInterface, from string, index uint64) error {
meta, err := broker.getMap(stub, dstRollbackMeta)
if err != nil {
return err
}
meta[from] = index
return broker.putMap(stub, dstRollbackMeta, meta)
}
...@@ -62,9 +62,9 @@ func (s *DataSwapper) get(stub shim.ChaincodeStubInterface, args []string) pb.Re ...@@ -62,9 +62,9 @@ func (s *DataSwapper) get(stub shim.ChaincodeStubInterface, args []string) pb.Re
return shim.Success(value) return shim.Success(value)
case 2: case 2:
// args[0]: destination appchain contract did // args[0]: destination service id
// args[1]: key // args[1]: key
b := util.ToChaincodeArgs(emitInterchainEventFunc, args[0], "interchainGet", args[2], "interchainSet", args[2], "", "") b := util.ToChaincodeArgs(emitInterchainEventFunc, args[0], "interchainGet,interchainSet,", args[1], args[1], "")
response := stub.InvokeChaincode(brokerContractName, b, channelID) response := stub.InvokeChaincode(brokerContractName, b, channelID)
if response.Status != shim.OK { if response.Status != shim.OK {
return shim.Error(fmt.Errorf("invoke broker chaincode %s error: %s", brokerContractName, response.Message).Error()) return shim.Error(fmt.Errorf("invoke broker chaincode %s error: %s", brokerContractName, response.Message).Error())
......
module github.com/meshplus/data_swapper
go 1.13
require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.29.1 // indirect
github.com/fsouza/go-dockerclient v1.7.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hyperledger/fabric v1.4.3
github.com/hyperledger/fabric-amcl v0.0.0-20210603140002-2670f91851c8 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/onsi/gomega v1.14.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/sykesm/zap-logfmt v0.0.4 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
google.golang.org/grpc v1.39.0 // indirect
)
replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
module github.com/meshplus/transfer
go 1.13
require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.29.1 // indirect
github.com/fsouza/go-dockerclient v1.7.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hyperledger/fabric v1.4.3
github.com/hyperledger/fabric-amcl v0.0.0-20210603140002-2670f91851c8 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/onsi/gomega v1.14.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/sykesm/zap-logfmt v0.0.4 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
google.golang.org/grpc v1.39.0 // indirect
)
replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
...@@ -92,8 +92,7 @@ func (t *Transfer) transfer(stub shim.ChaincodeStubInterface, args []string) pb. ...@@ -92,8 +92,7 @@ func (t *Transfer) transfer(stub shim.ChaincodeStubInterface, args []string) pb.
return shim.Success(nil) return shim.Success(nil)
case 4: case 4:
// args[0]: destination appchain contract did dstServiceID := args[0]
destContractDID := args[0]
sender := args[1] sender := args[1]
receiver := args[2] receiver := args[2]
amountArg := args[3] amountArg := args[3]
...@@ -121,7 +120,7 @@ func (t *Transfer) transfer(stub shim.ChaincodeStubInterface, args []string) pb. ...@@ -121,7 +120,7 @@ func (t *Transfer) transfer(stub shim.ChaincodeStubInterface, args []string) pb.
args := strings.Join([]string{sender, receiver, amountArg}, ",") args := strings.Join([]string{sender, receiver, amountArg}, ",")
argsRb := strings.Join([]string{sender, amountArg}, ",") argsRb := strings.Join([]string{sender, amountArg}, ",")
b := util.ToChaincodeArgs(emitInterchainEventFunc, destContractDID, "interchainCharge", args, "", "", "interchainRollback", argsRb) b := util.ToChaincodeArgs(emitInterchainEventFunc, dstServiceID, "interchainCharge,,interchainRollback", args, "", argsRb)
response := stub.InvokeChaincode(brokerContractName, b, channelID) response := stub.InvokeChaincode(brokerContractName, b, channelID)
if response.Status != shim.OK { if response.Status != shim.OK {
return shim.Error(fmt.Errorf("invoke broker chaincode %s", response.Message).Error()) return shim.Error(fmt.Errorf("invoke broker chaincode %s", response.Message).Error())
......
...@@ -3,26 +3,22 @@ module github.com/meshplus/pier-client-fabric ...@@ -3,26 +3,22 @@ module github.com/meshplus/pier-client-fabric
go 1.13 go 1.13
require ( require (
github.com/OneOfOne/xxhash v1.2.5 // indirect
github.com/Rican7/retry v0.1.0 github.com/Rican7/retry v0.1.0
github.com/VividCortex/gohistogram v1.0.0 // indirect github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/cloudflare/cfssl v0.0.0-20190409034051-768cd563887f github.com/cloudflare/cfssl v0.0.0-20190409034051-768cd563887f
github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa // indirect
github.com/go-logfmt/logfmt v0.4.0 // indirect github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/golang/protobuf v1.4.3 github.com/golang/protobuf v1.5.2
github.com/google/certificate-transparency-go v1.1.0 // indirect github.com/google/certificate-transparency-go v1.1.0 // indirect
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd
github.com/hashicorp/go-plugin v1.3.0 github.com/hashicorp/go-plugin v1.3.0
github.com/hyperledger/fabric v2.0.1+incompatible github.com/hyperledger/fabric v2.0.1+incompatible
github.com/hyperledger/fabric-chaincode-go v0.0.0-20200511190512-bcfeb58dd83a github.com/hyperledger/fabric-chaincode-go v0.0.0-20200511190512-bcfeb58dd83a
github.com/hyperledger/fabric-lib-go v1.0.0 // indirect github.com/hyperledger/fabric-lib-go v1.0.0 // indirect
github.com/hyperledger/fabric-protos-go v0.0.0-20200330074707-cfe579e86986 github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354
github.com/hyperledger/fabric-sdk-go v1.0.0-alpha5 github.com/hyperledger/fabric-sdk-go v1.0.0-alpha5
github.com/meshplus/bitxhub-model v1.2.1-0.20210524073042-f243c2fee25b github.com/meshplus/bitxhub-model v1.2.1-0.20210805064451-03258148acad
github.com/meshplus/bitxid v0.0.0-20210412025850-e0eaf0f9063a github.com/meshplus/pier v1.11.1-0.20210809064238-de527e06d443
github.com/meshplus/pier v1.7.1-0.20210524093640-1337e0a53318
github.com/spf13/viper v1.7.0 github.com/spf13/viper v1.7.0
sigs.k8s.io/yaml v1.2.0 // indirect
) )
replace ( replace (
...@@ -30,5 +26,4 @@ replace ( ...@@ -30,5 +26,4 @@ replace (
github.com/golang/protobuf => github.com/golang/protobuf v1.3.2 github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
github.com/prometheus/client_golang => github.com/prometheus/client_golang v0.9.3 github.com/prometheus/client_golang => github.com/prometheus/client_golang v0.9.3
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884
google.golang.org/protobuf => google.golang.org/protobuf v1.21.0
) )
...@@ -61,6 +61,7 @@ github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrU ...@@ -61,6 +61,7 @@ github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrU
github.com/VictoriaMetrics/fastcache v1.5.3/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE= github.com/VictoriaMetrics/fastcache v1.5.3/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE=
github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw= github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw=
github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8=
github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
...@@ -157,6 +158,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX ...@@ -157,6 +158,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/common-nighthawk/go-figure v0.0.0-20190529165535-67e0ed34491a/go.mod h1:mk5IQ+Y0ZeO87b858TlA645sVcEcbiX6YqP98kt+7+w= github.com/common-nighthawk/go-figure v0.0.0-20190529165535-67e0ed34491a/go.mod h1:mk5IQ+Y0ZeO87b858TlA645sVcEcbiX6YqP98kt+7+w=
github.com/consensys/bavard v0.1.8-0.20210105233146-c16790d2aa8b/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/bavard v0.1.8-0.20210105233146-c16790d2aa8b/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ=
github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ=
github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q=
github.com/consensys/goff v0.3.10/go.mod h1:xTldOBEHmFiYS0gPXd3NsaEqZWlnmeWcRLWgD3ba3xc= github.com/consensys/goff v0.3.10/go.mod h1:xTldOBEHmFiYS0gPXd3NsaEqZWlnmeWcRLWgD3ba3xc=
github.com/consensys/gurvy v0.3.8/go.mod h1:sN75xnsiD593XnhbhvG2PkOy194pZBzqShWF/kwuW/g= github.com/consensys/gurvy v0.3.8/go.mod h1:sN75xnsiD593XnhbhvG2PkOy194pZBzqShWF/kwuW/g=
github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s= github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s=
...@@ -237,6 +240,7 @@ github.com/ethereum/go-ethereum v1.9.18/go.mod h1:JSSTypSMTkGZtAdAChH2wP5dZEvPGh ...@@ -237,6 +240,7 @@ github.com/ethereum/go-ethereum v1.9.18/go.mod h1:JSSTypSMTkGZtAdAChH2wP5dZEvPGh
github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM=
github.com/ethereum/go-ethereum v1.10.2 h1:qRDI7ztIBsAFH0ULVjU+twnRUYV2ApT0XJBdxxaSNzk= github.com/ethereum/go-ethereum v1.10.2 h1:qRDI7ztIBsAFH0ULVjU+twnRUYV2ApT0XJBdxxaSNzk=
github.com/ethereum/go-ethereum v1.10.2/go.mod h1:YmSRTZNqAvVUg3BIG8uhT/BOkFk9+R2iCbxw5zOlnWY= github.com/ethereum/go-ethereum v1.10.2/go.mod h1:YmSRTZNqAvVUg3BIG8uhT/BOkFk9+R2iCbxw5zOlnWY=
github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg=
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 h1:Ghm4eQYC0nEPnSJdVkTrXpu9KtoVCSo1hg7mtI7G9KU= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 h1:Ghm4eQYC0nEPnSJdVkTrXpu9KtoVCSo1hg7mtI7G9KU=
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw=
github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
...@@ -380,6 +384,7 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW ...@@ -380,6 +384,7 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 h1:ur2rms48b3Ep1dxh7aUV2FZEQ8jEVO2F6ILKx8ofkAg= github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 h1:ur2rms48b3Ep1dxh7aUV2FZEQ8jEVO2F6ILKx8ofkAg=
github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0=
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM=
...@@ -523,6 +528,7 @@ github.com/hokaccha/go-prettyjson v0.0.0-20190818114111-108c894c2c0e/go.mod h1:p ...@@ -523,6 +528,7 @@ github.com/hokaccha/go-prettyjson v0.0.0-20190818114111-108c894c2c0e/go.mod h1:p
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag=
...@@ -538,6 +544,7 @@ github.com/hyperledger/fabric v2.1.1+incompatible h1:cYYRv3vVg4kA6DmrixLxwn1nwBE ...@@ -538,6 +544,7 @@ github.com/hyperledger/fabric v2.1.1+incompatible h1:cYYRv3vVg4kA6DmrixLxwn1nwBE
github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a h1:HgdNn3UYz8PdcZrLEk0IsSU4LRHp7yY2rgjIKcSiJaA= github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a h1:HgdNn3UYz8PdcZrLEk0IsSU4LRHp7yY2rgjIKcSiJaA=
github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE= github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE=
github.com/hyperledger/fabric-amcl v0.0.0-20200424173818-327c9e2cf77a/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE= github.com/hyperledger/fabric-amcl v0.0.0-20200424173818-327c9e2cf77a/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE=
github.com/hyperledger/fabric-amcl v0.0.0-20210603140002-2670f91851c8/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE=
github.com/hyperledger/fabric-chaincode-go v0.0.0-20200511190512-bcfeb58dd83a h1:KoFw2HnRfW+EItMP0zvUUl1FGzDb/7O0ov7uXZffQok= github.com/hyperledger/fabric-chaincode-go v0.0.0-20200511190512-bcfeb58dd83a h1:KoFw2HnRfW+EItMP0zvUUl1FGzDb/7O0ov7uXZffQok=
github.com/hyperledger/fabric-chaincode-go v0.0.0-20200511190512-bcfeb58dd83a/go.mod h1:N7H3sA7Tx4k/YzFq7U0EPdqJtqvM4Kild0JoCc7C0Dc= github.com/hyperledger/fabric-chaincode-go v0.0.0-20200511190512-bcfeb58dd83a/go.mod h1:N7H3sA7Tx4k/YzFq7U0EPdqJtqvM4Kild0JoCc7C0Dc=
github.com/hyperledger/fabric-lib-go v1.0.0 h1:UL1w7c9LvHZUSkIvHTDGklxFv2kTeva1QI2emOVc324= github.com/hyperledger/fabric-lib-go v1.0.0 h1:UL1w7c9LvHZUSkIvHTDGklxFv2kTeva1QI2emOVc324=
...@@ -547,6 +554,8 @@ github.com/hyperledger/fabric-protos-go v0.0.0-20191121202242-f5500d5e3e85/go.mo ...@@ -547,6 +554,8 @@ github.com/hyperledger/fabric-protos-go v0.0.0-20191121202242-f5500d5e3e85/go.mo
github.com/hyperledger/fabric-protos-go v0.0.0-20200124220212-e9cfc186ba7b/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/hyperledger/fabric-protos-go v0.0.0-20200124220212-e9cfc186ba7b/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0=
github.com/hyperledger/fabric-protos-go v0.0.0-20200330074707-cfe579e86986 h1:g9tgYXQPZcxRryp2/rutvfSCiiJzHNoyX7JaoXeGkZ8= github.com/hyperledger/fabric-protos-go v0.0.0-20200330074707-cfe579e86986 h1:g9tgYXQPZcxRryp2/rutvfSCiiJzHNoyX7JaoXeGkZ8=
github.com/hyperledger/fabric-protos-go v0.0.0-20200330074707-cfe579e86986/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/hyperledger/fabric-protos-go v0.0.0-20200330074707-cfe579e86986/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0=
github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354 h1:6vLLEpvDbSlmUJFjg1hB5YMBpI+WgKguztlONcAFBoY=
github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0=
github.com/hyperledger/fabric-sdk-go v1.0.0-alpha5 h1:gc6CVOAM6Br4HMfs3N6ZSK9bJdZo4zhiEbrYS8fqVwA= github.com/hyperledger/fabric-sdk-go v1.0.0-alpha5 h1:gc6CVOAM6Br4HMfs3N6ZSK9bJdZo4zhiEbrYS8fqVwA=
github.com/hyperledger/fabric-sdk-go v1.0.0-alpha5/go.mod h1:kqYuM7jCDf1BbXWgbWaevpnlhDii5i4TkGXhfib2epU= github.com/hyperledger/fabric-sdk-go v1.0.0-alpha5/go.mod h1:kqYuM7jCDf1BbXWgbWaevpnlhDii5i4TkGXhfib2epU=
github.com/hyperledger/fabric-sdk-go v1.0.0-beta2 h1:FBYygns0Qga+mQ4PXycyTU5m4N9KAZM+Ttf7agiV7M8= github.com/hyperledger/fabric-sdk-go v1.0.0-beta2 h1:FBYygns0Qga+mQ4PXycyTU5m4N9KAZM+Ttf7agiV7M8=
...@@ -881,6 +890,7 @@ github.com/meshplus/bitxhub-core v0.1.0-rc1.0.20201021153523-274a013bfd41/go.mod ...@@ -881,6 +890,7 @@ github.com/meshplus/bitxhub-core v0.1.0-rc1.0.20201021153523-274a013bfd41/go.mod
github.com/meshplus/bitxhub-core v0.1.0-rc1.0.20210204062242-16739cd5ee9a/go.mod h1:MHf0waxqnW4Qwfpq66jqvJP+FritN5OTs/8wlQcNlJY= github.com/meshplus/bitxhub-core v0.1.0-rc1.0.20210204062242-16739cd5ee9a/go.mod h1:MHf0waxqnW4Qwfpq66jqvJP+FritN5OTs/8wlQcNlJY=
github.com/meshplus/bitxhub-core v1.3.0/go.mod h1:2ksSKEiox4B06gSPT6h4+GcdWnh92/FDPUUImX/dI04= github.com/meshplus/bitxhub-core v1.3.0/go.mod h1:2ksSKEiox4B06gSPT6h4+GcdWnh92/FDPUUImX/dI04=
github.com/meshplus/bitxhub-core v1.3.1-0.20210524071255-789fd9ab501c/go.mod h1:3jozBvAkL1+asOJPvhCouIZoedWnhr79LgDAdX9o95I= github.com/meshplus/bitxhub-core v1.3.1-0.20210524071255-789fd9ab501c/go.mod h1:3jozBvAkL1+asOJPvhCouIZoedWnhr79LgDAdX9o95I=
github.com/meshplus/bitxhub-core v1.3.1-0.20210803021905-6eb15f02fc23/go.mod h1:yP/sWObKXNTovvopImIWNIy50vpdCdlrZkZM1RJoxts=
github.com/meshplus/bitxhub-kit v1.0.0-rc1 h1:gNi8IFU5CMHT3KE2I4ACj5alMW9h/4cV8xOxn7wSmtA= github.com/meshplus/bitxhub-kit v1.0.0-rc1 h1:gNi8IFU5CMHT3KE2I4ACj5alMW9h/4cV8xOxn7wSmtA=
github.com/meshplus/bitxhub-kit v1.0.0-rc1/go.mod h1:ra/AhOkPvpElI+wXrB9G6DjdcrdxFU3vMwA5MYKr9D0= github.com/meshplus/bitxhub-kit v1.0.0-rc1/go.mod h1:ra/AhOkPvpElI+wXrB9G6DjdcrdxFU3vMwA5MYKr9D0=
github.com/meshplus/bitxhub-kit v1.0.0-rc2/go.mod h1:1XDQRhdVkFDwQH3SgKKyy+cpUyfozNmCqrudDXlh2Oo= github.com/meshplus/bitxhub-kit v1.0.0-rc2/go.mod h1:1XDQRhdVkFDwQH3SgKKyy+cpUyfozNmCqrudDXlh2Oo=
...@@ -905,6 +915,8 @@ github.com/meshplus/bitxhub-kit v1.2.0 h1:lG6vyRD14bPoQFNU8ygmgzMXAy4xDlEueJyM6v ...@@ -905,6 +915,8 @@ github.com/meshplus/bitxhub-kit v1.2.0 h1:lG6vyRD14bPoQFNU8ygmgzMXAy4xDlEueJyM6v
github.com/meshplus/bitxhub-kit v1.2.0/go.mod h1:vGTKDkCAU7/IlirT6tlq6BMnCpY9UbfrrwGDy6foQIg= github.com/meshplus/bitxhub-kit v1.2.0/go.mod h1:vGTKDkCAU7/IlirT6tlq6BMnCpY9UbfrrwGDy6foQIg=
github.com/meshplus/bitxhub-kit v1.2.1-0.20210524063043-9afae78ac098 h1:/E1isgGcUXQhTlKgVZ7GULTqw+0mj/WZ1a+Yd5N7Bmg= github.com/meshplus/bitxhub-kit v1.2.1-0.20210524063043-9afae78ac098 h1:/E1isgGcUXQhTlKgVZ7GULTqw+0mj/WZ1a+Yd5N7Bmg=
github.com/meshplus/bitxhub-kit v1.2.1-0.20210524063043-9afae78ac098/go.mod h1:wrEdhHp1tktzdwcWb4bOxYsVc+KkcrYL18IYWYeumPQ= github.com/meshplus/bitxhub-kit v1.2.1-0.20210524063043-9afae78ac098/go.mod h1:wrEdhHp1tktzdwcWb4bOxYsVc+KkcrYL18IYWYeumPQ=
github.com/meshplus/bitxhub-kit v1.2.1-0.20210616114532-4849447f09e1 h1:rLkrRvNOduKx+w3sGxNQIUCFf2Qu6d/mvTCGZjsfVZw=
github.com/meshplus/bitxhub-kit v1.2.1-0.20210616114532-4849447f09e1/go.mod h1:wrEdhHp1tktzdwcWb4bOxYsVc+KkcrYL18IYWYeumPQ=
github.com/meshplus/bitxhub-model v1.0.0-rc3/go.mod h1:ZCctQIYTlE3vJ8Lhkrgs9bWwNA+Dw4JzojOSIzLVU6E= github.com/meshplus/bitxhub-model v1.0.0-rc3/go.mod h1:ZCctQIYTlE3vJ8Lhkrgs9bWwNA+Dw4JzojOSIzLVU6E=
github.com/meshplus/bitxhub-model v1.0.0-rc4.0.20200429111056-62b55c3d4260 h1:C82XmTofR2/R/1rafiwjLkgTvzPN/0cOQHBbpxEXUyY= github.com/meshplus/bitxhub-model v1.0.0-rc4.0.20200429111056-62b55c3d4260 h1:C82XmTofR2/R/1rafiwjLkgTvzPN/0cOQHBbpxEXUyY=
github.com/meshplus/bitxhub-model v1.0.0-rc4.0.20200429111056-62b55c3d4260/go.mod h1:QK8aACbxtZEA3Hk1BOCirW0uxMWLsMrLDpWz9FweIKM= github.com/meshplus/bitxhub-model v1.0.0-rc4.0.20200429111056-62b55c3d4260/go.mod h1:QK8aACbxtZEA3Hk1BOCirW0uxMWLsMrLDpWz9FweIKM=
...@@ -930,6 +942,10 @@ github.com/meshplus/bitxhub-model v1.2.1-0.20210512070527-c3a68359d36c/go.mod h1 ...@@ -930,6 +942,10 @@ github.com/meshplus/bitxhub-model v1.2.1-0.20210512070527-c3a68359d36c/go.mod h1
github.com/meshplus/bitxhub-model v1.2.1-0.20210524063354-5d48e2fee178/go.mod h1:vwJ+sHPUyA2JELmUUDBol+7zA+7GcqutxzqXjsN0QLA= github.com/meshplus/bitxhub-model v1.2.1-0.20210524063354-5d48e2fee178/go.mod h1:vwJ+sHPUyA2JELmUUDBol+7zA+7GcqutxzqXjsN0QLA=
github.com/meshplus/bitxhub-model v1.2.1-0.20210524073042-f243c2fee25b h1:X3USIatxU/mMy4P7y9/x6ONDHm3CFEgfTyHo4KGAt2o= github.com/meshplus/bitxhub-model v1.2.1-0.20210524073042-f243c2fee25b h1:X3USIatxU/mMy4P7y9/x6ONDHm3CFEgfTyHo4KGAt2o=
github.com/meshplus/bitxhub-model v1.2.1-0.20210524073042-f243c2fee25b/go.mod h1:vwJ+sHPUyA2JELmUUDBol+7zA+7GcqutxzqXjsN0QLA= github.com/meshplus/bitxhub-model v1.2.1-0.20210524073042-f243c2fee25b/go.mod h1:vwJ+sHPUyA2JELmUUDBol+7zA+7GcqutxzqXjsN0QLA=
github.com/meshplus/bitxhub-model v1.2.1-0.20210629020432-d98febd566c1/go.mod h1:IjgoQrsn1wthW7XcKRqgaZqCSlqNy0SBwF/7lmGSqXc=
github.com/meshplus/bitxhub-model v1.2.1-0.20210728034727-3e559aabfbe3/go.mod h1:IjgoQrsn1wthW7XcKRqgaZqCSlqNy0SBwF/7lmGSqXc=
github.com/meshplus/bitxhub-model v1.2.1-0.20210805064451-03258148acad h1:bB1ozZF+B5G0iiJ1eJ+NSeO+ckKTzTXYCGUurDT1mg4=
github.com/meshplus/bitxhub-model v1.2.1-0.20210805064451-03258148acad/go.mod h1:IjgoQrsn1wthW7XcKRqgaZqCSlqNy0SBwF/7lmGSqXc=
github.com/meshplus/bitxid v0.0.0-20210331074321-62187b1145f5 h1:AIK+w1w46SDjf3BGQstCnzoLRK1OeDullbaATaXbTHc= github.com/meshplus/bitxid v0.0.0-20210331074321-62187b1145f5 h1:AIK+w1w46SDjf3BGQstCnzoLRK1OeDullbaATaXbTHc=
github.com/meshplus/bitxid v0.0.0-20210331074321-62187b1145f5/go.mod h1:vAldSRfDe2Qo7exsSTbchVmZWXPY7fhWQrRw18QJHho= github.com/meshplus/bitxid v0.0.0-20210331074321-62187b1145f5/go.mod h1:vAldSRfDe2Qo7exsSTbchVmZWXPY7fhWQrRw18QJHho=
github.com/meshplus/bitxid v0.0.0-20210412025850-e0eaf0f9063a h1:c4ESPDa60Jd4zfzZIGGTyzhfaVM3vKN+xV2G9BwIDGQ= github.com/meshplus/bitxid v0.0.0-20210412025850-e0eaf0f9063a h1:c4ESPDa60Jd4zfzZIGGTyzhfaVM3vKN+xV2G9BwIDGQ=
...@@ -941,6 +957,7 @@ github.com/meshplus/go-bitxhub-client v1.0.0-rc4.0.20200731031000-ec0387c42327/g ...@@ -941,6 +957,7 @@ github.com/meshplus/go-bitxhub-client v1.0.0-rc4.0.20200731031000-ec0387c42327/g
github.com/meshplus/go-bitxhub-client v1.0.0-rc4.0.20201023092924-5f9a248146f9/go.mod h1:6e0wKF//AwnJPlzXsfl5EDLRzn+/Wt8+fOEbKsYSFlc= github.com/meshplus/go-bitxhub-client v1.0.0-rc4.0.20201023092924-5f9a248146f9/go.mod h1:6e0wKF//AwnJPlzXsfl5EDLRzn+/Wt8+fOEbKsYSFlc=
github.com/meshplus/go-bitxhub-client v1.0.0-rc4.0.20210301024916-b7461066a067/go.mod h1:ZWklYGrAMQcknmMMyxZtRU1IiBRuoYy570QNTp3WJbI= github.com/meshplus/go-bitxhub-client v1.0.0-rc4.0.20210301024916-b7461066a067/go.mod h1:ZWklYGrAMQcknmMMyxZtRU1IiBRuoYy570QNTp3WJbI=
github.com/meshplus/go-bitxhub-client v1.3.0/go.mod h1:oeX3NbSpHGsc3v2ZSAaYc+WbG9+eKhYLjGCvX/KEmhU= github.com/meshplus/go-bitxhub-client v1.3.0/go.mod h1:oeX3NbSpHGsc3v2ZSAaYc+WbG9+eKhYLjGCvX/KEmhU=
github.com/meshplus/go-bitxhub-client v1.3.1-0.20210701063659-a0836fbc1c78/go.mod h1:etPPxsG4sQV0QWuVHLWrMPtTQbkt2LCccOa3yDyKIHo=
github.com/meshplus/go-lightp2p v0.0.0-20200817105923-6b3aee40fa54/go.mod h1:G89UJaeqCQFxFdp8wzy1AdKfMtDEhpySau0pjDNeeaw= github.com/meshplus/go-lightp2p v0.0.0-20200817105923-6b3aee40fa54/go.mod h1:G89UJaeqCQFxFdp8wzy1AdKfMtDEhpySau0pjDNeeaw=
github.com/meshplus/pier v1.0.0-rc1.0.20200707085406-951dc93be28b h1:2w2wGZ1XSHosf5vQDP3hE5LbLqRJusXJAW99oX/MrH4= github.com/meshplus/pier v1.0.0-rc1.0.20200707085406-951dc93be28b h1:2w2wGZ1XSHosf5vQDP3hE5LbLqRJusXJAW99oX/MrH4=
github.com/meshplus/pier v1.0.0-rc1.0.20200707085406-951dc93be28b/go.mod h1:nRBB9WTl9/mdDlUutQKNh4qkVN3QQWJEM5B+RUxhO8w= github.com/meshplus/pier v1.0.0-rc1.0.20200707085406-951dc93be28b/go.mod h1:nRBB9WTl9/mdDlUutQKNh4qkVN3QQWJEM5B+RUxhO8w=
...@@ -962,6 +979,8 @@ github.com/meshplus/pier v1.7.1-0.20210520094508-a8b2d96fd5c5 h1:rgD8Sr6K3r5+X7k ...@@ -962,6 +979,8 @@ github.com/meshplus/pier v1.7.1-0.20210520094508-a8b2d96fd5c5 h1:rgD8Sr6K3r5+X7k
github.com/meshplus/pier v1.7.1-0.20210520094508-a8b2d96fd5c5/go.mod h1:jp2TrTX5iKXEA0UHFyCA62t6vfbogd3rNR/qagfAgNI= github.com/meshplus/pier v1.7.1-0.20210520094508-a8b2d96fd5c5/go.mod h1:jp2TrTX5iKXEA0UHFyCA62t6vfbogd3rNR/qagfAgNI=
github.com/meshplus/pier v1.7.1-0.20210524093640-1337e0a53318 h1:On8bT4A8mldYLx2ljJyd1DQ/mHmqKgIiOPBCKEhie3o= github.com/meshplus/pier v1.7.1-0.20210524093640-1337e0a53318 h1:On8bT4A8mldYLx2ljJyd1DQ/mHmqKgIiOPBCKEhie3o=
github.com/meshplus/pier v1.7.1-0.20210524093640-1337e0a53318/go.mod h1:lRpgDnF72/wpQTBIp5eLxiv5YxLe+XhefYgPyFLN4/4= github.com/meshplus/pier v1.7.1-0.20210524093640-1337e0a53318/go.mod h1:lRpgDnF72/wpQTBIp5eLxiv5YxLe+XhefYgPyFLN4/4=
github.com/meshplus/pier v1.11.1-0.20210809064238-de527e06d443 h1:MPDYVXTHx0HZO9rPlGEzOxgSe3o8cxr4HeVelH5XlKY=
github.com/meshplus/pier v1.11.1-0.20210809064238-de527e06d443/go.mod h1:hklBupF/Wo2k2+LG2dpR0KTR83kvLnYNUpjsdq/a7UI=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
...@@ -1205,6 +1224,7 @@ github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4 ...@@ -1205,6 +1224,7 @@ github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4
github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc=
github.com/shirou/gopsutil v2.20.5+incompatible h1:tYH07UPoQt0OCQdgWWMgYHy3/a9bcxNpBIysykNIP7I= github.com/shirou/gopsutil v2.20.5+incompatible h1:tYH07UPoQt0OCQdgWWMgYHy3/a9bcxNpBIysykNIP7I=
github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
...@@ -1220,6 +1240,8 @@ github.com/sirupsen/logrus v1.5.0 h1:1N5EYkVAPEywqZRJd7cwnRtCb6xJx7NH3T3WUTF980Q ...@@ -1220,6 +1240,8 @@ github.com/sirupsen/logrus v1.5.0 h1:1N5EYkVAPEywqZRJd7cwnRtCb6xJx7NH3T3WUTF980Q
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
...@@ -1286,6 +1308,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s ...@@ -1286,6 +1308,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/sykesm/zap-logfmt v0.0.3 h1:3Wrhf7+I9JEUD8B6KPtDAr9j2jrS0/EPLy7GCE1t/+U= github.com/sykesm/zap-logfmt v0.0.3 h1:3Wrhf7+I9JEUD8B6KPtDAr9j2jrS0/EPLy7GCE1t/+U=
github.com/sykesm/zap-logfmt v0.0.3/go.mod h1:AuBd9xQjAe3URrWT1BBDk2v2onAZHkZkWRMiYZXiZWA= github.com/sykesm/zap-logfmt v0.0.3/go.mod h1:AuBd9xQjAe3URrWT1BBDk2v2onAZHkZkWRMiYZXiZWA=
github.com/sykesm/zap-logfmt v0.0.4 h1:U2WzRvmIWG1wDLCFY3sz8UeEmsdHQjHFNlIdmroVFaI=
github.com/sykesm/zap-logfmt v0.0.4/go.mod h1:AuBd9xQjAe3URrWT1BBDk2v2onAZHkZkWRMiYZXiZWA=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
...@@ -1313,6 +1337,8 @@ github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4C ...@@ -1313,6 +1337,8 @@ github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4C
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/tjfoc/gmsm v1.3.0/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w= github.com/tjfoc/gmsm v1.3.0/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4=
...@@ -1343,6 +1369,7 @@ github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOV ...@@ -1343,6 +1369,7 @@ github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOV
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE= github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE=
github.com/wasmerio/go-ext-wasm v0.3.1/go.mod h1:VGyarTzasuS7k5KhSIGpM3tciSZlkP31Mp9VJTHMMeI= github.com/wasmerio/go-ext-wasm v0.3.1/go.mod h1:VGyarTzasuS7k5KhSIGpM3tciSZlkP31Mp9VJTHMMeI=
github.com/wasmerio/wasmer-go v1.0.3/go.mod h1:0gzVdSfg6pysA6QVp6iVRPTagC6Wq9pOE8J86WKb2Fk=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE= github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE=
...@@ -1430,6 +1457,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh ...@@ -1430,6 +1457,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
...@@ -1465,6 +1494,7 @@ golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hM ...@@ -1465,6 +1494,7 @@ golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hM
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
...@@ -1512,6 +1542,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R ...@@ -1512,6 +1542,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d h1:1aflnvSoWWLI2k/dMUAl5lvU1YO4Mb4hz0gh+1rjcxU= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d h1:1aflnvSoWWLI2k/dMUAl5lvU1YO4Mb4hz0gh+1rjcxU=
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
...@@ -1528,6 +1560,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ ...@@ -1528,6 +1560,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
...@@ -1588,8 +1621,13 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w ...@@ -1588,8 +1621,13 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 h1:vRgIt+nup/B/BwIS0g2oC0haq0iqbV3ZA+u6+0TlNCo= golang.org/x/sys v0.0.0-20201223074533-0d417f636930 h1:vRgIt+nup/B/BwIS0g2oC0haq0iqbV3ZA+u6+0TlNCo=
golang.org/x/sys v0.0.0-20201223074533-0d417f636930/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201223074533-0d417f636930/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210105210732-16f7687f5001/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210105210732-16f7687f5001/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988 h1:EjgCl+fVlIaPJSori0ikSz3uV0DOHKWOJFpv1sAAhBM=
golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
...@@ -1667,6 +1705,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY ...@@ -1667,6 +1705,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20201009162240-fcf82128ed91/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201009162240-fcf82128ed91/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ= golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
...@@ -1823,6 +1862,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh ...@@ -1823,6 +1862,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo=
......
...@@ -2,14 +2,13 @@ package main ...@@ -2,14 +2,13 @@ package main
import ( import (
"fmt" "fmt"
"time"
"github.com/meshplus/bitxhub-model/pb" "github.com/meshplus/bitxhub-model/pb"
) )
func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte, status bool) (result *pb.IBTP, err error) { func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, status bool) (result *pb.IBTP, err error) {
if original == nil { if original == nil {
return nil, fmt.Errorf("got nil ibtp to generate receipt: %w", err) return nil, fmt.Errorf("got nil ibtp To generate receipt: %w", err)
} }
pd := &pb.Payload{} pd := &pb.Payload{}
if err := pd.Unmarshal(original.Payload); err != nil { if err := pd.Unmarshal(original.Payload); err != nil {
...@@ -20,10 +19,9 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte ...@@ -20,10 +19,9 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte
if err := originalContent.Unmarshal(pd.Content); err != nil { if err := originalContent.Unmarshal(pd.Content); err != nil {
return nil, fmt.Errorf("ibtp payload unmarshal: %w", err) return nil, fmt.Errorf("ibtp payload unmarshal: %w", err)
} }
content := &pb.Content{
SrcContractId: originalContent.DstContractId, content := &pb.Content{}
DstContractId: originalContent.SrcContractId, typ := pb.IBTP_RECEIPT_SUCCESS
}
if status { if status {
content.Func = originalContent.Callback content.Func = originalContent.Callback
...@@ -31,6 +29,11 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte ...@@ -31,6 +29,11 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte
} else { } else {
content.Func = originalContent.Rollback content.Func = originalContent.Rollback
content.Args = originalContent.ArgsRb content.Args = originalContent.ArgsRb
typ = pb.IBTP_RECEIPT_FAILURE
}
if original.Type == pb.IBTP_ROLLBACK {
typ = pb.IBTP_RECEIPT_ROLLBACK
} }
b, err := content.Marshal() b, err := content.Marshal()
...@@ -46,19 +49,13 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte ...@@ -46,19 +49,13 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte
return nil, err return nil, err
} }
typ := pb.IBTP_RECEIPT_SUCCESS
if !status {
typ = pb.IBTP_RECEIPT_FAILURE
}
return &pb.IBTP{ return &pb.IBTP{
From: original.From, From: original.From,
To: original.To, To: original.To,
Index: original.Index, Index: original.Index,
Type: typ, Type: typ,
Timestamp: time.Now().UnixNano(), Proof: original.Proof,
Proof: proof, Payload: pdb,
Payload: pdb, Version: original.Version,
Version: original.Version,
}, nil }, 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