Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: mostly refactors #2194

Merged
merged 16 commits into from
Aug 30, 2024
15 changes: 10 additions & 5 deletions testutil/ibc_testing/generic_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,15 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp](
FirstConsumerID = consumerId
}
providerKeeper.SetConsumerChainId(providerChain.GetContext(), consumerId, chainID)
providerKeeper.SetConsumerMetadata(providerChain.GetContext(), consumerId, consumerMetadata)
providerKeeper.SetConsumerInitializationParameters(providerChain.GetContext(), consumerId, initializationParameters)
providerKeeper.SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerId, powerShapingParameters)
err := providerKeeper.SetConsumerMetadata(providerChain.GetContext(), consumerId, consumerMetadata)
s.Require().NoError(err)
err = providerKeeper.SetConsumerInitializationParameters(providerChain.GetContext(), consumerId, initializationParameters)
s.Require().NoError(err)
err = providerKeeper.SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerId, powerShapingParameters)
s.Require().NoError(err)
providerKeeper.SetConsumerPhase(providerChain.GetContext(), consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.AppendConsumerToBeLaunched(providerChain.GetContext(), consumerId, coordinator.CurrentTime)
err = providerKeeper.AppendConsumerToBeLaunched(providerChain.GetContext(), consumerId, coordinator.CurrentTime)
s.Require().NoError(err)

// opt-in all validators
lastVals, err := providerApp.GetProviderKeeper().GetLastBondedValidators(providerChain.GetContext())
Expand All @@ -173,7 +177,8 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp](
for _, v := range lastVals {
consAddr, _ := v.GetConsAddr()
providerKeeper.SetOptedIn(providerChain.GetContext(), consumerId, providertypes.NewProviderConsAddress(consAddr))
providerKeeper.AppendOptedInConsumerId(providerChain.GetContext(), providertypes.NewProviderConsAddress(consAddr), consumerId)
err = providerKeeper.AppendOptedInConsumerId(providerChain.GetContext(), providertypes.NewProviderConsAddress(consAddr), consumerId)
s.Require().NoError(err)
}

// commit the state on the provider chain
Expand Down
2 changes: 1 addition & 1 deletion testutil/keeper/unit_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context,

err := providerKeeper.CreateConsumerClient(ctx, consumerId)
require.NoError(t, err)
providerKeeper.SetClientIdToConsumerId(ctx, "clientID", consumerId)
providerKeeper.SetConsumerClientId(ctx, consumerId, "clientID")
mpoke marked this conversation as resolved.
Show resolved Hide resolved
err = providerKeeper.SetConsumerChain(ctx, "channelID")
require.NoError(t, err)
}
Expand Down
3 changes: 1 addition & 2 deletions x/ccv/provider/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ func TestOnChanOpenTry(t *testing.T) {

providerKeeper.SetPort(ctx, ccv.ProviderPortID)
providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientIdToConsumer")
providerKeeper.SetClientIdToConsumerId(ctx, "clientIdToConsumer", "consumerId")

// Instantiate valid params as default. Individual test cases mutate these as needed.
params := params{
Expand Down Expand Up @@ -313,7 +312,7 @@ func TestOnChanOpenConfirm(t *testing.T) {
providerKeeper.SetConsumerIdToChannelId(ctx, "consumerChainID", "existingChannelID")
}

providerKeeper.SetClientIdToConsumerId(ctx, "clientID", "consumerChainID")
providerKeeper.SetConsumerClientId(ctx, "consumerChainID", "clientID")
mpoke marked this conversation as resolved.
Show resolved Hide resolved

providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey)

Expand Down
Loading
Loading