Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
sidecar
Commits
65c121b8
Commit
65c121b8
authored
Sep 16, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update CI and update makefile and update source file
parent
560a6263
Pipeline
#8003
canceled with stages
Changes
41
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
508 additions
and
427 deletions
+508
-427
.clang-format
.clang-format
+21
-0
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
Makefile
Makefile
+42
-3
pool.go
internal/exchanger/pool.go
+2
-1
logger_test.go
internal/loggers/logger_test.go
+2
-1
persister.go
internal/manger/persister.go
+1
-0
local.go
internal/peermgr/local.go
+1
-0
direct_cryptor.go
internal/txcrypto/direct_cryptor.go
+1
-0
arg.pb.go
model/pb/arg.pb.go
+2
-1
arg.proto
model/pb/arg.proto
+12
-11
basic.pb.go
model/pb/basic.pb.go
+2
-1
basic.proto
model/pb/basic.proto
+13
-12
block.pb.go
model/pb/block.pb.go
+4
-3
block.proto
model/pb/block.proto
+13
-12
broker.pb.go
model/pb/broker.pb.go
+4
-3
broker.proto
model/pb/broker.proto
+195
-194
bxh_transaction.pb.go
model/pb/bxh_transaction.pb.go
+4
-3
bxh_transaction.proto
model/pb/bxh_transaction.proto
+35
-34
chain.pb.go
model/pb/chain.pb.go
+4
-3
chain.proto
model/pb/chain.proto
+3
-2
commit.pb.go
model/pb/commit.pb.go
+3
-2
commit.proto
model/pb/commit.proto
+2
-2
ibtp.pb.go
model/pb/ibtp.pb.go
+2
-1
ibtp.proto
model/pb/ibtp.proto
+18
-18
ibtpx.pb.go
model/pb/ibtpx.pb.go
+2
-1
ibtpx.proto
model/pb/ibtpx.proto
+6
-7
interchain_meta.pb.go
model/pb/interchain_meta.pb.go
+4
-3
interchain_meta.proto
model/pb/interchain_meta.proto
+7
-6
message.pb.go
model/pb/message.pb.go
+2
-1
message.proto
model/pb/message.proto
+14
-16
plugin.pb.go
model/pb/plugin.pb.go
+4
-3
plugin.proto
model/pb/plugin.proto
+12
-12
receipt.pb.go
model/pb/receipt.pb.go
+4
-3
receipt.proto
model/pb/receipt.proto
+16
-16
vp_info.pb.go
model/pb/vp_info.pb.go
+2
-1
vp_info.proto
model/pb/vp_info.proto
+5
-4
cross_compile.sh
scripts/cross_compile.sh
+15
-15
docker_entrypoint.sh
scripts/docker_entrypoint.sh
+7
-9
prepare.sh
scripts/prepare.sh
+6
-7
release_binary.sh
scripts/release_binary.sh
+6
-6
x.sh
scripts/x.sh
+9
-9
No files found.
.clang-format
0 → 100644
View file @
65c121b8
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'
.gitlab-ci.yml
View file @
65c121b8
...
...
@@ -11,7 +11,7 @@ stages:
build
:
stage
:
build
script
:
-
make
fmt
-
make
check
-
make build
test
:
...
...
Makefile
View file @
65c121b8
...
...
@@ -38,7 +38,7 @@ GREEN=\033[0;32m
BLUE
=
\0
33[0
;
34m
NC
=
\0
33[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
internal/exchanger/pool.go
View file @
65c121b8
package
exchanger
import
(
"github.com/link33/sidecar/model/pb"
"sync"
"github.com/link33/sidecar/model/pb"
)
type
Pool
struct
{
...
...
internal/loggers/logger_test.go
View file @
65c121b8
package
loggers
import
(
"github.com/stretchr/testify/require"
"testing"
"github.com/stretchr/testify/require"
"github.com/link33/sidecar/internal/repo"
)
...
...
internal/manger/persister.go
View file @
65c121b8
...
...
@@ -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"
...
...
internal/peermgr/local.go
View file @
65c121b8
...
...
@@ -2,6 +2,7 @@ package peermgr
import
(
"errors"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/sirupsen/logrus"
...
...
internal/txcrypto/direct_cryptor.go
View file @
65c121b8
...
...
@@ -2,6 +2,7 @@ package txcrypto
import
(
"fmt"
appchainmgr
"github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/btcsuite/btcd/btcec"
...
...
model/pb/arg.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/arg.proto
View file @
65c121b8
...
...
@@ -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
model/pb/basic.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/basic.proto
View file @
65c121b8
...
...
@@ -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
model/pb/block.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/block.proto
View file @
65c121b8
...
...
@@ -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
model/pb/broker.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/broker.proto
View file @
65c121b8
...
...
@@ -10,267 +10,267 @@ import "block.proto";
import
"chain.proto"
;
service
ChainBroker
{
rpc
Subscribe
(
SubscriptionRequest
)
returns
(
stream
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/subscription"
};
}
rpc
GetBlockHeader
(
GetBlockHeaderRequest
)
returns
(
stream
pb.BlockHeader
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/block_header"
};
}
rpc
GetInterchainTxWrappers
(
GetInterchainTxWrappersRequest
)
returns
(
stream
InterchainTxWrappers
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/interchain_tx_wrappers"
};
}
rpc
SendTransaction
(
pb.BxhTransaction
)
returns
(
TransactionHashMsg
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/transaction"
body
:
"*"
};
}
rpc
SendView
(
pb.BxhTransaction
)
returns
(
pb.Receipt
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/view"
body
:
"*"
};
}
rpc
GetTransaction
(
TransactionHashMsg
)
returns
(
GetTransactionResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/transaction/{tx_hash}"
};
}
rpc
GetReceipt
(
TransactionHashMsg
)
returns
(
pb.Receipt
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/receipt/{tx_hash}"
};
}
rpc
GetBlock
(
GetBlockRequest
)
returns
(
pb.Block
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/block"
};
}
rpc
GetBlocks
(
GetBlocksRequest
)
returns
(
GetBlocksResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/blocks"
};
}
rpc
GetBlockHeaders
(
GetBlockHeadersRequest
)
returns
(
GetBlockHeadersResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/block_headers"
};
}
rpc
GetChainMeta
(
Request
)
returns
(
pb.ChainMeta
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/chain_meta"
};
}
rpc
GetInfo
(
Request
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/info"
};
}
rpc
GetAccountBalance
(
Address
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/account_balance/{address}"
};
}
rpc
GetMultiSigns
(
GetMultiSignsRequest
)
returns
(
SignResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/multi_sign/{content}"
};
}
rpc
GetTPS
(
GetTPSRequest
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/tps/{begin}/{end}"
};
}
rpc
GetPendingNonceByAccount
(
Address
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/pendingNonce/{address}"
};
}
rpc
DelVPNode
(
DelVPNodeRequest
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/delvpnode"
body
:
"*"
};
}
rpc
CheckMasterSidecar
(
Address
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/check_master_sidecar/{address}"
};
}
rpc
SetMasterSidecar
(
SidecarInfo
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/set_master_sidecar"
body
:
"*"
};
}
rpc
HeartBeat
(
SidecarInfo
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/heart_beat"
body
:
"*"
};
}
rpc
Subscribe
(
SubscriptionRequest
)
returns
(
stream
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/subscription"
};
}
rpc
GetBlockHeader
(
GetBlockHeaderRequest
)
returns
(
stream
pb.BlockHeader
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/block_header"
};
}
rpc
GetInterchainTxWrappers
(
GetInterchainTxWrappersRequest
)
returns
(
stream
InterchainTxWrappers
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/interchain_tx_wrappers"
};
}
rpc
SendTransaction
(
pb.BxhTransaction
)
returns
(
TransactionHashMsg
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/transaction"
body
:
"*"
};
}
rpc
SendView
(
pb.BxhTransaction
)
returns
(
pb.Receipt
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/view"
body
:
"*"
};
}
rpc
GetTransaction
(
TransactionHashMsg
)
returns
(
GetTransactionResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/transaction/{tx_hash}"
};
}
rpc
GetReceipt
(
TransactionHashMsg
)
returns
(
pb.Receipt
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/receipt/{tx_hash}"
};
}
rpc
GetBlock
(
GetBlockRequest
)
returns
(
pb.Block
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/block"
};
}
rpc
GetBlocks
(
GetBlocksRequest
)
returns
(
GetBlocksResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/blocks"
};
}
rpc
GetBlockHeaders
(
GetBlockHeadersRequest
)
returns
(
GetBlockHeadersResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/block_headers"
};
}
rpc
GetChainMeta
(
Request
)
returns
(
pb.ChainMeta
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/chain_meta"
};
}
rpc
GetInfo
(
Request
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/info"
};
}
rpc
GetAccountBalance
(
Address
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/account_balance/{address}"
};
}
rpc
GetMultiSigns
(
GetMultiSignsRequest
)
returns
(
SignResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/multi_sign/{content}"
};
}
rpc
GetTPS
(
GetTPSRequest
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/tps/{begin}/{end}"
};
}
rpc
GetPendingNonceByAccount
(
Address
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/pendingNonce/{address}"
};
}
rpc
DelVPNode
(
DelVPNodeRequest
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/delvpnode"
body
:
"*"
};
}
rpc
CheckMasterSidecar
(
Address
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
get
:
"/v1/check_master_sidecar/{address}"
};
}
rpc
SetMasterSidecar
(
SidecarInfo
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/set_master_sidecar"
body
:
"*"
};
}
rpc
HeartBeat
(
SidecarInfo
)
returns
(
Response
)
{
option
(
google.api.http
)
=
{
post
:
"/v1/heart_beat"
body
:
"*"
};
}
}
message
GetBlockHeaderRequest
{
uint64
begin
=
1
;
uint64
end
=
2
;
uint64
begin
=
1
;
uint64
end
=
2
;
}
message
GetInterchainTxWrappersRequest
{
uint64
begin
=
1
;
uint64
end
=
2
;
string
pid
=
3
;
uint64
begin
=
1
;
uint64
end
=
2
;
string
pid
=
3
;
}
message
TransactionHashMsg
{
string
tx_hash
=
1
;
string
tx_hash
=
1
;
}
message
GetBlockRequest
{
enum
Type
{
HEIGHT
=
0
;
HASH
=
1
;
}
Type
type
=
1
;
string
value
=
2
;
enum
Type
{
HEIGHT
=
0
;
HASH
=
1
;
}
Type
type
=
1
;
string
value
=
2
;
}
message
Request
{
enum
Type
{
CHAIN_STATUS
=
0
;
NETWORK
=
1
;
VALIDATORS
=
2
;
}
Type
type
=
1
;
enum
Type
{
CHAIN_STATUS
=
0
;
NETWORK
=
1
;
VALIDATORS
=
2
;
}
Type
type
=
1
;
}
message
Response
{
bytes
data
=
1
;
bytes
data
=
1
;
}
message
SignResponse
{
map
<
string
,
bytes
>
sign
=
1
;
map
<
string
,
bytes
>
sign
=
1
;
}
message
Address
{
string
address
=
1
;
string
address
=
1
;
}
message
GetBlocksRequest
{
uint64
start
=
1
;
uint64
end
=
2
;
uint64
start
=
1
;
uint64
end
=
2
;
}
message
GetBlocksResponse
{
repeated
pb.Block
blocks
=
1
;
repeated
pb.Block
blocks
=
1
;
}
message
GetBlockHeadersRequest
{
uint64
start
=
1
;
uint64
end
=
2
;
uint64
start
=
1
;
uint64
end
=
2
;
}
message
GetBlockHeadersResponse
{
repeated
pb.BlockHeader
blockHeaders
=
1
;
repeated
pb.BlockHeader
blockHeaders
=
1
;
}
message
SubscriptionRequest
{
enum
Type
{
BLOCK
=
0
;
EVENT
=
1
;
INTERCHAIN_TX
=
2
;
BLOCK_HEADER
=
3
;
INTERCHAIN_TX_WRAPPER
=
4
;
UNION_INTERCHAIN_TX_WRAPPER
=
5
;
}
Type
type
=
1
;
bytes
extra
=
2
;
enum
Type
{
BLOCK
=
0
;
EVENT
=
1
;
INTERCHAIN_TX
=
2
;
BLOCK_HEADER
=
3
;
INTERCHAIN_TX_WRAPPER
=
4
;
UNION_INTERCHAIN_TX_WRAPPER
=
5
;
}
Type
type
=
1
;
bytes
extra
=
2
;
}
message
GetMultiSignsRequest
{
enum
Type
{
ASSET_EXCHANGE
=
0
;
IBTP
=
1
;
BLOCK_HEADER
=
2
;
}
Type
type
=
1
;
string
content
=
2
;
enum
Type
{
ASSET_EXCHANGE
=
0
;
IBTP
=
1
;
BLOCK_HEADER
=
2
;
}
Type
type
=
1
;
string
content
=
2
;
}
message
GetTransactionResponse
{
pb.BxhTransaction
tx
=
1
;
pb.TransactionMeta
tx_meta
=
2
;
pb.BxhTransaction
tx
=
1
;
pb.TransactionMeta
tx_meta
=
2
;
}
message
VerifiedTx
{
pb.BxhTransaction
tx
=
1
;
bool
valid
=
2
;
pb.BxhTransaction
tx
=
1
;
bool
valid
=
2
;
}
message
InterchainTxWrapper
{
repeated
bytes
l2Roots
=
1
[(
gogoproto.customtype
)
=
"github.com/meshplus/bitxhub-kit/types.Hash"
];
repeated
VerifiedTx
transactions
=
2
;
uint64
height
=
3
;
repeated
bytes
l2Roots
=
1
[
(
gogoproto.customtype
)
=
"github.com/meshplus/bitxhub-kit/types.Hash"
];
repeated
VerifiedTx
transactions
=
2
;
uint64
height
=
3
;
}
message
InterchainTxWrappers
{
repeated
InterchainTxWrapper
interchainTxWrappers
=
1
;
repeated
InterchainTxWrapper
interchainTxWrappers
=
1
;
}
message
GetTPSRequest
{
uint64
begin
=
1
;
uint64
end
=
2
;
uint64
begin
=
1
;
uint64
end
=
2
;
}
message
DelVPNodeRequest
{
string
pid
=
1
;
string
pid
=
1
;
}
message
SidecarInfo
{
string
address
=
1
;
string
index
=
2
;
int64
timeout
=
3
;
string
address
=
1
;
string
index
=
2
;
int64
timeout
=
3
;
}
message
CheckSidecarResponse
{
enum
Status
{
ERROR_MASTER
=
0
;
HAS_MASTER
=
1
;
NO_MASTER
=
2
;
}
Status
status
=
1
;
string
address
=
2
;
enum
Status
{
ERROR_MASTER
=
0
;
HAS_MASTER
=
1
;
NO_MASTER
=
2
;
}
Status
status
=
1
;
string
address
=
2
;
}
message
HeartBeatRespones
{
enum
Status
{
ALIVE
=
0
;
DEAD
=
1
;
}
Status
status
=
1
;
enum
Status
{
ALIVE
=
0
;
DEAD
=
1
;
}
Status
status
=
1
;
}
\ No newline at end of file
model/pb/bxh_transaction.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/bxh_transaction.proto
View file @
65c121b8
...
...
@@ -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
model/pb/chain.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/chain.proto
View file @
65c121b8
...
...
@@ -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
model/pb/commit.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/commit.proto
View file @
65c121b8
...
...
@@ -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
;
}
model/pb/ibtp.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/ibtp.proto
View file @
65c121b8
...
...
@@ -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
{
...
...
model/pb/ibtpx.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/ibtpx.proto
View file @
65c121b8
...
...
@@ -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,
model/pb/interchain_meta.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/interchain_meta.proto
View file @
65c121b8
...
...
@@ -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
model/pb/message.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/message.proto
View file @
65c121b8
...
...
@@ -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
;
}
model/pb/plugin.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/plugin.proto
View file @
65c121b8
...
...
@@ -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
{
...
...
model/pb/receipt.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/receipt.proto
View file @
65c121b8
...
...
@@ -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
;
...
...
model/pb/vp_info.pb.go
View file @
65c121b8
...
...
@@ -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.
...
...
model/pb/vp_info.proto
View file @
65c121b8
...
...
@@ -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
scripts/cross_compile.sh
View file @
65c121b8
...
...
@@ -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
scripts/docker_entrypoint.sh
View file @
65c121b8
...
...
@@ -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
"
$@
"
scripts/prepare.sh
View file @
65c121b8
...
...
@@ -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
scripts/release_binary.sh
View file @
65c121b8
...
...
@@ -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
scripts/x.sh
View file @
65c121b8
...
...
@@ -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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment