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:
...
@@ -11,7 +11,7 @@ stages:
build
:
build
:
stage
:
build
stage
:
build
script
:
script
:
-
make
fmt
-
make
check
-
make build
-
make build
test
:
test
:
...
...
Makefile
View file @
65c121b8
...
@@ -38,7 +38,7 @@ GREEN=\033[0;32m
...
@@ -38,7 +38,7 @@ GREEN=\033[0;32m
BLUE
=
\0
33[0
;
34m
BLUE
=
\0
33[0
;
34m
NC
=
\0
33[0m
NC
=
\0
33[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
internal/exchanger/pool.go
View file @
65c121b8
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
{
...
...
internal/loggers/logger_test.go
View file @
65c121b8
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"
)
)
...
...
internal/manger/persister.go
View file @
65c121b8
...
@@ -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"
...
...
internal/peermgr/local.go
View file @
65c121b8
...
@@ -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"
...
...
internal/txcrypto/direct_cryptor.go
View file @
65c121b8
...
@@ -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"
...
...
model/pb/arg.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/arg.proto
View file @
65c121b8
...
@@ -4,17 +4,17 @@ package pb;
...
@@ -4,17 +4,17 @@ package pb;
message
Arg
{
message
Arg
{
enum
Type
{
enum
Type
{
I32
=
0
;
I32
=
0
;
I64
=
1
;
I64
=
1
;
U32
=
2
;
U32
=
2
;
U64
=
3
;
U64
=
3
;
F32
=
4
;
F32
=
4
;
F64
=
5
;
F64
=
5
;
String
=
6
;
String
=
6
;
Bytes
=
7
;
Bytes
=
7
;
Bool
=
8
;
Bool
=
8
;
}
}
Type
type
=
1
;
Type
type
=
1
;
bool
is_array
=
2
;
bool
is_array
=
2
;
bytes
value
=
3
;
bytes
value
=
3
;
}
}
\ No newline at end of file
model/pb/basic.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/basic.proto
View file @
65c121b8
...
@@ -3,34 +3,34 @@ syntax = "proto3";
...
@@ -3,34 +3,34 @@ syntax = "proto3";
package
pb
;
package
pb
;
message
Uint64Slice
{
message
Uint64Slice
{
repeated
uint64
slice
=
1
;
repeated
uint64
slice
=
1
;
}
}
message
StringUint64Map
{
message
StringUint64Map
{
repeated
string
keys
=
1
;
repeated
string
keys
=
1
;
repeated
uint64
vals
=
2
;
repeated
uint64
vals
=
2
;
}
}
message
StringUint64SliceMap
{
message
StringUint64SliceMap
{
repeated
string
keys
=
1
;
repeated
string
keys
=
1
;
repeated
Uint64Slice
vals
=
2
;
repeated
Uint64Slice
vals
=
2
;
}
}
message
VerifiedIndex
{
message
VerifiedIndex
{
uint64
index
=
1
;
uint64
index
=
1
;
bool
valid
=
2
;
bool
valid
=
2
;
}
}
message
VerifiedIndexSlice
{
message
VerifiedIndexSlice
{
repeated
VerifiedIndex
slice
=
1
;
repeated
VerifiedIndex
slice
=
1
;
}
}
message
StringVerifiedIndexMap
{
message
StringVerifiedIndexMap
{
repeated
string
keys
=
1
;
repeated
string
keys
=
1
;
repeated
VerifiedIndex
vals
=
2
;
repeated
VerifiedIndex
vals
=
2
;
}
}
message
StringVerifiedIndexSliceMap
{
message
StringVerifiedIndexSliceMap
{
repeated
string
keys
=
1
;
repeated
string
keys
=
1
;
repeated
VerifiedIndexSlice
vals
=
2
;
repeated
VerifiedIndexSlice
vals
=
2
;
}
}
\ No newline at end of file
model/pb/block.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/block.proto
View file @
65c121b8
...
@@ -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
model/pb/broker.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/broker.proto
View file @
65c121b8
...
@@ -10,267 +10,267 @@ import "block.proto";
...
@@ -10,267 +10,267 @@ 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
:
"*"
};
};
}
}
}
}
message
GetBlockHeaderRequest
{
message
GetBlockHeaderRequest
{
uint64
begin
=
1
;
uint64
begin
=
1
;
uint64
end
=
2
;
uint64
end
=
2
;
}
}
message
GetInterchainTxWrappersRequest
{
message
GetInterchainTxWrappersRequest
{
uint64
begin
=
1
;
uint64
begin
=
1
;
uint64
end
=
2
;
uint64
end
=
2
;
string
pid
=
3
;
string
pid
=
3
;
}
}
message
TransactionHashMsg
{
message
TransactionHashMsg
{
string
tx_hash
=
1
;
string
tx_hash
=
1
;
}
}
message
GetBlockRequest
{
message
GetBlockRequest
{
enum
Type
{
enum
Type
{
HEIGHT
=
0
;
HEIGHT
=
0
;
HASH
=
1
;
HASH
=
1
;
}
}
Type
type
=
1
;
Type
type
=
1
;
string
value
=
2
;
string
value
=
2
;
}
}
message
Request
{
message
Request
{
enum
Type
{
enum
Type
{
CHAIN_STATUS
=
0
;
CHAIN_STATUS
=
0
;
NETWORK
=
1
;
NETWORK
=
1
;
VALIDATORS
=
2
;
VALIDATORS
=
2
;
}
}
Type
type
=
1
;
Type
type
=
1
;
}
}
message
Response
{
message
Response
{
bytes
data
=
1
;
bytes
data
=
1
;
}
}
message
SignResponse
{
message
SignResponse
{
map
<
string
,
bytes
>
sign
=
1
;
map
<
string
,
bytes
>
sign
=
1
;
}
}
message
Address
{
message
Address
{
string
address
=
1
;
string
address
=
1
;
}
}
message
GetBlocksRequest
{
message
GetBlocksRequest
{
uint64
start
=
1
;
uint64
start
=
1
;
uint64
end
=
2
;
uint64
end
=
2
;
}
}
message
GetBlocksResponse
{
message
GetBlocksResponse
{
repeated
pb.Block
blocks
=
1
;
repeated
pb.Block
blocks
=
1
;
}
}
message
GetBlockHeadersRequest
{
message
GetBlockHeadersRequest
{
uint64
start
=
1
;
uint64
start
=
1
;
uint64
end
=
2
;
uint64
end
=
2
;
}
}
message
GetBlockHeadersResponse
{
message
GetBlockHeadersResponse
{
repeated
pb.BlockHeader
blockHeaders
=
1
;
repeated
pb.BlockHeader
blockHeaders
=
1
;
}
}
message
SubscriptionRequest
{
message
SubscriptionRequest
{
enum
Type
{
enum
Type
{
BLOCK
=
0
;
BLOCK
=
0
;
EVENT
=
1
;
EVENT
=
1
;
INTERCHAIN_TX
=
2
;
INTERCHAIN_TX
=
2
;
BLOCK_HEADER
=
3
;
BLOCK_HEADER
=
3
;
INTERCHAIN_TX_WRAPPER
=
4
;
INTERCHAIN_TX_WRAPPER
=
4
;
UNION_INTERCHAIN_TX_WRAPPER
=
5
;
UNION_INTERCHAIN_TX_WRAPPER
=
5
;
}
}
Type
type
=
1
;
Type
type
=
1
;
bytes
extra
=
2
;
bytes
extra
=
2
;
}
}
message
GetMultiSignsRequest
{
message
GetMultiSignsRequest
{
enum
Type
{
enum
Type
{
ASSET_EXCHANGE
=
0
;
ASSET_EXCHANGE
=
0
;
IBTP
=
1
;
IBTP
=
1
;
BLOCK_HEADER
=
2
;
BLOCK_HEADER
=
2
;
}
}
Type
type
=
1
;
Type
type
=
1
;
string
content
=
2
;
string
content
=
2
;
}
}
message
GetTransactionResponse
{
message
GetTransactionResponse
{
pb.BxhTransaction
tx
=
1
;
pb.BxhTransaction
tx
=
1
;
pb.TransactionMeta
tx_meta
=
2
;
pb.TransactionMeta
tx_meta
=
2
;
}
}
message
VerifiedTx
{
message
VerifiedTx
{
pb.BxhTransaction
tx
=
1
;
pb.BxhTransaction
tx
=
1
;
bool
valid
=
2
;
bool
valid
=
2
;
}
}
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
;
}
}
message
InterchainTxWrappers
{
message
InterchainTxWrappers
{
repeated
InterchainTxWrapper
interchainTxWrappers
=
1
;
repeated
InterchainTxWrapper
interchainTxWrappers
=
1
;
}
}
message
GetTPSRequest
{
message
GetTPSRequest
{
uint64
begin
=
1
;
uint64
begin
=
1
;
uint64
end
=
2
;
uint64
end
=
2
;
}
}
message
DelVPNodeRequest
{
message
DelVPNodeRequest
{
string
pid
=
1
;
string
pid
=
1
;
}
}
message
SidecarInfo
{
message
SidecarInfo
{
string
address
=
1
;
string
address
=
1
;
string
index
=
2
;
string
index
=
2
;
int64
timeout
=
3
;
int64
timeout
=
3
;
}
}
message
CheckSidecarResponse
{
message
CheckSidecarResponse
{
enum
Status
{
enum
Status
{
ERROR_MASTER
=
0
;
ERROR_MASTER
=
0
;
HAS_MASTER
=
1
;
HAS_MASTER
=
1
;
NO_MASTER
=
2
;
NO_MASTER
=
2
;
}
}
Status
status
=
1
;
Status
status
=
1
;
string
address
=
2
;
string
address
=
2
;
}
}
message
HeartBeatRespones
{
message
HeartBeatRespones
{
enum
Status
{
enum
Status
{
ALIVE
=
0
;
ALIVE
=
0
;
DEAD
=
1
;
DEAD
=
1
;
}
}
Status
status
=
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
...
@@ -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.
...
...
model/pb/bxh_transaction.proto
View file @
65c121b8
...
@@ -7,53 +7,53 @@ import "arg.proto";
...
@@ -7,53 +7,53 @@ import "arg.proto";
import
"ibtp.proto"
;
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
;
uint64
amount
=
9
;
uint64
amount
=
9
;
bytes
signature
=
10
;
bytes
signature
=
10
;
bytes
extra
=
11
;
bytes
extra
=
11
;
}
}
message
TransactionData
{
message
TransactionData
{
enum
Type
{
enum
Type
{
NORMAL
=
0
;
NORMAL
=
0
;
INVOKE
=
1
;
INVOKE
=
1
;
UPDATE
=
2
;
UPDATE
=
2
;
FREEZE
=
3
;
FREEZE
=
3
;
UNFREEZE
=
4
;
UNFREEZE
=
4
;
}
}
Type
type
=
1
;
Type
type
=
1
;
uint64
amount
=
2
;
uint64
amount
=
2
;
enum
VMType
{
enum
VMType
{
BVM
=
0
;
BVM
=
0
;
XVM
=
1
;
XVM
=
1
;
}
}
VMType
vm_type
=
3
;
VMType
vm_type
=
3
;
bytes
payload
=
4
;
bytes
payload
=
4
;
bytes
extra
=
5
;
bytes
extra
=
5
;
}
}
message
InvokePayload
{
message
InvokePayload
{
string
method
=
1
;
string
method
=
1
;
repeated
Arg
args
=
2
;
repeated
Arg
args
=
2
;
}
}
message
TransactionMeta
{
message
TransactionMeta
{
bytes
block_hash
=
1
;
bytes
block_hash
=
1
;
uint64
block_height
=
2
;
uint64
block_height
=
2
;
uint64
index
=
3
;
uint64
index
=
3
;
}
}
message
CrosschainTransactionExtra
{
message
CrosschainTransactionExtra
{
uint64
index
=
1
;
// to_id index
uint64
index
=
1
;
// to_id index
bool
status
=
2
;
// receipt status
bool
status
=
2
;
// receipt status
bytes
ret
=
3
;
// receipt result
bytes
ret
=
3
;
// receipt result
}
}
message
TransactionTracingMeta
{
message
TransactionTracingMeta
{
...
@@ -62,28 +62,28 @@ message TransactionTracingMeta {
...
@@ -62,28 +62,28 @@ message TransactionTracingMeta {
}
}
message
TransactionSlice
{
message
TransactionSlice
{
uint64
height
=
1
;
uint64
height
=
1
;
repeated
BxhTransaction
txs
=
2
;
repeated
BxhTransaction
txs
=
2
;
}
}
message
AssetExchangeInfo
{
message
AssetExchangeInfo
{
string
id
=
1
;
string
id
=
1
;
string
sender_on_src
=
2
;
string
sender_on_src
=
2
;
string
receiver_on_src
=
3
;
string
receiver_on_src
=
3
;
uint64
asset_on_src
=
4
;
uint64
asset_on_src
=
4
;
string
sender_on_dst
=
5
;
string
sender_on_dst
=
5
;
string
receiver_on_dst
=
6
;
string
receiver_on_dst
=
6
;
uint64
asset_on_dst
=
7
;
uint64
asset_on_dst
=
7
;
}
}
enum
TransactionStatus
{
enum
TransactionStatus
{
BEGIN
=
0
;
BEGIN
=
0
;
SUCCESS
=
1
;
SUCCESS
=
1
;
FAILURE
=
2
;
FAILURE
=
2
;
}
}
enum
AssetExchangeStatus
{
enum
AssetExchangeStatus
{
INIT
=
0
;
INIT
=
0
;
REDEEM
=
1
;
REDEEM
=
1
;
REFUND
=
2
;
REFUND
=
2
;
}
}
\ No newline at end of file
model/pb/chain.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/chain.proto
View file @
65c121b8
...
@@ -5,7 +5,7 @@ package pb;
...
@@ -5,7 +5,7 @@ package pb;
import
"github.com/gogo/protobuf/gogoproto/gogo.proto"
;
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
model/pb/commit.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/commit.proto
View file @
65c121b8
...
@@ -6,6 +6,6 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
...
@@ -6,6 +6,6 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import
"block.proto"
;
import
"block.proto"
;
message
commit_event
{
message
commit_event
{
Block
block
=
1
;
Block
block
=
1
;
repeated
bool
local_list
=
2
;
repeated
bool
local_list
=
2
;
}
}
model/pb/ibtp.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/ibtp.proto
View file @
65c121b8
...
@@ -7,19 +7,19 @@ import "basic.proto";
...
@@ -7,19 +7,19 @@ import "basic.proto";
// Inter-blockchain Transfer Protocol
// Inter-blockchain Transfer Protocol
message
IBTP
{
message
IBTP
{
enum
Type
{
enum
Type
{
INTERCHAIN
=
0
;
INTERCHAIN
=
0
;
RECEIPT_SUCCESS
=
1
;
RECEIPT_SUCCESS
=
1
;
RECEIPT_FAILURE
=
2
;
RECEIPT_FAILURE
=
2
;
ASSET_EXCHANGE_INIT
=
3
;
ASSET_EXCHANGE_INIT
=
3
;
ASSET_EXCHANGE_REDEEM
=
4
;
ASSET_EXCHANGE_REDEEM
=
4
;
ASSET_EXCHANGE_REFUND
=
5
;
ASSET_EXCHANGE_REFUND
=
5
;
ASSET_EXCHANGE_RECEIPT
=
6
;
ASSET_EXCHANGE_RECEIPT
=
6
;
}
}
enum
Category
{
enum
Category
{
REQUEST
=
0
;
REQUEST
=
0
;
RESPONSE
=
1
;
RESPONSE
=
1
;
UNKNOWN
=
2
;
UNKNOWN
=
2
;
}
}
// ID of sending chain
// ID of sending chain
...
@@ -45,19 +45,19 @@ message IBTP {
...
@@ -45,19 +45,19 @@ message IBTP {
}
}
message
payload
{
message
payload
{
bool
encrypted
=
1
;
bool
encrypted
=
1
;
bytes
content
=
2
;
bytes
content
=
2
;
}
}
message
content
{
message
content
{
string
src_contract_id
=
1
;
string
src_contract_id
=
1
;
string
dst_contract_id
=
2
;
string
dst_contract_id
=
2
;
string
func
=
3
;
string
func
=
3
;
repeated
bytes
args
=
4
;
repeated
bytes
args
=
4
;
string
callback
=
5
;
string
callback
=
5
;
repeated
bytes
argsCb
=
6
;
repeated
bytes
argsCb
=
6
;
string
rollback
=
7
;
string
rollback
=
7
;
repeated
bytes
argsRb
=
8
;
repeated
bytes
argsRb
=
8
;
}
}
message
IBTPs
{
message
IBTPs
{
...
...
model/pb/ibtpx.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/ibtpx.proto
View file @
65c121b8
...
@@ -2,17 +2,17 @@ syntax = "proto3";
...
@@ -2,17 +2,17 @@ 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如下值时。
// method:single、multicast、broadcast、随机选择、最快速度、官方节点、开源节点、nat节点。
// method:single、multicast、broadcast、随机选择、最快速度、官方节点、开源节点、nat节点。
...
@@ -22,4 +22,3 @@ message IBTPX {
...
@@ -22,4 +22,3 @@ message IBTPX {
// broadcast:广播所有的给所有的peer。
// broadcast:广播所有的给所有的peer。
// 设置节点筛选器,根据标签。
// 设置节点筛选器,根据标签。
// 不需要指定节点ID,
// 不需要指定节点ID,
model/pb/interchain_meta.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/interchain_meta.proto
View file @
65c121b8
...
@@ -6,13 +6,13 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
...
@@ -6,13 +6,13 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import
"basic.proto"
;
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
{
string
ID
=
1
;
string
ID
=
1
;
StringUint64Map
InterchainCounter
=
2
;
StringUint64Map
InterchainCounter
=
2
;
StringUint64Map
ReceiptCounter
=
3
;
StringUint64Map
ReceiptCounter
=
3
;
StringUint64Map
SourceReceiptCounter
=
4
;
StringUint64Map
SourceReceiptCounter
=
4
;
}
}
\ No newline at end of file
model/pb/message.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/message.proto
View file @
65c121b8
...
@@ -4,33 +4,31 @@ package pb;
...
@@ -4,33 +4,31 @@ package pb;
message
Message
{
message
Message
{
enum
Type
{
enum
Type
{
ACK
=
0
;
ACK
=
0
;
ADDRESS_GET
=
1
;
ADDRESS_GET
=
1
;
APPCHAIN_REGISTER
=
2
;
APPCHAIN_REGISTER
=
2
;
APPCHAIN_UPDATE
=
3
;
APPCHAIN_UPDATE
=
3
;
APPCHAIN_GET
=
4
;
APPCHAIN_GET
=
4
;
INTERCHAIN_META_GET
=
5
;
INTERCHAIN_META_GET
=
5
;
RULE_DEPLOY
=
6
;
//部署验证规则
RULE_DEPLOY
=
6
;
//部署验证规则
//异步完成
//异步完成
IBTP_GET
=
7
;
IBTP_GET
=
7
;
IBTP_SEND
=
8
;
IBTP_SEND
=
8
;
IBTP_RECEIPT_SEND
=
9
;
IBTP_RECEIPT_SEND
=
9
;
IBTP_RECEIPT_GET
=
10
;
IBTP_RECEIPT_GET
=
10
;
PEER_INFO_GET
=
11
;
PEER_INFO_GET
=
11
;
}
}
Type
type
=
1
;
Type
type
=
1
;
Pack
payload
=
2
;
Pack
payload
=
2
;
string
version
=
3
;
string
version
=
3
;
}
}
message
Pack
{
message
Pack
{
bool
ok
=
1
;
bool
ok
=
1
;
bytes
data
=
2
;
bytes
data
=
2
;
}
}
message
PeerInfo
{
message
PeerInfo
{
string
ID
=
1
;
string
ID
=
1
;
string
Tag
=
2
;
string
Tag
=
2
;
}
}
model/pb/plugin.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/plugin.proto
View file @
65c121b8
...
@@ -7,34 +7,34 @@ message Empty {}
...
@@ -7,34 +7,34 @@ message Empty {}
message
InitializeRequest
{
message
InitializeRequest
{
string
config_path
=
1
;
string
config_path
=
1
;
string
sidecar_id
=
2
;
string
sidecar_id
=
2
;
bytes
extra
=
3
;
bytes
extra
=
3
;
}
}
message
SubmitIBTPResponse
{
message
SubmitIBTPResponse
{
bool
status
=
1
;
bool
status
=
1
;
string
message
=
2
;
string
message
=
2
;
pb.IBTP
result
=
3
;
pb.IBTP
result
=
3
;
}
}
message
RollbackIBTPRequest
{
message
RollbackIBTPRequest
{
pb.IBTP
ibtp
=
1
;
pb.IBTP
ibtp
=
1
;
bool
srcChain
=
2
;
bool
srcChain
=
2
;
}
}
message
RollbackIBTPResponse
{
message
RollbackIBTPResponse
{
bool
status
=
1
;
bool
status
=
1
;
string
message
=
2
;
string
message
=
2
;
}
}
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
{
...
...
model/pb/receipt.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/receipt.proto
View file @
65c121b8
...
@@ -7,17 +7,17 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
...
@@ -7,17 +7,17 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message
Receipt
{
message
Receipt
{
enum
Status
{
enum
Status
{
SUCCESS
=
0
;
SUCCESS
=
0
;
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
;
...
...
model/pb/vp_info.pb.go
View file @
65c121b8
...
@@ -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.
...
...
model/pb/vp_info.proto
View file @
65c121b8
...
@@ -3,8 +3,8 @@ syntax = "proto3";
...
@@ -3,8 +3,8 @@ syntax = "proto3";
package
pb
;
package
pb
;
message
VpInfo
{
message
VpInfo
{
uint64
id
=
1
;
uint64
id
=
1
;
string
pid
=
2
;
string
pid
=
2
;
string
account
=
3
;
string
account
=
3
;
repeated
string
hosts
=
4
;
repeated
string
hosts
=
4
;
}
}
\ No newline at end of file
scripts/cross_compile.sh
View file @
65c121b8
...
@@ -6,17 +6,17 @@ source x.sh
...
@@ -6,17 +6,17 @@ 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
\
-v
$2
/../sidecar-client-fabric:/code/sidecar-client-fabric
\
-v
$2
/../sidecar-client-fabric:/code/sidecar-client-fabric
\
-v
$2
/../sidecar-client-ethereum:/code/sidecar-client-ethereum
\
-v
$2
/../sidecar-client-ethereum:/code/sidecar-client-ethereum
\
-v
~/.ssh:/root/.ssh
\
-v
~/.ssh:/root/.ssh
\
-v
~/.gitconfig:/root/.gitconfig
\
-v
~/.gitconfig:/root/.gitconfig
\
-v
$GOPATH
/pkg/mod:
$GOPATH
/pkg/mod
\
-v
$GOPATH
/pkg/mod:
$GOPATH
/pkg/mod
\
sidecar-ubuntu/compile
\
sidecar-ubuntu/compile
\
/bin/bash
-c
"go env -w GO111MODULE=on &&
/bin/bash
-c
"go env -w GO111MODULE=on &&
go env -w GOPROXY=https://goproxy.cn,direct &&
go env -w GOPROXY=https://goproxy.cn,direct &&
go get -u github.com/gobuffalo/packr/packr &&
go get -u github.com/gobuffalo/packr/packr &&
cd /code/sidecar-client-fabric && make fabric1.4 &&
cd /code/sidecar-client-fabric && make fabric1.4 &&
...
@@ -26,8 +26,8 @@ linux-amd64)
...
@@ -26,8 +26,8 @@ linux-amd64)
cp /go/bin/sidecar /code/sidecar/bin/sidecar_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-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
scripts/docker_entrypoint.sh
View file @
65c121b8
...
@@ -5,20 +5,19 @@ APPCHAIN_NAME=$1
...
@@ -5,20 +5,19 @@ APPCHAIN_NAME=$1
PLUGIN_CONFIG
=
$2
PLUGIN_CONFIG
=
$2
sidecar
--repo
=
/root/sidecar appchain method register
--admin-key
./key.json
--method
fabappchain
\
sidecar
--repo
=
/root/sidecar appchain method register
--admin-key
./key.json
--method
fabappchain
\
--doc-addr
/ipfs/QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi
\
--doc-addr
/ipfs/QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi
\
--doc-hash
QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi
\
--doc-hash
QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi
\
--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
exec
"
$@
"
exec
"
$@
"
\ No newline at end of file
scripts/prepare.sh
View file @
65c121b8
...
@@ -4,23 +4,23 @@ BLUE='\033[0;34m'
...
@@ -4,23 +4,23 @@ BLUE='\033[0;34m'
NC
=
'\033[0m'
NC
=
'\033[0m'
function
print_blue
()
{
function
print_blue
()
{
printf
"
${
BLUE
}
%s
${
NC
}
\n
"
"
$1
"
printf
"
${
BLUE
}
%s
${
NC
}
\n
"
"
$1
"
}
}
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
go get
-u
github.com/gobuffalo/packr/packr
go get
-u
github.com/gobuffalo/packr/packr
fi
fi
print_blue
"===> 2. Install golangci-lint"
print_blue
"===> 2. Install golangci-lint"
if
!
type
golanci-lint
>
/dev/null 2>&1
;
then
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
fi
print_blue
"===> 3. Install go mock tool"
print_blue
"===> 3. Install go mock tool"
if
!
type
gomock
>
/dev/null 2>&1
;
then
if
!
type
gomock
>
/dev/null 2>&1
;
then
go get github.com/golang/mock/gomock
go get github.com/golang/mock/gomock
fi
fi
if
!
type
mockgen
>
/dev/null 2>&1
;
then
if
!
type
mockgen
>
/dev/null 2>&1
;
then
go get github.com/golang/mock/mockgen
go get github.com/golang/mock/mockgen
fi
fi
\ No newline at end of file
scripts/release_binary.sh
View file @
65c121b8
...
@@ -6,11 +6,11 @@ source x.sh
...
@@ -6,11 +6,11 @@ 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
go get
-u
github.com/gobuffalo/packr/packr
go get
-u
github.com/gobuffalo/packr/packr
fi
fi
print_blue
"===> 2. build sidecar"
print_blue
"===> 2. build sidecar"
...
@@ -19,9 +19,9 @@ cd "${PROJECT_PATH}" && make build
...
@@ -19,9 +19,9 @@ cd "${PROJECT_PATH}" && make build
print_blue
"===> 3. pack binarys"
print_blue
"===> 3. pack binarys"
cd
"
${
RELEASE_PATH
}
"
cd
"
${
RELEASE_PATH
}
"
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
cp
../build/wasm/lib/darwin-amd64/libwasmer.dylib
.
cp
../build/wasm/lib/darwin-amd64/libwasmer.dylib
.
tar
zcvf sidecar_darwin_x86_64_
"
${
APP_VERSION
}
"
.tar.gz ./sidecar ./libwasmer.dylib
tar
zcvf sidecar_darwin_x86_64_
"
${
APP_VERSION
}
"
.tar.gz ./sidecar ./libwasmer.dylib
else
else
cp
../build/wasm/lib/linux-amd64/libwasmer.so
.
cp
../build/wasm/lib/linux-amd64/libwasmer.so
.
tar
zcvf sidecar_linux-amd64_
"
${
APP_VERSION
}
"
.tar.gz ./sidecar ./libwasmer.so
tar
zcvf sidecar_linux-amd64_
"
${
APP_VERSION
}
"
.tar.gz ./sidecar ./libwasmer.so
fi
fi
scripts/x.sh
View file @
65c121b8
...
@@ -4,26 +4,26 @@ BLUE='\033[0;34m'
...
@@ -4,26 +4,26 @@ BLUE='\033[0;34m'
NC
=
'\033[0m'
NC
=
'\033[0m'
function
print_blue
()
{
function
print_blue
()
{
printf
"
${
BLUE
}
%s
${
NC
}
\n
"
"
$1
"
printf
"
${
BLUE
}
%s
${
NC
}
\n
"
"
$1
"
}
}
function
print_green
()
{
function
print_green
()
{
printf
"
${
GREEN
}
%s
${
NC
}
\n
"
"
$1
"
printf
"
${
GREEN
}
%s
${
NC
}
\n
"
"
$1
"
}
}
function
print_red
()
{
function
print_red
()
{
printf
"
${
RED
}
%s
${
NC
}
\n
"
"
$1
"
printf
"
${
RED
}
%s
${
NC
}
\n
"
"
$1
"
}
}
# The sed commend with system judging
# The sed commend with system judging
# Examples:
# Examples:
# sed -i 's/a/b/g' bob.txt => x_replace 's/a/b/g' bob.txt
# sed -i 's/a/b/g' bob.txt => x_replace 's/a/b/g' bob.txt
function
x_replace
()
{
function
x_replace
()
{
system
=
$(
uname
)
system
=
$(
uname
)
if
[
"
${
system
}
"
=
"Linux"
]
;
then
if
[
"
${
system
}
"
=
"Linux"
]
;
then
sed
-i
"
$@
"
sed
-i
"
$@
"
else
else
sed
-i
''
"
$@
"
sed
-i
''
"
$@
"
fi
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