diff --git a/e2e/go.mod b/e2e/go.mod index 8bfb0caff40..6bc87524ae1 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -14,7 +14,7 @@ require ( github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230622193330-220ce33823c0 github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.24.0 - golang.org/x/mod v0.11.0 + golang.org/x/mod v0.12.0 google.golang.org/grpc v1.56.1 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/e2e/go.sum b/e2e/go.sum index 6a265fa2137..3adbc31d305 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -1132,8 +1132,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go index 3d3b678df22..467561d9e77 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go @@ -543,8 +543,11 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false) suite.Require().NoError(err) - suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) - suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal) + err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) + suite.Require().NoError(err) + + err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal) + suite.Require().NoError(err) msgBytes := []byte(`{ "messages": [ @@ -639,8 +642,10 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "description", sdk.AccAddress(interchainAccountAddr), false) suite.Require().NoError(err) - suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) - suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal) + err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) + suite.Require().NoError(err) + err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal) + suite.Require().NoError(err) msgBytes := []byte(`{ "messages": [ diff --git a/modules/core/02-client/keeper/client_test.go b/modules/core/02-client/keeper/client_test.go index 5edc15ccd6a..76a39a59c92 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -149,8 +149,6 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { updateHeader = createPastUpdateFn(fillHeight, trustedHeight) }, true, false}, {"valid duplicate update", func() { - clientID := path.EndpointA.ClientID - height1 := clienttypes.NewHeight(1, 1) // store previous consensus state @@ -158,22 +156,27 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { Timestamp: suite.past, NextValidatorsHash: suite.chainB.Vals.Hash(), } - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), clientID, height1, prevConsState) + path.EndpointA.SetConsensusState(prevConsState, height1) height5 := clienttypes.NewHeight(1, 5) - // store next consensus state to check that trustedHeight does not need to be hightest consensus state before header height + // store next consensus state to check that trustedHeight does not need to be highest consensus state before header height nextConsState := &ibctm.ConsensusState{ Timestamp: suite.past.Add(time.Minute), NextValidatorsHash: suite.chainB.Vals.Hash(), } - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), clientID, height5, nextConsState) + path.EndpointA.SetConsensusState(nextConsState, height5) + + // update client state latest height + clientState := path.EndpointA.GetClientState() + clientState.(*ibctm.ClientState).LatestHeight = height5 + path.EndpointA.SetClientState(clientState) height3 := clienttypes.NewHeight(1, 3) // updateHeader will fill in consensus state between prevConsState and suite.consState // clientState should not be updated updateHeader = createPastUpdateFn(height3, height1) // set updateHeader's consensus state in store to create duplicate UpdateClient scenario - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), clientID, updateHeader.GetHeight(), updateHeader.ConsensusState()) + path.EndpointA.SetConsensusState(updateHeader.ConsensusState(), updateHeader.GetHeight()) }, true, false}, {"misbehaviour detection: conflicting header", func() { clientID := path.EndpointA.ClientID diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 5eddd78b936..6350c9d28f8 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -37,8 +37,6 @@ const ( testClientID2 = "tendermint-1" testClientID3 = "tendermint-2" - height = 5 - trustingPeriod time.Duration = time.Hour * 24 * 7 * 2 ubdPeriod time.Duration = time.Hour * 24 * 7 * 3 maxClockDrift time.Duration = time.Second * 10 @@ -61,7 +59,6 @@ type KeeperTestSuite struct { ctx sdk.Context keeper *keeper.Keeper consensusState *ibctm.ConsensusState - header *ibctm.Header valSet *tmtypes.ValidatorSet valSetHash tmbytes.HexBytes privVal tmtypes.PrivValidator @@ -81,7 +78,6 @@ func (suite *KeeperTestSuite) SetupTest() { isCheckTx := false suite.now = time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC) suite.past = time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) - now2 := suite.now.Add(time.Hour) app := simapp.Setup(suite.T(), isCheckTx) suite.cdc = app.AppCodec() @@ -91,8 +87,6 @@ func (suite *KeeperTestSuite) SetupTest() { pubKey, err := suite.privVal.GetPubKey() suite.Require().NoError(err) - testClientHeightMinus1 := types.NewHeight(0, height-1) - validator := tmtypes.NewValidator(pubKey, 1) suite.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) suite.valSetHash = suite.valSet.Hash() @@ -100,7 +94,6 @@ func (suite *KeeperTestSuite) SetupTest() { suite.signers = make(map[string]tmtypes.PrivValidator, 1) suite.signers[validator.Address.String()] = suite.privVal - suite.header = suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeightMinus1, now2, suite.valSet, suite.valSet, suite.valSet, suite.signers) suite.consensusState = ibctm.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot([]byte("hash")), suite.valSetHash) var validators stakingtypes.Validators @@ -308,30 +301,6 @@ func (suite KeeperTestSuite) TestGetConsensusState() { //nolint:govet // this is } } -func (suite KeeperTestSuite) TestConsensusStateHelpers() { //nolint:govet // this is a test, we are okay with copying locks - // initial setup - clientState := ibctm.NewClientState(testChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath) - - suite.keeper.SetClientState(suite.ctx, testClientID, clientState) - suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight, suite.consensusState) - - nextState := ibctm.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot([]byte("next")), suite.valSetHash) - - testClientHeightPlus5 := types.NewHeight(0, height+5) - - header := suite.chainA.CreateTMClientHeader(testClientID, int64(testClientHeightPlus5.RevisionHeight), testClientHeight, suite.header.Header.Time.Add(time.Minute), - suite.valSet, suite.valSet, suite.valSet, suite.signers) - - // mock update functionality - clientState.LatestHeight = header.GetHeight().(types.Height) - suite.keeper.SetClientConsensusState(suite.ctx, testClientID, header.GetHeight(), nextState) - suite.keeper.SetClientState(suite.ctx, testClientID, clientState) - - latest, ok := suite.keeper.GetLatestClientConsensusState(suite.ctx, testClientID) - suite.Require().True(ok) - suite.Require().Equal(nextState, latest, "Latest client not returned correctly") -} - // 2 clients in total are created on chainA. The first client is updated so it contains an initial consensus state // and a consensus state at the update height. func (suite KeeperTestSuite) TestGetAllConsensusStates() { //nolint:govet // this is a test, we are okay with copying locks