Skip to content

Commit

Permalink
[WIP]Implement of BEP126
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Apr 18, 2022
1 parent cc02ac0 commit 7fb4f15
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ $ export BNBCHAINPATH=~/go/src/github.com/binance-chain/node
$ mkdir -p $BNBCHAINPATH
$ git clone [email protected]:binance-chain/node.git $BNBCHAINPATH
$ cd $BNBCHAINPATH
$ make get_vendor_deps
$ make install
$ make build
```

> If you want run bnbchaind with cleveldb as backend, please ensure leveldb is installed: https://github.com/google/leveldb#building,
Expand All @@ -52,8 +51,7 @@ You may need add BNBCHAINPATH to the environment variables.
> md %BNBCHAINPATH%
> git clone [email protected]:binance-chain/node.git %BNBCHAINPATH%
> cd %BNBCHAINPATH%
> make get_vendor_deps
> make install
> make build
```

> If you encounter some network issues when downloading the dependencies, make sure you have configured shadowsocks correctly and switch to global mode. Run `set(win)/export(linux/mac) https_proxy=127.0.0.1:1080` if you still have https issues.
Expand All @@ -76,7 +74,7 @@ $ cat ~/.bnbchaind/config/genesis.json
You may want to check the [Issuing assets](#issuing-assets) section below before you start, but this is how to start the node and begin generating blocks:

```bash
$ bnbchaind start
$ bnbchaind start --moniker ${YOURNAME}
```

If everything worked you will see blocks being generated around every 1s in your console.
Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func (app *BinanceChain) subscribeEvent(logger log.Logger) {
app.subscriber = sub
}

// setUpgradeConfig will overwrite default upgrade config
// SetUpgradeConfig will overwrite default upgrade config
func SetUpgradeConfig(upgradeConfig *config.UpgradeConfig) {
// register upgrade height
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP6, upgradeConfig.BEP6Height)
Expand All @@ -328,6 +328,7 @@ func SetUpgradeConfig(upgradeConfig *config.UpgradeConfig) {
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP87, upgradeConfig.BEP87Height)
upgrade.Mgr.AddUpgradeHeight(upgrade.FixFailAckPackage, upgradeConfig.FixFailAckPackageHeight)
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP128, upgradeConfig.BEP128Height)
upgrade.Mgr.AddUpgradeHeight(upgrade.BEP126, upgradeConfig.BEP126Height)

// register store keys of upgrade
upgrade.Mgr.RegisterStoreKeys(upgrade.BEP9, common.TimeLockStoreKey.Name())
Expand Down
4 changes: 4 additions & 0 deletions app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ FixFailAckPackageHeight = {{ .UpgradeConfig.FixFailAckPackageHeight }}
EnableAccountScriptsForCrossChainTransferHeight = {{ .UpgradeConfig.EnableAccountScriptsForCrossChainTransferHeight }}
# Block height of BEP128 upgrade
BEP128Height = {{ .UpgradeConfig.BEP128Height }}
# Block height of BEP126 upgrade
BEP126Height = {{ .UpgradeConfig.BEP126Height }}
[query]
# ABCI query interface black list, suggested value: ["custom/gov/proposals", "custom/timelock/timelocks", "custom/atomicSwap/swapcreator", "custom/atomicSwap/swaprecipient"]
Expand Down Expand Up @@ -527,6 +529,7 @@ type UpgradeConfig struct {
FixFailAckPackageHeight int64 `mapstructure:"FixFailAckPackageHeight"`
EnableAccountScriptsForCrossChainTransferHeight int64 `mapstructure:"EnableAccountScriptsForCrossChainTransferHeight"`
BEP128Height int64 `mapstructure:"BEP128Height"`
BEP126Height int64 `mapstructure:"BEP126Height"`
}

func defaultUpgradeConfig() *UpgradeConfig {
Expand All @@ -546,6 +549,7 @@ func defaultUpgradeConfig() *UpgradeConfig {
BEP67Height: 1,
BEP70Height: 1,
LaunchBscUpgradeHeight: 1,
BEP126Height: 1,
BEP128Height: math.MaxInt64,
BEP82Height: math.MaxInt64,
BEP84Height: math.MaxInt64,
Expand Down
1 change: 1 addition & 0 deletions common/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
FixFailAckPackage = sdk.FixFailAckPackage

BEP128 = sdk.BEP128 // https://github.com/binance-chain/BEPs/pull/128 Staking reward distribution upgrade
BEP126 = sdk.BEP126 // https://github.com/binance-chain/BEPs/pull/126 Fast finality upgrade
)

func UpgradeBEP10(before func(), after func()) {
Expand Down

0 comments on commit 7fb4f15

Please sign in to comment.