Commit 65c121b8 authored by suyanlong's avatar suyanlong

update CI and update makefile and update source file

parent 560a6263
Pipeline #8003 canceled with stages
Language: 'Proto'
BasedOnStyle: 'LLVM'
AccessModifierOffset: '-1'
AlignAfterOpenBracket: 'Align'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlinesLeft: 'true'
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'true'
AllowShortCaseLabelsOnASingleLine: 'true'
ColumnLimit: '200'
IndentWidth: '4'
ContinuationIndentWidth: '4'
TabWidth: '4'
TabWidth: '4'
ReflowComments: 'true'
SortIncludes: 'true'
AllowShortFunctionsOnASingleLine: 'Empty'
AllowShortIfStatementsOnASingleLine: 'true'
...@@ -11,7 +11,7 @@ stages: ...@@ -11,7 +11,7 @@ stages:
build: build:
stage: build stage: build
script: script:
- make fmt - make check
- make build - make build
test: test:
......
...@@ -38,7 +38,7 @@ GREEN=\033[0;32m ...@@ -38,7 +38,7 @@ GREEN=\033[0;32m
BLUE=\033[0;34m BLUE=\033[0;34m
NC=\033[0m NC=\033[0m
.PHONY: test .PHONY: test fmt_proto fmt_shell check checkgofmt
help: Makefile help: Makefile
@echo "Choose a command run:" @echo "Choose a command run:"
...@@ -107,9 +107,19 @@ linter: ...@@ -107,9 +107,19 @@ linter:
golangci-lint run golangci-lint run
golangci-lint run -E goimports -E bodyclose --skip-dirs-use-default golangci-lint run -E goimports -E bodyclose --skip-dirs-use-default
fmt: fmt_proto: ## go fmt protobuf file
go fmt ./... @find . -name '*.proto' -not -path "./vendor/*" | xargs clang-format -i
fmt_shell: ## check shell file
@find . -name '*.sh' -not -path "./vendor/*" | xargs shfmt -w -s -i 4 -ci -bn
fmt_go: fmt_shell ## go fmt
@go fmt ./...
@find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
fmt: fmt_proto fmt_shell ## go fmt
@go fmt ./...
@find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
all: pb grpc all: pb grpc
...@@ -142,3 +152,32 @@ grpc: ...@@ -142,3 +152,32 @@ grpc:
clean: clean:
@go clean @go clean
build-dep:
@go install golang.org/x/tools/cmd/goimports@latest
@go install github.com/suyanlong/aligner@latest
@go install mvdan.cc/gofumpt@latest
@go install mvdan.cc/sh/v3/cmd/shfmt@latest
@go install mvdan.cc/sh/v3/cmd/gosh@latest
# @apt install clang-format or brew isntall clang-format
# @apt install shellcheck or brew install shellcheck
aligner:
@aligner -r -c "//" -e ".go" -i ./internal/repo/a_repo-packr.go comment
aligner-check:
@aligner -r -c "//" -e ".go" -i ./internal/repo/a_repo-packr.go check
checkgofmt: ## get all go files and run go fmt on them
@files=$$(find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -l -s); if [ -n "$$files" ]; then \
echo "Error: 'make fmt' needs to be run on:"; \
find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -l -s ;\
exit 1; \
fi;
@files=$$(find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w); if [ -n "$$files" ]; then \
echo "Error: 'make fmt' needs to be run on:"; \
find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w ;\
exit 1; \
fi;
check: aligner-check checkgofmt
package exchanger package exchanger
import ( import (
"github.com/link33/sidecar/model/pb"
"sync" "sync"
"github.com/link33/sidecar/model/pb"
) )
type Pool struct { type Pool struct {
......
package loggers package loggers
import ( import (
"github.com/stretchr/testify/require"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/link33/sidecar/internal/repo" "github.com/link33/sidecar/internal/repo"
) )
......
...@@ -2,6 +2,7 @@ package manger ...@@ -2,6 +2,7 @@ package manger
import ( import (
"encoding/json" "encoding/json"
"github.com/meshplus/bitxhub-core/governance" "github.com/meshplus/bitxhub-core/governance"
"github.com/meshplus/bitxhub-kit/storage" "github.com/meshplus/bitxhub-kit/storage"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
......
...@@ -2,6 +2,7 @@ package peermgr ...@@ -2,6 +2,7 @@ package peermgr
import ( import (
"errors" "errors"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
......
...@@ -2,6 +2,7 @@ package txcrypto ...@@ -2,6 +2,7 @@ package txcrypto
import ( import (
"fmt" "fmt"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr" appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/btcec"
......
...@@ -5,10 +5,11 @@ package pb ...@@ -5,10 +5,11 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,10 +5,11 @@ package pb ...@@ -5,10 +5,11 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,12 +5,13 @@ package pb ...@@ -5,12 +5,13 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -7,19 +7,19 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; ...@@ -7,19 +7,19 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message Block { message Block {
BlockHeader block_header = 1; BlockHeader block_header = 1;
bytes transactions = 2 [(gogoproto.customtype) = "Transactions"]; // transaction set bytes transactions = 2 [ (gogoproto.customtype) = "Transactions" ]; // transaction set
bytes block_hash = 3 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes block_hash = 3 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes signature = 4; bytes signature = 4;
bytes extra = 5; bytes extra = 5;
} }
message BlockHeader { message BlockHeader {
uint64 number = 1; uint64 number = 1;
bytes state_root = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes state_root = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes tx_root = 3 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes tx_root = 3 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes receipt_root = 4 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes receipt_root = 4 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes parent_hash = 5 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes parent_hash = 5 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
int64 timestamp = 6; int64 timestamp = 6;
bytes version = 7; bytes version = 7;
bytes Bloom = 8 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Bloom"]; bytes Bloom = 8 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Bloom" ];
} }
\ No newline at end of file
...@@ -6,6 +6,10 @@ package pb ...@@ -6,6 +6,10 @@ package pb
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types" github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
...@@ -13,9 +17,6 @@ import ( ...@@ -13,9 +17,6 @@ import (
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -10,128 +10,128 @@ import "block.proto"; ...@@ -10,128 +10,128 @@ import "block.proto";
import "chain.proto"; import "chain.proto";
service ChainBroker { service ChainBroker {
rpc Subscribe (SubscriptionRequest) returns (stream Response) { rpc Subscribe(SubscriptionRequest) returns (stream Response) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/subscription" get : "/v1/subscription"
}; };
} }
rpc GetBlockHeader (GetBlockHeaderRequest) returns (stream pb.BlockHeader) { rpc GetBlockHeader(GetBlockHeaderRequest) returns (stream pb.BlockHeader) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/block_header" get : "/v1/block_header"
}; };
} }
rpc GetInterchainTxWrappers (GetInterchainTxWrappersRequest) returns (stream InterchainTxWrappers) { rpc GetInterchainTxWrappers(GetInterchainTxWrappersRequest) returns (stream InterchainTxWrappers) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/interchain_tx_wrappers" get : "/v1/interchain_tx_wrappers"
}; };
} }
rpc SendTransaction (pb.BxhTransaction) returns (TransactionHashMsg) { rpc SendTransaction(pb.BxhTransaction) returns (TransactionHashMsg) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/transaction" post : "/v1/transaction"
body: "*" body : "*"
}; };
} }
rpc SendView (pb.BxhTransaction) returns (pb.Receipt) { rpc SendView(pb.BxhTransaction) returns (pb.Receipt) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/view" post : "/v1/view"
body: "*" body : "*"
}; };
} }
rpc GetTransaction (TransactionHashMsg) returns (GetTransactionResponse) { rpc GetTransaction(TransactionHashMsg) returns (GetTransactionResponse) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/transaction/{tx_hash}" get : "/v1/transaction/{tx_hash}"
}; };
} }
rpc GetReceipt (TransactionHashMsg) returns (pb.Receipt) { rpc GetReceipt(TransactionHashMsg) returns (pb.Receipt) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/receipt/{tx_hash}" get : "/v1/receipt/{tx_hash}"
}; };
} }
rpc GetBlock (GetBlockRequest) returns (pb.Block) { rpc GetBlock(GetBlockRequest) returns (pb.Block) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/block" get : "/v1/block"
}; };
} }
rpc GetBlocks (GetBlocksRequest) returns (GetBlocksResponse) { rpc GetBlocks(GetBlocksRequest) returns (GetBlocksResponse) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/blocks" get : "/v1/blocks"
}; };
} }
rpc GetBlockHeaders (GetBlockHeadersRequest) returns (GetBlockHeadersResponse) { rpc GetBlockHeaders(GetBlockHeadersRequest) returns (GetBlockHeadersResponse) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/block_headers" get : "/v1/block_headers"
}; };
} }
rpc GetChainMeta (Request) returns (pb.ChainMeta) { rpc GetChainMeta(Request) returns (pb.ChainMeta) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/chain_meta" get : "/v1/chain_meta"
}; };
} }
rpc GetInfo (Request) returns (Response) { rpc GetInfo(Request) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/info" get : "/v1/info"
}; };
} }
rpc GetAccountBalance (Address) returns (Response) { rpc GetAccountBalance(Address) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/account_balance/{address}" get : "/v1/account_balance/{address}"
}; };
} }
rpc GetMultiSigns (GetMultiSignsRequest) returns (SignResponse) { rpc GetMultiSigns(GetMultiSignsRequest) returns (SignResponse) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/multi_sign/{content}" get : "/v1/multi_sign/{content}"
}; };
} }
rpc GetTPS(GetTPSRequest) returns (Response) { rpc GetTPS(GetTPSRequest) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/tps/{begin}/{end}" get : "/v1/tps/{begin}/{end}"
}; };
} }
rpc GetPendingNonceByAccount(Address) returns (Response) { rpc GetPendingNonceByAccount(Address) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/pendingNonce/{address}" get : "/v1/pendingNonce/{address}"
}; };
} }
rpc DelVPNode(DelVPNodeRequest) returns (Response) { rpc DelVPNode(DelVPNodeRequest) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/delvpnode" post : "/v1/delvpnode"
body: "*" body : "*"
}; };
} }
rpc CheckMasterSidecar (Address) returns (Response) { rpc CheckMasterSidecar(Address) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
get: "/v1/check_master_sidecar/{address}" get : "/v1/check_master_sidecar/{address}"
}; };
} }
rpc SetMasterSidecar (SidecarInfo) returns (Response) { rpc SetMasterSidecar(SidecarInfo) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/set_master_sidecar" post : "/v1/set_master_sidecar"
body: "*" body : "*"
}; };
} }
rpc HeartBeat (SidecarInfo) returns (Response) { rpc HeartBeat(SidecarInfo) returns (Response) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/heart_beat" post : "/v1/heart_beat"
body: "*" body : "*"
}; };
} }
} }
...@@ -233,7 +233,7 @@ message VerifiedTx { ...@@ -233,7 +233,7 @@ message VerifiedTx {
} }
message InterchainTxWrapper { message InterchainTxWrapper {
repeated bytes l2Roots = 1 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; repeated bytes l2Roots = 1 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
repeated VerifiedTx transactions = 2; repeated VerifiedTx transactions = 2;
uint64 height = 3; uint64 height = 3;
} }
......
...@@ -5,12 +5,13 @@ package pb ...@@ -5,12 +5,13 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -8,10 +8,10 @@ import "ibtp.proto"; ...@@ -8,10 +8,10 @@ import "ibtp.proto";
message BxhTransaction { message BxhTransaction {
bytes version = 1; bytes version = 1;
bytes from = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address"]; bytes from = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address" ];
bytes to = 3 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address"]; bytes to = 3 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address" ];
int64 timestamp = 4; int64 timestamp = 4;
bytes transaction_hash = 5 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes transaction_hash = 5 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes payload = 6; bytes payload = 6;
pb.IBTP IBTP = 7; pb.IBTP IBTP = 7;
uint64 nonce = 8; uint64 nonce = 8;
......
...@@ -5,12 +5,13 @@ package pb ...@@ -5,12 +5,13 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -6,6 +6,6 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; ...@@ -6,6 +6,6 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message ChainMeta { message ChainMeta {
uint64 height = 1; uint64 height = 1;
bytes block_hash = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes block_hash = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
uint64 interchain_tx_count = 3; uint64 interchain_tx_count = 3;
} }
\ No newline at end of file
...@@ -5,10 +5,11 @@ package pb ...@@ -5,10 +5,11 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,10 +5,11 @@ package pb ...@@ -5,10 +5,11 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,10 +5,11 @@ package pb ...@@ -5,10 +5,11 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -2,16 +2,16 @@ syntax = "proto3"; ...@@ -2,16 +2,16 @@ syntax = "proto3";
package pb; package pb;
//import "basic.proto"; // import "basic.proto";
import "ibtp.proto"; import "ibtp.proto";
message IBTPX { message IBTPX {
IBTP ibtp = 1; IBTP ibtp = 1;
// route mode // route mode
string mode = 2; //dirct、relay string mode = 2; // dirct、relay
repeated string routeSign = 3;//路由节点签名路径,主要是对data hash签名,主要是相互校验。sidecar节点之间相互校验。sidecar 节点需要注册到中继连上。还可以过滤已经发送过的交易、也可以作恶惩罚。 repeated string routeSign = 3; //路由节点签名路径,主要是对data hash签名,主要是相互校验。sidecar节点之间相互校验。sidecar 节点需要注册到中继连上。还可以过滤已经发送过的交易、也可以作恶惩罚。
string routeMethod = 4;//single、multicast、broadcast、 string routeMethod = 4; // single、multicast、broadcast、
repeated string routeMethodArg = 5;//路由节点,默认第一个节点。或者转发消息。 repeated string routeMethodArg = 5; //路由节点,默认第一个节点。或者转发消息。
bool IsValid = 6; bool IsValid = 6;
} }
// 若目的地址to不在路由表中,则使用如下规则,即routeRule如下值时。 // 若目的地址to不在路由表中,则使用如下规则,即routeRule如下值时。
...@@ -22,4 +22,3 @@ message IBTPX { ...@@ -22,4 +22,3 @@ message IBTPX {
// broadcast:广播所有的给所有的peer。 // broadcast:广播所有的给所有的peer。
// 设置节点筛选器,根据标签。 // 设置节点筛选器,根据标签。
// 不需要指定节点ID, // 不需要指定节点ID,
...@@ -5,12 +5,13 @@ package pb ...@@ -5,12 +5,13 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -7,7 +7,7 @@ import "basic.proto"; ...@@ -7,7 +7,7 @@ import "basic.proto";
message InterchainMetaS { message InterchainMetaS {
StringVerifiedIndexSliceMap counter = 1; StringVerifiedIndexSliceMap counter = 1;
repeated bytes l2Roots = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; repeated bytes l2Roots = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
} }
message InterchainS { message InterchainS {
......
...@@ -5,10 +5,11 @@ package pb ...@@ -5,10 +5,11 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -28,9 +28,7 @@ message Pack { ...@@ -28,9 +28,7 @@ message Pack {
bytes data = 2; bytes data = 2;
} }
message PeerInfo { message PeerInfo {
string ID = 1; string ID = 1;
string Tag = 2; string Tag = 2;
} }
...@@ -6,13 +6,14 @@ package pb ...@@ -6,13 +6,14 @@ package pb
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -28,13 +28,13 @@ message RollbackIBTPResponse { ...@@ -28,13 +28,13 @@ message RollbackIBTPResponse {
} }
message GetOutMessageRequest { message GetOutMessageRequest {
string to =1; string to = 1;
uint64 idx =2; uint64 idx = 2;
} }
message GetInMessageRequest { message GetInMessageRequest {
string from =1; string from = 1;
uint64 idx =2; uint64 idx = 2;
} }
message GetInMessageResponse { message GetInMessageResponse {
......
...@@ -5,12 +5,13 @@ package pb ...@@ -5,12 +5,13 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_meshplus_bitxhub_kit_types "github.com/meshplus/bitxhub-kit/types"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -10,14 +10,14 @@ message Receipt { ...@@ -10,14 +10,14 @@ message Receipt {
FAILED = 1; FAILED = 1;
} }
bytes version = 1; bytes version = 1;
bytes tx_hash = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes tx_hash = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes ret = 3; bytes ret = 3;
Status status = 4; Status status = 4;
repeated Event events = 5; repeated Event events = 5;
uint64 gas_used = 6; uint64 gas_used = 6;
repeated EvmLog evm_logs = 7; repeated EvmLog evm_logs = 7;
bytes bloom = 8 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Bloom"]; bytes bloom = 8 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Bloom" ];
bytes contract_address = 9 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address"]; bytes contract_address = 9 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address" ];
} }
message Receipts { message Receipts {
...@@ -26,26 +26,26 @@ message Receipts { ...@@ -26,26 +26,26 @@ message Receipts {
message Event { message Event {
// Transaction Hash // Transaction Hash
bytes tx_hash = 1 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes tx_hash = 1 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes data = 2; bytes data = 2;
// The interchain flag used by interchain contract // The interchain flag used by interchain contract
bool interchain = 3; bool interchain = 3;
} }
message EvmLog { message EvmLog {
bytes address = 1 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address"]; bytes address = 1 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address" ];
repeated bytes topics = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; repeated bytes topics = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes data = 3; bytes data = 3;
uint64 block_number = 4; uint64 block_number = 4;
bytes tx_hash = 5 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes tx_hash = 5 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
uint64 tx_index = 6; uint64 tx_index = 6;
bytes block_hash = 7 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"]; bytes block_hash = 7 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
uint64 index = 8; uint64 index = 8;
......
...@@ -5,10 +5,11 @@ package pb ...@@ -5,10 +5,11 @@ package pb
import ( import (
fmt "fmt" fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -6,7 +6,7 @@ source x.sh ...@@ -6,7 +6,7 @@ source x.sh
# $1 is arch, $2 is source code path # $1 is arch, $2 is source code path
case $1 in case $1 in
linux-amd64) linux-amd64)
print_blue "Compile for linux/amd64" print_blue "Compile for linux/amd64"
docker run -t \ docker run -t \
-v $2:/code/sidecar \ -v $2:/code/sidecar \
...@@ -27,7 +27,7 @@ linux-amd64) ...@@ -27,7 +27,7 @@ linux-amd64)
cp /code/sidecar-client-fabric/build/fabric-client-1.4.so /code/sidecar/bin/sidecar-fabric-linux.so && cp /code/sidecar-client-fabric/build/fabric-client-1.4.so /code/sidecar/bin/sidecar-fabric-linux.so &&
cp /code/sidecar-client-ethereum/build/eth-client.so /code/sidecar/bin/sidecar-eth-linux.so" cp /code/sidecar-client-ethereum/build/eth-client.so /code/sidecar/bin/sidecar-eth-linux.so"
;; ;;
*) *)
print_red "Other architectures are not supported yet" print_red "Other architectures are not supported yet"
;; ;;
esac esac
...@@ -10,13 +10,12 @@ sidecar --repo=/root/sidecar appchain method register --admin-key ./key.json --m ...@@ -10,13 +10,12 @@ sidecar --repo=/root/sidecar appchain method register --admin-key ./key.json --m
--name "${APPCHAIN_NAME}" --type fabric --desc="test for fabric" --version v1.4.3 \ --name "${APPCHAIN_NAME}" --type fabric --desc="test for fabric" --version v1.4.3 \
--validators ./"${PLUGIN_CONFIG}"/fabric.validators --consensus raft --validators ./"${PLUGIN_CONFIG}"/fabric.validators --consensus raft
command1=$(sidecar --repo=/root/sidecar rule deploy --path ./"${PLUGIN_CONFIG}"/validating.wasm --method fabappchain --admin-key ./key.json) command1=$(sidecar --repo=/root/sidecar rule deploy --path ./"${PLUGIN_CONFIG}"/validating.wasm --method fabappchain --admin-key ./key.json)
address=$(echo "$command1"|grep -o '0x.\{40\}') address=$(echo "$command1" | grep -o '0x.\{40\}')
echo "${address}" echo "${address}"
command2=$(sidecar --repo=/root/sidecar rule bind --addr "${address}" --method fabappchain --admin-key ./key.json) command2=$(sidecar --repo=/root/sidecar rule bind --addr "${address}" --method fabappchain --admin-key ./key.json)
proposalID=$(echo "$command2"|grep -o '0x.\{42\}') proposalID=$(echo "$command2" | grep -o '0x.\{42\}')
echo "${proposalID}" echo "${proposalID}"
sidecar --repo=/root/sidecar start sidecar --repo=/root/sidecar start
......
...@@ -6,7 +6,7 @@ source x.sh ...@@ -6,7 +6,7 @@ source x.sh
CURRENT_PATH=$(pwd) CURRENT_PATH=$(pwd)
PROJECT_PATH=$(dirname "${CURRENT_PATH}") PROJECT_PATH=$(dirname "${CURRENT_PATH}")
RELEASE_PATH=${PROJECT_PATH}/bin RELEASE_PATH=${PROJECT_PATH}/bin
APP_VERSION=$(if [ `git rev-parse --abbrev-ref HEAD` == 'HEAD' ];then git describe --tags HEAD ; else echo "dev" ; fi) APP_VERSION=$(if [ $(git rev-parse --abbrev-ref HEAD) == 'HEAD' ]; then git describe --tags HEAD; else echo "dev"; fi)
print_blue "===> 1. Install packr" print_blue "===> 1. Install packr"
if ! type packr >/dev/null 2>&1; then if ! type packr >/dev/null 2>&1; then
......
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