From 8666e26d021733fdab48f5b0a3cc2c217e9c05a5 Mon Sep 17 00:00:00 2001 From: insumity Date: Thu, 1 Feb 2024 12:25:36 +0100 Subject: [PATCH] added changelog entry and comment --- .../1587-enable-opt-in-chains-through-gov-proposals.md | 2 ++ x/ccv/provider/keeper/proposal.go | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 .changelog/unreleased/features/1587-enable-opt-in-chains-through-gov-proposals.md diff --git a/.changelog/unreleased/features/1587-enable-opt-in-chains-through-gov-proposals.md b/.changelog/unreleased/features/1587-enable-opt-in-chains-through-gov-proposals.md new file mode 100644 index 0000000000..0abdcace89 --- /dev/null +++ b/.changelog/unreleased/features/1587-enable-opt-in-chains-through-gov-proposals.md @@ -0,0 +1,2 @@ +.changelog/unreleased/features/1587-enable-opt-in-chains-throughgov-proposals.md- Enable Opt In and Top N chains through gov proposals. + ([\#1587](https://github.com/cosmos/interchain-security/pull/1587)) \ No newline at end of file diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 6aa61d79b4..50dc69d080 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -367,7 +367,11 @@ func (k Keeper) BeginBlockInit(ctx sdk.Context) { ctx.Logger().Info("consumer client could not be created: %w", err) continue } + + // Only set Top N at the moment a chain starts. If we were to do this earlier (e.g., during the proposal), + // then someone could create a bogus ConsumerAdditionProposal to override the Top N for a specific chain. k.SetTopN(ctx, prop.ChainId, prop.Top_N) + // The cached context is created with a new EventManager so we merge the event // into the original context ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events())