From b6364abbe90220beb1d6cfd660bfa00907f7638a Mon Sep 17 00:00:00 2001 From: Kitipong Sirirueangsakul Date: Mon, 25 Sep 2023 13:20:44 +0700 Subject: [PATCH] use chain id as const string --- testing/testapp/setup.go | 5 +++-- x/oracle/simulation/operations_test.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/testing/testapp/setup.go b/testing/testapp/setup.go index 6035a41b7..5f02e6421 100644 --- a/testing/testapp/setup.go +++ b/testing/testapp/setup.go @@ -86,6 +86,7 @@ var ( ) const ( + ChainID string = "BANDCHAIN" TestDefaultPrepareGas uint64 = 40000 TestDefaultExecuteGas uint64 = 300000 ) @@ -386,7 +387,7 @@ func NewTestApp(chainID string, logger log.Logger) *TestingApp { // CreateTestInput creates a new test environment for unit tests. func CreateTestInput(autoActivate bool) (*TestingApp, sdk.Context, keeper.Keeper) { - app := NewTestApp("BANDCHAIN", log.NewNopLogger()) + app := NewTestApp(ChainID, log.NewNopLogger()) ctx := app.NewContext(false, tmproto.Header{Height: app.LastBlockHeight()}) if autoActivate { app.OracleKeeper.Activate(ctx, Validators[0].ValAddress) @@ -443,7 +444,7 @@ func setup(withGenesis bool, invCheckPeriod uint, chainID string) (*TestingApp, // SetupWithEmptyStore setup a TestingApp instance with empty DB func SetupWithEmptyStore() *TestingApp { - app, _, _ := setup(false, 0, "BANDCHAIN") + app, _, _ := setup(false, 0, ChainID) return app } diff --git a/x/oracle/simulation/operations_test.go b/x/oracle/simulation/operations_test.go index 13559c4a5..0dfd5cd1a 100644 --- a/x/oracle/simulation/operations_test.go +++ b/x/oracle/simulation/operations_test.go @@ -30,7 +30,7 @@ type SimTestSuite struct { func (suite *SimTestSuite) SetupTest() { app, _, _ := testapp.CreateTestInput(true) suite.app = app - suite.ctx = app.BaseApp.NewContext(false, tmproto.Header{ChainID: "BANDCHAIN"}) + suite.ctx = app.BaseApp.NewContext(false, tmproto.Header{ChainID: testapp.ChainID}) s := rand.NewSource(1) suite.r = rand.New(s) suite.accs = suite.getTestingAccounts(suite.r, 10) @@ -39,7 +39,7 @@ func (suite *SimTestSuite) SetupTest() { suite.app.BeginBlock( abci.RequestBeginBlock{ Header: tmproto.Header{ - ChainID: "BANDCHAIN", + ChainID: testapp.ChainID, Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash, },