Skip to content

Commit

Permalink
Merge pull request #827 from binance-chain/develop
Browse files Browse the repository at this point in the history
Release v0.8.2
  • Loading branch information
yutianwu authored Jan 26, 2021
2 parents 4c5511e + ba384d5 commit 88ce487
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.8.2
BUG FIXES
* [\#823](https://github.com/binance-chain/node/pull/823) [Pub] return error when executing mirror or mirror sync request failed

## 0.8.1
FEATURES
* [\#809](https://github.com/binance-chain/node/pull/809) [Token] Implement BEP84
Expand Down
6 changes: 6 additions & 0 deletions plugins/bridge/cross_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ func (app *MirrorApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, relayer
return sdk.ExecuteResult{
Payload: ackPackage,
Tags: tags,
Err: types.ErrInvalidMirror("invalid mirror package"),
}
}

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

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

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

Expand All @@ -737,8 +741,10 @@ func (app *MirrorSyncApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, rel
return sdk.ExecuteResult{
Tags: tags,
Payload: ackPackage,
Err: types.ErrMirrorSyncInvalidSupply(fmt.Sprintf("mirror sync supply %d is invalid", newSupply)),
}
}

oldSupply := token.GetTotalSupply().ToInt64()
if newSupply > oldSupply {
if _, _, sdkError := app.bridgeKeeper.BankKeeper.AddCoins(ctx, token.GetOwner(),
Expand Down
25 changes: 25 additions & 0 deletions plugins/bridge/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ const (
CodeTokenBindRelationChanged sdk.CodeType = 15
CodeTransferInExpire sdk.CodeType = 16
CodeScriptsExecutionError sdk.CodeType = 17
CodeInvalidMirror sdk.CodeType = 18
CodeMirrorSymbolExists sdk.CodeType = 19
CodeInvalidMirrorSync sdk.CodeType = 20
CodeNotBoundByMirror sdk.CodeType = 21
CodeMirrorSyncInvalidSupply sdk.CodeType = 22
)

//----------------------------------------
Expand Down Expand Up @@ -96,3 +101,23 @@ func ErrTransferInExpire(msg string) sdk.Error {
func ErrScriptsExecutionError(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeScriptsExecutionError, msg)
}

func ErrInvalidMirror(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidMirror, msg)
}

func ErrMirrorSymbolExists(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeMirrorSymbolExists, msg)
}

func ErrInvalidMirrorSync(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidMirrorSync, msg)
}

func ErrNotBoundByMirror(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeNotBoundByMirror, msg)
}

func ErrMirrorSyncInvalidSupply(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeMirrorSyncInvalidSupply, msg)
}
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var (
Version string
)

const NodeVersion = "v0.8.1"
const NodeVersion = "v0.8.2"

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

0 comments on commit 88ce487

Please sign in to comment.