Skip to content

Commit

Permalink
misc: matching evmos's chain id rule
Browse files Browse the repository at this point in the history
- and added chain id in InitChain phase
  • Loading branch information
psy2848048 committed Nov 8, 2022
1 parent 0bd1fe5 commit 1f77eb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ante_test

import (
"fmt"
"math/rand"
"testing"

"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx/signing"
xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/stretchr/testify/suite"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

xplaapp "github.com/xpladev/xpla/app"
Expand All @@ -35,9 +35,11 @@ func TestIntegrationTestSuite(t *testing.T) {
}

func (s *IntegrationTestSuite) SetupTest() {
app := xplahelpers.Setup(s.T(), false, 1)
chainId := fmt.Sprintf("test_%d-%d", rand.Intn(1000), rand.Intn(10))

app := xplahelpers.Setup(s.T(), chainId, false, 1)
ctx := app.BaseApp.NewContext(false, tmproto.Header{
ChainID: fmt.Sprintf("test-chain-%s", tmrand.Str(4)),
ChainID: chainId,
Height: 1,
})

Expand Down
3 changes: 2 additions & 1 deletion app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type EmptyAppOptions struct{}

func (EmptyAppOptions) Get(o string) interface{} { return nil }

func Setup(t *testing.T, isCheckTx bool, invCheckPeriod uint) *xplaapp.XplaApp {
func Setup(t *testing.T, chainId string, isCheckTx bool, invCheckPeriod uint) *xplaapp.XplaApp {
t.Helper()

app, genesisState := setup(!isCheckTx, invCheckPeriod)
Expand All @@ -55,6 +55,7 @@ func Setup(t *testing.T, isCheckTx bool, invCheckPeriod uint) *xplaapp.XplaApp {
// Initialize the chain
app.InitChain(
abci.RequestInitChain{
ChainId: chainId,
Validators: []abci.ValidatorUpdate{},
ConsensusParams: DefaultConsensusParams,
AppStateBytes: stateBytes,
Expand Down

0 comments on commit 1f77eb2

Please sign in to comment.