Skip to content

Commit

Permalink
add upgrade height for FixFailAckPackage
Browse files Browse the repository at this point in the history
register channel
  • Loading branch information
HaoyangLiu committed Dec 25, 2020
1 parent b541325 commit dab338c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ func SetUpgradeConfig(upgradeConfig *config.UpgradeConfig) {
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP8, upgradeConfig.BEP8Height)
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP67, upgradeConfig.BEP67Height)
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP70, upgradeConfig.BEP70Height)
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP100, upgradeConfig.BEP100Height)
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP84, upgradeConfig.BEP84Height)
upgrade.Mgr.AddUpgradeHeight(sdk.FixFailAckPackage, upgradeConfig.FixFailAckPackageHeight)

// register store keys of upgrade
upgrade.Mgr.RegisterStoreKeys(upgrade.BEP9, common.TimeLockStoreKey.Name())
Expand Down
18 changes: 11 additions & 7 deletions app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ BEP8Height = {{ .UpgradeConfig.BEP8Height }}
BEP67Height = {{ .UpgradeConfig.BEP67Height }}
# Block height of BEP70 upgrade
BEP70Height = {{ .UpgradeConfig.BEP70Height }}
# Block height of BEP100 upgrade
BEP100Height = {{ .UpgradeConfig.BEP100Height }}
# Block height of BEP84 upgrade
BEP84Height = {{ .UpgradeConfig.BEP84Height }}
# Block height of FixFailAckPackage upgrade
FixFailAckPackageHeight = {{ .UpgradeConfig.FixFailAckPackageHeight }}
[query]
# ABCI query interface black list, suggested value: ["custom/gov/proposals", "custom/timelock/timelocks", "custom/atomicSwap/swapcreator", "custom/atomicSwap/swaprecipient"]
Expand Down Expand Up @@ -492,10 +494,11 @@ type UpgradeConfig struct {
LaunchBscUpgradeHeight int64 `mapstructure:"LaunchBscUpgradeHeight"`

// TODO: add upgrade name
BEP8Height int64 `mapstructure:"BEP8Height"`
BEP67Height int64 `mapstructure:"BEP67Height"`
BEP70Height int64 `mapstructure:"BEP70Height"`
BEP100Height int64 `mapstructure:"BEP100Height"`
BEP8Height int64 `mapstructure:"BEP8Height"`
BEP67Height int64 `mapstructure:"BEP67Height"`
BEP70Height int64 `mapstructure:"BEP70Height"`
BEP84Height int64 `mapstructure:"BEP84Height"`
FixFailAckPackageHeight int64 `mapstructure:"FixFailAckPackageHeight"`
}

