Skip to content

Commit

Permalink
use chain id as const string
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerKSI committed Sep 25, 2023
1 parent 4990717 commit b6364ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions testing/testapp/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ var (
)

const (
ChainID string = "BANDCHAIN"
TestDefaultPrepareGas uint64 = 40000
TestDefaultExecuteGas uint64 = 300000
)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions x/oracle/simulation/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
},
Expand Down

0 comments on commit b6364ab

Please sign in to comment.