From b5c10030426a5b47746e7ed37169c6644a8f3c47 Mon Sep 17 00:00:00 2001 From: randyahx <62416962+randyahx@users.noreply.github.com> Date: Fri, 7 Jul 2023 09:36:31 +0800 Subject: [PATCH] fix: bnb wording change (#963) --- app/account_test.go | 4 +- app/app.go | 80 +++++++++++++++++----------------- app/app_paramhub_test.go | 7 ++- app/app_pub_test.go | 6 +-- app/app_test.go | 28 ++++++------ app/apptest/base_test.go | 12 ++--- app/config/config.go | 26 +++++------ app/fee_distribution_test.go | 12 ++--- app/genesis.go | 8 ++-- app/helpers.go | 14 +++--- app_test/utils_test.go | 6 +-- cmd/bnbchaind/init/snapshot.go | 2 +- cmd/bnbchaind/init/testnet.go | 2 +- cmd/bnbchaind/main.go | 6 +-- cmd/gen_devnet/main.go | 40 ++++++++--------- plugins/tokens/abci_test.go | 2 +- 16 files changed, 127 insertions(+), 128 deletions(-) diff --git a/app/account_test.go b/app/account_test.go index 68a479299..7da53e971 100644 --- a/app/account_test.go +++ b/app/account_test.go @@ -17,7 +17,7 @@ import ( func BenchmarkGetAccount(b *testing.B) { memDB := db.NewMemDB() logger := log.NewTMLogger(io.Discard) - testApp := NewBinanceChain(logger, memDB, io.Discard) + testApp := NewBNBBeaconChain(logger, memDB, io.Discard) pk := ed25519.GenPrivKey().PubKey() addr := sdk.AccAddress(pk.Address()) @@ -49,7 +49,7 @@ func BenchmarkGetAccount(b *testing.B) { func BenchmarkSetAccount(b *testing.B) { memDB := db.NewMemDB() logger := log.NewTMLogger(io.Discard) - testApp := NewBinanceChain(logger, memDB, io.Discard) + testApp := NewBNBBeaconChain(logger, memDB, io.Discard) pk := ed25519.GenPrivKey().PubKey() addr := sdk.AccAddress(pk.Address()) diff --git a/app/app.go b/app/app.go index 5004e4de9..237c1afd8 100644 --- a/app/app.go +++ b/app/app.go @@ -79,16 +79,16 @@ var ( Bech32PrefixAccAddr string ) -// BinanceChain implements ChainApp -var _ types.ChainApp = (*BinanceChain)(nil) +// BNBBeaconChain implements ChainApp +var _ types.ChainApp = (*BNBBeaconChain)(nil) var ( Codec = MakeCodec() ServerContext = config.NewDefaultContext() ) -// BinanceChain is the BNBChain ABCI application -type BinanceChain struct { +// BNBBeaconChain is the BNBChain ABCI application +type BNBBeaconChain struct { *baseapp.BaseApp Codec *wire.Codec @@ -132,15 +132,15 @@ type BinanceChain struct { takeSnapshotHeight int64 // whether to take snapshot of current height, set at endblock(), reset at commit() } -// NewBinanceChain creates a new instance of the BinanceChain. -func NewBinanceChain(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptions ...func(*baseapp.BaseApp)) *BinanceChain { +// NewBNBBeaconChain creates a new instance of the BNBBeaconChain. +func NewBNBBeaconChain(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptions ...func(*baseapp.BaseApp)) *BNBBeaconChain { // create app-level codec for txs and accounts var cdc = Codec // create composed tx decoder decoders := wire.ComposeTxDecoders(cdc, defaultTxDecoder) // create the applicationsimulate object - var app = &BinanceChain{ + var app = &BNBBeaconChain{ BaseApp: baseapp.NewBaseApp(appName /*, cdc*/, logger, db, decoders, sdk.CollectConfig{CollectAccountBalance: ServerContext.PublishAccountBalance, CollectTxs: ServerContext.PublishTransfer || ServerContext.PublishBlock}, baseAppOptions...), Codec: cdc, queryHandlers: make(map[string]types.AbciQueryHandler), @@ -292,7 +292,7 @@ func NewBinanceChain(logger log.Logger, db dbm.DB, traceStore io.Writer, baseApp return app } -func (app *BinanceChain) startPubSub(logger log.Logger) { +func (app *BNBBeaconChain) startPubSub(logger log.Logger) { pubLogger := logger.With("module", "bnc_pubsub") app.psServer = pubsub.NewServer(pubLogger) if err := app.psServer.Start(); err != nil { @@ -300,7 +300,7 @@ func (app *BinanceChain) startPubSub(logger log.Logger) { } } -func (app *BinanceChain) subscribeEvent(logger log.Logger) { +func (app *BNBBeaconChain) subscribeEvent(logger log.Logger) { subLogger := logger.With("module", "bnc_sub") sub, err := app.psServer.NewSubscriber(pubsub.ClientID("bnc_app"), subLogger) if err != nil { @@ -408,14 +408,14 @@ func getABCIQueryBlackList(queryConfig *config.QueryConfig) map[string]bool { return cfg } -func (app *BinanceChain) initRunningMode() { +func (app *BNBBeaconChain) initRunningMode() { err := runtime.RecoverFromFile(ServerContext.Config.RootDir, runtime.Mode(ServerContext.StartMode)) if err != nil { cmn.Exit(err.Error()) } } -func (app *BinanceChain) initDex() { +func (app *BNBBeaconChain) initDex() { pairMapper := dex.NewTradingPairMapper(app.Codec, common.PairStoreKey) app.DexKeeper = dex.NewDexKeeper(common.DexStoreKey, app.AccountKeeper, pairMapper, app.RegisterCodespace(dex.DefaultCodespace), app.baseConfig.OrderKeeperConcurrency, app.Codec, @@ -445,7 +445,7 @@ func (app *BinanceChain) initDex() { } -func (app *BinanceChain) initPlugins() { +func (app *BNBBeaconChain) initPlugins() { app.initSideChain() app.initIbc() app.initDex() @@ -484,7 +484,7 @@ func (app *BinanceChain) initPlugins() { } -func (app *BinanceChain) initSideChain() { +func (app *BNBBeaconChain) initSideChain() { app.scKeeper.SetGovKeeper(&app.govKeeper) app.scKeeper.SetIbcKeeper(&app.ibcKeeper) upgrade.Mgr.RegisterBeginBlocker(sdk.LaunchBscUpgrade, func(ctx sdk.Context) { @@ -511,7 +511,7 @@ func (app *BinanceChain) initSideChain() { }) } -func (app *BinanceChain) initOracle() { +func (app *BNBBeaconChain) initOracle() { app.oracleKeeper.SetPbsbServer(app.psServer) if ServerContext.Config.Instrumentation.Prometheus { app.oracleKeeper.EnablePrometheusMetrics() @@ -520,7 +520,7 @@ func (app *BinanceChain) initOracle() { oracle.RegisterUpgradeBeginBlocker(app.oracleKeeper) } -func (app *BinanceChain) initBridge() { +func (app *BNBBeaconChain) initBridge() { app.bridgeKeeper.SetPbsbServer(app.psServer) upgrade.Mgr.RegisterBeginBlocker(sdk.LaunchBscUpgrade, func(ctx sdk.Context) { app.scKeeper.SetChannelSendPermission(ctx, sdk.ChainID(ServerContext.BscIbcChainId), bTypes.BindChannelID, sdk.ChannelAllow) @@ -529,7 +529,7 @@ func (app *BinanceChain) initBridge() { }) } -func (app *BinanceChain) initParamHub() { +func (app *BNBBeaconChain) initParamHub() { app.ParamHub.SetGovKeeper(&app.govKeeper) app.ParamHub.SetupForSideChain(&app.scKeeper, &app.ibcKeeper) @@ -547,7 +547,7 @@ func (app *BinanceChain) initParamHub() { }) } -func (app *BinanceChain) initStaking() { +func (app *BNBBeaconChain) initStaking() { app.stakeKeeper.SetupForSideChain(&app.scKeeper, &app.ibcKeeper) app.stakeKeeper.SetPbsbServer(app.psServer) upgrade.Mgr.RegisterBeginBlocker(sdk.LaunchBscUpgrade, func(ctx sdk.Context) { @@ -611,7 +611,7 @@ func (app *BinanceChain) initStaking() { } } -func (app *BinanceChain) initGov() { +func (app *BNBBeaconChain) initGov() { app.govKeeper.SetupForSideChain(&app.scKeeper) upgrade.Mgr.RegisterBeginBlocker(sdk.LaunchBscUpgrade, func(ctx sdk.Context) { storePrefix := app.scKeeper.GetSideChainStorePrefix(ctx, ServerContext.BscChainId) @@ -632,7 +632,7 @@ func (app *BinanceChain) initGov() { }) } -func (app *BinanceChain) initSlashing() { +func (app *BNBBeaconChain) initSlashing() { app.slashKeeper.SetPbsbServer(app.psServer) app.slashKeeper.SetSideChain(&app.scKeeper) app.slashKeeper.SubscribeParamChange(app.ParamHub) @@ -666,7 +666,7 @@ func (app *BinanceChain) initSlashing() { }) } -func (app *BinanceChain) initIbc() { +func (app *BNBBeaconChain) initIbc() { // set up IBC chainID for BBC app.scKeeper.SetSrcChainID(sdk.ChainID(ServerContext.IbcChainId)) // set up IBC chainID for BSC @@ -684,7 +684,7 @@ func (app *BinanceChain) initIbc() { }) } -func (app *BinanceChain) initGovHooks() { +func (app *BNBBeaconChain) initGovHooks() { listHooks := list.NewListHooks(app.DexKeeper, app.TokenMapper) feeChangeHooks := paramHub.NewFeeChangeHooks(app.Codec) cscParamChangeHooks := paramHub.NewCSCParamsChangeHook(app.Codec) @@ -701,14 +701,14 @@ func (app *BinanceChain) initGovHooks() { app.govKeeper.AddHooks(gov.ProposalTypeParameterChange, bcParamChangeHooks) } -func (app *BinanceChain) initParams() { +func (app *BNBBeaconChain) initParams() { if app.CheckState != nil && app.CheckState.Ctx.BlockHeight() != 0 { app.ParamHub.Load(app.CheckState.Ctx) } } // initChainerFn performs custom logic for chain initialization. -func (app *BinanceChain) initChainerFn() sdk.InitChainer { +func (app *BNBBeaconChain) initChainerFn() sdk.InitChainer { return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { stateJSON := req.AppStateBytes @@ -778,7 +778,7 @@ func (app *BinanceChain) initChainerFn() sdk.InitChainer { } } -func (app *BinanceChain) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx) { +func (app *BNBBeaconChain) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx) { var result sdk.Result var tx sdk.Tx txBytes := req.Tx @@ -822,7 +822,7 @@ func (app *BinanceChain) CheckTx(req abci.RequestCheckTx) (res abci.ResponseChec } // Implements ABCI -func (app *BinanceChain) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) { +func (app *BNBBeaconChain) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) { res = app.BaseApp.DeliverTx(req) txHash := cmn.HexBytes(tmhash.Sum(req.Tx)).String() if res.IsOK() { @@ -847,7 +847,7 @@ func (app *BinanceChain) DeliverTx(req abci.RequestDeliverTx) (res abci.Response // PreDeliverTx implements extended ABCI for concurrency // PreCheckTx would perform decoding, signture and other basic verification -func (app *BinanceChain) PreDeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) { +func (app *BNBBeaconChain) PreDeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) { res = app.BaseApp.PreDeliverTx(req) if res.IsErr() { txHash := cmn.HexBytes(tmhash.Sum(req.Tx)).String() @@ -856,7 +856,7 @@ func (app *BinanceChain) PreDeliverTx(req abci.RequestDeliverTx) (res abci.Respo return res } -func (app *BinanceChain) isBreatheBlock(height int64, lastBlockTime time.Time, blockTime time.Time) bool { +func (app *BNBBeaconChain) isBreatheBlock(height int64, lastBlockTime time.Time, blockTime time.Time) bool { // lastBlockTime is zero if this blockTime is for the first block (first block doesn't mean height = 1, because after // state sync from breathe block, the height is breathe block + 1) if app.baseConfig.BreatheBlockInterval > 0 { @@ -866,12 +866,12 @@ func (app *BinanceChain) isBreatheBlock(height int64, lastBlockTime time.Time, b } } -func (app *BinanceChain) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) (res abci.ResponseBeginBlock) { +func (app *BNBBeaconChain) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) (res abci.ResponseBeginBlock) { upgrade.Mgr.BeginBlocker(ctx) return } -func (app *BinanceChain) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { +func (app *BNBBeaconChain) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { // lastBlockTime would be 0 if this is the first block. lastBlockTime := app.CheckState.Ctx.BlockHeader().Time blockTime := ctx.BlockHeader().Time @@ -959,7 +959,7 @@ func (app *BinanceChain) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) a } } -func (app *BinanceChain) Commit() (res abci.ResponseCommit) { +func (app *BNBBeaconChain) Commit() (res abci.ResponseCommit) { res = app.BaseApp.Commit() if ServerContext.Config.StateSyncReactor && app.takeSnapshotHeight > 0 { app.StateSyncHelper.SnapshotHeights <- app.takeSnapshotHeight @@ -968,7 +968,7 @@ func (app *BinanceChain) Commit() (res abci.ResponseCommit) { return } -func (app *BinanceChain) WriteRecoveryChunk(hash abci.SHA256Sum, chunk *abci.AppStateChunk, isComplete bool) (err error) { +func (app *BNBBeaconChain) WriteRecoveryChunk(hash abci.SHA256Sum, chunk *abci.AppStateChunk, isComplete bool) (err error) { err = app.BaseApp.WriteRecoveryChunk(hash, chunk, isComplete) if err != nil { return err @@ -980,7 +980,7 @@ func (app *BinanceChain) WriteRecoveryChunk(hash abci.SHA256Sum, chunk *abci.App } // ExportAppStateAndValidators exports blockchain world state to json. -func (app *BinanceChain) ExportAppStateAndValidators() (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { +func (app *BNBBeaconChain) ExportAppStateAndValidators() (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { ctx := app.NewContext(sdk.RunTxModeCheck, abci.Header{}) // iterate to get the accounts @@ -1005,7 +1005,7 @@ func (app *BinanceChain) ExportAppStateAndValidators() (appState json.RawMessage } // Query performs an abci query. -func (app *BinanceChain) Query(req abci.RequestQuery) (res abci.ResponseQuery) { +func (app *BNBBeaconChain) Query(req abci.RequestQuery) (res abci.ResponseQuery) { defer func() { if r := recover(); r != nil { app.Logger.Error("internal error caused by query", "req", req, "stack", debug.Stack()) @@ -1033,7 +1033,7 @@ func (app *BinanceChain) Query(req abci.RequestQuery) (res abci.ResponseQuery) { return app.BaseApp.Query(req) } -func (app *BinanceChain) AccountHandler(chainApp types.ChainApp, req abci.RequestQuery, path []string) *abci.ResponseQuery { +func (app *BNBBeaconChain) AccountHandler(chainApp types.ChainApp, req abci.RequestQuery, path []string) *abci.ResponseQuery { var res abci.ResponseQuery if len(path) == 2 { addr := path[1] @@ -1066,7 +1066,7 @@ func (app *BinanceChain) AccountHandler(chainApp types.ChainApp, req abci.Reques } // RegisterQueryHandler registers an abci query handler, implements ChainApp.RegisterQueryHandler. -func (app *BinanceChain) RegisterQueryHandler(prefix string, handler types.AbciQueryHandler) { +func (app *BNBBeaconChain) RegisterQueryHandler(prefix string, handler types.AbciQueryHandler) { if _, ok := app.queryHandlers[prefix]; ok { panic(fmt.Errorf("registerQueryHandler: prefix `%s` is already registered", prefix)) } else { @@ -1075,17 +1075,17 @@ func (app *BinanceChain) RegisterQueryHandler(prefix string, handler types.AbciQ } // GetCodec returns the app's Codec. -func (app *BinanceChain) GetCodec() *wire.Codec { +func (app *BNBBeaconChain) GetCodec() *wire.Codec { return app.Codec } // GetRouter returns the app's Router. -func (app *BinanceChain) GetRouter() baseapp.Router { +func (app *BNBBeaconChain) GetRouter() baseapp.Router { return app.Router() } // GetContextForCheckState gets the context for the check state. -func (app *BinanceChain) GetContextForCheckState() sdk.Context { +func (app *BNBBeaconChain) GetContextForCheckState() sdk.Context { return app.CheckState.Ctx } @@ -1130,14 +1130,14 @@ func MakeCodec() *wire.Codec { return cdc } -func (app *BinanceChain) publishEvent() { +func (app *BNBBeaconChain) publishEvent() { if appsub.ToPublish() != nil && appsub.ToPublish().EventData != nil { pub.ToPublishEventCh <- appsub.ToPublish() } } -func (app *BinanceChain) publish(tradesToPublish []*pub.Trade, proposalsToPublish *pub.Proposals, sideProposalsToPublish *pub.SideProposals, stakeUpdates *pub.StakeUpdates, blockFee pub.BlockFee, ctx sdk.Context, height, blockTime int64) { +func (app *BNBBeaconChain) publish(tradesToPublish []*pub.Trade, proposalsToPublish *pub.Proposals, sideProposalsToPublish *pub.SideProposals, stakeUpdates *pub.StakeUpdates, blockFee pub.BlockFee, ctx sdk.Context, height, blockTime int64) { pub.Logger.Info("start to collect publish information", "height", height) var accountsToPublish map[string]pub.Account diff --git a/app/app_paramhub_test.go b/app/app_paramhub_test.go index 7cdc28942..850d62286 100644 --- a/app/app_paramhub_test.go +++ b/app/app_paramhub_test.go @@ -24,7 +24,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/stake" "github.com/stretchr/testify/assert" - "github.com/tendermint/go-amino" abcicli "github.com/tendermint/tendermint/abci/client" "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types" @@ -51,12 +50,12 @@ var ( sdk.Coins{sdk.NewCoin("BNB", 500000e8), sdk.NewCoin("BTC-000", 200e8)}) testScParams = `[{"type": "params/StakeParamSet","value": {"unbonding_time": "604800000000000","max_validators": 11,"bond_denom": "BNB","min_self_delegation": "5000000000000","min_delegation_change": "100000000","reward_distribution_batch_size":"1000"}},{"type": "params/SlashParamSet","value": {"max_evidence_age": "259200000000000","signed_blocks_window": "0","min_signed_per_window": "0","double_sign_unbond_duration": "9223372036854775807","downtime_unbond_duration": "172800000000000","too_low_del_unbond_duration": "86400000000000","slash_fraction_double_sign": "0","slash_fraction_downtime": "0","double_sign_slash_amount": "1000000000000","downtime_slash_amount": "5000000000","submitter_reward": "100000000000","downtime_slash_fee": "1000000000"}},{"type": "params/OracleParamSet","value": {"ConsensusNeeded": "70000000"}},{"type": "params/IbcParamSet","value": {"relayer_fee": "1000000"}}]` testClient *TestClient - testApp *BinanceChain + testApp *BNBBeaconChain ) func init() { ServerContext.UpgradeConfig.LaunchBscUpgradeHeight = 1 - testApp = NewBinanceChain(logger, memDB, os.Stdout) + testApp = NewBNBBeaconChain(logger, memDB, os.Stdout) testClient = NewTestClient(testApp) } @@ -368,7 +367,7 @@ func TestSCParamUpdatesFail(t *testing.T) { // =========== setup for test cases ==== -func NewTestClient(a *BinanceChain) *TestClient { +func NewTestClient(a *BNBBeaconChain) *TestClient { a.SetDeliverState(types.Header{}) a.SetAnteHandler(newMockAnteHandler(a.Codec)) // clear AnteHandler to skip the signature verification step return &TestClient{abcicli.NewLocalClient(nil, a), MakeCodec()} diff --git a/app/app_pub_test.go b/app/app_pub_test.go index ec3d92894..144bf3411 100644 --- a/app/app_pub_test.go +++ b/app/app_pub_test.go @@ -57,11 +57,11 @@ func prepareGenTx(cdc *codec.Codec, chainId string, return txBytes } -func setupAppTest(t *testing.T) (*assert.Assertions, *require.Assertions, *BinanceChain, sdk.Account, sdk.Account) { +func setupAppTest(t *testing.T) (*assert.Assertions, *require.Assertions, *BNBBeaconChain, sdk.Account, sdk.Account) { logger := log.NewNopLogger() db := dbm.NewMemDB() - app := NewBinanceChain(logger, db, os.Stdout) + app := NewBNBBeaconChain(logger, db, os.Stdout) app.SetAnteHandler(nil) app.SetDeliverState(abci.Header{}) am := app.AccountKeeper @@ -74,7 +74,7 @@ func setupAppTest(t *testing.T) (*assert.Assertions, *require.Assertions, *Binan // set ante handler to nil to skip the sig verification. the side effect is that we also skip the tx fee collection. chainId := "chain-pub" genTx := prepareGenTx(app.Codec, chainId, sdk.ValAddress(proposerAcc.GetAddress()), proposerPubKey) - appState, _ := BinanceAppGenState(app.Codec, []json.RawMessage{genTx}) + appState, _ := BNBAppGenState(app.Codec, []json.RawMessage{genTx}) appGenState, _ := wire.MarshalJSONIndent(app.Codec, appState) app.InitChain(abci.RequestInitChain{AppStateBytes: appGenState}) app.BeginBlock(abci.RequestBeginBlock{Header: abci.Header{Height: 42, Time: time.Unix(0, 100), ProposerAddress: proposerValAddr}}) diff --git a/app/app_test.go b/app/app_test.go index 3ddb996b4..8cdeafb63 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -28,10 +28,10 @@ func defaultLogger() log.Logger { return log.NewTMLogger(log.NewSyncWriter(os.Stdout)).With("module", "sdk/app") } -func newBinanceChainApp(options ...func(baseApp *baseapp.BaseApp)) *BinanceChain { +func newBNBBeaconChainApp(options ...func(baseApp *baseapp.BaseApp)) *BNBBeaconChain { logger := defaultLogger() db := dbm.NewMemDB() - return NewBinanceChain(logger, db, os.Stdout, options...) + return NewBNBBeaconChain(logger, db, os.Stdout, options...) } // msg type for testing @@ -45,7 +45,7 @@ func NewTestMsg(addrs ...sdk.AccAddress) *TestMsg { } } -//nolint +// nolint func (msg *TestMsg) Route() string { return "TestMsg" } func (msg *TestMsg) Type() string { return "Test message" } func (msg *TestMsg) GetSignBytes() []byte { @@ -97,7 +97,7 @@ func TestPreCheckTxWithRightPubKey(t *testing.T) { priv1, addr1 := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -129,7 +129,7 @@ func TestPreCheckTxWithWrongPubKey(t *testing.T) { priv2, _ := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -161,7 +161,7 @@ func TestPreCheckTxWithEmptyPubKey(t *testing.T) { priv1, addr1 := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -192,7 +192,7 @@ func TestPreCheckTxWithEmptySignatures(t *testing.T) { priv1, addr1 := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -224,7 +224,7 @@ func TestPreCheckTxWithWrongSignerNum(t *testing.T) { _, addr2 := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -254,7 +254,7 @@ func TestPreCheckTxWithData(t *testing.T) { priv1, addr1 := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -284,7 +284,7 @@ func TestPreCheckTxWithLargeMemo(t *testing.T) { priv1, addr1 := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -315,7 +315,7 @@ func TestPreCheckTxWithWrongPubKeyAndEmptyAccountPubKey(t *testing.T) { priv2, _ := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -346,7 +346,7 @@ func TestCheckTxWithUnrecognizedAccount(t *testing.T) { priv2, _ := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -372,7 +372,7 @@ func TestCheckTxWithWrongSequence(t *testing.T) { priv2, _ := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) @@ -401,7 +401,7 @@ func TestCheckTxWithWrongAccountNum(t *testing.T) { priv2, _ := testutils.PrivAndAddr() Codec = MakeCodec() - app := newBinanceChainApp(routerOpt) + app := newBNBBeaconChainApp(routerOpt) app.Codec.RegisterConcrete(&TestMsg{}, "cosmos-sdk/baseapp/testMsg", nil) app.BeginBlock(abci.RequestBeginBlock{}) diff --git a/app/apptest/base_test.go b/app/apptest/base_test.go index bd1fef3b3..5f41e6f84 100644 --- a/app/apptest/base_test.go +++ b/app/apptest/base_test.go @@ -80,7 +80,7 @@ func (tc *TestClient) CheckTxSync(msg sdk.Msg, cdc *wire.Codec) (*types.Response var ( memDB = db.NewMemDB() logger = log.NewTMLogger(os.Stdout) - testApp = app.NewBinanceChain(logger, memDB, os.Stdout) + testApp = app.NewBNBBeaconChain(logger, memDB, os.Stdout) genAccs, addrs, pubKeys, privKeys = mock.CreateGenAccounts(4, sdk.Coins{sdk.NewCoin("BNB", 500e8), sdk.NewCoin("BTC-000", 200e8)}) testClient = NewTestClient(testApp) @@ -91,7 +91,7 @@ func TearDown() { os.RemoveAll(cfg.DefaultConfig().DBDir()) } -func InitAccounts(ctx sdk.Context, app *app.BinanceChain) *[]sdk.Account { +func InitAccounts(ctx sdk.Context, app *app.BNBBeaconChain) *[]sdk.Account { for _, acc := range genAccs { aacc := &common.AppAccount{ BaseAccount: auth.BaseAccount{ @@ -106,7 +106,7 @@ func InitAccounts(ctx sdk.Context, app *app.BinanceChain) *[]sdk.Account { return &genAccs } -func ResetAccounts(ctx sdk.Context, app *app.BinanceChain, ccy1 int64, ccy2 int64, ccy3 int64) { +func ResetAccounts(ctx sdk.Context, app *app.BNBBeaconChain, ccy1 int64, ccy2 int64, ccy3 int64) { for _, acc := range genAccs { a := app.AccountKeeper.GetAccount(ctx, acc.GetAddress()) a.SetCoins(sdk.Coins{sdk.NewCoin("BNB", ccy1), sdk.NewCoin("BTC-000", ccy2), sdk.NewCoin("ETH-000", ccy3)}) @@ -122,7 +122,7 @@ func Address(i int) sdk.AccAddress { return addrs[i] } -func NewTestClient(a *app.BinanceChain) *TestClient { +func NewTestClient(a *app.BNBBeaconChain) *TestClient { a.SetCheckState(types.Header{}) a.SetAnteHandler(NewMockAnteHandler(a.Codec)) // clear AnteHandler to skip the signature verification step return &TestClient{abcicli.NewLocalClient(nil, a), app.MakeCodec()} @@ -136,7 +136,7 @@ func GetLocked(ctx sdk.Context, add sdk.AccAddress, ccy string) int64 { return testApp.AccountKeeper.GetAccount(ctx, add).(common.NamedAccount).GetLockedCoins().AmountOf(ccy) } -func setGenesis(bapp *app.BinanceChain, tokens []tokens.GenesisToken, accs ...*common.AppAccount) error { +func setGenesis(bapp *app.BNBBeaconChain, tokens []tokens.GenesisToken, accs ...*common.AppAccount) error { genaccs := make([]app.GenesisAccount, len(accs)) for i, acc := range accs { pk := GenPrivKey().PubKey() @@ -167,7 +167,7 @@ func setGenesis(bapp *app.BinanceChain, tokens []tokens.GenesisToken, accs ...*c func TestGenesis(t *testing.T) { logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)).With("module", "sdk/app") db := dbm.NewMemDB() - bapp := app.NewBinanceChain(logger, db, os.Stdout) + bapp := app.NewBNBBeaconChain(logger, db, os.Stdout) // Construct some genesis bytes to reflect democoin/types/AppAccount addr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) diff --git a/app/config/config.go b/app/config/config.go index 9c88683ea..6a04baaca 100644 --- a/app/config/config.go +++ b/app/config/config.go @@ -235,24 +235,24 @@ bscIbcChainId = {{ .CrossChainConfig.BscIbcChainId }} BUSDSymbol = "{{ .DexConfig.BUSDSymbol }}" ` -type BinanceChainContext struct { +type BNBBeaconChainContext struct { *server.Context *viper.Viper - *BinanceChainConfig + *BNBBeaconChainConfig } -func NewDefaultContext() *BinanceChainContext { - return &BinanceChainContext{ +func NewDefaultContext() *BNBBeaconChainContext { + return &BNBBeaconChainContext{ server.NewDefaultContext(), viper.New(), - DefaultBinanceChainConfig()} + DefaultBNBBeaconChainConfig()} } -func (context *BinanceChainContext) ToCosmosServerCtx() *server.Context { +func (context *BNBBeaconChainContext) ToCosmosServerCtx() *server.Context { return context.Context } -type BinanceChainConfig struct { +type BNBBeaconChainConfig struct { *AddressConfig `mapstructure:"addr"` *PublicationConfig `mapstructure:"publication"` *LogConfig `mapstructure:"log"` @@ -263,8 +263,8 @@ type BinanceChainConfig struct { *DexConfig `mapstructure:"dex"` } -func DefaultBinanceChainConfig() *BinanceChainConfig { - return &BinanceChainConfig{ +func DefaultBNBBeaconChainConfig() *BNBBeaconChainConfig { + return &BNBBeaconChainConfig{ AddressConfig: defaultAddressConfig(), PublicationConfig: defaultPublicationConfig(), LogConfig: defaultLogConfig(), @@ -569,7 +569,7 @@ func defaultUpgradeConfig() *UpgradeConfig { BEP70Height: 1, LaunchBscUpgradeHeight: 1, LimitConsAddrUpdateIntervalHeight: math.MaxInt64, - BEP126Height: math.MaxInt64, + BEP126Height: math.MaxInt64, BEP128Height: math.MaxInt64, BEP151Height: math.MaxInt64, BEP153Height: math.MaxInt64, @@ -606,7 +606,7 @@ func defaultGovConfig() *DexConfig { } } -func (context *BinanceChainContext) ParseAppConfigInPlace() error { +func (context *BNBBeaconChainContext) ParseAppConfigInPlace() error { // this piece of code should be consistent with bindFlagsLoadViper // vendor/github.com/tendermint/tendermint/libs/cli/setup.go:125 homeDir := viper.GetString(cli.HomeFlag) @@ -623,7 +623,7 @@ func (context *BinanceChainContext) ParseAppConfigInPlace() error { return err } - err := context.Viper.Unmarshal(context.BinanceChainConfig) + err := context.Viper.Unmarshal(context.BNBBeaconChainConfig) if err != nil { return err } @@ -631,7 +631,7 @@ func (context *BinanceChainContext) ParseAppConfigInPlace() error { } // WriteConfigFile renders config using the template and writes it to configFilePath. -func WriteConfigFile(configFilePath string, config *BinanceChainConfig) { +func WriteConfigFile(configFilePath string, config *BNBBeaconChainConfig) { var buffer bytes.Buffer if err := configTemplate.Execute(&buffer, config); err != nil { diff --git a/app/fee_distribution_test.go b/app/fee_distribution_test.go index 0c7762ae4..a4bf0e982 100644 --- a/app/fee_distribution_test.go +++ b/app/fee_distribution_test.go @@ -155,7 +155,7 @@ func GenAccounts(n int) (accounts []Account) { return } -func setupTestForBEP159Test() (*BinanceChain, sdk.Context, []Account) { +func setupTestForBEP159Test() (*BNBBeaconChain, sdk.Context, []Account) { // config upgrade.Mgr.Reset() context := ServerContext @@ -173,7 +173,7 @@ func setupTestForBEP159Test() (*BinanceChain, sdk.Context, []Account) { config.SetBech32PrefixForConsensusNode(context.Bech32PrefixConsAddr, context.Bech32PrefixConsPub) config.Seal() // create app - app := NewBinanceChain(logger, memDB, io.Discard) + app := NewBNBBeaconChain(logger, memDB, io.Discard) logger.Info("BEP159Height", "BEP159Height", ServerContext.BEP159Height) logger.Info("BEP159Phase2Height", "BEP159Phase2Height", ServerContext.BEP159Phase2Height) logger.Info("BreatheBlockInterval", "BreatheBlockInterval", ServerContext.BreatheBlockInterval) @@ -212,7 +212,7 @@ func setupTestForBEP159Test() (*BinanceChain, sdk.Context, []Account) { return app, ctx, accounts } -func GenSimTxs(app *BinanceChain, msgs []sdk.Msg, expSimPass bool, privs ...crypto.PrivKey, +func GenSimTxs(app *BNBBeaconChain, msgs []sdk.Msg, expSimPass bool, privs ...crypto.PrivKey, ) (txs []auth.StdTx) { accSeqMap := make(map[string][2]int64) ctx := app.CheckState.Ctx @@ -240,7 +240,7 @@ func GenSimTxs(app *BinanceChain, msgs []sdk.Msg, expSimPass bool, privs ...cryp return txs } -func ApplyBlock(t *testing.T, app *BinanceChain, ctx sdk.Context, txs []auth.StdTx) (newCtx sdk.Context) { +func ApplyBlock(t *testing.T, app *BNBBeaconChain, ctx sdk.Context, txs []auth.StdTx) (newCtx sdk.Context) { height := ctx.BlockHeader().Height + 1 logger.Debug("ApplyBlock", "height", height) header := abci.Header{Height: height} @@ -272,7 +272,7 @@ func ApplyBlock(t *testing.T, app *BinanceChain, ctx sdk.Context, txs []auth.Std return } -func ApplyEmptyBlocks(t *testing.T, app *BinanceChain, ctx sdk.Context, blockNum int) (newCtx sdk.Context) { +func ApplyEmptyBlocks(t *testing.T, app *BNBBeaconChain, ctx sdk.Context, blockNum int) (newCtx sdk.Context) { currentCtx := ctx for i := 0; i < blockNum; i++ { currentCtx = ApplyBlock(t, app, currentCtx, []auth.StdTx{}) @@ -280,7 +280,7 @@ func ApplyEmptyBlocks(t *testing.T, app *BinanceChain, ctx sdk.Context, blockNum return currentCtx } -func ApplyToBreathBlocks(t *testing.T, app *BinanceChain, ctx sdk.Context, breathBlockNum int) (newCtx sdk.Context) { +func ApplyToBreathBlocks(t *testing.T, app *BNBBeaconChain, ctx sdk.Context, breathBlockNum int) (newCtx sdk.Context) { currentHeight := ctx.BlockHeader().Height blockNum := BREATHE_BLOCK_INTERVAL*breathBlockNum - int(currentHeight%int64(BREATHE_BLOCK_INTERVAL)) return ApplyEmptyBlocks(t, app, ctx, blockNum) diff --git a/app/genesis.go b/app/genesis.go index 65c295dca..94337a13b 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -21,7 +21,7 @@ import ( "github.com/bnb-chain/node/wire" ) -//DefaultKeyPass only for private test net +// DefaultKeyPass only for private test net var DefaultKeyPass = "12345678" var ( @@ -75,14 +75,14 @@ func (ga *GenesisAccount) ToAppAccount() (acc *types.AppAccount) { } } -func BinanceAppInit() server.AppInit { +func BNBAppInit() server.AppInit { return server.AppInit{ - AppGenState: BinanceAppGenState, + AppGenState: BNBAppGenState, } } // AppGenState sets up the app_state and appends the cool app state -func BinanceAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { +func BNBAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { if len(appGenTxs) == 0 { err = errors.New("must provide at least 1 genesis transaction") return diff --git a/app/helpers.go b/app/helpers.go index b707cf3dd..858382da9 100644 --- a/app/helpers.go +++ b/app/helpers.go @@ -33,7 +33,7 @@ import ( ) // If a new config is created, change some of the default tendermint settings -func interceptLoadConfigInPlace(context *config.BinanceChainContext) (err error) { +func interceptLoadConfigInPlace(context *config.BNBBeaconChainContext) (err error) { tmpConf := tmcfg.DefaultConfig() err = viper.Unmarshal(tmpConf) if err != nil { @@ -58,7 +58,7 @@ func interceptLoadConfigInPlace(context *config.BinanceChainContext) (err error) appConfigFilePath := filepath.Join(rootDir, "config/", config.AppConfigFileName+".toml") if _, err := os.Stat(appConfigFilePath); os.IsNotExist(err) { - config.WriteConfigFile(appConfigFilePath, ServerContext.BinanceChainConfig) + config.WriteConfigFile(appConfigFilePath, ServerContext.BNBBeaconChainConfig) } else { err = context.ParseAppConfigInPlace() if err != nil { @@ -69,7 +69,7 @@ func interceptLoadConfigInPlace(context *config.BinanceChainContext) (err error) return nil } -func newLogger(ctx *config.BinanceChainContext) log.Logger { +func newLogger(ctx *config.BNBBeaconChainContext) log.Logger { if ctx.LogConfig.LogToConsole { return bnclog.NewConsoleLogger() } else { @@ -90,7 +90,7 @@ func newLogger(ctx *config.BinanceChainContext) log.Logger { // PersistentPreRunEFn returns a PersistentPreRunE function for cobra // that initailizes the passed in context with a properly configured // logger and config object -func PersistentPreRunEFn(context *config.BinanceChainContext) func(*cobra.Command, []string) error { +func PersistentPreRunEFn(context *config.BNBBeaconChainContext) func(*cobra.Command, []string) error { return func(cmd *cobra.Command, args []string) error { if cmd.Name() == version.VersionCmd.Name() { return nil @@ -123,7 +123,7 @@ func PersistentPreRunEFn(context *config.BinanceChainContext) func(*cobra.Comman } } -func (app *BinanceChain) processErrAbciResponseForPub(txBytes []byte) { +func (app *BNBBeaconChain) processErrAbciResponseForPub(txBytes []byte) { defer func() { if r := recover(); r != nil { stackTrace := fmt.Sprintf("recovered: %v\nstack:\n%v", r, string(debug.Stack())) @@ -158,7 +158,7 @@ func (app *BinanceChain) processErrAbciResponseForPub(txBytes []byte) { } } -func (app *BinanceChain) getLastBreatheBlockHeight() int64 { +func (app *BNBBeaconChain) getLastBreatheBlockHeight() int64 { // we should only sync to breathe block height latestBlockHeight := app.LastBlockHeight() var timeOfLatestBlock time.Time @@ -182,7 +182,7 @@ func (app *BinanceChain) getLastBreatheBlockHeight() int64 { return height } -func (app *BinanceChain) reInitChain() error { +func (app *BNBBeaconChain) reInitChain() error { app.DexKeeper.Init( app.CheckState.Ctx, app.baseConfig.BreatheBlockInterval, diff --git a/app_test/utils_test.go b/app_test/utils_test.go index 15235fa42..d2b3d48a0 100644 --- a/app_test/utils_test.go +++ b/app_test/utils_test.go @@ -39,7 +39,7 @@ func setup(t *testing.T, symbol string, upgrade bool) (ass *assert.Assertions, r logger := log.NewTMLogger(os.Stdout) db := dbm.NewMemDB() - app = appPkg.NewBinanceChain(logger, db, os.Stdout) + app = appPkg.NewBNBBeaconChain(logger, db, os.Stdout) //ctx = app.NewContext(false, abci.Header{ChainID: "mychainid"}) ctx = app.GetContextForCheckState() cdc = app.GetCodec() @@ -48,12 +48,12 @@ func setup(t *testing.T, symbol string, upgrade bool) (ass *assert.Assertions, r setChainVersion() } - keeper = app.(*appPkg.BinanceChain).DexKeeper + keeper = app.(*appPkg.BNBBeaconChain).DexKeeper tradingPair := dextypes.NewTradingPair(baseAssetSymbol, types.NativeTokenSymbol, 1e8) keeper.PairMapper.AddTradingPair(ctx, tradingPair) keeper.AddEngine(tradingPair) - am = app.(*appPkg.BinanceChain).AccountKeeper + am = app.(*appPkg.BNBBeaconChain).AccountKeeper _, buyerAcc := testutils.NewAccountForPub(ctx, am, 100000000000, 100000000000, 100000000000, symbol) // give user enough coins to pay the fee buyer = buyerAcc.GetAddress() diff --git a/cmd/bnbchaind/init/snapshot.go b/cmd/bnbchaind/init/snapshot.go index fd1a2cb89..b8bed544c 100644 --- a/cmd/bnbchaind/init/snapshot.go +++ b/cmd/bnbchaind/init/snapshot.go @@ -40,7 +40,7 @@ func SnapshotCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command { if err != nil { return err } - app.SetUpgradeConfig(appCtx.BinanceChainConfig.UpgradeConfig) + app.SetUpgradeConfig(appCtx.BNBBeaconChainConfig.UpgradeConfig) logger.Info("setup block db") blockDB, err := node.DefaultDBProvider(&node.DBContext{ID: "blockstore", Config: config}) diff --git a/cmd/bnbchaind/init/testnet.go b/cmd/bnbchaind/init/testnet.go index 9f6140ec2..8b9cda837 100644 --- a/cmd/bnbchaind/init/testnet.go +++ b/cmd/bnbchaind/init/testnet.go @@ -225,7 +225,7 @@ func createConfigFiles(config *cfg.Config, monikers []string, nodeDirs []string, appConfigFilePath := filepath.Join(config.RootDir, "config/", appCfg.AppConfigFileName+".toml") if _, err := os.Stat(appConfigFilePath); os.IsNotExist(err) { - appCfg.WriteConfigFile(appConfigFilePath, app.ServerContext.BinanceChainConfig) + appCfg.WriteConfigFile(appConfigFilePath, app.ServerContext.BNBBeaconChainConfig) } } } diff --git a/cmd/bnbchaind/main.go b/cmd/bnbchaind/main.go index 74b321f04..0a7504417 100644 --- a/cmd/bnbchaind/main.go +++ b/cmd/bnbchaind/main.go @@ -20,11 +20,11 @@ import ( ) func newApp(logger log.Logger, db dbm.DB, storeTracer io.Writer) abci.Application { - return app.NewBinanceChain(logger, db, storeTracer) + return app.NewBNBBeaconChain(logger, db, storeTracer) } func exportAppStateAndTMValidators(logger log.Logger, db dbm.DB, storeTracer io.Writer) (json.RawMessage, []tmtypes.GenesisValidator, error) { - dapp := app.NewBinanceChain(logger, db, storeTracer) + dapp := app.NewBNBBeaconChain(logger, db, storeTracer) return dapp.ExportAppStateAndValidators() } @@ -38,7 +38,7 @@ func main() { PersistentPreRunE: app.PersistentPreRunEFn(ctx), } - appInit := app.BinanceAppInit() + appInit := app.BNBAppInit() rootCmd.AddCommand(bnbInit.InitCmd(ctx.ToCosmosServerCtx(), cdc, appInit)) rootCmd.AddCommand(bnbInit.TestnetFilesCmd(ctx.ToCosmosServerCtx(), cdc, appInit)) rootCmd.AddCommand(bnbInit.CollectGenTxsCmd(cdc, appInit)) diff --git a/cmd/gen_devnet/main.go b/cmd/gen_devnet/main.go index eee352a5c..129102bb0 100644 --- a/cmd/gen_devnet/main.go +++ b/cmd/gen_devnet/main.go @@ -33,7 +33,7 @@ func main() { // init nodes cdc := app.Codec ctx := app.ServerContext - appInit := app.BinanceAppInit() + appInit := app.BNBAppInit() ctxConfig := ctx.Config sdkConfig := sdk.GetConfig() sdkConfig.SetBech32PrefixForAccount(ctx.Bech32PrefixAccAddr, ctx.Bech32PrefixAccPub) @@ -58,26 +58,26 @@ func main() { } } // app.toml - binanceChainConfig := ServerContext.BinanceChainConfig - binanceChainConfig.UpgradeConfig.BEP3Height = 1 - binanceChainConfig.UpgradeConfig.BEP8Height = 1 - binanceChainConfig.UpgradeConfig.BEP12Height = 1 - binanceChainConfig.UpgradeConfig.BEP67Height = 1 - binanceChainConfig.UpgradeConfig.BEP70Height = 1 - binanceChainConfig.UpgradeConfig.BEP82Height = 1 - binanceChainConfig.UpgradeConfig.BEP84Height = 1 - binanceChainConfig.UpgradeConfig.BEP87Height = 1 - binanceChainConfig.UpgradeConfig.FixFailAckPackageHeight = 1 - binanceChainConfig.UpgradeConfig.EnableAccountScriptsForCrossChainTransferHeight = 1 - binanceChainConfig.UpgradeConfig.BEP128Height = 1 - binanceChainConfig.UpgradeConfig.BEP151Height = 1 - binanceChainConfig.UpgradeConfig.BEP153Height = 2 - binanceChainConfig.UpgradeConfig.BEP159Height = 3 - binanceChainConfig.UpgradeConfig.BEP159Phase2Height = 6 - binanceChainConfig.UpgradeConfig.LimitConsAddrUpdateIntervalHeight = 6 - binanceChainConfig.BreatheBlockInterval = 5 + bnbBeaconChainConfig := ServerContext.BNBBeaconChainConfig + bnbBeaconChainConfig.UpgradeConfig.BEP3Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP8Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP12Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP67Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP70Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP82Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP84Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP87Height = 1 + bnbBeaconChainConfig.UpgradeConfig.FixFailAckPackageHeight = 1 + bnbBeaconChainConfig.UpgradeConfig.EnableAccountScriptsForCrossChainTransferHeight = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP128Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP151Height = 1 + bnbBeaconChainConfig.UpgradeConfig.BEP153Height = 2 + bnbBeaconChainConfig.UpgradeConfig.BEP159Height = 3 + bnbBeaconChainConfig.UpgradeConfig.BEP159Phase2Height = 6 + bnbBeaconChainConfig.UpgradeConfig.LimitConsAddrUpdateIntervalHeight = 6 + bnbBeaconChainConfig.BreatheBlockInterval = 5 appConfigFilePath := filepath.Join(ctxConfig.RootDir, "config", "app.toml") - config.WriteConfigFile(appConfigFilePath, binanceChainConfig) + config.WriteConfigFile(appConfigFilePath, bnbBeaconChainConfig) // pk nodeID, pubKey := bnbInit.InitializeNodeValidatorFiles(ctxConfig) ctxConfig.Moniker = nodeName diff --git a/plugins/tokens/abci_test.go b/plugins/tokens/abci_test.go index 9e9e71259..475045545 100644 --- a/plugins/tokens/abci_test.go +++ b/plugins/tokens/abci_test.go @@ -21,7 +21,7 @@ import ( var ( db = dbm.NewMemDB() logger = log.NewTMLogger(os.Stdout) - app = bca.NewBinanceChain(logger, db, os.Stdout) + app = bca.NewBNBBeaconChain(logger, db, os.Stdout) pk = ed25519.GenPrivKey().PubKey() addr = sdk.AccAddress(pk.Address()) token1Ptr, _ = common.NewToken("XXX", "XXX-000", 10000000000, addr, false)