Skip to content

Commit

Permalink
Merge branch 'main' into shawn/optimize-pending-packets-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Jul 13, 2023
2 parents d84b29d + 08e59a8 commit 8084b49
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 37 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
Add an entry to the unreleased section whenever merging a PR to main that is not targeted at a specific release. These entries will eventually be included in a release.

* (feat!) optimize pending packets storage on consumer, with migration! [#1037](https://github.com/cosmos/interchain-security/pull/1037)

## v3.1.0

Date July 11th, 2023

A minor upgrade to v3.0.0, which removes the panic in the consumer ccv module which would occur in an emergency scenario where the ccv channel is closed. This release also fixes how a distribution related event is emitted, and bumps cometbft.

* (feat) [#1127](https://github.com/cosmos/interchain-security/pull/1127) Remove consumer panic when ccv channel is closed
* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit.
* (deps) [#1119](https://github.com/cosmos/interchain-security/pull/1119) bump cometbft from `v0.37.1` to `0.37.2`.

Expand Down
29 changes: 0 additions & 29 deletions tests/integration/stop_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

abci "github.com/cometbft/cometbft/abci/types"

"github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
ccv "github.com/cosmos/interchain-security/v3/x/ccv/types"
)
Expand Down Expand Up @@ -213,30 +211,3 @@ func (s *CCVTestSuite) checkConsumerChainIsRemoved(chainID string, checkChannel
s.Require().Empty(slashData)
s.Require().Empty(vscMaturedData)
}

// TestProviderChannelClosed checks that a consumer chain panics
// when the provider channel was established and then closed
func (suite *CCVTestSuite) TestProviderChannelClosed() {
suite.SetupCCVChannel(suite.path)
// establish provider channel with a first VSC packet
suite.SendEmptyVSCPacket()

consumerKeeper := suite.consumerApp.GetConsumerKeeper()

channelID, found := consumerKeeper.GetProviderChannel(suite.consumerChain.GetContext())
suite.Require().True(found)

// close provider channel
err := consumerKeeper.ChanCloseInit(suite.consumerChain.GetContext(), ccv.ConsumerPortID, channelID)
suite.Require().NoError(err)
suite.Require().True(consumerKeeper.IsChannelClosed(suite.consumerChain.GetContext(), channelID))

// assert begin blocker did panics
defer func() {
if r := recover(); r != nil {
return
}
suite.Require().Fail("Begin blocker did not panic with a closed channel")
}()
suite.consumerApp.BeginBlocker(suite.consumerChain.GetContext(), abci.RequestBeginBlock{})
}
4 changes: 0 additions & 4 deletions testutil/integration/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ func TestStopConsumerOnChannelClosed(t *testing.T) {
runCCVTestByName(t, "TestStopConsumerOnChannelClosed")
}

func TestProviderChannelClosed(t *testing.T) {
runCCVTestByName(t, "TestProviderChannelClosed")
}

//
// Throttle tests
//
Expand Down
5 changes: 1 addition & 4 deletions x/ccv/consumer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,9 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
channelID, found := am.keeper.GetProviderChannel(ctx)
if found && am.keeper.IsChannelClosed(ctx, channelID) {
// The CCV channel was established, but it was then closed;
// the consumer chain is no longer safe, thus it MUST shut down.
// This is achieved by panicking, similar as it's done in the
// x/upgrade module of cosmos-sdk.
// the consumer chain is not secured anymore, but we allow it to run as a POA chain and log an error.
channelClosedMsg := fmt.Sprintf("CCV channel %q was closed - shutdown consumer chain since it is not secured anymore", channelID)
am.keeper.Logger(ctx).Error(channelClosedMsg)
panic(channelClosedMsg)
}

// map next block height to the vscID of the current block height
Expand Down

0 comments on commit 8084b49

Please sign in to comment.