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:
build:
stage: build
script:
- make fmt
- make check
- make build
test:
......
......@@ -38,7 +38,7 @@ GREEN=\033[0;32m
BLUE=\033[0;34m
NC=\033[0m
.PHONY: test
.PHONY: test fmt_proto fmt_shell check checkgofmt
help: Makefile
@echo "Choose a command run:"
......@@ -107,9 +107,19 @@ linter:
golangci-lint run
golangci-lint run -E goimports -E bodyclose --skip-dirs-use-default
fmt:
go fmt ./...
fmt_proto: ## go fmt protobuf file
@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
......@@ -142,3 +152,32 @@ grpc:
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
import (
"github.com/link33/sidecar/model/pb"
"sync"
"github.com/link33/sidecar/model/pb"
)
type Pool struct {
......
package loggers
import (
"github.com/stretchr/testify/require"
"testing"
"github.com/stretchr/testify/require"
"github.com/link33/sidecar/internal/repo"
)
......
......@@ -2,6 +2,7 @@ package manger
import (
"encoding/json"
"github.com/meshplus/bitxhub-core/governance"
"github.com/meshplus/bitxhub-kit/storage"
"github.com/sirupsen/logrus"
......
......@@ -2,6 +2,7 @@ package peermgr
import (
"errors"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/sirupsen/logrus"
......
......@@ -2,6 +2,7 @@ package txcrypto
import (
"fmt"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/btcsuite/btcd/btcec"
......
......@@ -5,10 +5,11 @@ package pb
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -4,17 +4,17 @@ package pb;
message Arg {
enum Type {
I32 = 0;
I64 = 1;
U32 = 2;
U64 = 3;
F32 = 4;
F64 = 5;
I32 = 0;
I64 = 1;
U32 = 2;
U64 = 3;
F32 = 4;
F64 = 5;
String = 6;
Bytes = 7;
Bool = 8;
Bytes = 7;
Bool = 8;
}
Type type = 1;
bool is_array = 2;
bytes value = 3;
Type type = 1;
bool is_array = 2;
bytes value = 3;
}
\ No newline at end of file
......@@ -5,10 +5,11 @@ package pb
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -3,34 +3,34 @@ syntax = "proto3";
package pb;
message Uint64Slice {
repeated uint64 slice = 1;
repeated uint64 slice = 1;
}
message StringUint64Map {
repeated string keys = 1;
repeated uint64 vals = 2;
repeated string keys = 1;
repeated uint64 vals = 2;
}
message StringUint64SliceMap {
repeated string keys = 1;
repeated Uint64Slice vals = 2;
repeated string keys = 1;
repeated Uint64Slice vals = 2;
}
message VerifiedIndex {
uint64 index = 1;
bool valid = 2;
uint64 index = 1;
bool valid = 2;
}
message VerifiedIndexSlice {
repeated VerifiedIndex slice = 1;
repeated VerifiedIndex slice = 1;
}
message StringVerifiedIndexMap {
repeated string keys = 1;
repeated VerifiedIndex vals = 2;
repeated string keys = 1;
repeated VerifiedIndex vals = 2;
}
message StringVerifiedIndexSliceMap {
repeated string keys = 1;
repeated VerifiedIndexSlice vals = 2;
repeated string keys = 1;
repeated VerifiedIndexSlice vals = 2;
}
\ No newline at end of file
......@@ -5,12 +5,13 @@ package pb
import (
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"
math "math"
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.
......
......@@ -7,19 +7,19 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message Block {
BlockHeader block_header = 1;
bytes transactions = 2 [(gogoproto.customtype) = "Transactions"]; // transaction set
bytes block_hash = 3 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"];
bytes signature = 4;
bytes extra = 5;
bytes transactions = 2 [ (gogoproto.customtype) = "Transactions" ]; // transaction set
bytes block_hash = 3 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes signature = 4;
bytes extra = 5;
}
message BlockHeader {
uint64 number = 1;
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 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"];
int64 timestamp = 6;
bytes version = 7;
bytes Bloom = 8 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Bloom"];
uint64 number = 1;
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 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" ];
int64 timestamp = 6;
bytes version = 7;
bytes Bloom = 8 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Bloom" ];
}
\ No newline at end of file
......@@ -6,6 +6,10 @@ package pb
import (
context "context"
fmt "fmt"
io "io"
math "math"
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"
......@@ -13,9 +17,6 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
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.
......
This diff is collapsed.
......@@ -5,12 +5,13 @@ package pb
import (
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"
math "math"
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.
......
......@@ -7,53 +7,53 @@ import "arg.proto";
import "ibtp.proto";
message BxhTransaction {
bytes version = 1;
bytes from = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address"];
bytes to = 3 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address"];
int64 timestamp = 4;
bytes transaction_hash = 5 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"];
bytes payload = 6;
pb.IBTP IBTP = 7;
uint64 nonce = 8;
uint64 amount = 9;
bytes signature = 10;
bytes extra = 11;
bytes version = 1;
bytes from = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address" ];
bytes to = 3 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Address" ];
int64 timestamp = 4;
bytes transaction_hash = 5 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes payload = 6;
pb.IBTP IBTP = 7;
uint64 nonce = 8;
uint64 amount = 9;
bytes signature = 10;
bytes extra = 11;
}
message TransactionData {
enum Type {
NORMAL = 0;
INVOKE = 1;
UPDATE = 2;
FREEZE = 3;
NORMAL = 0;
INVOKE = 1;
UPDATE = 2;
FREEZE = 3;
UNFREEZE = 4;
}
Type type = 1;
Type type = 1;
uint64 amount = 2;
enum VMType {
BVM = 0;
XVM = 1;
}
VMType vm_type = 3;
bytes payload = 4;
bytes extra = 5;
bytes payload = 4;
bytes extra = 5;
}
message InvokePayload {
string method = 1;
repeated Arg args = 2;
string method = 1;
repeated Arg args = 2;
}
message TransactionMeta {
bytes block_hash = 1;
bytes block_hash = 1;
uint64 block_height = 2;
uint64 index = 3;
uint64 index = 3;
}
message CrosschainTransactionExtra {
uint64 index = 1; // to_id index
bool status = 2; // receipt status
bytes ret = 3; // receipt result
uint64 index = 1; // to_id index
bool status = 2; // receipt status
bytes ret = 3; // receipt result
}
message TransactionTracingMeta {
......@@ -62,28 +62,28 @@ message TransactionTracingMeta {
}
message TransactionSlice {
uint64 height = 1;
repeated BxhTransaction txs = 2;
uint64 height = 1;
repeated BxhTransaction txs = 2;
}
message AssetExchangeInfo {
string id = 1;
string sender_on_src = 2;
string id = 1;
string sender_on_src = 2;
string receiver_on_src = 3;
uint64 asset_on_src = 4;
string sender_on_dst = 5;
uint64 asset_on_src = 4;
string sender_on_dst = 5;
string receiver_on_dst = 6;
uint64 asset_on_dst = 7;
uint64 asset_on_dst = 7;
}
enum TransactionStatus {
BEGIN = 0;
BEGIN = 0;
SUCCESS = 1;
FAILURE = 2;
}
enum AssetExchangeStatus {
INIT = 0;
INIT = 0;
REDEEM = 1;
REFUND = 2;
}
\ No newline at end of file
......@@ -5,12 +5,13 @@ package pb
import (
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"
math "math"
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.
......
......@@ -5,7 +5,7 @@ package pb;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message ChainMeta {
uint64 height = 1;
bytes block_hash = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"];
uint64 height = 1;
bytes block_hash = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
uint64 interchain_tx_count = 3;
}
\ No newline at end of file
......@@ -5,10 +5,11 @@ package pb
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -6,6 +6,6 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "block.proto";
message commit_event {
Block block = 1;
repeated bool local_list = 2;
Block block = 1;
repeated bool local_list = 2;
}
......@@ -5,10 +5,11 @@ package pb
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -7,19 +7,19 @@ import "basic.proto";
// Inter-blockchain Transfer Protocol
message IBTP {
enum Type {
INTERCHAIN = 0;
RECEIPT_SUCCESS = 1;
RECEIPT_FAILURE = 2;
ASSET_EXCHANGE_INIT = 3;
ASSET_EXCHANGE_REDEEM = 4;
ASSET_EXCHANGE_REFUND = 5;
INTERCHAIN = 0;
RECEIPT_SUCCESS = 1;
RECEIPT_FAILURE = 2;
ASSET_EXCHANGE_INIT = 3;
ASSET_EXCHANGE_REDEEM = 4;
ASSET_EXCHANGE_REFUND = 5;
ASSET_EXCHANGE_RECEIPT = 6;
}
enum Category {
REQUEST = 0;
REQUEST = 0;
RESPONSE = 1;
UNKNOWN = 2;
UNKNOWN = 2;
}
// ID of sending chain
......@@ -45,19 +45,19 @@ message IBTP {
}
message payload {
bool encrypted = 1;
bytes content = 2;
bool encrypted = 1;
bytes content = 2;
}
message content {
string src_contract_id = 1;
string dst_contract_id = 2;
string func = 3;
repeated bytes args = 4;
string callback = 5;
repeated bytes argsCb = 6;
string rollback = 7;
repeated bytes argsRb = 8;
string src_contract_id = 1;
string dst_contract_id = 2;
string func = 3;
repeated bytes args = 4;
string callback = 5;
repeated bytes argsCb = 6;
string rollback = 7;
repeated bytes argsRb = 8;
}
message IBTPs {
......
......@@ -5,10 +5,11 @@ package pb
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -2,17 +2,17 @@ syntax = "proto3";
package pb;
//import "basic.proto";
// import "basic.proto";
import "ibtp.proto";
message IBTPX {
IBTP ibtp = 1;
// route mode
string mode = 2; //dirct、relay
repeated string routeSign = 3;//路由节点签名路径,主要是对data hash签名,主要是相互校验。sidecar节点之间相互校验。sidecar 节点需要注册到中继连上。还可以过滤已经发送过的交易、也可以作恶惩罚。
string routeMethod = 4;//single、multicast、broadcast、
repeated string routeMethodArg = 5;//路由节点,默认第一个节点。或者转发消息。
bool IsValid = 6;
string mode = 2; // dirct、relay
repeated string routeSign = 3; //路由节点签名路径,主要是对data hash签名,主要是相互校验。sidecar节点之间相互校验。sidecar 节点需要注册到中继连上。还可以过滤已经发送过的交易、也可以作恶惩罚。
string routeMethod = 4; // single、multicast、broadcast、
repeated string routeMethodArg = 5; //路由节点,默认第一个节点。或者转发消息。
bool IsValid = 6;
}
// 若目的地址to不在路由表中,则使用如下规则,即routeRule如下值时。
// method:single、multicast、broadcast、随机选择、最快速度、官方节点、开源节点、nat节点。
......@@ -22,4 +22,3 @@ message IBTPX {
// broadcast:广播所有的给所有的peer。
// 设置节点筛选器,根据标签。
// 不需要指定节点ID,
......@@ -5,12 +5,13 @@ package pb
import (
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"
math "math"
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.
......
......@@ -6,13 +6,13 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "basic.proto";
message InterchainMetaS {
StringVerifiedIndexSliceMap counter = 1;
repeated bytes l2Roots = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"];
StringVerifiedIndexSliceMap counter = 1;
repeated bytes l2Roots = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
}
message InterchainS {
string ID = 1;
StringUint64Map InterchainCounter = 2;
StringUint64Map ReceiptCounter = 3;
StringUint64Map SourceReceiptCounter = 4;
string ID = 1;
StringUint64Map InterchainCounter = 2;
StringUint64Map ReceiptCounter = 3;
StringUint64Map SourceReceiptCounter = 4;
}
\ No newline at end of file
......@@ -5,10 +5,11 @@ package pb
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -4,33 +4,31 @@ package pb;
message Message {
enum Type {
ACK = 0;
ADDRESS_GET = 1;
APPCHAIN_REGISTER = 2;
APPCHAIN_UPDATE = 3;
APPCHAIN_GET = 4;
ACK = 0;
ADDRESS_GET = 1;
APPCHAIN_REGISTER = 2;
APPCHAIN_UPDATE = 3;
APPCHAIN_GET = 4;
INTERCHAIN_META_GET = 5;
RULE_DEPLOY = 6; //部署验证规则
RULE_DEPLOY = 6; //部署验证规则
//异步完成
IBTP_GET = 7;
IBTP_SEND = 8;
IBTP_GET = 7;
IBTP_SEND = 8;
IBTP_RECEIPT_SEND = 9;
IBTP_RECEIPT_GET = 10;
PEER_INFO_GET = 11;
IBTP_RECEIPT_GET = 10;
PEER_INFO_GET = 11;
}
Type type = 1;
Pack payload = 2;
Type type = 1;
Pack payload = 2;
string version = 3;
}
message Pack {
bool ok = 1;
bool ok = 1;
bytes data = 2;
}
message PeerInfo {
string ID = 1;
string ID = 1;
string Tag = 2;
}
......@@ -6,13 +6,14 @@ package pb
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
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.
......
......@@ -7,34 +7,34 @@ message Empty {}
message InitializeRequest {
string config_path = 1;
string sidecar_id = 2;
bytes extra = 3;
string sidecar_id = 2;
bytes extra = 3;
}
message SubmitIBTPResponse {
bool status = 1;
string message = 2;
pb.IBTP result = 3;
bool status = 1;
string message = 2;
pb.IBTP result = 3;
}
message RollbackIBTPRequest {
pb.IBTP ibtp = 1;
bool srcChain = 2;
pb.IBTP ibtp = 1;
bool srcChain = 2;
}
message RollbackIBTPResponse {
bool status = 1;
bool status = 1;
string message = 2;
}
message GetOutMessageRequest {
string to =1;
uint64 idx =2;
string to = 1;
uint64 idx = 2;
}
message GetInMessageRequest {
string from =1;
uint64 idx =2;
string from = 1;
uint64 idx = 2;
}
message GetInMessageResponse {
......
......@@ -5,12 +5,13 @@ package pb
import (
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"
math "math"
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.
......
......@@ -7,17 +7,17 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message Receipt {
enum Status {
SUCCESS = 0;
FAILED = 1;
FAILED = 1;
}
bytes version = 1;
bytes tx_hash = 2 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"];
bytes ret = 3;
Status status = 4;
repeated Event events = 5;
uint64 gas_used = 6;
repeated EvmLog evm_logs = 7;
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 version = 1;
bytes tx_hash = 2 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes ret = 3;
Status status = 4;
repeated Event events = 5;
uint64 gas_used = 6;
repeated EvmLog evm_logs = 7;
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" ];
}
message Receipts {
......@@ -26,26 +26,26 @@ message Receipts {
message Event {
// Transaction Hash
bytes tx_hash = 1 [(gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash"];
bytes data = 2;
bytes tx_hash = 1 [ (gogoproto.customtype) = "github.com/meshplus/bitxhub-kit/types.Hash" ];
bytes data = 2;
// The interchain flag used by interchain contract
bool interchain = 3;
}
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;
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;
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;
......
......@@ -5,10 +5,11 @@ package pb
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -3,8 +3,8 @@ syntax = "proto3";
package pb;
message VpInfo {
uint64 id = 1;
string pid = 2;
string account = 3;
repeated string hosts = 4;
uint64 id = 1;
string pid = 2;
string account = 3;
repeated string hosts = 4;
}
\ No newline at end of file
......@@ -6,17 +6,17 @@ source x.sh
# $1 is arch, $2 is source code path
case $1 in
linux-amd64)
print_blue "Compile for linux/amd64"
docker run -t \
-v $2:/code/sidecar \
-v $2/../sidecar-client-fabric:/code/sidecar-client-fabric \
-v $2/../sidecar-client-ethereum:/code/sidecar-client-ethereum \
-v ~/.ssh:/root/.ssh \
-v ~/.gitconfig:/root/.gitconfig \
-v $GOPATH/pkg/mod:$GOPATH/pkg/mod \
sidecar-ubuntu/compile \
/bin/bash -c "go env -w GO111MODULE=on &&
linux-amd64)
print_blue "Compile for linux/amd64"
docker run -t \
-v $2:/code/sidecar \
-v $2/../sidecar-client-fabric:/code/sidecar-client-fabric \
-v $2/../sidecar-client-ethereum:/code/sidecar-client-ethereum \
-v ~/.ssh:/root/.ssh \
-v ~/.gitconfig:/root/.gitconfig \
-v $GOPATH/pkg/mod:$GOPATH/pkg/mod \
sidecar-ubuntu/compile \
/bin/bash -c "go env -w GO111MODULE=on &&
go env -w GOPROXY=https://goproxy.cn,direct &&
go get -u github.com/gobuffalo/packr/packr &&
cd /code/sidecar-client-fabric && make fabric1.4 &&
......@@ -26,8 +26,8 @@ linux-amd64)
cp /go/bin/sidecar /code/sidecar/bin/sidecar_linux-amd64 &&
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"
;;
*)
print_red "Other architectures are not supported yet"
;;
;;
*)
print_red "Other architectures are not supported yet"
;;
esac
......@@ -5,20 +5,19 @@ APPCHAIN_NAME=$1
PLUGIN_CONFIG=$2
sidecar --repo=/root/sidecar appchain method register --admin-key ./key.json --method fabappchain \
--doc-addr /ipfs/QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi \
--doc-hash QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi \
--name "${APPCHAIN_NAME}" --type fabric --desc="test for fabric" --version v1.4.3 \
--validators ./"${PLUGIN_CONFIG}"/fabric.validators --consensus raft
--doc-addr /ipfs/QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi \
--doc-hash QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi \
--name "${APPCHAIN_NAME}" --type fabric --desc="test for fabric" --version v1.4.3 \
--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)
address=$(echo "$command1"|grep -o '0x.\{40\}')
address=$(echo "$command1" | grep -o '0x.\{40\}')
echo "${address}"
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}"
sidecar --repo=/root/sidecar start
exec "$@"
\ No newline at end of file
exec "$@"
......@@ -4,23 +4,23 @@ BLUE='\033[0;34m'
NC='\033[0m'
function print_blue() {
printf "${BLUE}%s${NC}\n" "$1"
printf "${BLUE}%s${NC}\n" "$1"
}
print_blue "===> 1. Install packr"
if ! type packr >/dev/null 2>&1; then
go get -u github.com/gobuffalo/packr/packr
go get -u github.com/gobuffalo/packr/packr
fi
print_blue "===> 2. Install golangci-lint"
if ! type golanci-lint >/dev/null 2>&1; then
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.0
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.0
fi
print_blue "===> 3. Install go mock tool"
if ! type gomock >/dev/null 2>&1; then
go get github.com/golang/mock/gomock
go get github.com/golang/mock/gomock
fi
if ! type mockgen >/dev/null 2>&1; then
go get github.com/golang/mock/mockgen
fi
\ No newline at end of file
go get github.com/golang/mock/mockgen
fi
......@@ -6,11 +6,11 @@ source x.sh
CURRENT_PATH=$(pwd)
PROJECT_PATH=$(dirname "${CURRENT_PATH}")
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"
if ! type packr >/dev/null 2>&1; then
go get -u github.com/gobuffalo/packr/packr
go get -u github.com/gobuffalo/packr/packr
fi
print_blue "===> 2. build sidecar"
......@@ -19,9 +19,9 @@ cd "${PROJECT_PATH}" && make build
print_blue "===> 3. pack binarys"
cd "${RELEASE_PATH}"
if [ "$(uname)" == "Darwin" ]; then
cp ../build/wasm/lib/darwin-amd64/libwasmer.dylib .
tar zcvf sidecar_darwin_x86_64_"${APP_VERSION}".tar.gz ./sidecar ./libwasmer.dylib
cp ../build/wasm/lib/darwin-amd64/libwasmer.dylib .
tar zcvf sidecar_darwin_x86_64_"${APP_VERSION}".tar.gz ./sidecar ./libwasmer.dylib
else
cp ../build/wasm/lib/linux-amd64/libwasmer.so .
tar zcvf sidecar_linux-amd64_"${APP_VERSION}".tar.gz ./sidecar ./libwasmer.so
cp ../build/wasm/lib/linux-amd64/libwasmer.so .
tar zcvf sidecar_linux-amd64_"${APP_VERSION}".tar.gz ./sidecar ./libwasmer.so
fi
......@@ -4,26 +4,26 @@ BLUE='\033[0;34m'
NC='\033[0m'
function print_blue() {
printf "${BLUE}%s${NC}\n" "$1"
printf "${BLUE}%s${NC}\n" "$1"
}
function print_green() {
printf "${GREEN}%s${NC}\n" "$1"
printf "${GREEN}%s${NC}\n" "$1"
}
function print_red() {
printf "${RED}%s${NC}\n" "$1"
printf "${RED}%s${NC}\n" "$1"
}
# The sed commend with system judging
# Examples:
# sed -i 's/a/b/g' bob.txt => x_replace 's/a/b/g' bob.txt
function x_replace() {
system=$(uname)
system=$(uname)
if [ "${system}" = "Linux" ]; then
sed -i "$@"
else
sed -i '' "$@"
fi
if [ "${system}" = "Linux" ]; then
sed -i "$@"
else
sed -i '' "$@"
fi
}
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