Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Mar 7, 2024
1 parent 762fbe4 commit cb090f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions tests/integration/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ func (s *CCVTestSuite) TestAllocateTokensToValidator() {
}
}

// TestMultiConsumerRewardsDistribution tests the reward distribution in the conext
// TestMultiConsumerRewardsDistribution tests the reward distribution in the context
// of multiple consumers sending rewards to the provider
func (s *CCVTestSuite) TestMultiConsumerRewardsDistribution() {
s.SetupAllCCVChannels()
Expand All @@ -997,25 +997,25 @@ func (s *CCVTestSuite) TestMultiConsumerRewardsDistribution() {
totalConsumerRewards := sdk.Coins{}

// Iterate over the consumers and perform the reward distribution
// to the provider.
// to the provider
for chainID := range s.consumerBundles {
bundle := s.consumerBundles[chainID]
consumerKeeper := bundle.App.GetConsumerKeeper()
bankKeeper := bundle.App.GetTestBankKeeper()
accountKeeper := bundle.App.GetTestAccountKeeper()

// set the consumer reward denom and block per distribution params
// set the consumer reward denom and the block per distribution params
params := consumerKeeper.GetConsumerParams(bundle.GetCtx())
params.RewardDenoms = []string{sdk.DefaultBondDenom}
// set the reward distribution for the next block
// set the reward distribution to be performed during the next block
params.BlocksPerDistributionTransmission = int64(1)
consumerKeeper.SetParams(bundle.GetCtx(), params)

// transfer the consumer reward pool to the provider
var rewardsPerConsumer sdk.Coin

// check the consumer pool balance
// Note that for a democracy consumer chain the reward pool may already be filled
// Note that for a democracy consumer chain the pool may already be filled
if pool := bankKeeper.GetAllBalances(
bundle.GetCtx(),
accountKeeper.GetModuleAccount(bundle.GetCtx(), consumertypes.ConsumerToSendToProviderName).GetAddress(),
Expand All @@ -1030,10 +1030,9 @@ func (s *CCVTestSuite) TestMultiConsumerRewardsDistribution() {
)
s.Require().NoError(err)
} else {
// the pool is filled so we force
// the internal reward distribution
// and save the pool balance before
// it get transferred to the provider
// execute the internal rewards distribution
// to save the pool's balance before
// it gets transferred to the provider in EndBlock
consumerKeeper.DistributeRewardsInternally(bundle.GetCtx())
pool = bankKeeper.GetAllBalances(
bundle.GetCtx(),
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (suite *CCVTestSuite) SetupTest() {
suite.consumerBundles[bundle.Chain.ChainID] = bundle
suite.registerPacketSniffer(bundle.Chain)

// check that TopN was correctly set
// check that TopN is correctly set for the consumer
topN, found := providerKeeper.GetTopN(suite.providerCtx(), bundle.Chain.ChainID)
suite.Require().True(found)
suite.Require().Equal(bundle.TopN, topN)
Expand Down
2 changes: 1 addition & 1 deletion testutil/ibc_testing/generic_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type (
// to run integration tests against your app.go implementations!

const (
// Default number of setup consumer chains
// Default number of consumer chains
NumConsumers = 5
)

Expand Down

0 comments on commit cb090f4

Please sign in to comment.