Skip to content

Commit 88ce487

Browse files
authored
Merge pull request #827 from binance-chain/develop
Release v0.8.2
2 parents 4c5511e + ba384d5 commit 88ce487

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.8.2
4+
BUG FIXES
5+
* [\#823](https://github.com/binance-chain/node/pull/823) [Pub] return error when executing mirror or mirror sync request failed
6+
37
## 0.8.1
48
FEATURES
59
* [\#809](https://github.com/binance-chain/node/pull/809) [Token] Implement BEP84

plugins/bridge/cross_app.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ func (app *MirrorApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, relayer
524524
return sdk.ExecuteResult{
525525
Payload: ackPackage,
526526
Tags: tags,
527+
Err: types.ErrInvalidMirror("invalid mirror package"),
527528
}
528529
}
529530

@@ -540,6 +541,7 @@ func (app *MirrorApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, relayer
540541
return sdk.ExecuteResult{
541542
Payload: ackPackage,
542543
Tags: tags,
544+
Err: types.ErrMirrorSymbolExists(fmt.Sprintf("symbol %s already exists", symbol)),
543545
}
544546
}
545547

@@ -700,6 +702,7 @@ func (app *MirrorSyncApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, rel
700702
return sdk.ExecuteResult{
701703
Payload: ackPackage,
702704
Tags: tags,
705+
Err: types.ErrInvalidMirrorSync("invalid mirror sync package"),
703706
}
704707
}
705708

@@ -720,6 +723,7 @@ func (app *MirrorSyncApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, rel
720723
return sdk.ExecuteResult{
721724
Tags: tags,
722725
Payload: ackPackage,
726+
Err: types.ErrNotBoundByMirror(fmt.Sprintf("token %s is not bound by mirror", token.GetSymbol())),
723727
}
724728
}
725729

@@ -737,8 +741,10 @@ func (app *MirrorSyncApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, rel
737741
return sdk.ExecuteResult{
738742
Tags: tags,
739743
Payload: ackPackage,
744+
Err: types.ErrMirrorSyncInvalidSupply(fmt.Sprintf("mirror sync supply %d is invalid", newSupply)),
740745
}
741746
}
747+
742748
oldSupply := token.GetTotalSupply().ToInt64()
743749
if newSupply > oldSupply {
744750
if _, _, sdkError := app.bridgeKeeper.BankKeeper.AddCoins(ctx, token.GetOwner(),

plugins/bridge/types/errors.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ const (
2424
CodeTokenBindRelationChanged sdk.CodeType = 15
2525
CodeTransferInExpire sdk.CodeType = 16
2626
CodeScriptsExecutionError sdk.CodeType = 17
27+
CodeInvalidMirror sdk.CodeType = 18
28+
CodeMirrorSymbolExists sdk.CodeType = 19
29+
CodeInvalidMirrorSync sdk.CodeType = 20
30+
CodeNotBoundByMirror sdk.CodeType = 21
31+
CodeMirrorSyncInvalidSupply sdk.CodeType = 22
2732
)
2833

2934
//----------------------------------------
@@ -96,3 +101,23 @@ func ErrTransferInExpire(msg string) sdk.Error {
96101
func ErrScriptsExecutionError(msg string) sdk.Error {
97102
return sdk.NewError(DefaultCodespace, CodeScriptsExecutionError, msg)
98103
}
104+
105+
func ErrInvalidMirror(msg string) sdk.Error {
106+
return sdk.NewError(DefaultCodespace, CodeInvalidMirror, msg)
107+
}
108+
109+
func ErrMirrorSymbolExists(msg string) sdk.Error {
110+
return sdk.NewError(DefaultCodespace, CodeMirrorSymbolExists, msg)
111+
}
112+
113+
func ErrInvalidMirrorSync(msg string) sdk.Error {
114+
return sdk.NewError(DefaultCodespace, CodeInvalidMirrorSync, msg)
115+
}
116+
117+
func ErrNotBoundByMirror(msg string) sdk.Error {
118+
return sdk.NewError(DefaultCodespace, CodeNotBoundByMirror, msg)
119+
}
120+
121+
func ErrMirrorSyncInvalidSupply(msg string) sdk.Error {
122+
return sdk.NewError(DefaultCodespace, CodeMirrorSyncInvalidSupply, msg)
123+
}

version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var (
1212
Version string
1313
)
1414

15-
const NodeVersion = "v0.8.1"
15+
const NodeVersion = "v0.8.2"
1616

1717
func init() {
1818
Version = fmt.Sprintf("Binance Chain Release: %s;", NodeVersion)

0 commit comments

Comments
 (0)