Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
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
plugin
Commits
dd7fbd8c
Commit
dd7fbd8c
authored
Nov 09, 2021
by
harrylee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update broker
parent
e664d86c
Pipeline
#8222
failed with stages
in 0 seconds
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
79 deletions
+74
-79
brokerdb.go
plugin/dapp/broker/executor/brokerdb.go
+3
-2
tables.go
plugin/dapp/broker/executor/tables.go
+0
-2
broker.proto
plugin/dapp/broker/proto/broker.proto
+7
-21
broker.pb.go
plugin/dapp/broker/types/broker.pb.go
+64
-54
No files found.
plugin/dapp/broker/executor/brokerdb.go
View file @
dd7fbd8c
...
...
@@ -140,14 +140,15 @@ func (b *BrokerDB) updateIndex(payload *brokertypes.UpdateIndex) (*types.Receipt
receipt
.
Logs
=
append
(
receipt
.
Logs
,
receiptlog
)
return
receipt
,
nil
}
//TODO 重构跨链事件发布
func
(
b
*
BrokerDB
)
emitInterchainEvent
(
payload
*
brokertypes
.
InterchainEvent
)
(
*
types
.
Receipt
,
error
)
{
//FIXME 权限检查,是否需要设定指定账户拥有跨链的权限
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
//发布跨链事件分为 1.信息跨链 2.代币跨链,代币跨链需要在这步将所需金额冻结在broker下面
if
payload
.
Type
==
brokertypes
.
Req_Type_Storage
{
//校验存在交易是否存在
params
:=
&
storagetypes
.
QueryStorage
{
TxHash
:
payload
.
Args
[
0
]
}
_
,
err
:=
b
.
api
.
Query
(
storagetypes
.
StorageX
,
payload
.
GetFunc
()
,
params
)
params
:=
&
storagetypes
.
QueryStorage
{
TxHash
:
payload
.
Args
}
_
,
err
:=
b
.
api
.
Query
(
storagetypes
.
StorageX
,
"QueryStorage"
,
params
)
if
err
!=
nil
{
return
nil
,
brokertypes
.
ErrBrokerStorageTx
}
...
...
plugin/dapp/broker/executor/tables.go
View file @
dd7fbd8c
...
...
@@ -47,8 +47,6 @@ func (m *InterchainEventRow) Get(key string) ([]byte, error) {
return
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
m
.
Index
)),
nil
}
else
if
key
==
"dstServiceID"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%s"
,
m
.
GetDstServiceID
())),
nil
}
else
if
key
==
"status"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%d"
,
m
.
GetStatus
())),
nil
}
else
if
key
==
"type"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%d"
,
m
.
GetType
())),
nil
}
...
...
plugin/dapp/broker/proto/broker.proto
View file @
dd7fbd8c
...
...
@@ -52,7 +52,6 @@ message UpdateIndex {
//响应信息
Response
response
=
5
;
}
// 跨链事件
message
InterchainEvent
{
//索引值,这个有系统自动生成
...
...
@@ -63,12 +62,16 @@ message InterchainEvent {
string
srcServiceID
=
3
;
//跨链交易类型 0表示storage,1表示coins,2表示token......
uint64
type
=
4
;
//
调用方法
//
方法集合分别表示 当前,回调,回滚方法 用,号分割 比如: "interchainGet,interchainSet,interchainRollback"
string
func
=
5
;
//参数列表
repeated
string
args
=
6
;
string
args
=
6
;
//回调参数
string
argscb
=
7
;
//回滚参数
string
argsrb
=
8
;
//状态 0表示开始处理 1表示跨链成功 2表示跨链失败
int32
status
=
7
;
//
int32 status = 7;
}
//ReceiptBrokerLog
message
ReceiptBrokerLog
{
...
...
@@ -95,23 +98,6 @@ message InterChainEventList{
repeated
InterchainEvent
list
=
1
;
}
////根据状态查看跨链事件
//message QueryInterchainEventList {
// //事件状态必填(默认是0,只查询待处理状态的事件)
// int32 status = 1;
// // 主键索引
// string primaryKey = 2;
// //单页返回多少条记录,默认返回10条,为了系统安全最多单次只能返回20条
// int32 count = 3;
// // 0降序,1升序,默认降序
// int32 direction = 4;
//}
////跨链事件列表
//message InterchainEventList {
// repeated InterchainEvent list = 1;
// string primaryKey = 2;
//}
message
QueryNilParam
{
}
...
...
plugin/dapp/broker/types/broker.pb.go
View file @
dd7fbd8c
This diff is collapsed.
Click to expand it.
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