func defaultUpgradeConfig() *UpgradeConfig {
Expand All @@ -514,7 +517,8 @@ func defaultUpgradeConfig() *UpgradeConfig {
BEP8Height: 1,
BEP67Height: 1,
BEP70Height: 1,
BEP100Height: 1,
BEP84Height: 1,
FixFailAckPackageHeight: 1,
LaunchBscUpgradeHeight: math.MaxInt64,
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
BEP67 = "BEP67" // https://github.com/binance-chain/BEPs/pull/67 Expiry time upgrade
BEP70 = "BEP70" // https://github.com/binance-chain/BEPs/pull/70 BUSD Pair Upgrade

BEP100 = "BEP100"
BEP84 = "BEP84"
)

func UpgradeBEP10(before func(), after func()) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/binance-chain/bnc-cosmos-sdk v0.25.0-rc0.0.20201221070522-efca5af89bde
github.com/cosmos/cosmos-sdk => github.com/binance-chain/bnc-cosmos-sdk v0.25.0-rc0.0.20201223082755-a64140e72ced
github.com/tendermint/go-amino => github.com/binance-chain/bnc-go-amino v0.14.1-binance.2
github.com/tendermint/iavl => github.com/binance-chain/bnc-tendermint-iavl v0.12.0-binance.4
github.com/tendermint/tendermint => github.com/binance-chain/bnc-tendermint v0.32.3-binance.3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/binance-chain/bnc-cosmos-sdk v0.25.0-rc0.0.20201221070522-efca5af89bde h1:inilHYVApodSNZvmthICb2Rq9EoCyaz3tSiLct0hSLk=
github.com/binance-chain/bnc-cosmos-sdk v0.25.0-rc0.0.20201221070522-efca5af89bde/go.mod h1:25UaVXWOjzVAmL4I6szOdC4SQz4wsBG6wpv68V2vK7w=
github.com/binance-chain/bnc-cosmos-sdk v0.25.0-rc0.0.20201223082755-a64140e72ced h1:cCyOsYdmTs/KREb9YjZrTRpw2xP9NDtFxjPz4tYjKxA=
github.com/binance-chain/bnc-cosmos-sdk v0.25.0-rc0.0.20201223082755-a64140e72ced/go.mod h1:25UaVXWOjzVAmL4I6szOdC4SQz4wsBG6wpv68V2vK7w=
github.com/binance-chain/bnc-go-amino v0.14.1-binance.2 h1:XcbcfisVItk92UKoGbtNT8nbcfadj3H3ayuM2srAfVs=
github.com/binance-chain/bnc-go-amino v0.14.1-binance.2/go.mod h1:yaElUUxWtv/TC/ldGtlKAvS1vKwokxgJ1d97I+6is80=
github.com/binance-chain/bnc-tendermint v0.32.3-binance.3 h1:b8SqtWmtHPhPQ2ADzUgO9sr+ChKL9ho4dTorBjGAAyY=
Expand Down
3 changes: 1 addition & 2 deletions plugins/bridge/cross_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/binance-chain/node/common/log"
ctypes "github.com/binance-chain/node/common/types"
"github.com/binance-chain/node/common/upgrade"
"github.com/binance-chain/node/plugins/bridge/types"
)

Expand Down Expand Up @@ -289,7 +288,7 @@ func (app *TransferInApp) checkTransferInSynPackage(transferInPackage *types.Tra

for _, amount := range transferInPackage.Amounts {
// allow transfer 0 amount tokens
if sdk.IsUpgrade(upgrade.BEP100) {
if sdk.IsUpgrade(sdk.FixFailAckPackage) {
if amount.Int64() < 0 {
return types.ErrInvalidAmount("amount to send should not be negative")
}
Expand Down
26 changes: 10 additions & 16 deletions plugins/bridge/plugin.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package bridge

import (
sdk "github.com/cosmos/cosmos-sdk/types"

app "github.com/binance-chain/node/common/types"
"github.com/binance-chain/node/common/upgrade"
"github.com/binance-chain/node/plugins/bridge/types"
)

Expand Down Expand Up @@ -35,18 +32,15 @@ func RegisterCrossApps(keeper Keeper) {
panic(err)
}

// register new apps
if sdk.IsUpgrade(upgrade.BEP100) {
mirrorApp := NewMirrorApp(keeper)
err = keeper.ScKeeper.RegisterChannel(types.MirrorChannel, types.MirrorChannelID, mirrorApp)
if err != nil {
panic(err)
}

mirrorSyncApp := NewMirrorSyncApp(keeper)
err = keeper.ScKeeper.RegisterChannel(types.MirrorSyncChannel, types.MirrorSyncChannelID, mirrorSyncApp)
if err != nil {
panic(err)
}
mirrorApp := NewMirrorApp(keeper)
err = keeper.ScKeeper.RegisterChannel(types.MirrorChannel, types.MirrorChannelID, mirrorApp)
if err != nil {
panic(err)
}

mirrorSyncApp := NewMirrorSyncApp(keeper)
err = keeper.ScKeeper.RegisterChannel(types.MirrorSyncChannel, types.MirrorSyncChannelID, mirrorSyncApp)
if err != nil {
panic(err)
}
}

0 comments on commit dab338c

Please sign in to comment.