From 897a3009a4e8de2be3d4831cc127dbb7ba65b055 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Fri, 24 May 2024 23:45:40 +0200 Subject: [PATCH 01/81] turn off expensive tests --- .github/workflows/test.yml | 189 ++----------------------------------- 1 file changed, 10 insertions(+), 179 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 078ab2c0d8..ab60f22a2b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,11 +53,11 @@ jobs: if: env.GIT_DIFF run: | make test-unit-cov - - uses: actions/upload-artifact@v4 - if: env.GIT_DIFF - with: - name: "${{ github.sha }}-coverage" - path: ./profile.out + # - uses: actions/upload-artifact@v4 + # if: env.GIT_DIFF + # with: + # name: "${{ github.sha }}-coverage" + # path: ./profile.out test-integration: runs-on: ubuntu-latest @@ -84,88 +84,11 @@ jobs: if: env.GIT_DIFF run: | make test-integration-cov - - uses: actions/upload-artifact@v4 - if: env.GIT_DIFF - with: - name: "${{ github.sha }}-integration-coverage" - path: ./integration-profile.out - - test-mbt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: go.sum - - uses: actions/setup-node@v4 - with: - node-version: ">= 18" - check-latest: true - - run: npm i @informalsystems/quint -g - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - **/Makefile - Makefile - - name: mbt tests - if: env.GIT_DIFF - run: | - make test-mbt-cov - - uses: actions/upload-artifact@v4 - if: env.GIT_DIFF - with: - name: "${{ github.sha }}-mbt-coverage" - path: ./mbt-profile.out - - name: Archive MBT traces - uses: actions/upload-artifact@v4 - if: ${{ success() || failure() }} # to upload the traces only when the test failed - with: - name: mbt-traces - path: tests/mbt/driver/traces - retention-days: 6 # to not clog our cloud storage too much, we retain only for a few days - - repo-analysis: - runs-on: ubuntu-latest - needs: [tests, test-integration, test-mbt] - steps: - - uses: actions/checkout@v4 - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - - uses: actions/download-artifact@v4 - if: env.GIT_DIFF - with: - name: "${{ github.sha }}-coverage" - - uses: actions/download-artifact@v4 - if: env.GIT_DIFF - with: - name: "${{ github.sha }}-integration-coverage" - - uses: actions/download-artifact@v4 - if: env.GIT_DIFF - with: - name: "${{ github.sha }}-mbt-coverage" - continue-on-error: true - - name: sonarcloud - if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }} - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # - uses: actions/upload-artifact@v4 + # if: env.GIT_DIFF + # with: + # name: "${{ github.sha }}-integration-coverage" + # path: ./integration-profile.out test-e2e: runs-on: ubuntu-latest @@ -198,98 +121,6 @@ jobs: run: | make test-e2e-short - test-e2e-compatibility: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - lfs: true - - name: checkout LFS objects - run: git lfs checkout - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: go.sum - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - **/Makefile - Makefile - Dockerfile* - - name: e2e compatibility tests - if: env.GIT_DIFF - run: | - make test-e2e-compatibility-tests-latest - - test-cometmock: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - lfs: true - - name: checkout LFS objects - run: git lfs checkout - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: go.sum - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - **/Makefile - Makefile - Dockerfile* - - name: cometmock tests - if: env.GIT_DIFF - run: | - make test-e2e-short-cometmock - - test-trace: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - lfs: true - - name: checkout LFS objects - run: git lfs checkout - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: go.sum - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - **/Makefile - Makefile - Dockerfile* - - name: trace-e2e tests - if: env.GIT_DIFF - run: | - make test-trace model-analysis: runs-on: ubuntu-latest steps: From 51d6543d31210f561c2eec75fd0a43d4dd5e804a Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 10:03:58 +0200 Subject: [PATCH 02/81] deprecate key prefixes --- x/ccv/provider/keeper/keeper.go | 343 +----------------------- x/ccv/provider/keeper/keeper_test.go | 202 -------------- x/ccv/provider/keeper/key_assignment.go | 2 +- x/ccv/provider/types/keys.go | 55 +--- x/ccv/provider/types/keys_test.go | 7 - 5 files changed, 15 insertions(+), 594 deletions(-) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 9b95036dda..38a98df5e9 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -4,7 +4,6 @@ import ( "encoding/binary" "fmt" "reflect" - "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" @@ -414,44 +413,6 @@ func (k Keeper) SetConsumerChain(ctx sdk.Context, channelID string) error { return nil } -// SetUnbondingOp sets the UnbondingOp by its unique ID -func (k Keeper) SetUnbondingOp(ctx sdk.Context, unbondingOp types.UnbondingOp) { - store := ctx.KVStore(k.storeKey) - bz, err := unbondingOp.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // unbondingOp is either instantiated in AfterUnbondingInitiated, - // updated correctly by RemoveConsumerFromUnbondingOp, - // or set during InitGenesis. - panic(fmt.Errorf("unbonding op could not be marshaled: %w", err)) - } - store.Set(types.UnbondingOpKey(unbondingOp.Id), bz) -} - -// GetUnbondingOp gets a UnbondingOp by its unique ID -func (k Keeper) GetUnbondingOp(ctx sdk.Context, id uint64) (types.UnbondingOp, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.UnbondingOpKey(id)) - if bz == nil { - return types.UnbondingOp{}, false - } - - var unbondingOp types.UnbondingOp - if err := unbondingOp.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the UnbondingOp is assumed to be correctly serialized in SetUnbondingOp. - panic(fmt.Errorf("failed to unmarshal UnbondingOp: %w", err)) - } - - return unbondingOp, true -} - -// DeleteUnbondingOp deletes a UnbondingOp given its ID -func (k Keeper) DeleteUnbondingOp(ctx sdk.Context, id uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.UnbondingOpKey(id)) -} - // GetAllUnbondingOps gets all UnbondingOps, where each UnbondingOp consists // of its unique ID and a list of consumer chainIDs that the unbonding operation // is waiting on. @@ -459,6 +420,7 @@ func (k Keeper) DeleteUnbondingOp(ctx sdk.Context, id uint64) { // Note that UnbondingOps are stored under keys with the following format: // UnbondingOpBytePrefix | ID // Thus, the iteration is in ascending order of IDs. +// TODO (mpoke): remove after state migration calling stakingKeeper.UnbondingCanComplete(ctx, id) func (k Keeper) GetAllUnbondingOps(ctx sdk.Context) (ops []types.UnbondingOp) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, []byte{types.UnbondingOpBytePrefix}) @@ -485,189 +447,6 @@ func (k Keeper) GetAllUnbondingOps(ctx sdk.Context) (ops []types.UnbondingOp) { return ops } -// RemoveConsumerFromUnbondingOp removes a consumer chain ID that the unbonding op with 'id' is waiting on. -// The method returns true if the unbonding op can complete. In this case the record is removed from store. -// The method panics if the unbonding op with 'id' is not found. -func (k Keeper) RemoveConsumerFromUnbondingOp(ctx sdk.Context, id uint64, chainID string) (canComplete bool) { - // Get the unbonding op from store - unbondingOp, found := k.GetUnbondingOp(ctx, id) - if !found { - panic(fmt.Errorf("internal state corrupted; could not find UnbondingOp with ID %d", id)) - } - - // Remove consumer chain ID from unbonding op - var numRemoved int - unbondingOp.UnbondingConsumerChains, numRemoved = removeStringFromSlice(unbondingOp.UnbondingConsumerChains, chainID) - if numRemoved > 0 { - k.Logger(ctx).Debug("unbonding operation matured on consumer", "chainID", chainID, "opID", id) - - if len(unbondingOp.UnbondingConsumerChains) == 0 { - // Delete unbonding op - k.DeleteUnbondingOp(ctx, id) - // No more consumer chains; the unbonding op can complete - canComplete = true - } else { - // Update unbonding op in store - k.SetUnbondingOp(ctx, unbondingOp) - } - } - return -} - -func removeStringFromSlice(slice []string, x string) (newSlice []string, numRemoved int) { - for _, y := range slice { - if x != y { - newSlice = append(newSlice, y) - } - } - - return newSlice, len(slice) - len(newSlice) -} - -// SetUnbondingOpIndex sets the IDs of unbonding operations that are waiting for -// a VSCMaturedPacket with vscID from a consumer with chainID -func (k Keeper) SetUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64, ids []uint64) { - store := ctx.KVStore(k.storeKey) - - vscUnbondingOps := types.VscUnbondingOps{ - VscId: vscID, - UnbondingOpIds: ids, - } - bz, err := vscUnbondingOps.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // vscUnbondingOps is instantiated in this method and should be able to be marshaled. - panic(fmt.Errorf("failed to marshal VscUnbondingOps: %w", err)) - } - - store.Set(types.UnbondingOpIndexKey(chainID, vscID), bz) -} - -// GetAllUnbondingOpIndexes gets all unbonding indexes for a given chain id, -// i.e., all the IDs of unbonding operations that are waiting for -// VSCMaturedPackets from a consumer with chainID. -// -// Note that the unbonding indexes for a given chainID are stored under keys with the following format: -// UnbondingOpIndexBytePrefix | len(chainID) | chainID | vscID -// Thus, the returned array is in ascending order of vscIDs. -func (k Keeper) GetAllUnbondingOpIndexes(ctx sdk.Context, chainID string) (indexes []types.VscUnbondingOps) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.UnbondingOpIndexBytePrefix, chainID)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var vscUnbondingOps types.VscUnbondingOps - if err := vscUnbondingOps.Unmarshal(iterator.Value()); err != nil { - // An error here would indicate something is very wrong, - // the VscUnbondingOps are assumed to be correctly serialized in SetUnbondingOpIndex. - panic(fmt.Errorf("failed to unmarshal VscUnbondingOps: %w", err)) - } - - indexes = append(indexes, types.VscUnbondingOps{ - VscId: vscUnbondingOps.GetVscId(), - UnbondingOpIds: vscUnbondingOps.GetUnbondingOpIds(), - }) - } - - return indexes -} - -// GetUnbondingOpIndex gets the IDs of unbonding operations that are waiting for -// a VSCMaturedPacket with vscID from a consumer with chainID -func (k Keeper) GetUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64) ([]uint64, bool) { - store := ctx.KVStore(k.storeKey) - - bz := store.Get(types.UnbondingOpIndexKey(chainID, vscID)) - if bz == nil { - return []uint64{}, false - } - - var vscUnbondingOps types.VscUnbondingOps - if err := vscUnbondingOps.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the VscUnbondingOps are assumed to be correctly serialized in SetUnbondingOpIndex. - panic(fmt.Errorf("failed to unmarshal VscUnbondingOps: %w", err)) - } - - return vscUnbondingOps.GetUnbondingOpIds(), true -} - -// DeleteUnbondingOpIndex deletes the IDs of unbonding operations that are waiting for -// a VSCMaturedPacket with vscID from a consumer with chainID -func (k Keeper) DeleteUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.UnbondingOpIndexKey(chainID, vscID)) -} - -// GetUnbondingOpsFromIndex gets the unbonding ops waiting for a given chainID and vscID -func (k Keeper) GetUnbondingOpsFromIndex(ctx sdk.Context, chainID string, valsetUpdateID uint64) (entries []types.UnbondingOp) { - ids, found := k.GetUnbondingOpIndex(ctx, chainID, valsetUpdateID) - if !found { - return entries - } - for _, id := range ids { - entry, found := k.GetUnbondingOp(ctx, id) - if !found { - // An error here would indicate something is very wrong. - // Every UnbondingOpIndex is assumed to have the corresponding UnbondingOps set in store. - // This is done in AfterUnbondingInitiated and InitGenesis. - panic("did not find UnbondingOp according to index- index was probably not correctly updated") - } - entries = append(entries, entry) - } - - return entries -} - -// GetMaturedUnbondingOps returns the list of matured unbonding operation ids -func (k Keeper) GetMaturedUnbondingOps(ctx sdk.Context) (ids []uint64) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.MaturedUnbondingOpsKey()) - if bz == nil { - // Note that every call to ConsumeMaturedUnbondingOps - // deletes the MaturedUnbondingOpsKey, which means that - // the first call to GetMaturedUnbondingOps after that - // will enter this branch. - return nil - } - - var ops types.MaturedUnbondingOps - if err := ops.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the MaturedUnbondingOps are assumed to be correctly serialized in AppendMaturedUnbondingOps. - panic(fmt.Errorf("failed to unmarshal MaturedUnbondingOps: %w", err)) - } - return ops.GetIds() -} - -// AppendMaturedUnbondingOps adds a list of ids to the list of matured unbonding operation ids -func (k Keeper) AppendMaturedUnbondingOps(ctx sdk.Context, ids []uint64) { - if len(ids) == 0 { - return - } - existingIds := k.GetMaturedUnbondingOps(ctx) - maturedOps := types.MaturedUnbondingOps{ - Ids: append(existingIds, ids...), - } - - store := ctx.KVStore(k.storeKey) - bz, err := maturedOps.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // maturedOps is instantiated in this method and should be able to be marshaled. - panic(fmt.Sprintf("failed to marshal matured unbonding operations: %s", err)) - } - store.Set(types.MaturedUnbondingOpsKey(), bz) -} - -// ConsumeMaturedUnbondingOps empties and returns list of matured unbonding operation ids (if it exists) -func (k Keeper) ConsumeMaturedUnbondingOps(ctx sdk.Context) []uint64 { - ids := k.GetMaturedUnbondingOps(ctx) - store := ctx.KVStore(k.storeKey) - store.Delete(types.MaturedUnbondingOpsKey()) - return ids -} - // Retrieves the underlying client state corresponding to a connection ID. func (k Keeper) getUnderlyingClient(ctx sdk.Context, connectionID string) ( clientID string, tmClient *ibctmtypes.ClientState, err error, @@ -973,126 +752,6 @@ func (k Keeper) GetAllInitTimeoutTimestamps(ctx sdk.Context) (initTimeoutTimesta return initTimeoutTimestamps } -// SetVscSendTimestamp sets the VSC send timestamp -// for a VSCPacket with ID vscID sent to a chain with ID chainID -func (k Keeper) SetVscSendTimestamp( - ctx sdk.Context, - chainID string, - vscID uint64, - timestamp time.Time, -) { - store := ctx.KVStore(k.storeKey) - - // Convert timestamp into bytes for storage - timeBz := sdk.FormatTimeBytes(timestamp) - - store.Set(types.VscSendingTimestampKey(chainID, vscID), timeBz) -} - -// GetVscSendTimestamp returns a VSC send timestamp by chainID and vscID -// -// Note: This method is used only for testing. -func (k Keeper) GetVscSendTimestamp(ctx sdk.Context, chainID string, vscID uint64) (time.Time, bool) { - store := ctx.KVStore(k.storeKey) - - timeBz := store.Get(types.VscSendingTimestampKey(chainID, vscID)) - if timeBz == nil { - return time.Time{}, false - } - - ts, err := sdk.ParseTimeBytes(timeBz) - if err != nil { - return time.Time{}, false - } - return ts, true -} - -// DeleteVscSendTimestamp removes from the store a specific VSC send timestamp -// for the given chainID and vscID. -func (k Keeper) DeleteVscSendTimestamp(ctx sdk.Context, chainID string, vscID uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.VscSendingTimestampKey(chainID, vscID)) -} - -// GetAllVscSendTimestamps gets an array of all the vsc send timestamps of the given chainID. -// -// Note that the vsc send timestamps of a given chainID are stored under keys with the following format: -// VscSendTimestampBytePrefix | len(chainID) | chainID | vscID -// Thus, the iteration is in ascending order of vscIDs, and as a result in send timestamp order. -func (k Keeper) GetAllVscSendTimestamps(ctx sdk.Context, chainID string) (vscSendTimestamps []types.VscSendTimestamp) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.VscSendTimestampBytePrefix, chainID)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - _, vscID, err := types.ParseVscSendingTimestampKey(iterator.Key()) - if err != nil { - // An error here would indicate something is very wrong, - // the store key is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse VscSendTimestampKey: %w", err)) - } - ts, err := sdk.ParseTimeBytes(iterator.Value()) - if err != nil { - // An error here would indicate something is very wrong, - // the timestamp is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse timestamp value: %w", err)) - } - - vscSendTimestamps = append(vscSendTimestamps, types.VscSendTimestamp{ - VscId: vscID, - Timestamp: ts, - }) - } - - return vscSendTimestamps -} - -// DeleteVscSendTimestampsForConsumer deletes all VSC send timestamps for a given consumer chain -func (k Keeper) DeleteVscSendTimestampsForConsumer(ctx sdk.Context, consumerChainID string) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.VscSendTimestampBytePrefix, consumerChainID)) - defer iterator.Close() - - keysToDel := [][]byte{} - for ; iterator.Valid(); iterator.Next() { - keysToDel = append(keysToDel, iterator.Key()) - } - - // Delete data for this consumer - for _, key := range keysToDel { - store.Delete(key) - } -} - -// GetFirstVscSendTimestamp gets the vsc send timestamp with the lowest vscID for the given chainID. -func (k Keeper) GetFirstVscSendTimestamp(ctx sdk.Context, chainID string) (vscSendTimestamp types.VscSendTimestamp, found bool) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.VscSendTimestampBytePrefix, chainID)) - defer iterator.Close() - - if iterator.Valid() { - _, vscID, err := types.ParseVscSendingTimestampKey(iterator.Key()) - if err != nil { - // An error here would indicate something is very wrong, - // the store key is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse VscSendTimestampKey: %w", err)) - } - ts, err := sdk.ParseTimeBytes(iterator.Value()) - if err != nil { - // An error here would indicate something is very wrong, - // the timestamp is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse timestamp value: %w", err)) - } - - return types.VscSendTimestamp{ - VscId: vscID, - Timestamp: ts, - }, true - } - - return types.VscSendTimestamp{}, false -} - // SetSlashLog updates validator's slash log for a consumer chain // If an entry exists for a given validator address, at least one // double signing slash packet was received by the provider from at least one consumer chain diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index f68afc20c2..8b4dcec43e 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -224,63 +224,6 @@ func TestInitHeight(t *testing.T) { } } -// TestGetAllUnbondingOpIndexes tests GetAllUnbondingOpIndexes behavior correctness -func TestGetAllUnbondingOpIndexes(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - ops := []types.VscUnbondingOps{ - { - VscId: 2, - UnbondingOpIds: []uint64{4, 5, 6, 7}, - }, - { - VscId: 1, - UnbondingOpIds: []uint64{1, 2, 3}, - }, - { - VscId: 4, - UnbondingOpIds: []uint64{10}, - }, - { - VscId: 3, - UnbondingOpIds: []uint64{8, 9}, - }, - } - // sorting by CrossChainValidator.Address - expectedGetAllOrder := ops - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].VscId < expectedGetAllOrder[j].VscId - }) - - pk.SetUnbondingOpIndex(ctx, "chain-2", 1, []uint64{1, 2, 3}) - for _, op := range ops { - pk.SetUnbondingOpIndex(ctx, "chain-1", op.VscId, op.UnbondingOpIds) - } - - // iterate and check all results are returned in the expected order - result := pk.GetAllUnbondingOpIndexes(ctx, "chain-1") - require.Len(t, result, len(ops)) - require.Equal(t, result, expectedGetAllOrder) -} - -func TestMaturedUnbondingOps(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - ids := providerKeeper.GetMaturedUnbondingOps(ctx) - require.Nil(t, ids) - - unbondingOpIds := []uint64{0, 1, 2, 3, 4, 5, 6} - providerKeeper.AppendMaturedUnbondingOps(ctx, unbondingOpIds) - - ids = providerKeeper.ConsumeMaturedUnbondingOps(ctx) - require.Equal(t, len(unbondingOpIds), len(ids)) - for i := 0; i < len(unbondingOpIds); i++ { - require.Equal(t, unbondingOpIds[i], ids[i]) - } -} - func TestInitTimeoutTimestamp(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -334,65 +277,6 @@ func TestInitTimeoutTimestamp(t *testing.T) { require.False(t, found) } -// TestVscSendTimestamp tests the set, deletion, and iteration methods for VSC timeout timestamps -func TestVscSendTimestamp(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - - testCases := []struct { - chainID string - ts time.Time - vscID uint64 - }{ - {chainID: "chain", ts: now.Add(2 * time.Hour), vscID: 2}, - {chainID: "chain", ts: now.Add(time.Hour), vscID: 1}, - {chainID: "chain", ts: now.Add(time.Hour), vscID: 3}, - // this is not possible since the ts is the timestamp of sending, - // which means it must be in the same order as vscIDs, - // but it still worth testing - {chainID: "chain", ts: now.Add(-time.Hour), vscID: 4}, - {chainID: "chain1", ts: now.Add(time.Hour), vscID: 1}, - {chainID: "chain2", ts: now.Add(time.Hour), vscID: 1}, - } - chainID := testCases[0].chainID - expectedGetAllOrder := []types.VscSendTimestamp{} - for _, tc := range testCases { - if tc.chainID == chainID { - expectedGetAllOrder = append(expectedGetAllOrder, types.VscSendTimestamp{VscId: tc.vscID, Timestamp: tc.ts}) - } - } - // sorting by vscID - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].VscId < expectedGetAllOrder[j].VscId - }) - - require.Empty(t, providerKeeper.GetAllVscSendTimestamps(ctx, chainID)) - - for _, tc := range testCases { - providerKeeper.SetVscSendTimestamp(ctx, tc.chainID, tc.vscID, tc.ts) - } - - // iterate and check all results are returned in the expected order - vscSendTimestamps := providerKeeper.GetAllVscSendTimestamps(ctx, chainID) - require.Equal(t, expectedGetAllOrder, vscSendTimestamps) - - vscSendTimestamp, found := providerKeeper.GetFirstVscSendTimestamp(ctx, chainID) - require.True(t, found) - require.Equal(t, vscSendTimestamp, expectedGetAllOrder[0]) - - // delete first VSC send timestamp - providerKeeper.DeleteVscSendTimestamp(ctx, chainID, vscSendTimestamp.VscId) - for _, vst := range providerKeeper.GetAllVscSendTimestamps(ctx, chainID) { - require.NotEqual(t, vscSendTimestamp, vst) - } - - // delete all VSC send timestamps - providerKeeper.DeleteVscSendTimestampsForConsumer(ctx, chainID) - require.Empty(t, providerKeeper.GetAllVscSendTimestamps(ctx, chainID)) -} - func TestGetAllRegisteredConsumerChainIDs(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -433,92 +317,6 @@ func TestGetAllChannelToChains(t *testing.T) { require.Equal(t, expectedGetAllOrder, result) } -// TestGetAllUnbondingOps tests GetAllUnbondingOps behaviour correctness -func TestGetAllUnbondingOps(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - ops := []types.UnbondingOp{ - { - Id: 2, - UnbondingConsumerChains: []string{"chain-2", "chain-1"}, - }, - { - Id: 1, - UnbondingConsumerChains: []string{"chain-1", "chain-2"}, - }, - { - Id: 4, - UnbondingConsumerChains: []string{"chain-2"}, - }, - { - Id: 3, - UnbondingConsumerChains: []string{"chain-3", "chain-1", "chain-2"}, - }, - } - expectedGetAllOrder := ops - // sorting by Id - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].Id < expectedGetAllOrder[j].Id - }) - - for _, op := range ops { - pk.SetUnbondingOp(ctx, op) - } - - // iterate and check all results are returned - result := pk.GetAllUnbondingOps(ctx) - require.Len(t, result, len(ops)) - require.Equal(t, expectedGetAllOrder, result) -} - -// TestRemoveConsumerFromUnbondingOp tests RemoveConsumerFromUnbondingOp behaviour correctness -func TestRemoveConsumerFromUnbondingOp(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - var expectedID uint64 = 1 - expectedUnbondingOp := types.UnbondingOp{ - Id: expectedID, - UnbondingConsumerChains: []string{"chain-3", "chain-1", "chain-2"}, - } - - pk.SetUnbondingOp(ctx, expectedUnbondingOp) - - canComplete := pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-1") - require.False(t, canComplete) - unbondingOp, found := pk.GetUnbondingOp(ctx, expectedID) - require.True(t, found) - expectedChainIDs := []string{"chain-3", "chain-2"} - require.Equal(t, expectedChainIDs, unbondingOp.UnbondingConsumerChains) - - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-2") - require.False(t, canComplete) - unbondingOp, found = pk.GetUnbondingOp(ctx, expectedID) - require.True(t, found) - expectedChainIDs = []string{"chain-3"} - require.Equal(t, expectedChainIDs, unbondingOp.UnbondingConsumerChains) - - // check that it doesn't panic when calling with same chain ID - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-2") - require.False(t, canComplete) - unbondingOp, found = pk.GetUnbondingOp(ctx, expectedID) - require.True(t, found) - require.Equal(t, expectedChainIDs, unbondingOp.UnbondingConsumerChains) - - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-3") - require.True(t, canComplete) - unbondingOp, found = pk.GetUnbondingOp(ctx, expectedID) - require.False(t, found) - require.Empty(t, unbondingOp.UnbondingConsumerChains) - - // check that it panics when calling with wrong chain IDs - require.Panics(t, func() { - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "some_chain") - require.False(t, canComplete) - }) -} - // TestSetSlashLog tests slash log getter and setter methods func TestSetSlashLog(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 67f4d89fdd..99d9443d47 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -103,7 +103,7 @@ func (k Keeper) SetValidatorConsumerPubKey( // If chainID is nil, it returns all the validators public keys assigned for all consumer chains // // Note that the validators public keys assigned for a consumer chain are stored under keys -// with the following format: UnbondingOpIndexBytePrefix | len(chainID) | chainID | providerAddress +// with the following format: ConsumerValidatorsBytePrefix | len(chainID) | chainID | providerAddress // Thus, the returned array is // - in ascending order of providerAddresses, if chainID is not nil; // - in undetermined order, if chainID is nil. diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 14521b9289..e916f856df 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -42,6 +42,8 @@ const ( // MaturedUnbondingOpsByteKey is the byte key that stores the list of all unbonding operations ids // that have matured from a consumer chain perspective, // i.e., no longer waiting on the unbonding period to elapse on any consumer chain + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] MaturedUnbondingOpsByteKey // ValidatorSetUpdateIdByteKey is the byte key that stores the current validator set update id @@ -78,10 +80,16 @@ const ( // UnbondingOpBytePrefix is the byte prefix that stores a record of all the ids of consumer chains that // need to unbond before a given unbonding operation can unbond on this chain. + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + // TODO (mpoke): cleanup state in migration UnbondingOpBytePrefix // UnbondingOpIndexBytePrefix is byte prefix of the index for looking up which unbonding // operations are waiting for a given consumer chain to unbond + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + // TODO (mpoke): cleanup state in migration UnbondingOpIndexBytePrefix // ValsetUpdateBlockHeightBytePrefix is the byte prefix that will store the mapping from vscIDs to block heights @@ -102,6 +110,9 @@ const ( // VscSendTimestampBytePrefix is the byte prefix for storing // the list of VSC sending timestamps for a given consumer chainID. + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + // TODO (mpoke): cleanup state in migration VscSendTimestampBytePrefix // ThrottledPacketDataSizeBytePrefix is the byte prefix for storing the size of chain-specific throttled packet data queues @@ -138,6 +149,8 @@ const ( // VSCMaturedHandledThisBlockBytePrefix is the byte prefix storing the number of vsc matured packets // handled in the current block + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] VSCMaturedHandledThisBlockBytePrefix // EquivocationEvidenceMinHeightBytePrefix is the byte prefix storing the mapping from consumer chain IDs @@ -195,11 +208,6 @@ func PortKey() []byte { return []byte{PortByteKey} } -// MaturedUnbondingOpsKey returns the key for storing the list of matured unbonding operations. -func MaturedUnbondingOpsKey() []byte { - return []byte{MaturedUnbondingOpsByteKey} -} - // ValidatorSetUpdateIdKey is the key that stores the current validator set update id func ValidatorSetUpdateIdKey() []byte { return []byte{ValidatorSetUpdateIdByteKey} @@ -263,27 +271,6 @@ func PendingCRPKey(timestamp time.Time, chainID string) []byte { ) } -// UnbondingOpKey returns the key that stores a record of all the ids of consumer chains that -// need to unbond before a given unbonding operation can unbond on this chain. -func UnbondingOpKey(id uint64) []byte { - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, id) - return append([]byte{UnbondingOpBytePrefix}, bz...) -} - -// UnbondingOpIndexKey returns an unbonding op index key -// Note: chainId is hashed to a fixed length sequence of bytes here to prevent -// injection attack between chainIDs. -func UnbondingOpIndexKey(chainID string, vscID uint64) []byte { - return ChainIdAndUintIdKey(UnbondingOpIndexBytePrefix, chainID, vscID) -} - -// ParseUnbondingOpIndexKey parses an unbonding op index key for VSC ID -// Removes the prefix + chainID from index key and returns only the key part. -func ParseUnbondingOpIndexKey(key []byte) (string, uint64, error) { - return ParseChainIdAndUintIdKey(UnbondingOpIndexBytePrefix, key) -} - // ValsetUpdateBlockHeightKey returns the key that storing the mapping from valset update ID to block height func ValsetUpdateBlockHeightKey(valsetUpdateId uint64) []byte { vuidBytes := make([]byte, 8) @@ -313,18 +300,6 @@ func PendingVSCsKey(chainID string) []byte { return append([]byte{PendingVSCsBytePrefix}, []byte(chainID)...) } -// VscSendingTimestampKey returns the key under which the -// sending timestamp of the VSCPacket with vsc ID is stored -func VscSendingTimestampKey(chainID string, vscID uint64) []byte { - return ChainIdAndUintIdKey(VscSendTimestampBytePrefix, chainID, vscID) -} - -// ParseVscTimeoutTimestampKey returns chain ID and vsc ID -// for a VscSendingTimestampKey or an error if unparsable -func ParseVscSendingTimestampKey(bz []byte) (string, uint64, error) { - return ParseChainIdAndUintIdKey(VscSendTimestampBytePrefix, bz) -} - // ThrottledPacketDataSizeKey returns the key storing the size of the throttled packet data queue for a given chain ID func ThrottledPacketDataSizeKey(consumerChainID string) []byte { return append([]byte{ThrottledPacketDataSizeBytePrefix}, []byte(consumerChainID)...) @@ -525,10 +500,6 @@ func ParseChainIdAndConsAddrKey(prefix byte, bz []byte) (string, sdk.ConsAddress return chainID, addr, nil } -func VSCMaturedHandledThisBlockKey() []byte { - return []byte{VSCMaturedHandledThisBlockBytePrefix} -} - // ProposedConsumerChainKey returns the key of proposed consumer chainId in consumerAddition gov proposal before voting finishes, the stored key format is prefix|proposalID, value is chainID func ProposedConsumerChainKey(proposalID uint64) []byte { return ccvtypes.AppendMany( diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index eac11a0993..1580ee0fcd 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -78,7 +78,6 @@ func TestNoPrefixOverlap(t *testing.T) { func getAllFullyDefinedKeys() [][]byte { return [][]byte{ providertypes.PortKey(), - providertypes.MaturedUnbondingOpsKey(), providertypes.ValidatorSetUpdateIdKey(), providertypes.SlashMeterKey(), providertypes.SlashMeterReplenishTimeCandidateKey(), @@ -88,14 +87,11 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.InitTimeoutTimestampKey("chainID"), providertypes.PendingCAPKey(time.Time{}, "chainID"), providertypes.PendingCRPKey(time.Time{}, "chainID"), - providertypes.UnbondingOpKey(7), - providertypes.UnbondingOpIndexKey("chainID", 7), providertypes.ValsetUpdateBlockHeightKey(7), providertypes.ConsumerGenesisKey("chainID"), providertypes.SlashAcksKey("chainID"), providertypes.InitChainHeightKey("chainID"), providertypes.PendingVSCsKey("chainID"), - providertypes.VscSendingTimestampKey("chainID", 8), providertypes.ThrottledPacketDataSizeKey("chainID"), providertypes.ThrottledPacketDataKey("chainID", 88), providertypes.GlobalSlashEntryKey(providertypes.GlobalSlashEntry{}), @@ -103,7 +99,6 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ValidatorsByConsumerAddrKey("chainID", providertypes.NewConsumerConsAddress([]byte{0x05})), providertypes.ConsumerAddrsToPruneKey("chainID", 88), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05})), - providertypes.VSCMaturedHandledThisBlockKey(), providertypes.EquivocationEvidenceMinHeightKey("chainID"), } } @@ -290,12 +285,10 @@ func TestKeysWithPrefixAndId(t *testing.T) { func TestKeysWithUint64Payload(t *testing.T) { funcs := []func(uint64) []byte{ - providertypes.UnbondingOpKey, providertypes.ValsetUpdateBlockHeightKey, } expectedBytePrefixes := []byte{ - providertypes.UnbondingOpBytePrefix, providertypes.ValsetUpdateBlockHeightBytePrefix, } From b8eac2cd8ee457c9a15e82dedf502d4d7a6d6699 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 10:14:27 +0200 Subject: [PATCH 03/81] tag protos for removal --- proto/interchain_security/ccv/provider/v1/genesis.proto | 5 +++++ proto/interchain_security/ccv/provider/v1/provider.proto | 5 +++++ x/ccv/provider/types/genesis.pb.go | 9 +++++++-- x/ccv/provider/types/provider.pb.go | 5 +++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 443ea26b32..fb8fa4b490 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -19,9 +19,11 @@ message GenesisState { (gogoproto.moretags) = "yaml:\"consumer_states\"" ]; // empty for a new chain + // TODO (mpoke) remove repeated interchain_security.ccv.provider.v1.UnbondingOp unbonding_ops = 3 [ (gogoproto.nullable) = false ]; // empty for a new chain + // TODO (mpoke) remove interchain_security.ccv.provider.v1.MaturedUnbondingOps mature_unbonding_ops = 4; // empty for a new chain repeated ValsetUpdateIdToHeight valset_update_id_to_height = 5 @@ -46,6 +48,7 @@ message GenesisState { repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 12 [ (gogoproto.nullable) = false ]; +// TODO (mpoke) remove repeated interchain_security.ccv.provider.v1.ExportedVscSendTimestamp exported_vsc_send_timestamps = 13 [ (gogoproto.nullable) = false ]; } @@ -67,11 +70,13 @@ message ConsumerState { [ (gogoproto.nullable) = false ]; // PendingValsetChanges defines the pending validator set changes for the // consumer chain + // TODO (mpoke) remove repeated interchain_security.ccv.v1.ValidatorSetChangePacketData pending_valset_changes = 6 [ (gogoproto.nullable) = false ]; repeated string slash_downtime_ack = 7; // UnbondingOpsIndex defines the unbonding operations waiting on this consumer // chain + // TODO (mpoke) remove repeated interchain_security.ccv.provider.v1.VscUnbondingOps unbonding_ops_index = 8 [ (gogoproto.nullable) = false ]; } diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 2a25eb533f..c0b53c5b67 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -274,6 +274,7 @@ message ChannelToChain { // VscUnbondingOps contains the IDs of unbonding operations that are waiting for // at least one VSCMaturedPacket with vscID from a consumer chain +// TODO (mpoke) remove message VscUnbondingOps { uint64 vsc_id = 1; repeated uint64 unbonding_op_ids = 2; @@ -281,6 +282,7 @@ message VscUnbondingOps { // UnbondingOp contains the ids of consumer chains that need to unbond before // the unbonding operation with the given ID can unbond +// TODO (mpoke) remove message UnbondingOp { uint64 id = 1; // consumer chains that are still unbonding @@ -292,6 +294,7 @@ message InitTimeoutTimestamp { uint64 timestamp = 2; } +// TODO (mpoke) remove message VscSendTimestamp { uint64 vsc_id = 1; google.protobuf.Timestamp timestamp = 2 @@ -306,9 +309,11 @@ message ValidatorSetChangePackets { // MaturedUnbondingOps defines a list of ids corresponding to ids of matured // unbonding operations. +// TODO (mpoke) remove message MaturedUnbondingOps { repeated uint64 ids = 1; } // ExportedVscSendTimestamps is VscSendTimestamp with chainID info for exporting to genesis +// TODO (mpoke) remove message ExportedVscSendTimestamp { string chain_id = 1; repeated VscSendTimestamp vsc_send_timestamps = 2 diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index d5041f1b10..fcb7d6c499 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -31,8 +31,10 @@ type GenesisState struct { // empty for a new chain ConsumerStates []ConsumerState `protobuf:"bytes,2,rep,name=consumer_states,json=consumerStates,proto3" json:"consumer_states" yaml:"consumer_states"` // empty for a new chain + // TODO (mpoke) remove UnbondingOps []UnbondingOp `protobuf:"bytes,3,rep,name=unbonding_ops,json=unbondingOps,proto3" json:"unbonding_ops"` // empty for a new chain + // TODO (mpoke) remove MatureUnbondingOps *MaturedUnbondingOps `protobuf:"bytes,4,opt,name=mature_unbonding_ops,json=matureUnbondingOps,proto3" json:"mature_unbonding_ops,omitempty"` // empty for a new chain ValsetUpdateIdToHeight []ValsetUpdateIdToHeight `protobuf:"bytes,5,rep,name=valset_update_id_to_height,json=valsetUpdateIdToHeight,proto3" json:"valset_update_id_to_height"` @@ -46,8 +48,9 @@ type GenesisState struct { // empty for a new chain ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,10,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` // empty for a new chain - ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` - InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` + ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` + InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` + // TODO (mpoke) remove ExportedVscSendTimestamps []ExportedVscSendTimestamp `protobuf:"bytes,13,rep,name=exported_vsc_send_timestamps,json=exportedVscSendTimestamps,proto3" json:"exported_vsc_send_timestamps"` } @@ -191,10 +194,12 @@ type ConsumerState struct { ConsumerGenesis types.ConsumerGenesisState `protobuf:"bytes,5,opt,name=consumer_genesis,json=consumerGenesis,proto3" json:"consumer_genesis"` // PendingValsetChanges defines the pending validator set changes for the // consumer chain + // TODO (mpoke) remove PendingValsetChanges []types.ValidatorSetChangePacketData `protobuf:"bytes,6,rep,name=pending_valset_changes,json=pendingValsetChanges,proto3" json:"pending_valset_changes"` SlashDowntimeAck []string `protobuf:"bytes,7,rep,name=slash_downtime_ack,json=slashDowntimeAck,proto3" json:"slash_downtime_ack,omitempty"` // UnbondingOpsIndex defines the unbonding operations waiting on this consumer // chain + // TODO (mpoke) remove UnbondingOpsIndex []VscUnbondingOps `protobuf:"bytes,8,rep,name=unbonding_ops_index,json=unbondingOpsIndex,proto3" json:"unbonding_ops_index"` } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 0540dfb0a6..e31b79600f 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -931,6 +931,7 @@ func (m *ChannelToChain) GetChainId() string { // VscUnbondingOps contains the IDs of unbonding operations that are waiting for // at least one VSCMaturedPacket with vscID from a consumer chain +// TODO (mpoke) remove type VscUnbondingOps struct { VscId uint64 `protobuf:"varint,1,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` UnbondingOpIds []uint64 `protobuf:"varint,2,rep,packed,name=unbonding_op_ids,json=unbondingOpIds,proto3" json:"unbonding_op_ids,omitempty"` @@ -985,6 +986,7 @@ func (m *VscUnbondingOps) GetUnbondingOpIds() []uint64 { // UnbondingOp contains the ids of consumer chains that need to unbond before // the unbonding operation with the given ID can unbond +// TODO (mpoke) remove type UnbondingOp struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // consumer chains that are still unbonding @@ -1090,6 +1092,7 @@ func (m *InitTimeoutTimestamp) GetTimestamp() uint64 { return 0 } +// TODO (mpoke) remove type VscSendTimestamp struct { VscId uint64 `protobuf:"varint,1,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"` @@ -1189,6 +1192,7 @@ func (m *ValidatorSetChangePackets) GetList() []types3.ValidatorSetChangePacketD // MaturedUnbondingOps defines a list of ids corresponding to ids of matured // unbonding operations. +// TODO (mpoke) remove type MaturedUnbondingOps struct { Ids []uint64 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"` } @@ -1234,6 +1238,7 @@ func (m *MaturedUnbondingOps) GetIds() []uint64 { } // ExportedVscSendTimestamps is VscSendTimestamp with chainID info for exporting to genesis +// TODO (mpoke) remove type ExportedVscSendTimestamp struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` VscSendTimestamps []VscSendTimestamp `protobuf:"bytes,2,rep,name=vsc_send_timestamps,json=vscSendTimestamps,proto3" json:"vsc_send_timestamps"` From 57a5c30ba93b1ebe6f4d812fb587d2df75912fa0 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 10:16:09 +0200 Subject: [PATCH 04/81] remove QueryOldestUnconfirmedVsc --- .../ccv/provider/v1/query.proto | 14 - x/ccv/provider/client/cli/query.go | 28 - x/ccv/provider/keeper/grpc_query.go | 31 - x/ccv/provider/keeper/grpc_query_test.go | 44 -- x/ccv/provider/types/query.pb.go | 630 ++++-------------- x/ccv/provider/types/query.pb.gw.go | 101 --- 6 files changed, 122 insertions(+), 726 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index b982cea667..dfb413da8c 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -128,13 +128,6 @@ service Query { "/interchain_security/ccv/provider/consumer_commission_rate/{chain_id}/{provider_address}"; } - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - rpc QueryOldestUnconfirmedVsc(QueryOldestUnconfirmedVscRequest) - returns (QueryOldestUnconfirmedVscResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/oldest_unconfirmed_vsc/{chain_id}"; - } - // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. @@ -320,10 +313,3 @@ message QueryValidatorConsumerCommissionRateResponse { (gogoproto.nullable) = false ]; } - -message QueryOldestUnconfirmedVscRequest { string chain_id = 1; } - -message QueryOldestUnconfirmedVscResponse { - interchain_security.ccv.provider.v1.VscSendTimestamp vsc_send_timestamp = 1 - [ (gogoproto.nullable) = false ]; -} diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 21d840f01f..f698daca03 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -39,7 +39,6 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand(CmdConsumerValidators()) cmd.AddCommand(CmdConsumerChainsValidatorHasToValidate()) cmd.AddCommand(CmdValidatorConsumerCommissionRate()) - cmd.AddCommand(CmdOldestUnconfirmedVsc()) return cmd } @@ -569,30 +568,3 @@ $ %s validator-consumer-commission-rate foochain %s1gghjut3ccd8ay0zduzj64hwre2fx return cmd } - -func CmdOldestUnconfirmedVsc() *cobra.Command { - cmd := &cobra.Command{ - Use: "oldest_unconfirmed_vsc [chainid]", - Short: "Query the send timestamp of the oldest unconfirmed VSCPacket by chain id", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - req := types.QueryOldestUnconfirmedVscRequest{ChainId: args[0]} - res, err := queryClient.QueryOldestUnconfirmedVsc(cmd.Context(), &req) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.VscSendTimestamp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index ee00556f06..ea2c4d6c5b 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -447,34 +447,3 @@ func (k Keeper) QueryValidatorConsumerCommissionRate(goCtx context.Context, req return res, nil } - -func (k Keeper) QueryOldestUnconfirmedVsc(goCtx context.Context, req *types.QueryOldestUnconfirmedVscRequest) (*types.QueryOldestUnconfirmedVscResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if req == nil { - return nil, status.Errorf(codes.InvalidArgument, "empty request") - } - - if req.ChainId == "" { - return nil, status.Errorf(codes.InvalidArgument, "invalid request: chain id cannot be empty") - } - - if _, consumerRegistered := k.GetConsumerClientId(ctx, req.ChainId); !consumerRegistered { - return nil, status.Error( - codes.NotFound, - errorsmod.Wrap(types.ErrUnknownConsumerChainId, req.ChainId).Error(), - ) - } - - // Note that GetFirstVscSendTimestamp returns the send timestamp of the oldest - // unconfirmed VSCPacket as these timestamps are deleted when handling VSCMaturedPackets - ts, found := k.GetFirstVscSendTimestamp(ctx, req.ChainId) - if !found { - return nil, status.Error( - codes.NotFound, - errorsmod.Wrap(types.ErrNoUnconfirmedVSCPacket, req.ChainId).Error(), - ) - } - - return &types.QueryOldestUnconfirmedVscResponse{VscSendTimestamp: ts}, nil -} diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 4f3825238f..5638f2939b 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "fmt" "testing" - "time" "github.com/cometbft/cometbft/proto/tendermint/crypto" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -66,49 +65,6 @@ func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { require.Equal(t, &expectedResult, response.PairValConAddr[0]) } -func TestQueryOldestUnconfirmedVsc(t *testing.T) { - chainID := consumer - - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - pk.SetVscSendTimestamp(ctx, chainID, 2, now) - pk.SetVscSendTimestamp(ctx, chainID, 1, now) - pk.SetConsumerClientId(ctx, chainID, "client-1") - - // Request is nil - _, err := pk.QueryOldestUnconfirmedVsc(ctx, nil) - require.Error(t, err) - - // Request with chainId is empty - _, err = pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{}) - require.Error(t, err) - - // Request with chainId is invalid - _, err = pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: "invalidChainId"}) - require.Error(t, err) - - // Request is valid - response, err := pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: chainID}) - require.NoError(t, err) - expectedResult := types.VscSendTimestamp{ - VscId: 1, - Timestamp: now, - } - require.Equal(t, expectedResult, response.VscSendTimestamp) - - // Make sure that the oldest is queried - pk.DeleteVscSendTimestamp(ctx, chainID, 1) - response, err = pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: chainID}) - require.NoError(t, err) - expectedResult = types.VscSendTimestamp{ - VscId: 2, - Timestamp: now, - } - require.Equal(t, expectedResult, response.VscSendTimestamp) -} - func TestQueryConsumerChainOptedInValidators(t *testing.T) { chainID := "chainID" diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index 4d42311fda..88d401aa19 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -1656,94 +1656,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryValidatorConsumerCommissionRateResponse proto.InternalMessageInfo -type QueryOldestUnconfirmedVscRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (m *QueryOldestUnconfirmedVscRequest) Reset() { *m = QueryOldestUnconfirmedVscRequest{} } -func (m *QueryOldestUnconfirmedVscRequest) String() string { return proto.CompactTextString(m) } -func (*QueryOldestUnconfirmedVscRequest) ProtoMessage() {} -func (*QueryOldestUnconfirmedVscRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{34} -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOldestUnconfirmedVscRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOldestUnconfirmedVscRequest.Merge(m, src) -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOldestUnconfirmedVscRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOldestUnconfirmedVscRequest proto.InternalMessageInfo - -func (m *QueryOldestUnconfirmedVscRequest) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -type QueryOldestUnconfirmedVscResponse struct { - VscSendTimestamp VscSendTimestamp `protobuf:"bytes,1,opt,name=vsc_send_timestamp,json=vscSendTimestamp,proto3" json:"vsc_send_timestamp"` -} - -func (m *QueryOldestUnconfirmedVscResponse) Reset() { *m = QueryOldestUnconfirmedVscResponse{} } -func (m *QueryOldestUnconfirmedVscResponse) String() string { return proto.CompactTextString(m) } -func (*QueryOldestUnconfirmedVscResponse) ProtoMessage() {} -func (*QueryOldestUnconfirmedVscResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{35} -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOldestUnconfirmedVscResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOldestUnconfirmedVscResponse.Merge(m, src) -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOldestUnconfirmedVscResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOldestUnconfirmedVscResponse proto.InternalMessageInfo - -func (m *QueryOldestUnconfirmedVscResponse) GetVscSendTimestamp() VscSendTimestamp { - if m != nil { - return m.VscSendTimestamp - } - return VscSendTimestamp{} -} - func init() { proto.RegisterType((*QueryConsumerGenesisRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisRequest") proto.RegisterType((*QueryConsumerGenesisResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisResponse") @@ -1779,8 +1691,6 @@ func init() { proto.RegisterType((*QueryConsumerChainsValidatorHasToValidateResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsValidatorHasToValidateResponse") proto.RegisterType((*QueryValidatorConsumerCommissionRateRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerCommissionRateRequest") proto.RegisterType((*QueryValidatorConsumerCommissionRateResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerCommissionRateResponse") - proto.RegisterType((*QueryOldestUnconfirmedVscRequest)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscRequest") - proto.RegisterType((*QueryOldestUnconfirmedVscResponse)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscResponse") } func init() { @@ -1788,134 +1698,128 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2023 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcd, 0x6f, 0xdc, 0xc6, - 0x15, 0x17, 0x57, 0x1f, 0x91, 0x46, 0xf1, 0x47, 0xc6, 0x6a, 0x22, 0x53, 0xca, 0xae, 0xc2, 0xb4, - 0xa9, 0x2c, 0xdb, 0xa4, 0x24, 0x37, 0xa8, 0x63, 0x47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, 0xfe, 0xa6, 0x04, 0xbe, 0x9e, 0x87, 0xf2, 0xc1, 0x9d, - 0x11, 0x1a, 0x93, 0x4c, 0x1e, 0x2b, 0xbe, 0x77, 0x84, 0x88, 0xdc, 0x53, 0xf7, 0x98, 0xa7, 0xee, - 0xc2, 0xef, 0x16, 0xf1, 0x54, 0x04, 0xa5, 0xf9, 0x0c, 0x34, 0x11, 0x55, 0x59, 0xfe, 0xfa, 0xaf, - 0xc0, 0x1f, 0xdf, 0xb3, 0x08, 0x26, 0x2c, 0xf0, 0xe6, 0xd1, 0x87, 0xe0, 0x8a, 0xd7, 0x46, 0x85, - 0x29, 0x7e, 0x61, 0x62, 0x86, 0xa3, 0x35, 0x63, 0x20, 0xad, 0x45, 0x8c, 0x64, 0x8a, 0xfd, 0xab, - 0x93, 0x00, 0x24, 0x6a, 0xcd, 0xf6, 0x28, 0x6f, 0x3d, 0xa1, 0xd5, 0xb5, 0xd1, 0x40, 0x46, 0x60, - 0x3c, 0x99, 0x35, 0xa5, 0xfa, 0x9d, 0xcf, 0x9f, 0x94, 0x85, 0x2f, 0x9e, 0x94, 0x85, 0xbf, 0x3d, - 0x29, 0x0b, 0x9f, 0x3c, 0x2d, 0x8f, 0x7d, 0xf1, 0xb4, 0x3c, 0xf6, 0xe7, 0xa7, 0xe5, 0xb1, 0xbb, - 0x1b, 0xdd, 0x0f, 0x1c, 0xf1, 0x66, 0xe7, 0xa3, 0xcd, 0x5a, 0xdf, 0x52, 0x3e, 0xe8, 0xe8, 0xcd, - 0xda, 0x2e, 0x22, 0xf7, 0xa7, 0xd8, 0x3f, 0x41, 0x2e, 0xfc, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xb7, - 0x19, 0x6f, 0x26, 0xab, 0x20, 0x00, 0x00, + // 1924 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4d, 0x6c, 0x1b, 0xc7, + 0x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x55, 0x76, 0x2d, 0x4d, 0xb0, 0x60, 0xd3, 0x15, 0xf6, + 0x32, 0x9f, 0xcf, 0x78, 0x17, 0xde, 0x11, 0x96, 0xb7, 0x0c, 0x40, 0xb8, 0xc5, 0x0a, 0x39, 0x91, + 0x01, 0x77, 0x6d, 0x17, 0xe9, 0x4d, 0x2b, 0x6c, 0x8f, 0x59, 0x46, 0xc7, 0x7d, 0x56, 0xe3, 0xe3, + 0x80, 0xc2, 0x79, 0xed, 0x6c, 0xfc, 0xfd, 0xed, 0xbb, 0x29, 0x14, 0x94, 0xfe, 0x6a, 0xec, 0x21, + 0x4e, 0x5e, 0x1d, 0x22, 0xc2, 0x55, 0x50, 0x4a, 0xa8, 0xcc, 0x65, 0xef, 0xef, 0x39, 0xb0, 0x3e, + 0xe4, 0x74, 0xf8, 0x5f, 0xea, 0x63, 0xca, 0x65, 0x7e, 0x4c, 0x07, 0xb2, 0xa2, 0x90, 0x33, 0x2b, + 0xe0, 0x0a, 0x98, 0xa7, 0xa3, 0x09, 0xcd, 0xa7, 0x59, 0xd9, 0xff, 0xf0, 0x86, 0xcf, 0xf2, 0x50, + 0xc7, 0x59, 0x7c, 0x11, 0x00, 0x51, 0xe8, 0x58, 0xc9, 0xde, 0xc8, 0x94, 0x26, 0xe3, 0x82, 0x22, + 0xc7, 0x80, 0x85, 0x7d, 0xd6, 0x54, 0x92, 0x53, 0x79, 0x28, 0xfb, 0x96, 0x4a, 0x76, 0x31, 0xfb, + 0x0a, 0xde, 0xc3, 0x29, 0x83, 0x2a, 0xa8, 0x60, 0x2b, 0x87, 0x4a, 0x16, 0x8e, 0x0b, 0x00, 0x86, + 0x37, 0x11, 0x64, 0x44, 0x90, 0x63, 0x61, 0x07, 0xf0, 0xbb, 0x9f, 0x4e, 0x27, 0x95, 0xf3, 0xe9, + 0xb3, 0x4f, 0x1d, 0x77, 0x3a, 0x06, 0x21, 0x06, 0xb6, 0xe4, 0x98, 0x47, 0x5f, 0xda, 0x38, 0x26, +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, 0x7f, 0x09, 0xbc, 0x3d, 0xb1, 0xd1, 0x83, 0x3c, 0x9b, 0xbf, 0x73, + 0x3c, 0x60, 0x2c, 0x00, 0xb7, 0x68, 0x00, 0x76, 0xe0, 0xf6, 0x04, 0x01, 0xc0, 0x76, 0xcc, 0xff, + 0xff, 0x04, 0x3c, 0x24, 0x95, 0xd1, 0xc1, 0x9b, 0xd9, 0xad, 0x1e, 0xc5, 0x4d, 0xf9, 0x5b, 0x53, + 0xe3, 0x30, 0xc7, 0x77, 0xa8, 0xe3, 0x57, 0xe1, 0xeb, 0x19, 0x7e, 0x40, 0x0c, 0x89, 0x79, 0x62, + 0x56, 0x4b, 0x71, 0x39, 0x3e, 0x45, 0x4c, 0xe4, 0x72, 0x0a, 0x67, 0x9d, 0xc8, 0xe5, 0x34, 0xca, + 0x39, 0x99, 0xcb, 0x89, 0xf7, 0x05, 0xfe, 0x91, 0x63, 0x93, 0x64, 0x82, 0x6d, 0xc2, 0x37, 0xb3, + 0x9b, 0x98, 0x46, 0x62, 0xf9, 0xed, 0x89, 0xcf, 0x33, 0xd7, 0x2e, 0x53, 0xd7, 0xaa, 0x70, 0x73, + 0xbc, 0x6b, 0x2e, 0x03, 0xf0, 0x7f, 0x63, 0x84, 0xbf, 0x28, 0x80, 0x57, 0x33, 0xd0, 0x47, 0x78, + 0x37, 0xbb, 0x89, 0x99, 0x68, 0x2b, 0xdf, 0x3a, 0x3e, 0x40, 0x16, 0x84, 0xdb, 0x34, 0x08, 0x37, + 0x60, 0x7d, 0x7c, 0x10, 0x9c, 0x10, 0x31, 0xca, 0x69, 0x87, 0x62, 0x2a, 0x3e, 0x1d, 0x86, 0xff, + 0x1a, 0xa0, 0xbb, 0x49, 0x16, 0x47, 0x60, 0x8e, 0x57, 0x75, 0x08, 0xa7, 0xe6, 0x6b, 0xd3, 0x40, + 0x30, 0xaf, 0x6b, 0xd4, 0xeb, 0x37, 0xe0, 0x95, 0xf1, 0x5e, 0x07, 0x6c, 0x5a, 0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xd3, 0xfc, 0x42, 0x10, 0x44, 0xa5, 0x31, 0x1d, 0xc8, 0x14, 0x73, 0x7f, 0x6a, + 0x65, 0xd5, 0xbe, 0xfd, 0xe9, 0x51, 0x89, 0xfb, 0xec, 0xa8, 0xc4, 0xfd, 0xfd, 0xa8, 0xc4, 0x7d, + 0xfc, 0xac, 0x34, 0xf3, 0xd9, 0xb3, 0xd2, 0xcc, 0x5f, 0x9e, 0x95, 0x66, 0x1e, 0x5c, 0x1b, 0xa4, + 0xc5, 0x91, 0xb2, 0x8b, 0xa1, 0xb2, 0xee, 0x37, 0xa4, 0xf7, 0xfb, 0x26, 0x14, 0x8f, 0x31, 0x3f, + 0x5a, 0xa0, 0x3f, 0x9d, 0x5f, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x59, 0x19, 0xb3, + 0xe1, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1969,8 +1873,6 @@ type QueryClient interface { // QueryValidatorConsumerCommissionRate returns the commission rate a given // validator charges on a given consumer chain QueryValidatorConsumerCommissionRate(ctx context.Context, in *QueryValidatorConsumerCommissionRateRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerCommissionRateResponse, error) - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. @@ -2111,15 +2013,6 @@ func (c *queryClient) QueryValidatorConsumerCommissionRate(ctx context.Context, return out, nil } -func (c *queryClient) QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) { - out := new(QueryOldestUnconfirmedVscResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) QueryConsumerValidators(ctx context.Context, in *QueryConsumerValidatorsRequest, opts ...grpc.CallOption) (*QueryConsumerValidatorsResponse, error) { out := new(QueryConsumerValidatorsResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerValidators", in, out, opts...) @@ -2170,8 +2063,6 @@ type QueryServer interface { // QueryValidatorConsumerCommissionRate returns the commission rate a given // validator charges on a given consumer chain QueryValidatorConsumerCommissionRate(context.Context, *QueryValidatorConsumerCommissionRateRequest) (*QueryValidatorConsumerCommissionRateResponse, error) - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - QueryOldestUnconfirmedVsc(context.Context, *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. @@ -2224,9 +2115,6 @@ func (*UnimplementedQueryServer) QueryConsumerChainsValidatorHasToValidate(ctx c func (*UnimplementedQueryServer) QueryValidatorConsumerCommissionRate(ctx context.Context, req *QueryValidatorConsumerCommissionRateRequest) (*QueryValidatorConsumerCommissionRateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorConsumerCommissionRate not implemented") } -func (*UnimplementedQueryServer) QueryOldestUnconfirmedVsc(ctx context.Context, req *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryOldestUnconfirmedVsc not implemented") -} func (*UnimplementedQueryServer) QueryConsumerValidators(ctx context.Context, req *QueryConsumerValidatorsRequest) (*QueryConsumerValidatorsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerValidators not implemented") } @@ -2487,24 +2375,6 @@ func _Query_QueryValidatorConsumerCommissionRate_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } -func _Query_QueryOldestUnconfirmedVsc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOldestUnconfirmedVscRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, req.(*QueryOldestUnconfirmedVscRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_QueryConsumerValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryConsumerValidatorsRequest) if err := dec(in); err != nil { @@ -2583,10 +2453,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryValidatorConsumerCommissionRate", Handler: _Query_QueryValidatorConsumerCommissionRate_Handler, }, - { - MethodName: "QueryOldestUnconfirmedVsc", - Handler: _Query_QueryOldestUnconfirmedVsc_Handler, - }, { MethodName: "QueryConsumerValidators", Handler: _Query_QueryConsumerValidators_Handler, @@ -3738,69 +3604,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) MarshalToSizedBuffer(dAtA return len(dAtA) - i, nil } -func (m *QueryOldestUnconfirmedVscRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryOldestUnconfirmedVscRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOldestUnconfirmedVscRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryOldestUnconfirmedVscResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryOldestUnconfirmedVscResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOldestUnconfirmedVscResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.VscSendTimestamp.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -4296,30 +4099,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) Size() (n int) { return n } -func (m *QueryOldestUnconfirmedVscRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryOldestUnconfirmedVscResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.VscSendTimestamp.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -7359,171 +7138,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) Unmarshal(dAtA []byte) er } return nil } -func (m *QueryOldestUnconfirmedVscRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryOldestUnconfirmedVscRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOldestUnconfirmedVscRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryOldestUnconfirmedVscResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryOldestUnconfirmedVscResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOldestUnconfirmedVscResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VscSendTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.VscSendTimestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.gw.go b/x/ccv/provider/types/query.pb.gw.go index 16bb010d71..413b35e723 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -505,60 +505,6 @@ func local_request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Cont } -func request_Query_QueryOldestUnconfirmedVsc_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOldestUnconfirmedVscRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := client.QueryOldestUnconfirmedVsc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_QueryOldestUnconfirmedVsc_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOldestUnconfirmedVscRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := server.QueryOldestUnconfirmedVsc(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_QueryConsumerValidators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryConsumerValidatorsRequest var metadata runtime.ServerMetadata @@ -941,29 +887,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueryOldestUnconfirmedVsc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_QueryOldestUnconfirmedVsc_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_QueryOldestUnconfirmedVsc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_QueryConsumerValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1308,26 +1231,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueryOldestUnconfirmedVsc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_QueryOldestUnconfirmedVsc_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_QueryOldestUnconfirmedVsc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_QueryConsumerValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1380,8 +1283,6 @@ var ( pattern_Query_QueryValidatorConsumerCommissionRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"interchain_security", "ccv", "provider", "consumer_commission_rate", "chain_id", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryOldestUnconfirmedVsc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "oldest_unconfirmed_vsc", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryConsumerValidators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_validators", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) ) @@ -1414,7 +1315,5 @@ var ( forward_Query_QueryValidatorConsumerCommissionRate_0 = runtime.ForwardResponseMessage - forward_Query_QueryOldestUnconfirmedVsc_0 = runtime.ForwardResponseMessage - forward_Query_QueryConsumerValidators_0 = runtime.ForwardResponseMessage ) From 1723a07a36660b354fc8b85dbd39aa5200b8b35f Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 10:19:38 +0200 Subject: [PATCH 05/81] make AfterUnbondingInitiated a noop --- x/ccv/provider/keeper/hooks.go | 113 --------------------------------- 1 file changed, 113 deletions(-) diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index 5aef4a16ef..f6129c3e7a 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -8,7 +8,6 @@ import ( v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" providertypes "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v4/x/ccv/types" ) @@ -32,119 +31,7 @@ func (k *Keeper) Hooks() Hooks { // staking hooks // -// This stores a record of each unbonding op from staking, allowing us to track which consumer chains have unbonded func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error { - var consumerChainIDS []string - - // get validator address from unbonding operation - unbondingType, found := h.k.stakingKeeper.GetUnbondingType(ctx, id) - vadAddrBech32 := "" - if !found { - ctx.Logger().Error("undefined type for unbonding operation id: %d", id) - return nil - } - - switch unbondingType { - case stakingtypes.UnbondingType_UnbondingDelegation: - ubd, found := h.k.stakingKeeper.GetUnbondingDelegationByUnbondingID(ctx, id) - if !found { - ctx.Logger().Error("unfound ubonding delegation for unbonding id: %d", id) - return nil - } - vadAddrBech32 = ubd.ValidatorAddress - case stakingtypes.UnbondingType_Redelegation: - red, found := h.k.stakingKeeper.GetRedelegationByUnbondingID(ctx, id) - if !found { - ctx.Logger().Error("unfound relegation for unbonding operation id: %d", id) - return nil - } - vadAddrBech32 = red.ValidatorSrcAddress - case stakingtypes.UnbondingType_ValidatorUnbonding: - val, found := h.k.stakingKeeper.GetValidatorByUnbondingID(ctx, id) - if !found { - ctx.Logger().Error("unfound validator for unbonding operation id: %d", id) - return nil - } - vadAddrBech32 = val.OperatorAddress - default: - ctx.Logger().Error("invalid unbonding operation type: %s", unbondingType) - return nil - } - - valAddr, err := sdk.ValAddressFromBech32(vadAddrBech32) - if err != nil { - ctx.Logger().Error(err.Error()) - return nil - } - - validator, found := h.k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - ctx.Logger().Error("unfound validator for validator address %s", vadAddrBech32) - return nil - } - - consAddr, err := validator.GetConsAddr() - if err != nil { - ctx.Logger().Error(err.Error()) - return nil - } - - // get all consumers where the validator is in the validator set - for _, chainID := range h.k.GetAllRegisteredConsumerChainIDs(ctx) { - if h.k.IsConsumerValidator(ctx, chainID, types.NewProviderConsAddress(consAddr)) { - consumerChainIDS = append(consumerChainIDS, chainID) - } - } - - if len(consumerChainIDS) == 0 { - // Do not put the unbonding op on hold if there are no consumer chains - return nil - } - // Call back into staking to tell it to stop this op from unbonding when the unbonding period is complete - if err := h.k.stakingKeeper.PutUnbondingOnHold(ctx, id); err != nil { - // Note: that in the case of a validator unbonding, AfterUnbondingInitiated is called - // from staking.EndBlock. - - // In this case PutUnbondingOnHold fails if either the unbonding operation was - // not found or the UnbondingOnHoldRefCount is negative. - - // This change should be updated for SDK v0.48 because it will include changes in handling - // check: https://github.com/cosmos/cosmos-sdk/pull/16043 - ctx.Logger().Error("unbonding could not be put on hold: %w", err) - return nil - } - - valsetUpdateID := h.k.GetValidatorSetUpdateId(ctx) - unbondingOp := providertypes.UnbondingOp{ - Id: id, - UnbondingConsumerChains: consumerChainIDS, - } - - // Add to indexes - for _, consumerChainID := range consumerChainIDS { - index, _ := h.k.GetUnbondingOpIndex(ctx, consumerChainID, valsetUpdateID) - index = append(index, id) - h.k.SetUnbondingOpIndex(ctx, consumerChainID, valsetUpdateID, index) - } - - h.k.SetUnbondingOp(ctx, unbondingOp) - - // NOTE: This is a temporary fix for v0.47 -> we should not panic in this edge case - // since the AfterUnbondInitiatedHook can be called with a non-existing UnbondingEntry.id - // check: https://github.com/cosmos/cosmos-sdk/pull/16043 - // - // Call back into staking to tell it to stop this op from unbonding when the unbonding period is complete - // if err := h.k.stakingKeeper.PutUnbondingOnHold(ctx, id); err != nil { - // // If there was an error putting the unbonding on hold, panic to end execution for - // // the current tx and prevent committal of this invalid state. - // // - // // Note: that in the case of a validator unbonding, AfterUnbondingInitiated is called - // // from staking.EndBlock, thus the following panic would halt the chain. - // // In this case PutUnbondingOnHold fails if either the unbonding operation was - // // not found or the UnbondingOnHoldRefCount is negative. In either cases, - // // the state of the x/staking module of cosmos-sdk is invalid. - // panic(fmt.Errorf("unbonding could not be put on hold: %w", err)) - // } return nil } From 294476cbb8761f4060dcc6b8084aaf24b79af0da Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 10:49:02 +0200 Subject: [PATCH 06/81] add migration --- x/ccv/provider/migrations/vX/migrations.go | 45 ++++++++++++++++++++++ x/ccv/provider/types/keys.go | 3 -- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 x/ccv/provider/migrations/vX/migrations.go diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go new file mode 100644 index 0000000000..49bda6b912 --- /dev/null +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -0,0 +1,45 @@ +package vX + +import ( + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + providerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v4/x/ccv/types" +) + +// CompleteUnbondingOps completes all unbonding operations +func CompleteUnbondingOps(ctx sdk.Context, pk providerkeeper.Keeper, sk ccv.StakingKeeper) { + for _, op := range pk.GetAllUnbondingOps(ctx) { + if err := sk.UnbondingCanComplete(ctx, op.Id); err != nil { + pk.Logger(ctx).Error("UnbondingCanComplete failed", "unbondingID", op.Id, "error", err.Error()) + } + } +} + +// CleanupState removes deprecated state +func CleanupState(ctx sdk.Context, store storetypes.KVStore) error { + removePrefix(ctx, store, providertypes.MaturedUnbondingOpsByteKey) + removePrefix(ctx, store, providertypes.UnbondingOpBytePrefix) + removePrefix(ctx, store, providertypes.UnbondingOpIndexBytePrefix) + removePrefix(ctx, store, providertypes.VscSendTimestampBytePrefix) + removePrefix(ctx, store, providertypes.VSCMaturedHandledThisBlockBytePrefix) + + return nil +} + +func removePrefix(ctx sdk.Context, store storetypes.KVStore, prefix byte) error { + iterator := sdk.KVStorePrefixIterator(store, []byte{prefix}) + defer iterator.Close() + + var keysToDel [][]byte + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + for _, delKey := range keysToDel { + store.Delete(delKey) + } + + return nil +} diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index e916f856df..4b30c35fb8 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -82,14 +82,12 @@ const ( // need to unbond before a given unbonding operation can unbond on this chain. // NOTE: This prefix is deprecated, but left in place to avoid state migrations // [DEPRECATED] - // TODO (mpoke): cleanup state in migration UnbondingOpBytePrefix // UnbondingOpIndexBytePrefix is byte prefix of the index for looking up which unbonding // operations are waiting for a given consumer chain to unbond // NOTE: This prefix is deprecated, but left in place to avoid state migrations // [DEPRECATED] - // TODO (mpoke): cleanup state in migration UnbondingOpIndexBytePrefix // ValsetUpdateBlockHeightBytePrefix is the byte prefix that will store the mapping from vscIDs to block heights @@ -112,7 +110,6 @@ const ( // the list of VSC sending timestamps for a given consumer chainID. // NOTE: This prefix is deprecated, but left in place to avoid state migrations // [DEPRECATED] - // TODO (mpoke): cleanup state in migration VscSendTimestampBytePrefix // ThrottledPacketDataSizeBytePrefix is the byte prefix for storing the size of chain-specific throttled packet data queues From b8632e0f6feb2159fbf2e233b36734ebebc2a87b Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 10:50:43 +0200 Subject: [PATCH 07/81] remove completeMaturedUnbondingOps --- x/ccv/provider/keeper/relay.go | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 852b70928b..15fd1b9244 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -82,30 +82,6 @@ func (k Keeper) HandleVSCMaturedPacket(ctx sdk.Context, chainID string, data ccv ) } -// CompleteMaturedUnbondingOps attempts to complete all matured unbonding operations -func (k Keeper) completeMaturedUnbondingOps(ctx sdk.Context) { - for _, id := range k.ConsumeMaturedUnbondingOps(ctx) { - // Attempt to complete unbonding in staking module - err := k.stakingKeeper.UnbondingCanComplete(ctx, id) - if err != nil { - if stakingtypes.ErrUnbondingNotFound.Is(err) { - // The unbonding was not found. - unbondingType, found := k.stakingKeeper.GetUnbondingType(ctx, id) - if found && unbondingType == stakingtypes.UnbondingType_UnbondingDelegation { - // If this is an unbonding delegation, it may have been removed - // after through a CancelUnbondingDelegation message - k.Logger(ctx).Debug("unbonding delegation was already removed:", "unbondingID", id) - continue - } - } - // UnbondingCanComplete failing means that the state of the x/staking module - // of cosmos-sdk is invalid. An exception is the case handled above - panic(fmt.Sprintf("could not complete unbonding op: %s", err.Error())) - } - k.Logger(ctx).Debug("unbonding operation matured on all consumers", "opID", id) - } -} - // OnAcknowledgementPacket handles acknowledgments for sent VSC packets func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error { if err := ack.GetError(); err != "" { @@ -145,9 +121,6 @@ func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) err // EndBlockVSU contains the EndBlock logic needed for // the Validator Set Update sub-protocol func (k Keeper) EndBlockVSU(ctx sdk.Context) { - // notify the staking module to complete all matured unbonding ops - k.completeMaturedUnbondingOps(ctx) - if ctx.BlockHeight()%k.GetBlocksPerEpoch(ctx) == 0 { // only queue and send VSCPackets at the boundaries of an epoch From cb27a8e8a0daee620c40e0cd572d83678ce66cb7 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 10:52:28 +0200 Subject: [PATCH 08/81] send VSCPacket only on valupdates --- x/ccv/provider/keeper/relay.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 15fd1b9244..584516aa4b 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -213,11 +213,8 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { valUpdates := DiffValidators(currentValidators, nextValidators) k.SetConsumerValSet(ctx, chainID, nextValidators) - // check whether there are changes in the validator set; - // note that this also entails unbonding operations - // w/o changes in the voting power of the validators in the validator set - unbondingOps := k.GetUnbondingOpsFromIndex(ctx, chainID, valUpdateID) - if len(valUpdates) != 0 || len(unbondingOps) != 0 { + // check whether there are changes in the validator set + if len(valUpdates) != 0 { // construct validator set change packet data packet := ccv.NewValidatorSetChangePacketData(valUpdates, valUpdateID, k.ConsumeSlashAcks(ctx, chainID)) k.AppendPendingVSCPackets(ctx, chainID, packet) @@ -225,7 +222,6 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { "chainID", chainID, "vscID", valUpdateID, "len updates", len(valUpdates), - "len unbonding ops", len(unbondingOps), ) } } From 2707a048d34eebd9af40fe5cac7bf17787b17cae Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:08:44 +0200 Subject: [PATCH 09/81] remove VSC timeout logic --- x/ccv/provider/keeper/genesis.go | 12 +- x/ccv/provider/keeper/genesis_test.go | 35 +----- x/ccv/provider/keeper/proposal.go | 3 - x/ccv/provider/keeper/relay.go | 35 ------ x/ccv/provider/migrations/migrator.go | 6 +- .../provider/migrations/v3/migration_test.go | 117 ------------------ x/ccv/provider/migrations/v3/migrations.go | 25 ---- 7 files changed, 6 insertions(+), 227 deletions(-) delete mode 100644 x/ccv/provider/migrations/v3/migration_test.go delete mode 100644 x/ccv/provider/migrations/v3/migrations.go diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index cc8bdc41cd..e9dec001f9 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -95,12 +95,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { k.SetInitTimeoutTimestamp(ctx, item.ChainId, item.Timestamp) } - for _, item := range genState.ExportedVscSendTimestamps { - for _, vscSendTimestamp := range item.VscSendTimestamps { - k.SetVscSendTimestamp(ctx, item.ChainId, vscSendTimestamp.VscId, vscSendTimestamp.Timestamp) - } - } - k.SetParams(ctx, genState.Params) k.InitializeSlashMeter(ctx) } @@ -110,7 +104,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // get a list of all registered consumer chains registeredChainIDs := k.GetAllRegisteredConsumerChainIDs(ctx) - var exportedVscSendTimestamps []types.ExportedVscSendTimestamp // export states for each consumer chains var consumerStates []types.ConsumerState for _, chainID := range registeredChainIDs { @@ -144,9 +137,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { cs.PendingValsetChanges = k.GetPendingVSCPackets(ctx, chainID) consumerStates = append(consumerStates, cs) - - vscSendTimestamps := k.GetAllVscSendTimestamps(ctx, chainID) - exportedVscSendTimestamps = append(exportedVscSendTimestamps, types.ExportedVscSendTimestamp{ChainId: chainID, VscSendTimestamps: vscSendTimestamps}) } // ConsumerAddrsToPrune are added only for registered consumer chains @@ -170,6 +160,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { k.GetAllValidatorsByConsumerAddr(ctx, nil), consumerAddrsToPrune, k.GetAllInitTimeoutTimestamps(ctx), - exportedVscSendTimestamps, + nil, ) } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 81b0a90bd8..5fa1e301e7 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -41,27 +41,6 @@ func TestInitAndExportGenesis(t *testing.T) { {ChainId: cChainIDs[1], Timestamp: uint64(time.Now().UTC().UnixNano()) + 15}, } - now := time.Now().UTC() - exportedVscSendTimeStampsC0 := providertypes.ExportedVscSendTimestamp{ - ChainId: "c0", - VscSendTimestamps: []providertypes.VscSendTimestamp{ - {VscId: 1, Timestamp: now.Add(time.Hour)}, - {VscId: 2, Timestamp: now.Add(2 * time.Hour)}, - }, - } - - exportedVscSendTimeStampsC1 := providertypes.ExportedVscSendTimestamp{ - ChainId: "c1", - VscSendTimestamps: []providertypes.VscSendTimestamp{ - {VscId: 1, Timestamp: now.Add(-time.Hour)}, - {VscId: 2, Timestamp: now.Add(time.Hour)}, - }, - } - - var exportedVscSendTimeStampsAll []providertypes.ExportedVscSendTimestamp - exportedVscSendTimeStampsAll = append(exportedVscSendTimeStampsAll, exportedVscSendTimeStampsC0) - exportedVscSendTimeStampsAll = append(exportedVscSendTimeStampsAll, exportedVscSendTimeStampsC1) - // create genesis struct provGenesis := providertypes.NewGenesisState(vscID, []providertypes.ValsetUpdateIdToHeight{{ValsetUpdateId: vscID, Height: initHeight}}, @@ -125,7 +104,7 @@ func TestInitAndExportGenesis(t *testing.T) { }, }, initTimeoutTimeStamps, - exportedVscSendTimeStampsAll, + nil, ) // Instantiate in-mem provider keeper with mocks @@ -198,18 +177,6 @@ func TestInitAndExportGenesis(t *testing.T) { return initTimeoutTimestampInStore[i].Timestamp < initTimeoutTimestampInStore[j].Timestamp }) require.Equal(t, initTimeoutTimestampInStore, initTimeoutTimeStamps) - - vscSendTimestampsC0InStore := pk.GetAllVscSendTimestamps(ctx, cChainIDs[0]) - sort.Slice(vscSendTimestampsC0InStore, func(i, j int) bool { - return vscSendTimestampsC0InStore[i].VscId < vscSendTimestampsC0InStore[j].VscId - }) - require.Equal(t, vscSendTimestampsC0InStore, exportedVscSendTimeStampsC0.VscSendTimestamps) - - vscSendTimestampsC1InStore := pk.GetAllVscSendTimestamps(ctx, cChainIDs[1]) - sort.Slice(vscSendTimestampsC1InStore, func(i, j int) bool { - return vscSendTimestampsC1InStore[i].VscId < vscSendTimestampsC1InStore[j].VscId - }) - require.Equal(t, vscSendTimestampsC1InStore, exportedVscSendTimeStampsC1.VscSendTimestamps) } func assertConsumerChainStates(t *testing.T, ctx sdk.Context, pk keeper.Keeper, consumerStates ...providertypes.ConsumerState) { diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 34bb5b6971..7a600e6a8f 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -216,9 +216,6 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo } k.DeleteChainToChannel(ctx, chainID) k.DeleteChannelToChain(ctx, channelID) - - // delete VSC send timestamps - k.DeleteVscSendTimestampsForConsumer(ctx, chainID) } // delete consumer commission rate diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 584516aa4b..cefd3cb1d3 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -70,9 +70,6 @@ func (k Keeper) HandleVSCMaturedPacket(ctx sdk.Context, chainID string, data ccv // clean up index k.DeleteUnbondingOpIndex(ctx, chainID, data.ValsetUpdateId) - // remove the VSC timeout timestamp for this chainID and vscID - k.DeleteVscSendTimestamp(ctx, chainID, data.ValsetUpdateId) - // prune previous consumer validator address that are no longer needed k.PruneKeyAssignments(ctx, chainID, data.ValsetUpdateId) @@ -178,10 +175,6 @@ func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string } return } - // set the VSC send timestamp for this packet; - // note that the VSC send timestamp are set when the packets - // are actually sent over IBC - k.SetVscSendTimestamp(ctx, chainID, data.ValsetUpdateId, ctx.BlockTime()) } k.DeletePendingVSCPackets(ctx, chainID) } @@ -466,34 +459,6 @@ func (k Keeper) EndBlockCCR(ctx sdk.Context) { } } } - - for _, channelToChain := range k.GetAllChannelToChains(ctx) { - // Check if the first vscSendTimestamp in iterator + VscTimeoutPeriod - // exceed the current block time. - // Checking the first send timestamp for each chain is sufficient since - // timestamps are ordered by vsc ID. - // Note: GetFirstVscSendTimestamp panics if the internal state is invalid - vscSendTimestamp, found := k.GetFirstVscSendTimestamp(ctx, channelToChain.ChainId) - if found { - timeoutTimestamp := vscSendTimestamp.Timestamp.Add(k.GetParams(ctx).VscTimeoutPeriod) - if currentTime.After(timeoutTimestamp) { - // vscTimeout expired - // stop the consumer chain and release unbondings - k.Logger(ctx).Info("about to remove timed out consumer chain - VSCPacket timed out", - "chainID", channelToChain.ChainId, - "vscID", vscSendTimestamp.VscId, - ) - err := k.StopConsumerChain(ctx, channelToChain.ChainId, true) - if err != nil { - if providertypes.ErrConsumerChainNotFound.Is(err) { - // consumer chain not found - continue - } - panic(fmt.Errorf("consumer chain failed to stop: %w", err)) - } - } - } - } } // getMappedInfractionHeight gets the infraction height mapped from val set ID for the given chain ID diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index c8b464a7a3..ff22fc363f 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -5,7 +5,6 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" providerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" - v3 "github.com/cosmos/interchain-security/v4/x/ccv/provider/migrations/v3" v4 "github.com/cosmos/interchain-security/v4/x/ccv/provider/migrations/v4" v5 "github.com/cosmos/interchain-security/v4/x/ccv/provider/migrations/v5" ) @@ -30,8 +29,11 @@ func (m Migrator) Migrate1to2(ctx sdktypes.Context) error { } // Migrate2to3 migrates x/ccvprovider state from consensus version 2 to 3. +// First run provider@v3.x.y in production to migrate from consensus version 2 to 3. +// TODO (mpoke) This should probably return an error. +// TODO (mpoke) Check versions. func (m Migrator) Migrate2to3(ctx sdktypes.Context) error { - return v3.MigrateQueuedPackets(ctx, m.providerKeeper) + return nil } // Migrate3to4 migrates x/ccvprovider state from consensus version 3 to 4. diff --git a/x/ccv/provider/migrations/v3/migration_test.go b/x/ccv/provider/migrations/v3/migration_test.go deleted file mode 100644 index 630b8fd7dd..0000000000 --- a/x/ccv/provider/migrations/v3/migration_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package v3 - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v4/testutil/keeper" -) - -func TestMigrate2To3(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, testutil.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - // Set consumer client ids to mock consumers being connected to provider - providerKeeper.SetConsumerClientId(ctx, "chain-1", "client-1") - providerKeeper.SetConsumerClientId(ctx, "chain-2", "client-2") - providerKeeper.SetConsumerClientId(ctx, "chain-3", "client-3") - - // Queue some data for chain-1 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 66, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 67, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 68, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 69, testutil.GetNewVSCMaturedPacketData()) - - // Queue some data for chain-2 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 789, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 790, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 791, testutil.GetNewVSCMaturedPacketData()) - - // Queue some data for chain-3 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 123, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 124, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 125, testutil.GetNewVSCMaturedPacketData()) - - // Confirm getter methods return expected values - slash1, vscm1 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") - require.Len(t, slash1, 2) - require.Len(t, vscm1, 2) - - slash2, vscm2 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") - require.Len(t, slash2, 1) - require.Len(t, vscm2, 2) - - slash3, vscm3 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") - require.Len(t, slash3, 1) - require.Len(t, vscm3, 2) - - // Set vsc send timestamp for every queued vsc matured packet, - // as a way to assert that the vsc matured packets are handled in the migration. - // - // That is, timestamp should exist before a vsc matured packet is handled, - // and deleted after handling. - for _, data := range vscm1 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId, time.Now()) - } - for _, data := range vscm2 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId, time.Now()) - } - for _, data := range vscm3 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId, time.Now()) - } - - // Confirm timestamps are set - for _, data := range vscm1 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId) - require.True(t, found) - } - for _, data := range vscm2 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId) - require.True(t, found) - } - for _, data := range vscm3 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId) - require.True(t, found) - } - - // Run migration - err := MigrateQueuedPackets(ctx, providerKeeper) - require.NoError(t, err) - - // Confirm throttled data is now deleted - slash1, vscm1 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") - require.Empty(t, slash1) - require.Empty(t, vscm1) - slash2, vscm2 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") - require.Empty(t, slash2) - require.Empty(t, vscm2) - slash3, vscm3 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") - require.Empty(t, slash3) - require.Empty(t, vscm3) - - // Confirm timestamps are deleted, meaning vsc matured packets were handled - for _, data := range vscm1 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId) - require.False(t, found) - } - for _, data := range vscm2 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId) - require.False(t, found) - } - for _, data := range vscm3 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId) - require.False(t, found) - } -} diff --git a/x/ccv/provider/migrations/v3/migrations.go b/x/ccv/provider/migrations/v3/migrations.go deleted file mode 100644 index 0a3ae68f12..0000000000 --- a/x/ccv/provider/migrations/v3/migrations.go +++ /dev/null @@ -1,25 +0,0 @@ -package v3 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - providerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" -) - -// MigrateQueuedPackets processes all queued packet data for all consumer chains that were stored -// on the provider in the v2 consensus version (jail throttling v1). -func MigrateQueuedPackets(ctx sdk.Context, k providerkeeper.Keeper) error { - for _, consumerChainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { - slashData, vscmData := k.LegacyGetAllThrottledPacketData(ctx, consumerChainID) - if len(slashData) > 0 { - k.Logger(ctx).Error(fmt.Sprintf("slash data being dropped: %v", slashData)) - } - for _, data := range vscmData { - k.HandleVSCMaturedPacket(ctx, consumerChainID, data) - } - k.LegacyDeleteThrottledPacketDataForConsumer(ctx, consumerChainID) - } - return nil -} From b33496d8d860418b5ddd83c909caa51bcf3393cf Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:18:40 +0200 Subject: [PATCH 10/81] remove unbonding ops logic --- x/ccv/provider/keeper/genesis.go | 18 +-- x/ccv/provider/keeper/genesis_test.go | 23 +--- x/ccv/provider/keeper/proposal.go | 20 --- x/ccv/provider/keeper/relay.go | 19 +-- x/ccv/provider/keeper/relay_test.go | 180 -------------------------- 5 files changed, 8 insertions(+), 252 deletions(-) diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index e9dec001f9..517b09b1d4 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -39,15 +39,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { p := prop k.SetPendingConsumerRemovalProp(ctx, &p) } - for _, ubdOp := range genState.UnbondingOps { - k.SetUnbondingOp(ctx, ubdOp) - } - - // Note that MatureUnbondingOps aren't stored across blocks, but it - // might be used after implementing standalone to consumer transition - if genState.MatureUnbondingOps != nil { - k.AppendMaturedUnbondingOps(ctx, genState.MatureUnbondingOps.Ids) - } // Set initial state for each consumer chain for _, cs := range genState.ConsumerStates { @@ -58,9 +49,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { // the ConsumerGenesis validated in ConsumerState.Validate(). panic(fmt.Errorf("consumer chain genesis could not be persisted: %w", err)) } - for _, ubdOpIndex := range cs.UnbondingOpsIndex { - k.SetUnbondingOpIndex(ctx, chainID, ubdOpIndex.GetVscId(), ubdOpIndex.GetUnbondingOpIds()) - } // check if the CCV channel was established if cs.ChannelId != "" { k.SetChannelToChain(ctx, cs.ChannelId, chainID) @@ -121,7 +109,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { ChainId: chainID, ClientId: clientID, ConsumerGenesis: gen, - UnbondingOpsIndex: k.GetAllUnbondingOpIndexes(ctx, chainID), + UnbondingOpsIndex: nil, } // try to find channel id for the current consumer chain @@ -151,8 +139,8 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { k.GetValidatorSetUpdateId(ctx), k.GetAllValsetUpdateBlockHeights(ctx), consumerStates, - k.GetAllUnbondingOps(ctx), - &types.MaturedUnbondingOps{Ids: k.GetMaturedUnbondingOps(ctx)}, + nil, + nil, k.GetAllPendingConsumerAdditionProps(ctx), k.GetAllPendingConsumerRemovalProps(ctx), params, diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 5fa1e301e7..137a18a848 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -25,7 +25,6 @@ func TestInitAndExportGenesis(t *testing.T) { expClientID := "client" oneHourFromNow := time.Now().UTC().Add(time.Hour) initHeight, vscID := uint64(5), uint64(1) - ubdIndex := []uint64{0, 1, 2} params := providertypes.DefaultParams() // create validator keys and addresses for key assignment @@ -51,9 +50,7 @@ func TestInitAndExportGenesis(t *testing.T) { "channel", initHeight, *ccv.DefaultConsumerGenesisState(), - []providertypes.VscUnbondingOps{ - {VscId: vscID, UnbondingOpIds: ubdIndex}, - }, + nil, []ccv.ValidatorSetChangePacketData{}, []string{"slashedValidatorConsAddress"}, ), @@ -68,11 +65,8 @@ func TestInitAndExportGenesis(t *testing.T) { nil, ), }, - []providertypes.UnbondingOp{{ - Id: vscID, - UnbondingConsumerChains: []string{cChainIDs[0]}, - }}, - &providertypes.MaturedUnbondingOps{Ids: ubdIndex}, + nil, + nil, []providertypes.ConsumerAdditionProposal{{ ChainId: cChainIDs[0], SpawnTime: oneHourFromNow, @@ -135,11 +129,6 @@ func TestInitAndExportGenesis(t *testing.T) { require.Equal(t, expectedCandidate, pk.GetSlashMeterReplenishTimeCandidate(ctx)) // check local provider chain states - ubdOps, found := pk.GetUnbondingOp(ctx, vscID) - require.True(t, found) - require.Equal(t, provGenesis.UnbondingOps[0], ubdOps) - matureUbdOps := pk.GetMaturedUnbondingOps(ctx) - require.Equal(t, ubdIndex, matureUbdOps) chainID, found := pk.GetChannelToChain(ctx, provGenesis.ConsumerStates[0].ChannelId) require.True(t, found) require.Equal(t, cChainIDs[0], chainID) @@ -207,12 +196,6 @@ func assertConsumerChainStates(t *testing.T, ctx sdk.Context, pk keeper.Keeper, require.Equal(t, expVSC, gotVSC) } - for _, ubdOpIdx := range cs.UnbondingOpsIndex { - ubdIndex, found := pk.GetUnbondingOpIndex(ctx, chainID, ubdOpIdx.VscId) - require.True(t, found) - require.Equal(t, ubdOpIdx.UnbondingOpIds, ubdIndex) - } - require.Equal(t, cs.SlashDowntimeAck, pk.GetSlashAcks(ctx, chainID)) } } diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 7a600e6a8f..58d95dbbe5 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -228,26 +228,6 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo k.DeleteSlashAcks(ctx, chainID) k.DeletePendingVSCPackets(ctx, chainID) - // release unbonding operations - for _, unbondingOpsIndex := range k.GetAllUnbondingOpIndexes(ctx, chainID) { - // iterate over the unbonding operations for the current VSC ID - var maturedIds []uint64 - for _, id := range unbondingOpsIndex.UnbondingOpIds { - // Remove consumer chain ID from unbonding op record. - // Note that RemoveConsumerFromUnbondingOp cannot panic here - // as it is expected that for all UnbondingOpIds in every - // VscUnbondingOps returned by GetAllUnbondingOpIndexes - // there is an unbonding op in store that can be retrieved - // via via GetUnbondingOp. - if k.RemoveConsumerFromUnbondingOp(ctx, id, chainID) { - // Store id of matured unbonding op for later completion of unbonding in staking module - maturedIds = append(maturedIds, id) - } - } - k.AppendMaturedUnbondingOps(ctx, maturedIds) - k.DeleteUnbondingOpIndex(ctx, chainID, unbondingOpsIndex.VscId) - } - k.DeleteTopN(ctx, chainID) k.DeleteValidatorsPowerCap(ctx, chainID) k.DeleteValidatorSetCap(ctx, chainID) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index cefd3cb1d3..41ec8cde7f 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -52,25 +52,10 @@ func (k Keeper) OnRecvVSCMaturedPacket( // // Note: This method should only panic for a system critical error like a // failed marshal/unmarshal, or persistence of critical data. +// TODO (mpoke) remove once dealt with key assignment pruning func (k Keeper) HandleVSCMaturedPacket(ctx sdk.Context, chainID string, data ccv.VSCMaturedPacketData) { - // iterate over the unbonding operations mapped to (chainID, data.ValsetUpdateId) - var maturedIds []uint64 - for _, unbondingOp := range k.GetUnbondingOpsFromIndex(ctx, chainID, data.ValsetUpdateId) { - // Remove consumer chain ID from unbonding op record. - // Note that RemoveConsumerFromUnbondingOp cannot panic here - // as all the unbonding ops returned by GetUnbondingOpsFromIndex - // are retrieved via GetUnbondingOp. - if k.RemoveConsumerFromUnbondingOp(ctx, unbondingOp.Id, chainID) { - // Store id of matured unbonding op for later completion of unbonding in staking module - maturedIds = append(maturedIds, unbondingOp.Id) - } - } - k.AppendMaturedUnbondingOps(ctx, maturedIds) - - // clean up index - k.DeleteUnbondingOpIndex(ctx, chainID, data.ValsetUpdateId) - // prune previous consumer validator address that are no longer needed + // TODO (mpoke) deal with key assignment pruning k.PruneKeyAssignments(ctx, chainID, data.ValsetUpdateId) k.Logger(ctx).Info("VSCMaturedPacket handled", diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 5f74d93424..7a9ec4b40c 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -12,9 +12,7 @@ import ( "cosmossdk.io/math" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -459,184 +457,6 @@ func TestHandleSlashPacket(t *testing.T) { } } -// TestHandleVSCMaturedPacket tests the handling of VSCMatured packets. -// Note that this method also tests the behaviour of AfterUnbondingInitiated. -func TestHandleVSCMaturedPacket(t *testing.T) { - pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - // Init vscID - pk.SetValidatorSetUpdateId(ctx, 1) - - // Start first unbonding without any consumers registered - var unbondingOpId uint64 = 1 - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_Undefined, false), - ) - - err := pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) - require.NoError(t, err) - // Check that no unbonding op was stored - _, found := pk.GetUnbondingOp(ctx, unbondingOpId) - require.False(t, found) - - // Increment vscID - pk.IncrementValidatorSetUpdateId(ctx) - require.Equal(t, uint64(2), pk.GetValidatorSetUpdateId(ctx)) - - // Register first consumer - pk.SetConsumerClientId(ctx, "chain-1", "client-1") - - // Create 2 validators - vals := []stakingtypes.Validator{} - valsPk := []cryptotypes.PubKey{} - for i := 0; i < 2; i++ { - pubkey, err := cryptocodec.FromTmPubKeyInterface(cryptotestutil.NewCryptoIdentityFromIntSeed(54321 + i).TMCryptoPubKey()) - require.NoError(t, err) - valsPk = append(valsPk, pubkey) - pkAny, err := codectypes.NewAnyWithValue(pubkey) - require.NoError(t, err) - vals = append(vals, stakingtypes.Validator{ConsensusPubkey: pkAny}) - } - - // Opt-in one validator to consumer - pk.SetConsumerValidator(ctx, "chain-1", types.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) - - // Start second unbonding - unbondingOpId = 2 - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_UnbondingDelegation, true), - mocks.MockStakingKeeper.EXPECT().GetUnbondingDelegationByUnbondingID(ctx, unbondingOpId).Return( - stakingtypes.UnbondingDelegation{ - ValidatorAddress: sdk.ValAddress([]byte{1}).String(), - }, true), - mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). - Return(vals[0], true), - mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, unbondingOpId).Return(nil), - ) - err = pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) - require.NoError(t, err) - // Check that an unbonding op was stored - expectedChains := []string{"chain-1"} - unbondingOp, found := pk.GetUnbondingOp(ctx, unbondingOpId) - require.True(t, found) - require.Equal(t, unbondingOpId, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - // Check that the unbonding op index was stored - expectedUnbondingOpIds := []uint64{unbondingOpId} - ids, found := pk.GetUnbondingOpIndex(ctx, "chain-1", pk.GetValidatorSetUpdateId(ctx)) - require.True(t, found) - require.Equal(t, expectedUnbondingOpIds, ids) - - // Increment vscID - pk.IncrementValidatorSetUpdateId(ctx) - require.Equal(t, uint64(3), pk.GetValidatorSetUpdateId(ctx)) - - // Registered second consumer - pk.SetConsumerClientId(ctx, "chain-2", "client-2") - - // Opt-in both validators to second consumer - pk.SetConsumerValidator(ctx, "chain-2", types.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) - pk.SetConsumerValidator(ctx, "chain-2", types.ConsumerValidator{ProviderConsAddr: valsPk[1].Address()}) - - // Start third and fourth unbonding - unbondingOpIds := []uint64{3, 4} - for _, id := range unbondingOpIds { - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, id).Return(stakingtypes.UnbondingType_Redelegation, true), - mocks.MockStakingKeeper.EXPECT().GetRedelegationByUnbondingID(ctx, id).Return( - stakingtypes.Redelegation{ - ValidatorSrcAddress: sdk.ValAddress([]byte{1}).String(), - }, true), - mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). - Return(vals[0], true), - mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, id).Return(nil), - ) - err = pk.Hooks().AfterUnbondingInitiated(ctx, id) - require.NoError(t, err) - } - // Check that the unbonding ops were stored - expectedChains = []string{"chain-1", "chain-2"} - for _, id := range unbondingOpIds { - unbondingOp, found = pk.GetUnbondingOp(ctx, id) - require.True(t, found) - require.Equal(t, id, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - } - // Check that the unbonding op index was stored - for _, chainID := range expectedChains { - ids, found := pk.GetUnbondingOpIndex(ctx, chainID, pk.GetValidatorSetUpdateId(ctx)) - require.True(t, found) - require.Equal(t, unbondingOpIds, ids) - } - - // Increment vscID - pk.IncrementValidatorSetUpdateId(ctx) - require.Equal(t, uint64(4), pk.GetValidatorSetUpdateId(ctx)) - - // Start fith unbonding - unbondingOpId = 5 - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_ValidatorUnbonding, true), - mocks.MockStakingKeeper.EXPECT().GetValidatorByUnbondingID(ctx, unbondingOpId).Return( - stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress([]byte{1}).String(), - }, true), - mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). - Return(vals[1], true), - mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, unbondingOpId).Return(nil), - ) - err = pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) - require.NoError(t, err) - - // Check that an unbonding op was stored for chain-2 only - // since it's the only consumer the unbonding validator has opted-in to - expectedChains = []string{"chain-2"} - unbondingOp, found = pk.GetUnbondingOp(ctx, unbondingOpId) - require.True(t, found) - require.Equal(t, unbondingOpId, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - - // Handle VSCMatured packet from chain-1 for vscID 1. - // Note that no VSCPacket was sent as the chain was not yet registered, - // but the code should still work - pk.HandleVSCMaturedPacket(ctx, "chain-1", ccv.VSCMaturedPacketData{ValsetUpdateId: 1}) - require.Empty(t, pk.ConsumeMaturedUnbondingOps(ctx)) - - // Handle VSCMatured packet from chain-1 for vscID 2. - pk.HandleVSCMaturedPacket(ctx, "chain-1", ccv.VSCMaturedPacketData{ValsetUpdateId: 2}) - // Check that the unbonding operation with ID=2 can complete - require.Equal(t, []uint64{2}, pk.ConsumeMaturedUnbondingOps(ctx)) - // Check that the unbonding op index was removed - _, found = pk.GetUnbondingOpIndex(ctx, "chain-1", 2) - require.False(t, found) - - // Handle VSCMatured packet from chain-2 for vscID 3. - pk.HandleVSCMaturedPacket(ctx, "chain-2", ccv.VSCMaturedPacketData{ValsetUpdateId: 3}) - // Check that the unbonding operations with IDs 3 and 4 no longer wait for chain-2 - expectedChains = []string{"chain-1"} - unbondingOpIds = []uint64{3, 4} - for _, id := range unbondingOpIds { - unbondingOp, found := pk.GetUnbondingOp(ctx, id) - require.True(t, found) - require.Equal(t, id, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - } - // Check that no unbonding operation can complete - require.Empty(t, pk.ConsumeMaturedUnbondingOps(ctx)) - // Check that the unbonding op index was removed - _, found = pk.GetUnbondingOpIndex(ctx, "chain-2", 3) - require.False(t, found) - - // Handle VSCMatured packet from chain-1 for vscID 3. - pk.HandleVSCMaturedPacket(ctx, "chain-1", ccv.VSCMaturedPacketData{ValsetUpdateId: 3}) - // Check that the unbonding operations with IDs 3 and 4 can complete - require.Equal(t, unbondingOpIds, pk.ConsumeMaturedUnbondingOps(ctx)) - // Check that the unbonding op index was removed - _, found = pk.GetUnbondingOpIndex(ctx, "chain-1", 3) - require.False(t, found) -} - // TestSendVSCPacketsToChainFailure tests the SendVSCPacketsToChain method failing func TestSendVSCPacketsToChainFailure(t *testing.T) { // Keeper setup From e64f8722a50d22189535fa2fd43c767e090a3b44 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:24:55 +0200 Subject: [PATCH 11/81] remove VscUnbondingOps from ConsumerState --- .../ccv/provider/v1/genesis.proto | 5 - x/ccv/provider/keeper/genesis.go | 7 +- x/ccv/provider/keeper/genesis_test.go | 2 - x/ccv/provider/types/consumer.go | 2 - x/ccv/provider/types/genesis.go | 17 -- x/ccv/provider/types/genesis.pb.go | 180 ++++++------------ x/ccv/provider/types/genesis_test.go | 160 ---------------- 7 files changed, 60 insertions(+), 313 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index fb8fa4b490..c3c6a51927 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -74,11 +74,6 @@ message ConsumerState { repeated interchain_security.ccv.v1.ValidatorSetChangePacketData pending_valset_changes = 6 [ (gogoproto.nullable) = false ]; repeated string slash_downtime_ack = 7; - // UnbondingOpsIndex defines the unbonding operations waiting on this consumer - // chain - // TODO (mpoke) remove - repeated interchain_security.ccv.provider.v1.VscUnbondingOps - unbonding_ops_index = 8 [ (gogoproto.nullable) = false ]; } // ValsetUpdateIdToHeight defines the genesis information for the mapping diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 517b09b1d4..3100dc2aa8 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -106,10 +106,9 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // initial consumer chain states cs := types.ConsumerState{ - ChainId: chainID, - ClientId: clientID, - ConsumerGenesis: gen, - UnbondingOpsIndex: nil, + ChainId: chainID, + ClientId: clientID, + ConsumerGenesis: gen, } // try to find channel id for the current consumer chain diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 137a18a848..bb718670ed 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -50,7 +50,6 @@ func TestInitAndExportGenesis(t *testing.T) { "channel", initHeight, *ccv.DefaultConsumerGenesisState(), - nil, []ccv.ValidatorSetChangePacketData{}, []string{"slashedValidatorConsAddress"}, ), @@ -60,7 +59,6 @@ func TestInitAndExportGenesis(t *testing.T) { "", 0, *ccv.DefaultConsumerGenesisState(), - nil, []ccv.ValidatorSetChangePacketData{{ValsetUpdateId: vscID}}, nil, ), diff --git a/x/ccv/provider/types/consumer.go b/x/ccv/provider/types/consumer.go index 4c43bd58e7..cda585efbc 100644 --- a/x/ccv/provider/types/consumer.go +++ b/x/ccv/provider/types/consumer.go @@ -10,7 +10,6 @@ func NewConsumerStates( channelID string, initialHeight uint64, genesis ccv.ConsumerGenesisState, - unbondingOpsIndexes []VscUnbondingOps, pendingValsetChanges []ccv.ValidatorSetChangePacketData, slashDowntimeAck []string, ) ConsumerState { @@ -19,7 +18,6 @@ func NewConsumerStates( ClientId: clientID, ChannelId: channelID, InitialHeight: initialHeight, - UnbondingOpsIndex: unbondingOpsIndexes, PendingValsetChanges: pendingValsetChanges, ConsumerGenesis: genesis, SlashDowntimeAck: slashDowntimeAck, diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index ae929ba541..8800fe69a9 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -116,14 +116,6 @@ func (gs GenesisState) ValidateUnbondingOp(ubdOp UnbondingOp) error { if cs.ChainId != chainID { continue } - for _, vscUnbondingOps := range cs.UnbondingOpsIndex { - for _, id := range vscUnbondingOps.GetUnbondingOpIds() { - if id == ubdOp.Id { - found = true - break - } - } - } } if !found { return errorsmod.Wrap(ccv.ErrInvalidGenesis, @@ -167,15 +159,6 @@ func (cs ConsumerState) Validate() error { } } - for _, ubdOpIdx := range cs.UnbondingOpsIndex { - if ubdOpIdx.VscId == 0 { - return fmt.Errorf("UnbondingOpsIndex vscID cannot be equal to zero") - } - if len(ubdOpIdx.UnbondingOpIds) == 0 { - return fmt.Errorf("unbonding operation index cannot be empty: %#v", ubdOpIdx) - } - } - return nil } diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index fcb7d6c499..97d70b8f70 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -197,10 +197,6 @@ type ConsumerState struct { // TODO (mpoke) remove PendingValsetChanges []types.ValidatorSetChangePacketData `protobuf:"bytes,6,rep,name=pending_valset_changes,json=pendingValsetChanges,proto3" json:"pending_valset_changes"` SlashDowntimeAck []string `protobuf:"bytes,7,rep,name=slash_downtime_ack,json=slashDowntimeAck,proto3" json:"slash_downtime_ack,omitempty"` - // UnbondingOpsIndex defines the unbonding operations waiting on this consumer - // chain - // TODO (mpoke) remove - UnbondingOpsIndex []VscUnbondingOps `protobuf:"bytes,8,rep,name=unbonding_ops_index,json=unbondingOpsIndex,proto3" json:"unbonding_ops_index"` } func (m *ConsumerState) Reset() { *m = ConsumerState{} } @@ -285,13 +281,6 @@ func (m *ConsumerState) GetSlashDowntimeAck() []string { return nil } -func (m *ConsumerState) GetUnbondingOpsIndex() []VscUnbondingOps { - if m != nil { - return m.UnbondingOpsIndex - } - return nil -} - // ValsetUpdateIdToHeight defines the genesis information for the mapping // of each valset update id to a block height type ValsetUpdateIdToHeight struct { @@ -357,64 +346,63 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 908 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0x1b, 0x37, - 0x10, 0xf6, 0xda, 0x8e, 0x63, 0xd1, 0x3f, 0x75, 0x59, 0x57, 0x59, 0xdb, 0xad, 0x62, 0xa8, 0x08, - 0x60, 0xa0, 0xad, 0x14, 0xbb, 0x39, 0xa4, 0x3f, 0x39, 0xc4, 0x49, 0xd1, 0x0a, 0x45, 0x51, 0x41, - 0x76, 0x5c, 0x20, 0x3d, 0x10, 0x14, 0x49, 0x48, 0x8c, 0x25, 0x72, 0xc1, 0xe1, 0xae, 0x2d, 0x14, - 0x05, 0x52, 0xb4, 0x0f, 0xd0, 0xc7, 0xca, 0xd1, 0xc7, 0x9e, 0x82, 0xc2, 0x7e, 0x83, 0x3e, 0x41, - 0xb1, 0x5c, 0xee, 0x66, 0xe5, 0xca, 0x81, 0x94, 0x93, 0x2d, 0x7e, 0x9c, 0xef, 0xfb, 0x86, 0x43, - 0xce, 0x2c, 0xda, 0x97, 0xca, 0x0a, 0xc3, 0xfa, 0x54, 0x2a, 0x02, 0x82, 0xc5, 0x46, 0xda, 0x51, - 0x93, 0xb1, 0xa4, 0x19, 0x19, 0x9d, 0x48, 0x2e, 0x4c, 0x33, 0xd9, 0x6f, 0xf6, 0x84, 0x12, 0x20, - 0xa1, 0x11, 0x19, 0x6d, 0x35, 0xfe, 0x64, 0x42, 0x48, 0x83, 0xb1, 0xa4, 0x91, 0x87, 0x34, 0x92, - 0xfd, 0x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0xa1, 0xf9, 0x26, 0xab, 0xcf, 0x8b, 0x2f, 0x92, 0xe4, 0x41, - 0xf3, 0x7c, 0xfc, 0xb3, 0xc4, 0x8e, 0x22, 0x01, 0xdd, 0x25, 0xf7, 0x45, 0xf2, 0xc5, 0x7f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xa6, 0x52, 0x42, 0x65, 0x8e, 0x09, 0x00, 0x00, + // 881 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdf, 0x6e, 0xdb, 0xb6, + 0x17, 0x8e, 0x92, 0x34, 0x8d, 0x99, 0x3f, 0xbf, 0x80, 0xc8, 0xcf, 0x55, 0x92, 0xcd, 0x0d, 0x3c, + 0x14, 0x08, 0xb0, 0xcd, 0x6a, 0xb2, 0x5d, 0x74, 0x7f, 0x7a, 0xd1, 0xb4, 0xc3, 0x66, 0x0c, 0xc3, + 0x0c, 0x27, 0xcd, 0x80, 0xee, 0x82, 0xa0, 0x29, 0xc2, 0xe6, 0x22, 0x91, 0x02, 0x0f, 0xa5, 0xd4, + 0x18, 0x06, 0x6c, 0xd8, 0x1e, 0x60, 0x17, 0x7b, 0xa8, 0x5e, 0xe6, 0x72, 0x57, 0xc5, 0x90, 0xbc, + 0xc1, 0x9e, 0x60, 0x10, 0x45, 0xa9, 0x72, 0xe6, 0x14, 0xf6, 0xae, 0x6c, 0x9d, 0x8f, 0xe7, 0xfb, + 0xbe, 0xc3, 0x43, 0x1d, 0x0a, 0x1d, 0x0a, 0x69, 0xb8, 0x66, 0x23, 0x2a, 0x24, 0x01, 0xce, 0x52, + 0x2d, 0xcc, 0x38, 0x60, 0x2c, 0x0b, 0x12, 0xad, 0x32, 0x11, 0x72, 0x1d, 0x64, 0x87, 0xc1, 0x90, + 0x4b, 0x0e, 0x02, 0x3a, 0x89, 0x56, 0x46, 0xe1, 0xf7, 0xa6, 0xa4, 0x74, 0x18, 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xe1, 0xa3, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x91, 0x39, 0x14, 0x22, 0x09, 0x00, + 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -627,20 +615,6 @@ func (m *ConsumerState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.UnbondingOpsIndex) > 0 { - for iNdEx := len(m.UnbondingOpsIndex) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingOpsIndex[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - } if len(m.SlashDowntimeAck) > 0 { for iNdEx := len(m.SlashDowntimeAck) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.SlashDowntimeAck[iNdEx]) @@ -860,12 +834,6 @@ func (m *ConsumerState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.UnbondingOpsIndex) > 0 { - for _, e := range m.UnbondingOpsIndex { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -1611,40 +1579,6 @@ func (m *ConsumerState) Unmarshal(dAtA []byte) error { } m.SlashDowntimeAck = append(m.SlashDowntimeAck, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOpsIndex", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UnbondingOpsIndex = append(m.UnbondingOpsIndex, VscUnbondingOps{}) - if err := m.UnbondingOpsIndex[len(m.UnbondingOpsIndex)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 41a716757f..fc7713c059 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -513,166 +513,6 @@ func TestValidateGenesisState(t *testing.T) { ), false, }, - { - "invalid consumer state UnbondingOpsIndex - zero vscID", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{{}}, - }, - }, - nil, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state UnbondingOpsIndex - no IDs", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{{VscId: 1}}, - }, - }, - nil, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state UnbondingOp - no matching UnbondingOpsIndex", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{ - { - VscId: 1, - }, - }, - }, - }, - []types.UnbondingOp{ - { - Id: 13, - UnbondingConsumerChains: []string{"chainid"}, - }, - }, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state UnbondingOp - no matching UnbondingOpsIndex 2", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{ - { - VscId: 1, - UnbondingOpIds: []uint64{13}, - }, - }, - }, - { - ChainId: "chainid-2", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-2"), - UnbondingOpsIndex: []types.VscUnbondingOps{ - { - VscId: 1, - }, - }, - }, - }, - []types.UnbondingOp{ - { - Id: 13, - UnbondingConsumerChains: []string{"chainid", "chainid-2"}, - }, - }, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state unbonding operation operation 2", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{{ - ChainId: "chainid", ChannelId: "channel-0", ClientId: "client-id", - UnbondingOpsIndex: []types.VscUnbondingOps{{VscId: 1}}, - }}, - nil, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, { "invalid params- invalid consumer registration fee denom", types.NewGenesisState( From 899a93e7e15354e340e5a8057e6ef5b634780fe9 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:33:36 +0200 Subject: [PATCH 12/81] remove unnecessary fields from GenesisState --- .../ccv/provider/v1/genesis.proto | 27 +- x/ccv/provider/keeper/genesis.go | 3 - x/ccv/provider/keeper/genesis_test.go | 3 - x/ccv/provider/module_test.go | 3 - x/ccv/provider/types/genesis.go | 12 - x/ccv/provider/types/genesis.pb.go | 340 ++++-------------- x/ccv/provider/types/genesis_test.go | 111 ------ 7 files changed, 80 insertions(+), 419 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index c3c6a51927..783cc32abb 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -19,37 +19,26 @@ message GenesisState { (gogoproto.moretags) = "yaml:\"consumer_states\"" ]; // empty for a new chain - // TODO (mpoke) remove - repeated interchain_security.ccv.provider.v1.UnbondingOp unbonding_ops = 3 + repeated ValsetUpdateIdToHeight valset_update_id_to_height = 3 [ (gogoproto.nullable) = false ]; // empty for a new chain - // TODO (mpoke) remove - interchain_security.ccv.provider.v1.MaturedUnbondingOps mature_unbonding_ops = 4; - // empty for a new chain - repeated ValsetUpdateIdToHeight valset_update_id_to_height = 5 + repeated ConsumerAdditionProposal consumer_addition_proposals = 4 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ConsumerAdditionProposal consumer_addition_proposals = 6 + repeated ConsumerRemovalProposal consumer_removal_proposals = 5 [ (gogoproto.nullable) = false ]; + Params params = 6 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ConsumerRemovalProposal consumer_removal_proposals = 7 + repeated ValidatorConsumerPubKey validator_consumer_pubkeys = 7 [ (gogoproto.nullable) = false ]; - Params params = 8 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ValidatorConsumerPubKey validator_consumer_pubkeys = 9 + repeated ValidatorByConsumerAddr validators_by_consumer_addr = 8 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ValidatorByConsumerAddr validators_by_consumer_addr = 10 - [ (gogoproto.nullable) = false ]; - // empty for a new chain - repeated ConsumerAddrsToPrune consumer_addrs_to_prune = 11 - [ (gogoproto.nullable) = false ]; - - repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 12 + repeated ConsumerAddrsToPrune consumer_addrs_to_prune = 9 [ (gogoproto.nullable) = false ]; -// TODO (mpoke) remove - repeated interchain_security.ccv.provider.v1.ExportedVscSendTimestamp exported_vsc_send_timestamps = 13 + repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 10 [ (gogoproto.nullable) = false ]; } diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 3100dc2aa8..6ee2b63f17 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -138,8 +138,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { k.GetValidatorSetUpdateId(ctx), k.GetAllValsetUpdateBlockHeights(ctx), consumerStates, - nil, - nil, k.GetAllPendingConsumerAdditionProps(ctx), k.GetAllPendingConsumerRemovalProps(ctx), params, @@ -147,6 +145,5 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { k.GetAllValidatorsByConsumerAddr(ctx, nil), consumerAddrsToPrune, k.GetAllInitTimeoutTimestamps(ctx), - nil, ) } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index bb718670ed..e0a1f3e395 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -63,8 +63,6 @@ func TestInitAndExportGenesis(t *testing.T) { nil, ), }, - nil, - nil, []providertypes.ConsumerAdditionProposal{{ ChainId: cChainIDs[0], SpawnTime: oneHourFromNow, @@ -96,7 +94,6 @@ func TestInitAndExportGenesis(t *testing.T) { }, }, initTimeoutTimeStamps, - nil, ) // Instantiate in-mem provider keeper with mocks diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 869c24253f..b7480cdf25 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -102,14 +102,11 @@ func TestInitGenesis(t *testing.T) { tc.consumerStates, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ) cdc := keeperParams.Cdc diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index 8800fe69a9..fa64f6f14b 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -16,8 +16,6 @@ func NewGenesisState( vscID uint64, vscIdToHeights []ValsetUpdateIdToHeight, consumerStates []ConsumerState, - unbondingOps []UnbondingOp, - matureUbdOps *MaturedUnbondingOps, additionProposals []ConsumerAdditionProposal, removalProposals []ConsumerRemovalProposal, params Params, @@ -25,14 +23,11 @@ func NewGenesisState( validatorsByConsumerAddr []ValidatorByConsumerAddr, consumerAddrsToPrune []ConsumerAddrsToPrune, initTimeoutTimestamps []InitTimeoutTimestamp, - exportedVscSendTimestamps []ExportedVscSendTimestamp, ) *GenesisState { return &GenesisState{ ValsetUpdateId: vscID, ValsetUpdateIdToHeight: vscIdToHeights, ConsumerStates: consumerStates, - UnbondingOps: unbondingOps, - MatureUnbondingOps: matureUbdOps, ConsumerAdditionProposals: additionProposals, ConsumerRemovalProposals: removalProposals, Params: params, @@ -40,7 +35,6 @@ func NewGenesisState( ValidatorsByConsumerAddr: validatorsByConsumerAddr, ConsumerAddrsToPrune: consumerAddrsToPrune, InitTimeoutTimestamps: initTimeoutTimestamps, - ExportedVscSendTimestamps: exportedVscSendTimestamps, } } @@ -57,12 +51,6 @@ func (gs GenesisState) Validate() error { return errorsmod.Wrap(ccv.ErrInvalidGenesis, "valset update ID cannot be equal to zero") } - for _, ubdOp := range gs.UnbondingOps { - if err := gs.ValidateUnbondingOp(ubdOp); err != nil { - return err - } - } - for _, prop := range gs.ConsumerAdditionProposals { if err := prop.ValidateBasic(); err != nil { return errorsmod.Wrap(ccv.ErrInvalidGenesis, err.Error()) diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index 97d70b8f70..85b6f2121f 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -31,27 +31,19 @@ type GenesisState struct { // empty for a new chain ConsumerStates []ConsumerState `protobuf:"bytes,2,rep,name=consumer_states,json=consumerStates,proto3" json:"consumer_states" yaml:"consumer_states"` // empty for a new chain - // TODO (mpoke) remove - UnbondingOps []UnbondingOp `protobuf:"bytes,3,rep,name=unbonding_ops,json=unbondingOps,proto3" json:"unbonding_ops"` - // empty for a new chain - // TODO (mpoke) remove - MatureUnbondingOps *MaturedUnbondingOps `protobuf:"bytes,4,opt,name=mature_unbonding_ops,json=matureUnbondingOps,proto3" json:"mature_unbonding_ops,omitempty"` + ValsetUpdateIdToHeight []ValsetUpdateIdToHeight `protobuf:"bytes,3,rep,name=valset_update_id_to_height,json=valsetUpdateIdToHeight,proto3" json:"valset_update_id_to_height"` // empty for a new chain - ValsetUpdateIdToHeight []ValsetUpdateIdToHeight `protobuf:"bytes,5,rep,name=valset_update_id_to_height,json=valsetUpdateIdToHeight,proto3" json:"valset_update_id_to_height"` + ConsumerAdditionProposals []ConsumerAdditionProposal `protobuf:"bytes,4,rep,name=consumer_addition_proposals,json=consumerAdditionProposals,proto3" json:"consumer_addition_proposals"` // empty for a new chain - ConsumerAdditionProposals []ConsumerAdditionProposal `protobuf:"bytes,6,rep,name=consumer_addition_proposals,json=consumerAdditionProposals,proto3" json:"consumer_addition_proposals"` + ConsumerRemovalProposals []ConsumerRemovalProposal `protobuf:"bytes,5,rep,name=consumer_removal_proposals,json=consumerRemovalProposals,proto3" json:"consumer_removal_proposals"` + Params Params `protobuf:"bytes,6,opt,name=params,proto3" json:"params"` // empty for a new chain - ConsumerRemovalProposals []ConsumerRemovalProposal `protobuf:"bytes,7,rep,name=consumer_removal_proposals,json=consumerRemovalProposals,proto3" json:"consumer_removal_proposals"` - Params Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params"` + ValidatorConsumerPubkeys []ValidatorConsumerPubKey `protobuf:"bytes,7,rep,name=validator_consumer_pubkeys,json=validatorConsumerPubkeys,proto3" json:"validator_consumer_pubkeys"` // empty for a new chain - ValidatorConsumerPubkeys []ValidatorConsumerPubKey `protobuf:"bytes,9,rep,name=validator_consumer_pubkeys,json=validatorConsumerPubkeys,proto3" json:"validator_consumer_pubkeys"` + ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,8,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` // empty for a new chain - ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,10,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` - // empty for a new chain - ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` - InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` - // TODO (mpoke) remove - ExportedVscSendTimestamps []ExportedVscSendTimestamp `protobuf:"bytes,13,rep,name=exported_vsc_send_timestamps,json=exportedVscSendTimestamps,proto3" json:"exported_vsc_send_timestamps"` + ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,9,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` + InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,10,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -101,20 +93,6 @@ func (m *GenesisState) GetConsumerStates() []ConsumerState { return nil } -func (m *GenesisState) GetUnbondingOps() []UnbondingOp { - if m != nil { - return m.UnbondingOps - } - return nil -} - -func (m *GenesisState) GetMatureUnbondingOps() *MaturedUnbondingOps { - if m != nil { - return m.MatureUnbondingOps - } - return nil -} - func (m *GenesisState) GetValsetUpdateIdToHeight() []ValsetUpdateIdToHeight { if m != nil { return m.ValsetUpdateIdToHeight @@ -171,13 +149,6 @@ func (m *GenesisState) GetInitTimeoutTimestamps() []InitTimeoutTimestamp { return nil } -func (m *GenesisState) GetExportedVscSendTimestamps() []ExportedVscSendTimestamp { - if m != nil { - return m.ExportedVscSendTimestamps - } - return nil -} - // The provider CCV module's knowledge of consumer state. // // Note this type is only used internally to the provider CCV module. @@ -346,63 +317,56 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 881 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdf, 0x6e, 0xdb, 0xb6, - 0x17, 0x8e, 0x92, 0x34, 0x8d, 0x99, 0x3f, 0xbf, 0x80, 0xc8, 0xcf, 0x55, 0x92, 0xcd, 0x0d, 0x3c, - 0x14, 0x08, 0xb0, 0xcd, 0x6a, 0xb2, 0x5d, 0x74, 0x7f, 0x7a, 0xd1, 0xb4, 0xc3, 0x66, 0x0c, 0xc3, - 0x0c, 0x27, 0xcd, 0x80, 0xee, 0x82, 0xa0, 0x29, 0xc2, 0xe6, 0x22, 0x91, 0x02, 0x0f, 0xa5, 0xd4, - 0x18, 0x06, 0x6c, 0xd8, 0x1e, 0x60, 0x17, 0x7b, 0xa8, 0x5e, 0xe6, 0x72, 0x57, 0xc5, 0x90, 0xbc, - 0xc1, 0x9e, 0x60, 0x10, 0x45, 0xa9, 0x72, 0xe6, 0x14, 0xf6, 0xae, 0x6c, 0x9d, 0x8f, 0xe7, 0xfb, - 0xbe, 0xc3, 0x43, 0x1d, 0x0a, 0x1d, 0x0a, 0x69, 0xb8, 0x66, 0x23, 0x2a, 0x24, 0x01, 0xce, 0x52, - 0x2d, 0xcc, 0x38, 0x60, 0x2c, 0x0b, 0x12, 0xad, 0x32, 0x11, 0x72, 0x1d, 0x64, 0x87, 0xc1, 0x90, - 0x4b, 0x0e, 0x02, 0x3a, 0x89, 0x56, 0x46, 0xe1, 0xf7, 0xa6, 0xa4, 0x74, 0x18, 0xcb, 0x3a, 0x65, - 0x4a, 0x27, 0x3b, 0xdc, 0xdd, 0x1e, 0xaa, 0xa1, 0xb2,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09, 0x00, - 0x00, + // 783 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x4f, 0x23, 0x37, + 0x14, 0xcf, 0x90, 0x10, 0x88, 0x29, 0x14, 0x59, 0x34, 0x0c, 0x41, 0x0d, 0x28, 0x15, 0x52, 0xa4, + 0xb6, 0x19, 0x92, 0xf6, 0xd0, 0x7f, 0x1c, 0x08, 0x48, 0x6d, 0xd4, 0x4b, 0x14, 0x52, 0x2a, 0x71, + 0x19, 0x39, 0x1e, 0x2b, 0xb1, 0x32, 0x33, 0x1e, 0xd9, 0x9e, 0xa1, 0x51, 0x55, 0x89, 0x6a, 0xbf, + 0xc0, 0x1e, 0xf6, 0x43, 0x71, 0xe4, 0xb8, 0x27, 0xb4, 0x82, 0x6f, 0xb0, 0x9f, 0x60, 0x35, 0x1e, + 0xcf, 0x6c, 0xc2, 0x06, 0x94, 0xec, 0x29, 0x19, 0xff, 0xfc, 0x7e, 0xbf, 0xdf, 0x7b, 0xcf, 0x7e, + 0x06, 0x4d, 0xea, 0x4b, 0xc2, 0xf1, 0x08, 0x51, 0xdf, 0x16, 0x04, 0x87, 0x9c, 0xca, 0x89, 0x85, + 0x71, 0x64, 0x05, 0x9c, 0x45, 0xd4, 0x21, 0xdc, 0x8a, 0x9a, 0xd6, 0x90, 0xf8, 0x44, 0x50, 0xd1, + 0x08, 0x38, 0x93, 0x0c, 0x7e, 0x33, 0x27, 0xa4, 0x81, 0x71, 0xd4, 0x48, 0x43, 0x1a, 0x51, 0xb3, + 0xb2, 0x33, 0x64, 0x43, 0xa6, 0xf6, 0x5b, 0xf1, 0xbf, 0x24, 0xb4, 0x72, 0xfc, 0x9c, 0x5a, 0xd4, + 0xb4, 0xc4, 0x08, 0x71, 0xe2, 0xd8, 0x98, 0xf9, 0x22, 0xf4, 0x08, 0xd7, 0x11, 0x47, 0x2f, 0x44, + 0x5c, 0x53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56, 0x73, 0x6f, 0x1f, 0xab, 0xb9, 0xab, 0x93, 0x21, 0x95, + 0xa3, 0x70, 0xd0, 0xc0, 0xcc, 0xb3, 0x30, 0x13, 0x1e, 0x13, 0xd6, 0xc7, 0x52, 0x7c, 0x9f, 0xbd, + 0x6a, 0xd1, 0x8f, 0xd6, 0x3f, 0xb3, 0x4f, 0x9b, 0x9c, 0x04, 0x44, 0x0c, 0x8a, 0xea, 0x55, 0xfb, + 0xe1, 0x43, 0x00, 0x00, 0x00, 0xff, 0xff, 0x64, 0x1d, 0x14, 0x17, 0xd2, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -425,20 +389,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ExportedVscSendTimestamps) > 0 { - for iNdEx := len(m.ExportedVscSendTimestamps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ExportedVscSendTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6a - } - } if len(m.InitTimeoutTimestamps) > 0 { for iNdEx := len(m.InitTimeoutTimestamps) - 1; iNdEx >= 0; iNdEx-- { { @@ -450,7 +400,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x62 + dAtA[i] = 0x52 } } if len(m.ConsumerAddrsToPrune) > 0 { @@ -464,7 +414,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x5a + dAtA[i] = 0x4a } } if len(m.ValidatorsByConsumerAddr) > 0 { @@ -478,7 +428,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x42 } } if len(m.ValidatorConsumerPubkeys) > 0 { @@ -492,7 +442,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a + dAtA[i] = 0x3a } } { @@ -504,7 +454,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x32 if len(m.ConsumerRemovalProposals) > 0 { for iNdEx := len(m.ConsumerRemovalProposals) - 1; iNdEx >= 0; iNdEx-- { { @@ -516,7 +466,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x2a } } if len(m.ConsumerAdditionProposals) > 0 { @@ -530,7 +480,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x22 } } if len(m.ValsetUpdateIdToHeight) > 0 { @@ -544,32 +494,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a - } - } - if m.MatureUnbondingOps != nil { - { - size, err := m.MatureUnbondingOps.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.UnbondingOps) > 0 { - for iNdEx := len(m.UnbondingOps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingOps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x1a } } @@ -736,16 +660,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.UnbondingOps) > 0 { - for _, e := range m.UnbondingOps { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.MatureUnbondingOps != nil { - l = m.MatureUnbondingOps.Size() - n += 1 + l + sovGenesis(uint64(l)) - } if len(m.ValsetUpdateIdToHeight) > 0 { for _, e := range m.ValsetUpdateIdToHeight { l = e.Size() @@ -790,12 +704,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.ExportedVscSendTimestamps) > 0 { - for _, e := range m.ExportedVscSendTimestamps { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -941,76 +849,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UnbondingOps = append(m.UnbondingOps, UnbondingOp{}) - if err := m.UnbondingOps[len(m.UnbondingOps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MatureUnbondingOps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MatureUnbondingOps == nil { - m.MatureUnbondingOps = &MaturedUnbondingOps{} - } - if err := m.MatureUnbondingOps.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValsetUpdateIdToHeight", wireType) } @@ -1044,7 +882,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAdditionProposals", wireType) } @@ -1078,7 +916,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerRemovalProposals", wireType) } @@ -1112,7 +950,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } @@ -1145,7 +983,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorConsumerPubkeys", wireType) } @@ -1179,7 +1017,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsByConsumerAddr", wireType) } @@ -1213,7 +1051,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 11: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrsToPrune", wireType) } @@ -1247,7 +1085,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 12: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutTimestamps", wireType) } @@ -1281,40 +1119,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExportedVscSendTimestamps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExportedVscSendTimestamps = append(m.ExportedVscSendTimestamps, ExportedVscSendTimestamp{}) - if err := m.ExportedVscSendTimestamps[len(m.ExportedVscSendTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index fc7713c059..ef40c1e3d7 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -34,14 +34,11 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), true, }, @@ -58,14 +55,11 @@ func TestValidateGenesisState(t *testing.T) { }, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), true, }, @@ -77,8 +71,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -86,7 +78,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), true, }, @@ -98,8 +89,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -107,7 +96,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -119,29 +107,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, - nil, - types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, - time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid unbonding op", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - nil, - []types.UnbondingOp{{UnbondingConsumerChains: nil}}, - nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -149,7 +114,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -161,8 +125,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -176,7 +138,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -188,8 +149,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), "0.0", // 0 trusting period fraction here @@ -203,7 +162,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -215,8 +173,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -230,7 +186,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -242,8 +197,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -257,34 +210,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, - ), - false, - }, - { - "invalid params, zero vsc timeout", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, - nil, - nil, - types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, - time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, - ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, - 0, // 0 vsc timeout here - types.DefaultSlashMeterReplenishPeriod, - types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), - nil, - nil, - nil, - nil, - nil, ), false, }, @@ -296,8 +221,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -311,7 +234,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -323,8 +245,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -338,7 +258,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -350,14 +269,11 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -369,14 +285,11 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid", ChannelId: "ivnalidChannel{}", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -388,14 +301,11 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid", ChannelId: "channel-0", ClientId: ""}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -407,14 +317,11 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid", ChannelId: "channel-0", ClientId: "abc", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid")}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -429,14 +336,11 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -452,14 +356,11 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -475,14 +376,11 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -502,14 +400,11 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, nil, - nil, ), false, }, @@ -521,8 +416,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600), @@ -530,7 +423,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -542,8 +434,6 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600), @@ -551,7 +441,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, From 3ad2d3d95d50484815a19410490d2219e7a0847d Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:38:45 +0200 Subject: [PATCH 13/81] remove GetAllUnbondingOps --- x/ccv/provider/keeper/keeper.go | 34 ---------------------- x/ccv/provider/migrations/vX/migrations.go | 14 ++++++--- 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 38a98df5e9..4125c3de5f 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -413,40 +413,6 @@ func (k Keeper) SetConsumerChain(ctx sdk.Context, channelID string) error { return nil } -// GetAllUnbondingOps gets all UnbondingOps, where each UnbondingOp consists -// of its unique ID and a list of consumer chainIDs that the unbonding operation -// is waiting on. -// -// Note that UnbondingOps are stored under keys with the following format: -// UnbondingOpBytePrefix | ID -// Thus, the iteration is in ascending order of IDs. -// TODO (mpoke): remove after state migration calling stakingKeeper.UnbondingCanComplete(ctx, id) -func (k Keeper) GetAllUnbondingOps(ctx sdk.Context) (ops []types.UnbondingOp) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, []byte{types.UnbondingOpBytePrefix}) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - id := binary.BigEndian.Uint64(iterator.Key()[1:]) - bz := iterator.Value() - if bz == nil { - // An error here would indicate something is very wrong, - // the UnbondingOp is assumed to be correctly set in SetUnbondingOp. - panic(fmt.Errorf("unbonding operation is nil for id %d", id)) - } - var unbondingOp types.UnbondingOp - if err := unbondingOp.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the UnbondingOp is assumed to be correctly serialized in SetUnbondingOp. - panic(fmt.Errorf("failed to unmarshal UnbondingOp: %w", err)) - } - - ops = append(ops, unbondingOp) - } - - return ops -} - // Retrieves the underlying client state corresponding to a connection ID. func (k Keeper) getUnderlyingClient(ctx sdk.Context, connectionID string) ( clientID string, tmClient *ibctmtypes.ClientState, err error, diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go index 49bda6b912..e6f091bf1d 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -1,6 +1,8 @@ package vX import ( + "encoding/binary" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -10,10 +12,14 @@ import ( ) // CompleteUnbondingOps completes all unbonding operations -func CompleteUnbondingOps(ctx sdk.Context, pk providerkeeper.Keeper, sk ccv.StakingKeeper) { - for _, op := range pk.GetAllUnbondingOps(ctx) { - if err := sk.UnbondingCanComplete(ctx, op.Id); err != nil { - pk.Logger(ctx).Error("UnbondingCanComplete failed", "unbondingID", op.Id, "error", err.Error()) +func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper, sk ccv.StakingKeeper) { + iterator := sdk.KVStorePrefixIterator(store, []byte{providertypes.UnbondingOpBytePrefix}) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + id := binary.BigEndian.Uint64(iterator.Key()[1:]) + if err := sk.UnbondingCanComplete(ctx, id); err != nil { + pk.Logger(ctx).Error("UnbondingCanComplete failed", "unbondingID", id, "error", err.Error()) } } } From cac47fa2ed757c44667f988559787b30ad115c50 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:40:19 +0200 Subject: [PATCH 14/81] remove deprecated protos --- .../ccv/provider/v1/provider.proto | 37 - x/ccv/provider/types/genesis.go | 24 - x/ccv/provider/types/provider.pb.go | 1546 ++--------------- 3 files changed, 193 insertions(+), 1414 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index c0b53c5b67..c5958606b0 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -272,54 +272,17 @@ message ChannelToChain { string chain_id = 2; } -// VscUnbondingOps contains the IDs of unbonding operations that are waiting for -// at least one VSCMaturedPacket with vscID from a consumer chain -// TODO (mpoke) remove -message VscUnbondingOps { - uint64 vsc_id = 1; - repeated uint64 unbonding_op_ids = 2; -} - -// UnbondingOp contains the ids of consumer chains that need to unbond before -// the unbonding operation with the given ID can unbond -// TODO (mpoke) remove -message UnbondingOp { - uint64 id = 1; - // consumer chains that are still unbonding - repeated string unbonding_consumer_chains = 2; -} - message InitTimeoutTimestamp { string chain_id = 1; uint64 timestamp = 2; } -// TODO (mpoke) remove -message VscSendTimestamp { - uint64 vsc_id = 1; - google.protobuf.Timestamp timestamp = 2 - [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; -} - // ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. message ValidatorSetChangePackets { repeated interchain_security.ccv.v1.ValidatorSetChangePacketData list = 1 [ (gogoproto.nullable) = false ]; } -// MaturedUnbondingOps defines a list of ids corresponding to ids of matured -// unbonding operations. -// TODO (mpoke) remove -message MaturedUnbondingOps { repeated uint64 ids = 1; } - -// ExportedVscSendTimestamps is VscSendTimestamp with chainID info for exporting to genesis -// TODO (mpoke) remove -message ExportedVscSendTimestamp { - string chain_id = 1; - repeated VscSendTimestamp vsc_send_timestamps = 2 - [ (gogoproto.nullable) = false ]; -} - // // Key assignment section // diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index fa64f6f14b..aad59d9982 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -90,30 +90,6 @@ func (gs GenesisState) Validate() error { return nil } -func (gs GenesisState) ValidateUnbondingOp(ubdOp UnbondingOp) error { - if len(ubdOp.UnbondingConsumerChains) == 0 { - return errorsmod.Wrap(ccv.ErrInvalidGenesis, "unbonding operations cannot have an empty consumer chain list") - } - - // Check that the ID is set correctly in the UnbondingOpsIndex - for _, chainID := range ubdOp.UnbondingConsumerChains { - found := false - - // Find consumer state for this consumer chain - for _, cs := range gs.ConsumerStates { - if cs.ChainId != chainID { - continue - } - } - if !found { - return errorsmod.Wrap(ccv.ErrInvalidGenesis, - fmt.Sprintf("unbonding operation without UnbondingOpsIndex, opID=%d, chainID=%s", ubdOp.Id, chainID)) - } - } - - return nil -} - // Validate performs a consumer state validation returning an error upon any failure. // It ensures that the chain id, client id and consumer genesis states are valid and non-empty. func (cs ConsumerState) Validate() error { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index e31b79600f..ea00914f57 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -929,117 +929,6 @@ func (m *ChannelToChain) GetChainId() string { return "" } -// VscUnbondingOps contains the IDs of unbonding operations that are waiting for -// at least one VSCMaturedPacket with vscID from a consumer chain -// TODO (mpoke) remove -type VscUnbondingOps struct { - VscId uint64 `protobuf:"varint,1,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` - UnbondingOpIds []uint64 `protobuf:"varint,2,rep,packed,name=unbonding_op_ids,json=unbondingOpIds,proto3" json:"unbonding_op_ids,omitempty"` -} - -func (m *VscUnbondingOps) Reset() { *m = VscUnbondingOps{} } -func (m *VscUnbondingOps) String() string { return proto.CompactTextString(m) } -func (*VscUnbondingOps) ProtoMessage() {} -func (*VscUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{12} -} -func (m *VscUnbondingOps) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VscUnbondingOps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VscUnbondingOps.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *VscUnbondingOps) XXX_Merge(src proto.Message) { - xxx_messageInfo_VscUnbondingOps.Merge(m, src) -} -func (m *VscUnbondingOps) XXX_Size() int { - return m.Size() -} -func (m *VscUnbondingOps) XXX_DiscardUnknown() { - xxx_messageInfo_VscUnbondingOps.DiscardUnknown(m) -} - -var xxx_messageInfo_VscUnbondingOps proto.InternalMessageInfo - -func (m *VscUnbondingOps) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *VscUnbondingOps) GetUnbondingOpIds() []uint64 { - if m != nil { - return m.UnbondingOpIds - } - return nil -} - -// UnbondingOp contains the ids of consumer chains that need to unbond before -// the unbonding operation with the given ID can unbond -// TODO (mpoke) remove -type UnbondingOp struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // consumer chains that are still unbonding - UnbondingConsumerChains []string `protobuf:"bytes,2,rep,name=unbonding_consumer_chains,json=unbondingConsumerChains,proto3" json:"unbonding_consumer_chains,omitempty"` -} - -func (m *UnbondingOp) Reset() { *m = UnbondingOp{} } -func (m *UnbondingOp) String() string { return proto.CompactTextString(m) } -func (*UnbondingOp) ProtoMessage() {} -func (*UnbondingOp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{13} -} -func (m *UnbondingOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UnbondingOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnbondingOp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *UnbondingOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnbondingOp.Merge(m, src) -} -func (m *UnbondingOp) XXX_Size() int { - return m.Size() -} -func (m *UnbondingOp) XXX_DiscardUnknown() { - xxx_messageInfo_UnbondingOp.DiscardUnknown(m) -} - -var xxx_messageInfo_UnbondingOp proto.InternalMessageInfo - -func (m *UnbondingOp) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *UnbondingOp) GetUnbondingConsumerChains() []string { - if m != nil { - return m.UnbondingConsumerChains - } - return nil -} - type InitTimeoutTimestamp struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` @@ -1049,7 +938,7 @@ func (m *InitTimeoutTimestamp) Reset() { *m = InitTimeoutTimestamp{} } func (m *InitTimeoutTimestamp) String() string { return proto.CompactTextString(m) } func (*InitTimeoutTimestamp) ProtoMessage() {} func (*InitTimeoutTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{14} + return fileDescriptor_f22ec409a72b7b72, []int{12} } func (m *InitTimeoutTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1092,59 +981,6 @@ func (m *InitTimeoutTimestamp) GetTimestamp() uint64 { return 0 } -// TODO (mpoke) remove -type VscSendTimestamp struct { - VscId uint64 `protobuf:"varint,1,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"` -} - -func (m *VscSendTimestamp) Reset() { *m = VscSendTimestamp{} } -func (m *VscSendTimestamp) String() string { return proto.CompactTextString(m) } -func (*VscSendTimestamp) ProtoMessage() {} -func (*VscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{15} -} -func (m *VscSendTimestamp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VscSendTimestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VscSendTimestamp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *VscSendTimestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_VscSendTimestamp.Merge(m, src) -} -func (m *VscSendTimestamp) XXX_Size() int { - return m.Size() -} -func (m *VscSendTimestamp) XXX_DiscardUnknown() { - xxx_messageInfo_VscSendTimestamp.DiscardUnknown(m) -} - -var xxx_messageInfo_VscSendTimestamp proto.InternalMessageInfo - -func (m *VscSendTimestamp) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *VscSendTimestamp) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - // ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. type ValidatorSetChangePackets struct { List []types3.ValidatorSetChangePacketData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` @@ -1154,7 +990,7 @@ func (m *ValidatorSetChangePackets) Reset() { *m = ValidatorSetChangePac func (m *ValidatorSetChangePackets) String() string { return proto.CompactTextString(m) } func (*ValidatorSetChangePackets) ProtoMessage() {} func (*ValidatorSetChangePackets) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{16} + return fileDescriptor_f22ec409a72b7b72, []int{13} } func (m *ValidatorSetChangePackets) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1190,107 +1026,6 @@ func (m *ValidatorSetChangePackets) GetList() []types3.ValidatorSetChangePacketD return nil } -// MaturedUnbondingOps defines a list of ids corresponding to ids of matured -// unbonding operations. -// TODO (mpoke) remove -type MaturedUnbondingOps struct { - Ids []uint64 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"` -} - -func (m *MaturedUnbondingOps) Reset() { *m = MaturedUnbondingOps{} } -func (m *MaturedUnbondingOps) String() string { return proto.CompactTextString(m) } -func (*MaturedUnbondingOps) ProtoMessage() {} -func (*MaturedUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{17} -} -func (m *MaturedUnbondingOps) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MaturedUnbondingOps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MaturedUnbondingOps.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MaturedUnbondingOps) XXX_Merge(src proto.Message) { - xxx_messageInfo_MaturedUnbondingOps.Merge(m, src) -} -func (m *MaturedUnbondingOps) XXX_Size() int { - return m.Size() -} -func (m *MaturedUnbondingOps) XXX_DiscardUnknown() { - xxx_messageInfo_MaturedUnbondingOps.DiscardUnknown(m) -} - -var xxx_messageInfo_MaturedUnbondingOps proto.InternalMessageInfo - -func (m *MaturedUnbondingOps) GetIds() []uint64 { - if m != nil { - return m.Ids - } - return nil -} - -// ExportedVscSendTimestamps is VscSendTimestamp with chainID info for exporting to genesis -// TODO (mpoke) remove -type ExportedVscSendTimestamp struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - VscSendTimestamps []VscSendTimestamp `protobuf:"bytes,2,rep,name=vsc_send_timestamps,json=vscSendTimestamps,proto3" json:"vsc_send_timestamps"` -} - -func (m *ExportedVscSendTimestamp) Reset() { *m = ExportedVscSendTimestamp{} } -func (m *ExportedVscSendTimestamp) String() string { return proto.CompactTextString(m) } -func (*ExportedVscSendTimestamp) ProtoMessage() {} -func (*ExportedVscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{18} -} -func (m *ExportedVscSendTimestamp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExportedVscSendTimestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExportedVscSendTimestamp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ExportedVscSendTimestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExportedVscSendTimestamp.Merge(m, src) -} -func (m *ExportedVscSendTimestamp) XXX_Size() int { - return m.Size() -} -func (m *ExportedVscSendTimestamp) XXX_DiscardUnknown() { - xxx_messageInfo_ExportedVscSendTimestamp.DiscardUnknown(m) -} - -var xxx_messageInfo_ExportedVscSendTimestamp proto.InternalMessageInfo - -func (m *ExportedVscSendTimestamp) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ExportedVscSendTimestamp) GetVscSendTimestamps() []VscSendTimestamp { - if m != nil { - return m.VscSendTimestamps - } - return nil -} - type KeyAssignmentReplacement struct { ProviderAddr []byte `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` PrevCKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=prev_c_key,json=prevCKey,proto3" json:"prev_c_key,omitempty"` @@ -1301,7 +1036,7 @@ func (m *KeyAssignmentReplacement) Reset() { *m = KeyAssignmentReplaceme func (m *KeyAssignmentReplacement) String() string { return proto.CompactTextString(m) } func (*KeyAssignmentReplacement) ProtoMessage() {} func (*KeyAssignmentReplacement) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{19} + return fileDescriptor_f22ec409a72b7b72, []int{14} } func (m *KeyAssignmentReplacement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1364,7 +1099,7 @@ func (m *ValidatorConsumerPubKey) Reset() { *m = ValidatorConsumerPubKey func (m *ValidatorConsumerPubKey) String() string { return proto.CompactTextString(m) } func (*ValidatorConsumerPubKey) ProtoMessage() {} func (*ValidatorConsumerPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{20} + return fileDescriptor_f22ec409a72b7b72, []int{15} } func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1427,7 +1162,7 @@ func (m *ValidatorByConsumerAddr) Reset() { *m = ValidatorByConsumerAddr func (m *ValidatorByConsumerAddr) String() string { return proto.CompactTextString(m) } func (*ValidatorByConsumerAddr) ProtoMessage() {} func (*ValidatorByConsumerAddr) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{21} + return fileDescriptor_f22ec409a72b7b72, []int{16} } func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1489,7 +1224,7 @@ func (m *ConsumerAddrsToPrune) Reset() { *m = ConsumerAddrsToPrune{} } func (m *ConsumerAddrsToPrune) String() string { return proto.CompactTextString(m) } func (*ConsumerAddrsToPrune) ProtoMessage() {} func (*ConsumerAddrsToPrune) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{22} + return fileDescriptor_f22ec409a72b7b72, []int{17} } func (m *ConsumerAddrsToPrune) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1554,7 +1289,7 @@ func (m *ConsumerValidator) Reset() { *m = ConsumerValidator{} } func (m *ConsumerValidator) String() string { return proto.CompactTextString(m) } func (*ConsumerValidator) ProtoMessage() {} func (*ConsumerValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{23} + return fileDescriptor_f22ec409a72b7b72, []int{18} } func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1615,7 +1350,7 @@ func (m *ConsumerRewardsAllocation) Reset() { *m = ConsumerRewardsAlloca func (m *ConsumerRewardsAllocation) String() string { return proto.CompactTextString(m) } func (*ConsumerRewardsAllocation) ProtoMessage() {} func (*ConsumerRewardsAllocation) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{24} + return fileDescriptor_f22ec409a72b7b72, []int{19} } func (m *ConsumerRewardsAllocation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1664,13 +1399,8 @@ func init() { proto.RegisterType((*ConsumerRemovalProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposals") proto.RegisterType((*AddressList)(nil), "interchain_security.ccv.provider.v1.AddressList") proto.RegisterType((*ChannelToChain)(nil), "interchain_security.ccv.provider.v1.ChannelToChain") - proto.RegisterType((*VscUnbondingOps)(nil), "interchain_security.ccv.provider.v1.VscUnbondingOps") - proto.RegisterType((*UnbondingOp)(nil), "interchain_security.ccv.provider.v1.UnbondingOp") proto.RegisterType((*InitTimeoutTimestamp)(nil), "interchain_security.ccv.provider.v1.InitTimeoutTimestamp") - proto.RegisterType((*VscSendTimestamp)(nil), "interchain_security.ccv.provider.v1.VscSendTimestamp") proto.RegisterType((*ValidatorSetChangePackets)(nil), "interchain_security.ccv.provider.v1.ValidatorSetChangePackets") - proto.RegisterType((*MaturedUnbondingOps)(nil), "interchain_security.ccv.provider.v1.MaturedUnbondingOps") - proto.RegisterType((*ExportedVscSendTimestamp)(nil), "interchain_security.ccv.provider.v1.ExportedVscSendTimestamp") proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") @@ -1684,130 +1414,120 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1954 bytes of a gzipped FileDescriptorProto + // 1802 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcb, 0x6f, 0x1b, 0xc7, - 0x19, 0xd7, 0x92, 0x94, 0x44, 0x0e, 0xf5, 0x1c, 0x29, 0xf1, 0x4a, 0x55, 0x29, 0x7a, 0xd3, 0xa4, - 0x6a, 0x5c, 0x2f, 0x23, 0xa5, 0x05, 0x0c, 0xa3, 0x41, 0x20, 0x51, 0x4e, 0x2c, 0x2b, 0xb6, 0x99, - 0x95, 0x2a, 0xa3, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, - 0x78, 0xe9, 0xb9, 0x87, 0x16, 0x48, 0x6f, 0x41, 0x0f, 0x6d, 0x5a, 0xa0, 0x40, 0xd1, 0x4b, 0xfb, - 0x67, 0xe4, 0x98, 0x63, 0x4f, 0x49, 0x61, 0x1f, 0x7a, 0xe8, 0x3f, 0x51, 0xcc, 0xec, 0x93, 0x94, - 0xe4, 0xd2, 0x48,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9, 0xf4, 0xeb, 0x6d, 0xc3, 0xa9, 0x69, 0x3d, 0xc5, 0x81, 0x8f, 0xc0, 0xca, 0x30, 0xe8, - 0xb2, 0xc0, 0xa3, 0x41, 0xcf, 0x0d, 0x09, 0xa7, 0xcc, 0x33, 0xab, 0x1a, 0x6a, 0xe3, 0x12, 0xd4, - 0x61, 0x92, 0x47, 0x31, 0xd2, 0x67, 0x0a, 0x69, 0x39, 0x53, 0xee, 0x68, 0x5d, 0xf8, 0x31, 0x80, - 0x18, 0x47, 0xda, 0x25, 0x36, 0x94, 0x29, 0x62, 0x6d, 0x7a, 0xc4, 0x15, 0x8c, 0xa3, 0xd3, 0x58, - 0x3b, 0x81, 0xfc, 0x15, 0xb8, 0x21, 0x39, 0x0a, 0xc4, 0x53, 0xc2, 0x27, 0x71, 0xc1, 0xf4, 0xb8, - 0xaf, 0xa5, 0x18, 0xe3, 0xe0, 0xf7, 0x41, 0x13, 0x27, 0x09, 0xe4, 0x72, 0xe2, 0x51, 0x21, 0x39, - 0xed, 0x0e, 0x95, 0xae, 0xfb, 0x94, 0x23, 0xac, 0x73, 0xa4, 0xae, 0x93, 0xa0, 0x91, 0xca, 0x39, - 0x63, 0x62, 0x1f, 0x24, 0x52, 0xf0, 0x31, 0xf8, 0x41, 0xd7, 0x67, 0xf8, 0x5c, 0x28, 0xe7, 0xdc, - 0x31, 0x24, 0x6d, 0x7a, 0x40, 0x85, 0x50, 0x68, 0x0b, 0x4d, 0x63, 0xa7, 0xec, 0xdc, 0x8c, 0x65, - 0x3b, 0x84, 0x1f, 0x16, 0x24, 0x4f, 0x0b, 0x82, 0xf0, 0x36, 0x80, 0x7d, 0x2a, 0x24, 0xe3, 0x14, - 0x23, 0xdf, 0x25, 0x81, 0xe4, 0x94, 0x08, 0x73, 0x51, 0xab, 0xaf, 0xe6, 0x9c, 0x7b, 0x31, 0x03, - 0x3e, 0x00, 0x37, 0xaf, 0x35, 0xea, 0xe2, 0x3e, 0x0a, 0x02, 0xe2,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 0x05, 0x7c, 0x0d, 0xcc, 0xa9, 0x1a, 0x4a, 0x80, 0x2a, 0xce, - 0x6c, 0x24, 0xf0, 0x91, 0xee, 0xda, 0xf9, 0xca, 0xcd, 0x42, 0x97, 0x7a, 0xc2, 0x2c, 0x35, 0xcb, - 0x3b, 0x15, 0x67, 0x69, 0x98, 0xab, 0x1f, 0x79, 0xc2, 0xfa, 0x05, 0xa8, 0x17, 0x00, 0xe1, 0x12, - 0x28, 0x65, 0x58, 0x25, 0xea, 0xc1, 0xbb, 0x60, 0x23, 0x07, 0x1a, 0x6f, 0xc3, 0x31, 0x62, 0xcd, - 0xb9, 0x91, 0x09, 0x8c, 0x75, 0x62, 0x61, 0x3d, 0x06, 0xeb, 0x47, 0x79, 0xd1, 0x67, 0x4d, 0x7e, - 0xec, 0x84, 0xc6, 0xf8, 0xde, 0xb0, 0x05, 0x6a, 0xd9, 0x4f, 0x4d, 0x7d, 0xfa, 0x8a, 0x93, 0x13, - 0xac, 0x01, 0x58, 0x39, 0x13, 0xf8, 0x84, 0x04, 0x5e, 0x0e, 0x76, 0xcd, 0x05, 0x1c, 0x4c, 0x02, - 0x4d, 0xfd, 0xbb, 0x25, 0x37, 0xc7, 0xc0, 0xc6, 0x59, 0x71, 0xc9, 0xd0, 0x03, 0xb8, 0x83, 0xf0, - 0x39, 0x91, 0x02, 0x3a, 0xa0, 0xa2, 0x97, 0x89, 0x38, 0xb3, 0xee, 0x5c, 0x9b, 0x59, 0xd1, 0xae, - 0x7d, 0x1d, 0xc8, 0x21, 0x92, 0x28, 0xa9, 0x5d, 0x8d, 0x65, 0xfd, 0x10, 0xac, 0x3d, 0x44, 0x72, - 0xc8, 0x89, 0x37, 0x16, 0xe3, 0x15, 0x50, 0x56, 0xf1, 0x33, 0x74, 0xfc, 0xd4, 0xa3, 0xda, 0x07, - 0xcc, 0x7b, 0x9f, 0x84, 0x8c, 0x4b, 0xe2, 0x5d, 0xba, 0x91, 0x97, 0x5c, 0xef, 0x39, 0x58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x4a, 0x6d, 0x0d, + 0x18, 0x1b, 0x04, 0xc4, 0xd1, 0x6f, 0xfd, 0xf1, 0x53, 0x47, 0xd2, 0x11, 0x11, 0x12, 0x8d, 0xa2, + 0x54, 0xa0, 0x79, 0x51, 0xc0, 0x1f, 0x73, 0x24, 0x29, 0x0b, 0x33, 0x00, 0xda, 0xc7, 0x0e, 0x66, + 0x9c, 0x38, 0x38, 0xa0, 0x24, 0x94, 0xca, 0x6a, 0xf2, 0x94, 0x0a, 0x38, 0x4a, 0x20, 0xa0, 0x83, + 0xa1, 0x4c, 0xc8, 0xc2, 0x91, 0x24, 0xf4, 0x09, 0x1f, 0xd1, 0x44, 0xb8, 0x78, 0x4b, 0x15, 0x76, + 0x4b, 0x7c, 0xcc, 0x27, 0x91, 0x64, 0xce, 0x19, 0x99, 0x88, 0x94, 0xfb, 0x0e, 0x66, 0x62, 0xc4, + 0x84, 0x43, 0xd4, 0xf9, 0x43, 0x4c, 0x9c, 0x78, 0xbf, 0x4f, 0x24, 0xda, 0xcf, 0x09, 0x99, 0xdf, + 0xa9, 0x5c, 0x1f, 0x89, 0x42, 0x06, 0x33, 0x9a, 0xf9, 0xbd, 0x81, 0x46, 0x34, 0x64, 0x8e, 0xfe, + 0x9b, 0x90, 0xac, 0xdf, 0xd4, 0x80, 0xd9, 0x65, 0xa1, 0x18, 0x8f, 0x08, 0xef, 0xf8, 0x3e, 0x55, + 0xa7, 0xec, 0x71, 0x16, 0x31, 0x81, 0x02, 0xb8, 0x05, 0x16, 0x24, 0x95, 0x01, 0x31, 0x8d, 0xb6, + 0xb1, 0x57, 0x77, 0x93, 0x17, 0xd8, 0x06, 0x0d, 0x9f, 0x08, 0xcc, 0x69, 0xa4, 0x84, 0xcd, 0x79, + 0xcd, 0x2b, 0x93, 0xe0, 0x36, 0xa8, 0x25, 0xa1, 0xa1, 0xbe, 0x59, 0xd1, 0xec, 0x25, 0xfd, 0xfe, + 0xc0, 0x87, 0x1f, 0x83, 0x55, 0x1a, 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 0x11, 0x4f, 0x59, 0xc7, 0xf7, 0xe1, 0x1e, + 0x58, 0x2f, 0x64, 0xb8, 0x4a, 0x78, 0x95, 0x87, 0x4a, 0x6c, 0x35, 0x13, 0xd3, 0x65, 0x40, 0xac, + 0xff, 0x18, 0x60, 0xfd, 0xe3, 0x80, 0xf5, 0x51, 0x70, 0x12, 0x20, 0x31, 0x54, 0x3d, 0x63, 0xa2, + 0xf2, 0x97, 0x93, 0xb4, 0x59, 0x6b, 0xf7, 0x66, 0xce, 0x5f, 0xa5, 0xa6, 0xc7, 0xc7, 0x87, 0x60, + 0x23, 0x6f, 0x9f, 0x79, 0xbe, 0xe9, 0xd3, 0x1c, 0x6e, 0x3e, 0xff, 0xb6, 0xb5, 0x96, 0xe5, 0x76, + 0x57, 0xe7, 0xde, 0x91, 0xbb, 0x86, 0xa7, 0x08, 0x3e, 0x6c, 0x82, 0x06, 0xed, 0x63, 0x4f, 0x90, + 0x67, 0x5e, 0x38, 0x1e, 0xe9, 0x54, 0xad, 0xba, 0x75, 0xda, 0xc7, 0x27, 0xe4, 0xd9, 0xa3, 0xf1, + 0x08, 0xbe, 0x0f, 0xde, 0xcc, 0x36, 0x27, 0x2f, 0x46, 0x81, 0xa7, 0xf4, 0xd5, 0x75, 0x70, 0x9d, + 0xbd, 0xcb, 0xee, 0x66, 0xc6, 0x7d, 0x8c, 0x02, 0x65, 0xac, 0xe3, 0xfb, 0xdc, 0x7a, 0xb1, 0x00, + 0x16, 0x7b, 0x88, 0xa3, 0x91, 0x80, 0xa7, 0x60, 0x4d, 0x92, 0x51, 0x14, 0x20, 0x49, 0xbc, 0x64, + 0x34, 0xa7, 0x27, 0xbd, 0xa5, 0x47, 0x76, 0x79, 0xcb, 0xb1, 0x4b, 0x7b, 0x4d, 0xbc, 0x6f, 0x77, + 0x35, 0xf5, 0x44, 0x22, 0x49, 0xdc, 0xd5, 0x0c, 0x23, 0x21, 0xc2, 0x3b, 0xc0, 0x94, 0x7c, 0x2c, + 0x64,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02, 0x60, 0x7e, 0xbc, 0x62, 0xa2, 0x27, 0x29, 0xb5, 0x9e, 0x71, 0xb2, 0x71, 0x5e, 0xa4, 0xc6, + 0x7c, 0x29, 0x35, 0xe0, 0x27, 0x60, 0x33, 0x77, 0x39, 0xd2, 0x01, 0x9a, 0x39, 0x8a, 0xf9, 0xce, + 0x92, 0x93, 0xac, 0xdf, 0x1a, 0x45, 0x8b, 0x4c, 0x7a, 0xb4, 0xe8, 0x04, 0x41, 0xba, 0xe8, 0xc1, + 0x08, 0x2c, 0x25, 0x63, 0x40, 0xa4, 0x15, 0xb7, 0x7b, 0x65, 0xc3, 0x3f, 0x22, 0x58, 0xf7, 0xfc, + 0x3b, 0xaa, 0xaa, 0xfe, 0xf6, 0x5d, 0xeb, 0xd6, 0x80, 0xca, 0xe1, 0xb8, 0x6f, 0x63, 0x36, 0x72, + 0xd2, 0x8f, 0x1b, 0xc9, 0xbf, 0xdb, 0xc2, 0x3f, 0x73, 0xe4, 0x24, 0x22, 0x22, 0xd3, 0x11, 0x7f, + 0xfd, 0xf7, 0x3f, 0xde, 0x35, 0xdc, 0xcc, 0xcc, 0xe1, 0x93, 0xaf, 0x9f, 0x37, 0x8d, 0x6f, 0x9e, + 0x37, 0x8d, 0x7f, 0x3d, 0x6f, 0x1a, 0x5f, 0xbc, 0x68, 0xce, 0x7d, 0xf3, 0xa2, 0x39, 0xf7, 0xcf, + 0x17, 0xcd, 0xb9, 0x9f, 0x7f, 0x70, 0x19, 0xb4, 0x88, 0xd1, 0xed, 0xfc, 0x73, 0x52, 0xfc, 0x53, + 0xe7, 0x97, 0xd3, 0x1f, 0xab, 0xb4, 0xbd, 0xfe, 0xa2, 0x9e, 0xab, 0xef, 0xff, 0x37, 0x00, 0x00, + 0xff, 0xff, 0x4c, 0x7f, 0xe4, 0xb1, 0xdd, 0x12, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2531,7 +2251,7 @@ func (m *ChannelToChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *VscUnbondingOps) Marshal() (dAtA []byte, err error) { +func (m *InitTimeoutTimestamp) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2541,43 +2261,32 @@ func (m *VscUnbondingOps) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *VscUnbondingOps) MarshalTo(dAtA []byte) (int, error) { +func (m *InitTimeoutTimestamp) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *VscUnbondingOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *InitTimeoutTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.UnbondingOpIds) > 0 { - dAtA15 := make([]byte, len(m.UnbondingOpIds)*10) - var j14 int - for _, num := range m.UnbondingOpIds { - for num >= 1<<7 { - dAtA15[j14] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j14++ - } - dAtA15[j14] = uint8(num) - j14++ - } - i -= j14 - copy(dAtA[i:], dAtA15[:j14]) - i = encodeVarintProvider(dAtA, i, uint64(j14)) + if m.Timestamp != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Timestamp)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if m.VscId != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *UnbondingOp) Marshal() (dAtA []byte, err error) { +func (m *ValidatorSetChangePackets) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2587,34 +2296,34 @@ func (m *UnbondingOp) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *UnbondingOp) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatorSetChangePackets) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *UnbondingOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatorSetChangePackets) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.UnbondingConsumerChains) > 0 { - for iNdEx := len(m.UnbondingConsumerChains) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.UnbondingConsumerChains[iNdEx]) - copy(dAtA[i:], m.UnbondingConsumerChains[iNdEx]) - i = encodeVarintProvider(dAtA, i, uint64(len(m.UnbondingConsumerChains[iNdEx]))) + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa } } - if m.Id != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } -func (m *InitTimeoutTimestamp) Marshal() (dAtA []byte, err error) { +func (m *KeyAssignmentReplacement) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2624,32 +2333,44 @@ func (m *InitTimeoutTimestamp) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InitTimeoutTimestamp) MarshalTo(dAtA []byte) (int, error) { +func (m *KeyAssignmentReplacement) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *InitTimeoutTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *KeyAssignmentReplacement) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Timestamp != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Timestamp)) + if m.Power != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Power)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) + if m.PrevCKey != nil { + { + size, err := m.PrevCKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ProviderAddr) > 0 { + i -= len(m.ProviderAddr) + copy(dAtA[i:], m.ProviderAddr) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderAddr))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *VscSendTimestamp) Marshal() (dAtA []byte, err error) { +func (m *ValidatorConsumerPubKey) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2659,239 +2380,34 @@ func (m *VscSendTimestamp) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *VscSendTimestamp) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatorConsumerPubKey) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *VscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatorConsumerPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) - if err16 != nil { - return 0, err16 + if m.ConsumerKey != nil { + { + size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - i -= n16 - i = encodeVarintProvider(dAtA, i, uint64(n16)) - i-- - dAtA[i] = 0x12 - if m.VscId != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) + if len(m.ProviderAddr) > 0 { + i -= len(m.ProviderAddr) + copy(dAtA[i:], m.ProviderAddr) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderAddr))) i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ValidatorSetChangePackets) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ValidatorSetChangePackets) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorSetChangePackets) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.List) > 0 { - for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MaturedUnbondingOps) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MaturedUnbondingOps) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MaturedUnbondingOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Ids) > 0 { - dAtA18 := make([]byte, len(m.Ids)*10) - var j17 int - for _, num := range m.Ids { - for num >= 1<<7 { - dAtA18[j17] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j17++ - } - dAtA18[j17] = uint8(num) - j17++ - } - i -= j17 - copy(dAtA[i:], dAtA18[:j17]) - i = encodeVarintProvider(dAtA, i, uint64(j17)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExportedVscSendTimestamp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExportedVscSendTimestamp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExportedVscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.VscSendTimestamps) > 0 { - for iNdEx := len(m.VscSendTimestamps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.VscSendTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *KeyAssignmentReplacement) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KeyAssignmentReplacement) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *KeyAssignmentReplacement) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Power != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Power)) - i-- - dAtA[i] = 0x18 - } - if m.PrevCKey != nil { - { - size, err := m.PrevCKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ProviderAddr) > 0 { - i -= len(m.ProviderAddr) - copy(dAtA[i:], m.ProviderAddr) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValidatorConsumerPubKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ValidatorConsumerPubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorConsumerPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsumerKey != nil { - { - size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.ProviderAddr) > 0 { - i -= len(m.ProviderAddr) - copy(dAtA[i:], m.ProviderAddr) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderAddr))) - i-- - dAtA[i] = 0x12 + dAtA[i] = 0x12 } if len(m.ChainId) > 0 { i -= len(m.ChainId) @@ -3413,43 +2929,6 @@ func (m *ChannelToChain) Size() (n int) { return n } -func (m *VscUnbondingOps) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.VscId != 0 { - n += 1 + sovProvider(uint64(m.VscId)) - } - if len(m.UnbondingOpIds) > 0 { - l = 0 - for _, e := range m.UnbondingOpIds { - l += sovProvider(uint64(e)) - } - n += 1 + sovProvider(uint64(l)) + l - } - return n -} - -func (m *UnbondingOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovProvider(uint64(m.Id)) - } - if len(m.UnbondingConsumerChains) > 0 { - for _, s := range m.UnbondingConsumerChains { - l = len(s) - n += 1 + l + sovProvider(uint64(l)) - } - } - return n -} - func (m *InitTimeoutTimestamp) Size() (n int) { if m == nil { return 0 @@ -3466,20 +2945,6 @@ func (m *InitTimeoutTimestamp) Size() (n int) { return n } -func (m *VscSendTimestamp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.VscId != 0 { - n += 1 + sovProvider(uint64(m.VscId)) - } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) - n += 1 + l + sovProvider(uint64(l)) - return n -} - func (m *ValidatorSetChangePackets) Size() (n int) { if m == nil { return 0 @@ -3495,41 +2960,6 @@ func (m *ValidatorSetChangePackets) Size() (n int) { return n } -func (m *MaturedUnbondingOps) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Ids) > 0 { - l = 0 - for _, e := range m.Ids { - l += sovProvider(uint64(e)) - } - n += 1 + sovProvider(uint64(l)) + l - } - return n -} - -func (m *ExportedVscSendTimestamp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if len(m.VscSendTimestamps) > 0 { - for _, e := range m.VscSendTimestamps { - l = e.Size() - n += 1 + l + sovProvider(uint64(l)) - } - } - return n -} - func (m *KeyAssignmentReplacement) Size() (n int) { if m == nil { return 0 @@ -5975,7 +5405,7 @@ func (m *ChannelToChain) Unmarshal(dAtA []byte) error { } return nil } -func (m *VscUnbondingOps) Unmarshal(dAtA []byte) error { +func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5998,263 +5428,17 @@ func (m *VscUnbondingOps) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: VscUnbondingOps: wiretype end group for non-group") + return fmt.Errorf("proto: InitTimeoutTimestamp: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: VscUnbondingOps: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InitTimeoutTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - m.VscId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.VscId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UnbondingOpIds = append(m.UnbondingOpIds, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.UnbondingOpIds) == 0 { - m.UnbondingOpIds = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UnbondingOpIds = append(m.UnbondingOpIds, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOpIds", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UnbondingOp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UnbondingOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnbondingOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingConsumerChains", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UnbondingConsumerChains = append(m.UnbondingConsumerChains, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: InitTimeoutTimestamp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InitTimeoutTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -6322,108 +5506,6 @@ func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { } return nil } -func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VscSendTimestamp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VscSendTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) - } - m.VscId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.VscId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -6508,248 +5590,6 @@ func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { } return nil } -func (m *MaturedUnbondingOps) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MaturedUnbondingOps: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MaturedUnbondingOps: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Ids = append(m.Ids, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.Ids) == 0 { - m.Ids = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Ids = append(m.Ids, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExportedVscSendTimestamp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExportedVscSendTimestamp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExportedVscSendTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VscSendTimestamps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VscSendTimestamps = append(m.VscSendTimestamps, VscSendTimestamp{}) - if err := m.VscSendTimestamps[len(m.VscSendTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 73509c8f575ad3cfaaa69bfd735b1e2b41eca905 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:42:02 +0200 Subject: [PATCH 15/81] remove TODO --- proto/interchain_security/ccv/provider/v1/genesis.proto | 1 - x/ccv/provider/types/genesis.pb.go | 1 - 2 files changed, 2 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 783cc32abb..7a5a897929 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -59,7 +59,6 @@ message ConsumerState { [ (gogoproto.nullable) = false ]; // PendingValsetChanges defines the pending validator set changes for the // consumer chain - // TODO (mpoke) remove repeated interchain_security.ccv.v1.ValidatorSetChangePacketData pending_valset_changes = 6 [ (gogoproto.nullable) = false ]; repeated string slash_downtime_ack = 7; diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index 85b6f2121f..a6d26b1db5 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -165,7 +165,6 @@ type ConsumerState struct { ConsumerGenesis types.ConsumerGenesisState `protobuf:"bytes,5,opt,name=consumer_genesis,json=consumerGenesis,proto3" json:"consumer_genesis"` // PendingValsetChanges defines the pending validator set changes for the // consumer chain - // TODO (mpoke) remove PendingValsetChanges []types.ValidatorSetChangePacketData `protobuf:"bytes,6,rep,name=pending_valset_changes,json=pendingValsetChanges,proto3" json:"pending_valset_changes"` SlashDowntimeAck []string `protobuf:"bytes,7,rep,name=slash_downtime_ack,json=slashDowntimeAck,proto3" json:"slash_downtime_ack,omitempty"` } From 8657fbd24bd53792342fbe26ba15ae9bf252a9d4 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:52:15 +0200 Subject: [PATCH 16/81] remove unbonding integration tests --- tests/integration/unbonding.go | 512 --------------------------------- 1 file changed, 512 deletions(-) delete mode 100644 tests/integration/unbonding.go diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go deleted file mode 100644 index a8398843aa..0000000000 --- a/tests/integration/unbonding.go +++ /dev/null @@ -1,512 +0,0 @@ -package integration - -import ( - "time" - - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - - providerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" - ccv "github.com/cosmos/interchain-security/v4/x/ccv/types" -) - -// TestUndelegationNormalOperation tests that undelegations complete after -// the unbonding period elapses on both the consumer and provider, without -// VSC packets timing out. -func (s *CCVTestSuite) TestUndelegationNormalOperation() { - unbondConsumer := func(expectedPackets int) { - // relay 1 VSC packet from provider to consumer - relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, expectedPackets) - // increment time so that the unbonding period ends on the consumer - incrementTimeByUnbondingPeriod(s, Consumer) - // relay 1 VSCMatured packet from consumer to provider - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, expectedPackets) - } - - testCases := []struct { - name string - shareDiv int64 - unbond func(expBalance, balance math.Int) - }{ - { - "provider unbonding period elapses first", 2, func(expBalance, balance math.Int) { - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // check that onHold is true - checkStakingUnbondingOps(s, 1, true, true, "unbonding should be on hold") - - // check that the unbonding is not complete - s.Require().Equal(expBalance, balance, "unexpected balance after provider unbonding") - - // undelegation complete on consumer - unbondConsumer(1) - }, - }, - { - "consumer unbonding period elapses first", 2, func(expBalance, balance math.Int) { - // undelegation complete on consumer - unbondConsumer(1) - - // check that onHold is false - checkStakingUnbondingOps(s, 1, true, false, "unbonding should be not be on hold") - - // check that the unbonding is not complete - s.Require().Equal(expBalance, balance, "unexpected balance after consumer unbonding") - - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - }, - }, - { - "no valset changes", 1, func(expBalance, balance math.Int) { - // undelegation complete on consumer - unbondConsumer(1) - - // check that onHold is false - checkStakingUnbondingOps(s, 1, true, false, "unbonding should be not be on hold") - - // check that the unbonding is not complete - s.Require().Equal(expBalance, balance, "unexpected balance after consumer unbonding") - - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - }, - }, - } - - for i, tc := range testCases { - providerKeeper := s.providerApp.GetProviderKeeper() - consumerKeeper := s.consumerApp.GetConsumerKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - s.SetupCCVChannel(s.path) - - // set VSC timeout period to not trigger the removal of the consumer chain - providerUnbondingPeriod := stakingKeeper.UnbondingTime(s.providerCtx()) - consumerUnbondingPeriod := consumerKeeper.GetUnbondingPeriod(s.consumerCtx()) - providerKeeper.SetVscTimeoutPeriod(s.providerCtx(), providerUnbondingPeriod+consumerUnbondingPeriod+24*time.Hour) - - // delegate bondAmt and undelegate tc.shareDiv of it - bondAmt := sdk.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, tc.shareDiv) - // - check that staking unbonding op was created and onHold is true - checkStakingUnbondingOps(s, 1, true, true, "test: "+tc.name) - // - check that CCV unbonding op was created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true, "test: "+tc.name) - - // call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() - - // unbond both on provider and consumer and check that - // the balance remains unchanged in between - tc.unbond(initBalance.Sub(bondAmt), getBalance(s, s.providerCtx(), delAddr)) - - // check that the unbonding operation completed - // - check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false, "test: "+tc.name) - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false, "test: "+tc.name) - // - check that necessary delegated coins have been returned - unbondAmt := bondAmt.Sub(bondAmt.Quo(sdk.NewInt(tc.shareDiv))) - s.Require().Equal( - initBalance.Sub(unbondAmt), - getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance after unbonding; test: %s", tc.name, - ) - - if i+1 < len(testCases) { - // reset suite to reset provider client - s.SetupTest() - } - } -} - -// TestUndelegationVscTimeout tests that an undelegation -// completes after vscTimeoutPeriod even if it does not -// reach maturity on the consumer chain. In this case, -// the consumer chain is removed. -func (s *CCVTestSuite) TestUndelegationVscTimeout() { - providerKeeper := s.providerApp.GetProviderKeeper() - - s.SetupCCVChannel(s.path) - - // set VSC timeout period to trigger the removal of the consumer chain - vscTimeout := providerKeeper.GetVscTimeoutPeriod(s.providerCtx()) - - // delegate bondAmt and undelegate 1/2 of it - bondAmt := sdk.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) - // - check that staking unbonding op was created and onHold is true - checkStakingUnbondingOps(s, 1, true, true) - // - check that CCV unbonding op was created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) - - // call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() - - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // check that onHold is true - checkStakingUnbondingOps(s, 1, true, true, "unbonding should be on hold") - - // check that the unbonding is not complete - s.Require().Equal( - initBalance.Sub(bondAmt), - getBalance(s, s.providerCtx(), delAddr), - "unexpected balance after provider unbonding") - - // increment time - incrementTime(s, vscTimeout) - - // check whether the chain was removed - chainID := s.consumerChain.ChainID - _, found := providerKeeper.GetConsumerClientId(s.providerCtx(), chainID) - s.Require().Equal(false, found, "consumer chain was not removed") - - // check if the chain was properly removed - s.checkConsumerChainIsRemoved(chainID, true) - - // check that the unbonding operation completed - // - check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false) - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false) - // - check that necessary delegated coins have been returned - unbondAmt := bondAmt.Sub(bondAmt.Quo(sdk.NewInt(2))) - s.Require().Equal( - initBalance.Sub(unbondAmt), - getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance after VSC timeout", - ) -} - -// TestUndelegationDuringInit checks that before the CCV channel is established -// - no undelegations can complete, even if the provider unbonding period elapses -// - all the VSC packets are stored in state as pending -// - if the channel handshake times out, then the undelegation completes -func (s *CCVTestSuite) TestUndelegationDuringInit() { - testCases := []struct { - name string - updateInitTimeoutTimestamp func(*providerkeeper.Keeper, time.Duration) - removed bool - }{ - { - "channel handshake completes after unbonding period", func(pk *providerkeeper.Keeper, pUnbondingPeriod time.Duration) { - // change the init timeout timestamp for this consumer chain - // to make sure the chain is not removed before the unbonding period elapses - ts := s.providerCtx().BlockTime().Add(pUnbondingPeriod + 24*time.Hour) - pk.SetInitTimeoutTimestamp(s.providerCtx(), s.consumerChain.ChainID, uint64(ts.UnixNano())) - }, false, - }, - { - "channel handshake times out before unbonding period", func(pk *providerkeeper.Keeper, pUnbondingPeriod time.Duration) { - // change the init timeout timestamp for this consumer chain - // to make sure the chain is removed before the unbonding period elapses - ts := s.providerCtx().BlockTime().Add(pUnbondingPeriod - 24*time.Hour) - pk.SetInitTimeoutTimestamp(s.providerCtx(), s.consumerChain.ChainID, uint64(ts.UnixNano())) - }, true, - }, - } - - for i, tc := range testCases { - providerKeeper := s.providerApp.GetProviderKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - // delegate bondAmt and undelegate 1/2 of it - bondAmt := sdk.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) - // - check that staking unbonding op was created and onHold is true - checkStakingUnbondingOps(s, 1, true, true, "test: "+tc.name) - // - check that CCV unbonding op was created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true, "test: "+tc.name) - - // get provider unbonding period - providerUnbondingPeriod := stakingKeeper.UnbondingTime(s.providerCtx()) - // update init timeout timestamp - tc.updateInitTimeoutTimestamp(&providerKeeper, providerUnbondingPeriod) - - s.nextEpoch() - - // check that the VSC packet is stored in state as pending - pendingVSCs := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) - s.Require().Lenf(pendingVSCs, 1, "no pending VSC packet found; test: %s", tc.name) - - // delegate again to create another VSC packet - delegate(s, delAddr, bondAmt) - - s.nextEpoch() - - // check that the VSC packet is stored in state as pending - pendingVSCs = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) - s.Require().Lenf(pendingVSCs, 2, "only one pending VSC packet found; test: %s", tc.name) - - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // check whether the unbonding op is still there and onHold is true - checkStakingUnbondingOps(s, 1, !tc.removed, true, "test: "+tc.name) - - if !tc.removed { - // check that unbonding has not yet completed, i.e., the initBalance - // is still lower by the bond amount, because it has been taken out of - // the delegator's account - s.Require().Equal( - initBalance.Sub(bondAmt).Sub(bondAmt), - getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance before unbonding; test: %s", tc.name, - ) - - // complete CCV channel setup - s.SetupCCVChannel(s.path) - s.nextEpoch() - - // relay VSC packets from provider to consumer - relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 2) - - // increment time so that the unbonding period ends on the consumer - incrementTimeByUnbondingPeriod(s, Consumer) - - // relay VSCMatured packets from consumer to provider - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 2) - - // check that the unbonding operation completed - // - check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false, "test: "+tc.name) - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false, "test: "+tc.name) - // - check that one quarter the delegated coins have been returned - s.Require().Equal( - initBalance.Sub(bondAmt).Sub(bondAmt.Quo(sdk.NewInt(2))), - getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance after unbonding; test: %s", tc.name, - ) - } - - if i+1 < len(testCases) { - // reset suite to reset provider client - s.SetupTest() - } - } -} - -// Bond some tokens on provider -// Unbond them to create unbonding op -// Check unbonding ops on both sides -// Advance time so that provider's unbonding op completes -// Check that unbonding has completed in provider staking -func (s *CCVTestSuite) TestUnbondingNoConsumer() { - providerKeeper := s.providerApp.GetProviderKeeper() - providerStakingKeeper := s.providerApp.GetTestStakingKeeper() - - // remove all consumer chains, which were already started during setup - for chainID := range s.consumerBundles { - err := providerKeeper.StopConsumerChain(s.providerCtx(), chainID, true) - s.Require().NoError(err) - } - - // delegate bondAmt and undelegate 1/2 of it - bondAmt := sdk.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) - // - check that staking unbonding op was created and onHold is FALSE - checkStakingUnbondingOps(s, 1, true, false) - // - check that CCV unbonding op was NOT created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false) - - // increment time so that the unbonding period ends on the provider; - // cannot use incrementTimeByUnbondingPeriod() since it tries - // to also update the provider's client on the consumer - providerUnbondingPeriod := providerStakingKeeper.UnbondingTime(s.providerCtx()) - s.coordinator.IncrementTimeBy(providerUnbondingPeriod + time.Hour) - - // call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() - - // check that the unbonding operation completed - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false) - // - check that half the coins have been returned - s.Require().True(getBalance(s, s.providerCtx(), delAddr).Equal(initBalance.Sub(bondAmt.Quo(sdk.NewInt(2))))) -} - -// TestRedelegationNoConsumer tests a redelegate transaction -// submitted on a provider chain with no consumers -func (s *CCVTestSuite) TestRedelegationNoConsumer() { - providerKeeper := s.providerApp.GetProviderKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - // stop the consumer chain, which was already started during setup - err := providerKeeper.StopConsumerChain(s.providerCtx(), s.consumerChain.ChainID, true) - s.Require().NoError(err) - - // Setup delegator, bond amount, and src/dst validators - bondAmt := sdk.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - _, srcVal := s.getValByIdx(0) - _, dstVal := s.getValByIdx(1) - - delegateAndRedelegate( - s, - delAddr, - srcVal, - dstVal, - bondAmt, - ) - - // 1 redelegation record should exist for original delegator - redelegations := checkRedelegations(s, delAddr, 1) - - // Check that the only entry has appropriate maturation time, the unbonding period from now - checkRedelegationEntryCompletionTime( - s, - redelegations[0].Entries[0], - s.providerCtx().BlockTime().Add(stakingKeeper.UnbondingTime(s.providerCtx())), - ) - - // required before call to incrementTimeByUnbondingPeriod or else a panic - // occurs in ibc-go because trusted validators don't match last trusted. - s.providerChain.NextBlock() - - // Increment time so that the unbonding period passes on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // Call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() - - // No redelegation records should exist for original delegator anymore - checkRedelegations(s, delAddr, 0) -} - -// TestRedelegationWithConsumer tests a redelegate transaction submitted on a provider chain -// when the unbonding period elapses first on the provider chain -func (s *CCVTestSuite) TestRedelegationProviderFirst() { - s.SetupCCVChannel(s.path) - s.SetupTransferChannel() - - providerKeeper := s.providerApp.GetProviderKeeper() - consumerKeeper := s.consumerApp.GetConsumerKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - // set VSC timeout period to not trigger the removal of the consumer chain - providerUnbondingPeriod := stakingKeeper.UnbondingTime(s.providerCtx()) - consumerUnbondingPeriod := consumerKeeper.GetUnbondingPeriod(s.consumerCtx()) - providerKeeper.SetVscTimeoutPeriod(s.providerCtx(), providerUnbondingPeriod+consumerUnbondingPeriod+24*time.Hour) - - // Setup delegator, bond amount, and src/dst validators - bondAmt := sdk.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - _, srcVal := s.getValByIdx(0) - _, dstVal := s.getValByIdx(1) - - delegateAndRedelegate( - s, - delAddr, - srcVal, - dstVal, - bondAmt, - ) - - // 1 redelegation record should exist for original delegator - redelegations := checkRedelegations(s, delAddr, 1) - - // Check that the only entry has appropriate maturation time, the unbonding period from now - checkRedelegationEntryCompletionTime( - s, - redelegations[0].Entries[0], - s.providerCtx().BlockTime().Add(stakingKeeper.UnbondingTime(s.providerCtx())), - ) - - // Save the current valset update ID - valsetUpdateID := providerKeeper.GetValidatorSetUpdateId(s.providerCtx()) - - // Check that CCV unbonding op was created from AfterUnbondingInitiated hook - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) - - // move forward by an epoch to be able to relay VSC packets - s.nextEpoch() - - // Relay 2 VSC packets from provider to consumer (original delegation, and redelegation) - relayAllCommittedPackets(s, s.providerChain, s.path, - ccv.ProviderPortID, s.path.EndpointB.ChannelID, 2) - - // Increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // 1 redelegation record should still exist for original delegator on provider - checkRedelegations(s, delAddr, 1) - - // CCV unbonding op should also still exist - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) - - // Increment time so that the unbonding period ends on the consumer - incrementTimeByUnbondingPeriod(s, Consumer) - - // Relay 2 VSCMatured packets from consumer to provider (original delegation and redelegation) - relayAllCommittedPackets(s, s.consumerChain, - s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 2) - - // - // Check that the redelegation operation has now completed on provider - // - - // Redelegation record should be deleted for original delegator - checkRedelegations(s, delAddr, 0) - - // Check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false) -} - -// This test reproduces a fixed bug when an inactive validator enters back into the active set. -// It used to cause a panic in the provider module hook called by AfterUnbondingInitiated -// during the staking module EndBlock. -func (s *CCVTestSuite) TestTooManyLastValidators() { - sk := s.providerApp.GetTestStakingKeeper() - - // get current staking params - p := sk.GetParams(s.providerCtx()) - - // get validators, which are all active at the moment - vals := sk.GetAllValidators(s.providerCtx()) - s.Require().Equal(len(vals), len(sk.GetLastValidators(s.providerCtx()))) - - // jail a validator - val := vals[0] - consAddr, err := val.GetConsAddr() - s.Require().NoError(err) - sk.Jail(s.providerCtx(), consAddr) - - // save the current number of bonded vals - lastVals := sk.GetLastValidators(s.providerCtx()) - - // pass one block to apply the validator set changes - // (calls ApplyAndReturnValidatorSetUpdates in the the staking module EndBlock) - s.providerChain.NextBlock() - - // verify that the number of bonded validators is decreased by one - s.Require().Equal(len(lastVals)-1, len(sk.GetLastValidators(s.providerCtx()))) - - // update maximum validator to equal the number of bonded validators - p.MaxValidators = uint32(len(sk.GetLastValidators(s.providerCtx()))) - sk.SetParams(s.providerCtx(), p) - - // pass one block to apply validator set changes - s.providerChain.NextBlock() - - // unjail validator - // Note that since validators are sorted in descending order, the unjailed validator - // enters the active set again since it's ranked first by voting power. - sk.Unjail(s.providerCtx(), consAddr) - - // pass another block to update the validator set - // which causes a panic due to a GetLastValidator call in - // ApplyAndReturnValidatorSetUpdates where the staking module has a inconsistent state - s.Require().NotPanics(s.providerChain.NextBlock) - s.Require().NotPanics(func() { sk.ApplyAndReturnValidatorSetUpdates(s.providerCtx()) }) - s.Require().NotPanics(func() { sk.GetLastValidators(s.providerCtx()) }) -} From 7767adb01eac98fd0d81d20d68d38d0bc90bd12f Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:53:01 +0200 Subject: [PATCH 17/81] fix checkConsumerChainIsRemoved --- tests/integration/stop_consumer.go | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tests/integration/stop_consumer.go b/tests/integration/stop_consumer.go index 6e72679ccd..7f95a76a51 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -128,25 +128,12 @@ func (s *CCVTestSuite) TestStopConsumerOnChannelClosed() { func (s *CCVTestSuite) checkConsumerChainIsRemoved(chainID string, checkChannel bool) { channelID := s.path.EndpointB.ChannelID providerKeeper := s.providerApp.GetProviderKeeper() - providerStakingKeeper := s.providerApp.GetTestStakingKeeper() if checkChannel { // check channel's state is closed s.Require().Equal(channeltypes.CLOSED, s.path.EndpointB.GetChannel().State) } - // check UnbondingOps were deleted and undelegation entries aren't onHold - for _, unbondingOpsIndex := range providerKeeper.GetAllUnbondingOpIndexes(s.providerCtx(), chainID) { - _, found := providerKeeper.GetUnbondingOpIndex(s.providerCtx(), chainID, unbondingOpsIndex.VscId) - s.Require().False(found) - for _, ubdID := range unbondingOpsIndex.UnbondingOpIds { - _, found = providerKeeper.GetUnbondingOp(s.providerCtx(), unbondingOpsIndex.UnbondingOpIds[ubdID]) - s.Require().False(found) - ubd, _ := providerStakingKeeper.GetUnbondingDelegationByUnbondingID(s.providerCtx(), unbondingOpsIndex.UnbondingOpIds[ubdID]) - s.Require().Zero(ubd.Entries[ubdID].UnbondingOnHoldRefCount) - } - } - // verify consumer chain's states are removed _, found := providerKeeper.GetConsumerGenesis(s.providerCtx(), chainID) s.Require().False(found) From cb319df61f56c23768fa38ccfbc49b380756210a Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:53:17 +0200 Subject: [PATCH 18/81] remove checkCCVUnbondingOp --- tests/integration/common.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tests/integration/common.go b/tests/integration/common.go index 18b657ae56..db78ac9c51 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -326,28 +326,6 @@ func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found, onHold bool, ms } } -func checkCCVUnbondingOp(s *CCVTestSuite, providerCtx sdk.Context, chainID string, valUpdateID uint64, found bool, msgAndArgs ...interface{}) { - entries := s.providerApp.GetProviderKeeper().GetUnbondingOpsFromIndex(providerCtx, chainID, valUpdateID) - if found { - s.Require().NotEmpty(entries, fmt.Sprintf("checkCCVUnbondingOp failed - should not be empty; %s", msgAndArgs...)) - s.Require().Greater( - len(entries), - 0, - fmt.Sprintf("checkCCVUnbondingOp failed - no unbonding ops found; %s", msgAndArgs...), - ) - s.Require().Greater( - len(entries[0].UnbondingConsumerChains), - 0, - fmt.Sprintf("checkCCVUnbondingOp failed - unbonding op with no consumer chains; %s", msgAndArgs...), - ) - s.Require().Equal( - "testchain2", - entries[0].UnbondingConsumerChains[0], - fmt.Sprintf("checkCCVUnbondingOp failed - unbonding op with unexpected consumer chain; %s", msgAndArgs...), - ) - } -} - // Checks that an expected amount of redelegations exist for a delegator // via the staking keeper, then returns those redelegations. func checkRedelegations(s *CCVTestSuite, delAddr sdk.AccAddress, From 6f31e5cccedea6ac952ab2d77128414629300a08 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:53:41 +0200 Subject: [PATCH 19/81] TestProviderStateIsCleanedAfterConsumerChainIsStopped --- testutil/keeper/unit_test_helpers.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index ef208cb907..0161d15d20 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -248,8 +248,6 @@ func TestProviderStateIsCleanedAfterConsumerChainIsStopped(t *testing.T, ctx sdk _, found = providerKeeper.GetInitTimeoutTimestamp(ctx, expectedChainID) require.False(t, found) - require.Empty(t, providerKeeper.GetAllVscSendTimestamps(ctx, expectedChainID)) - // in case the chain was successfully stopped, it should not contain a Top N associated to it _, found = providerKeeper.GetTopN(ctx, expectedChainID) require.False(t, found) From ddb40311e9bcfd6f90cf5585ba203c56aa8b4dea Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 11:57:28 +0200 Subject: [PATCH 20/81] fix TestRelayAndApplyDowntimePacket --- tests/integration/slashing.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 19805a49ad..825e4cf2e2 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -98,15 +98,6 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().Equal(heightBefore+2, heightAfter) // We've now advanced two blocks. - - // VSC packets should have been sent from provider during block N to each consumer - expectedSentValsetUpdateId := valsetUpdateIdN - for _, bundle := range s.consumerBundles { - _, found := providerKeeper.GetVscSendTimestamp(s.providerCtx(), - bundle.Chain.ChainID, expectedSentValsetUpdateId) - s.Require().True(found) - } - s.nextEpoch() // Confirm the valset update Id was incremented twice on provider, @@ -117,6 +108,8 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { // check that the validator was removed from the provider validator set by N + 2 s.Require().Len(s.providerChain.Vals.Validators, validatorsPerChain-1) + // VSC packets should have been sent from provider during block N to each consumer + expectedSentValsetUpdateId := valsetUpdateIdN for _, bundle := range s.consumerBundles { // Relay VSC packets from provider to each consumer relayAllCommittedPackets(s, s.providerChain, bundle.Path, From d95815286ae589d2fa7d917c19851ca8f8bc95b4 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 12:29:32 +0200 Subject: [PATCH 21/81] remove vsc_timeout_period param --- .../ccv/provider/v1/provider.proto | 9 +- x/ccv/provider/keeper/params.go | 13 - x/ccv/provider/keeper/params_test.go | 1 - x/ccv/provider/keeper/proposal_test.go | 4 +- x/ccv/provider/types/genesis_test.go | 16 +- x/ccv/provider/types/params.go | 11 - x/ccv/provider/types/params_test.go | 25 +- x/ccv/provider/types/provider.pb.go | 289 +++++++----------- 8 files changed, 138 insertions(+), 230 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index c5958606b0..60b0634972 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -207,6 +207,9 @@ message GlobalSlashEntry { // Params defines the parameters for CCV Provider module message Params { + // Reserve 5th slot for removed vsc_timeout_period param + reserved 5; + // Reserve 8th slot for removed max throttled packet param reserved 8; @@ -221,12 +224,6 @@ message Params { // after this duration google.protobuf.Duration init_timeout_period = 4 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; - // The VSC packets sent by the provider will timeout after this duration. - // Note that unlike ccv_timeout_period which is an IBC param, - // the vsc_timeout_period is a provider-side param that enables the provider - // to timeout VSC packets even when a consumer chain is not live. - google.protobuf.Duration vsc_timeout_period = 5 - [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; // The period for which the slash meter is replenished google.protobuf.Duration slash_meter_replenish_period = 6 diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index f74baf656e..30bae78745 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -40,18 +40,6 @@ func (k Keeper) GetInitTimeoutPeriod(ctx sdk.Context) time.Duration { return p } -// GetVscTimeoutPeriod returns the vsc timeout period -func (k Keeper) GetVscTimeoutPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramSpace.Get(ctx, types.KeyVscTimeoutPeriod, &p) - return p -} - -// SetVscTimeoutPeriod sets the vsc timeout period -func (k Keeper) SetVscTimeoutPeriod(ctx sdk.Context, period time.Duration) { - k.paramSpace.Set(ctx, types.KeyVscTimeoutPeriod, period) -} - // GetSlashMeterReplenishPeriod returns the period in which: // Once the slash meter becomes not-full, the slash meter is replenished after this period. func (k Keeper) GetSlashMeterReplenishPeriod(ctx sdk.Context) time.Duration { @@ -92,7 +80,6 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { k.GetTrustingPeriodFraction(ctx), k.GetCCVTimeoutPeriod(ctx), k.GetInitTimeoutPeriod(ctx), - k.GetVscTimeoutPeriod(ctx), k.GetSlashMeterReplenishPeriod(ctx), k.GetSlashMeterReplenishFraction(ctx), k.GetConsumerRewardDenomRegistrationFee(ctx), diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index 88175431c0..52d1cb7451 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -41,7 +41,6 @@ func TestParams(t *testing.T) { "0.25", 7*24*time.Hour, 5*time.Hour, - 10*time.Minute, time.Hour, "0.4", sdk.Coin{ diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index c561960a49..f412da935b 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -3,11 +3,12 @@ package keeper_test import ( "bytes" "encoding/json" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "sort" "testing" "time" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" _go "github.com/cosmos/ics23/go" @@ -831,7 +832,6 @@ func TestMakeConsumerGenesis(t *testing.T) { TrustingPeriodFraction: providertypes.DefaultTrustingPeriodFraction, CcvTimeoutPeriod: ccvtypes.DefaultCCVTimeoutPeriod, InitTimeoutPeriod: providertypes.DefaultInitTimeoutPeriod, - VscTimeoutPeriod: providertypes.DefaultVscTimeoutPeriod, SlashMeterReplenishPeriod: providertypes.DefaultSlashMeterReplenishPeriod, SlashMeterReplenishFraction: providertypes.DefaultSlashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: sdk.Coin{ diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index ef40c1e3d7..12974a6ea7 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -73,7 +73,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -91,7 +91,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -109,7 +109,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -130,7 +130,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -154,7 +153,6 @@ func TestValidateGenesisState(t *testing.T) { "0.0", // 0 trusting period fraction here ccv.DefaultCCVTimeoutPeriod, types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -178,7 +176,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultTrustingPeriodFraction, 0, // 0 ccv timeout here types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}, 600), @@ -202,7 +199,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, 0, // 0 init timeout here - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -226,7 +222,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, 0, // 0 slash meter replenish period here types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -250,7 +245,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -418,7 +412,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -436,7 +430,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600), nil, nil, nil, diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index a0a7a5ed7a..6fec18a30c 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -26,9 +26,6 @@ const ( // DefaultInitTimeoutPeriod defines the init timeout period DefaultInitTimeoutPeriod = 7 * 24 * time.Hour - // DefaultVscTimeoutPeriod defines the VSC timeout period - DefaultVscTimeoutPeriod = 5 * 7 * 24 * time.Hour - // DefaultSlashMeterReplenishPeriod defines the default period for which the slash gas meter is replenished DefaultSlashMeterReplenishPeriod = time.Hour @@ -48,7 +45,6 @@ var ( KeyTemplateClient = []byte("TemplateClient") KeyTrustingPeriodFraction = []byte("TrustingPeriodFraction") KeyInitTimeoutPeriod = []byte("InitTimeoutPeriod") - KeyVscTimeoutPeriod = []byte("VscTimeoutPeriod") KeySlashMeterReplenishPeriod = []byte("SlashMeterReplenishPeriod") KeySlashMeterReplenishFraction = []byte("SlashMeterReplenishFraction") KeyConsumerRewardDenomRegistrationFee = []byte("ConsumerRewardDenomRegistrationFee") @@ -66,7 +62,6 @@ func NewParams( trustingPeriodFraction string, ccvTimeoutPeriod time.Duration, initTimeoutPeriod time.Duration, - vscTimeoutPeriod time.Duration, slashMeterReplenishPeriod time.Duration, slashMeterReplenishFraction string, consumerRewardDenomRegistrationFee sdk.Coin, @@ -77,7 +72,6 @@ func NewParams( TrustingPeriodFraction: trustingPeriodFraction, CcvTimeoutPeriod: ccvTimeoutPeriod, InitTimeoutPeriod: initTimeoutPeriod, - VscTimeoutPeriod: vscTimeoutPeriod, SlashMeterReplenishPeriod: slashMeterReplenishPeriod, SlashMeterReplenishFraction: slashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: consumerRewardDenomRegistrationFee, @@ -103,7 +97,6 @@ func DefaultParams() Params { DefaultTrustingPeriodFraction, ccvtypes.DefaultCCVTimeoutPeriod, DefaultInitTimeoutPeriod, - DefaultVscTimeoutPeriod, DefaultSlashMeterReplenishPeriod, DefaultSlashMeterReplenishFraction, // Defining this inline because it's not possible to define a constant of type sdk.Coin. @@ -133,9 +126,6 @@ func (p Params) Validate() error { if err := ccvtypes.ValidateDuration(p.InitTimeoutPeriod); err != nil { return fmt.Errorf("init timeout period is invalid: %s", err) } - if err := ccvtypes.ValidateDuration(p.VscTimeoutPeriod); err != nil { - return fmt.Errorf("vsc timeout period is invalid: %s", err) - } if err := ccvtypes.ValidateDuration(p.SlashMeterReplenishPeriod); err != nil { return fmt.Errorf("slash meter replenish period is invalid: %s", err) } @@ -158,7 +148,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyTrustingPeriodFraction, p.TrustingPeriodFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(ccvtypes.KeyCCVTimeoutPeriod, p.CcvTimeoutPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeyInitTimeoutPeriod, p.InitTimeoutPeriod, ccvtypes.ValidateDuration), - paramtypes.NewParamSetPair(KeyVscTimeoutPeriod, p.VscTimeoutPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishPeriod, p.SlashMeterReplenishPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, ValidateCoin), diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 4e72c233af..72a52bb1d5 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -24,39 +24,36 @@ func TestValidateParams(t *testing.T) { {"custom valid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, + "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, {"custom invalid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"blank client", types.NewParams(&ibctmtypes.ClientState{}, - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, - {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, // Check if "0.00" is valid or if a zero dec TrustFraction needs to return an error {"0 trusting period fraction", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, + "0.00", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, {"0 ccv timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"0 init timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, - {"0 vsc timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, - time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"0 slash meter replenish period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"slash meter replenish fraction over 1", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"invalid consumer reward denom registration fee denom", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), false}, {"invalid consumer reward denom registration fee amount", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}, 1000), false}, } for _, tc := range testCases { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index ea00914f57..80cb1e5626 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -578,11 +578,6 @@ type Params struct { // The channel initialization (IBC channel opening handshake) will timeout // after this duration InitTimeoutPeriod time.Duration `protobuf:"bytes,4,opt,name=init_timeout_period,json=initTimeoutPeriod,proto3,stdduration" json:"init_timeout_period"` - // The VSC packets sent by the provider will timeout after this duration. - // Note that unlike ccv_timeout_period which is an IBC param, - // the vsc_timeout_period is a provider-side param that enables the provider - // to timeout VSC packets even when a consumer chain is not live. - VscTimeoutPeriod time.Duration `protobuf:"bytes,5,opt,name=vsc_timeout_period,json=vscTimeoutPeriod,proto3,stdduration" json:"vsc_timeout_period"` // The period for which the slash meter is replenished SlashMeterReplenishPeriod time.Duration `protobuf:"bytes,6,opt,name=slash_meter_replenish_period,json=slashMeterReplenishPeriod,proto3,stdduration" json:"slash_meter_replenish_period"` // The fraction of total voting power that is replenished to the slash meter @@ -656,13 +651,6 @@ func (m *Params) GetInitTimeoutPeriod() time.Duration { return 0 } -func (m *Params) GetVscTimeoutPeriod() time.Duration { - if m != nil { - return m.VscTimeoutPeriod - } - return 0 -} - func (m *Params) GetSlashMeterReplenishPeriod() time.Duration { if m != nil { return m.SlashMeterReplenishPeriod @@ -1414,120 +1402,120 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1802 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcb, 0x6f, 0x1b, 0xc7, - 0x19, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf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xda, 0xc7, 0x0e, 0x66, - 0x9c, 0x38, 0x38, 0xa0, 0x24, 0x94, 0xca, 0x6a, 0xf2, 0x94, 0x0a, 0x38, 0x4a, 0x20, 0xa0, 0x83, - 0xa1, 0x4c, 0xc8, 0xc2, 0x91, 0x24, 0xf4, 0x09, 0x1f, 0xd1, 0x44, 0xb8, 0x78, 0x4b, 0x15, 0x76, - 0x4b, 0x7c, 0xcc, 0x27, 0x91, 0x64, 0xce, 0x19, 0x99, 0x88, 0x94, 0xfb, 0x0e, 0x66, 0x62, 0xc4, - 0x84, 0x43, 0xd4, 0xf9, 0x43, 0x4c, 0x9c, 0x78, 0xbf, 0x4f, 0x24, 0xda, 0xcf, 0x09, 0x99, 0xdf, - 0xa9, 0x5c, 0x1f, 0x89, 0x42, 0x06, 0x33, 0x9a, 0xf9, 0xbd, 0x81, 0x46, 0x34, 0x64, 0x8e, 0xfe, - 0x9b, 0x90, 0xac, 0xdf, 0xd4, 0x80, 0xd9, 0x65, 0xa1, 0x18, 0x8f, 0x08, 0xef, 0xf8, 0x3e, 0x55, - 0xa7, 0xec, 0x71, 0x16, 0x31, 0x81, 0x02, 0xb8, 0x05, 0x16, 0x24, 0x95, 0x01, 0x31, 0x8d, 0xb6, - 0xb1, 0x57, 0x77, 0x93, 0x17, 0xd8, 0x06, 0x0d, 0x9f, 0x08, 0xcc, 0x69, 0xa4, 0x84, 0xcd, 0x79, - 0xcd, 0x2b, 0x93, 0xe0, 0x36, 0xa8, 0x25, 0xa1, 0xa1, 0xbe, 0x59, 0xd1, 0xec, 0x25, 0xfd, 0xfe, - 0xc0, 0x87, 0x1f, 0x83, 0x55, 0x1a, 0x52, 0x49, 0x51, 0xe0, 0x0d, 0x89, 0xba, 0x20, 0xb3, 0xda, - 0x36, 0xf6, 0x1a, 0x07, 0x3b, 0x36, 0xed, 0x63, 0x5b, 0xdd, 0xa9, 0x9d, 0xde, 0x64, 0xbc, 0x6f, - 0xdf, 0xd7, 0x12, 0x87, 0xd5, 0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- 0x92, 0x93, 0xac, 0xdf, 0x1a, 0x45, 0x8b, 0x4c, 0x7a, 0xb4, 0xe8, 0x04, 0x41, 0xba, 0xe8, 0xc1, - 0x08, 0x2c, 0x25, 0x63, 0x40, 0xa4, 0x15, 0xb7, 0x7b, 0x65, 0xc3, 0x3f, 0x22, 0x58, 0xf7, 0xfc, - 0x3b, 0xaa, 0xaa, 0xfe, 0xf6, 0x5d, 0xeb, 0xd6, 0x80, 0xca, 0xe1, 0xb8, 0x6f, 0x63, 0x36, 0x72, - 0xd2, 0x8f, 0x1b, 0xc9, 0xbf, 0xdb, 0xc2, 0x3f, 0x73, 0xe4, 0x24, 0x22, 0x22, 0xd3, 0x11, 0x7f, - 0xfd, 0xf7, 0x3f, 0xde, 0x35, 0xdc, 0xcc, 0xcc, 0xe1, 0x93, 0xaf, 0x9f, 0x37, 0x8d, 0x6f, 0x9e, - 0x37, 0x8d, 0x7f, 0x3d, 0x6f, 0x1a, 0x5f, 0xbc, 0x68, 0xce, 0x7d, 0xf3, 0xa2, 0x39, 0xf7, 0xcf, - 0x17, 0xcd, 0xb9, 0x9f, 0x7f, 0x70, 0x19, 0xb4, 0x88, 0xd1, 0xed, 0xfc, 0x73, 0x52, 0xfc, 0x53, - 0xe7, 0x97, 0xd3, 0x1f, 0xab, 0xb4, 0xbd, 0xfe, 0xa2, 0x9e, 0xab, 0xef, 0xff, 0x37, 0x00, 0x00, - 0xff, 0xff, 0x4c, 0x7f, 0xe4, 0xb1, 0xdd, 0x12, 0x00, 0x00, + // 1797 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, + 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xe2, 0x95, 0xaa, 0x92, 0xf4, 0xa6, 0x09, + 0xd4, 0xb8, 0xde, 0x8d, 0x94, 0x1e, 0x0c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 0x22, + 0xad, 0xb8, 0xdd, 0x2b, 0xdb, 0xfe, 0x11, 0xc1, 0xba, 0xf3, 0xdf, 0x51, 0x55, 0xf5, 0xb7, 0x6f, + 0x5b, 0xb7, 0x06, 0x54, 0x0e, 0xc7, 0x7d, 0x1b, 0xb3, 0x91, 0x93, 0x7e, 0x8f, 0x48, 0xfe, 0xdd, + 0x16, 0xfe, 0x99, 0x23, 0x27, 0x11, 0x11, 0x99, 0x8d, 0xf8, 0xeb, 0xbf, 0xff, 0xf1, 0xae, 0xe1, + 0x66, 0xdb, 0x1c, 0x3e, 0xf9, 0xea, 0x79, 0xd3, 0xf8, 0xfa, 0x79, 0xd3, 0xf8, 0xd7, 0xf3, 0xa6, + 0xf1, 0xf9, 0x8b, 0xe6, 0xdc, 0xd7, 0x2f, 0x9a, 0x73, 0xff, 0x7c, 0xd1, 0x9c, 0xfb, 0xd9, 0x07, + 0x97, 0x41, 0x8b, 0x3b, 0xba, 0x9d, 0x7f, 0x01, 0x8a, 0x7f, 0xec, 0xfc, 0x62, 0xfa, 0xfb, 0x92, + 0xde, 0xaf, 0xbf, 0xa8, 0xd9, 0xf5, 0xfd, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x92, 0xb4, 0x94, + 0x25, 0x90, 0x12, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2030,29 +2018,21 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintProvider(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x32 - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.VscTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VscTimeoutPeriod):]) + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) if err10 != nil { return 0, err10 } i -= n10 i = encodeVarintProvider(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x2a - n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) + dAtA[i] = 0x22 + n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) if err11 != nil { return 0, err11 } i -= n11 i = encodeVarintProvider(dAtA, i, uint64(n11)) i-- - dAtA[i] = 0x22 - n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) - if err12 != nil { - return 0, err12 - } - i -= n12 - i = encodeVarintProvider(dAtA, i, uint64(n12)) - i-- dAtA[i] = 0x1a if len(m.TrustingPeriodFraction) > 0 { i -= len(m.TrustingPeriodFraction) @@ -2836,8 +2816,6 @@ func (m *Params) Size() (n int) { n += 1 + l + sovProvider(uint64(l)) l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.InitTimeoutPeriod) n += 1 + l + sovProvider(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VscTimeoutPeriod) - n += 1 + l + sovProvider(uint64(l)) l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.SlashMeterReplenishPeriod) n += 1 + l + sovProvider(uint64(l)) l = len(m.SlashMeterReplenishFraction) @@ -4788,39 +4766,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VscTimeoutPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.VscTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlashMeterReplenishPeriod", wireType) From bf23c1ef12e15e1877134c689db9152798f90d4a Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 12:49:53 +0200 Subject: [PATCH 22/81] add TestUndelegationCompletion --- tests/integration/common.go | 29 +++-------- tests/integration/unbonding.go | 84 ++++++++++++++++++++++++++++++ testutil/integration/debug_test.go | 24 +-------- 3 files changed, 93 insertions(+), 44 deletions(-) create mode 100644 tests/integration/unbonding.go diff --git a/tests/integration/common.go b/tests/integration/common.go index db78ac9c51..d1e383f55b 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -298,6 +298,7 @@ func relayAllCommittedPackets( // // Note that it is expected for the provider unbonding period // to be one day larger than the consumer unbonding period. +// TODO (mpoke) get rid of consumer unbonding period func incrementTimeByUnbondingPeriod(s *CCVTestSuite, chainType ChainType) { // Get unboding periods providerUnbondingPeriod := s.providerApp.GetTestStakingKeeper().UnbondingTime(s.providerCtx()) @@ -311,7 +312,7 @@ func incrementTimeByUnbondingPeriod(s *CCVTestSuite, chainType ChainType) { incrementTime(s, jumpPeriod) } -func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found, onHold bool, msgAndArgs ...interface{}) { +func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found bool, msgAndArgs ...interface{}) { stakingUnbondingOp, wasFound := getStakingUnbondingDelegationEntry(s.providerCtx(), s.providerApp.GetTestStakingKeeper(), id) s.Require().Equal( found, @@ -319,31 +320,15 @@ func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found, onHold bool, ms fmt.Sprintf("checkStakingUnbondingOps failed - getStakingUnbondingDelegationEntry; %s", msgAndArgs...), ) if wasFound { - s.Require().True( - onHold == (0 < stakingUnbondingOp.UnbondingOnHoldRefCount), - fmt.Sprintf("checkStakingUnbondingOps failed - onHold; %s", msgAndArgs...), + // make sure UnbondingOnHoldRefCount remains zero + s.Require().Equal( + 0, + stakingUnbondingOp.UnbondingOnHoldRefCount, + fmt.Sprintf("checkStakingUnbondingOps failed - UnbondingOnHoldRefCount; %s", msgAndArgs...), ) } } -// Checks that an expected amount of redelegations exist for a delegator -// via the staking keeper, then returns those redelegations. -func checkRedelegations(s *CCVTestSuite, delAddr sdk.AccAddress, - expect uint16, -) []stakingtypes.Redelegation { - redelegations := s.providerApp.GetTestStakingKeeper().GetRedelegations(s.providerCtx(), delAddr, 2) - - s.Require().Len(redelegations, int(expect)) - return redelegations -} - -// Checks that a redelegation entry has a completion time equal to an expected time -func checkRedelegationEntryCompletionTime( - s *CCVTestSuite, entry stakingtypes.RedelegationEntry, expectedCompletion time.Time, -) { - s.Require().Equal(expectedCompletion, entry.CompletionTime) -} - func getStakingUnbondingDelegationEntry(ctx sdk.Context, k testutil.TestStakingKeeper, id uint64) (stakingUnbondingOp stakingtypes.UnbondingDelegationEntry, found bool) { stakingUbd, found := k.GetUnbondingDelegationByUnbondingID(ctx, id) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go new file mode 100644 index 0000000000..b53d1a5a51 --- /dev/null +++ b/tests/integration/unbonding.go @@ -0,0 +1,84 @@ +package integration + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// TestUndelegationCompletion tests that undelegations complete after +// the unbonding period elapses on the provider, regardless of the consumer's state +func (s *CCVTestSuite) TestUndelegationCompletion() { + s.SetupCCVChannel(s.path) + + // delegate bondAmt and undelegate 1/2 of it + bondAmt := sdk.NewInt(10000000) + delAddr := s.providerChain.SenderAccount.GetAddress() + initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) + // - check that staking unbonding op was created + checkStakingUnbondingOps(s, 1, true) + + // call NextBlock on the provider (which increments the height) + s.providerChain.NextBlock() + + // unbond on provider + stakingKeeper := s.providerApp.GetTestStakingKeeper() + incrementTime(s, stakingKeeper.UnbondingTime(s.providerCtx())) + + // check that the unbonding operation completed + checkStakingUnbondingOps(s, valsetUpdateID, false) + // - check that necessary delegated coins have been returned + unbondAmt := bondAmt.Sub(bondAmt.Quo(sdk.NewInt(2))) + s.Require().Equal( + initBalance.Sub(unbondAmt), + getBalance(s, s.providerCtx(), delAddr), + "unexpected initial balance after unbonding; test: %s", + ) +} + +// This test reproduces a fixed bug when an inactive validator enters back into the active set. +// It used to cause a panic in the provider module hook called by AfterUnbondingInitiated +// during the staking module EndBlock. +func (s *CCVTestSuite) TestTooManyLastValidators() { + sk := s.providerApp.GetTestStakingKeeper() + + // get current staking params + p := sk.GetParams(s.providerCtx()) + + // get validators, which are all active at the moment + vals := sk.GetAllValidators(s.providerCtx()) + s.Require().Equal(len(vals), len(sk.GetLastValidators(s.providerCtx()))) + + // jail a validator + val := vals[0] + consAddr, err := val.GetConsAddr() + s.Require().NoError(err) + sk.Jail(s.providerCtx(), consAddr) + + // save the current number of bonded vals + lastVals := sk.GetLastValidators(s.providerCtx()) + + // pass one block to apply the validator set changes + // (calls ApplyAndReturnValidatorSetUpdates in the the staking module EndBlock) + s.providerChain.NextBlock() + + // verify that the number of bonded validators is decreased by one + s.Require().Equal(len(lastVals)-1, len(sk.GetLastValidators(s.providerCtx()))) + + // update maximum validator to equal the number of bonded validators + p.MaxValidators = uint32(len(sk.GetLastValidators(s.providerCtx()))) + sk.SetParams(s.providerCtx(), p) + + // pass one block to apply validator set changes + s.providerChain.NextBlock() + + // unjail validator + // Note that since validators are sorted in descending order, the unjailed validator + // enters the active set again since it's ranked first by voting power. + sk.Unjail(s.providerCtx(), consAddr) + + // pass another block to update the validator set + // which causes a panic due to a GetLastValidator call in + // ApplyAndReturnValidatorSetUpdates where the staking module has a inconsistent state + s.Require().NotPanics(s.providerChain.NextBlock) + s.Require().NotPanics(func() { sk.ApplyAndReturnValidatorSetUpdates(s.providerCtx()) }) + s.Require().NotPanics(func() { sk.GetLastValidators(s.providerCtx()) }) +} diff --git a/testutil/integration/debug_test.go b/testutil/integration/debug_test.go index d97c41f7d0..db4392dab7 100644 --- a/testutil/integration/debug_test.go +++ b/testutil/integration/debug_test.go @@ -205,28 +205,8 @@ func TestSlashAllValidators(t *testing.T) { // Unbonding tests // -func TestUndelegationNormalOperation(t *testing.T) { - runCCVTestByName(t, "TestUndelegationNormalOperation") -} - -func TestUndelegationVscTimeout(t *testing.T) { - runCCVTestByName(t, "TestUndelegationVscTimeout") -} - -func TestUndelegationDuringInit(t *testing.T) { - runCCVTestByName(t, "TestUndelegationDuringInit") -} - -func TestUnbondingNoConsumer(t *testing.T) { - runCCVTestByName(t, "TestUnbondingNoConsumer") -} - -func TestRedelegationNoConsumer(t *testing.T) { - runCCVTestByName(t, "TestRedelegationNoConsumer") -} - -func TestRedelegationProviderFirst(t *testing.T) { - runCCVTestByName(t, "TestRedelegationProviderFirst") +func TestUndelegationCompletion(t *testing.T) { + runCCVTestByName(t, "TestUndelegationCompletion") } // From ddb5fcb3c6afe52e486b7ff01d401cf7f4d0e9e5 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 12:50:39 +0200 Subject: [PATCH 23/81] add TODO for init timeout --- x/ccv/provider/keeper/proposal.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 58d95dbbe5..6df307592f 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -95,6 +95,7 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi } k.SetConsumerClientId(ctx, chainID, clientID) + // TODO (mpoke) Decide what to do about the init timeout // add the init timeout timestamp for this consumer chain ts := ctx.BlockTime().Add(k.GetParams(ctx).InitTimeoutPeriod) k.SetInitTimeoutTimestamp(ctx, chainID, uint64(ts.UnixNano())) From 81af3079bb37b8f6cc324f8b340f38455749b689 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 12 Jun 2024 17:09:03 +0200 Subject: [PATCH 24/81] fix integration tests --- tests/integration/common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/common.go b/tests/integration/common.go index d1e383f55b..d11a88d4aa 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -322,7 +322,7 @@ func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found bool, msgAndArgs if wasFound { // make sure UnbondingOnHoldRefCount remains zero s.Require().Equal( - 0, + int64(0), stakingUnbondingOp.UnbondingOnHoldRefCount, fmt.Sprintf("checkStakingUnbondingOps failed - UnbondingOnHoldRefCount; %s", msgAndArgs...), ) From 703afd2378ce1e78c27e60c988d2b3cd1d48f3c2 Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 18 Jun 2024 15:03:24 +0200 Subject: [PATCH 25/81] avoid breaking protos --- .../ccv/provider/v1/genesis.proto | 28 +++- x/ccv/provider/types/genesis.pb.go | 150 +++++++++--------- 2 files changed, 96 insertions(+), 82 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 7a5a897929..d7dffcf531 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -11,6 +11,15 @@ import "interchain_security/ccv/provider/v1/provider.proto"; // GenesisState defines the CCV provider chain genesis state message GenesisState { + // Reserve 3rd slot for removed unbonding_ops field + reserved 3; + + // Reserve 4th slot for removed mature_unbonding_ops field + reserved 4; + + // Reserve 13th slot for removed exported_vsc_send_timestamps field + reserved 13; + // strictly positive and set to 1 (DefaultValsetUpdateID) for a new chain uint64 valset_update_id = 1; // empty for a new chain @@ -19,26 +28,26 @@ message GenesisState { (gogoproto.moretags) = "yaml:\"consumer_states\"" ]; // empty for a new chain - repeated ValsetUpdateIdToHeight valset_update_id_to_height = 3 + repeated ValsetUpdateIdToHeight valset_update_id_to_height = 5 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ConsumerAdditionProposal consumer_addition_proposals = 4 + repeated ConsumerAdditionProposal consumer_addition_proposals = 6 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ConsumerRemovalProposal consumer_removal_proposals = 5 + repeated ConsumerRemovalProposal consumer_removal_proposals = 7 [ (gogoproto.nullable) = false ]; - Params params = 6 [ (gogoproto.nullable) = false ]; + Params params = 8 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ValidatorConsumerPubKey validator_consumer_pubkeys = 7 + repeated ValidatorConsumerPubKey validator_consumer_pubkeys = 9 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ValidatorByConsumerAddr validators_by_consumer_addr = 8 + repeated ValidatorByConsumerAddr validators_by_consumer_addr = 10 [ (gogoproto.nullable) = false ]; // empty for a new chain - repeated ConsumerAddrsToPrune consumer_addrs_to_prune = 9 + repeated ConsumerAddrsToPrune consumer_addrs_to_prune = 11 [ (gogoproto.nullable) = false ]; - repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 10 + repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 12 [ (gogoproto.nullable) = false ]; } @@ -46,6 +55,9 @@ message GenesisState { // // Note this type is only used internally to the provider CCV module. message ConsumerState { + // Reserve 8th slot for removed unbonding_ops_index field + reserved 8; + // ChainID defines the chain ID for the consumer chain string chain_id = 1; // ChannelID defines the IBC channel ID for the consumer chain diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index a6d26b1db5..5e42ffd760 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -31,19 +31,19 @@ type GenesisState struct { // empty for a new chain ConsumerStates []ConsumerState `protobuf:"bytes,2,rep,name=consumer_states,json=consumerStates,proto3" json:"consumer_states" yaml:"consumer_states"` // empty for a new chain - ValsetUpdateIdToHeight []ValsetUpdateIdToHeight `protobuf:"bytes,3,rep,name=valset_update_id_to_height,json=valsetUpdateIdToHeight,proto3" json:"valset_update_id_to_height"` + ValsetUpdateIdToHeight []ValsetUpdateIdToHeight `protobuf:"bytes,5,rep,name=valset_update_id_to_height,json=valsetUpdateIdToHeight,proto3" json:"valset_update_id_to_height"` // empty for a new chain - ConsumerAdditionProposals []ConsumerAdditionProposal `protobuf:"bytes,4,rep,name=consumer_addition_proposals,json=consumerAdditionProposals,proto3" json:"consumer_addition_proposals"` + ConsumerAdditionProposals []ConsumerAdditionProposal `protobuf:"bytes,6,rep,name=consumer_addition_proposals,json=consumerAdditionProposals,proto3" json:"consumer_addition_proposals"` // empty for a new chain - ConsumerRemovalProposals []ConsumerRemovalProposal `protobuf:"bytes,5,rep,name=consumer_removal_proposals,json=consumerRemovalProposals,proto3" json:"consumer_removal_proposals"` - Params Params `protobuf:"bytes,6,opt,name=params,proto3" json:"params"` + ConsumerRemovalProposals []ConsumerRemovalProposal `protobuf:"bytes,7,rep,name=consumer_removal_proposals,json=consumerRemovalProposals,proto3" json:"consumer_removal_proposals"` + Params Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params"` // empty for a new chain - ValidatorConsumerPubkeys []ValidatorConsumerPubKey `protobuf:"bytes,7,rep,name=validator_consumer_pubkeys,json=validatorConsumerPubkeys,proto3" json:"validator_consumer_pubkeys"` + ValidatorConsumerPubkeys []ValidatorConsumerPubKey `protobuf:"bytes,9,rep,name=validator_consumer_pubkeys,json=validatorConsumerPubkeys,proto3" json:"validator_consumer_pubkeys"` // empty for a new chain - ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,8,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` + ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,10,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` // empty for a new chain - ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,9,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` - InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,10,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` + ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` + InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -316,56 +316,58 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 783 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x4f, 0x23, 0x37, - 0x14, 0xcf, 0x90, 0x10, 0x88, 0x29, 0x14, 0x59, 0x34, 0x0c, 0x41, 0x0d, 0x28, 0x15, 0x52, 0xa4, - 0xb6, 0x19, 0x92, 0xf6, 0xd0, 0x7f, 0x1c, 0x08, 0x48, 0x6d, 0xd4, 0x4b, 0x14, 0x52, 0x2a, 0x71, - 0x19, 0x39, 0x1e, 0x2b, 0xb1, 0x32, 0x33, 0x1e, 0xd9, 0x9e, 0xa1, 0x51, 0x55, 0x89, 0x6a, 0xbf, - 0xc0, 0x1e, 0xf6, 0x43, 0x71, 0xe4, 0xb8, 0x27, 0xb4, 0x82, 0x6f, 0xb0, 0x9f, 0x60, 0x35, 0x1e, - 0xcf, 0x6c, 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 0x52, 0x7b, 0x42, 0x5c, 0xeb, 0x6d, 0xe1, - 0xe9, 0xed, 0x02, 0xfe, 0x07, 0x2a, 0x4f, 0x6d, 0xda, 0x92, 0xd9, 0x23, 0x42, 0x87, 0x23, 0x69, - 0xe6, 0x95, 0x8f, 0x5f, 0x17, 0xf2, 0x71, 0x39, 0x93, 0x55, 0x9f, 0xfd, 0xa1, 0x28, 0xda, 0x85, - 0xd8, 0x50, 0xaf, 0x1c, 0xcd, 0x45, 0xe1, 0x2b, 0x03, 0xec, 0x67, 0x1e, 0x91, 0xe3, 0x50, 0x49, - 0x99, 0x6f, 0x07, 0x9c, 0x05, 0x4c, 0x20, 0x57, 0x98, 0x05, 0x65, 0xe0, 0x64, 0xa9, 0x42, 0x9c, - 0x6a, 0x9a, 0xae, 0x66, 0xd1, 0x16, 0xf6, 0xf0, 0x33, 0xb8, 0x80, 0x37, 0x06, 0xa8, 0x64, 0x2e, - 0x38, 0xf1, 0x58, 0x84, 0xdc, 0x29, 0x13, 0xab, 0xca, 0xc4, 0x6f, 0x4b, 0x99, 0xe8, 0x25, 0x2c, - 0x4f, 0x3c, 0x98, 0x78, 0x3e, 0x2c, 0x60, 0x07, 0x14, 0x03, 0xc4, 0x91, 0x27, 0xcc, 0xe2, 0xa1, - 0x51, 0xdf, 0x68, 0x7d, 0xbb, 0x90, 0x5a, 0x57, 0x85, 0x68, 0x72, 0x4d, 0xa0, 0xb2, 0x89, 0x90, - 0x4b, 0x1d, 0x24, 0x19, 0xcf, 0xae, 0x80, 0x1d, 0x84, 0x83, 0x31, 0x99, 0x08, 0x73, 0x6d, 0x89, - 0x6c, 0x2e, 0x53, 0x9a, 0x34, 0xad, 0x6e, 0x38, 0xf8, 0x93, 0x4c, 0xd2, 0x6c, 0xa2, 0x39, 0x70, - 0xac, 0x01, 0xff, 0x37, 0xc0, 0x7e, 0x06, 0x0a, 0x7b, 0x30, 0xb1, 0xa7, 0x9b, 0xcc, 0xcd, 0xf5, - 0xcf, 0xf1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xf1, 0x2d, 0x8a, 0x4b, 0xfd, 0xd3, 0x4b, 0x42, - 0xd9, 0xc1, 0xba, 0x20, 0xf2, 0x4c, 0x85, 0x75, 0x11, 0x1e, 0x13, 0x79, 0x8e, 0x24, 0x4a, 0x3b, - 0xac, 0xd9, 0x93, 0xd9, 0x96, 0x6c, 0x12, 0xf0, 0x3b, 0x00, 0x85, 0x8b, 0xc4, 0xc8, 0x76, 0xd8, - 0xb5, 0x1f, 0xb7, 0xd7, 0x46, 0x78, 0xac, 0xee, 0x55, 0xa9, 0xb7, 0xad, 0x90, 0x73, 0x0d, 0x9c, - 0xe2, 0x71, 0xed, 0x0a, 0x94, 0xe7, 0x8f, 0xc6, 0x25, 0x9e, 0x88, 0x32, 0x28, 0xea, 0x4a, 0xaf, - 0x28, 0x5c, 0x7f, 0xb5, 0xff, 0xbe, 0x7d, 0xa8, 0x1a, 0x77, 0x0f, 0x55, 0xe3, 0xdd, 0x43, 0xd5, - 0x78, 0xfd, 0x58, 0xcd, 0xdd, 0x3d, 0x56, 0x73, 0x6f, 0x1f, 0xab, 0xb9, 0xab, 0x93, 0x21, 0x95, - 0xa3, 0x70, 0xd0, 0xc0, 0xcc, 0xb3, 0x30, 0x13, 0x1e, 0x13, 0xd6, 0xc7, 0x52, 0x7c, 0x9f, 0xbd, - 0x6a, 0xd1, 0x8f, 0xd6, 0x3f, 0xb3, 0x4f, 0x9b, 0x9c, 0x04, 0x44, 0x0c, 0x8a, 0xea, 0x55, 0xfb, - 0xe1, 0x43, 0x00, 0x00, 0x00, 0xff, 0xff, 0x64, 0x1d, 0x14, 0x17, 0xd2, 0x07, 0x00, 0x00, + // 805 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x8f, 0xe2, 0x36, + 0x14, 0x27, 0x43, 0x86, 0x0d, 0x9e, 0x1d, 0x8a, 0xac, 0x2d, 0x9b, 0x65, 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x2a, 0x9d, 0xbd, 0x98, 0x53, 0xb9, 0x88, 0x67, 0x5d, 0xcc, 0x02, 0x07, 0x33, 0x11, 0x30, + 0xe1, 0xfc, 0xd7, 0x90, 0x4f, 0x8a, 0xd7, 0x2e, 0xf9, 0xcc, 0xf9, 0x71, 0xf3, 0xc9, 0x93, 0xab, + 0x88, 0x88, 0x59, 0x45, 0xbd, 0x76, 0x9f, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xd7, 0x76, + 0x7e, 0xea, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -399,7 +401,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x62 } } if len(m.ConsumerAddrsToPrune) > 0 { @@ -413,7 +415,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a + dAtA[i] = 0x5a } } if len(m.ValidatorsByConsumerAddr) > 0 { @@ -427,7 +429,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x52 } } if len(m.ValidatorConsumerPubkeys) > 0 { @@ -441,7 +443,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x4a } } { @@ -453,7 +455,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x42 if len(m.ConsumerRemovalProposals) > 0 { for iNdEx := len(m.ConsumerRemovalProposals) - 1; iNdEx >= 0; iNdEx-- { { @@ -465,7 +467,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x3a } } if len(m.ConsumerAdditionProposals) > 0 { @@ -479,7 +481,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x32 } } if len(m.ValsetUpdateIdToHeight) > 0 { @@ -493,7 +495,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x2a } } if len(m.ConsumerStates) > 0 { @@ -847,7 +849,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValsetUpdateIdToHeight", wireType) } @@ -881,7 +883,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAdditionProposals", wireType) } @@ -915,7 +917,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerRemovalProposals", wireType) } @@ -949,7 +951,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } @@ -982,7 +984,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorConsumerPubkeys", wireType) } @@ -1016,7 +1018,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsByConsumerAddr", wireType) } @@ -1050,7 +1052,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrsToPrune", wireType) } @@ -1084,7 +1086,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutTimestamps", wireType) } From 27145792c5f73c768f3d4e6b0c812808d72158e0 Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 18 Jun 2024 15:05:39 +0200 Subject: [PATCH 26/81] remove TestTooManyLastValidators --- tests/integration/unbonding.go | 50 ---------------------------------- 1 file changed, 50 deletions(-) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index 8b37ba09e6..19dd1cbe21 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -33,53 +33,3 @@ func (s *CCVTestSuite) TestUndelegationCompletion() { "unexpected initial balance after unbonding; test: %s", ) } - -// This test reproduces a fixed bug when an inactive validator enters back into the active set. -// It used to cause a panic in the provider module hook called by AfterUnbondingInitiated -// during the staking module EndBlock. -func (s *CCVTestSuite) TestTooManyLastValidators() { - sk := s.providerApp.GetTestStakingKeeper() - pk := s.providerApp.GetProviderKeeper() - - // get current staking params - p := sk.GetParams(s.providerCtx()) - - // get validators, which are all active at the moment - vals := sk.GetAllValidators(s.providerCtx()) - s.Require().Equal(len(vals), len(pk.GetLastBondedValidators(s.providerCtx()))) - - // jail a validator - val := vals[0] - consAddr, err := val.GetConsAddr() - s.Require().NoError(err) - sk.Jail(s.providerCtx(), consAddr) - - // save the current number of bonded vals - lastVals := pk.GetLastBondedValidators(s.providerCtx()) - - // pass one block to apply the validator set changes - // (calls ApplyAndReturnValidatorSetUpdates in the the staking module EndBlock) - s.providerChain.NextBlock() - - // verify that the number of bonded validators is decreased by one - s.Require().Equal(len(lastVals)-1, len(pk.GetLastBondedValidators(s.providerCtx()))) - - // update maximum validator to equal the number of bonded validators - p.MaxValidators = uint32(len(pk.GetLastBondedValidators(s.providerCtx()))) - sk.SetParams(s.providerCtx(), p) - - // pass one block to apply validator set changes - s.providerChain.NextBlock() - - // unjail validator - // Note that since validators are sorted in descending order, the unjailed validator - // enters the active set again since it's ranked first by voting power. - sk.Unjail(s.providerCtx(), consAddr) - - // pass another block to update the validator set - // which causes a panic due to a GetLastValidator call in - // ApplyAndReturnValidatorSetUpdates where the staking module has a inconsistent state - s.Require().NotPanics(s.providerChain.NextBlock) - s.Require().NotPanics(func() { sk.ApplyAndReturnValidatorSetUpdates(s.providerCtx()) }) - s.Require().NotPanics(func() { pk.GetLastBondedValidators(s.providerCtx()) }) -} From c2be16f3b36ea09edff54b1f25916d2e9c3745b6 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 19 Jun 2024 11:03:42 +0200 Subject: [PATCH 27/81] add ADR for removing vscmatured packets --- docs/docs/adrs/adr-018-remove-vscmatured.md | 119 ++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 docs/docs/adrs/adr-018-remove-vscmatured.md diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md new file mode 100644 index 0000000000..73c6ef866a --- /dev/null +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -0,0 +1,119 @@ +--- +sidebar_position: 19 +title: Remove VSCMatured Packets +--- +# ADR 018: Remove VSCMatured Packets + +## Changelog +* 19/06/2024: Create initial draft + +## Status + +Proposed + +## Context + +The consumer module on the consumer chains is just a representation of the Hub’s staking module, i.e., it provides an _asynchronous_ view of the voting powers and indirectly of the locked collateral. +The key word here is _asynchronous_, which means that (in theory) there is no bound on the lag between the Hub’s view of stake and the consumer’s view of stake. +The reasons for this asynchrony are relaying delays and chain liveness (e.g., a consumer could be down for a long period of time without affecting the liveness of the staking module on the Hub). + +The current version of ICS uses `VSCMaturedPackets` to create on the consumers a _partially synchronous_ view of the Hub’s staking module. +Partially synchronous means that the lag between the Hub’s view of stake and the consumer’s view of stake is bounded. +Basically, unlocking collateral from the Hub is being delayed until the consumers’ `UnbondingPeriod` elapses. +The reason the view is only partially synchronous is that eventually the collateral is unlocked, i.e., if `VSCMaturedPackets` are not received from a consumer for `VscTimeoutPeriod` (default: 5 weeks), then the consumer is removed from ICS and the collateral is unlocked. +Note that keeping the stake locked “forever” would affect the Hub’s liveness, so it’s not a viable option. + +The issue is that whatever attack is possible with an asynchronous view of the staking module, it is eventually possible with the partially synchronous view as well. +For example, an attacker could wait for `VscTimeoutPeriod` for the collateral to be unlocked and then send invalid headers to third-party chains that are not aware the consumer's collateral is no longer locked on the Hub (i.e., the consumer is no longer part of ICS). + +Moreover, with the introduction of [PSS](./adr-015-partial-set-security.md), a consumer’s validator set could “lie” about its `UnbondingPeriod` elapsing by sending `VSCMaturedPackets` earlier. +This would result in a discrepancy between a light client’s view of the `UnbondingPeriod` and the actual Hub’s `UnbondingPeriod`. + +## Decision + +This ADR proposes the removal of `VSCMaturedPackets`. The reason is twofold. +First, `VSCMaturedPackets` provide a "false" sense of correctness as the attack discribed above is still possible. +Second, `VSCMaturedPackets` add considerable complexity to the ICS protocol -- an extra message plus the pausing of unbonding operations that can affect the UX. + +To simplify the upgrading process, removing `VSCMaturedPackets` can be done in two releases: + +* (R1) Update the provider to drop `VSCMaturedPackets`. +* (R2) Update the consumer to stop sending `VSCMaturedPackets`. + +As a result, once the provider chain runs R1, the consumers can start upgrading to R2. + +### Provider Changes + +#### State + +Remove the following key prefixes from the state: + +- `MaturedUnbondingOpsByteKey` -- the byte key that stores the list of all unbonding operations ids that have matured from a consumer chain perspective. +- `UnbondingOpBytePrefix` -- the byte prefix that stores a record of all the ids of consumer chains that need to unbond before a given unbonding operation can unbond on this chain. +- `UnbondingOpIndexBytePrefix` -- the byte prefix of the index for looking up which unbonding operations are waiting for a given consumer chain to unbond. +- `VscSendTimestampBytePrefix` -- the byte prefix for storing the list of VSC sending timestamps for a given consumer chainID. + +Note that these removals require state migration. + +#### State Transitions + +Removing `VSCMaturedPackets` affects three ICS sub-protocols (see [HandleVSCMaturedPacket](https://github.com/cosmos/interchain-security/blob/v4.2.0/x/ccv/provider/keeper/relay.go#L51)): unbonding operations pausing, `VSCPackets` timeout, and key assignment pruning. +The first two are no longer needed, while the third (key assignment pruning) needs to be redesign to not depend on `VSCMaturedPackets`. + +**Removing unbonding operations pausing:** + +- Make the `AfterUnbondingInitiated` hook a no-op. As a result, unbonding operations are no longer paused. +- Stop calling the `UnbondingCanComplete` method from the staking keeper. This entails, it is no longer necessary to append `MaturedUnbondingOps` and the `completeMaturedUnbondingOps` method can be removed. +- Note, that during the upgrade, all unbonding operations stored under the `UnbondingOpBytePrefix` prefix need to be completed (via the `UnbondingCanComplete` method from the staking keeper). + +**Removing `VSCPackets` timeout:** + +- Stop setting VSC send timestamps when sending `VSCPackets`. +- Stop removing the VSC send timestamps when receiving `VSCMaturedPackets`. +- Remove the logic from `EndBlockCCR` that checks if the first VSC send timestamp in iterator plus `VscTimeoutPeriod` exceeds the current block time. +- Remove the `VscTimeoutPeriod` parameter. + +**Redesign key assignment pruning.** The reason for keeping "old" consumer addresses is to enable slashing / jailing validators that misbehave on consumer chains, +i.e., the slashing logic uses the `GetProviderAddrFromConsumerAddr` method that accesses the mapping from validator addresses on consumer chains to validator addresses on the provider chain (`ValidatorsByConsumerAddrBytePrefix`). +Thus, "old" consumer addresses are no longer needed after the provider's `UnbondingPeriod` elapses. +This means that once a validator changes its key on a consumer, we can prune the address corresponding to the "old" key after `UnbondingPeriod`. +This requires the following changes: + +- Add a new prefix (i.e., `ConsumerAddrsToPruneV2BytePrefix`) to store consumer addresses that need to be pruned under a key with the format `bytePrefix | len(chainID) | chainID | timestamp` (see `ChainIdAndTsKey`). +- Adapt the `AppendConsumerAddrsToPrune()` method to use the timestamp of the current block instead of the current `vscID`. +- Add a new method `PruneKeyAssignmentsV2()` that adapts `PruneKeyAssignments()` to take a timestamp as an argument and iterate over `ConsumerAddrsToPruneV2BytePrefix`. +- Call the `PruneKeyAssignmentsV2()` method in every `EndBlock` instead of calling `PruneKeyAssignments()` in `HandleVSCMaturedPacket`. + +Note that the existing "old" consumer addresses stored under the `ConsumerAddrsToPruneBytePrefix` need to be pruned eventually to avoid slashing validator for "old" misbehaviors. +As a result, `PruneKeyAssignments()` needs to be called for `UnbondingPeriod` (i.e., three weeks). +Once the `UnbondingPeriod` elapses, the consumers can be upgraded to stop sending `VSCMaturedPackets` and the provider can be upgraded to stop calling `PruneKeyAssignments()` (and all the data under `ConsumerAddrsToPruneBytePrefix` can be removed). + +#### Queries + +Remove the `oldest_unconfirmed_vsc` query. + +### Consumer Changes + +TBA + +## Consequences + +### Positive + +- Remove feature that provides a "false" sense of correctness. +- Remove unnecessary complexity, from both ICS and Cosmos SDK. +- Remove one IBC packet and, thus, reduce relaying cost. +- Remove unbonding pausing logic that could affect the UX. + +### Negative + +- Large refactor that might introduce unexpected bugs. + +### Neutral + +- Consumer chains are no longer removed after a `VscTimeoutPeriod` of inactivity. + Note that consumers are still removed if their CCV channel expires, which usually happens after two weeks instead of five weeks (the default value for `VscTimeoutPeriod`). + +## References + + From 1b5857d450d6026ce76243a3b8b4da1fe506442b Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Wed, 19 Jun 2024 14:13:12 +0200 Subject: [PATCH 28/81] Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: MSalopek --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 73c6ef866a..90bab95f67 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -73,7 +73,7 @@ The first two are no longer needed, while the third (key assignment pruning) nee - Remove the logic from `EndBlockCCR` that checks if the first VSC send timestamp in iterator plus `VscTimeoutPeriod` exceeds the current block time. - Remove the `VscTimeoutPeriod` parameter. -**Redesign key assignment pruning.** The reason for keeping "old" consumer addresses is to enable slashing / jailing validators that misbehave on consumer chains, +**Redesign key assignment pruning.** The reason for keeping "old" consumer addresses in the previous design was to enable slashing / jailing validators that misbehave on consumer chains, i.e., the slashing logic uses the `GetProviderAddrFromConsumerAddr` method that accesses the mapping from validator addresses on consumer chains to validator addresses on the provider chain (`ValidatorsByConsumerAddrBytePrefix`). Thus, "old" consumer addresses are no longer needed after the provider's `UnbondingPeriod` elapses. This means that once a validator changes its key on a consumer, we can prune the address corresponding to the "old" key after `UnbondingPeriod`. From dfd2956d2a53bca526bec3dd34f2e845cef1f50e Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Wed, 19 Jun 2024 14:15:28 +0200 Subject: [PATCH 29/81] Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: MSalopek --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 90bab95f67..d54016a82d 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -13,7 +13,7 @@ Proposed ## Context -The consumer module on the consumer chains is just a representation of the Hub’s staking module, i.e., it provides an _asynchronous_ view of the voting powers and indirectly of the locked collateral. +The consumer module on the consumer chains is a representation of the Hub’s staking module, i.e., it provides an _asynchronous_ view of the voting powers and indirectly of the locked collateral. The key word here is _asynchronous_, which means that (in theory) there is no bound on the lag between the Hub’s view of stake and the consumer’s view of stake. The reasons for this asynchrony are relaying delays and chain liveness (e.g., a consumer could be down for a long period of time without affecting the liveness of the staking module on the Hub). From 283ac29a75fd2d0ae98937342c9d02d28e56dca7 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 19 Jun 2024 15:23:30 +0200 Subject: [PATCH 30/81] add consumer changes -- wip --- docs/docs/adrs/adr-018-remove-vscmatured.md | 39 ++++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index d54016a82d..dadab0bc05 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -42,7 +42,11 @@ To simplify the upgrading process, removing `VSCMaturedPackets` can be done in t As a result, once the provider chain runs R1, the consumers can start upgrading to R2. -### Provider Changes +### Provider Changes (R1) + +#### Parameters + +Deprecate the `VscTimeoutPeriod` parameter. #### State @@ -71,7 +75,7 @@ The first two are no longer needed, while the third (key assignment pruning) nee - Stop setting VSC send timestamps when sending `VSCPackets`. - Stop removing the VSC send timestamps when receiving `VSCMaturedPackets`. - Remove the logic from `EndBlockCCR` that checks if the first VSC send timestamp in iterator plus `VscTimeoutPeriod` exceeds the current block time. -- Remove the `VscTimeoutPeriod` parameter. +- Deprecate the `VscTimeoutPeriod` parameter. **Redesign key assignment pruning.** The reason for keeping "old" consumer addresses in the previous design was to enable slashing / jailing validators that misbehave on consumer chains, i.e., the slashing logic uses the `GetProviderAddrFromConsumerAddr` method that accesses the mapping from validator addresses on consumer chains to validator addresses on the provider chain (`ValidatorsByConsumerAddrBytePrefix`). @@ -86,15 +90,40 @@ This requires the following changes: Note that the existing "old" consumer addresses stored under the `ConsumerAddrsToPruneBytePrefix` need to be pruned eventually to avoid slashing validator for "old" misbehaviors. As a result, `PruneKeyAssignments()` needs to be called for `UnbondingPeriod` (i.e., three weeks). -Once the `UnbondingPeriod` elapses, the consumers can be upgraded to stop sending `VSCMaturedPackets` and the provider can be upgraded to stop calling `PruneKeyAssignments()` (and all the data under `ConsumerAddrsToPruneBytePrefix` can be removed). +Once the `UnbondingPeriod` elapses, the consumers can be upgraded to stop sending `VSCMaturedPackets` (see [R2](#consumer-changes-r2) below) and the provider can be upgraded to stop calling `PruneKeyAssignments()` (and all the data under `ConsumerAddrsToPruneBytePrefix` can be removed). #### Queries Remove the `oldest_unconfirmed_vsc` query. -### Consumer Changes +### Consumer Changes (R2) + +#### Parameters + +Deprecate the consumer `UnbondingPeriod` (see `ConsumerParams`). + +#### State + +Remove the following key prefixes from the state: + +- `PacketMaturityTimeBytePrefix` -- the byte prefix that will store maturity time for each received VSC packet + +Note that these removals require state migration. + +#### State Transitions + +To stop the consumer chains from sending `VSCMaturedPackets`, it is sufficient to not sore the maturity time of `VSCPacket`s when receiving them, i.e., do not call `SetPacketMaturityTime` from the `OnRecvVSCPacket()` method. +Note that eventually, no additional `VSCMaturedPackets` will be added to the sending queue as `QueueVSCMaturedPackets` iterates over elapsed maturity times. +In addition, to cleanup the code, the `QueueVSCMaturedPackets` must be removed. + +TODO: + +- adapt `UnbondingTime` and how relayers will interact with the consumer chain + +#### Messages -TBA +`VSCMaturedPacketData` is deprecated. +Note that this is a wire-breaking change -- older consumer versions will send `VSCMaturedPackets` and older provider versions will expect to receive `VSCMaturedPackets`. ## Consequences From a895aaba0925ef5c6dae57ef5350c32a628082f0 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 19 Jun 2024 17:22:55 +0200 Subject: [PATCH 31/81] consumer changes --- docs/docs/adrs/adr-018-remove-vscmatured.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index dadab0bc05..ce6fab2fb2 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -100,7 +100,8 @@ Remove the `oldest_unconfirmed_vsc` query. #### Parameters -Deprecate the consumer `UnbondingPeriod` (see `ConsumerParams`). +Given that currently relayers use the consumer `UnbondingPeriod` (see `ConsumerParams`), this param cannot be deprecated. +The `UnbondingTime` method from the staking interface will continue to be used to retrieve the consumer's `UnbondingPeriod`. #### State @@ -116,10 +117,6 @@ To stop the consumer chains from sending `VSCMaturedPackets`, it is sufficient t Note that eventually, no additional `VSCMaturedPackets` will be added to the sending queue as `QueueVSCMaturedPackets` iterates over elapsed maturity times. In addition, to cleanup the code, the `QueueVSCMaturedPackets` must be removed. -TODO: - -- adapt `UnbondingTime` and how relayers will interact with the consumer chain - #### Messages `VSCMaturedPacketData` is deprecated. From af6e0e25eaee4098874da7e7b9fd9a45d9b4c21e Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 20 Jun 2024 11:13:06 +0200 Subject: [PATCH 32/81] add new prefix for ConsumerAddrsToPrune --- .../ccv/provider/v1/provider.proto | 10 + x/ccv/provider/keeper/key_assignment.go | 98 ++++ x/ccv/provider/keeper/key_assignment_test.go | 84 +++ x/ccv/provider/types/keys.go | 15 + x/ccv/provider/types/keys_test.go | 2 + x/ccv/provider/types/provider.pb.go | 514 ++++++++++++++---- 6 files changed, 609 insertions(+), 114 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 60b0634972..b2f5e1b979 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -310,12 +310,22 @@ message ValidatorByConsumerAddr { // Used to serialize the ConsumerAddrsToPrune index from key assignment // ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList +// TODO remove once all consumer addresses stored under the ConsumerAddrsToPrune index are pruned message ConsumerAddrsToPrune { string chain_id = 1; uint64 vsc_id = 2; AddressList consumer_addrs = 3; } +// Used to serialize the ConsumerAddrsToPruneV2 index from key assignment +// ConsumerAddrsToPruneV2: (chainID, pruneAfterTs time.Time) -> consumerAddrs AddressList +message ConsumerAddrsToPruneV2 { + string chain_id = 1; + google.protobuf.Timestamp prune_after_ts = 2 + [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + AddressList consumer_addrs = 3; +} + // ConsumerValidator is used to facilitate epoch-based transitions. It contains relevant info for // a validator that is expected to validate on a consumer chain during an epoch. message ConsumerValidator { diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 99d9443d47..ce8985279d 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/base64" "fmt" + "time" errorsmod "cosmossdk.io/errors" @@ -323,6 +324,103 @@ func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscI store.Delete(types.ConsumerAddrsToPruneKey(chainID, vscID)) } +// AppendConsumerAddrsToPruneV2 appends a consumer validator address to the list of consumer addresses +// that can be pruned once the block time is larger than pruneAfterTs. +// +// The following invariant needs to hold: +// For each consumer address cAddr in ValidatorByConsumerAddr, +// - either there exists a provider address pAddr in ValidatorConsumerPubKey, +// s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr +// - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) +func (k Keeper) AppendConsumerAddrsToPruneV2( + ctx sdk.Context, + chainID string, + pruneAfterTs time.Time, + consumerAddr types.ConsumerConsAddress, +) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs)) + var consumerAddrsToPrune types.AddressList + if bz != nil { + err := consumerAddrsToPrune.Unmarshal(bz) + if err != nil { + // An error here would indicate something is very wrong, + // the data bytes are assumed to be correctly serialized by previous calls to this method. + panic(err) + } + } + consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, consumerAddr.ToSdkConsAddr()) + bz, err := consumerAddrsToPrune.Marshal() + if err != nil { + // An error here would indicate something is very wrong, + // consumerAddrsToPrune is instantiated in this method and should be able to be marshaled. + panic(err) + } + store.Set(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs), bz) +} + +// GetConsumerAddrsToPruneV2 returns the list of consumer addresses +// that can be pruned once the block time is larger than pruneAfterTs. +func (k Keeper) GetConsumerAddrsToPruneV2( + ctx sdk.Context, + chainID string, + pruneAfterTs time.Time, +) (consumerAddrsToPrune types.AddressList) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs)) + if bz == nil { + return + } + err := consumerAddrsToPrune.Unmarshal(bz) + if err != nil { + // An error here would indicate something is very wrong, + // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPruneV2. + panic(fmt.Sprintf("failed to unmarshal consumer addresses to prune: %v", err)) + } + return +} + +// GetAllConsumerAddrsToPruneV2 gets all consumer addresses that can be eventually pruned for a given chainID. +// +// Note that the list of all consumer addresses is stored under keys with the following format: +// ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp +// Thus, the returned array is in ascending order of timestamps. +func (k Keeper) GetAllConsumerAddrsToPruneV2(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPruneV2) { + store := ctx.KVStore(k.storeKey) + iteratorPrefix := types.ChainIdWithLenKey(types.ConsumerAddrsToPruneV2BytePrefix, chainID) + iterator := sdk.KVStorePrefixIterator(store, iteratorPrefix) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + _, pruneAfterTs, err := types.ParseChainIdAndTsKey(types.ConsumerAddrsToPruneV2BytePrefix, iterator.Key()) + if err != nil { + // An error here would indicate something is very wrong, + // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPruneV2. + panic(err) + } + var addrs types.AddressList + err = addrs.Unmarshal(iterator.Value()) + if err != nil { + // An error here would indicate something is very wrong, + // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPruneV2. + panic(err) + } + + consumerAddrsToPrune = append(consumerAddrsToPrune, types.ConsumerAddrsToPruneV2{ + PruneAfterTs: pruneAfterTs, + ConsumerAddrs: &addrs, + ChainId: chainID, + }) + } + + return consumerAddrsToPrune +} + +// DeleteConsumerAddrsToPruneV2 deletes the list of consumer addresses mapped to a timestamp +func (k Keeper) DeleteConsumerAddrsToPruneV2(ctx sdk.Context, chainID string, pruneAfterTs time.Time) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs)) +} + // AssignConsumerKey assigns the consumerKey to the validator with providerAddr // on the consumer chain with ID chainID, if it is either registered or currently // voted on in a ConsumerAddition governance proposal diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index abf7858d40..4616e226c9 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -270,6 +270,90 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { require.Equal(t, expectedGetAllOrder, result) } +func TestConsumerAddrsToPruneV2CRUD(t *testing.T) { + chainID := consumer + consumerAddr := types.NewConsumerConsAddress([]byte("consumerAddr1")) + + keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + ts := ctx.BlockTime() + + addrsToPrune := keeper.GetConsumerAddrsToPruneV2(ctx, chainID, ts).Addresses + require.Empty(t, addrsToPrune) + + keeper.AppendConsumerAddrsToPruneV2(ctx, chainID, ts, consumerAddr) + + addrsToPrune = keeper.GetConsumerAddrsToPruneV2(ctx, chainID, ts).Addresses + require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") + require.Equal(t, addrsToPrune[0], consumerAddr.ToSdkConsAddr().Bytes()) + + keeper.DeleteConsumerAddrsToPruneV2(ctx, chainID, ts) + addrsToPrune = keeper.GetConsumerAddrsToPruneV2(ctx, chainID, ts).Addresses + require.Empty(t, addrsToPrune, "addresses to prune was returned") +} + +func TestGetAllConsumerAddrsToPruneV2(t *testing.T) { + pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + seed := time.Now().UnixNano() + rng := rand.New(rand.NewSource(seed)) + + chainIDs := []string{"consumer-1", "consumer-2", "consumer-3"} + numAssignments := 10 + testAssignments := []types.ConsumerAddrsToPruneV2{} + for i := 0; i < numAssignments; i++ { + consumerAddresses := types.AddressList{} + for j := 0; j < 2*(i+1); j++ { + addr := cryptotestutil.NewCryptoIdentityFromIntSeed(i * j).SDKValConsAddress() + consumerAddresses.Addresses = append(consumerAddresses.Addresses, addr) + } + testAssignments = append(testAssignments, + types.ConsumerAddrsToPruneV2{ + ChainId: chainIDs[rng.Intn(len(chainIDs))], + PruneAfterTs: time.Now().UTC(), + ConsumerAddrs: &consumerAddresses, + }, + ) + } + // select a chainID with more than two assignments + var chainID string + for i := range chainIDs { + chainID = chainIDs[i] + count := 0 + for _, assignment := range testAssignments { + if assignment.ChainId == chainID { + count++ + } + } + if count > 2 { + break + } + } + expectedGetAllOrder := []types.ConsumerAddrsToPruneV2{} + for _, assignment := range testAssignments { + if assignment.ChainId == chainID { + expectedGetAllOrder = append(expectedGetAllOrder, assignment) + } + } + // sorting by ConsumerAddrsToPrune.PruneAfterTs + sort.Slice(expectedGetAllOrder, func(i, j int) bool { + return expectedGetAllOrder[i].PruneAfterTs.Before(expectedGetAllOrder[j].PruneAfterTs) + }) + + for _, assignment := range testAssignments { + for _, addr := range assignment.ConsumerAddrs.Addresses { + consumerAddr := types.NewConsumerConsAddress(addr) + pk.AppendConsumerAddrsToPruneV2(ctx, assignment.ChainId, assignment.PruneAfterTs, consumerAddr) + } + } + + result := pk.GetAllConsumerAddrsToPruneV2(ctx, chainID) + require.Equal(t, expectedGetAllOrder, result) +} + // checkCorrectPruningProperty checks that the pruning property is correct for a given // consumer chain. See AppendConsumerAddrsToPrune for a formulation of the property. func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chainID string) bool { diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 2aba5e21d8..186120f959 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -135,6 +135,7 @@ const ( // ConsumerAddrsToPruneBytePrefix is the byte prefix that will store the mapping from VSC ids // to consumer validators addresses needed for pruning + // TODO: deprecate once all consumer addresses stored under this prefix are pruned ConsumerAddrsToPruneBytePrefix // SlashLogBytePrefix is the byte prefix that will store the mapping from provider address to boolean @@ -197,6 +198,12 @@ const ( // minimum power required to be in the top N per consumer chain. MinimumPowerInTopNBytePrefix + // ConsumerAddrsToPruneV2BytePrefix is the byte prefix that will store + // consumer validators addresses that need to be pruned. These are stored as a + // ts -> (consumer_address1, consumer_address2, ...) mapping, where ts is the + // timestamp after which the consumer validators addresses can be pruned. + ConsumerAddrsToPruneV2BytePrefix + // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -398,6 +405,14 @@ func EquivocationEvidenceMinHeightKey(consumerChainID string) []byte { return append([]byte{EquivocationEvidenceMinHeightBytePrefix}, []byte(consumerChainID)...) } +// ConsumerAddrsToPruneV2Key returns the key under which the consumer validators +// addresses that need to be pruned are stored. These are stored as a +// ts -> (consumer_address1, consumer_address2, ...) mapping, where ts is the +// timestamp after which the consumer validators addresses can be pruned. +func ConsumerAddrsToPruneV2Key(chainID string, pruneAfterTs time.Time) []byte { + return ChainIdAndTsKey(ConsumerAddrsToPruneV2BytePrefix, chainID, pruneAfterTs) +} + // NOTE: DO NOT ADD FULLY DEFINED KEY FUNCTIONS WITHOUT ADDING THEM TO getAllFullyDefinedKeys() IN keys_test.go // diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index b33845a5ba..51cfc2aaea 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -62,6 +62,7 @@ func getAllKeyPrefixes() []byte { providertypes.ConsumerRewardsAllocationBytePrefix, providertypes.ConsumerCommissionRatePrefix, providertypes.MinimumPowerInTopNBytePrefix, + providertypes.ConsumerAddrsToPruneV2BytePrefix, } } @@ -101,6 +102,7 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ConsumerAddrsToPruneKey("chainID", 88), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.EquivocationEvidenceMinHeightKey("chainID"), + providertypes.ConsumerAddrsToPruneV2Key("chainID", time.Time{}), } } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 80cb1e5626..a6a29991eb 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -1202,6 +1202,7 @@ func (m *ValidatorByConsumerAddr) GetProviderAddr() []byte { // Used to serialize the ConsumerAddrsToPrune index from key assignment // ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList +// TODO remove once all consumer addresses stored under the ConsumerAddrsToPrune index are pruned type ConsumerAddrsToPrune struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` VscId uint64 `protobuf:"varint,2,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` @@ -1262,6 +1263,68 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { return nil } +// Used to serialize the ConsumerAddrsToPruneV2 index from key assignment +// ConsumerAddrsToPruneV2: (chainID, pruneAfterTs time.Time) -> consumerAddrs AddressList +type ConsumerAddrsToPruneV2 struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + PruneAfterTs time.Time `protobuf:"bytes,2,opt,name=prune_after_ts,json=pruneAfterTs,proto3,stdtime" json:"prune_after_ts"` + ConsumerAddrs *AddressList `protobuf:"bytes,3,opt,name=consumer_addrs,json=consumerAddrs,proto3" json:"consumer_addrs,omitempty"` +} + +func (m *ConsumerAddrsToPruneV2) Reset() { *m = ConsumerAddrsToPruneV2{} } +func (m *ConsumerAddrsToPruneV2) String() string { return proto.CompactTextString(m) } +func (*ConsumerAddrsToPruneV2) ProtoMessage() {} +func (*ConsumerAddrsToPruneV2) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{18} +} +func (m *ConsumerAddrsToPruneV2) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerAddrsToPruneV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerAddrsToPruneV2.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerAddrsToPruneV2) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerAddrsToPruneV2.Merge(m, src) +} +func (m *ConsumerAddrsToPruneV2) XXX_Size() int { + return m.Size() +} +func (m *ConsumerAddrsToPruneV2) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerAddrsToPruneV2.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerAddrsToPruneV2 proto.InternalMessageInfo + +func (m *ConsumerAddrsToPruneV2) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ConsumerAddrsToPruneV2) GetPruneAfterTs() time.Time { + if m != nil { + return m.PruneAfterTs + } + return time.Time{} +} + +func (m *ConsumerAddrsToPruneV2) GetConsumerAddrs() *AddressList { + if m != nil { + return m.ConsumerAddrs + } + return nil +} + // ConsumerValidator is used to facilitate epoch-based transitions. It contains relevant info for // a validator that is expected to validate on a consumer chain during an epoch. type ConsumerValidator struct { @@ -1277,7 +1340,7 @@ func (m *ConsumerValidator) Reset() { *m = ConsumerValidator{} } func (m *ConsumerValidator) String() string { return proto.CompactTextString(m) } func (*ConsumerValidator) ProtoMessage() {} func (*ConsumerValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{18} + return fileDescriptor_f22ec409a72b7b72, []int{19} } func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1338,7 +1401,7 @@ func (m *ConsumerRewardsAllocation) Reset() { *m = ConsumerRewardsAlloca func (m *ConsumerRewardsAllocation) String() string { return proto.CompactTextString(m) } func (*ConsumerRewardsAllocation) ProtoMessage() {} func (*ConsumerRewardsAllocation) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{19} + return fileDescriptor_f22ec409a72b7b72, []int{20} } func (m *ConsumerRewardsAllocation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1393,6 +1456,7 @@ func init() { proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") + proto.RegisterType((*ConsumerAddrsToPruneV2)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPruneV2") proto.RegisterType((*ConsumerValidator)(nil), "interchain_security.ccv.provider.v1.ConsumerValidator") proto.RegisterType((*ConsumerRewardsAllocation)(nil), "interchain_security.ccv.provider.v1.ConsumerRewardsAllocation") } @@ -1402,120 +1466,122 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1797 bytes of a gzipped FileDescriptorProto + // 1835 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xe2, 0x95, 0xaa, 0x92, 0xf4, 0xa6, 0x09, - 0xd4, 0xb8, 0xde, 0x8d, 0x94, 0x1e, 0x0c, 0xa3, 0x41, 0x40, 0x51, 0x4e, 0x6c, 0x2b, 0x71, 0xd8, - 0x95, 0x60, 0x03, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, + 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xec, 0x95, 0xaa, 0x92, 0xf4, 0xa6, 0x09, + 0xd4, 0xb8, 0xde, 0x8d, 0x94, 0x1e, 0x0c, 0xa3, 0x41, 0x40, 0x51, 0x4e, 0x6c, 0x29, 0x71, 0xd8, + 0x95, 0x60, 0x03, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x91, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, 0x79, 0xe9, 0xb9, 0x87, 0x16, 0x48, 0x2f, 0x45, 0xd0, 0x43, 0x9b, 0x16, 0x28, 0x50, 0xf4, 0xd2, - 0xfe, 0x19, 0x39, 0xe6, 0xd8, 0x53, 0x52, 0xd8, 0x87, 0x1e, 0xfa, 0x4f, 0x14, 0x33, 0xfb, 0x49, - 0x7d, 0xb8, 0x34, 0x52, 0x5f, 0xa4, 0xdd, 0x37, 0xef, 0xfd, 0xe6, 0xcd, 0x9b, 0xf7, 0xde, 0xef, - 0x71, 0xc1, 0x01, 0x0d, 0x25, 0xe1, 0x78, 0x88, 0x68, 0xe8, 0x09, 0x82, 0xc7, 0x9c, 0xca, 0x89, - 0x83, 0x71, 0xec, 0x44, 0x9c, 0xc5, 0xd4, 0x27, 0xdc, 0x89, 0xf7, 0xf3, 0x67, 0x3b, 0xe2, 0x4c, - 0x32, 0xf8, 0xd6, 0x15, 0x36, 0x36, 0xc6, 0xb1, 0x9d, 0xeb, 0xc5, 0xfb, 0x3b, 0x6f, 0x5f, 0x07, - 0x1c, 0xef, 0x3b, 0xe7, 0x94, 0x93, 0x04, 0x6b, 0x67, 0x6b, 0xc0, 0x06, 0x4c, 0x3f, 0x3a, 0xea, - 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xbe, 0x4a, 0x23, 0xf1, 0x45, 0xda, 0x7d, 0xf3, 0xde, 0x6f, 0xde, 0xbc, 0x79, 0xef, 0xfd, + 0x1e, 0x17, 0xec, 0xd1, 0x50, 0x12, 0x8e, 0xfb, 0x88, 0x86, 0x9e, 0x20, 0x78, 0xc8, 0xa9, 0x1c, + 0x39, 0x18, 0xc7, 0x4e, 0xc4, 0x59, 0x4c, 0x7d, 0xc2, 0x9d, 0x78, 0x37, 0x7f, 0xb6, 0x23, 0xce, + 0x24, 0x83, 0x6f, 0x5e, 0x61, 0x63, 0x63, 0x1c, 0xdb, 0xb9, 0x5e, 0xbc, 0xbb, 0xf5, 0xd6, 0x75, + 0xc0, 0xf1, 0xae, 0x73, 0x4e, 0x39, 0x49, 0xb0, 0xb6, 0x36, 0x7a, 0xac, 0xc7, 0xf4, 0xa3, 0xa3, + 0x9e, 0x52, 0x69, 0xa3, 0xc7, 0x58, 0x2f, 0x20, 0x8e, 0x7e, 0xeb, 0x0e, 0x4f, 0x1d, 0x49, 0x07, + 0x44, 0x48, 0x34, 0x88, 0x52, 0x85, 0xfa, 0x45, 0x05, 0x7f, 0xc8, 0x91, 0xa4, 0x2c, 0xcc, 0x00, + 0x68, 0x17, 0x3b, 0x98, 0x71, 0xe2, 0xe0, 0x80, 0x92, 0x50, 0xaa, 0x5d, 0x93, 0xa7, 0x54, 0xc1, + 0x51, 0x0a, 0x01, 0xed, 0xf5, 0x65, 0x22, 0x16, 0x8e, 0x24, 0xa1, 0x4f, 0xf8, 0x80, 0x26, 0xca, + 0xe3, 0xb7, 0xd4, 0x60, 0xbb, 0xb0, 0x8e, 0xf9, 0x28, 0x92, 0xcc, 0x39, 0x23, 0x23, 0x91, 0xae, + 0xbe, 0x8d, 0x99, 0x18, 0x30, 0xe1, 0x10, 0x75, 0xfe, 0x10, 0x13, 0x27, 0xde, 0xed, 0x12, 0x89, + 0x76, 0x73, 0x41, 0xe6, 0x77, 0xaa, 0xd7, 0x45, 0x62, 0xac, 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xf1, 0x31, 0x79, 0xfe, 0x64, 0x38, 0x80, 0xef, 0x81, 0x5b, 0xd9, 0xe4, 0xe4, 0xc5, 0x28, + 0xf0, 0x94, 0xbd, 0x0a, 0x07, 0xd7, 0xd9, 0xbb, 0xe8, 0xae, 0x67, 0xab, 0x4f, 0x51, 0xa0, 0x36, + 0x6b, 0xf9, 0x3e, 0xb7, 0xfe, 0x30, 0x07, 0xe6, 0x3b, 0x88, 0xa3, 0x81, 0x80, 0x27, 0x60, 0x45, + 0x92, 0x41, 0x14, 0x20, 0x49, 0xbc, 0x84, 0x9a, 0xd3, 0x93, 0xde, 0xd5, 0x94, 0x5d, 0x9c, 0x72, + 0xec, 0xc2, 0x5c, 0x13, 0xef, 0xda, 0x6d, 0x2d, 0x3d, 0x96, 0x48, 0x12, 0x77, 0x39, 0xc3, 0x48, + 0x84, 0xf0, 0x3e, 0x30, 0x25, 0x1f, 0x0a, 0x39, 0x26, 0xcd, 0x31, 0x5b, 0x24, 0x77, 0x79, 0x2b, + 0x5b, 0x4f, 0x78, 0x26, 0x67, 0x89, 0xab, 0xf9, 0xb1, 0xf4, 0x5d, 0xf8, 0xf1, 0x18, 0xac, 0xab, + 0xe1, 0xe2, 0x22, 0x66, 0x79, 0x7a, 0xcc, 0x35, 0x65, 0x3f, 0x09, 0xea, 0x83, 0x6d, 0xa1, 0x32, + 0xc5, 0x1b, 0x10, 0xa9, 0xa9, 0x31, 0x0a, 0x48, 0x48, 0x45, 0x3f, 0x43, 0x9f, 0x9f, 0x1e, 0x7d, + 0x53, 0x03, 0x7d, 0xa2, 0x70, 0xdc, 0x0c, 0x26, 0xdd, 0xa5, 0x0d, 0xea, 0x57, 0xef, 0x92, 0x47, + 0x73, 0x41, 0x47, 0xf3, 0x07, 0x57, 0x40, 0xe4, 0x21, 0x15, 0xe0, 0xed, 0x02, 0x85, 0xab, 0x12, + 0xf4, 0x74, 0xf6, 0x7b, 0x9c, 0xf4, 0x14, 0xcf, 0xa1, 0x84, 0xcd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b3, 0x81, + 0x93, 0x7e, 0x6a, 0x49, 0xfe, 0xdd, 0x13, 0xfe, 0x99, 0x23, 0x47, 0x11, 0x11, 0x99, 0x8d, 0xf8, + 0xfb, 0x7f, 0xfe, 0xf5, 0x8e, 0xe1, 0x66, 0xdb, 0xec, 0x3f, 0xfb, 0xf2, 0x45, 0xdd, 0xf8, 0xea, + 0x45, 0xdd, 0xf8, 0xf7, 0x8b, 0xba, 0xf1, 0xd9, 0xcb, 0xfa, 0xcc, 0x57, 0x2f, 0xeb, 0x33, 0x5f, + 0xbf, 0xac, 0xcf, 0xfc, 0xe2, 0xfd, 0xcb, 0xa0, 0xe3, 0x3b, 0xba, 0x97, 0x7f, 0xdc, 0x8a, 0x7f, + 0xea, 0xfc, 0x6a, 0xf2, 0xd3, 0x99, 0xde, 0xaf, 0x3b, 0xaf, 0xb3, 0xe2, 0xbd, 0xff, 0x05, 0x00, + 0x00, 0xff, 0xff, 0xec, 0x30, 0xb2, 0x8e, 0x6b, 0x13, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2490,6 +2556,56 @@ func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ConsumerAddrsToPruneV2) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerAddrsToPruneV2) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerAddrsToPruneV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ConsumerAddrs != nil { + { + size, err := m.ConsumerAddrs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + n17, err17 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneAfterTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneAfterTs):]) + if err17 != nil { + return 0, err17 + } + i -= n17 + i = encodeVarintProvider(dAtA, i, uint64(n17)) + i-- + dAtA[i] = 0x12 + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *ConsumerValidator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3020,6 +3136,25 @@ func (m *ConsumerAddrsToPrune) Size() (n int) { return n } +func (m *ConsumerAddrsToPruneV2) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneAfterTs) + n += 1 + l + sovProvider(uint64(l)) + if m.ConsumerAddrs != nil { + l = m.ConsumerAddrs.Size() + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + func (m *ConsumerValidator) Size() (n int) { if m == nil { return 0 @@ -6113,6 +6248,157 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { } return nil } +func (m *ConsumerAddrsToPruneV2) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerAddrsToPruneV2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerAddrsToPruneV2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PruneAfterTs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.PruneAfterTs, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsumerAddrs == nil { + m.ConsumerAddrs = &AddressList{} + } + if err := m.ConsumerAddrs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ConsumerValidator) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From b330507c82632b3e7b13ed822ffb7858ed20a423 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 20 Jun 2024 11:38:58 +0200 Subject: [PATCH 33/81] add consumer_addrs_to_prune_v2 to GenesisState --- .../ccv/provider/v1/genesis.proto | 10 +- x/ccv/provider/keeper/genesis.go | 8 +- x/ccv/provider/keeper/genesis_test.go | 6 +- x/ccv/provider/types/genesis.go | 6 +- x/ccv/provider/types/genesis.pb.go | 156 +++++++++--------- x/ccv/provider/types/key_assignment.go | 3 +- 6 files changed, 96 insertions(+), 93 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index d7dffcf531..00071baa3a 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -17,6 +17,9 @@ message GenesisState { // Reserve 4th slot for removed mature_unbonding_ops field reserved 4; + // Reserve 11th slot for consumer_addrs_to_prune field + reserved 11; + // Reserve 13th slot for removed exported_vsc_send_timestamps field reserved 13; @@ -43,12 +46,13 @@ message GenesisState { // empty for a new chain repeated ValidatorByConsumerAddr validators_by_consumer_addr = 10 [ (gogoproto.nullable) = false ]; - // empty for a new chain - repeated ConsumerAddrsToPrune consumer_addrs_to_prune = 11 - [ (gogoproto.nullable) = false ]; repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 12 [ (gogoproto.nullable) = false ]; + + // empty for a new chain + repeated ConsumerAddrsToPruneV2 consumer_addrs_to_prune_v2 = 14 + [ (gogoproto.nullable) = false ]; } // The provider CCV module's knowledge of consumer state. diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 6ee2b63f17..ff67acada2 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -72,10 +72,10 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { k.SetValidatorByConsumerAddr(ctx, item.ChainId, consumerAddr, providerAddr) } - for _, item := range genState.ConsumerAddrsToPrune { + for _, item := range genState.ConsumerAddrsToPruneV2 { for _, addr := range item.ConsumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addr) - k.AppendConsumerAddrsToPrune(ctx, item.ChainId, item.VscId, consumerAddr) + k.AppendConsumerAddrsToPruneV2(ctx, item.ChainId, item.PruneAfterTs, consumerAddr) } } @@ -127,9 +127,9 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { } // ConsumerAddrsToPrune are added only for registered consumer chains - consumerAddrsToPrune := []types.ConsumerAddrsToPrune{} + consumerAddrsToPrune := []types.ConsumerAddrsToPruneV2{} for _, chainID := range registeredChainIDs { - consumerAddrsToPrune = append(consumerAddrsToPrune, k.GetAllConsumerAddrsToPrune(ctx, chainID)...) + consumerAddrsToPrune = append(consumerAddrsToPrune, k.GetAllConsumerAddrsToPruneV2(ctx, chainID)...) } params := k.GetParams(ctx) diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index e0a1f3e395..0f2f511194 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -86,10 +86,10 @@ func TestInitAndExportGenesis(t *testing.T) { ConsumerAddr: consumerConsAddr.ToSdkConsAddr(), }, }, - []providertypes.ConsumerAddrsToPrune{ + []providertypes.ConsumerAddrsToPruneV2{ { ChainId: cChainIDs[0], - VscId: vscID, + PruneAfterTs: oneHourFromNow, ConsumerAddrs: &providertypes.AddressList{Addresses: [][]byte{consumerConsAddr.ToSdkConsAddr()}}, }, }, @@ -145,7 +145,7 @@ func TestInitAndExportGenesis(t *testing.T) { require.True(t, found) require.Equal(t, provAddr, providerAddr) - addrs := pk.GetConsumerAddrsToPrune(ctx, cChainIDs[0], vscID) + addrs := pk.GetConsumerAddrsToPruneV2(ctx, cChainIDs[0], oneHourFromNow) // Expect same list as what was provided in provGenesis expectedAddrList := providertypes.AddressList{Addresses: [][]byte{consumerConsAddr.ToSdkConsAddr()}} require.Equal(t, expectedAddrList, addrs) diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index aad59d9982..1e2d0b0e3c 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -21,7 +21,7 @@ func NewGenesisState( params Params, validatorConsumerPubkeys []ValidatorConsumerPubKey, validatorsByConsumerAddr []ValidatorByConsumerAddr, - consumerAddrsToPrune []ConsumerAddrsToPrune, + consumerAddrsToPrune []ConsumerAddrsToPruneV2, initTimeoutTimestamps []InitTimeoutTimestamp, ) *GenesisState { return &GenesisState{ @@ -33,7 +33,7 @@ func NewGenesisState( Params: params, ValidatorConsumerPubkeys: validatorConsumerPubkeys, ValidatorsByConsumerAddr: validatorsByConsumerAddr, - ConsumerAddrsToPrune: consumerAddrsToPrune, + ConsumerAddrsToPruneV2: consumerAddrsToPrune, InitTimeoutTimestamps: initTimeoutTimestamps, } } @@ -82,7 +82,7 @@ func (gs GenesisState) Validate() error { if err := KeyAssignmentValidateBasic(gs.ValidatorConsumerPubkeys, gs.ValidatorsByConsumerAddr, - gs.ConsumerAddrsToPrune, + gs.ConsumerAddrsToPruneV2, ); err != nil { return err } diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index 5e42ffd760..3c88d05272 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -41,9 +41,9 @@ type GenesisState struct { ValidatorConsumerPubkeys []ValidatorConsumerPubKey `protobuf:"bytes,9,rep,name=validator_consumer_pubkeys,json=validatorConsumerPubkeys,proto3" json:"validator_consumer_pubkeys"` // empty for a new chain ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,10,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` + InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` // empty for a new chain - ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` - InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` + ConsumerAddrsToPruneV2 []ConsumerAddrsToPruneV2 `protobuf:"bytes,14,rep,name=consumer_addrs_to_prune_v2,json=consumerAddrsToPruneV2,proto3" json:"consumer_addrs_to_prune_v2"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -135,16 +135,16 @@ func (m *GenesisState) GetValidatorsByConsumerAddr() []ValidatorByConsumerAddr { return nil } -func (m *GenesisState) GetConsumerAddrsToPrune() []ConsumerAddrsToPrune { +func (m *GenesisState) GetInitTimeoutTimestamps() []InitTimeoutTimestamp { if m != nil { - return m.ConsumerAddrsToPrune + return m.InitTimeoutTimestamps } return nil } -func (m *GenesisState) GetInitTimeoutTimestamps() []InitTimeoutTimestamp { +func (m *GenesisState) GetConsumerAddrsToPruneV2() []ConsumerAddrsToPruneV2 { if m != nil { - return m.InitTimeoutTimestamps + return m.ConsumerAddrsToPruneV2 } return nil } @@ -316,58 +316,58 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 805 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x8f, 0xe2, 0x36, - 0x14, 0x27, 0x43, 0x86, 0x0d, 0x9e, 0x1d, 0x8a, 0xac, 0x2d, 0x9b, 0x65, 0x54, 0x76, 0x44, 0xb5, - 0x12, 0x52, 0x5b, 0xb2, 0xd0, 0x1e, 0xfa, 0x6f, 0x0f, 0xcb, 0xae, 0xd4, 0x42, 0x2f, 0x88, 0xa5, - 0x5b, 0x69, 0x2e, 0x91, 0x71, 0x2c, 0xb0, 0x48, 0xe2, 0xc8, 0x76, 0x32, 0x45, 0x55, 0xa5, 0x56, - 0xfd, 0x02, 0x55, 0x8f, 0xfd, 0x44, 0x73, 0x9c, 0x63, 0x4f, 0xa3, 0x6a, 0xe6, 0x1b, 0xf4, 0x13, - 0x54, 0x71, 0x9c, 0x14, 0xa6, 0xcc, 0x08, 0xf6, 0x04, 0xf1, 0xcf, 0xef, 0xf7, 0x7e, 0xef, 0x3d, - 0xfb, 0x67, 0xd0, 0xa3, 0xa1, 0x24, 0x1c, 0x2f, 0x10, 0x0d, 0x5d, 0x41, 0x70, 0xcc, 0xa9, 0x5c, - 0x39, 0x18, 0x27, 0x4e, 0xc4, 0x59, 0x42, 0x3d, 0xc2, 0x9d, 0xa4, 0xe7, 0xcc, 0x49, 0x48, 0x04, - 0x15, 0xdd, 0x88, 0x33, 0xc9, 0xe0, 0x87, 0x5b, 0x42, 0xba, 0x18, 0x27, 0xdd, 0x3c, 0xa4, 0x9b, - 0xf4, 0x9a, 0x8f, 0xe6, 0x6c, 0xce, 0xd4, 0x7e, 0x27, 0xfd, 0x97, 0x85, 0x36, 0x9f, 0xdf, 0x95, - 0x2d, 0xe9, 0x39, 0x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0xd3, 0xb2, 0xea, 0xd5, 0xf6, 0x19, 0x68, 0x6c, 0xb7, 0xcc, 0x3d, 0x9e, - 0x8e, 0x06, 0xa8, 0xe8, 0x7e, 0x1f, 0x28, 0x5c, 0x7f, 0x0d, 0x7e, 0xb8, 0xb8, 0x6e, 0x19, 0x97, - 0xd7, 0x2d, 0xe3, 0xef, 0xeb, 0x96, 0xf1, 0xfb, 0x4d, 0xab, 0x74, 0x79, 0xd3, 0x2a, 0xfd, 0x75, - 0xd3, 0x2a, 0x9d, 0xbd, 0x98, 0x53, 0xb9, 0x88, 0x67, 0x5d, 0xcc, 0x02, 0x07, 0x33, 0x11, 0x30, - 0xe1, 0xfc, 0xd7, 0x90, 0x4f, 0x8a, 0xd7, 0x2e, 0xf9, 0xcc, 0xf9, 0x71, 0xf3, 0xc9, 0x93, 0xab, - 0x88, 0x88, 0x59, 0x45, 0xbd, 0x76, 0x9f, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xd7, 0x76, - 0x7e, 0xea, 0x07, 0x00, 0x00, + // 815 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x8f, 0xdb, 0x44, + 0x14, 0x8f, 0x37, 0xde, 0xd4, 0x99, 0xdd, 0x0d, 0xd6, 0xa8, 0x04, 0x37, 0x2b, 0xd2, 0x55, 0x50, + 0xa5, 0x48, 0x40, 0xdc, 0x04, 0x0e, 0xfc, 0xeb, 0xa1, 0x69, 0x25, 0x48, 0xb8, 0x44, 0x69, 0x58, + 0xa4, 0x5e, 0x46, 0x93, 0xf1, 0x28, 0x19, 0xc5, 0xf6, 0x58, 0x9e, 0xb1, 0x97, 0x08, 0x21, 0x81, + 0xf8, 0x02, 0x9c, 0xb9, 0xf0, 0x75, 0x7a, 0xec, 0x91, 0x53, 0x85, 0x76, 0xbf, 0x01, 0x9f, 0x00, + 0x79, 0x3c, 0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07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -390,10 +390,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.InitTimeoutTimestamps) > 0 { - for iNdEx := len(m.InitTimeoutTimestamps) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ConsumerAddrsToPruneV2) > 0 { + for iNdEx := len(m.ConsumerAddrsToPruneV2) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.InitTimeoutTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ConsumerAddrsToPruneV2[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -401,13 +401,13 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x62 + dAtA[i] = 0x72 } } - if len(m.ConsumerAddrsToPrune) > 0 { - for iNdEx := len(m.ConsumerAddrsToPrune) - 1; iNdEx >= 0; iNdEx-- { + if len(m.InitTimeoutTimestamps) > 0 { + for iNdEx := len(m.InitTimeoutTimestamps) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ConsumerAddrsToPrune[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.InitTimeoutTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -415,7 +415,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x5a + dAtA[i] = 0x62 } } if len(m.ValidatorsByConsumerAddr) > 0 { @@ -693,14 +693,14 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.ConsumerAddrsToPrune) > 0 { - for _, e := range m.ConsumerAddrsToPrune { + if len(m.InitTimeoutTimestamps) > 0 { + for _, e := range m.InitTimeoutTimestamps { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.InitTimeoutTimestamps) > 0 { - for _, e := range m.InitTimeoutTimestamps { + if len(m.ConsumerAddrsToPruneV2) > 0 { + for _, e := range m.ConsumerAddrsToPruneV2 { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -1052,9 +1052,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 11: + case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrsToPrune", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutTimestamps", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1081,14 +1081,14 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumerAddrsToPrune = append(m.ConsumerAddrsToPrune, ConsumerAddrsToPrune{}) - if err := m.ConsumerAddrsToPrune[len(m.ConsumerAddrsToPrune)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.InitTimeoutTimestamps = append(m.InitTimeoutTimestamps, InitTimeoutTimestamp{}) + if err := m.InitTimeoutTimestamps[len(m.InitTimeoutTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 12: + case 14: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutTimestamps", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrsToPruneV2", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1115,8 +1115,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitTimeoutTimestamps = append(m.InitTimeoutTimestamps, InitTimeoutTimestamp{}) - if err := m.InitTimeoutTimestamps[len(m.InitTimeoutTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ConsumerAddrsToPruneV2 = append(m.ConsumerAddrsToPruneV2, ConsumerAddrsToPruneV2{}) + if err := m.ConsumerAddrsToPruneV2[len(m.ConsumerAddrsToPruneV2)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ccv/provider/types/key_assignment.go b/x/ccv/provider/types/key_assignment.go index 04192ae53a..2d615e2e8a 100644 --- a/x/ccv/provider/types/key_assignment.go +++ b/x/ccv/provider/types/key_assignment.go @@ -67,7 +67,7 @@ func (c *ConsumerConsAddress) String() string { func KeyAssignmentValidateBasic( assignedKeys []ValidatorConsumerPubKey, byConsumerAddrs []ValidatorByConsumerAddr, - consumerAddrsToPrune []ConsumerAddrsToPrune, + consumerAddrsToPrune []ConsumerAddrsToPruneV2, ) error { for _, e := range assignedKeys { if strings.TrimSpace(e.ChainId) == "" { @@ -95,7 +95,6 @@ func KeyAssignmentValidateBasic( if strings.TrimSpace(e.ChainId) == "" { return errorsmod.Wrap(ccvtypes.ErrInvalidGenesis, "consumer chain id must not be blank") } - // Don't check e.vscid, it's an unsigned integer for _, a := range e.ConsumerAddrs.Addresses { if err := sdk.VerifyAddressFormat(a); err != nil { return errorsmod.Wrap(ccvtypes.ErrInvalidGenesis, fmt.Sprintf("invalid consumer address: %s", a)) From 0b234324a7e76188842a47ec8e36a93465d80ad9 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 20 Jun 2024 12:01:27 +0200 Subject: [PATCH 34/81] add migration for ConsumerAddrsToPrune index --- x/ccv/provider/migrations/vX/migrations.go | 47 +++++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go index e6f091bf1d..66de1a0657 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -2,6 +2,7 @@ package vX import ( "encoding/binary" + "time" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -24,18 +25,52 @@ func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk provider } } +// MigrateConsumerAddrsToPrune migrates the ConsumerAddrsToPrune index to ConsumerAddrsToPruneV2. +// Note: This migration must be done before removing the VscSendTimestamp index +func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper, sk ccv.StakingKeeper) { + iterator := sdk.KVStorePrefixIterator(store, []byte{providertypes.ConsumerAddrsToPruneBytePrefix}) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(providertypes.ConsumerAddrsToPruneBytePrefix, iterator.Key()) + if err != nil { + pk.Logger(ctx).Error("ParseChainIdAndUintIdKey failed", "key", string(iterator.Key())) + } + // use the VscSendTimestamp index to compute the timestamp after which this consumer address can be pruned + vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(providertypes.VscSendTimestampBytePrefix, chainID, vscID) + sentTime := time.Time{} + if timeBz := store.Get(vscSendTimestampKey); timeBz != nil { + if ts, err := sdk.ParseTimeBytes(timeBz); err == nil { + sentTime = ts + } + } + pruneAfterTs := sentTime.Add(sk.UnbondingTime(ctx)) + + var addrs providertypes.AddressList + err = addrs.Unmarshal(iterator.Value()) + if err != nil { + pk.Logger(ctx).Error("MigrateConsumerAddrsToPrune failed unmarshaling data from store", "key", string(iterator.Value())) + } + + for _, addr := range addrs.Addresses { + consumerAddr := providertypes.NewConsumerConsAddress(addr) + pk.AppendConsumerAddrsToPruneV2(ctx, chainID, pruneAfterTs, consumerAddr) + } + } +} + // CleanupState removes deprecated state func CleanupState(ctx sdk.Context, store storetypes.KVStore) error { - removePrefix(ctx, store, providertypes.MaturedUnbondingOpsByteKey) - removePrefix(ctx, store, providertypes.UnbondingOpBytePrefix) - removePrefix(ctx, store, providertypes.UnbondingOpIndexBytePrefix) - removePrefix(ctx, store, providertypes.VscSendTimestampBytePrefix) - removePrefix(ctx, store, providertypes.VSCMaturedHandledThisBlockBytePrefix) + removePrefix(store, providertypes.MaturedUnbondingOpsByteKey) + removePrefix(store, providertypes.UnbondingOpBytePrefix) + removePrefix(store, providertypes.UnbondingOpIndexBytePrefix) + removePrefix(store, providertypes.VscSendTimestampBytePrefix) + removePrefix(store, providertypes.VSCMaturedHandledThisBlockBytePrefix) return nil } -func removePrefix(ctx sdk.Context, store storetypes.KVStore, prefix byte) error { +func removePrefix(store storetypes.KVStore, prefix byte) error { iterator := sdk.KVStorePrefixIterator(store, []byte{prefix}) defer iterator.Close() From f4bafdbdb0ec9779b87cfda2f13d5d4e0e86cf7f Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 20 Jun 2024 17:45:15 +0200 Subject: [PATCH 35/81] Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: insumity --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index ce6fab2fb2..56167d5576 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -62,7 +62,7 @@ Note that these removals require state migration. #### State Transitions Removing `VSCMaturedPackets` affects three ICS sub-protocols (see [HandleVSCMaturedPacket](https://github.com/cosmos/interchain-security/blob/v4.2.0/x/ccv/provider/keeper/relay.go#L51)): unbonding operations pausing, `VSCPackets` timeout, and key assignment pruning. -The first two are no longer needed, while the third (key assignment pruning) needs to be redesign to not depend on `VSCMaturedPackets`. +The first two are no longer needed, while the third (key assignment pruning) needs to be redesigned to not depend on `VSCMaturedPackets`. **Removing unbonding operations pausing:** From ca9b8f96f7fd94869ba1d3595184d274c9b07750 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 20 Jun 2024 17:49:35 +0200 Subject: [PATCH 36/81] Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: insumity --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 56167d5576..f862438ab5 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -113,7 +113,7 @@ Note that these removals require state migration. #### State Transitions -To stop the consumer chains from sending `VSCMaturedPackets`, it is sufficient to not sore the maturity time of `VSCPacket`s when receiving them, i.e., do not call `SetPacketMaturityTime` from the `OnRecvVSCPacket()` method. +To stop the consumer chains from sending `VSCMaturedPackets`, it is sufficient to not store the maturity time of `VSCPacket`s when receiving them, i.e., do not call `SetPacketMaturityTime` from the `OnRecvVSCPacket()` method. Note that eventually, no additional `VSCMaturedPackets` will be added to the sending queue as `QueueVSCMaturedPackets` iterates over elapsed maturity times. In addition, to cleanup the code, the `QueueVSCMaturedPackets` must be removed. From 76c5627e1fdb3be457b2b635beacc114e56e5fc7 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 21 Jun 2024 10:15:57 +0200 Subject: [PATCH 37/81] deprecate ConsumerAddrsToPruneBytePrefix --- x/ccv/provider/types/keys.go | 17 ++++++----------- x/ccv/provider/types/keys_test.go | 1 - 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 186120f959..53a7d0fcad 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -135,7 +135,8 @@ const ( // ConsumerAddrsToPruneBytePrefix is the byte prefix that will store the mapping from VSC ids // to consumer validators addresses needed for pruning - // TODO: deprecate once all consumer addresses stored under this prefix are pruned + // NOTE: This prefix is deprecated, but left in place to avoid consumer state migrations + // [DEPRECATED] ConsumerAddrsToPruneBytePrefix // SlashLogBytePrefix is the byte prefix that will store the mapping from provider address to boolean @@ -201,7 +202,7 @@ const ( // ConsumerAddrsToPruneV2BytePrefix is the byte prefix that will store // consumer validators addresses that need to be pruned. These are stored as a // ts -> (consumer_address1, consumer_address2, ...) mapping, where ts is the - // timestamp after which the consumer validators addresses can be pruned. + // timestamp at which the consumer validators addresses can be pruned. ConsumerAddrsToPruneV2BytePrefix // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go @@ -383,12 +384,6 @@ func ValidatorsByConsumerAddrKey(chainID string, addr ConsumerConsAddress) []byt return ChainIdAndConsAddrKey(ValidatorsByConsumerAddrBytePrefix, chainID, addr.ToSdkConsAddr()) } -// ConsumerAddrsToPruneKey returns the key under which the -// mapping from VSC ids to consumer validators addresses is stored -func ConsumerAddrsToPruneKey(chainID string, vscID uint64) []byte { - return ChainIdAndUintIdKey(ConsumerAddrsToPruneBytePrefix, chainID, vscID) -} - // SlashLogKey returns the key to a validator's slash log func SlashLogKey(providerAddr ProviderConsAddress) []byte { return append([]byte{SlashLogBytePrefix}, providerAddr.ToSdkConsAddr().Bytes()...) @@ -408,9 +403,9 @@ func EquivocationEvidenceMinHeightKey(consumerChainID string) []byte { // ConsumerAddrsToPruneV2Key returns the key under which the consumer validators // addresses that need to be pruned are stored. These are stored as a // ts -> (consumer_address1, consumer_address2, ...) mapping, where ts is the -// timestamp after which the consumer validators addresses can be pruned. -func ConsumerAddrsToPruneV2Key(chainID string, pruneAfterTs time.Time) []byte { - return ChainIdAndTsKey(ConsumerAddrsToPruneV2BytePrefix, chainID, pruneAfterTs) +// timestamp at which the consumer validators addresses can be pruned. +func ConsumerAddrsToPruneV2Key(chainID string, pruneTs time.Time) []byte { + return ChainIdAndTsKey(ConsumerAddrsToPruneV2BytePrefix, chainID, pruneTs) } // NOTE: DO NOT ADD FULLY DEFINED KEY FUNCTIONS WITHOUT ADDING THEM TO getAllFullyDefinedKeys() IN keys_test.go diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 51cfc2aaea..f65aec24df 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -99,7 +99,6 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.GlobalSlashEntryKey(providertypes.GlobalSlashEntry{}), providertypes.ConsumerValidatorsKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.ValidatorsByConsumerAddrKey("chainID", providertypes.NewConsumerConsAddress([]byte{0x05})), - providertypes.ConsumerAddrsToPruneKey("chainID", 88), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.EquivocationEvidenceMinHeightKey("chainID"), providertypes.ConsumerAddrsToPruneV2Key("chainID", time.Time{}), From 581dd48547f83d5d6d1c4155cf7fa4bc5d420471 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 21 Jun 2024 10:16:50 +0200 Subject: [PATCH 38/81] change name of field for ConsumerAddrsToPruneV2 --- .../ccv/provider/v1/provider.proto | 4 +- x/ccv/provider/types/provider.pb.go | 242 +++++++++--------- 2 files changed, 123 insertions(+), 123 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index b2f5e1b979..4752c8f2e2 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -318,10 +318,10 @@ message ConsumerAddrsToPrune { } // Used to serialize the ConsumerAddrsToPruneV2 index from key assignment -// ConsumerAddrsToPruneV2: (chainID, pruneAfterTs time.Time) -> consumerAddrs AddressList +// ConsumerAddrsToPruneV2: (chainID, pruneTs time.Time) -> consumerAddrs AddressList message ConsumerAddrsToPruneV2 { string chain_id = 1; - google.protobuf.Timestamp prune_after_ts = 2 + google.protobuf.Timestamp prune_ts = 2 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; AddressList consumer_addrs = 3; } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index a6a29991eb..db7481c433 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -1264,10 +1264,10 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { } // Used to serialize the ConsumerAddrsToPruneV2 index from key assignment -// ConsumerAddrsToPruneV2: (chainID, pruneAfterTs time.Time) -> consumerAddrs AddressList +// ConsumerAddrsToPruneV2: (chainID, pruneTs time.Time) -> consumerAddrs AddressList type ConsumerAddrsToPruneV2 struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - PruneAfterTs time.Time `protobuf:"bytes,2,opt,name=prune_after_ts,json=pruneAfterTs,proto3,stdtime" json:"prune_after_ts"` + PruneTs time.Time `protobuf:"bytes,2,opt,name=prune_ts,json=pruneTs,proto3,stdtime" json:"prune_ts"` ConsumerAddrs *AddressList `protobuf:"bytes,3,opt,name=consumer_addrs,json=consumerAddrs,proto3" json:"consumer_addrs,omitempty"` } @@ -1311,9 +1311,9 @@ func (m *ConsumerAddrsToPruneV2) GetChainId() string { return "" } -func (m *ConsumerAddrsToPruneV2) GetPruneAfterTs() time.Time { +func (m *ConsumerAddrsToPruneV2) GetPruneTs() time.Time { if m != nil { - return m.PruneAfterTs + return m.PruneTs } return time.Time{} } @@ -1466,122 +1466,122 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1835 bytes of a gzipped FileDescriptorProto + // 1829 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xec, 0x95, 0xaa, 0x92, 0xf4, 0xa6, 0x09, - 0xd4, 0xb8, 0xde, 0x8d, 0x94, 0x1e, 0x0c, 0xa3, 0x41, 0x40, 0x51, 0x4e, 0x6c, 0x29, 0x71, 0xd8, - 0x95, 0x60, 0x03, 0xed, 0x61, 0x31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2c, 0xcc, 0x00, - 0x68, 0x17, 0x3b, 0x98, 0x71, 0xe2, 0xe0, 0x80, 0x92, 0x50, 0xaa, 0x5d, 0x93, 0xa7, 0x54, 0xc1, - 0x51, 0x0a, 0x01, 0xed, 0xf5, 0x65, 0x22, 0x16, 0x8e, 0x24, 0xa1, 0x4f, 0xf8, 0x80, 0x26, 0xca, - 0xe3, 0xb7, 0xd4, 0x60, 0xbb, 0xb0, 0x8e, 0xf9, 0x28, 0x92, 0xcc, 0x39, 0x23, 0x23, 0x91, 0xae, - 0xbe, 0x8d, 0x99, 0x18, 0x30, 0xe1, 0x10, 0x75, 0xfe, 0x10, 0x13, 0x27, 0xde, 0xed, 0x12, 0x89, - 0x76, 0x73, 0x41, 0xe6, 0x77, 0xaa, 0xd7, 0x45, 0x62, 0xac, 0x83, 0x19, 0xcd, 0xfc, 0x5e, 0x43, - 0x03, 0x1a, 0x32, 0x47, 0xff, 0x4d, 0x44, 0xd6, 0x6f, 0x2b, 0xc0, 0x6c, 0xb3, 0x50, 0x0c, 0x07, - 0x84, 0xb7, 0x7c, 0x9f, 0xaa, 0x53, 0x76, 0x38, 0x8b, 0x98, 0x40, 0x01, 0xdc, 0x00, 0x73, 0x92, - 0xca, 0x80, 0x98, 0x46, 0xd3, 0xd8, 0xa9, 0xba, 0xc9, 0x0b, 0x6c, 0x82, 0x9a, 0x4f, 0x04, 0xe6, - 0x34, 0x52, 0xca, 0xe6, 0xac, 0x5e, 0x2b, 0x8a, 0xe0, 0x26, 0xa8, 0x24, 0x57, 0x43, 0x7d, 0xb3, - 0xa4, 0x97, 0x17, 0xf4, 0xfb, 0x63, 0x1f, 0x7e, 0x04, 0x96, 0x69, 0x48, 0x25, 0x45, 0x81, 0xd7, - 0x27, 0x2a, 0x40, 0x66, 0xb9, 0x69, 0xec, 0xd4, 0xf6, 0xb6, 0x6c, 0xda, 0xc5, 0xb6, 0x8a, 0xa9, - 0x9d, 0x46, 0x32, 0xde, 0xb5, 0x1f, 0x69, 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0xab, - 0xe1, 0xe2, 0x22, 0x66, 0x79, 0x7a, 0xcc, 0x35, 0x65, 0x3f, 0x09, 0xea, 0x83, 0x6d, 0xa1, 0x32, - 0xc5, 0x1b, 0x10, 0xa9, 0xa9, 0x31, 0x0a, 0x48, 0x48, 0x45, 0x3f, 0x43, 0x9f, 0x9f, 0x1e, 0x7d, - 0x53, 0x03, 0x7d, 0xa2, 0x70, 0xdc, 0x0c, 0x26, 0xdd, 0xa5, 0x0d, 0xea, 0x57, 0xef, 0x92, 0x47, - 0x73, 0x41, 0x47, 0xf3, 0x07, 0x57, 0x40, 0xe4, 0x21, 0x15, 0xe0, 0xed, 0x02, 0x85, 0xab, 0x12, - 0xf4, 0x74, 0xf6, 0x7b, 0x9c, 0xf4, 0x14, 0xcf, 0xa1, 0x84, 0xcd, 0x09, 0xc9, 0xc7, 0x90, 0xb4, - 0xd4, 0xd5, 0xa0, 0x99, 0x97, 0x79, 0x9b, 0xd1, 0x30, 0x9d, 0xd5, 0xac, 0x31, 0xd3, 0xe7, 0x05, - 0xed, 0x16, 0xb0, 0x3e, 0x24, 0x44, 0x95, 0x5e, 0x81, 0xed, 0x49, 0xc4, 0x70, 0x5f, 0x4f, 0x23, - 0x25, 0x77, 0x39, 0x67, 0xf6, 0x87, 0x4a, 0x7a, 0x58, 0xae, 0xcc, 0xad, 0xce, 0x1f, 0x96, 0x2b, - 0x95, 0xd5, 0xaa, 0xf5, 0x63, 0x50, 0xd5, 0xf5, 0xd7, 0xc2, 0x67, 0x42, 0x37, 0x45, 0xdf, 0xe7, - 0x44, 0x08, 0x22, 0x4c, 0x23, 0x6d, 0x8a, 0x99, 0xc0, 0x92, 0x60, 0xf3, 0xba, 0xc9, 0x56, 0xc0, - 0x67, 0x60, 0x21, 0x22, 0x7a, 0xec, 0xd2, 0x86, 0xb5, 0xbd, 0xf7, 0xed, 0x29, 0x7e, 0x77, 0xd8, - 0xd7, 0x01, 0xba, 0x19, 0x9a, 0xc5, 0xc7, 0xf3, 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0x4e, 0xf5, 0x7a, 0x48, 0x14, 0x3a, 0x98, 0xd1, 0xcc, 0xef, 0x35, + 0x34, 0xa4, 0x21, 0x73, 0xf4, 0xdf, 0x44, 0x64, 0xfd, 0xba, 0x06, 0xcc, 0x0e, 0x0b, 0xc5, 0x68, + 0x48, 0xf8, 0xbe, 0xef, 0x53, 0x75, 0xca, 0x2e, 0x67, 0x11, 0x13, 0x28, 0x80, 0x1b, 0x60, 0x4e, + 0x52, 0x19, 0x10, 0xd3, 0x68, 0x1b, 0x3b, 0x75, 0x37, 0x79, 0x81, 0x6d, 0xd0, 0xf0, 0x89, 0xc0, + 0x9c, 0x46, 0x4a, 0xd9, 0x9c, 0xd5, 0x6b, 0x65, 0x11, 0xdc, 0x04, 0xb5, 0xe4, 0x6a, 0xa8, 0x6f, + 0x56, 0xf4, 0xf2, 0x82, 0x7e, 0x7f, 0xe0, 0xc3, 0x8f, 0xc1, 0x32, 0x0d, 0xa9, 0xa4, 0x28, 0xf0, + 0x06, 0x44, 0x05, 0xc8, 0xac, 0xb6, 0x8d, 0x9d, 0xc6, 0xde, 0x96, 0x4d, 0x7b, 0xd8, 0x56, 0x31, + 0xb5, 0xd3, 0x48, 0xc6, 0xbb, 0xf6, 0x7d, 0xad, 0x71, 0x50, 0xfd, 0xea, 0x9b, 0xd6, 0x8c, 0xbb, + 0x94, 0xda, 0x25, 0x42, 0x78, 0x03, 0x2c, 0xf6, 0x49, 0x48, 0x04, 0x15, 0xde, 0x00, 0x89, 0x81, + 0x39, 0xd7, 0x36, 0x76, 0x16, 0xdd, 0x46, 0x2a, 0xbb, 0x8f, 0xc4, 0x00, 0xb6, 0x40, 0xa3, 0x47, + 0x43, 0xc4, 0xc7, 0x89, 0xc6, 0xbc, 0xd6, 0x00, 0x89, 0x48, 0x2b, 0x74, 0x00, 0x10, 0x11, 0x3a, + 0x0b, 0x3d, 0x95, 0x00, 0xe6, 0x42, 0xea, 0x48, 0x72, 0xf9, 0x76, 0x76, 0xf9, 0x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 0x98, 0x0d, 0x9d, 0xf4, 0xfb, 0x4a, 0xf2, 0xef, + 0x96, 0xf0, 0x4f, 0x1d, 0x39, 0x8e, 0x88, 0xc8, 0x6c, 0xc4, 0x5f, 0xff, 0xf3, 0x8f, 0xf7, 0x0c, + 0x37, 0xdb, 0xe6, 0xe0, 0xc9, 0x57, 0xcf, 0x9b, 0xc6, 0xd7, 0xcf, 0x9b, 0xc6, 0xbf, 0x9f, 0x37, + 0x8d, 0xcf, 0x5f, 0x34, 0x67, 0xbe, 0x7e, 0xd1, 0x9c, 0xf9, 0xd7, 0x8b, 0xe6, 0xcc, 0xcf, 0x3e, + 0xbc, 0x08, 0x5a, 0xdc, 0xd1, 0xad, 0xfc, 0x8b, 0x56, 0xfc, 0x63, 0xe7, 0x17, 0x93, 0xdf, 0xcb, + 0xf4, 0x7e, 0xbd, 0x79, 0x9d, 0x10, 0x1f, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x86, 0x84, + 0x4b, 0x60, 0x13, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2588,7 +2588,7 @@ func (m *ConsumerAddrsToPruneV2) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x1a } - n17, err17 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneAfterTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneAfterTs):]) + n17, err17 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) if err17 != nil { return 0, err17 } @@ -3146,7 +3146,7 @@ func (m *ConsumerAddrsToPruneV2) Size() (n int) { if l > 0 { n += 1 + l + sovProvider(uint64(l)) } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneAfterTs) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs) n += 1 + l + sovProvider(uint64(l)) if m.ConsumerAddrs != nil { l = m.ConsumerAddrs.Size() @@ -6311,7 +6311,7 @@ func (m *ConsumerAddrsToPruneV2) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PruneAfterTs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PruneTs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6338,7 +6338,7 @@ func (m *ConsumerAddrsToPruneV2) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.PruneAfterTs, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.PruneTs, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 76ab502d0dbba0119bc413530e6713abe9940b1a Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 21 Jun 2024 10:18:47 +0200 Subject: [PATCH 39/81] reuse original ConsumerAddrsToPrune methods --- x/ccv/provider/keeper/genesis.go | 4 +- x/ccv/provider/keeper/genesis_test.go | 4 +- x/ccv/provider/keeper/key_assignment.go | 161 ++--- x/ccv/provider/keeper/key_assignment_test.go | 724 +++++++++---------- x/ccv/provider/migrations/vX/migrations.go | 2 +- 5 files changed, 398 insertions(+), 497 deletions(-) diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index ff67acada2..c7b7d4dd41 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -75,7 +75,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { for _, item := range genState.ConsumerAddrsToPruneV2 { for _, addr := range item.ConsumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addr) - k.AppendConsumerAddrsToPruneV2(ctx, item.ChainId, item.PruneAfterTs, consumerAddr) + k.AppendConsumerAddrsToPrune(ctx, item.ChainId, item.PruneTs, consumerAddr) } } @@ -129,7 +129,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // ConsumerAddrsToPrune are added only for registered consumer chains consumerAddrsToPrune := []types.ConsumerAddrsToPruneV2{} for _, chainID := range registeredChainIDs { - consumerAddrsToPrune = append(consumerAddrsToPrune, k.GetAllConsumerAddrsToPruneV2(ctx, chainID)...) + consumerAddrsToPrune = append(consumerAddrsToPrune, k.GetAllConsumerAddrsToPrune(ctx, chainID)...) } params := k.GetParams(ctx) diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 0f2f511194..6f16f0bbbe 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -89,7 +89,7 @@ func TestInitAndExportGenesis(t *testing.T) { []providertypes.ConsumerAddrsToPruneV2{ { ChainId: cChainIDs[0], - PruneAfterTs: oneHourFromNow, + PruneTs: oneHourFromNow, ConsumerAddrs: &providertypes.AddressList{Addresses: [][]byte{consumerConsAddr.ToSdkConsAddr()}}, }, }, @@ -145,7 +145,7 @@ func TestInitAndExportGenesis(t *testing.T) { require.True(t, found) require.Equal(t, provAddr, providerAddr) - addrs := pk.GetConsumerAddrsToPruneV2(ctx, cChainIDs[0], oneHourFromNow) + addrs := pk.GetConsumerAddrsToPrune(ctx, cChainIDs[0], oneHourFromNow) // Expect same list as what was provided in provGenesis expectedAddrList := providertypes.AddressList{Addresses: [][]byte{consumerConsAddr.ToSdkConsAddr()}} require.Equal(t, expectedAddrList, addrs) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index ce8985279d..e3efbebed4 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -233,16 +233,21 @@ func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, c } // AppendConsumerAddrsToPrune appends a consumer validator address to the list of consumer addresses -// that can be pruned once the VSCMaturedPacket with vscID is received. +// that can be pruned once the block time is at least pruneTs. // // The following invariant needs to hold: // For each consumer address cAddr in ValidatorByConsumerAddr, // - either there exists a provider address pAddr in ValidatorConsumerPubKey, // s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr -// - or there exists a vscID in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(vscID) -func (k Keeper) AppendConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscID uint64, consumerAddr types.ConsumerConsAddress) { +// - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) +func (k Keeper) AppendConsumerAddrsToPrune( + ctx sdk.Context, + chainID string, + pruneTs time.Time, + consumerAddr types.ConsumerConsAddress, +) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneKey(chainID, vscID)) + bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, pruneTs)) var consumerAddrsToPrune types.AddressList if bz != nil { err := consumerAddrsToPrune.Unmarshal(bz) @@ -259,18 +264,19 @@ func (k Keeper) AppendConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscI // consumerAddrsToPrune is instantiated in this method and should be able to be marshaled. panic(err) } - store.Set(types.ConsumerAddrsToPruneKey(chainID, vscID), bz) + store.Set(types.ConsumerAddrsToPruneV2Key(chainID, pruneTs), bz) } -// GetConsumerAddrsToPrune returns the list of consumer addresses -// that can be pruned once the VSCMaturedPacket with vscID is received +// GetConsumerAddrsToPrune returns the list of consumer addresses to prune stored under timestamp ts. +// Note that this method is only used in testing. func (k Keeper) GetConsumerAddrsToPrune( ctx sdk.Context, chainID string, - vscID uint64, + ts time.Time, ) (consumerAddrsToPrune types.AddressList) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneKey(chainID, vscID)) + + bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, ts)) if bz == nil { return } @@ -283,130 +289,84 @@ func (k Keeper) GetConsumerAddrsToPrune( return } -// GetAllConsumerAddrsToPrune gets all consumer addresses that can be pruned for a given chainID. +// ConsumeConsumerAddrsToPrune returns the list of consumer addresses that can be pruned at timestamp ts. +// The returned addresses are removed from the store. // // Note that the list of all consumer addresses is stored under keys with the following format: -// ConsumerAddrsToPruneBytePrefix | len(chainID) | chainID | vscID -// Thus, the returned array is in ascending order of vscIDs. -func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPrune) { +// ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp +// Thus, this method returns all the consumer addresses stored under keys in the following range: +// (ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID) ... (ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | ts) +func (k Keeper) ConsumeConsumerAddrsToPrune( + ctx sdk.Context, + chainID string, + ts time.Time, +) (consumerAddrsToPrune types.AddressList) { store := ctx.KVStore(k.storeKey) - iteratorPrefix := types.ChainIdWithLenKey(types.ConsumerAddrsToPruneBytePrefix, chainID) - iterator := sdk.KVStorePrefixIterator(store, iteratorPrefix) + + startPrefix := types.ChainIdWithLenKey(types.ConsumerAddrsToPruneV2BytePrefix, chainID) + iterator := store.Iterator(startPrefix, + sdk.InclusiveEndBytes(types.ConsumerAddrsToPruneV2Key(chainID, ts))) defer iterator.Close() + + var keysToDel [][]byte for ; iterator.Valid(); iterator.Next() { - _, vscID, err := types.ParseChainIdAndUintIdKey(types.ConsumerAddrsToPruneBytePrefix, iterator.Key()) - if err != nil { + // Sanity check + if _, pruneTs, err := types.ParseChainIdAndTsKey(types.ConsumerAddrsToPruneV2BytePrefix, iterator.Key()); err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. panic(err) + } else if pruneTs.After(ts) { + // An error here would indicate something is wrong the iterator + k.Logger(ctx).Error("iterator in GetConsumerAddrsToPrune failed", "key", string(iterator.Key())) + continue } + + keysToDel = append(keysToDel, iterator.Key()) + var addrs types.AddressList - err = addrs.Unmarshal(iterator.Value()) - if err != nil { + if err := addrs.Unmarshal(iterator.Value()); err != nil { // An error here would indicate something is very wrong, // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPrune. panic(err) } - consumerAddrsToPrune = append(consumerAddrsToPrune, types.ConsumerAddrsToPrune{ - VscId: vscID, - ConsumerAddrs: &addrs, - ChainId: chainID, - }) + consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, addrs.Addresses...) } - return consumerAddrsToPrune -} - -// DeleteConsumerAddrsToPrune deletes the list of consumer addresses mapped to a given VSC ID -func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscID uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerAddrsToPruneKey(chainID, vscID)) -} - -// AppendConsumerAddrsToPruneV2 appends a consumer validator address to the list of consumer addresses -// that can be pruned once the block time is larger than pruneAfterTs. -// -// The following invariant needs to hold: -// For each consumer address cAddr in ValidatorByConsumerAddr, -// - either there exists a provider address pAddr in ValidatorConsumerPubKey, -// s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr -// - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) -func (k Keeper) AppendConsumerAddrsToPruneV2( - ctx sdk.Context, - chainID string, - pruneAfterTs time.Time, - consumerAddr types.ConsumerConsAddress, -) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs)) - var consumerAddrsToPrune types.AddressList - if bz != nil { - err := consumerAddrsToPrune.Unmarshal(bz) - if err != nil { - // An error here would indicate something is very wrong, - // the data bytes are assumed to be correctly serialized by previous calls to this method. - panic(err) - } - } - consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, consumerAddr.ToSdkConsAddr()) - bz, err := consumerAddrsToPrune.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // consumerAddrsToPrune is instantiated in this method and should be able to be marshaled. - panic(err) + for _, delKey := range keysToDel { + store.Delete(delKey) } - store.Set(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs), bz) -} -// GetConsumerAddrsToPruneV2 returns the list of consumer addresses -// that can be pruned once the block time is larger than pruneAfterTs. -func (k Keeper) GetConsumerAddrsToPruneV2( - ctx sdk.Context, - chainID string, - pruneAfterTs time.Time, -) (consumerAddrsToPrune types.AddressList) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs)) - if bz == nil { - return - } - err := consumerAddrsToPrune.Unmarshal(bz) - if err != nil { - // An error here would indicate something is very wrong, - // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPruneV2. - panic(fmt.Sprintf("failed to unmarshal consumer addresses to prune: %v", err)) - } return } -// GetAllConsumerAddrsToPruneV2 gets all consumer addresses that can be eventually pruned for a given chainID. +// GetAllConsumerAddrsToPrune gets all consumer addresses that can be eventually pruned for a given chainID. // // Note that the list of all consumer addresses is stored under keys with the following format: // ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp // Thus, the returned array is in ascending order of timestamps. -func (k Keeper) GetAllConsumerAddrsToPruneV2(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPruneV2) { +func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPruneV2) { store := ctx.KVStore(k.storeKey) iteratorPrefix := types.ChainIdWithLenKey(types.ConsumerAddrsToPruneV2BytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, iteratorPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - _, pruneAfterTs, err := types.ParseChainIdAndTsKey(types.ConsumerAddrsToPruneV2BytePrefix, iterator.Key()) + _, ts, err := types.ParseChainIdAndTsKey(types.ConsumerAddrsToPruneV2BytePrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, - // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPruneV2. + // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. panic(err) } var addrs types.AddressList err = addrs.Unmarshal(iterator.Value()) if err != nil { // An error here would indicate something is very wrong, - // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPruneV2. + // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPrune. panic(err) } consumerAddrsToPrune = append(consumerAddrsToPrune, types.ConsumerAddrsToPruneV2{ - PruneAfterTs: pruneAfterTs, + PruneTs: ts, ConsumerAddrs: &addrs, ChainId: chainID, }) @@ -416,9 +376,9 @@ func (k Keeper) GetAllConsumerAddrsToPruneV2(ctx sdk.Context, chainID string) (c } // DeleteConsumerAddrsToPruneV2 deletes the list of consumer addresses mapped to a timestamp -func (k Keeper) DeleteConsumerAddrsToPruneV2(ctx sdk.Context, chainID string, pruneAfterTs time.Time) { +func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, chainID string, pruneTs time.Time) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerAddrsToPruneV2Key(chainID, pruneAfterTs)) + store.Delete(types.ConsumerAddrsToPruneV2Key(chainID, pruneTs)) } // AssignConsumerKey assigns the consumerKey to the validator with providerAddr @@ -500,13 +460,12 @@ func (k Keeper) AssignConsumerKey( // check whether the consumer chain is already registered, // i.e., a client to the consumer was already created if _, consumerRegistered := k.GetConsumerClientId(ctx, chainID); consumerRegistered { - // mark the old consumer address as prunable once the VSCMaturedPacket - // for the current VSC ID is received; - // note: this state is removed on receiving the VSCMaturedPacket + // mark the old consumer address as prunable once UnbondingPeriod elapses; + // note: this state is removed on EndBlock k.AppendConsumerAddrsToPrune( ctx, chainID, - k.GetValidatorSetUpdateId(ctx), + ctx.BlockTime().Add(k.stakingKeeper.UnbondingTime(ctx)), oldConsumerAddr, ) } else { @@ -547,8 +506,10 @@ func (k Keeper) GetProviderAddrFromConsumerAddr( // PruneKeyAssignments prunes the consumer addresses no longer needed // as they cannot be referenced in slash requests (by a correct consumer) -func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string, vscID uint64) { - consumerAddrs := k.GetConsumerAddrsToPrune(ctx, chainID, vscID) +func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string) { + now := ctx.BlockTime() + + consumerAddrs := k.ConsumeConsumerAddrsToPrune(ctx, chainID, now) for _, addrBz := range consumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addrBz) k.DeleteValidatorByConsumerAddr(ctx, chainID, consumerAddr) @@ -557,8 +518,6 @@ func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string, vscID uint6 "consumer consensus addr", consumerAddr.String(), ) } - - k.DeleteConsumerAddrsToPrune(ctx, chainID, vscID) } // DeleteKeyAssignments deletes all the state needed for key assignments on a consumer chain @@ -577,7 +536,7 @@ func (k Keeper) DeleteKeyAssignments(ctx sdk.Context, chainID string) { // delete ValidatorConsumerPubKey for _, consumerAddrsToPrune := range k.GetAllConsumerAddrsToPrune(ctx, chainID) { - k.DeleteConsumerAddrsToPrune(ctx, chainID, consumerAddrsToPrune.VscId) + k.DeleteConsumerAddrsToPrune(ctx, chainID, consumerAddrsToPrune.PruneTs) } } diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 4616e226c9..b341946bb9 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -10,7 +10,6 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -189,112 +188,54 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { func TestConsumerAddrsToPruneCRUD(t *testing.T) { chainID := consumer - consumerAddr := types.NewConsumerConsAddress([]byte("consumerAddr1")) - vscID := uint64(1) + consumerAddr1 := types.NewConsumerConsAddress([]byte("consumerAddr1")) + consumerAddr2 := types.NewConsumerConsAddress([]byte("consumerAddr2")) keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - addrsToPrune := keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).Addresses + ts1 := ctx.BlockTime() + ts2 := ts1.Add(time.Hour) + + addrsToPrune := keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses require.Empty(t, addrsToPrune) - keeper.AppendConsumerAddrsToPrune(ctx, chainID, vscID, consumerAddr) + keeper.AppendConsumerAddrsToPrune(ctx, chainID, ts1, consumerAddr1) - addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).Addresses + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") - require.Equal(t, addrsToPrune[0], consumerAddr.ToSdkConsAddr().Bytes()) - - keeper.DeleteConsumerAddrsToPrune(ctx, chainID, vscID) - addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).Addresses - require.Empty(t, addrsToPrune, "addresses to prune was returned") -} - -func TestGetAllConsumerAddrsToPrune(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() + require.Equal(t, addrsToPrune[0], consumerAddr1.ToSdkConsAddr().Bytes()) - seed := time.Now().UnixNano() - rng := rand.New(rand.NewSource(seed)) + keeper.AppendConsumerAddrsToPrune(ctx, chainID, ts2, consumerAddr2) - chainIDs := []string{"consumer-1", "consumer-2", "consumer-3"} - numAssignments := 10 - testAssignments := []types.ConsumerAddrsToPrune{} - for i := 0; i < numAssignments; i++ { - consumerAddresses := types.AddressList{} - for j := 0; j < 2*(i+1); j++ { - addr := cryptotestutil.NewCryptoIdentityFromIntSeed(i * j).SDKValConsAddress() - consumerAddresses.Addresses = append(consumerAddresses.Addresses, addr) - } - testAssignments = append(testAssignments, - types.ConsumerAddrsToPrune{ - ChainId: chainIDs[rng.Intn(len(chainIDs))], - VscId: rng.Uint64(), - ConsumerAddrs: &consumerAddresses, - }, - ) - } - // select a chainID with more than two assignments - var chainID string - for i := range chainIDs { - chainID = chainIDs[i] - count := 0 - for _, assignment := range testAssignments { - if assignment.ChainId == chainID { - count++ - } - } - if count > 2 { - break - } - } - expectedGetAllOrder := []types.ConsumerAddrsToPrune{} - for _, assignment := range testAssignments { - if assignment.ChainId == chainID { - expectedGetAllOrder = append(expectedGetAllOrder, assignment) - } - } - // sorting by ConsumerAddrsToPrune.VscId - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].VscId < expectedGetAllOrder[j].VscId - }) - - for _, assignment := range testAssignments { - for _, addr := range assignment.ConsumerAddrs.Addresses { - consumerAddr := types.NewConsumerConsAddress(addr) - pk.AppendConsumerAddrsToPrune(ctx, assignment.ChainId, assignment.VscId, consumerAddr) - } - } - - result := pk.GetAllConsumerAddrsToPrune(ctx, chainID) - require.Equal(t, expectedGetAllOrder, result) -} - -func TestConsumerAddrsToPruneV2CRUD(t *testing.T) { - chainID := consumer - consumerAddr := types.NewConsumerConsAddress([]byte("consumerAddr1")) - - keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - ts := ctx.BlockTime() - - addrsToPrune := keeper.GetConsumerAddrsToPruneV2(ctx, chainID, ts).Addresses - require.Empty(t, addrsToPrune) - - keeper.AppendConsumerAddrsToPruneV2(ctx, chainID, ts, consumerAddr) + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts2).Addresses + require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") + require.Equal(t, addrsToPrune[0], consumerAddr2.ToSdkConsAddr().Bytes()) - addrsToPrune = keeper.GetConsumerAddrsToPruneV2(ctx, chainID, ts).Addresses + keeper.DeleteConsumerAddrsToPrune(ctx, chainID, ts1) + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses + require.Empty(t, addrsToPrune, "addresses to prune was returned") + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts2).Addresses require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") - require.Equal(t, addrsToPrune[0], consumerAddr.ToSdkConsAddr().Bytes()) + require.Equal(t, addrsToPrune[0], consumerAddr2.ToSdkConsAddr().Bytes()) + + keeper.AppendConsumerAddrsToPrune(ctx, chainID, ts1, consumerAddr1) - keeper.DeleteConsumerAddrsToPruneV2(ctx, chainID, ts) - addrsToPrune = keeper.GetConsumerAddrsToPruneV2(ctx, chainID, ts).Addresses + addrsToPrune = keeper.ConsumeConsumerAddrsToPrune(ctx, chainID, ts2).Addresses + require.NotEmpty(t, addrsToPrune, "addresses to prune was returned") + require.Len(t, addrsToPrune, 2, "addresses to prune is not len 2") + require.Equal(t, addrsToPrune[0], consumerAddr1.ToSdkConsAddr().Bytes()) + require.Equal(t, addrsToPrune[1], consumerAddr2.ToSdkConsAddr().Bytes()) + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses + require.Empty(t, addrsToPrune, "addresses to prune was returned") + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts2).Addresses require.Empty(t, addrsToPrune, "addresses to prune was returned") } -func TestGetAllConsumerAddrsToPruneV2(t *testing.T) { +func TestGetAllConsumerAddrsToPrune(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -313,7 +254,7 @@ func TestGetAllConsumerAddrsToPruneV2(t *testing.T) { testAssignments = append(testAssignments, types.ConsumerAddrsToPruneV2{ ChainId: chainIDs[rng.Intn(len(chainIDs))], - PruneAfterTs: time.Now().UTC(), + PruneTs: time.Now().UTC(), ConsumerAddrs: &consumerAddresses, }, ) @@ -338,19 +279,19 @@ func TestGetAllConsumerAddrsToPruneV2(t *testing.T) { expectedGetAllOrder = append(expectedGetAllOrder, assignment) } } - // sorting by ConsumerAddrsToPrune.PruneAfterTs + // sorting by ConsumerAddrsToPrune.PruneTs sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].PruneAfterTs.Before(expectedGetAllOrder[j].PruneAfterTs) + return expectedGetAllOrder[i].PruneTs.Before(expectedGetAllOrder[j].PruneTs) }) for _, assignment := range testAssignments { for _, addr := range assignment.ConsumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addr) - pk.AppendConsumerAddrsToPruneV2(ctx, assignment.ChainId, assignment.PruneAfterTs, consumerAddr) + pk.AppendConsumerAddrsToPrune(ctx, assignment.ChainId, assignment.PruneTs, consumerAddr) } } - result := pk.GetAllConsumerAddrsToPruneV2(ctx, chainID) + result := pk.GetAllConsumerAddrsToPrune(ctx, chainID) require.Equal(t, expectedGetAllOrder, result) } @@ -471,6 +412,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, consumerIdentities[1].SDKValConsAddress(), ).Return(stakingtypes.Validator{}, false), + mocks.MockStakingKeeper.EXPECT().UnbondingTime(ctx), ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { @@ -720,300 +662,300 @@ type Assignment struct { ck tmprotocrypto.PublicKey } -// TestSimulatedAssignmentsAndUpdateApplication tests a series -// of simulated scenarios where random key assignments and validator -// set updates are generated. -func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { - CHAINID := ChainID - // The number of full test executions to run - NUM_EXECUTIONS := 100 - // Each test execution mimics the adding of a consumer chain and the - // assignments and power updates of several blocks - NUM_BLOCKS_PER_EXECUTION := 40 - // The number of validators to be simulated - NUM_VALIDATORS := 4 - // The number of keys that can be used. Keeping this number small is - // good because it increases the chance that different assignments will - // use the same keys, which is something we want to test. - NUM_ASSIGNABLE_KEYS := 12 - // The maximum number of key assignment actions to simulate in each - // simulated block, and before the consumer chain is registered. - NUM_ASSIGNMENTS_PER_BLOCK_MAX := 8 - - // Create some identities for the simulated provider validators to use - providerIDS := []*cryptotestutil.CryptoIdentity{} - // Create some identities which the provider validators can assign to the consumer chain - assignableIDS := []*cryptotestutil.CryptoIdentity{} - for i := 0; i < NUM_VALIDATORS; i++ { - providerIDS = append(providerIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) - } - // Notice that the assignable identities include the provider identities - for i := 0; i < NUM_VALIDATORS+NUM_ASSIGNABLE_KEYS; i++ { - assignableIDS = append(assignableIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) - } - - seed := time.Now().UnixNano() - rng := rand.New(rand.NewSource(seed)) - - // Helper: simulates creation of staking module EndBlock updates. - getStakingUpdates := func() (ret []abci.ValidatorUpdate) { - // Get a random set of validators to update. It is important to test subsets of all validators. - validators := rng.Perm(len(providerIDS))[0:rng.Intn(len(providerIDS)+1)] - for _, i := range validators { - // Power 0, 1, or 2 represents - // deletion, update (from 0 or 2), update (from 0 or 1) - power := rng.Intn(3) - ret = append(ret, abci.ValidatorUpdate{ - PubKey: providerIDS[i].TMProtoCryptoPublicKey(), - Power: int64(power), - }) - } - return - } - - // Helper: simulates creation of assignment tx's to be done. - getAssignments := func() (ret []Assignment) { - for i, numAssignments := 0, rng.Intn(NUM_ASSIGNMENTS_PER_BLOCK_MAX); i < numAssignments; i++ { - randomIxP := rng.Intn(len(providerIDS)) - randomIxC := rng.Intn(len(assignableIDS)) - ret = append(ret, Assignment{ - val: providerIDS[randomIxP].SDKStakingValidator(), - ck: assignableIDS[randomIxC].TMProtoCryptoPublicKey(), - }) - } - return - } - - // Run a randomly simulated execution and test that desired properties hold - // Helper: run a randomly simulated scenario where a consumer chain is added - // (after key assignment actions are done), followed by a series of validator power updates - // and key assignments tx's. For each simulated 'block', the validator set replication - // properties and the pruning property are checked. - runRandomExecution := func() { - k, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - - // Create validator sets for the provider and consumer. These are used to check the validator set - // replication property. - providerValset := CreateValSet(providerIDS) - // NOTE: consumer must have space for provider identities because default key assignments are to provider keys - consumerValset := CreateValSet(assignableIDS) - // For each validator on the consumer, record the corresponding provider - // address as looked up on the provider using GetProviderAddrFromConsumerAddr - // at a given vscid. - // consumer consAddr -> vscid -> provider consAddr - historicSlashQueries := map[string]map[uint64]string{} - - // Sanity check that the validator set update is initialised to 0, for clarity. - require.Equal(t, k.GetValidatorSetUpdateId(ctx), uint64(0)) - - // Mock calls to GetLastValidatorPower to return directly from the providerValset - mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower( - gomock.Any(), - gomock.Any(), - ).DoAndReturn(func(_ interface{}, valAddr sdk.ValAddress) int64 { - // When the mocked method is called, locate the appropriate validator - // in the provider valset and return its power. - for i, id := range providerIDS { - if id.SDKStakingValidator().GetOperator().Equals(valAddr) { - return providerValset.power[i] - } - } - panic("must find validator") - // This can be called 0 or more times per block depending on the random - // assignments that occur - }).AnyTimes() - - // This implements the assumption that all the provider IDS are added - // to the system at the beginning of the simulation. - mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( - gomock.Any(), - gomock.Any(), - ).DoAndReturn(func(_ interface{}, consP sdk.ConsAddress) (stakingtypes.Validator, bool) { - for _, id := range providerIDS { - if id.SDKValConsAddress().Equals(consP) { - return id.SDKStakingValidator(), true - } - } - return stakingtypes.Validator{}, false - }).AnyTimes() - - // Helper: apply some updates to both the provider and consumer valsets - // and increment the provider vscid. - applyUpdatesAndIncrementVSCID := func(updates []abci.ValidatorUpdate) { - providerValset.apply(updates) - - var bondedValidators []stakingtypes.Validator - for _, v := range providerValset.identities { - pkAny, _ := codectypes.NewAnyWithValue(v.ConsensusSDKPubKey()) - - bondedValidators = append(bondedValidators, stakingtypes.Validator{ - OperatorAddress: v.SDKValOpAddress().String(), - ConsensusPubkey: pkAny, - }) - } - - nextValidators := k.FilterValidators(ctx, CHAINID, bondedValidators, - func(providerAddr types.ProviderConsAddress) bool { - return true - }) - updates = providerkeeper.DiffValidators(k.GetConsumerValSet(ctx, CHAINID), nextValidators) - k.SetConsumerValSet(ctx, CHAINID, nextValidators) - - consumerValset.apply(updates) - // Simulate the VSCID update in EndBlock - k.IncrementValidatorSetUpdateId(ctx) - } - - // Helper: apply some key assignment transactions to the system - applyAssignments := func(assignments []Assignment) { - for _, a := range assignments { - // ignore err return, it can be possible for an error to occur - _ = k.AssignConsumerKey(ctx, CHAINID, a.val, a.ck) - } - } - - // The consumer chain has not yet been registered - // Apply some randomly generated key assignments - assignments := getAssignments() - applyAssignments(assignments) - // And generate a random provider valset which, in the real system, will - // be put into the consumer genesis. - stakingUpdates := getStakingUpdates() - - applyUpdatesAndIncrementVSCID(stakingUpdates) - - // Register the consumer chain - k.SetConsumerClientId(ctx, CHAINID, "") - - // Analogous to the last vscid received from the consumer in a maturity - // Used to check the correct pruning property - greatestPrunedVSCID := -1 - - // Simulate a number of 'blocks' - // Each block consists of a number of random key assignment tx's - // and a random set of validator power updates - for block := 0; block < NUM_BLOCKS_PER_EXECUTION; block++ { - - stakingUpdates = getStakingUpdates() - assignments = getAssignments() - - // Generate and apply assignments and power updates - applyAssignments(assignments) - applyUpdatesAndIncrementVSCID(stakingUpdates) - - // Randomly fast forward the greatest pruned VSCID. This simulates - // delivery of maturity packets from the consumer chain. - prunedVscid := greatestPrunedVSCID + - // +1 and -1 because id was incremented (-1), (+1) to make upper bound inclusive - rng.Intn(int(k.GetValidatorSetUpdateId(ctx))+1-1-greatestPrunedVSCID) - k.PruneKeyAssignments(ctx, CHAINID, uint64(prunedVscid)) - greatestPrunedVSCID = prunedVscid - - /* - - Property: Validator Set Replication - Each validator set on the provider must be replicated on the consumer. - The property in the real system is somewhat weaker, because the consumer chain can - forward updates to tendermint in batches. - (See https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/system_model_and_properties.md#system-properties) - We test the stronger property, because we abstract over implementation of the consumer - chain. The stronger property implies the weaker property. - - */ - - // Check validator set replication forward direction - for i, idP := range providerValset.identities { - // For each active validator on the provider chain - if 0 < providerValset.power[i] { - // Get the assigned key - ck, found := k.GetValidatorConsumerPubKey(ctx, CHAINID, idP.ProviderConsAddress()) - if !found { - // Use default if unassigned - ck = idP.TMProtoCryptoPublicKey() - } - consC, err := ccvtypes.TMCryptoPublicKeyToConsAddr(ck) - require.NoError(t, err) - // Find the corresponding consumer validator (must always be found) - for j, idC := range consumerValset.identities { - if consC.Equals(idC.SDKValConsAddress()) { - // Ensure powers are the same - require.Equal(t, providerValset.power[i], consumerValset.power[j]) - } - } - } - } - // Check validator set replication backward direction - for i := range consumerValset.identities { - // For each active validator on the consumer chain - consC := consumerValset.identities[i].ConsumerConsAddress() - if 0 < consumerValset.power[i] { - // Get the provider who assigned the key - consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) - // Find the corresponding provider validator (must always be found) - for j, idP := range providerValset.identities { - if idP.SDKValConsAddress().Equals(consP.ToSdkConsAddr()) { - // Ensure powers are the same - require.Equal(t, providerValset.power[j], consumerValset.power[i]) - } - } - } - } - - /* - Property: Pruning (bounded storage) - Check that all keys have been or will eventually be pruned. - */ - - require.True(t, checkCorrectPruningProperty(ctx, k, CHAINID)) - - /* - Property: Correct Consumer Initiated Slash Lookup - - Check that since the last pruning, it has never been possible to query - two different provider addresses from the same consumer address. - We know that the queried provider address was correct at least once, - from checking the validator set replication property. These two facts - together guarantee that the slash lookup is always correct. - */ - - // Build up the historicSlashQueries data structure - for i := range consumerValset.identities { - // For each active validator on the consumer chain - consC := consumerValset.identities[i].ConsumerConsAddress() - if 0 < consumerValset.power[i] { - // Get the provider who assigned the key - consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) - - if _, found := historicSlashQueries[consC.String()]; !found { - historicSlashQueries[consC.String()] = map[uint64]string{} - } - - vscid := k.GetValidatorSetUpdateId(ctx) - 1 // -1 since it was incremented before - // Record the slash query result obtained at this block - historicSlashQueries[consC.String()][vscid] = consP.String() - } - } - - // Check that, for each address known the consumer at some block - // with vscid st. greatestPrunedVSCID < vscid, there were never - // conflicting slash query results. - for _, vscidToConsP := range historicSlashQueries { - seen := map[string]bool{} - for vscid, consP := range vscidToConsP { - if uint64(greatestPrunedVSCID) < vscid { - // The provider would have returned - seen[consP] = true - } - } - // No conflicts. - require.True(t, len(seen) < 2) - } - - } - ctrl.Finish() - } - - for i := 0; i < NUM_EXECUTIONS; i++ { - runRandomExecution() - } -} +// // TestSimulatedAssignmentsAndUpdateApplication tests a series +// // of simulated scenarios where random key assignments and validator +// // set updates are generated. +// func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { +// CHAINID := ChainID +// // The number of full test executions to run +// NUM_EXECUTIONS := 100 +// // Each test execution mimics the adding of a consumer chain and the +// // assignments and power updates of several blocks +// NUM_BLOCKS_PER_EXECUTION := 40 +// // The number of validators to be simulated +// NUM_VALIDATORS := 4 +// // The number of keys that can be used. Keeping this number small is +// // good because it increases the chance that different assignments will +// // use the same keys, which is something we want to test. +// NUM_ASSIGNABLE_KEYS := 12 +// // The maximum number of key assignment actions to simulate in each +// // simulated block, and before the consumer chain is registered. +// NUM_ASSIGNMENTS_PER_BLOCK_MAX := 8 + +// // Create some identities for the simulated provider validators to use +// providerIDS := []*cryptotestutil.CryptoIdentity{} +// // Create some identities which the provider validators can assign to the consumer chain +// assignableIDS := []*cryptotestutil.CryptoIdentity{} +// for i := 0; i < NUM_VALIDATORS; i++ { +// providerIDS = append(providerIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) +// } +// // Notice that the assignable identities include the provider identities +// for i := 0; i < NUM_VALIDATORS+NUM_ASSIGNABLE_KEYS; i++ { +// assignableIDS = append(assignableIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) +// } + +// seed := time.Now().UnixNano() +// rng := rand.New(rand.NewSource(seed)) + +// // Helper: simulates creation of staking module EndBlock updates. +// getStakingUpdates := func() (ret []abci.ValidatorUpdate) { +// // Get a random set of validators to update. It is important to test subsets of all validators. +// validators := rng.Perm(len(providerIDS))[0:rng.Intn(len(providerIDS)+1)] +// for _, i := range validators { +// // Power 0, 1, or 2 represents +// // deletion, update (from 0 or 2), update (from 0 or 1) +// power := rng.Intn(3) +// ret = append(ret, abci.ValidatorUpdate{ +// PubKey: providerIDS[i].TMProtoCryptoPublicKey(), +// Power: int64(power), +// }) +// } +// return +// } + +// // Helper: simulates creation of assignment tx's to be done. +// getAssignments := func() (ret []Assignment) { +// for i, numAssignments := 0, rng.Intn(NUM_ASSIGNMENTS_PER_BLOCK_MAX); i < numAssignments; i++ { +// randomIxP := rng.Intn(len(providerIDS)) +// randomIxC := rng.Intn(len(assignableIDS)) +// ret = append(ret, Assignment{ +// val: providerIDS[randomIxP].SDKStakingValidator(), +// ck: assignableIDS[randomIxC].TMProtoCryptoPublicKey(), +// }) +// } +// return +// } + +// // Run a randomly simulated execution and test that desired properties hold +// // Helper: run a randomly simulated scenario where a consumer chain is added +// // (after key assignment actions are done), followed by a series of validator power updates +// // and key assignments tx's. For each simulated 'block', the validator set replication +// // properties and the pruning property are checked. +// runRandomExecution := func() { +// k, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + +// // Create validator sets for the provider and consumer. These are used to check the validator set +// // replication property. +// providerValset := CreateValSet(providerIDS) +// // NOTE: consumer must have space for provider identities because default key assignments are to provider keys +// consumerValset := CreateValSet(assignableIDS) +// // For each validator on the consumer, record the corresponding provider +// // address as looked up on the provider using GetProviderAddrFromConsumerAddr +// // at a given vscid. +// // consumer consAddr -> vscid -> provider consAddr +// historicSlashQueries := map[string]map[uint64]string{} + +// // Sanity check that the validator set update is initialised to 0, for clarity. +// require.Equal(t, k.GetValidatorSetUpdateId(ctx), uint64(0)) + +// // Mock calls to GetLastValidatorPower to return directly from the providerValset +// mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower( +// gomock.Any(), +// gomock.Any(), +// ).DoAndReturn(func(_ interface{}, valAddr sdk.ValAddress) int64 { +// // When the mocked method is called, locate the appropriate validator +// // in the provider valset and return its power. +// for i, id := range providerIDS { +// if id.SDKStakingValidator().GetOperator().Equals(valAddr) { +// return providerValset.power[i] +// } +// } +// panic("must find validator") +// // This can be called 0 or more times per block depending on the random +// // assignments that occur +// }).AnyTimes() + +// // This implements the assumption that all the provider IDS are added +// // to the system at the beginning of the simulation. +// mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( +// gomock.Any(), +// gomock.Any(), +// ).DoAndReturn(func(_ interface{}, consP sdk.ConsAddress) (stakingtypes.Validator, bool) { +// for _, id := range providerIDS { +// if id.SDKValConsAddress().Equals(consP) { +// return id.SDKStakingValidator(), true +// } +// } +// return stakingtypes.Validator{}, false +// }).AnyTimes() + +// // Helper: apply some updates to both the provider and consumer valsets +// // and increment the provider vscid. +// applyUpdatesAndIncrementVSCID := func(updates []abci.ValidatorUpdate) { +// providerValset.apply(updates) + +// var bondedValidators []stakingtypes.Validator +// for _, v := range providerValset.identities { +// pkAny, _ := codectypes.NewAnyWithValue(v.ConsensusSDKPubKey()) + +// bondedValidators = append(bondedValidators, stakingtypes.Validator{ +// OperatorAddress: v.SDKValOpAddress().String(), +// ConsensusPubkey: pkAny, +// }) +// } + +// nextValidators := k.FilterValidators(ctx, CHAINID, bondedValidators, +// func(providerAddr types.ProviderConsAddress) bool { +// return true +// }) +// updates = providerkeeper.DiffValidators(k.GetConsumerValSet(ctx, CHAINID), nextValidators) +// k.SetConsumerValSet(ctx, CHAINID, nextValidators) + +// consumerValset.apply(updates) +// // Simulate the VSCID update in EndBlock +// k.IncrementValidatorSetUpdateId(ctx) +// } + +// // Helper: apply some key assignment transactions to the system +// applyAssignments := func(assignments []Assignment) { +// for _, a := range assignments { +// // ignore err return, it can be possible for an error to occur +// _ = k.AssignConsumerKey(ctx, CHAINID, a.val, a.ck) +// } +// } + +// // The consumer chain has not yet been registered +// // Apply some randomly generated key assignments +// assignments := getAssignments() +// applyAssignments(assignments) +// // And generate a random provider valset which, in the real system, will +// // be put into the consumer genesis. +// stakingUpdates := getStakingUpdates() + +// applyUpdatesAndIncrementVSCID(stakingUpdates) + +// // Register the consumer chain +// k.SetConsumerClientId(ctx, CHAINID, "") + +// // Analogous to the last vscid received from the consumer in a maturity +// // Used to check the correct pruning property +// greatestPrunedVSCID := -1 + +// // Simulate a number of 'blocks' +// // Each block consists of a number of random key assignment tx's +// // and a random set of validator power updates +// for block := 0; block < NUM_BLOCKS_PER_EXECUTION; block++ { + +// stakingUpdates = getStakingUpdates() +// assignments = getAssignments() + +// // Generate and apply assignments and power updates +// applyAssignments(assignments) +// applyUpdatesAndIncrementVSCID(stakingUpdates) + +// // Randomly fast forward the greatest pruned VSCID. This simulates +// // delivery of maturity packets from the consumer chain. +// prunedVscid := greatestPrunedVSCID + +// // +1 and -1 because id was incremented (-1), (+1) to make upper bound inclusive +// rng.Intn(int(k.GetValidatorSetUpdateId(ctx))+1-1-greatestPrunedVSCID) +// k.PruneKeyAssignments(ctx, CHAINID, uint64(prunedVscid)) +// greatestPrunedVSCID = prunedVscid + +// /* + +// Property: Validator Set Replication +// Each validator set on the provider must be replicated on the consumer. +// The property in the real system is somewhat weaker, because the consumer chain can +// forward updates to tendermint in batches. +// (See https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/system_model_and_properties.md#system-properties) +// We test the stronger property, because we abstract over implementation of the consumer +// chain. The stronger property implies the weaker property. + +// */ + +// // Check validator set replication forward direction +// for i, idP := range providerValset.identities { +// // For each active validator on the provider chain +// if 0 < providerValset.power[i] { +// // Get the assigned key +// ck, found := k.GetValidatorConsumerPubKey(ctx, CHAINID, idP.ProviderConsAddress()) +// if !found { +// // Use default if unassigned +// ck = idP.TMProtoCryptoPublicKey() +// } +// consC, err := ccvtypes.TMCryptoPublicKeyToConsAddr(ck) +// require.NoError(t, err) +// // Find the corresponding consumer validator (must always be found) +// for j, idC := range consumerValset.identities { +// if consC.Equals(idC.SDKValConsAddress()) { +// // Ensure powers are the same +// require.Equal(t, providerValset.power[i], consumerValset.power[j]) +// } +// } +// } +// } +// // Check validator set replication backward direction +// for i := range consumerValset.identities { +// // For each active validator on the consumer chain +// consC := consumerValset.identities[i].ConsumerConsAddress() +// if 0 < consumerValset.power[i] { +// // Get the provider who assigned the key +// consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) +// // Find the corresponding provider validator (must always be found) +// for j, idP := range providerValset.identities { +// if idP.SDKValConsAddress().Equals(consP.ToSdkConsAddr()) { +// // Ensure powers are the same +// require.Equal(t, providerValset.power[j], consumerValset.power[i]) +// } +// } +// } +// } + +// /* +// Property: Pruning (bounded storage) +// Check that all keys have been or will eventually be pruned. +// */ + +// require.True(t, checkCorrectPruningProperty(ctx, k, CHAINID)) + +// /* +// Property: Correct Consumer Initiated Slash Lookup + +// Check that since the last pruning, it has never been possible to query +// two different provider addresses from the same consumer address. +// We know that the queried provider address was correct at least once, +// from checking the validator set replication property. These two facts +// together guarantee that the slash lookup is always correct. +// */ + +// // Build up the historicSlashQueries data structure +// for i := range consumerValset.identities { +// // For each active validator on the consumer chain +// consC := consumerValset.identities[i].ConsumerConsAddress() +// if 0 < consumerValset.power[i] { +// // Get the provider who assigned the key +// consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) + +// if _, found := historicSlashQueries[consC.String()]; !found { +// historicSlashQueries[consC.String()] = map[uint64]string{} +// } + +// vscid := k.GetValidatorSetUpdateId(ctx) - 1 // -1 since it was incremented before +// // Record the slash query result obtained at this block +// historicSlashQueries[consC.String()][vscid] = consP.String() +// } +// } + +// // Check that, for each address known the consumer at some block +// // with vscid st. greatestPrunedVSCID < vscid, there were never +// // conflicting slash query results. +// for _, vscidToConsP := range historicSlashQueries { +// seen := map[string]bool{} +// for vscid, consP := range vscidToConsP { +// if uint64(greatestPrunedVSCID) < vscid { +// // The provider would have returned +// seen[consP] = true +// } +// } +// // No conflicts. +// require.True(t, len(seen) < 2) +// } + +// } +// ctrl.Finish() +// } + +// for i := 0; i < NUM_EXECUTIONS; i++ { +// runRandomExecution() +// } +// } diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go index 66de1a0657..5f7c2c930f 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -54,7 +54,7 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p for _, addr := range addrs.Addresses { consumerAddr := providertypes.NewConsumerConsAddress(addr) - pk.AppendConsumerAddrsToPruneV2(ctx, chainID, pruneAfterTs, consumerAddr) + pk.AppendConsumerAddrsToPrune(ctx, chainID, pruneAfterTs, consumerAddr) } } } From 636cd8d8015825e805c18360cd529122ed50295b Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 21 Jun 2024 10:19:26 +0200 Subject: [PATCH 40/81] stop handling VSCMaturedPackets --- testutil/keeper/unit_test_helpers.go | 7 ---- x/ccv/provider/ibc_module.go | 9 ++--- x/ccv/provider/keeper/relay.go | 53 +++------------------------- x/ccv/provider/keeper/relay_test.go | 37 ------------------- 4 files changed, 7 insertions(+), 99 deletions(-) diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index efc25ce97d..9e538f3212 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -199,13 +199,6 @@ func GetNewSlashPacketData() types.SlashPacketData { } } -// Obtains vsc matured packet data with a newly generated key -func GetNewVSCMaturedPacketData() types.VSCMaturedPacketData { - b := make([]byte, 8) - _, _ = rand.Read(b) - return types.VSCMaturedPacketData{ValsetUpdateId: binary.BigEndian.Uint64(b)} -} - // SetupForStoppingConsumerChain registers expected mock calls and corresponding state setup // which assert that a consumer chain was properly setup to be later stopped from `StopConsumerChain`. // Note: This function only setups and tests that we correctly setup a consumer chain that we could later stop when diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index f6ad43d60b..52a8b714f9 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -197,13 +197,8 @@ func (am AppModule) OnRecvPacket( var err error switch consumerPacket.Type { case ccv.VscMaturedPacket: - // handle VSCMaturedPacket - data := *consumerPacket.GetVscMaturedPacketData() - err = am.keeper.OnRecvVSCMaturedPacket(ctx, packet, data) - if err == nil { - logger.Info("successfully handled VSCMaturedPacket", "sequence", packet.Sequence) - eventAttributes = append(eventAttributes, sdk.NewAttribute(ccv.AttributeValSetUpdateID, strconv.Itoa(int(data.ValsetUpdateId)))) - } + // ignore VSCMaturedPacket + err = nil case ccv.SlashPacket: // handle SlashPacket var ackResult ccv.PacketAckResult diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 656e775e5b..89bd8f8aab 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -16,54 +16,6 @@ import ( ccv "github.com/cosmos/interchain-security/v4/x/ccv/types" ) -// OnRecvVSCMaturedPacket handles a VSCMatured packet and returns a no-op result ack. -func (k Keeper) OnRecvVSCMaturedPacket( - ctx sdk.Context, - packet channeltypes.Packet, - data ccv.VSCMaturedPacketData, -) error { - // check that the channel is established, panic if not - chainID, found := k.GetChannelToChain(ctx, packet.DestinationChannel) - if !found { - // VSCMatured packet was sent on a channel different than any of the established CCV channels; - // this should never happen - k.Logger(ctx).Error("VSCMaturedPacket received on unknown channel", - "channelID", packet.DestinationChannel, - ) - panic(fmt.Errorf("VSCMaturedPacket received on unknown channel %s", packet.DestinationChannel)) - } - - // validate packet data upon receiving - if err := data.Validate(); err != nil { - return errorsmod.Wrapf(err, "error validating VSCMaturedPacket data") - } - - k.HandleVSCMaturedPacket(ctx, chainID, data) - - k.Logger(ctx).Info("VSCMaturedPacket handled", - "chainID", chainID, - "vscID", data.ValsetUpdateId, - ) - - return nil -} - -// HandleVSCMaturedPacket handles a VSCMatured packet. -// -// Note: This method should only panic for a system critical error like a -// failed marshal/unmarshal, or persistence of critical data. -// TODO (mpoke) remove once dealt with key assignment pruning -func (k Keeper) HandleVSCMaturedPacket(ctx sdk.Context, chainID string, data ccv.VSCMaturedPacketData) { - // prune previous consumer validator address that are no longer needed - // TODO (mpoke) deal with key assignment pruning - k.PruneKeyAssignments(ctx, chainID, data.ValsetUpdateId) - - k.Logger(ctx).Info("VSCMaturedPacket handled", - "chainID", chainID, - "vscID", data.ValsetUpdateId, - ) -} - // OnAcknowledgementPacket handles acknowledgments for sent VSC packets func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error { if err := ack.GetError(); err != "" { @@ -233,6 +185,11 @@ func (k Keeper) EndBlockCIS(ctx sdk.Context) { valUpdateID := k.GetValidatorSetUpdateId(ctx) k.SetValsetUpdateBlockHeight(ctx, valUpdateID, blockHeight) k.Logger(ctx).Debug("vscID was mapped to block height", "vscID", valUpdateID, "height", blockHeight) + + // prune previous consumer validator addresses that are no longer needed + for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + k.PruneKeyAssignments(ctx, chainID) + } } // OnRecvSlashPacket delivers a received slash packet, validates it and diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index a28767012e..17a1f2a9ec 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -85,27 +85,6 @@ func TestQueueVSCPackets(t *testing.T) { } } -// TestOnRecvVSCMaturedPacket tests the OnRecvVSCMaturedPacket method of the keeper. -// -// Note: Handling logic itself is not tested here. -func TestOnRecvVSCMaturedPacket(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - - // Set channel to chain (faking multiple established channels) - providerKeeper.SetChannelToChain(ctx, "channel-1", "chain-1") - providerKeeper.SetChannelToChain(ctx, "channel-2", "chain-2") - - // Execute on recv for chain-1, confirm v1 result ack is returned - err := executeOnRecvVSCMaturedPacket(t, &providerKeeper, ctx, "channel-1", 1) - require.NoError(t, err) - - // Now queue a slash packet data instance for chain-2, confirm v1 result ack is returned - err = executeOnRecvVSCMaturedPacket(t, &providerKeeper, ctx, "channel-2", 2) - require.NoError(t, err) -} - // TestOnRecvDowntimeSlashPacket tests the OnRecvSlashPacket method specifically for downtime slash packets. func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) @@ -205,22 +184,6 @@ func TestOnRecvDoubleSignSlashPacket(t *testing.T) { require.False(t, providerKeeper.GetSlashLog(ctx, randomAddress)) } -func executeOnRecvVSCMaturedPacket(t *testing.T, providerKeeper *keeper.Keeper, ctx sdk.Context, - channelID string, ibcSeqNum uint64, -) error { - t.Helper() - // Instantiate vsc matured packet data and bytes - data := testkeeper.GetNewVSCMaturedPacketData() - dataBz, err := data.Marshal() - require.NoError(t, err) - - return providerKeeper.OnRecvVSCMaturedPacket( - ctx, - channeltypes.NewPacket(dataBz, ibcSeqNum, "srcPort", "srcChan", "provider-port", channelID, clienttypes.Height{}, 1), - data, - ) -} - func executeOnRecvSlashPacket(t *testing.T, providerKeeper *keeper.Keeper, ctx sdk.Context, channelID string, ibcSeqNum uint64, packetData ccv.SlashPacketData, ) (ccv.PacketAckResult, error) { From 507992917be1659e8908023548e0f9ad10bd885c Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 21 Jun 2024 14:30:40 +0200 Subject: [PATCH 41/81] update ADR --- docs/docs/adrs/adr-018-remove-vscmatured.md | 72 ++++++++++++++++----- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index f862438ab5..0302fef28d 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -13,6 +13,11 @@ Proposed ## Context +> The idea of removing VSCMatured packets was first suggested [Jae Kwon](https://github.com/jaekwon) over a conversation in 2022. +> As a result of that conversation, [an ADR was proposed](https://github.com/cosmos/interchain-security/pull/712) to halt consumer chain if VSC packets are no longer received. +> The ADR was not accepted due to other considerations regarding the safety of consumer chains. +> See [this blog post](https://informal.systems/blog/learning-to-live-with-unbonding-pausing) for more details. + The consumer module on the consumer chains is a representation of the Hub’s staking module, i.e., it provides an _asynchronous_ view of the voting powers and indirectly of the locked collateral. The key word here is _asynchronous_, which means that (in theory) there is no bound on the lag between the Hub’s view of stake and the consumer’s view of stake. The reasons for this asynchrony are relaying delays and chain liveness (e.g., a consumer could be down for a long period of time without affecting the liveness of the staking module on the Hub). @@ -46,18 +51,56 @@ As a result, once the provider chain runs R1, the consumers can start upgrading #### Parameters -Deprecate the `VscTimeoutPeriod` parameter. +Deprecate the `InitTimeoutPeriod` and `VscTimeoutPeriod` parameters. #### State -Remove the following key prefixes from the state: +Add the following key prefixes to the state: + +- `ConsumerAddrsToPruneV2BytePrefix` -- the byte prefix for storing consumer validators addresses that need to be pruned. + These are stored as + ``` + ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | ts -> (consumer_address1, consumer_address2, ...) + ``` + where `ts` is the timestamp at which the consumer validators addresses can be pruned. + +Migrate the consumer validator addresses stored under the `ConsumerAddrsToPruneBytePrefix` to the new prefix `ConsumerAddrsToPruneV2BytePrefix`. +Note that these consumer validators addresses are stored as +``` +ConsumerAddrsToPruneBytePrefix | len(chainID) | chainID | vscID -> (consumer_address1, consumer_address2, ...) +``` +where `vscID` is the ID of the first VSCPacket sent after these consumer validator addresses were changed. +These means that we can use the `VscSendTimestamp`s to compute the timestamps when these consumer validator addresses can be pruned, i.e., +```golang +func MigrateConsumerAddrsToPrune() + iterator := sdk.KVStorePrefixIterator(store, []byte{providertypes.ConsumerAddrsToPruneBytePrefix}) + for ; iterator.Valid(); iterator.Next() { + chainID, vscID, _ := providertypes.ParseChainIdAndUintIdKey(providertypes.ConsumerAddrsToPruneBytePrefix, iterator.Key()) + // use the VscSendTimestamp index to compute the timestamp at which this consumer addresses can be pruned + vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(providertypes.VscSendTimestampBytePrefix, chainID, vscID) + timeBz := store.Get(vscSendTimestampKey) + sentTime, _ := sdk.ParseTimeBytes(timeBz) + pruneTs := sentTime.Add(sk.UnbondingTime(ctx)) + + var addrs providertypes.AddressList + addrs.Unmarshal(iterator.Value()) + + for _, addr := range addrs.Addresses { + consumerAddr := providertypes.NewConsumerConsAddress(addr) + pk.AppendConsumerAddrsToPrune(ctx, chainID, pruneTs, consumerAddr) + } + } +} +``` + +Remove the following key prefixes from the state. Note that these removals require state migration. - `MaturedUnbondingOpsByteKey` -- the byte key that stores the list of all unbonding operations ids that have matured from a consumer chain perspective. - `UnbondingOpBytePrefix` -- the byte prefix that stores a record of all the ids of consumer chains that need to unbond before a given unbonding operation can unbond on this chain. - `UnbondingOpIndexBytePrefix` -- the byte prefix of the index for looking up which unbonding operations are waiting for a given consumer chain to unbond. +- `InitTimeoutTimestampBytePrefix` -- the byte prefix for storing the init timeout timestamp for a given consumer chainID. - `VscSendTimestampBytePrefix` -- the byte prefix for storing the list of VSC sending timestamps for a given consumer chainID. - -Note that these removals require state migration. +- `ConsumerAddrsToPruneBytePrefix` -- the byte prefix for storing the mapping from VSC IDs to consumer validators addresses that need to be pruned. #### State Transitions @@ -68,14 +111,14 @@ The first two are no longer needed, while the third (key assignment pruning) nee - Make the `AfterUnbondingInitiated` hook a no-op. As a result, unbonding operations are no longer paused. - Stop calling the `UnbondingCanComplete` method from the staking keeper. This entails, it is no longer necessary to append `MaturedUnbondingOps` and the `completeMaturedUnbondingOps` method can be removed. -- Note, that during the upgrade, all unbonding operations stored under the `UnbondingOpBytePrefix` prefix need to be completed (via the `UnbondingCanComplete` method from the staking keeper). +- Note, that during the upgrade, all unbonding operations stored under the `UnbondingOpBytePrefix` prefix need to be completed (via the `UnbondingCanComplete` method from the staking keeper). +- Remove the init timeout timestamp logic from the following methods: `CreateConsumerClient`, `SetConsumerChain`, and `EndBlockCCR`. **Removing `VSCPackets` timeout:** - Stop setting VSC send timestamps when sending `VSCPackets`. - Stop removing the VSC send timestamps when receiving `VSCMaturedPackets`. - Remove the logic from `EndBlockCCR` that checks if the first VSC send timestamp in iterator plus `VscTimeoutPeriod` exceeds the current block time. -- Deprecate the `VscTimeoutPeriod` parameter. **Redesign key assignment pruning.** The reason for keeping "old" consumer addresses in the previous design was to enable slashing / jailing validators that misbehave on consumer chains, i.e., the slashing logic uses the `GetProviderAddrFromConsumerAddr` method that accesses the mapping from validator addresses on consumer chains to validator addresses on the provider chain (`ValidatorsByConsumerAddrBytePrefix`). @@ -83,14 +126,10 @@ Thus, "old" consumer addresses are no longer needed after the provider's `Unbond This means that once a validator changes its key on a consumer, we can prune the address corresponding to the "old" key after `UnbondingPeriod`. This requires the following changes: -- Add a new prefix (i.e., `ConsumerAddrsToPruneV2BytePrefix`) to store consumer addresses that need to be pruned under a key with the format `bytePrefix | len(chainID) | chainID | timestamp` (see `ChainIdAndTsKey`). -- Adapt the `AppendConsumerAddrsToPrune()` method to use the timestamp of the current block instead of the current `vscID`. -- Add a new method `PruneKeyAssignmentsV2()` that adapts `PruneKeyAssignments()` to take a timestamp as an argument and iterate over `ConsumerAddrsToPruneV2BytePrefix`. -- Call the `PruneKeyAssignmentsV2()` method in every `EndBlock` instead of calling `PruneKeyAssignments()` in `HandleVSCMaturedPacket`. - -Note that the existing "old" consumer addresses stored under the `ConsumerAddrsToPruneBytePrefix` need to be pruned eventually to avoid slashing validator for "old" misbehaviors. -As a result, `PruneKeyAssignments()` needs to be called for `UnbondingPeriod` (i.e., three weeks). -Once the `UnbondingPeriod` elapses, the consumers can be upgraded to stop sending `VSCMaturedPackets` (see [R2](#consumer-changes-r2) below) and the provider can be upgraded to stop calling `PruneKeyAssignments()` (and all the data under `ConsumerAddrsToPruneBytePrefix` can be removed). +- Adapt the `AppendConsumerAddrsToPrune()` method to use the timestamp at which it is safe to prune the consumer validator address (instead of the current `vscID`). +- Add a new method `ConsumeConsumerAddrsToPrune(ts)` that returns the list of consumer addresses that can be pruned at timestamp `ts`. +- Adapt the `PruneKeyAssignments()` method to call `ConsumeConsumerAddrsToPrune(ctx.BlockTime())`. +- Call the `PruneKeyAssignments()` method from every `EndBlock()` instead of calling it from `HandleVSCMaturedPacket()`. #### Queries @@ -134,6 +173,8 @@ Note that this is a wire-breaking change -- older consumer versions will send `V ### Negative - Large refactor that might introduce unexpected bugs. +- Consumer chains are no longer removed if the duration between creating a client and creating the CCV channel exceeds `InitTimeoutPeriod`. + This means that if the CCV channel is not created on time, the client expires and the consumer chain can no longer start without a ClientUpdate proposal or re-submitting a `ConsumerAdditionProposal`. ### Neutral @@ -142,4 +183,5 @@ Note that this is a wire-breaking change -- older consumer versions will send `V ## References - +- [PR #712](https://github.com/cosmos/interchain-security/pull/712) -- Proposal to set an expiration date on the consumer chain updated on each VSCPacket received to ensure the chain is up-to-date. +- [Learning to Live with “Unbonding Pausing”](https://informal.systems/blog/learning-to-live-with-unbonding-pausing) blog post. From 70eaea4047046959e870acc58979420cceabfef8 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 21 Jun 2024 14:59:28 +0200 Subject: [PATCH 42/81] apply review suggestions --- x/ccv/provider/migrations/vX/migrations.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go index e6f091bf1d..bd4b0dfcc4 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -11,7 +11,8 @@ import ( ccv "github.com/cosmos/interchain-security/v4/x/ccv/types" ) -// CompleteUnbondingOps completes all unbonding operations +// CompleteUnbondingOps completes all unbonding operations. +// Note that it must be executed before CleanupState. func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper, sk ccv.StakingKeeper) { iterator := sdk.KVStorePrefixIterator(store, []byte{providertypes.UnbondingOpBytePrefix}) defer iterator.Close() @@ -25,17 +26,15 @@ func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk provider } // CleanupState removes deprecated state -func CleanupState(ctx sdk.Context, store storetypes.KVStore) error { - removePrefix(ctx, store, providertypes.MaturedUnbondingOpsByteKey) - removePrefix(ctx, store, providertypes.UnbondingOpBytePrefix) - removePrefix(ctx, store, providertypes.UnbondingOpIndexBytePrefix) - removePrefix(ctx, store, providertypes.VscSendTimestampBytePrefix) - removePrefix(ctx, store, providertypes.VSCMaturedHandledThisBlockBytePrefix) - - return nil +func CleanupState(store storetypes.KVStore) { + removePrefix(store, providertypes.MaturedUnbondingOpsByteKey) + removePrefix(store, providertypes.UnbondingOpBytePrefix) + removePrefix(store, providertypes.UnbondingOpIndexBytePrefix) + removePrefix(store, providertypes.VscSendTimestampBytePrefix) + removePrefix(store, providertypes.VSCMaturedHandledThisBlockBytePrefix) } -func removePrefix(ctx sdk.Context, store storetypes.KVStore, prefix byte) error { +func removePrefix(store storetypes.KVStore, prefix byte) { iterator := sdk.KVStorePrefixIterator(store, []byte{prefix}) defer iterator.Close() @@ -46,6 +45,4 @@ func removePrefix(ctx sdk.Context, store storetypes.KVStore, prefix byte) error for _, delKey := range keysToDel { store.Delete(delKey) } - - return nil } From d771102cd4908c4403723c6ef01a8d9403b4c711 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Tue, 25 Jun 2024 15:40:56 +0200 Subject: [PATCH 43/81] Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 0302fef28d..529b87a1ad 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -13,7 +13,7 @@ Proposed ## Context -> The idea of removing VSCMatured packets was first suggested [Jae Kwon](https://github.com/jaekwon) over a conversation in 2022. +> The idea of removing VSCMatured packets was first suggested by [Jae Kwon](https://github.com/jaekwon) over a conversation in 2022. > As a result of that conversation, [an ADR was proposed](https://github.com/cosmos/interchain-security/pull/712) to halt consumer chain if VSC packets are no longer received. > The ADR was not accepted due to other considerations regarding the safety of consumer chains. > See [this blog post](https://informal.systems/blog/learning-to-live-with-unbonding-pausing) for more details. From a39908a291fd775541c7501794b958d9dab727e3 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Tue, 25 Jun 2024 15:41:33 +0200 Subject: [PATCH 44/81] Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 529b87a1ad..2ae4cc329b 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -23,7 +23,7 @@ The key word here is _asynchronous_, which means that (in theory) there is no bo The reasons for this asynchrony are relaying delays and chain liveness (e.g., a consumer could be down for a long period of time without affecting the liveness of the staking module on the Hub). The current version of ICS uses `VSCMaturedPackets` to create on the consumers a _partially synchronous_ view of the Hub’s staking module. -Partially synchronous means that the lag between the Hub’s view of stake and the consumer’s view of stake is bounded. +Partially synchronous means that the lag between the Hub’s view of stake and the consumer’s view of stake is bounded, because consumers that exceed this lag are forcibly removed from the protocol. Basically, unlocking collateral from the Hub is being delayed until the consumers’ `UnbondingPeriod` elapses. The reason the view is only partially synchronous is that eventually the collateral is unlocked, i.e., if `VSCMaturedPackets` are not received from a consumer for `VscTimeoutPeriod` (default: 5 weeks), then the consumer is removed from ICS and the collateral is unlocked. Note that keeping the stake locked “forever” would affect the Hub’s liveness, so it’s not a viable option. From 7a29c15582bb5f0285ab119673efcd3ab58c9cf5 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Wed, 26 Jun 2024 13:44:22 +0200 Subject: [PATCH 45/81] Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: Simon Noetzlin --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 2ae4cc329b..416323802b 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -55,7 +55,7 @@ Deprecate the `InitTimeoutPeriod` and `VscTimeoutPeriod` parameters. #### State -Add the following key prefixes to the state: +Add the following key prefix to the state: - `ConsumerAddrsToPruneV2BytePrefix` -- the byte prefix for storing consumer validators addresses that need to be pruned. These are stored as From 4ebd2b8e27235f95b9d1d3f7e4b4f17aa1007f6b Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 26 Jun 2024 13:49:41 +0200 Subject: [PATCH 46/81] describe how hermes uses UnbondingPeriod --- docs/docs/adrs/adr-018-remove-vscmatured.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 416323802b..7bcb512af9 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -140,7 +140,8 @@ Remove the `oldest_unconfirmed_vsc` query. #### Parameters Given that currently relayers use the consumer `UnbondingPeriod` (see `ConsumerParams`), this param cannot be deprecated. -The `UnbondingTime` method from the staking interface will continue to be used to retrieve the consumer's `UnbondingPeriod`. +Note that Hermes queries the `UnbondingPeriod` for sanity checks and to set the default trusting period when it is not specified. +As a result, the `UnbondingTime` method from the staking interface will continue to be used to retrieve the consumer's `UnbondingPeriod`. #### State From 2f7758b5c024e3f7d9cc7366e871c340f60c213a Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 26 Jun 2024 13:53:37 +0200 Subject: [PATCH 47/81] apply review suggestions --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index 7bcb512af9..d4561bc844 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -120,7 +120,7 @@ The first two are no longer needed, while the third (key assignment pruning) nee - Stop removing the VSC send timestamps when receiving `VSCMaturedPackets`. - Remove the logic from `EndBlockCCR` that checks if the first VSC send timestamp in iterator plus `VscTimeoutPeriod` exceeds the current block time. -**Redesign key assignment pruning.** The reason for keeping "old" consumer addresses in the previous design was to enable slashing / jailing validators that misbehave on consumer chains, +**Redesign key assignment pruning.** The reason for keeping "old" consumer addresses is to enable slashing / jailing validators that misbehave on consumer chains, i.e., the slashing logic uses the `GetProviderAddrFromConsumerAddr` method that accesses the mapping from validator addresses on consumer chains to validator addresses on the provider chain (`ValidatorsByConsumerAddrBytePrefix`). Thus, "old" consumer addresses are no longer needed after the provider's `UnbondingPeriod` elapses. This means that once a validator changes its key on a consumer, we can prune the address corresponding to the "old" key after `UnbondingPeriod`. From 1626437bfa91947cf5daca88fd3ed066d6b5ff5e Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 28 Jun 2024 14:11:46 +0200 Subject: [PATCH 48/81] apply review suggestions --- tests/integration/unbonding.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index 19dd1cbe21..cd29c6da96 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -9,10 +9,10 @@ import ( func (s *CCVTestSuite) TestUndelegationCompletion() { s.SetupCCVChannel(s.path) - // delegate bondAmt and undelegate 1/2 of it + // delegate bondAmt and undelegate 1/4 of it bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) + initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 4) // - check that staking unbonding op was created checkStakingUnbondingOps(s, 1, true) @@ -26,9 +26,10 @@ func (s *CCVTestSuite) TestUndelegationCompletion() { // check that the unbonding operation completed checkStakingUnbondingOps(s, valsetUpdateID, false) // - check that necessary delegated coins have been returned - unbondAmt := bondAmt.Sub(bondAmt.Quo(sdk.NewInt(2))) + unbondAmt := bondAmt.Quo(sdk.NewInt(4)) + stillBondedAmt := bondAmt.Sub(unbondAmt) s.Require().Equal( - initBalance.Sub(unbondAmt), + initBalance.Sub(stillBondedAmt), getBalance(s, s.providerCtx(), delAddr), "unexpected initial balance after unbonding; test: %s", ) From 2762613e21cfacc11fdcf6f905c8eb0499e9ebf5 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 28 Jun 2024 14:25:36 +0200 Subject: [PATCH 49/81] apply review suggestions --- x/ccv/provider/keeper/relay.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 656e775e5b..f2aa0d61ac 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -357,7 +357,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // Obtain provider chain consensus address using the consumer chain consensus address providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, chainID, consumerConsAddr) - k.Logger(ctx).Debug("handling slash packet", + k.Logger(ctx).Debug("HandleSlashPacket", "chainID", chainID, "consumer cons addr", consumerConsAddr.String(), "provider cons addr", providerConsAddr.String(), @@ -372,10 +372,10 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // stakingKeeper.Slash() panics otherwise if !found || validator.IsUnbonded() { // if validator is not found or is unbonded, drop slash packet and log error. - // Note that it is impossible for the validator to be not found or unbonded if both the provider - // and the consumer are following the protocol. Thus if this branch is taken then one or both - // chains is incorrect, but it is impossible to tell which. - k.Logger(ctx).Error("validator not found or is unbonded", "validator", providerConsAddr.String()) + k.Logger(ctx).Info( + "HandleSlashPacket - slash packet dropped because validator not found or is unbonded", + "provider cons addr", providerConsAddr.String(), + ) return } @@ -383,7 +383,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas if k.slashingKeeper.IsTombstoned(ctx, providerConsAddr.ToSdkConsAddr()) { // Log and drop packet if validator is tombstoned. k.Logger(ctx).Info( - "slash packet dropped because validator is already tombstoned", + "HandleSlashPacket - slash packet dropped because validator is already tombstoned", "provider cons addr", providerConsAddr.String(), ) return @@ -391,7 +391,10 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas infractionHeight, found := k.getMappedInfractionHeight(ctx, chainID, data.ValsetUpdateId) if !found { - k.Logger(ctx).Error("infraction height not found. But was found during slash packet validation") + k.Logger(ctx).Error( + "HandleSlashPacket - infraction height not found. But was found during slash packet validation", + "vscID", data.ValsetUpdateId, + ) // drop packet return } @@ -406,7 +409,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // jail validator if !validator.IsJailed() { k.stakingKeeper.Jail(ctx, providerConsAddr.ToSdkConsAddr()) - k.Logger(ctx).Info("validator jailed", "provider cons addr", providerConsAddr.String()) + k.Logger(ctx).Info("HandleSlashPacket - validator jailed", "provider cons addr", providerConsAddr.String()) jailTime := ctx.BlockTime().Add(k.slashingKeeper.DowntimeJailDuration(ctx)) k.slashingKeeper.JailUntil(ctx, providerConsAddr.ToSdkConsAddr(), jailTime) } From 589aa3084fd33d20a8320f79d2350153358bc5ed Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 28 Jun 2024 19:19:08 +0200 Subject: [PATCH 50/81] remove ConsumerAddrsToPrune --- .../ccv/provider/v1/provider.proto | 9 - x/ccv/provider/types/provider.pb.go | 506 ++++-------------- 2 files changed, 118 insertions(+), 397 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 4752c8f2e2..1837754a6e 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -308,15 +308,6 @@ message ValidatorByConsumerAddr { bytes provider_addr = 3; } -// Used to serialize the ConsumerAddrsToPrune index from key assignment -// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList -// TODO remove once all consumer addresses stored under the ConsumerAddrsToPrune index are pruned -message ConsumerAddrsToPrune { - string chain_id = 1; - uint64 vsc_id = 2; - AddressList consumer_addrs = 3; -} - // Used to serialize the ConsumerAddrsToPruneV2 index from key assignment // ConsumerAddrsToPruneV2: (chainID, pruneTs time.Time) -> consumerAddrs AddressList message ConsumerAddrsToPruneV2 { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index db7481c433..c55e6766e4 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -1200,69 +1200,6 @@ func (m *ValidatorByConsumerAddr) GetProviderAddr() []byte { return nil } -// Used to serialize the ConsumerAddrsToPrune index from key assignment -// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList -// TODO remove once all consumer addresses stored under the ConsumerAddrsToPrune index are pruned -type ConsumerAddrsToPrune struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - VscId uint64 `protobuf:"varint,2,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` - ConsumerAddrs *AddressList `protobuf:"bytes,3,opt,name=consumer_addrs,json=consumerAddrs,proto3" json:"consumer_addrs,omitempty"` -} - -func (m *ConsumerAddrsToPrune) Reset() { *m = ConsumerAddrsToPrune{} } -func (m *ConsumerAddrsToPrune) String() string { return proto.CompactTextString(m) } -func (*ConsumerAddrsToPrune) ProtoMessage() {} -func (*ConsumerAddrsToPrune) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{17} -} -func (m *ConsumerAddrsToPrune) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConsumerAddrsToPrune) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConsumerAddrsToPrune.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ConsumerAddrsToPrune) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsumerAddrsToPrune.Merge(m, src) -} -func (m *ConsumerAddrsToPrune) XXX_Size() int { - return m.Size() -} -func (m *ConsumerAddrsToPrune) XXX_DiscardUnknown() { - xxx_messageInfo_ConsumerAddrsToPrune.DiscardUnknown(m) -} - -var xxx_messageInfo_ConsumerAddrsToPrune proto.InternalMessageInfo - -func (m *ConsumerAddrsToPrune) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ConsumerAddrsToPrune) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { - if m != nil { - return m.ConsumerAddrs - } - return nil -} - // Used to serialize the ConsumerAddrsToPruneV2 index from key assignment // ConsumerAddrsToPruneV2: (chainID, pruneTs time.Time) -> consumerAddrs AddressList type ConsumerAddrsToPruneV2 struct { @@ -1275,7 +1212,7 @@ func (m *ConsumerAddrsToPruneV2) Reset() { *m = ConsumerAddrsToPruneV2{} func (m *ConsumerAddrsToPruneV2) String() string { return proto.CompactTextString(m) } func (*ConsumerAddrsToPruneV2) ProtoMessage() {} func (*ConsumerAddrsToPruneV2) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{18} + return fileDescriptor_f22ec409a72b7b72, []int{17} } func (m *ConsumerAddrsToPruneV2) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1340,7 +1277,7 @@ func (m *ConsumerValidator) Reset() { *m = ConsumerValidator{} } func (m *ConsumerValidator) String() string { return proto.CompactTextString(m) } func (*ConsumerValidator) ProtoMessage() {} func (*ConsumerValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{19} + return fileDescriptor_f22ec409a72b7b72, []int{18} } func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1401,7 +1338,7 @@ func (m *ConsumerRewardsAllocation) Reset() { *m = ConsumerRewardsAlloca func (m *ConsumerRewardsAllocation) String() string { return proto.CompactTextString(m) } func (*ConsumerRewardsAllocation) ProtoMessage() {} func (*ConsumerRewardsAllocation) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{20} + return fileDescriptor_f22ec409a72b7b72, []int{19} } func (m *ConsumerRewardsAllocation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1455,7 +1392,6 @@ func init() { proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") - proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") proto.RegisterType((*ConsumerAddrsToPruneV2)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPruneV2") proto.RegisterType((*ConsumerValidator)(nil), "interchain_security.ccv.provider.v1.ConsumerValidator") proto.RegisterType((*ConsumerRewardsAllocation)(nil), "interchain_security.ccv.provider.v1.ConsumerRewardsAllocation") @@ -1466,122 +1402,120 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1829 bytes of a gzipped FileDescriptorProto + // 1802 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xec, 0x95, 0xaa, 0x92, 0xf4, 0xa6, 0x09, + 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xed, 0x95, 0xaa, 0x92, 0xf4, 0xa6, 0x09, 0xd4, 0xb8, 0xde, 0x8d, 0x94, 0x1e, 0x0c, 0xa3, 0x81, 0x21, 0x51, 0x4e, 0x6c, 0x2b, 0x71, 0xd8, - 0x95, 0x60, 0x03, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, - 0x79, 0xe9, 0xb9, 0x87, 0x16, 0x48, 0x2f, 0x45, 0xd0, 0x43, 0x9b, 0x16, 0x28, 0x50, 0xf4, 0xd2, + 0x15, 0xe1, 0x00, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, + 0x79, 0xe9, 0xb9, 0x87, 0x16, 0x48, 0x2f, 0x45, 0xd0, 0x43, 0x1b, 0x14, 0x28, 0x50, 0xf4, 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0x11, 0x3a, - 0x0b, 0x3d, 0x95, 0x00, 0xe6, 0x42, 0xea, 0x48, 0x72, 0xf9, 0x76, 0x76, 0xf9, 0xf6, 0x49, 0x96, - 0x1d, 0x07, 0x35, 0xe5, 0xc8, 0xe7, 0xdf, 0xb6, 0x0c, 0xb7, 0xae, 0xed, 0xd4, 0x0a, 0x7c, 0x04, - 0x56, 0x47, 0x61, 0x8f, 0x85, 0x3e, 0x0d, 0xfb, 0x5e, 0x44, 0x38, 0x65, 0xbe, 0x59, 0xd3, 0x50, - 0x9b, 0x17, 0xa0, 0x0e, 0xd3, 0x3c, 0x4a, 0x90, 0xbe, 0x50, 0x48, 0x2b, 0xb9, 0x71, 0x57, 0xdb, - 0xc2, 0x9f, 0x02, 0x88, 0x71, 0xac, 0x5d, 0x62, 0x23, 0x99, 0x21, 0xd6, 0xa7, 0x47, 0x5c, 0xc5, - 0x38, 0x3e, 0x49, 0xac, 0x53, 0xc8, 0x9f, 0x83, 0xeb, 0x92, 0xa3, 0x50, 0x3c, 0x25, 0xfc, 0x3c, - 0x2e, 0x98, 0x1e, 0xf7, 0xad, 0x0c, 0x63, 0x12, 0xfc, 0x3e, 0x68, 0xe3, 0x34, 0x81, 0x3c, 0x4e, - 0x7c, 0x2a, 0x24, 0xa7, 0xbd, 0x91, 0xb2, 0xf5, 0x9e, 0x72, 0x84, 0x75, 0x8e, 0x34, 0x74, 0x12, - 0x34, 0x33, 0x3d, 0x77, 0x42, 0xed, 0xa3, 0x54, 0x0b, 0x7e, 0x06, 0x7e, 0xd0, 0x0b, 0x18, 0x3e, - 0x15, 0xca, 0x39, 0x6f, 0x02, 0x49, 0x6f, 0x3d, 0xa4, 0x42, 0x28, 0xb4, 0xc5, 0xb6, 0xb1, 0x53, - 0x71, 0x6f, 0x24, 0xba, 0x5d, 0xc2, 0x0f, 0x4b, 0x9a, 0x27, 0x25, 0x45, 0x78, 0x0b, 0xc0, 0x01, - 0x15, 0x92, 0x71, 0x8a, 0x51, 0xe0,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09, 0x44, 0x1e, 0x52, 0x01, 0xde, 0x2d, 0x51, 0xb8, 0x2a, - 0x41, 0x4f, 0x67, 0xbf, 0xc7, 0x49, 0x5f, 0xf1, 0x1c, 0x4a, 0xd8, 0x9c, 0x90, 0x7c, 0x0c, 0x49, + 0x93, 0xfa, 0x70, 0x69, 0x24, 0xb9, 0x48, 0xbb, 0x6f, 0xde, 0xfb, 0xcd, 0x9b, 0x37, 0xef, 0xbd, + 0xdf, 0xe3, 0x82, 0x03, 0x1a, 0x4a, 0xc2, 0xf1, 0x10, 0xd1, 0xd0, 0x13, 0x04, 0x8f, 0x39, 0x95, + 0x13, 0x07, 0xe3, 0xd8, 0x89, 0x38, 0x8b, 0xa9, 0x4f, 0xb8, 0x13, 0xef, 0xe7, 0xcf, 0x76, 0xc4, + 0x99, 0x64, 0xf0, 0x8d, 0x2b, 0x6c, 0x6c, 0x8c, 0x63, 0x3b, 0xd7, 0x8b, 0xf7, 0x77, 0xde, 0xbc, + 0x0e, 0x38, 0xde, 0x77, 0xce, 0x29, 0x27, 0x09, 0xd6, 0xce, 0xd6, 0x80, 0x0d, 0x98, 0x7e, 0x74, + 0xd4, 0x53, 0x2a, 0x6d, 0x0d, 0x18, 0x1b, 0x04, 0xc4, 0xd1, 0x6f, 0xfd, 0xf1, 0x33, 0x47, 0xd2, + 0x11, 0x11, 0x12, 0x8d, 0xa2, 0x54, 0xa1, 0x79, 0x51, 0xc1, 0x1f, 0x73, 0x24, 0x29, 0x0b, 0x33, + 0x00, 0xda, 0xc7, 0x0e, 0x66, 0x9c, 0x38, 0x38, 0xa0, 0x24, 0x94, 0x6a, 0xd7, 0xe4, 0x29, 0x55, + 0x70, 0x94, 0x42, 0x40, 0x07, 0x43, 0x99, 0x88, 0x85, 0x23, 0x49, 0xe8, 0x13, 0x3e, 0xa2, 0x89, + 0x72, 0xf1, 0x96, 0x1a, 0xec, 0x96, 0xd6, 0x31, 0x9f, 0x44, 0x92, 0x39, 0x67, 0x64, 0x22, 0x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92, 0x7e, 0xeb, 0xd9, 0x4a, 0xc6, 0xd6, 0x45, 0x1a, 0xcd, + 0x97, 0xd2, 0x08, 0x7e, 0x08, 0x36, 0x73, 0x97, 0x23, 0x7d, 0x99, 0x33, 0xdf, 0x78, 0x3e, 0x92, + 0xe4, 0x22, 0xeb, 0xb7, 0x46, 0xd1, 0x4e, 0x93, 0xae, 0x2e, 0x0e, 0x83, 0x20, 0x9d, 0xe3, 0x60, + 0x04, 0x96, 0x12, 0xe2, 0x10, 0x69, 0x75, 0xee, 0x5e, 0x49, 0x11, 0xc7, 0x04, 0x6b, 0x96, 0xb8, + 0xab, 0x02, 0xfc, 0xb7, 0xaf, 0x5b, 0xb7, 0x07, 0x54, 0x0e, 0xc7, 0x7d, 0x1b, 0xb3, 0x91, 0x93, + 0x7e, 0xbb, 0x48, 0xfe, 0xdd, 0x11, 0xfe, 0x99, 0x23, 0x27, 0x11, 0x11, 0x99, 0x8d, 0xf8, 0xeb, + 0x7f, 0xfe, 0xf1, 0xb6, 0xe1, 0x66, 0xdb, 0x1c, 0x7d, 0xf2, 0xc5, 0x8b, 0xa6, 0xf1, 0xe5, 0x8b, + 0xa6, 0xf1, 0xef, 0x17, 0x4d, 0xe3, 0xd3, 0x97, 0xcd, 0xb9, 0x2f, 0x5f, 0x36, 0xe7, 0xfe, 0xf5, + 0xb2, 0x39, 0xf7, 0xf3, 0xf7, 0x2e, 0x83, 0x16, 0x77, 0x74, 0x27, 0xff, 0x5a, 0x14, 0xff, 0xc4, + 0xf9, 0xe5, 0xf4, 0xb7, 0x28, 0xbd, 0x5f, 0x7f, 0x51, 0x27, 0xc4, 0xbb, 0xff, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0x9e, 0x74, 0x8e, 0x96, 0xbc, 0x12, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2509,53 +2443,6 @@ func (m *ValidatorByConsumerAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *ConsumerAddrsToPrune) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConsumerAddrsToPrune) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsumerAddrs != nil { - { - size, err := m.ConsumerAddrs.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.VscId != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *ConsumerAddrsToPruneV2) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2588,12 +2475,12 @@ func (m *ConsumerAddrsToPruneV2) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x1a } - n17, err17 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) - if err17 != nil { - return 0, err17 + n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) + if err16 != nil { + return 0, err16 } - i -= n17 - i = encodeVarintProvider(dAtA, i, uint64(n17)) + i -= n16 + i = encodeVarintProvider(dAtA, i, uint64(n16)) i-- dAtA[i] = 0x12 if len(m.ChainId) > 0 { @@ -3116,26 +3003,6 @@ func (m *ValidatorByConsumerAddr) Size() (n int) { return n } -func (m *ConsumerAddrsToPrune) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.VscId != 0 { - n += 1 + sovProvider(uint64(m.VscId)) - } - if m.ConsumerAddrs != nil { - l = m.ConsumerAddrs.Size() - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - func (m *ConsumerAddrsToPruneV2) Size() (n int) { if m == nil { return 0 @@ -6111,143 +5978,6 @@ func (m *ValidatorByConsumerAddr) Unmarshal(dAtA []byte) error { } return nil } -func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConsumerAddrsToPrune: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerAddrsToPrune: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) - } - m.VscId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.VscId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsumerAddrs == nil { - m.ConsumerAddrs = &AddressList{} - } - if err := m.ConsumerAddrs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ConsumerAddrsToPruneV2) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From c52deedd71e3aa1a12c3100a026039dc723b37a3 Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 2 Jul 2024 15:56:11 +0200 Subject: [PATCH 51/81] deprecate InitTimeoutTimestampBytePrefix --- x/ccv/provider/keeper/keeper.go | 48 ------------------------- x/ccv/provider/keeper/keeper_test.go | 54 ---------------------------- x/ccv/provider/types/keys.go | 7 ++-- x/ccv/provider/types/keys_test.go | 3 -- 4 files changed, 2 insertions(+), 110 deletions(-) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 24810d96e1..6f0a479338 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -670,54 +670,6 @@ func (k Keeper) DeleteConsumerClientId(ctx sdk.Context, chainID string) { store.Delete(types.ChainToClientKey(chainID)) } -// SetInitTimeoutTimestamp sets the init timeout timestamp for the given chain ID -func (k Keeper) SetInitTimeoutTimestamp(ctx sdk.Context, chainID string, ts uint64) { - store := ctx.KVStore(k.storeKey) - tsBytes := make([]byte, 8) - binary.BigEndian.PutUint64(tsBytes, ts) - store.Set(types.InitTimeoutTimestampKey(chainID), tsBytes) -} - -// GetInitTimeoutTimestamp returns the init timeout timestamp for the given chain ID. -// This method is used only in testing. -func (k Keeper) GetInitTimeoutTimestamp(ctx sdk.Context, chainID string) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.InitTimeoutTimestampKey(chainID)) - if bz == nil { - return 0, false - } - return binary.BigEndian.Uint64(bz), true -} - -// DeleteInitTimeoutTimestamp removes from the store the init timeout timestamp for the given chainID. -func (k Keeper) DeleteInitTimeoutTimestamp(ctx sdk.Context, chainID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.InitTimeoutTimestampKey(chainID)) -} - -// GetAllInitTimeoutTimestamps gets all init timeout timestamps in the store. -// -// Note that the init timeout timestamps are stored under keys with the following format: -// InitTimeoutTimestampBytePrefix | chainID -// Thus, the returned array is in ascending order of chainIDs (NOT in timestamp order). -func (k Keeper) GetAllInitTimeoutTimestamps(ctx sdk.Context) (initTimeoutTimestamps []types.InitTimeoutTimestamp) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, []byte{types.InitTimeoutTimestampBytePrefix}) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - chainID := string(iterator.Key()[1:]) - ts := binary.BigEndian.Uint64(iterator.Value()) - - initTimeoutTimestamps = append(initTimeoutTimestamps, types.InitTimeoutTimestamp{ - ChainId: chainID, - Timestamp: ts, - }) - } - - return initTimeoutTimestamps -} - // SetSlashLog updates validator's slash log for a consumer chain // If an entry exists for a given validator address, at least one // double signing slash packet was received by the provider from at least one consumer chain diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index f60436a8a2..13393ee4d4 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -5,7 +5,6 @@ import ( "fmt" "sort" "testing" - "time" ibctesting "github.com/cosmos/ibc-go/v7/testing" "github.com/stretchr/testify/require" @@ -224,59 +223,6 @@ func TestInitHeight(t *testing.T) { } } -func TestInitTimeoutTimestamp(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - nsNow := uint64(now.UnixNano()) - timeoutTimestamps := []types.InitTimeoutTimestamp{ - { - ChainId: "chain-2", - Timestamp: nsNow, - }, - { - ChainId: "chain-1", - Timestamp: nsNow + 10, - }, - { - ChainId: "chain-4", - Timestamp: nsNow - 10, - }, - { - ChainId: "chain-3", - Timestamp: nsNow, - }, - } - - expectedGetAllOrder := timeoutTimestamps - // sorting by ChainId - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].ChainId < expectedGetAllOrder[j].ChainId - }) - - _, found := pk.GetInitTimeoutTimestamp(ctx, timeoutTimestamps[0].ChainId) - require.False(t, found) - - for _, tt := range timeoutTimestamps { - pk.SetInitTimeoutTimestamp(ctx, tt.ChainId, tt.Timestamp) - } - - for _, tt := range timeoutTimestamps { - _, found := pk.GetInitTimeoutTimestamp(ctx, tt.ChainId) - require.True(t, found) - } - - // iterate and check all results are returned in the expected order - result := pk.GetAllInitTimeoutTimestamps(ctx) - require.Len(t, result, len(timeoutTimestamps)) - require.Equal(t, result, expectedGetAllOrder) - - pk.DeleteInitTimeoutTimestamp(ctx, timeoutTimestamps[0].ChainId) - _, found = pk.GetInitTimeoutTimestamp(ctx, timeoutTimestamps[0].ChainId) - require.False(t, found) -} - func TestGetAllRegisteredConsumerChainIDs(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 53a7d0fcad..c049fecfde 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -68,6 +68,8 @@ const ( // InitTimeoutTimestampBytePrefix is the byte prefix for storing // the init timeout timestamp for a given consumer chainID. + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] InitTimeoutTimestampBytePrefix // PendingCAPBytePrefix is the byte prefix for storing pending consumer addition proposals before the spawn time occurs. @@ -247,11 +249,6 @@ func ChainToClientKey(chainID string) []byte { return append([]byte{ChainToClientBytePrefix}, []byte(chainID)...) } -// InitTimeoutTimestampKey returns the key under which the init timeout timestamp for the given chainID is stored. -func InitTimeoutTimestampKey(chainID string) []byte { - return append([]byte{InitTimeoutTimestampBytePrefix}, []byte(chainID)...) -} - // PendingCAPKey returns the key under which a pending consumer addition proposal is stored. // The key has the following format: PendingCAPBytePrefix | timestamp.UnixNano() | chainID func PendingCAPKey(timestamp time.Time, chainID string) []byte { diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index f65aec24df..ab7a711b0e 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -86,7 +86,6 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ChainToChannelKey("chainID"), providertypes.ChannelToChainKey("channelID"), providertypes.ChainToClientKey("chainID"), - providertypes.InitTimeoutTimestampKey("chainID"), providertypes.PendingCAPKey(time.Time{}, "chainID"), providertypes.PendingCRPKey(time.Time{}, "chainID"), providertypes.ValsetUpdateBlockHeightKey(7), @@ -250,7 +249,6 @@ func TestKeysWithPrefixAndId(t *testing.T) { providertypes.ChainToChannelKey, providertypes.ChannelToChainKey, providertypes.ChainToClientKey, - providertypes.InitTimeoutTimestampKey, providertypes.ConsumerGenesisKey, providertypes.SlashAcksKey, providertypes.InitChainHeightKey, @@ -261,7 +259,6 @@ func TestKeysWithPrefixAndId(t *testing.T) { providertypes.ChainToChannelBytePrefix, providertypes.ChannelToChainBytePrefix, providertypes.ChainToClientBytePrefix, - providertypes.InitTimeoutTimestampBytePrefix, providertypes.ConsumerGenesisBytePrefix, providertypes.SlashAcksBytePrefix, providertypes.InitChainHeightBytePrefix, From 3862a397b970eca9c01d155e058a7985a2ae9b8d Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 3 Jul 2024 13:02:47 +0200 Subject: [PATCH 52/81] remove init timeout logic --- x/ccv/provider/keeper/keeper.go | 2 -- x/ccv/provider/keeper/proposal.go | 8 -------- x/ccv/provider/keeper/relay.go | 26 -------------------------- x/ccv/provider/module.go | 2 -- x/ccv/provider/types/events.go | 1 - 5 files changed, 39 deletions(-) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 6f0a479338..0cd7beda03 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -396,8 +396,6 @@ func (k Keeper) SetConsumerChain(ctx sdk.Context, channelID string) error { k.SetChannelToChain(ctx, channelID, chainID) // - set current block height for the consumer chain initialization k.SetInitChainHeight(ctx, chainID, uint64(ctx.BlockHeight())) - // - remove init timeout timestamp - k.DeleteInitTimeoutTimestamp(ctx, chainID) // emit event on successful addition ctx.EventManager().EmitEvent( diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index f19eaa304b..bcd13a0986 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "strconv" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -95,11 +94,6 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi } k.SetConsumerClientId(ctx, chainID, clientID) - // TODO (mpoke) Decide what to do about the init timeout - // add the init timeout timestamp for this consumer chain - ts := ctx.BlockTime().Add(k.GetParams(ctx).InitTimeoutPeriod) - k.SetInitTimeoutTimestamp(ctx, chainID, uint64(ts.UnixNano())) - k.Logger(ctx).Info("consumer chain registered (client created)", "chainID", chainID, "clientID", clientID, @@ -112,7 +106,6 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi sdk.NewAttribute(ccv.AttributeChainID, chainID), sdk.NewAttribute(clienttypes.AttributeKeyClientID, clientID), sdk.NewAttribute(types.AttributeInitialHeight, prop.InitialHeight.String()), - sdk.NewAttribute(types.AttributeInitializationTimeout, strconv.Itoa(int(ts.UnixNano()))), sdk.NewAttribute(types.AttributeTrustingPeriod, clientState.TrustingPeriod.String()), sdk.NewAttribute(types.AttributeUnbondingPeriod, clientState.UnbondingPeriod.String()), ), @@ -216,7 +209,6 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo // clean up states k.DeleteConsumerClientId(ctx, chainID) k.DeleteConsumerGenesis(ctx, chainID) - k.DeleteInitTimeoutTimestamp(ctx, chainID) // Note: this call panics if the key assignment state is invalid k.DeleteKeyAssignments(ctx, chainID) k.DeleteMinimumPowerInTopN(ctx, chainID) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 1976bb8978..dde48fd9b6 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -383,32 +383,6 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas ) } -// EndBlockCCR contains the EndBlock logic needed for -// the Consumer Chain Removal sub-protocol -func (k Keeper) EndBlockCCR(ctx sdk.Context) { - currentTime := ctx.BlockTime() - currentTimeUint64 := uint64(currentTime.UnixNano()) - - for _, initTimeoutTimestamp := range k.GetAllInitTimeoutTimestamps(ctx) { - if currentTimeUint64 > initTimeoutTimestamp.Timestamp { - // initTimeout expired - // stop the consumer chain and unlock the unbonding. - // Note that the CCV channel was not established, - // thus closeChan is irrelevant - k.Logger(ctx).Info("about to remove timed out consumer chain - chain was not initialised", - "chainID", initTimeoutTimestamp.ChainId) - err := k.StopConsumerChain(ctx, initTimeoutTimestamp.ChainId, false) - if err != nil { - if providertypes.ErrConsumerChainNotFound.Is(err) { - // consumer chain not found - continue - } - panic(fmt.Errorf("consumer chain failed to stop: %w", err)) - } - } - } -} - // getMappedInfractionHeight gets the infraction height mapped from val set ID for the given chain ID func (k Keeper) getMappedInfractionHeight(ctx sdk.Context, chainID string, valsetUpdateID uint64, diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 23c773e97a..d36cccebde 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -159,8 +159,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V // EndBlock logic needed for the Consumer Initiated Slashing sub-protocol. // Important: EndBlockCIS must be called before EndBlockVSU am.keeper.EndBlockCIS(ctx) - // EndBlock logic needed for the Consumer Chain Removal sub-protocol - am.keeper.EndBlockCCR(ctx) // EndBlock logic needed for the Validator Set Update sub-protocol am.keeper.EndBlockVSU(ctx) diff --git a/x/ccv/provider/types/events.go b/x/ccv/provider/types/events.go index 8701821c52..9abcba7836 100644 --- a/x/ccv/provider/types/events.go +++ b/x/ccv/provider/types/events.go @@ -12,7 +12,6 @@ const ( EventTypeOptOut = "opt_out" AttributeInfractionHeight = "infraction_height" AttributeInitialHeight = "initial_height" - AttributeInitializationTimeout = "initialization_timeout" AttributeTrustingPeriod = "trusting_period" AttributeUnbondingPeriod = "unbonding_period" AttributeProviderValidatorAddress = "provider_validator_address" From 142e45e6a4108bc2faa6f83dad1e8d411cb8c54b Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 3 Jul 2024 13:11:43 +0200 Subject: [PATCH 53/81] migration to remove InitTimeoutTimestamp state --- x/ccv/provider/migrations/vX/migrations.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go index 17298b8de9..4009dc585f 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -65,6 +65,7 @@ func CleanupState(store storetypes.KVStore) { removePrefix(store, providertypes.MaturedUnbondingOpsByteKey) removePrefix(store, providertypes.UnbondingOpBytePrefix) removePrefix(store, providertypes.UnbondingOpIndexBytePrefix) + removePrefix(store, providertypes.InitTimeoutTimestampBytePrefix) removePrefix(store, providertypes.VscSendTimestampBytePrefix) removePrefix(store, providertypes.VSCMaturedHandledThisBlockBytePrefix) } From 94e403043e919c8b4b633ea0a0951bb86d9ab16b Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 3 Jul 2024 13:14:28 +0200 Subject: [PATCH 54/81] update GenesisState --- .../ccv/provider/v1/genesis.proto | 6 +- x/ccv/provider/keeper/genesis.go | 5 - x/ccv/provider/keeper/genesis_test.go | 13 -- x/ccv/provider/module_test.go | 1 - x/ccv/provider/types/genesis.go | 2 - x/ccv/provider/types/genesis.pb.go | 164 ++++++------------ x/ccv/provider/types/genesis_test.go | 21 --- 7 files changed, 53 insertions(+), 159 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 00071baa3a..96f6be69b3 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -20,6 +20,9 @@ message GenesisState { // Reserve 11th slot for consumer_addrs_to_prune field reserved 11; + // Reserve 12th slot for removed init_timeout_timestamps field + reserved 12; + // Reserve 13th slot for removed exported_vsc_send_timestamps field reserved 13; @@ -47,9 +50,6 @@ message GenesisState { repeated ValidatorByConsumerAddr validators_by_consumer_addr = 10 [ (gogoproto.nullable) = false ]; - repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 12 - [ (gogoproto.nullable) = false ]; - // empty for a new chain repeated ConsumerAddrsToPruneV2 consumer_addrs_to_prune_v2 = 14 [ (gogoproto.nullable) = false ]; diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index c7b7d4dd41..0082718021 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -79,10 +79,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { } } - for _, item := range genState.InitTimeoutTimestamps { - k.SetInitTimeoutTimestamp(ctx, item.ChainId, item.Timestamp) - } - k.SetParams(ctx, genState.Params) k.InitializeSlashMeter(ctx) } @@ -144,6 +140,5 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { k.GetAllValidatorConsumerPubKeys(ctx, nil), k.GetAllValidatorsByConsumerAddr(ctx, nil), consumerAddrsToPrune, - k.GetAllInitTimeoutTimestamps(ctx), ) } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 6f16f0bbbe..71f2589028 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "sort" "testing" "time" @@ -35,11 +34,6 @@ func TestInitAndExportGenesis(t *testing.T) { consumerTmPubKey := consumerCryptoId.TMProtoCryptoPublicKey() consumerConsAddr := consumerCryptoId.ConsumerConsAddress() - initTimeoutTimeStamps := []providertypes.InitTimeoutTimestamp{ - {ChainId: cChainIDs[0], Timestamp: uint64(time.Now().UTC().UnixNano()) + 10}, - {ChainId: cChainIDs[1], Timestamp: uint64(time.Now().UTC().UnixNano()) + 15}, - } - // create genesis struct provGenesis := providertypes.NewGenesisState(vscID, []providertypes.ValsetUpdateIdToHeight{{ValsetUpdateId: vscID, Height: initHeight}}, @@ -93,7 +87,6 @@ func TestInitAndExportGenesis(t *testing.T) { ConsumerAddrs: &providertypes.AddressList{Addresses: [][]byte{consumerConsAddr.ToSdkConsAddr()}}, }, }, - initTimeoutTimeStamps, ) // Instantiate in-mem provider keeper with mocks @@ -155,12 +148,6 @@ func TestInitAndExportGenesis(t *testing.T) { // check the exported genesis require.Equal(t, provGenesis, pk.ExportGenesis(ctx)) - - initTimeoutTimestampInStore := pk.GetAllInitTimeoutTimestamps(ctx) - sort.Slice(initTimeoutTimestampInStore, func(i, j int) bool { - return initTimeoutTimestampInStore[i].Timestamp < initTimeoutTimestampInStore[j].Timestamp - }) - require.Equal(t, initTimeoutTimestampInStore, initTimeoutTimeStamps) } func assertConsumerChainStates(t *testing.T, ctx sdk.Context, pk keeper.Keeper, consumerStates ...providertypes.ConsumerState) { diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index b7480cdf25..095788c2bd 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -106,7 +106,6 @@ func TestInitGenesis(t *testing.T) { nil, nil, nil, - nil, ) cdc := keeperParams.Cdc diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index 1e2d0b0e3c..41561f4a8c 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -22,7 +22,6 @@ func NewGenesisState( validatorConsumerPubkeys []ValidatorConsumerPubKey, validatorsByConsumerAddr []ValidatorByConsumerAddr, consumerAddrsToPrune []ConsumerAddrsToPruneV2, - initTimeoutTimestamps []InitTimeoutTimestamp, ) *GenesisState { return &GenesisState{ ValsetUpdateId: vscID, @@ -34,7 +33,6 @@ func NewGenesisState( ValidatorConsumerPubkeys: validatorConsumerPubkeys, ValidatorsByConsumerAddr: validatorsByConsumerAddr, ConsumerAddrsToPruneV2: consumerAddrsToPrune, - InitTimeoutTimestamps: initTimeoutTimestamps, } } diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index 3c88d05272..4e5fa6167b 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -41,7 +41,6 @@ type GenesisState struct { ValidatorConsumerPubkeys []ValidatorConsumerPubKey `protobuf:"bytes,9,rep,name=validator_consumer_pubkeys,json=validatorConsumerPubkeys,proto3" json:"validator_consumer_pubkeys"` // empty for a new chain ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,10,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` - InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` // empty for a new chain ConsumerAddrsToPruneV2 []ConsumerAddrsToPruneV2 `protobuf:"bytes,14,rep,name=consumer_addrs_to_prune_v2,json=consumerAddrsToPruneV2,proto3" json:"consumer_addrs_to_prune_v2"` } @@ -135,13 +134,6 @@ func (m *GenesisState) GetValidatorsByConsumerAddr() []ValidatorByConsumerAddr { return nil } -func (m *GenesisState) GetInitTimeoutTimestamps() []InitTimeoutTimestamp { - if m != nil { - return m.InitTimeoutTimestamps - } - return nil -} - func (m *GenesisState) GetConsumerAddrsToPruneV2() []ConsumerAddrsToPruneV2 { if m != nil { return m.ConsumerAddrsToPruneV2 @@ -316,58 +308,56 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 815 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0x37, 0xde, 0xd4, 0x99, 0xdd, 0x0d, 0xd6, 0xa8, 0x04, 0x37, 0x2b, 0xd2, 0x55, 0x50, - 0xa5, 0x48, 0x40, 0xdc, 0x04, 0x0e, 0xfc, 0xeb, 0xa1, 0x69, 0x25, 0x48, 0xb8, 0x44, 0x69, 0x58, - 0xa4, 0x5e, 0x46, 0x93, 0xf1, 0x28, 0x19, 0xc5, 0xf6, 0x58, 0x9e, 0xb1, 0x97, 0x08, 0x21, 0x81, - 0xf8, 0x02, 0x9c, 0xb9, 0xf0, 0x75, 0x7a, 0xec, 0x91, 0x53, 0x85, 0x76, 0xbf, 0x01, 0x9f, 0x00, - 0x79, 0x3c, 0x36, 0xc9, 0x92, 0xad, 0x12, 0x4e, 0x89, 0xe7, 0x37, 0xef, 0xf7, 0x7e, 0xef, 0xd9, - 0xef, 0xf7, 0x40, 0x9f, 0x85, 0x92, 0xc6, 0x64, 0x89, 0x59, 0x88, 0x04, 0x25, 0x49, 0xcc, 0xe4, - 0xda, 0x25, 0x24, 0x75, 0xa3, 0x98, 0xa7, 0xcc, 0xa3, 0xb1, 0x9b, 0xf6, 0xdd, 0x05, 0x0d, 0xa9, - 0x60, 0xa2, 0x17, 0xc5, 0x5c, 0x72, 0xf8, 0xc1, 0x8e, 0x90, 0x1e, 0x21, 0x69, 0xaf, 0x08, 0xe9, - 0xa5, 0xfd, 0xd6, 0xfd, 0x05, 0x5f, 0x70, 0x75, 0xdf, 0xcd, 0xfe, 0xe5, 0xa1, 0xad, 0xc7, 0x77, - 0x65, 0x4b, 0xfb, 0xae, 0x58, 0xe2, 0x98, 0x7a, 0x88, 0xf0, 0x50, 0x24, 0x01, 0x8d, 0x75, 0xc4, - 0xa3, 0xb7, 0x44, 0x5c, 0xb1, 0x98, 0xea, 0x6b, 0x83, 0x7d, 0xca, 0x28, 0xf5, 0xa9, 0x98, 0xce, - 0x1f, 0x75, 0x70, 0xfa, 0x75, 0x5e, 0xd9, 0x0b, 0x89, 0x25, 0x85, 0x5d, 0x60, 0xa7, 0xd8, 0x17, - 0x54, 0xa2, 0x24, 0xf2, 0xb0, 0xa4, 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xe7, 0x4d, 0xbb, 0xf2, 0xf2, 0xc9, 0x82, - 0xc9, 0x65, 0x32, 0xef, 0x11, 0x1e, 0xb8, 0x84, 0x8b, 0x80, 0x0b, 0xf7, 0xdf, 0x86, 0x7c, 0x5c, - 0xae, 0xbe, 0xf4, 0x53, 0xf7, 0x87, 0xed, 0xfd, 0x27, 0xd7, 0x11, 0x15, 0xf3, 0x9a, 0x5a, 0x7d, - 0x9f, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0xca, 0xe6, 0xe2, 0x1a, 0xf7, 0x07, 0x00, 0x00, + // 782 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x41, 0x6f, 0xda, 0x48, + 0x14, 0xc6, 0xc1, 0x21, 0x66, 0x12, 0x58, 0xcb, 0x8a, 0x90, 0x43, 0xb4, 0x24, 0x62, 0x15, 0x09, + 0x69, 0x77, 0x71, 0x60, 0xf7, 0xb0, 0xda, 0xdd, 0x1c, 0x42, 0x22, 0xed, 0x42, 0x2f, 0x88, 0xa4, + 0xa9, 0x94, 0x8b, 0x35, 0x8c, 0x47, 0x30, 0xc2, 0x78, 0x2c, 0xcf, 0xe0, 0x14, 0x55, 0x95, 0x5a, + 0xf5, 0x0f, 0xf4, 0xdc, 0xdf, 0xd0, 0x1f, 0x92, 0x63, 0x8e, 0x3d, 0x45, 0x55, 0xf2, 0x0f, 0xfa, + 0x0b, 0x2a, 0x8f, 0xc7, 0x2e, 0xa4, 0x24, 0x82, 0xde, 0x60, 0xbe, 0xf9, 0xbe, 0xf7, 0xbd, 0xe7, + 0xf7, 0xde, 0x80, 0x06, 0xf1, 0x38, 0x0e, 0xd0, 0x10, 0x12, 0xcf, 0x66, 0x18, 0x4d, 0x02, 0xc2, + 0xa7, 0x16, 0x42, 0xa1, 0xe5, 0x07, 0x34, 0x24, 0x0e, 0x0e, 0xac, 0xb0, 0x61, 0x0d, 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d1, 0x48, 0x4c, 0x74, 0xbe, 0xa7, 0x0b, 0xe4, 0x54, 0x02, 0xc7, 0x68, 0xd4, 0x51, 0x35, 0x4d, + 0xcf, 0x57, 0x2f, 0x41, 0x69, 0xf1, 0x32, 0x5b, 0x61, 0xa9, 0x97, 0x40, 0x4e, 0xd6, 0x7b, 0x4d, + 0xe0, 0xf2, 0x5f, 0xeb, 0xc5, 0xf5, 0x5d, 0x45, 0xb9, 0xb9, 0xab, 0x28, 0x9f, 0xef, 0x2a, 0xca, + 0xfb, 0xfb, 0x4a, 0xe6, 0xe6, 0xbe, 0x92, 0xf9, 0x74, 0x5f, 0xc9, 0x5c, 0x1e, 0x0d, 0x08, 0x1f, + 0x4e, 0xfa, 0x75, 0x44, 0xc7, 0x16, 0xa2, 0x6c, 0x4c, 0x99, 0xf5, 0xad, 0x20, 0xbf, 0xa7, 0xef, + 0x50, 0xf8, 0xa7, 0xf5, 0x72, 0xfe, 0x31, 0xe2, 0x53, 0x1f, 0xb3, 0x7e, 0x4e, 0xbc, 0x43, 0x7f, + 0x7c, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xac, 0x76, 0x15, 0xe7, 0x84, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -404,20 +394,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x72 } } - if len(m.InitTimeoutTimestamps) > 0 { - for iNdEx := len(m.InitTimeoutTimestamps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitTimeoutTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - } - } if len(m.ValidatorsByConsumerAddr) > 0 { for iNdEx := len(m.ValidatorsByConsumerAddr) - 1; iNdEx >= 0; iNdEx-- { { @@ -693,12 +669,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.InitTimeoutTimestamps) > 0 { - for _, e := range m.InitTimeoutTimestamps { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } if len(m.ConsumerAddrsToPruneV2) > 0 { for _, e := range m.ConsumerAddrsToPruneV2 { l = e.Size() @@ -1052,40 +1022,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutTimestamps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitTimeoutTimestamps = append(m.InitTimeoutTimestamps, InitTimeoutTimestamp{}) - if err := m.InitTimeoutTimestamps[len(m.InitTimeoutTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 14: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrsToPruneV2", wireType) diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 12974a6ea7..94b841e3e8 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -38,7 +38,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), true, }, @@ -59,7 +58,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), true, }, @@ -77,7 +75,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), true, }, @@ -95,7 +92,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -113,7 +109,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -136,7 +131,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -159,7 +153,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -182,7 +175,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -205,7 +197,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -228,7 +219,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -251,7 +241,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -267,7 +256,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -283,7 +271,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -299,7 +286,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -315,7 +301,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -334,7 +319,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -354,7 +338,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -374,7 +357,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -398,7 +380,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -416,7 +397,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, @@ -434,7 +414,6 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, ), false, }, From 38eaade9755c870de6f7e800e27fd9502abe1cad Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 3 Jul 2024 13:31:16 +0200 Subject: [PATCH 55/81] fix tests --- tests/integration/channel_init.go | 96 ---------------------------- testutil/keeper/unit_test_helpers.go | 2 - 2 files changed, 98 deletions(-) delete mode 100644 tests/integration/channel_init.go diff --git a/tests/integration/channel_init.go b/tests/integration/channel_init.go deleted file mode 100644 index e9a41c66f5..0000000000 --- a/tests/integration/channel_init.go +++ /dev/null @@ -1,96 +0,0 @@ -package integration - -// TestInitTimeout tests the init timeout -func (suite *CCVTestSuite) TestInitTimeout() { - testCases := []struct { - name string - handshake func() - removed bool - }{ - { - "init times out before INIT", func() {}, true, - }, - { - "init times out before TRY", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - }, true, - }, - { - "init times out before ACK", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - // send ChanOpenTry - err = suite.path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - }, true, - }, - { - "init times out before CONFIRM", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - // send ChanOpenTry - err = suite.path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - // send ChanOpenAck - err = suite.path.EndpointA.ChanOpenAck() - suite.Require().NoError(err) - }, true, - }, - { - "init completes before timeout", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - // send ChanOpenTry - err = suite.path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - // send ChanOpenAck - err = suite.path.EndpointA.ChanOpenAck() - suite.Require().NoError(err) - // send ChanOpenConfirm - err = suite.path.EndpointB.ChanOpenConfirm() - suite.Require().NoError(err) - }, false, - }, - } - - for i, tc := range testCases { - providerKeeper := suite.providerApp.GetProviderKeeper() - initTimeout := providerKeeper.GetParams(suite.providerCtx()).InitTimeoutPeriod - chainID := suite.consumerChain.ChainID - - // check that the init timeout timestamp is set - _, found := providerKeeper.GetInitTimeoutTimestamp(suite.providerCtx(), chainID) - suite.Require().True(found, "cannot find init timeout timestamp; test: %s", tc.name) - - // create connection - suite.coordinator.CreateConnections(suite.path) - - // channel opening handshake - tc.handshake() - - // call NextBlock - suite.providerChain.NextBlock() - - // increment time - incrementTime(suite, initTimeout) - - // check whether the chain was removed - _, found = providerKeeper.GetConsumerClientId(suite.providerCtx(), chainID) - suite.Require().Equal(!tc.removed, found, "unexpected outcome; test: %s", tc.name) - - if tc.removed { - // check if the chain was properly removed - suite.checkConsumerChainIsRemoved(chainID, false) - } - - if i+1 < len(testCases) { - // reset suite to reset provider client - suite.SetupTest() - } - } -} diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index 9e538f3212..7700bd9703 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -240,8 +240,6 @@ func TestProviderStateIsCleanedAfterConsumerChainIsStopped(t *testing.T, ctx sdk require.False(t, found) acks := providerKeeper.GetSlashAcks(ctx, expectedChainID) require.Empty(t, acks) - _, found = providerKeeper.GetInitTimeoutTimestamp(ctx, expectedChainID) - require.False(t, found) // in case the chain was successfully stopped, it should not contain a Top N associated to it _, found = providerKeeper.GetTopN(ctx, expectedChainID) From fbde460c3c2f88bae6aa100ac24db8bda1f5d848 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Wed, 3 Jul 2024 15:31:15 +0200 Subject: [PATCH 56/81] Update x/ccv/provider/types/keys.go Co-authored-by: insumity --- x/ccv/provider/types/keys.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 53a7d0fcad..34dc64e5ab 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -402,7 +402,7 @@ func EquivocationEvidenceMinHeightKey(consumerChainID string) []byte { // ConsumerAddrsToPruneV2Key returns the key under which the consumer validators // addresses that need to be pruned are stored. These are stored as a -// ts -> (consumer_address1, consumer_address2, ...) mapping, where ts is the +// (chainID, ts) -> (consumer_address1, consumer_address2, ...) mapping, where ts is the // timestamp at which the consumer validators addresses can be pruned. func ConsumerAddrsToPruneV2Key(chainID string, pruneTs time.Time) []byte { return ChainIdAndTsKey(ConsumerAddrsToPruneV2BytePrefix, chainID, pruneTs) From 59d593f37a07e27e29ec45d647ba709404b8e2c8 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 3 Jul 2024 15:41:53 +0200 Subject: [PATCH 57/81] apply review suggestions --- x/ccv/provider/keeper/key_assignment.go | 2 +- x/ccv/provider/migrations/vX/migrations.go | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index e3efbebed4..2675d84267 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -295,7 +295,7 @@ func (k Keeper) GetConsumerAddrsToPrune( // Note that the list of all consumer addresses is stored under keys with the following format: // ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp // Thus, this method returns all the consumer addresses stored under keys in the following range: -// (ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID) ... (ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | ts) +// (ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | ts') where ts' <= ts func (k Keeper) ConsumeConsumerAddrsToPrune( ctx sdk.Context, chainID string, diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go index 17298b8de9..1837ff3aae 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -36,14 +36,21 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(providertypes.ConsumerAddrsToPruneBytePrefix, iterator.Key()) if err != nil { pk.Logger(ctx).Error("ParseChainIdAndUintIdKey failed", "key", string(iterator.Key())) + continue } // use the VscSendTimestamp index to compute the timestamp after which this consumer address can be pruned vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(providertypes.VscSendTimestampBytePrefix, chainID, vscID) - sentTime := time.Time{} + var sentTime time.Time if timeBz := store.Get(vscSendTimestampKey); timeBz != nil { if ts, err := sdk.ParseTimeBytes(timeBz); err == nil { sentTime = ts + } else { + pk.Logger(ctx).Error("MigrateConsumerAddrsToPrune failed parsing VSC send timestamp key", "error", err.Error()) + continue } + } else { + pk.Logger(ctx).Error("MigrateConsumerAddrsToPrune cannot find VSC send timestamp", "error", err.Error()) + continue } pruneAfterTs := sentTime.Add(sk.UnbondingTime(ctx)) @@ -51,6 +58,7 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p err = addrs.Unmarshal(iterator.Value()) if err != nil { pk.Logger(ctx).Error("MigrateConsumerAddrsToPrune failed unmarshaling data from store", "key", string(iterator.Value())) + continue } for _, addr := range addrs.Addresses { From 37b912f0ffcdd609fc45070c88c5f9010bb924b8 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 3 Jul 2024 15:58:40 +0200 Subject: [PATCH 58/81] uncomment TestSimulatedAssignmentsAndUpdateApplication --- x/ccv/provider/keeper/key_assignment_test.go | 595 ++++++++++--------- 1 file changed, 298 insertions(+), 297 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index b341946bb9..b2138ff53f 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -10,6 +10,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -662,300 +663,300 @@ type Assignment struct { ck tmprotocrypto.PublicKey } -// // TestSimulatedAssignmentsAndUpdateApplication tests a series -// // of simulated scenarios where random key assignments and validator -// // set updates are generated. -// func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { -// CHAINID := ChainID -// // The number of full test executions to run -// NUM_EXECUTIONS := 100 -// // Each test execution mimics the adding of a consumer chain and the -// // assignments and power updates of several blocks -// NUM_BLOCKS_PER_EXECUTION := 40 -// // The number of validators to be simulated -// NUM_VALIDATORS := 4 -// // The number of keys that can be used. Keeping this number small is -// // good because it increases the chance that different assignments will -// // use the same keys, which is something we want to test. -// NUM_ASSIGNABLE_KEYS := 12 -// // The maximum number of key assignment actions to simulate in each -// // simulated block, and before the consumer chain is registered. -// NUM_ASSIGNMENTS_PER_BLOCK_MAX := 8 - -// // Create some identities for the simulated provider validators to use -// providerIDS := []*cryptotestutil.CryptoIdentity{} -// // Create some identities which the provider validators can assign to the consumer chain -// assignableIDS := []*cryptotestutil.CryptoIdentity{} -// for i := 0; i < NUM_VALIDATORS; i++ { -// providerIDS = append(providerIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) -// } -// // Notice that the assignable identities include the provider identities -// for i := 0; i < NUM_VALIDATORS+NUM_ASSIGNABLE_KEYS; i++ { -// assignableIDS = append(assignableIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) -// } - -// seed := time.Now().UnixNano() -// rng := rand.New(rand.NewSource(seed)) - -// // Helper: simulates creation of staking module EndBlock updates. -// getStakingUpdates := func() (ret []abci.ValidatorUpdate) { -// // Get a random set of validators to update. It is important to test subsets of all validators. -// validators := rng.Perm(len(providerIDS))[0:rng.Intn(len(providerIDS)+1)] -// for _, i := range validators { -// // Power 0, 1, or 2 represents -// // deletion, update (from 0 or 2), update (from 0 or 1) -// power := rng.Intn(3) -// ret = append(ret, abci.ValidatorUpdate{ -// PubKey: providerIDS[i].TMProtoCryptoPublicKey(), -// Power: int64(power), -// }) -// } -// return -// } - -// // Helper: simulates creation of assignment tx's to be done. -// getAssignments := func() (ret []Assignment) { -// for i, numAssignments := 0, rng.Intn(NUM_ASSIGNMENTS_PER_BLOCK_MAX); i < numAssignments; i++ { -// randomIxP := rng.Intn(len(providerIDS)) -// randomIxC := rng.Intn(len(assignableIDS)) -// ret = append(ret, Assignment{ -// val: providerIDS[randomIxP].SDKStakingValidator(), -// ck: assignableIDS[randomIxC].TMProtoCryptoPublicKey(), -// }) -// } -// return -// } - -// // Run a randomly simulated execution and test that desired properties hold -// // Helper: run a randomly simulated scenario where a consumer chain is added -// // (after key assignment actions are done), followed by a series of validator power updates -// // and key assignments tx's. For each simulated 'block', the validator set replication -// // properties and the pruning property are checked. -// runRandomExecution := func() { -// k, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - -// // Create validator sets for the provider and consumer. These are used to check the validator set -// // replication property. -// providerValset := CreateValSet(providerIDS) -// // NOTE: consumer must have space for provider identities because default key assignments are to provider keys -// consumerValset := CreateValSet(assignableIDS) -// // For each validator on the consumer, record the corresponding provider -// // address as looked up on the provider using GetProviderAddrFromConsumerAddr -// // at a given vscid. -// // consumer consAddr -> vscid -> provider consAddr -// historicSlashQueries := map[string]map[uint64]string{} - -// // Sanity check that the validator set update is initialised to 0, for clarity. -// require.Equal(t, k.GetValidatorSetUpdateId(ctx), uint64(0)) - -// // Mock calls to GetLastValidatorPower to return directly from the providerValset -// mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower( -// gomock.Any(), -// gomock.Any(), -// ).DoAndReturn(func(_ interface{}, valAddr sdk.ValAddress) int64 { -// // When the mocked method is called, locate the appropriate validator -// // in the provider valset and return its power. -// for i, id := range providerIDS { -// if id.SDKStakingValidator().GetOperator().Equals(valAddr) { -// return providerValset.power[i] -// } -// } -// panic("must find validator") -// // This can be called 0 or more times per block depending on the random -// // assignments that occur -// }).AnyTimes() - -// // This implements the assumption that all the provider IDS are added -// // to the system at the beginning of the simulation. -// mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( -// gomock.Any(), -// gomock.Any(), -// ).DoAndReturn(func(_ interface{}, consP sdk.ConsAddress) (stakingtypes.Validator, bool) { -// for _, id := range providerIDS { -// if id.SDKValConsAddress().Equals(consP) { -// return id.SDKStakingValidator(), true -// } -// } -// return stakingtypes.Validator{}, false -// }).AnyTimes() - -// // Helper: apply some updates to both the provider and consumer valsets -// // and increment the provider vscid. -// applyUpdatesAndIncrementVSCID := func(updates []abci.ValidatorUpdate) { -// providerValset.apply(updates) - -// var bondedValidators []stakingtypes.Validator -// for _, v := range providerValset.identities { -// pkAny, _ := codectypes.NewAnyWithValue(v.ConsensusSDKPubKey()) - -// bondedValidators = append(bondedValidators, stakingtypes.Validator{ -// OperatorAddress: v.SDKValOpAddress().String(), -// ConsensusPubkey: pkAny, -// }) -// } - -// nextValidators := k.FilterValidators(ctx, CHAINID, bondedValidators, -// func(providerAddr types.ProviderConsAddress) bool { -// return true -// }) -// updates = providerkeeper.DiffValidators(k.GetConsumerValSet(ctx, CHAINID), nextValidators) -// k.SetConsumerValSet(ctx, CHAINID, nextValidators) - -// consumerValset.apply(updates) -// // Simulate the VSCID update in EndBlock -// k.IncrementValidatorSetUpdateId(ctx) -// } - -// // Helper: apply some key assignment transactions to the system -// applyAssignments := func(assignments []Assignment) { -// for _, a := range assignments { -// // ignore err return, it can be possible for an error to occur -// _ = k.AssignConsumerKey(ctx, CHAINID, a.val, a.ck) -// } -// } - -// // The consumer chain has not yet been registered -// // Apply some randomly generated key assignments -// assignments := getAssignments() -// applyAssignments(assignments) -// // And generate a random provider valset which, in the real system, will -// // be put into the consumer genesis. -// stakingUpdates := getStakingUpdates() - -// applyUpdatesAndIncrementVSCID(stakingUpdates) - -// // Register the consumer chain -// k.SetConsumerClientId(ctx, CHAINID, "") - -// // Analogous to the last vscid received from the consumer in a maturity -// // Used to check the correct pruning property -// greatestPrunedVSCID := -1 - -// // Simulate a number of 'blocks' -// // Each block consists of a number of random key assignment tx's -// // and a random set of validator power updates -// for block := 0; block < NUM_BLOCKS_PER_EXECUTION; block++ { - -// stakingUpdates = getStakingUpdates() -// assignments = getAssignments() - -// // Generate and apply assignments and power updates -// applyAssignments(assignments) -// applyUpdatesAndIncrementVSCID(stakingUpdates) - -// // Randomly fast forward the greatest pruned VSCID. This simulates -// // delivery of maturity packets from the consumer chain. -// prunedVscid := greatestPrunedVSCID + -// // +1 and -1 because id was incremented (-1), (+1) to make upper bound inclusive -// rng.Intn(int(k.GetValidatorSetUpdateId(ctx))+1-1-greatestPrunedVSCID) -// k.PruneKeyAssignments(ctx, CHAINID, uint64(prunedVscid)) -// greatestPrunedVSCID = prunedVscid - -// /* - -// Property: Validator Set Replication -// Each validator set on the provider must be replicated on the consumer. -// The property in the real system is somewhat weaker, because the consumer chain can -// forward updates to tendermint in batches. -// (See https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/system_model_and_properties.md#system-properties) -// We test the stronger property, because we abstract over implementation of the consumer -// chain. The stronger property implies the weaker property. - -// */ - -// // Check validator set replication forward direction -// for i, idP := range providerValset.identities { -// // For each active validator on the provider chain -// if 0 < providerValset.power[i] { -// // Get the assigned key -// ck, found := k.GetValidatorConsumerPubKey(ctx, CHAINID, idP.ProviderConsAddress()) -// if !found { -// // Use default if unassigned -// ck = idP.TMProtoCryptoPublicKey() -// } -// consC, err := ccvtypes.TMCryptoPublicKeyToConsAddr(ck) -// require.NoError(t, err) -// // Find the corresponding consumer validator (must always be found) -// for j, idC := range consumerValset.identities { -// if consC.Equals(idC.SDKValConsAddress()) { -// // Ensure powers are the same -// require.Equal(t, providerValset.power[i], consumerValset.power[j]) -// } -// } -// } -// } -// // Check validator set replication backward direction -// for i := range consumerValset.identities { -// // For each active validator on the consumer chain -// consC := consumerValset.identities[i].ConsumerConsAddress() -// if 0 < consumerValset.power[i] { -// // Get the provider who assigned the key -// consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) -// // Find the corresponding provider validator (must always be found) -// for j, idP := range providerValset.identities { -// if idP.SDKValConsAddress().Equals(consP.ToSdkConsAddr()) { -// // Ensure powers are the same -// require.Equal(t, providerValset.power[j], consumerValset.power[i]) -// } -// } -// } -// } - -// /* -// Property: Pruning (bounded storage) -// Check that all keys have been or will eventually be pruned. -// */ - -// require.True(t, checkCorrectPruningProperty(ctx, k, CHAINID)) - -// /* -// Property: Correct Consumer Initiated Slash Lookup - -// Check that since the last pruning, it has never been possible to query -// two different provider addresses from the same consumer address. -// We know that the queried provider address was correct at least once, -// from checking the validator set replication property. These two facts -// together guarantee that the slash lookup is always correct. -// */ - -// // Build up the historicSlashQueries data structure -// for i := range consumerValset.identities { -// // For each active validator on the consumer chain -// consC := consumerValset.identities[i].ConsumerConsAddress() -// if 0 < consumerValset.power[i] { -// // Get the provider who assigned the key -// consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) - -// if _, found := historicSlashQueries[consC.String()]; !found { -// historicSlashQueries[consC.String()] = map[uint64]string{} -// } - -// vscid := k.GetValidatorSetUpdateId(ctx) - 1 // -1 since it was incremented before -// // Record the slash query result obtained at this block -// historicSlashQueries[consC.String()][vscid] = consP.String() -// } -// } - -// // Check that, for each address known the consumer at some block -// // with vscid st. greatestPrunedVSCID < vscid, there were never -// // conflicting slash query results. -// for _, vscidToConsP := range historicSlashQueries { -// seen := map[string]bool{} -// for vscid, consP := range vscidToConsP { -// if uint64(greatestPrunedVSCID) < vscid { -// // The provider would have returned -// seen[consP] = true -// } -// } -// // No conflicts. -// require.True(t, len(seen) < 2) -// } - -// } -// ctrl.Finish() -// } - -// for i := 0; i < NUM_EXECUTIONS; i++ { -// runRandomExecution() -// } -// } +// TestSimulatedAssignmentsAndUpdateApplication tests a series +// of simulated scenarios where random key assignments and validator +// set updates are generated. +func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { + CHAINID := ChainID + // The number of full test executions to run + NUM_EXECUTIONS := 100 + // Each test execution mimics the adding of a consumer chain and the + // assignments and power updates of several blocks + NUM_BLOCKS_PER_EXECUTION := 40 + // The number of validators to be simulated + NUM_VALIDATORS := 4 + // The number of keys that can be used. Keeping this number small is + // good because it increases the chance that different assignments will + // use the same keys, which is something we want to test. + NUM_ASSIGNABLE_KEYS := 12 + // The maximum number of key assignment actions to simulate in each + // simulated block, and before the consumer chain is registered. + NUM_ASSIGNMENTS_PER_BLOCK_MAX := 8 + + // Create some identities for the simulated provider validators to use + providerIDS := []*cryptotestutil.CryptoIdentity{} + // Create some identities which the provider validators can assign to the consumer chain + assignableIDS := []*cryptotestutil.CryptoIdentity{} + for i := 0; i < NUM_VALIDATORS; i++ { + providerIDS = append(providerIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) + } + // Notice that the assignable identities include the provider identities + for i := 0; i < NUM_VALIDATORS+NUM_ASSIGNABLE_KEYS; i++ { + assignableIDS = append(assignableIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) + } + + seed := time.Now().UnixNano() + rng := rand.New(rand.NewSource(seed)) + + // Helper: simulates creation of staking module EndBlock updates. + getStakingUpdates := func() (ret []abci.ValidatorUpdate) { + // Get a random set of validators to update. It is important to test subsets of all validators. + validators := rng.Perm(len(providerIDS))[0:rng.Intn(len(providerIDS)+1)] + for _, i := range validators { + // Power 0, 1, or 2 represents + // deletion, update (from 0 or 2), update (from 0 or 1) + power := rng.Intn(3) + ret = append(ret, abci.ValidatorUpdate{ + PubKey: providerIDS[i].TMProtoCryptoPublicKey(), + Power: int64(power), + }) + } + return + } + + // Helper: simulates creation of assignment tx's to be done. + getAssignments := func() (ret []Assignment) { + for i, numAssignments := 0, rng.Intn(NUM_ASSIGNMENTS_PER_BLOCK_MAX); i < numAssignments; i++ { + randomIxP := rng.Intn(len(providerIDS)) + randomIxC := rng.Intn(len(assignableIDS)) + ret = append(ret, Assignment{ + val: providerIDS[randomIxP].SDKStakingValidator(), + ck: assignableIDS[randomIxC].TMProtoCryptoPublicKey(), + }) + } + return + } + + // Run a randomly simulated execution and test that desired properties hold + // Helper: run a randomly simulated scenario where a consumer chain is added + // (after key assignment actions are done), followed by a series of validator power updates + // and key assignments tx's. For each simulated 'block', the validator set replication + // properties and the pruning property are checked. + runRandomExecution := func() { + k, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + + // Create validator sets for the provider and consumer. These are used to check the validator set + // replication property. + providerValset := CreateValSet(providerIDS) + // NOTE: consumer must have space for provider identities because default key assignments are to provider keys + consumerValset := CreateValSet(assignableIDS) + // For each validator on the consumer, record the corresponding provider + // address as looked up on the provider using GetProviderAddrFromConsumerAddr + // at a given vscid. + // consumer consAddr -> vscid -> provider consAddr + historicSlashQueries := map[string]map[uint64]string{} + + // Sanity check that the validator set update is initialised to 0, for clarity. + require.Equal(t, k.GetValidatorSetUpdateId(ctx), uint64(0)) + + // Mock calls to GetLastValidatorPower to return directly from the providerValset + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower( + gomock.Any(), + gomock.Any(), + ).DoAndReturn(func(_ interface{}, valAddr sdk.ValAddress) int64 { + // When the mocked method is called, locate the appropriate validator + // in the provider valset and return its power. + for i, id := range providerIDS { + if id.SDKStakingValidator().GetOperator().Equals(valAddr) { + return providerValset.power[i] + } + } + panic("must find validator") + // This can be called 0 or more times per block depending on the random + // assignments that occur + }).AnyTimes() + + // This implements the assumption that all the provider IDS are added + // to the system at the beginning of the simulation. + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( + gomock.Any(), + gomock.Any(), + ).DoAndReturn(func(_ interface{}, consP sdk.ConsAddress) (stakingtypes.Validator, bool) { + for _, id := range providerIDS { + if id.SDKValConsAddress().Equals(consP) { + return id.SDKStakingValidator(), true + } + } + return stakingtypes.Validator{}, false + }).AnyTimes() + + // Helper: apply some updates to both the provider and consumer valsets + // and increment the provider vscid. + applyUpdatesAndIncrementVSCID := func(updates []abci.ValidatorUpdate) { + providerValset.apply(updates) + + var bondedValidators []stakingtypes.Validator + for _, v := range providerValset.identities { + pkAny, _ := codectypes.NewAnyWithValue(v.ConsensusSDKPubKey()) + + bondedValidators = append(bondedValidators, stakingtypes.Validator{ + OperatorAddress: v.SDKValOpAddress().String(), + ConsensusPubkey: pkAny, + }) + } + + nextValidators := k.FilterValidators(ctx, CHAINID, bondedValidators, + func(providerAddr types.ProviderConsAddress) bool { + return true + }) + updates = providerkeeper.DiffValidators(k.GetConsumerValSet(ctx, CHAINID), nextValidators) + k.SetConsumerValSet(ctx, CHAINID, nextValidators) + + consumerValset.apply(updates) + // Simulate the VSCID update in EndBlock + k.IncrementValidatorSetUpdateId(ctx) + } + + // Helper: apply some key assignment transactions to the system + applyAssignments := func(assignments []Assignment) { + for _, a := range assignments { + // ignore err return, it can be possible for an error to occur + _ = k.AssignConsumerKey(ctx, CHAINID, a.val, a.ck) + } + } + + // The consumer chain has not yet been registered + // Apply some randomly generated key assignments + assignments := getAssignments() + applyAssignments(assignments) + // And generate a random provider valset which, in the real system, will + // be put into the consumer genesis. + stakingUpdates := getStakingUpdates() + + applyUpdatesAndIncrementVSCID(stakingUpdates) + + // Register the consumer chain + k.SetConsumerClientId(ctx, CHAINID, "") + + // Analogous to the last vscid received from the consumer in a maturity + // Used to check the correct pruning property + greatestPrunedVSCID := -1 + + // Simulate a number of 'blocks' + // Each block consists of a number of random key assignment tx's + // and a random set of validator power updates + for block := 0; block < NUM_BLOCKS_PER_EXECUTION; block++ { + + stakingUpdates = getStakingUpdates() + assignments = getAssignments() + + // Generate and apply assignments and power updates + applyAssignments(assignments) + applyUpdatesAndIncrementVSCID(stakingUpdates) + + // Randomly fast forward the greatest pruned VSCID. This simulates + // delivery of maturity packets from the consumer chain. + prunedVscid := greatestPrunedVSCID + + // +1 and -1 because id was incremented (-1), (+1) to make upper bound inclusive + rng.Intn(int(k.GetValidatorSetUpdateId(ctx))+1-1-greatestPrunedVSCID) + k.PruneKeyAssignments(ctx, CHAINID, uint64(prunedVscid)) + greatestPrunedVSCID = prunedVscid + + /* + + Property: Validator Set Replication + Each validator set on the provider must be replicated on the consumer. + The property in the real system is somewhat weaker, because the consumer chain can + forward updates to tendermint in batches. + (See https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/system_model_and_properties.md#system-properties) + We test the stronger property, because we abstract over implementation of the consumer + chain. The stronger property implies the weaker property. + + */ + + // Check validator set replication forward direction + for i, idP := range providerValset.identities { + // For each active validator on the provider chain + if 0 < providerValset.power[i] { + // Get the assigned key + ck, found := k.GetValidatorConsumerPubKey(ctx, CHAINID, idP.ProviderConsAddress()) + if !found { + // Use default if unassigned + ck = idP.TMProtoCryptoPublicKey() + } + consC, err := ccvtypes.TMCryptoPublicKeyToConsAddr(ck) + require.NoError(t, err) + // Find the corresponding consumer validator (must always be found) + for j, idC := range consumerValset.identities { + if consC.Equals(idC.SDKValConsAddress()) { + // Ensure powers are the same + require.Equal(t, providerValset.power[i], consumerValset.power[j]) + } + } + } + } + // Check validator set replication backward direction + for i := range consumerValset.identities { + // For each active validator on the consumer chain + consC := consumerValset.identities[i].ConsumerConsAddress() + if 0 < consumerValset.power[i] { + // Get the provider who assigned the key + consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) + // Find the corresponding provider validator (must always be found) + for j, idP := range providerValset.identities { + if idP.SDKValConsAddress().Equals(consP.ToSdkConsAddr()) { + // Ensure powers are the same + require.Equal(t, providerValset.power[j], consumerValset.power[i]) + } + } + } + } + + /* + Property: Pruning (bounded storage) + Check that all keys have been or will eventually be pruned. + */ + + require.True(t, checkCorrectPruningProperty(ctx, k, CHAINID)) + + /* + Property: Correct Consumer Initiated Slash Lookup + + Check that since the last pruning, it has never been possible to query + two different provider addresses from the same consumer address. + We know that the queried provider address was correct at least once, + from checking the validator set replication property. These two facts + together guarantee that the slash lookup is always correct. + */ + + // Build up the historicSlashQueries data structure + for i := range consumerValset.identities { + // For each active validator on the consumer chain + consC := consumerValset.identities[i].ConsumerConsAddress() + if 0 < consumerValset.power[i] { + // Get the provider who assigned the key + consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) + + if _, found := historicSlashQueries[consC.String()]; !found { + historicSlashQueries[consC.String()] = map[uint64]string{} + } + + vscid := k.GetValidatorSetUpdateId(ctx) - 1 // -1 since it was incremented before + // Record the slash query result obtained at this block + historicSlashQueries[consC.String()][vscid] = consP.String() + } + } + + // Check that, for each address known the consumer at some block + // with vscid st. greatestPrunedVSCID < vscid, there were never + // conflicting slash query results. + for _, vscidToConsP := range historicSlashQueries { + seen := map[string]bool{} + for vscid, consP := range vscidToConsP { + if uint64(greatestPrunedVSCID) < vscid { + // The provider would have returned + seen[consP] = true + } + } + // No conflicts. + require.True(t, len(seen) < 2) + } + + } + ctrl.Finish() + } + + for i := 0; i < NUM_EXECUTIONS; i++ { + runRandomExecution() + } +} From 459d6bf996a1ca1ada11cd71e492bec16808c2ab Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 5 Jul 2024 13:56:40 +0200 Subject: [PATCH 59/81] Fixed TestSimulatedAssignmentsAndUpdateApplication test --- x/ccv/provider/keeper/key_assignment_test.go | 78 ++++++++++---------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index b2138ff53f..62ca12daa5 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -300,10 +300,10 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { // consumer chain. See AppendConsumerAddrsToPrune for a formulation of the property. func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chainID string) bool { /* - For each consumer address cAddr in ValidatorByConsumerAddr, - - either there exists a provider address pAddr in ValidatorConsumerPubKey, - s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr - - or there exists a vscID in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(vscID) + For each consumer address cAddr in ValidatorByConsumerAddr, + - either there exists a provider address pAddr in ValidatorConsumerPubKey, + s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr + - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) */ willBePruned := map[string]bool{} for _, consAddrToPrune := range k.GetAllConsumerAddrsToPrune(ctx, chainID) { @@ -319,6 +319,7 @@ func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chain // Address will be pruned, everything is fine. continue } + // Try to find a validator who has this consumer address currently assigned isCurrentlyAssigned := false for _, valconsPubKey := range k.GetAllValidatorConsumerPubKeys(ctx, &valByConsAddr.ChainId) { @@ -740,11 +741,6 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { providerValset := CreateValSet(providerIDS) // NOTE: consumer must have space for provider identities because default key assignments are to provider keys consumerValset := CreateValSet(assignableIDS) - // For each validator on the consumer, record the corresponding provider - // address as looked up on the provider using GetProviderAddrFromConsumerAddr - // at a given vscid. - // consumer consAddr -> vscid -> provider consAddr - historicSlashQueries := map[string]map[uint64]string{} // Sanity check that the validator set update is initialised to 0, for clarity. require.Equal(t, k.GetValidatorSetUpdateId(ctx), uint64(0)) @@ -815,9 +811,14 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { } } + // Set the unbonding time to 60s so that a key is prunable after 60s + unbondingTimeInNs := time.Duration(60 * 1_000_000_000) // 60 seconds + mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeInNs).AnyTimes() + // The consumer chain has not yet been registered // Apply some randomly generated key assignments assignments := getAssignments() + applyAssignments(assignments) // And generate a random provider valset which, in the real system, will // be put into the consumer genesis. @@ -828,15 +829,15 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Register the consumer chain k.SetConsumerClientId(ctx, CHAINID, "") - // Analogous to the last vscid received from the consumer in a maturity - // Used to check the correct pruning property - greatestPrunedVSCID := -1 + // Set the greatest block time up to which keys have been pruned. At the beginning, no pruning has taken + // place, so we set `greatestPrunedBlockTime` to 0, and set the current block time to 1. + greatestPrunedBlockTime := int64(0) + ctx = ctx.WithBlockTime(time.Unix(0, 1)) // Simulate a number of 'blocks' // Each block consists of a number of random key assignment tx's // and a random set of validator power updates for block := 0; block < NUM_BLOCKS_PER_EXECUTION; block++ { - stakingUpdates = getStakingUpdates() assignments = getAssignments() @@ -844,13 +845,14 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { applyAssignments(assignments) applyUpdatesAndIncrementVSCID(stakingUpdates) - // Randomly fast forward the greatest pruned VSCID. This simulates - // delivery of maturity packets from the consumer chain. - prunedVscid := greatestPrunedVSCID + - // +1 and -1 because id was incremented (-1), (+1) to make upper bound inclusive - rng.Intn(int(k.GetValidatorSetUpdateId(ctx))+1-1-greatestPrunedVSCID) - k.PruneKeyAssignments(ctx, CHAINID, uint64(prunedVscid)) - greatestPrunedVSCID = prunedVscid + // prune all keys that can be pruned up to the current block time + greatestPrunedBlockTime = ctx.BlockTime().UnixNano() + k.PruneKeyAssignments(ctx, CHAINID) + + // Increase the block time by a small random amount up to UnbondingTime / 10. We do not increase the block time + // by UnbondingTime so that in the upcoming iteration of this `for` loop (i.e., new block), not all the keys + // previously (in this current block) set to be prunable are pruned. + ctx = ctx.WithBlockTime(time.Unix(0, ctx.BlockTime().UnixNano()+rng.Int63n(unbondingTimeInNs.Nanoseconds())/10)) /* @@ -906,20 +908,25 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { Property: Pruning (bounded storage) Check that all keys have been or will eventually be pruned. */ - require.True(t, checkCorrectPruningProperty(ctx, k, CHAINID)) /* Property: Correct Consumer Initiated Slash Lookup - Check that since the last pruning, it has never been possible to query - two different provider addresses from the same consumer address. + Check that since the last pruning took place, it has never been possible to have + two different provider addresses for the same consumer address. We know that the queried provider address was correct at least once, from checking the validator set replication property. These two facts together guarantee that the slash lookup is always correct. */ - // Build up the historicSlashQueries data structure + // For each validator on the consumer, record the corresponding provider + // address as looked up on the provider using `GetProviderAddrFromConsumerAddr` + // at a given block time. + // consumer consAddr -> block time -> provider consAddr + consumerAddrToBlockTimeToProviderAddr := map[string]map[uint64]string{} + + // Build up the consumerAddrToBlockTimeToProviderAddr data structure for i := range consumerValset.identities { // For each active validator on the consumer chain consC := consumerValset.identities[i].ConsumerConsAddress() @@ -927,28 +934,25 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Get the provider who assigned the key consP := k.GetProviderAddrFromConsumerAddr(ctx, CHAINID, consC) - if _, found := historicSlashQueries[consC.String()]; !found { - historicSlashQueries[consC.String()] = map[uint64]string{} + if _, found := consumerAddrToBlockTimeToProviderAddr[consC.String()]; !found { + consumerAddrToBlockTimeToProviderAddr[consC.String()] = map[uint64]string{} } - vscid := k.GetValidatorSetUpdateId(ctx) - 1 // -1 since it was incremented before - // Record the slash query result obtained at this block - historicSlashQueries[consC.String()][vscid] = consP.String() + consumerAddrToBlockTimeToProviderAddr[consC.String()][uint64(ctx.BlockTime().UnixNano())] = consP.String() } } - // Check that, for each address known the consumer at some block - // with vscid st. greatestPrunedVSCID < vscid, there were never - // conflicting slash query results. - for _, vscidToConsP := range historicSlashQueries { + // Check that, for each consumer address known at some block with blockTime st. greatestPrunedBlockTime < blockTime, + // there were never two providers with this consumer address. + for _, blockTimeToProviderAddr := range consumerAddrToBlockTimeToProviderAddr { seen := map[string]bool{} - for vscid, consP := range vscidToConsP { - if uint64(greatestPrunedVSCID) < vscid { - // The provider would have returned + for blockTime, consP := range blockTimeToProviderAddr { + if uint64(greatestPrunedBlockTime) < blockTime { seen[consP] = true } } - // No conflicts. + // Having len(seen) >= 2 implies that we had at least 2 different provider addresses that at some point + // had the exact same consumer address since the last pruning took place. This should not be possible! require.True(t, len(seen) < 2) } From 2827264d803765515bb12a9996028c9306d190eb Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 5 Jul 2024 14:04:32 +0200 Subject: [PATCH 60/81] formatting fix --- x/ccv/provider/keeper/key_assignment_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 62ca12daa5..eea2e457c7 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -300,10 +300,10 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { // consumer chain. See AppendConsumerAddrsToPrune for a formulation of the property. func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chainID string) bool { /* - For each consumer address cAddr in ValidatorByConsumerAddr, - - either there exists a provider address pAddr in ValidatorConsumerPubKey, - s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr - - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) + For each consumer address cAddr in ValidatorByConsumerAddr, + - either there exists a provider address pAddr in ValidatorConsumerPubKey, + s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr + - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) */ willBePruned := map[string]bool{} for _, consAddrToPrune := range k.GetAllConsumerAddrsToPrune(ctx, chainID) { From c7ddf84bfe889ba7315aedfeecc630ccf3f3d097 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 5 Jul 2024 16:14:31 +0200 Subject: [PATCH 61/81] fix error message --- x/ccv/provider/migrations/vX/migrations.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go index e51fd8bb86..153448477d 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -49,7 +49,11 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p continue } } else { - pk.Logger(ctx).Error("MigrateConsumerAddrsToPrune cannot find VSC send timestamp", "error", err.Error()) + pk.Logger(ctx).Error( + "MigrateConsumerAddrsToPrune cannot find VSC send timestamp", + "chainID", chainID, + "vscID", vscID, + ) continue } pruneAfterTs := sentTime.Add(sk.UnbondingTime(ctx)) From 99046b5cb07359e6319941d47e4e46d96b60ac5e Mon Sep 17 00:00:00 2001 From: mpoke Date: Mon, 15 Jul 2024 15:49:21 +0200 Subject: [PATCH 62/81] remove TestInitTimeout --- testutil/integration/debug_test.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/testutil/integration/debug_test.go b/testutil/integration/debug_test.go index db4392dab7..9542d4ecad 100644 --- a/testutil/integration/debug_test.go +++ b/testutil/integration/debug_test.go @@ -49,14 +49,6 @@ func findAndCallMethod(t *testing.T, suite any, methodName string) { method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) } -// -// Channel init tests -// - -func TestInitTimeout(t *testing.T) { - runCCVTestByName(t, "TestInitTimeout") -} - // // Consumer democracy tests // From 4eff896675b77bccd90c47f72d107d78aefa5b8a Mon Sep 17 00:00:00 2001 From: mpoke Date: Mon, 15 Jul 2024 15:58:29 +0200 Subject: [PATCH 63/81] remove init_timeout_period param --- .../ccv/provider/v1/provider.proto | 7 +- x/ccv/provider/keeper/params.go | 8 - x/ccv/provider/keeper/params_test.go | 1 - x/ccv/provider/keeper/proposal_test.go | 1 - x/ccv/provider/types/genesis_test.go | 37 +-- x/ccv/provider/types/params.go | 11 - x/ccv/provider/types/params_test.go | 23 +- x/ccv/provider/types/provider.pb.go | 291 +++++++----------- 8 files changed, 137 insertions(+), 242 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 1837754a6e..bf503a7e37 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -207,6 +207,9 @@ message GlobalSlashEntry { // Params defines the parameters for CCV Provider module message Params { + // Reserve 4th slot for removed init_timeout_period param + reserved 4; + // Reserve 5th slot for removed vsc_timeout_period param reserved 5; @@ -220,10 +223,6 @@ message Params { // Sent IBC packets will timeout after this duration google.protobuf.Duration ccv_timeout_period = 3 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; - // The channel initialization (IBC channel opening handshake) will timeout - // after this duration - google.protobuf.Duration init_timeout_period = 4 - [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; // The period for which the slash meter is replenished google.protobuf.Duration slash_meter_replenish_period = 6 diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 30bae78745..b6f001ecfd 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -33,13 +33,6 @@ func (k Keeper) GetCCVTimeoutPeriod(ctx sdk.Context) time.Duration { return p } -// GetInitTimeoutPeriod returns the init timeout period -func (k Keeper) GetInitTimeoutPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramSpace.Get(ctx, types.KeyInitTimeoutPeriod, &p) - return p -} - // GetSlashMeterReplenishPeriod returns the period in which: // Once the slash meter becomes not-full, the slash meter is replenished after this period. func (k Keeper) GetSlashMeterReplenishPeriod(ctx sdk.Context) time.Duration { @@ -79,7 +72,6 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { k.GetTemplateClient(ctx), k.GetTrustingPeriodFraction(ctx), k.GetCCVTimeoutPeriod(ctx), - k.GetInitTimeoutPeriod(ctx), k.GetSlashMeterReplenishPeriod(ctx), k.GetSlashMeterReplenishFraction(ctx), k.GetConsumerRewardDenomRegistrationFee(ctx), diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index 52d1cb7451..a58fac6726 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -40,7 +40,6 @@ func TestParams(t *testing.T) { ), "0.25", 7*24*time.Hour, - 5*time.Hour, time.Hour, "0.4", sdk.Coin{ diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 63c62baaee..642873dc39 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -831,7 +831,6 @@ func TestMakeConsumerGenesis(t *testing.T) { // They must be populated with reasonable values to satisfy SetParams though. TrustingPeriodFraction: providertypes.DefaultTrustingPeriodFraction, CcvTimeoutPeriod: ccvtypes.DefaultCCVTimeoutPeriod, - InitTimeoutPeriod: providertypes.DefaultInitTimeoutPeriod, SlashMeterReplenishPeriod: providertypes.DefaultSlashMeterReplenishPeriod, SlashMeterReplenishFraction: providertypes.DefaultSlashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: sdk.Coin{ diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 94b841e3e8..cf37bb7d26 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -71,7 +71,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -88,7 +88,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -105,7 +105,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -124,7 +124,6 @@ func TestValidateGenesisState(t *testing.T) { 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -146,7 +145,6 @@ func TestValidateGenesisState(t *testing.T) { time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), "0.0", // 0 trusting period fraction here ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -168,7 +166,6 @@ func TestValidateGenesisState(t *testing.T) { time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, 0, // 0 ccv timeout here - types.DefaultInitTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}, 600), @@ -178,28 +175,6 @@ func TestValidateGenesisState(t *testing.T) { ), false, }, - { - "invalid params, zero init timeout", - types.NewGenesisState( - 0, - nil, - []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, - types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, - time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, - ccv.DefaultCCVTimeoutPeriod, - 0, // 0 init timeout here - types.DefaultSlashMeterReplenishPeriod, - types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), - nil, - nil, - nil, - ), - false, - }, { "invalid params, zero slash meter replenish period", types.NewGenesisState( @@ -212,7 +187,6 @@ func TestValidateGenesisState(t *testing.T) { time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, 0, // 0 slash meter replenish period here types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -234,7 +208,6 @@ func TestValidateGenesisState(t *testing.T) { time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), @@ -393,7 +366,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -410,7 +383,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600), nil, nil, nil, diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 6fec18a30c..edba271dd5 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -23,9 +23,6 @@ const ( // as UnbondingPeriod * TrustingPeriodFraction DefaultTrustingPeriodFraction = "0.66" - // DefaultInitTimeoutPeriod defines the init timeout period - DefaultInitTimeoutPeriod = 7 * 24 * time.Hour - // DefaultSlashMeterReplenishPeriod defines the default period for which the slash gas meter is replenished DefaultSlashMeterReplenishPeriod = time.Hour @@ -44,7 +41,6 @@ const ( var ( KeyTemplateClient = []byte("TemplateClient") KeyTrustingPeriodFraction = []byte("TrustingPeriodFraction") - KeyInitTimeoutPeriod = []byte("InitTimeoutPeriod") KeySlashMeterReplenishPeriod = []byte("SlashMeterReplenishPeriod") KeySlashMeterReplenishFraction = []byte("SlashMeterReplenishFraction") KeyConsumerRewardDenomRegistrationFee = []byte("ConsumerRewardDenomRegistrationFee") @@ -61,7 +57,6 @@ func NewParams( cs *ibctmtypes.ClientState, trustingPeriodFraction string, ccvTimeoutPeriod time.Duration, - initTimeoutPeriod time.Duration, slashMeterReplenishPeriod time.Duration, slashMeterReplenishFraction string, consumerRewardDenomRegistrationFee sdk.Coin, @@ -71,7 +66,6 @@ func NewParams( TemplateClient: cs, TrustingPeriodFraction: trustingPeriodFraction, CcvTimeoutPeriod: ccvTimeoutPeriod, - InitTimeoutPeriod: initTimeoutPeriod, SlashMeterReplenishPeriod: slashMeterReplenishPeriod, SlashMeterReplenishFraction: slashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: consumerRewardDenomRegistrationFee, @@ -96,7 +90,6 @@ func DefaultParams() Params { ), DefaultTrustingPeriodFraction, ccvtypes.DefaultCCVTimeoutPeriod, - DefaultInitTimeoutPeriod, DefaultSlashMeterReplenishPeriod, DefaultSlashMeterReplenishFraction, // Defining this inline because it's not possible to define a constant of type sdk.Coin. @@ -123,9 +116,6 @@ func (p Params) Validate() error { if err := ccvtypes.ValidateDuration(p.CcvTimeoutPeriod); err != nil { return fmt.Errorf("ccv timeout period is invalid: %s", err) } - if err := ccvtypes.ValidateDuration(p.InitTimeoutPeriod); err != nil { - return fmt.Errorf("init timeout period is invalid: %s", err) - } if err := ccvtypes.ValidateDuration(p.SlashMeterReplenishPeriod); err != nil { return fmt.Errorf("slash meter replenish period is invalid: %s", err) } @@ -147,7 +137,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyTemplateClient, p.TemplateClient, ValidateTemplateClient), paramtypes.NewParamSetPair(KeyTrustingPeriodFraction, p.TrustingPeriodFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(ccvtypes.KeyCCVTimeoutPeriod, p.CcvTimeoutPeriod, ccvtypes.ValidateDuration), - paramtypes.NewParamSetPair(KeyInitTimeoutPeriod, p.InitTimeoutPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishPeriod, p.SlashMeterReplenishPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, ValidateCoin), diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 72a52bb1d5..956715c2a1 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -24,36 +24,33 @@ func TestValidateParams(t *testing.T) { {"custom valid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, + "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, {"custom invalid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"blank client", types.NewParams(&ibctmtypes.ClientState{}, - "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, - {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + {"nil client", types.NewParams(nil, "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, // Check if "0.00" is valid or if a zero dec TrustFraction needs to return an error {"0 trusting period fraction", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.00", time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, + "0.00", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, {"0 ccv timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, - {"0 init timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, - time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"0 slash meter replenish period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"slash meter replenish fraction over 1", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"invalid consumer reward denom registration fee denom", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), false}, {"invalid consumer reward denom registration fee amount", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}, 1000), false}, } for _, tc := range testCases { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index c55e6766e4..3a6b9f2717 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -575,9 +575,6 @@ type Params struct { TrustingPeriodFraction string `protobuf:"bytes,2,opt,name=trusting_period_fraction,json=trustingPeriodFraction,proto3" json:"trusting_period_fraction,omitempty"` // Sent IBC packets will timeout after this duration CcvTimeoutPeriod time.Duration `protobuf:"bytes,3,opt,name=ccv_timeout_period,json=ccvTimeoutPeriod,proto3,stdduration" json:"ccv_timeout_period"` - // The channel initialization (IBC channel opening handshake) will timeout - // after this duration - InitTimeoutPeriod time.Duration `protobuf:"bytes,4,opt,name=init_timeout_period,json=initTimeoutPeriod,proto3,stdduration" json:"init_timeout_period"` // The period for which the slash meter is replenished SlashMeterReplenishPeriod time.Duration `protobuf:"bytes,6,opt,name=slash_meter_replenish_period,json=slashMeterReplenishPeriod,proto3,stdduration" json:"slash_meter_replenish_period"` // The fraction of total voting power that is replenished to the slash meter @@ -644,13 +641,6 @@ func (m *Params) GetCcvTimeoutPeriod() time.Duration { return 0 } -func (m *Params) GetInitTimeoutPeriod() time.Duration { - if m != nil { - return m.InitTimeoutPeriod - } - return 0 -} - func (m *Params) GetSlashMeterReplenishPeriod() time.Duration { if m != nil { return m.SlashMeterReplenishPeriod @@ -1402,120 +1392,120 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1802 bytes of a gzipped FileDescriptorProto + // 1793 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xed, 0x95, 0xaa, 0x92, 0xf4, 0xa6, 0x09, - 0xd4, 0xb8, 0xde, 0x8d, 0x94, 0x1e, 0x0c, 0xa3, 0x81, 0x21, 0x51, 0x4e, 0x6c, 0x2b, 0x71, 0xd8, - 0x15, 0xe1, 0x00, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, - 0x79, 0xe9, 0xb9, 0x87, 0x16, 0x48, 0x2f, 0x45, 0xd0, 0x43, 0x1b, 0x14, 0x28, 0x50, 0xf4, 0xd2, - 0xfe, 0x19, 0xb9, 0x14, 0xc8, 0xb1, 0xa7, 0xa4, 0xb0, 0x0f, 0x3d, 0xf4, 0x9f, 0x28, 0x66, 0xf6, - 0x93, 0xfa, 0x70, 0x69, 0x24, 0xb9, 0x48, 0xbb, 0x6f, 0xde, 0xfb, 0xcd, 0x9b, 0x37, 0xef, 0xbd, - 0xdf, 0xe3, 0x82, 0x03, 0x1a, 0x4a, 0xc2, 0xf1, 0x10, 0xd1, 0xd0, 0x13, 0x04, 0x8f, 0x39, 0x95, - 0x13, 0x07, 0xe3, 0xd8, 0x89, 0x38, 0x8b, 0xa9, 0x4f, 0xb8, 0x13, 0xef, 0xe7, 0xcf, 0x76, 0xc4, - 0x99, 0x64, 0xf0, 0x8d, 0x2b, 0x6c, 0x6c, 0x8c, 0x63, 0x3b, 0xd7, 0x8b, 0xf7, 0x77, 0xde, 0xbc, - 0x0e, 0x38, 0xde, 0x77, 0xce, 0x29, 0x27, 0x09, 0xd6, 0xce, 0xd6, 0x80, 0x0d, 0x98, 0x7e, 0x74, - 0xd4, 0x53, 0x2a, 0x6d, 0x0d, 0x18, 0x1b, 0x04, 0xc4, 0xd1, 0x6f, 0xfd, 0xf1, 0x33, 0x47, 0xd2, - 0x11, 0x11, 0x12, 0x8d, 0xa2, 0x54, 0xa1, 0x79, 0x51, 0xc1, 0x1f, 0x73, 0x24, 0x29, 0x0b, 0x33, - 0x00, 0xda, 0xc7, 0x0e, 0x66, 0x9c, 0x38, 0x38, 0xa0, 0x24, 0x94, 0x6a, 0xd7, 0xe4, 0x29, 0x55, - 0x70, 0x94, 0x42, 0x40, 0x07, 0x43, 0x99, 0x88, 0x85, 0x23, 0x49, 0xe8, 0x13, 0x3e, 0xa2, 0x89, - 0x72, 0xf1, 0x96, 0x1a, 0xec, 0x96, 0xd6, 0x31, 0x9f, 0x44, 0x92, 0x39, 0x67, 0x64, 0x22, 0xd2, - 0xd5, 0xb7, 0x30, 0x13, 0x23, 0x26, 0x1c, 0xa2, 0xce, 0x1f, 0x62, 0xe2, 0xc4, 0xfb, 0x7d, 0x22, - 0xd1, 0x7e, 0x2e, 0xc8, 0xfc, 0x4e, 0xf5, 0xfa, 0x48, 0x14, 0x3a, 0x98, 0xd1, 0xcc, 0xef, 0x0d, - 0x34, 0xa2, 0x21, 0x73, 0xf4, 0xdf, 0x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0x12, 0xf0, 0x14, 0xac, 0x49, 0x32, + 0x8a, 0x02, 0x24, 0x89, 0x97, 0x50, 0x73, 0x7a, 0xd2, 0xdb, 0x9a, 0xb2, 0xcb, 0xb7, 0x1c, 0xbb, + 0x74, 0xaf, 0x89, 0xf7, 0xec, 0xae, 0x96, 0x3e, 0x91, 0x48, 0x12, 0x77, 0x35, 0xc3, 0x48, 0x84, + 0xf0, 0x2e, 0x30, 0x25, 0x1f, 0x0b, 0x59, 0x90, 0x66, 0xc1, 0x16, 0x49, 0x2e, 0x6f, 0x64, 0xeb, + 0x09, 0xcf, 0xe4, 0x2c, 0x71, 0x35, 0x3f, 0x56, 0xbe, 0x09, 0x3f, 0xfa, 0x60, 0x47, 0xa8, 0xa4, + 0x7a, 0x23, 0x22, 0x35, 0x8b, 0x45, 0x01, 0x09, 0xa9, 0x18, 0x66, 0xe0, 0x8b, 0xb3, 0x83, 0x6f, + 0x69, 0xa0, 0x8f, 0x14, 0x8e, 0x9b, 0xc1, 0xa4, 0xbb, 0x74, 0x41, 0xeb, 0xea, 0x5d, 0xf2, 0x83, + 0x2f, 0xe9, 0x83, 0x7f, 0xff, 0x0a, 0x88, 0xfc, 0xf4, 0x02, 0xbc, 0x55, 0x62, 0x5b, 0xd5, 0x2d, + 0x9e, 0x2e, 0x54, 0x8f, 0x93, 0x81, 0xa2, 0x24, 0x94, 0x10, 0x2f, 0x21, 0xf9, 0x8d, 0x21, 0xed, + 0x4a, 0x75, 0x27, 0xcc, 0x3b, 0xb2, 0xcb, 0x68, 0x98, 0x5e, 0xab, 0xac, 0x82, 0x94, 0xf3, 0xde, + 0x73, 0x4b, 0x58, 0xef, 0x13, 0xa2, 0xba, 0xa4, 0x44, 0xcc, 0x24, 0x62, 0x78, 0xa8, 0x2f, 0x0e, + 0x15, 0x77, 0x35, 0x27, 0xe1, 0x07, 0x4a, 0x7a, 0x5c, 0xad, 0x55, 0x9b, 0x0b, 0xc7, 0xd5, 0xda, + 0x42, 0x73, 0xf1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, 0x00, 0xff, 0xff, 0x17, 0x49, 0x68, 0xb4, 0x6d, 0x12, 0x00, + 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2018,21 +2008,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintProvider(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x32 - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) if err10 != nil { return 0, err10 } i -= n10 i = encodeVarintProvider(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x22 - n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) - if err11 != nil { - return 0, err11 - } - i -= n11 - i = encodeVarintProvider(dAtA, i, uint64(n11)) - i-- dAtA[i] = 0x1a if len(m.TrustingPeriodFraction) > 0 { i -= len(m.TrustingPeriodFraction) @@ -2475,12 +2457,12 @@ func (m *ConsumerAddrsToPruneV2) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x1a } - n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) - if err16 != nil { - return 0, err16 + n15, err15 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) + if err15 != nil { + return 0, err15 } - i -= n16 - i = encodeVarintProvider(dAtA, i, uint64(n16)) + i -= n15 + i = encodeVarintProvider(dAtA, i, uint64(n15)) i-- dAtA[i] = 0x12 if len(m.ChainId) > 0 { @@ -2817,8 +2799,6 @@ func (m *Params) Size() (n int) { } l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod) n += 1 + l + sovProvider(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.InitTimeoutPeriod) - n += 1 + l + sovProvider(uint64(l)) l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.SlashMeterReplenishPeriod) n += 1 + l + sovProvider(uint64(l)) l = len(m.SlashMeterReplenishFraction) @@ -4735,39 +4715,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.InitTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlashMeterReplenishPeriod", wireType) From 4672cbf74e1ffdd6fc0ee80c4b1cb9e07d834eae Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 16 Jul 2024 20:18:29 +0200 Subject: [PATCH 64/81] fix migration and tests --- tests/integration/slashing.go | 4 +- x/ccv/provider/keeper/keeper.go | 9 ++ x/ccv/provider/keeper/key_assignment_test.go | 2 +- x/ccv/provider/migrations/migrator.go | 21 ++-- .../provider/migrations/v3/migration_test.go | 117 ------------------ x/ccv/provider/migrations/v3/migrations.go | 25 ---- .../provider/migrations/v4/migration_test.go | 27 ---- x/ccv/provider/migrations/v4/migrations.go | 18 --- .../provider/migrations/v5/migration_test.go | 30 ----- x/ccv/provider/migrations/v5/migrations.go | 21 ---- .../provider/migrations/v6/migration_test.go | 27 ---- x/ccv/provider/migrations/v6/migrations.go | 47 ------- x/ccv/provider/migrations/v7/legacy_params.go | 99 --------------- x/ccv/provider/migrations/v7/migrations.go | 21 ---- .../provider/migrations/v7/migrations_test.go | 56 --------- .../migrations/{vX => v8}/migrations.go | 30 +++-- x/ccv/provider/module.go | 2 +- x/ccv/provider/types/genesis_test.go | 2 +- 18 files changed, 45 insertions(+), 513 deletions(-) delete mode 100644 x/ccv/provider/migrations/v3/migration_test.go delete mode 100644 x/ccv/provider/migrations/v3/migrations.go delete mode 100644 x/ccv/provider/migrations/v4/migration_test.go delete mode 100644 x/ccv/provider/migrations/v4/migrations.go delete mode 100644 x/ccv/provider/migrations/v5/migration_test.go delete mode 100644 x/ccv/provider/migrations/v5/migrations.go delete mode 100644 x/ccv/provider/migrations/v6/migration_test.go delete mode 100644 x/ccv/provider/migrations/v6/migrations.go delete mode 100644 x/ccv/provider/migrations/v7/legacy_params.go delete mode 100644 x/ccv/provider/migrations/v7/migrations.go delete mode 100644 x/ccv/provider/migrations/v7/migrations_test.go rename x/ccv/provider/migrations/{vX => v8}/migrations.go (78%) diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 0f48084418..eb1b62e8ff 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -103,7 +103,9 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().NoError(err) s.Require().Equal(heightBefore+2, heightAfter) - // We've now advanced two blocks. + // this call was added starging cosmos-sdk v0.50.x + s.nextEpoch() + s.nextEpoch() // Confirm the valset update Id was incremented twice on provider, diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index b454f3344a..c910d27cfb 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "fmt" "reflect" + "time" addresscodec "cosmossdk.io/core/address" "cosmossdk.io/math" @@ -1156,3 +1157,11 @@ func (k Keeper) DeleteMinimumPowerInTopN( store := ctx.KVStore(k.storeKey) store.Delete(types.MinimumPowerInTopNKey(chainID)) } + +func (k Keeper) UnbondingCanComplete(ctx sdk.Context, id uint64) error { + return k.stakingKeeper.UnbondingCanComplete(ctx, id) +} + +func (k Keeper) UnbondingTime(ctx sdk.Context) (time.Duration, error) { + return k.stakingKeeper.UnbondingTime(ctx) +} diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index f4b78528ed..50bc351ec2 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -814,7 +814,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Set the unbonding time to 60s so that a key is prunable after 60s unbondingTimeInNs := time.Duration(60 * 1_000_000_000) // 60 seconds - mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeInNs).AnyTimes() + mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeInNs, nil).AnyTimes() // The consumer chain has not yet been registered // Apply some randomly generated key assignments diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index 3f1a32c8af..13011e6bcf 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -7,10 +7,7 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - v4 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v4" - v5 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v5" - v6 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v6" - v7 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v7" + v8 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v8" ) // Migrator is a struct for handling in-place store migrations. @@ -45,27 +42,33 @@ func (m Migrator) Migrate2to3(ctx sdktypes.Context) error { // Migrate3to4 migrates x/ccvprovider state from consensus version 3 to 4. // The migration consists of provider chain params additions. func (m Migrator) Migrate3to4(ctx sdktypes.Context) error { - v4.MigrateParams(ctx, m.paramSpace) return nil } // Migrate4to5 migrates x/ccvprovider state from consensus version 4 to 5. // The migration consists of setting a top N of 95 for all registered consumer chains. func (m Migrator) Migrate4to5(ctx sdktypes.Context) error { - v5.MigrateTopNForRegisteredChains(ctx, m.providerKeeper) return nil } // Migrate5to6 consists of setting the `NumberOfEpochsToStartReceivingRewards` param, as well as // computing and storing the minimal power in the top N for all registered consumer chains. func (m Migrator) Migrate5to6(ctx sdktypes.Context) error { - v6.MigrateParams(ctx, m.paramSpace) - v6.MigrateMinPowerInTopN(ctx, m.providerKeeper) return nil } // Migrate6to7 migrates x/ccvprovider state from consensus version 6 to 7. // The migration consists of initializing new provider chain params using params from the legacy store. func (m Migrator) Migrate6to7(ctx sdktypes.Context) error { - return v7.MigrateLegacyParams(ctx, m.providerKeeper, m.paramSpace) + return nil +} + +// Migrate7to8 migrates x/ccvprovider state from consensus version 7 to 8. +func (m Migrator) Migrate7to8(ctx sdktypes.Context) error { + store := ctx.KVStore(m.storeKey) + v8.CompleteUnbondingOps(ctx, store, m.providerKeeper) + v8.MigrateConsumerAddrsToPrune(ctx, store, m.providerKeeper) + v8.CleanupState(store) + + return nil } diff --git a/x/ccv/provider/migrations/v3/migration_test.go b/x/ccv/provider/migrations/v3/migration_test.go deleted file mode 100644 index 56d6b617d9..0000000000 --- a/x/ccv/provider/migrations/v3/migration_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package v3 - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" -) - -func TestMigrate2To3(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, testutil.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - // Set consumer client ids to mock consumers being connected to provider - providerKeeper.SetConsumerClientId(ctx, "chain-1", "client-1") - providerKeeper.SetConsumerClientId(ctx, "chain-2", "client-2") - providerKeeper.SetConsumerClientId(ctx, "chain-3", "client-3") - - // Queue some data for chain-1 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 66, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 67, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 68, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 69, testutil.GetNewVSCMaturedPacketData()) - - // Queue some data for chain-2 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 789, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 790, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 791, testutil.GetNewVSCMaturedPacketData()) - - // Queue some data for chain-3 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 123, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 124, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 125, testutil.GetNewVSCMaturedPacketData()) - - // Confirm getter methods return expected values - slash1, vscm1 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") - require.Len(t, slash1, 2) - require.Len(t, vscm1, 2) - - slash2, vscm2 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") - require.Len(t, slash2, 1) - require.Len(t, vscm2, 2) - - slash3, vscm3 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") - require.Len(t, slash3, 1) - require.Len(t, vscm3, 2) - - // Set vsc send timestamp for every queued vsc matured packet, - // as a way to assert that the vsc matured packets are handled in the migration. - // - // That is, timestamp should exist before a vsc matured packet is handled, - // and deleted after handling. - for _, data := range vscm1 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId, time.Now()) - } - for _, data := range vscm2 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId, time.Now()) - } - for _, data := range vscm3 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId, time.Now()) - } - - // Confirm timestamps are set - for _, data := range vscm1 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId) - require.True(t, found) - } - for _, data := range vscm2 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId) - require.True(t, found) - } - for _, data := range vscm3 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId) - require.True(t, found) - } - - // Run migration - err := MigrateQueuedPackets(ctx, providerKeeper) - require.NoError(t, err) - - // Confirm throttled data is now deleted - slash1, vscm1 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") - require.Empty(t, slash1) - require.Empty(t, vscm1) - slash2, vscm2 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") - require.Empty(t, slash2) - require.Empty(t, vscm2) - slash3, vscm3 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") - require.Empty(t, slash3) - require.Empty(t, vscm3) - - // Confirm timestamps are deleted, meaning vsc matured packets were handled - for _, data := range vscm1 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId) - require.False(t, found) - } - for _, data := range vscm2 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId) - require.False(t, found) - } - for _, data := range vscm3 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId) - require.False(t, found) - } -} diff --git a/x/ccv/provider/migrations/v3/migrations.go b/x/ccv/provider/migrations/v3/migrations.go deleted file mode 100644 index 8c17000b0b..0000000000 --- a/x/ccv/provider/migrations/v3/migrations.go +++ /dev/null @@ -1,25 +0,0 @@ -package v3 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" -) - -// MigrateQueuedPackets processes all queued packet data for all consumer chains that were stored -// on the provider in the v2 consensus version (jail throttling v1). -func MigrateQueuedPackets(ctx sdk.Context, k providerkeeper.Keeper) error { - for _, consumerChainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { - slashData, vscmData := k.LegacyGetAllThrottledPacketData(ctx, consumerChainID) - if len(slashData) > 0 { - k.Logger(ctx).Error(fmt.Sprintf("slash data being dropped: %v", slashData)) - } - for _, data := range vscmData { - k.HandleVSCMaturedPacket(ctx, consumerChainID, data) - } - k.LegacyDeleteThrottledPacketDataForConsumer(ctx, consumerChainID) - } - return nil -} diff --git a/x/ccv/provider/migrations/v4/migration_test.go b/x/ccv/provider/migrations/v4/migration_test.go deleted file mode 100644 index 4423842149..0000000000 --- a/x/ccv/provider/migrations/v4/migration_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package v4 - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -func TestMigrateParams(t *testing.T) { - inMemParams := testutil.NewInMemKeeperParams(t) - _, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - // initially blocks per epoch param does not exist - require.False(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyBlocksPerEpoch)) - - MigrateParams(ctx, *inMemParams.ParamsSubspace) - - // after migration, blocks per epoch param should exist and be equal to default - require.True(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyBlocksPerEpoch)) - var blocksPerEpochParam int64 - inMemParams.ParamsSubspace.Get(ctx, providertypes.KeyBlocksPerEpoch, &blocksPerEpochParam) - require.Equal(t, providertypes.DefaultBlocksPerEpoch, blocksPerEpochParam) -} diff --git a/x/ccv/provider/migrations/v4/migrations.go b/x/ccv/provider/migrations/v4/migrations.go deleted file mode 100644 index e60c98700e..0000000000 --- a/x/ccv/provider/migrations/v4/migrations.go +++ /dev/null @@ -1,18 +0,0 @@ -package v4 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -// MigrateParams adds missing provider chain params to the param store. -func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { - if paramsSubspace.HasKeyTable() { - paramsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, providertypes.DefaultBlocksPerEpoch) - } else { - paramsSubspace.WithKeyTable(providertypes.ParamKeyTable()) - paramsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, providertypes.DefaultBlocksPerEpoch) - } -} diff --git a/x/ccv/provider/migrations/v5/migration_test.go b/x/ccv/provider/migrations/v5/migration_test.go deleted file mode 100644 index 907aa1b019..0000000000 --- a/x/ccv/provider/migrations/v5/migration_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package v5 - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" -) - -func TestMigrateParams(t *testing.T) { - inMemParams := testutil.NewInMemKeeperParams(t) - provKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - provKeeper.SetConsumerClientId(ctx, "chainID", "clientID") - - // initially top N should not exist - topN, found := provKeeper.GetTopN(ctx, "chainID") - require.False(t, found) - require.Zero(t, topN) - - // migrate - MigrateTopNForRegisteredChains(ctx, provKeeper) - - // after migration, top N should be 95 - topN, found = provKeeper.GetTopN(ctx, "chainID") - require.True(t, found) - require.Equal(t, uint32(95), topN) -} diff --git a/x/ccv/provider/migrations/v5/migrations.go b/x/ccv/provider/migrations/v5/migrations.go deleted file mode 100644 index 411efd49e1..0000000000 --- a/x/ccv/provider/migrations/v5/migrations.go +++ /dev/null @@ -1,21 +0,0 @@ -package v5 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" -) - -// This migration only takes already registered chains into account. -// If a chain is in voting while the upgrade happens, this is not sufficient, -// and a migration to rewrite the proposal is needed. -func MigrateTopNForRegisteredChains(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { - // Set the topN of each chain to 95 - for _, chainID := range providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) { - providerKeeper.SetTopN(ctx, chainID, 95) - } -} - -// // If there are consumer addition proposals in the voting period at the upgrade time, they may need the topN value updated. -// func MigrateTopNForVotingPeriodChains(ctx sdk.Context, govKeeper govkeeper.Keeper, providerKeeper providerkeeper.Keeper) { -// } diff --git a/x/ccv/provider/migrations/v6/migration_test.go b/x/ccv/provider/migrations/v6/migration_test.go deleted file mode 100644 index 9396a3e05d..0000000000 --- a/x/ccv/provider/migrations/v6/migration_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package v6 - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -func TestMigrateParams(t *testing.T) { - inMemParams := testutil.NewInMemKeeperParams(t) - _, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - // initially number of epochs param does not exist - require.False(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards)) - - MigrateParams(ctx, *inMemParams.ParamsSubspace) - - // after migration, number of epochs to start receiving rewards param should exist and be equal to default - require.True(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards)) - var numberOfEpochsParam int64 - inMemParams.ParamsSubspace.Get(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, &numberOfEpochsParam) - require.Equal(t, providertypes.DefaultNumberOfEpochsToStartReceivingRewards, numberOfEpochsParam) -} diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go deleted file mode 100644 index 5829f29222..0000000000 --- a/x/ccv/provider/migrations/v6/migrations.go +++ /dev/null @@ -1,47 +0,0 @@ -package v6 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -// MigrateParams adds missing provider chain params to the param store. -func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { - if !paramsSubspace.HasKeyTable() { - paramsSubspace.WithKeyTable(providertypes.ParamKeyTable()) - } - paramsSubspace.Set(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, providertypes.DefaultNumberOfEpochsToStartReceivingRewards) -} - -func MigrateMinPowerInTopN(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { - // we only get the registered consumer chains and not also the proposed consumer chains because - // the minimal power is first set when the consumer chain addition proposal passes - registeredConsumerChains := providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) - - for _, chain := range registeredConsumerChains { - // get the top N - topN, found := providerKeeper.GetTopN(ctx, chain) - if !found { - providerKeeper.Logger(ctx).Error("failed to get top N", "chain", chain) - continue - } else if topN == 0 { - providerKeeper.Logger(ctx).Info("top N is 0, not setting minimal power", "chain", chain) - } else { - // set the minimal power in the top N - bondedValidators, err := providerKeeper.GetLastBondedValidators(ctx) - if err != nil { - providerKeeper.Logger(ctx).Error("failed to get last bonded validators", "chain", chain, "error", err) - continue - } - minPower, err := providerKeeper.ComputeMinPowerInTopN(ctx, bondedValidators, topN) - if err != nil { - providerKeeper.Logger(ctx).Error("failed to compute min power in top N", "chain", chain, "topN", topN, "error", err) - continue - } - providerKeeper.SetMinimumPowerInTopN(ctx, chain, minPower) - } - } -} diff --git a/x/ccv/provider/migrations/v7/legacy_params.go b/x/ccv/provider/migrations/v7/legacy_params.go deleted file mode 100644 index a8c6d5218d..0000000000 --- a/x/ccv/provider/migrations/v7/legacy_params.go +++ /dev/null @@ -1,99 +0,0 @@ -package v7 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" -) - -// getTemplateClient returns the template client for provider proposals -func getTemplateClient(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) *ibctmtypes.ClientState { - var cs ibctmtypes.ClientState - paramSpace.Get(ctx, types.KeyTemplateClient, &cs) - return &cs -} - -// getTrustingPeriodFraction returns a TrustingPeriodFraction -// used to compute the provider IBC client's TrustingPeriod as UnbondingPeriod / TrustingPeriodFraction -func getTrustingPeriodFraction(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) string { - var f string - paramSpace.Get(ctx, types.KeyTrustingPeriodFraction, &f) - return f -} - -// getCCVTimeoutPeriod returns the timeout period for sent ibc packets -func getCCVTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, ccvtypes.KeyCCVTimeoutPeriod, &p) - return p -} - -// getInitTimeoutPeriod returns the init timeout period -func getInitTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, types.KeyInitTimeoutPeriod, &p) - return p -} - -// getVscTimeoutPeriod returns the vsc timeout period -func getVscTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, types.KeyVscTimeoutPeriod, &p) - return p -} - -// getSlashMeterReplenishPeriod returns the period in which: -// Once the slash meter becomes not-full, the slash meter is replenished after this period. -func getSlashMeterReplenishPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, types.KeySlashMeterReplenishPeriod, &p) - return p -} - -// getSlashMeterReplenishFraction returns the string fraction of total voting power that is replenished -// to the slash meter every replenish period. This param also serves as a maximum fraction of total -// voting power that the slash meter can hold. -func getSlashMeterReplenishFraction(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) string { - var f string - paramSpace.Get(ctx, types.KeySlashMeterReplenishFraction, &f) - return f -} - -func getConsumerRewardDenomRegistrationFee(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) sdk.Coin { - var c sdk.Coin - paramSpace.Get(ctx, types.KeyConsumerRewardDenomRegistrationFee, &c) - return c -} - -func getBlocksPerEpoch(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) int64 { - var b int64 - paramSpace.Get(ctx, types.KeyBlocksPerEpoch, &b) - return b -} - -func getNumberOfEpochsToStartReceivingRewards(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) int64 { - var b int64 - paramSpace.Get(ctx, types.KeyNumberOfEpochsToStartReceivingRewards, &b) - return b -} - -// Legacy: Only for migration purposes. GetParamsLegacy returns the paramset for the provider -// module from a given param subspace -func GetParamsLegacy(ctx sdk.Context, paramspace ccvtypes.LegacyParamSubspace) types.Params { - return types.NewParams( - getTemplateClient(ctx, paramspace), - getTrustingPeriodFraction(ctx, paramspace), - getCCVTimeoutPeriod(ctx, paramspace), - getInitTimeoutPeriod(ctx, paramspace), - getVscTimeoutPeriod(ctx, paramspace), - getSlashMeterReplenishPeriod(ctx, paramspace), - getSlashMeterReplenishFraction(ctx, paramspace), - getConsumerRewardDenomRegistrationFee(ctx, paramspace), - getBlocksPerEpoch(ctx, paramspace), - getNumberOfEpochsToStartReceivingRewards(ctx, paramspace), - ) -} diff --git a/x/ccv/provider/migrations/v7/migrations.go b/x/ccv/provider/migrations/v7/migrations.go deleted file mode 100644 index 3c2f171dac..0000000000 --- a/x/ccv/provider/migrations/v7/migrations.go +++ /dev/null @@ -1,21 +0,0 @@ -package v7 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" -) - -// MigrateParams migrates the provider module's parameters from the x/params to self store. -func MigrateLegacyParams(ctx sdk.Context, keeper providerkeeper.Keeper, legacyParamspace ccvtypes.LegacyParamSubspace) error { - ctx.Logger().Info("starting provider legacy params migration") - params := GetParamsLegacy(ctx, legacyParamspace) - err := params.Validate() - if err != nil { - return err - } - - keeper.SetParams(ctx, params) - keeper.Logger(ctx).Info("successfully migrated legacy provider parameters") - return nil -} diff --git a/x/ccv/provider/migrations/v7/migrations_test.go b/x/ccv/provider/migrations/v7/migrations_test.go deleted file mode 100644 index f4ee763263..0000000000 --- a/x/ccv/provider/migrations/v7/migrations_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package v7 - -import ( - "testing" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" - "github.com/stretchr/testify/require" -) - -func TestMigrateParams(t *testing.T) { - t.Helper() - inMemParams := testutil.NewInMemKeeperParams(t) - k, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - if !inMemParams.ParamsSubspace.HasKeyTable() { - inMemParams.ParamsSubspace.WithKeyTable(providertypes.ParamKeyTable()) - } - - defaultParams := providertypes.DefaultParams() - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTemplateClient, defaultParams.TemplateClient) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTrustingPeriodFraction, defaultParams.TrustingPeriodFraction) - inMemParams.ParamsSubspace.Set(ctx, ccvtypes.KeyCCVTimeoutPeriod, defaultParams.CcvTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyInitTimeoutPeriod, defaultParams.InitTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyVscTimeoutPeriod, defaultParams.VscTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishPeriod, defaultParams.SlashMeterReplenishPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishFraction, defaultParams.SlashMeterReplenishFraction) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyConsumerRewardDenomRegistrationFee, defaultParams.ConsumerRewardDenomRegistrationFee) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, defaultParams.BlocksPerEpoch) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, defaultParams.NumberOfEpochsToStartReceivingRewards) - - // confirms that inMemParams.ParamsSubspace works as expected - require.NotPanics(t, func() { - GetParamsLegacy(ctx, inMemParams.ParamsSubspace) - }) - - // no "new" params should be available before migration - // "new" params are stored under providertypes.ParametersKey() - emptyParams := k.GetParams(ctx) - require.Empty(t, emptyParams) - - // make sure that the legacy params are equal to the default params (they were set using inMemParams.ParamsSubspace.Set()) - legacyParams := GetParamsLegacy(ctx, inMemParams.ParamsSubspace) - require.NotNil(t, legacyParams) - require.Equal(t, defaultParams, legacyParams) - - err := MigrateLegacyParams(ctx, k, inMemParams.ParamsSubspace) - require.NoError(t, err) - - // check that "new" params are available after migration and equal to defaults - migratedParams := k.GetParams(ctx) - require.NotEmpty(t, migratedParams) - require.Equal(t, defaultParams, migratedParams) -} diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/v8/migrations.go similarity index 78% rename from x/ccv/provider/migrations/vX/migrations.go rename to x/ccv/provider/migrations/v8/migrations.go index 153448477d..30dfc6903c 100644 --- a/x/ccv/provider/migrations/vX/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -1,26 +1,25 @@ -package vX +package v8 import ( "encoding/binary" "time" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - providerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v4/x/ccv/types" + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) // CompleteUnbondingOps completes all unbonding operations. // Note that it must be executed before CleanupState. -func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper, sk ccv.StakingKeeper) { - iterator := sdk.KVStorePrefixIterator(store, []byte{providertypes.UnbondingOpBytePrefix}) +func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) { + iterator := storetypes.KVStorePrefixIterator(store, []byte{providertypes.UnbondingOpBytePrefix}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { id := binary.BigEndian.Uint64(iterator.Key()[1:]) - if err := sk.UnbondingCanComplete(ctx, id); err != nil { + if err := pk.UnbondingCanComplete(ctx, id); err != nil { pk.Logger(ctx).Error("UnbondingCanComplete failed", "unbondingID", id, "error", err.Error()) } } @@ -28,8 +27,8 @@ func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk provider // MigrateConsumerAddrsToPrune migrates the ConsumerAddrsToPrune index to ConsumerAddrsToPruneV2. // Note: This migration must be done before removing the VscSendTimestamp index -func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper, sk ccv.StakingKeeper) { - iterator := sdk.KVStorePrefixIterator(store, []byte{providertypes.ConsumerAddrsToPruneBytePrefix}) +func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) { + iterator := storetypes.KVStorePrefixIterator(store, []byte{providertypes.ConsumerAddrsToPruneBytePrefix}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -56,7 +55,14 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p ) continue } - pruneAfterTs := sentTime.Add(sk.UnbondingTime(ctx)) + unbondingPeriod, err := pk.UnbondingTime(ctx) + if err != nil { + pk.Logger(ctx).Error( + "MigrateConsumerAddrsToPrune cannot get unbonding period from staking module", + ) + continue + } + pruneAfterTs := sentTime.Add(unbondingPeriod) var addrs providertypes.AddressList err = addrs.Unmarshal(iterator.Value()) @@ -83,7 +89,7 @@ func CleanupState(store storetypes.KVStore) { } func removePrefix(store storetypes.KVStore, prefix byte) { - iterator := sdk.KVStorePrefixIterator(store, []byte{prefix}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{prefix}) defer iterator.Close() var keysToDel [][]byte diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 668b8b0f7d..7b0d0c8511 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -157,7 +157,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 7 } +func (AppModule) ConsensusVersion() uint64 { return 8 } // BeginBlock implements the AppModule interface func (am AppModule) BeginBlock(ctx context.Context) error { diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index bd10656105..642dc54a54 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -72,7 +72,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, From 175c56bb58a2d589109f6d2993572d530bebd1ee Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 17 Jul 2024 10:27:59 +0200 Subject: [PATCH 65/81] update ADR 18 status --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- docs/docs/adrs/intro.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index d4561bc844..e2359d5e94 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -9,7 +9,7 @@ title: Remove VSCMatured Packets ## Status -Proposed +Accepted ## Context diff --git a/docs/docs/adrs/intro.md b/docs/docs/adrs/intro.md index 110698c518..53602dd2d4 100644 --- a/docs/docs/adrs/intro.md +++ b/docs/docs/adrs/intro.md @@ -41,6 +41,7 @@ To suggest an ADR, please make use of the [ADR template](./templates/adr-templat - [ADR 013: Slashing on the provider for consumer equivocation](./adr-013-equivocation-slashing.md) - [ADR 014: Epochs](./adr-014-epochs.md) - [ADR 015: Partial Set Security](./adr-015-partial-set-security.md) +- [ADR 018: Remove VSCMatured Packets](./adr-018-remove-vscmatured.md) ### Proposed From 975fb79fbffa5327870b6ae347a10e841210be8b Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 17 Jul 2024 10:30:28 +0200 Subject: [PATCH 66/81] remove InitTimeoutTimestamp proto --- .../ccv/provider/v1/provider.proto | 5 - x/ccv/provider/types/provider.pb.go | 456 +++++------------- 2 files changed, 125 insertions(+), 336 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index e5ea218076..38140dff44 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -279,11 +279,6 @@ message ChannelToChain { string chain_id = 2; } -message InitTimeoutTimestamp { - string chain_id = 1; - uint64 timestamp = 2; -} - // ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. message ValidatorSetChangePackets { repeated interchain_security.ccv.v1.ValidatorSetChangePacketData list = 1 diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 599d2ccb7e..72a3c0ddec 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -920,58 +920,6 @@ func (m *ChannelToChain) GetChainId() string { return "" } -type InitTimeoutTimestamp struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` -} - -func (m *InitTimeoutTimestamp) Reset() { *m = InitTimeoutTimestamp{} } -func (m *InitTimeoutTimestamp) String() string { return proto.CompactTextString(m) } -func (*InitTimeoutTimestamp) ProtoMessage() {} -func (*InitTimeoutTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{12} -} -func (m *InitTimeoutTimestamp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InitTimeoutTimestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InitTimeoutTimestamp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *InitTimeoutTimestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitTimeoutTimestamp.Merge(m, src) -} -func (m *InitTimeoutTimestamp) XXX_Size() int { - return m.Size() -} -func (m *InitTimeoutTimestamp) XXX_DiscardUnknown() { - xxx_messageInfo_InitTimeoutTimestamp.DiscardUnknown(m) -} - -var xxx_messageInfo_InitTimeoutTimestamp proto.InternalMessageInfo - -func (m *InitTimeoutTimestamp) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *InitTimeoutTimestamp) GetTimestamp() uint64 { - if m != nil { - return m.Timestamp - } - return 0 -} - // ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. type ValidatorSetChangePackets struct { List []types3.ValidatorSetChangePacketData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` @@ -981,7 +929,7 @@ func (m *ValidatorSetChangePackets) Reset() { *m = ValidatorSetChangePac func (m *ValidatorSetChangePackets) String() string { return proto.CompactTextString(m) } func (*ValidatorSetChangePackets) ProtoMessage() {} func (*ValidatorSetChangePackets) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{13} + return fileDescriptor_f22ec409a72b7b72, []int{12} } func (m *ValidatorSetChangePackets) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1027,7 +975,7 @@ func (m *KeyAssignmentReplacement) Reset() { *m = KeyAssignmentReplaceme func (m *KeyAssignmentReplacement) String() string { return proto.CompactTextString(m) } func (*KeyAssignmentReplacement) ProtoMessage() {} func (*KeyAssignmentReplacement) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{14} + return fileDescriptor_f22ec409a72b7b72, []int{13} } func (m *KeyAssignmentReplacement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1090,7 +1038,7 @@ func (m *ValidatorConsumerPubKey) Reset() { *m = ValidatorConsumerPubKey func (m *ValidatorConsumerPubKey) String() string { return proto.CompactTextString(m) } func (*ValidatorConsumerPubKey) ProtoMessage() {} func (*ValidatorConsumerPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{15} + return fileDescriptor_f22ec409a72b7b72, []int{14} } func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1153,7 +1101,7 @@ func (m *ValidatorByConsumerAddr) Reset() { *m = ValidatorByConsumerAddr func (m *ValidatorByConsumerAddr) String() string { return proto.CompactTextString(m) } func (*ValidatorByConsumerAddr) ProtoMessage() {} func (*ValidatorByConsumerAddr) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{16} + return fileDescriptor_f22ec409a72b7b72, []int{15} } func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1215,7 +1163,7 @@ func (m *ConsumerAddrsToPruneV2) Reset() { *m = ConsumerAddrsToPruneV2{} func (m *ConsumerAddrsToPruneV2) String() string { return proto.CompactTextString(m) } func (*ConsumerAddrsToPruneV2) ProtoMessage() {} func (*ConsumerAddrsToPruneV2) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{17} + return fileDescriptor_f22ec409a72b7b72, []int{16} } func (m *ConsumerAddrsToPruneV2) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1285,7 +1233,7 @@ func (m *ConsumerValidator) Reset() { *m = ConsumerValidator{} } func (m *ConsumerValidator) String() string { return proto.CompactTextString(m) } func (*ConsumerValidator) ProtoMessage() {} func (*ConsumerValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{18} + return fileDescriptor_f22ec409a72b7b72, []int{17} } func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1353,7 +1301,7 @@ func (m *ConsumerRewardsAllocation) Reset() { *m = ConsumerRewardsAlloca func (m *ConsumerRewardsAllocation) String() string { return proto.CompactTextString(m) } func (*ConsumerRewardsAllocation) ProtoMessage() {} func (*ConsumerRewardsAllocation) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{19} + return fileDescriptor_f22ec409a72b7b72, []int{18} } func (m *ConsumerRewardsAllocation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1402,7 +1350,6 @@ func init() { proto.RegisterType((*ConsumerRemovalProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposals") proto.RegisterType((*AddressList)(nil), "interchain_security.ccv.provider.v1.AddressList") proto.RegisterType((*ChannelToChain)(nil), "interchain_security.ccv.provider.v1.ChannelToChain") - proto.RegisterType((*InitTimeoutTimestamp)(nil), "interchain_security.ccv.provider.v1.InitTimeoutTimestamp") proto.RegisterType((*ValidatorSetChangePackets)(nil), "interchain_security.ccv.provider.v1.ValidatorSetChangePackets") proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") @@ -1417,125 +1364,124 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1888 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x56, 0xed, 0x95, 0xaa, 0x52, 0xf2, 0xa6, 0x36, - 0xd4, 0xb8, 0x5e, 0x46, 0x0a, 0x0a, 0x18, 0x46, 0x03, 0x43, 0xa2, 0x9c, 0xd8, 0x52, 0x62, 0xb3, - 0x2b, 0xc2, 0x01, 0xd2, 0xc3, 0x62, 0x38, 0x3b, 0x22, 0xa7, 0x5a, 0xee, 0xac, 0x67, 0x86, 0xab, - 0xf2, 0xd2, 0x73, 0x2f, 0x05, 0xd2, 0x5b, 0xd0, 0x43, 0x1b, 0xa0, 0x97, 0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7b, 0x1b, 0x33, 0xd1, 0x67, 0xa2, 0x41, 0x94, 0xff, 0x11, 0x26, 0x8d, 0x64, 0xa7, - 0x43, 0x24, 0xda, 0xc9, 0x09, 0x99, 0xdd, 0xa9, 0x5c, 0x07, 0x89, 0x91, 0x0c, 0x66, 0x34, 0xb3, - 0x7b, 0xcd, 0xf0, 0x7d, 0x13, 0x11, 0xf3, 0x92, 0xb2, 0x56, 0x50, 0x9f, 0x46, 0xac, 0xa1, 0xff, - 0x1a, 0x92, 0xf3, 0x45, 0x05, 0xd8, 0x4d, 0x16, 0x89, 0x41, 0x9f, 0xf0, 0xbd, 0x20, 0xa0, 0x2a, - 0x00, 0x2d, 0xce, 0x62, 0x26, 0x50, 0x08, 0x57, 0xc1, 0x8c, 0xa4, 0x32, 0x24, 0xb6, 0xb5, 0x65, - 0x6d, 0x57, 0x3d, 0xf3, 0x02, 0xb7, 0x40, 0x2d, 0x20, 0x02, 0x73, 0x1a, 0x2b, 0x61, 0x7b, 0x5a, - 0xf3, 0x8a, 0x24, 0xb8, 0x06, 0x2a, 0xe6, 0xd6, 0x68, 0x60, 0x97, 0x34, 0x7b, 0x4e, 0xbf, 0x3f, - 0x0e, 0xe0, 0x07, 0x60, 0x91, 0x46, 0x54, 0x52, 0x14, 0xfa, 0x3d, 0xa2, 0x62, 0x67, 0x97, 0xb7, - 0xac, 0xed, 0xda, 0xee, 0xba, 0x4b, 0x3b, 0xd8, 0x55, 0xe1, 0x76, 0xd3, 0x20, 0x27, 0x3b, 0xee, - 0x23, 0x2d, 0xb1, 0x5f, 0xfe, 0xf2, 0xeb, 0xcd, 0x29, 0x6f, 0x21, 0xd5, 0x33, 0x44, 0x78, 0x13, - 0xcc, 0x77, 0x49, 0x44, 0x04, 0x15, 0x7e, 0x0f, 0x89, 0x9e, 0x3d, 0xb3, 0x65, 0x6d, 0xcf, 0x7b, - 0xb5, 0x94, 0xf6, 0x08, 0x89, 0x1e, 0xdc, 0x04, 0xb5, 0x0e, 0x8d, 0x10, 0x1f, 0x1a, 0x89, 0x59, - 0x2d, 0x01, 0x0c, 0x49, 0x0b, 0x34, 0x01, 0x10, 0x31, 0x3a, 0x8b, 0x7c, 0x95, 0x1b, 0xf6, 0x5c, - 0x6a, 0x88, 0xc9, 0x0b, 0x37, 0xcb, 0x0b, 0xb7, 0x9d, 0x25, 0xce, 0x7e, 0x45, 0x19, 0xf2, 0xe9, - 0x37, 0x9b, 0x96, 0x57, 0xd5, 0x7a, 0x8a, 0x03, 0x9f, 0x80, 0xe5, 0x41, 0xd4, 0x61, 0x51, 0x40, - 0xa3, 0xae, 0x1f, 0x13, 0x4e, 0x59, 0x60, 0x57, 0x34, 0xd4, 0xda, 0x05, 0xa8, 0x83, 0x34, 0xc5, - 0x0c, 0xd2, 0x67, 0x0a, 0x69, 0x29, 0x57, 0x6e, 0x69, 0x5d, 0xf8, 0x33, 0x00, 0x31, 0x4e, 0xb4, - 0x49, 0x6c, 0x20, 0x33, 0xc4, 0xea, 0xe4, 0x88, 0xcb, 0x18, 0x27, 0x6d, 0xa3, 0x9d, 0x42, 0xfe, - 0x1c, 0xdc, 0x90, 0x1c, 0x45, 0xe2, 0x84, 0xf0, 0xf3, 0xb8, 0x60, 0x72, 0xdc, 0xef, 0x65, 0x18, - 0xe3, 0xe0, 0x8f, 0xc0, 0x16, 0x4e, 0x13, 0xc8, 0xe7, 0x24, 0xa0, 0x42, 0x72, 0xda, 0x19, 0x28, - 0x5d, 0xff, 0x84, 0x23, 0xac, 0x73, 0xa4, 0xa6, 0x93, 0xa0, 0x9e, 0xc9, 0x79, 0x63, 0x62, 0xef, - 0xa7, 0x52, 0xf0, 0x29, 0xf8, 0x61, 0x27, 0x64, 0xf8, 0x54, 0x28, 0xe3, 0xfc, 0x31, 0x24, 0x7d, - 0x74, 0x9f, 0x0a, 0xa1, 0xd0, 0xe6, 0xb7, 0xac, 0xed, 0x92, 0x77, 0xd3, 0xc8, 0xb6, 0x08, 0x3f, - 0x28, 0x48, 0xb6, 0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23, 0x85, 0xe3, 0x65, 0x30, 0xe9, 0x29, 0x4d, 0x50, 0xbf, 0xfc, - 0x94, 0xdc, 0xf1, 0x39, 0xed, 0xf8, 0xf7, 0x2f, 0x81, 0xc8, 0xbd, 0x17, 0xe0, 0x76, 0x61, 0x96, - 0xab, 0x6a, 0xf2, 0x75, 0x22, 0xfb, 0x9c, 0x74, 0xd5, 0xc0, 0x43, 0x66, 0xac, 0x13, 0x92, 0xef, - 0x23, 0x69, 0x4e, 0xab, 0x65, 0xb4, 0x90, 0xd4, 0x34, 0x4a, 0x97, 0x36, 0x67, 0x34, 0xf2, 0xf3, - 0xda, 0xf4, 0x0a, 0x58, 0xef, 0x13, 0xa2, 0xaa, 0xa8, 0x30, 0xf6, 0x49, 0xcc, 0x70, 0x4f, 0xaf, - 0x25, 0x25, 0x6f, 0x31, 0x1f, 0xf1, 0x0f, 0x15, 0x15, 0x7e, 0x02, 0xee, 0x44, 0x83, 0x7e, 0x87, - 0x70, 0x9f, 0x9d, 0x18, 0x41, 0x5d, 0x79, 0x42, 0x22, 0x2e, 0x7d, 0x4e, 0x30, 0xa1, 0x89, 0xba, - 0x71, 0x63, 0xb9, 0xd0, 0x5b, 0x47, 0xc9, 0xbb, 0x65, 0x54, 0x9e, 0x9e, 0x68, 0x0c, 0xd1, 0x66, - 0xc7, 0x4a, 0xdc, 0xcb, 0xa4, 0x8d, 0x61, 0xe2, 0xb0, 0x5c, 0x29, 0x2f, 0xcf, 0x1c, 0x96, 0x2b, - 0x33, 0xcb, 0xb3, 0x87, 0xe5, 0x4a, 0x65, 0xb9, 0xea, 0xfc, 0x08, 0x54, 0x75, 0x31, 0xee, 0xe1, - 0x53, 0xa1, 0x3b, 0x68, 0x10, 0x70, 0x22, 0x04, 0x11, 0xb6, 0x95, 0x76, 0xd0, 0x8c, 0xe0, 0x48, - 0xb0, 0x76, 0xd5, 0x12, 0x2d, 0xe0, 0xc7, 0x60, 0x2e, 0x26, 0x7a, 0xc3, 0xd3, 0x8a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, 0xc1, 0x0f, 0xc1, 0xb5, 0xdc, 0xe4, 0x58, - 0x5f, 0xe6, 0xc4, 0x37, 0x9e, 0xef, 0x27, 0x39, 0x49, 0x7d, 0xb7, 0xff, 0x82, 0xd1, 0xa8, 0xf8, - 0x03, 0x41, 0xc9, 0x03, 0x8a, 0x64, 0xbe, 0xfd, 0x9d, 0xdf, 0x58, 0xa3, 0x7e, 0x9b, 0xf6, 0xef, - 0xbd, 0x30, 0x4c, 0xb7, 0x42, 0x18, 0x83, 0xb9, 0x6c, 0x02, 0x98, 0xf2, 0xdd, 0xb8, 0x74, 0x4a, - 0x1d, 0x10, 0xac, 0x07, 0xd5, 0x3d, 0x75, 0x03, 0x5f, 0x7c, 0xb3, 0x79, 0xa7, 0x4b, 0x65, 0x6f, - 0xd0, 0x71, 0x31, 0xeb, 0xa7, 0xbf, 0x9a, 0xa4, 0xff, 0xee, 0x8a, 0xe0, 0xb4, 0x21, 0x87, 0x31, - 0x11, 0x99, 0x8e, 0xf8, 0xd3, 0x7f, 0xfe, 0xfc, 0xb6, 0xe5, 0x65, 0xc7, 0xec, 0x7f, 0xfc, 0xe5, - 0x8b, 0xba, 0xf5, 0xd5, 0x8b, 0xba, 0xf5, 0xef, 0x17, 0x75, 0xeb, 0xd3, 0x97, 0xf5, 0xa9, 0xaf, - 0x5e, 0xd6, 0xa7, 0xfe, 0xf5, 0xb2, 0x3e, 0xf5, 0xc9, 0x7b, 0x17, 0x41, 0x47, 0x97, 0x78, 0x37, - 0xff, 0x51, 0x2b, 0xf9, 0x49, 0xe3, 0x97, 0xe3, 0x3f, 0x99, 0xe9, 0xf3, 0x3a, 0xb3, 0x3a, 0x63, - 0xde, 0xfd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x19, 0xc5, 0x77, 0x63, 0x13, 0x00, 0x00, + // 1865 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x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b, + 0x8d, 0x4e, 0x5b, 0x92, 0x0e, 0x89, 0x90, 0x68, 0x18, 0x25, 0x80, 0xda, 0x45, 0x80, 0x3f, 0xe2, + 0x48, 0x52, 0x16, 0xa6, 0x04, 0xb4, 0x87, 0x5b, 0x98, 0x71, 0xd2, 0xc2, 0x01, 0x25, 0xa1, 0x54, + 0xab, 0x9a, 0xa7, 0x04, 0xd0, 0x52, 0x80, 0x80, 0xf6, 0x07, 0xd2, 0x88, 0x45, 0x4b, 0x92, 0xd0, + 0x27, 0x7c, 0x48, 0x0d, 0x78, 0xf2, 0x96, 0x18, 0x6c, 0xe7, 0xf4, 0x98, 0x8f, 0x23, 0xc9, 0x5a, + 0x67, 0x64, 0x2c, 0x12, 0xed, 0x1d, 0xcc, 0xc4, 0x90, 0x89, 0x16, 0x51, 0xf1, 0x87, 0x98, 0xb4, + 0xe2, 0xdd, 0x1e, 0x91, 0x68, 0x37, 0x13, 0xa4, 0x7e, 0x27, 0xb8, 0x1e, 0x12, 0x13, 0x0c, 0x66, + 0x34, 0xf5, 0x7b, 0xd3, 0xe8, 0x3d, 0xb3, 0x23, 0xe6, 0x25, 0x51, 0xad, 0xa3, 0x21, 0x0d, 0x59, + 0x4b, 0xff, 0x35, 0xa2, 0xe6, 0xe7, 0x25, 0x60, 0xb7, 0x59, 0x28, 0x46, 0x43, 0xc2, 0xf7, 0x7d, + 0x9f, 0xaa, 0x0d, 0xe8, 0x70, 0x16, 0x31, 0x81, 0x02, 0x78, 0x03, 0x2c, 0x48, 0x2a, 0x03, 0x62, + 0x5b, 0x0d, 0x6b, 0xa7, 0xec, 0x9a, 0x17, 0xd8, 0x00, 0x15, 0x9f, 0x08, 0xcc, 0x69, 0xa4, 0xc0, + 0xf6, 0xbc, 0xd6, 0xe5, 0x45, 0x70, 0x13, 0x94, 0xcc, 0xa9, 0x51, 0xdf, 0x2e, 0x68, 0xf5, 0x92, + 0x7e, 0x7f, 0xcf, 0x87, 0xef, 0x82, 0x55, 0x1a, 0x52, 0x49, 0x51, 0xe0, 0x0d, 0x88, 0xda, 0x3b, + 0xbb, 0xd8, 0xb0, 0x76, 0x2a, 0x7b, 0x5b, 0x0e, 0xed, 0x61, 0x47, 0x6d, 0xb7, 0x93, 0x6c, 0x72, + 0xbc, 0xeb, 0x3c, 0xd6, 0x88, 0x83, 0xe2, 0x17, 0x5f, 0xd5, 0xe7, 0xdc, 0x95, 0xc4, 0xce, 0x08, + 0xe1, 0x2d, 0xb0, 0xdc, 0x27, 0x21, 0x11, 0x54, 0x78, 0x03, 0x24, 0x06, 0xf6, 0x42, 0xc3, 0xda, + 0x59, 0x76, 0x2b, 0x89, 0xec, 0x31, 0x12, 0x03, 0x58, 0x07, 0x95, 0x1e, 0x0d, 0x11, 0x1f, 0x1b, + 0xc4, 0xa2, 0x46, 0x00, 0x23, 0xd2, 0x80, 0x36, 0x00, 0x22, 0x42, 0xe7, 0xa1, 0xa7, 0x72, 0xc3, + 0x5e, 0x4a, 0x1c, 0x31, 0x79, 0xe1, 0xa4, 0x79, 0xe1, 0x74, 0xd3, 0xc4, 0x39, 0x28, 0x29, 0x47, + 0x3e, 0xf9, 0xba, 0x6e, 0xb9, 0x65, 0x6d, 0xa7, 0x34, 0xf0, 0x09, 0xa8, 0x8e, 0xc2, 0x1e, 0x0b, + 0x7d, 0x1a, 0xf6, 0xbd, 0x88, 0x70, 0xca, 0x7c, 0xbb, 0xa4, 0xa9, 0x36, 0x2f, 0x51, 0x1d, 0x26, + 0x29, 0x66, 0x98, 0x3e, 0x55, 0x4c, 0x6b, 0x99, 0x71, 0x47, 0xdb, 0xc2, 0x9f, 0x01, 0x88, 0x71, + 0xac, 0x5d, 0x62, 0x23, 0x99, 0x32, 0x96, 0x67, 0x67, 0xac, 0x62, 0x1c, 0x77, 0x8d, 0x75, 0x42, + 0xf9, 0x73, 0x70, 0x53, 0x72, 0x14, 0x8a, 0x53, 0xc2, 0x2f, 0xf2, 0x82, 0xd9, 0x79, 0xbf, 0x97, + 0x72, 0x4c, 0x93, 0x3f, 0x06, 0x0d, 0x9c, 0x24, 0x90, 0xc7, 0x89, 0x4f, 0x85, 0xe4, 0xb4, 0x37, + 0x52, 0xb6, 0xde, 0x29, 0x47, 0x58, 0xe7, 0x48, 0x45, 0x27, 0x41, 0x2d, 0xc5, 0xb9, 0x53, 0xb0, + 0x77, 0x12, 0x14, 0xfc, 0x10, 0xfc, 0xb0, 0x17, 0x30, 0x7c, 0x26, 0x94, 0x73, 0xde, 0x14, 0x93, + 0x5e, 0x7a, 0x48, 0x85, 0x50, 0x6c, 0xcb, 0x0d, 0x6b, 0xa7, 0xe0, 0xde, 0x32, 0xd8, 0x0e, 0xe1, + 0x87, 0x39, 0x64, 0x37, 0x07, 0x84, 0xf7, 0x00, 0x1c, 0x50, 0x21, 0x19, 0xa7, 0x18, 0x05, 0x1e, + 0x09, 0x25, 0xa7, 0x44, 0xd8, 0x2b, 0xda, 0x7c, 0x7d, 0xa2, 0x79, 0x64, 0x14, 0xf0, 0x08, 0xdc, + 0xba, 0x76, 0x51, 0x0f, 0x0f, 0x50, 0x18, 0x92, 0xc0, 0x5e, 0xd5, 0xa1, 0xd4, 0xfd, 0x6b, 0xd6, + 0x6c, 0x1b, 0x18, 0xdc, 0x00, 0x0b, 0x92, 0x45, 0xde, 0x13, 0x7b, 0xad, 0x61, 0xed, 0xac, 0xb8, + 0x45, 0xc9, 0xa2, 0x27, 0xf0, 0x4d, 0x70, 0x23, 0x46, 0x01, 0xf5, 0x91, 0x64, 0x5c, 0x78, 0x11, + 0x3b, 0x27, 0xdc, 0xc3, 0x28, 0xb2, 0xab, 0x1a, 0x03, 0x27, 0xba, 0x8e, 0x52, 0xb5, 0x51, 0x04, + 0xdf, 0x00, 0xeb, 0x99, 0xd4, 0x13, 0x44, 0x6a, 0xf8, 0xba, 0x86, 0xaf, 0x65, 0x8a, 0x13, 0x22, + 0x15, 0x76, 0x1b, 0x94, 0x51, 0x10, 0xb0, 0xf3, 0x80, 0x0a, 0x69, 0xc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0xcb, 0xe9, 0x5f, 0xb8, 0xf4, 0x7a, 0xbd, 0x45, 0x9d, 0x31, 0x6f, 0xfd, 0x2f, 0x00, 0x00, 0xff, + 0xff, 0xae, 0x29, 0x6e, 0xec, 0x12, 0x13, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2248,41 +2194,6 @@ func (m *ChannelToChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *InitTimeoutTimestamp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *InitTimeoutTimestamp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InitTimeoutTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Timestamp != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *ValidatorSetChangePackets) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2933,22 +2844,6 @@ func (m *ChannelToChain) Size() (n int) { return n } -func (m *InitTimeoutTimestamp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.Timestamp != 0 { - n += 1 + sovProvider(uint64(m.Timestamp)) - } - return n -} - func (m *ValidatorSetChangePackets) Size() (n int) { if m == nil { return 0 @@ -5364,107 +5259,6 @@ func (m *ChannelToChain) Unmarshal(dAtA []byte) error { } return nil } -func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: InitTimeoutTimestamp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InitTimeoutTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 8de627d07a3f01ed9919abb59bfaecd19a740f41 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 17 Jul 2024 10:55:21 +0200 Subject: [PATCH 67/81] add TestPreserveBytePrefix --- x/ccv/provider/types/keys_test.go | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 741215c6f4..e59c36a989 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -23,6 +23,52 @@ func TestNoDuplicates(t *testing.T) { } } +// Test that the value of all byte prefixes is preserved +func TestPreserveBytePrefix(t *testing.T) { + require.Equal(t, uint8(0), providertypes.PortByteKey) + require.Equal(t, uint8(1), providertypes.MaturedUnbondingOpsByteKey) + require.Equal(t, uint8(2), providertypes.ValidatorSetUpdateIdByteKey) + require.Equal(t, uint8(3), providertypes.SlashMeterByteKey) + require.Equal(t, uint8(4), providertypes.SlashMeterReplenishTimeCandidateByteKey) + require.Equal(t, uint8(5), providertypes.ChainToChannelBytePrefix) + require.Equal(t, uint8(6), providertypes.ChannelToChainBytePrefix) + require.Equal(t, uint8(7), providertypes.ChainToClientBytePrefix) + require.Equal(t, uint8(8), providertypes.InitTimeoutTimestampBytePrefix) + require.Equal(t, uint8(9), providertypes.PendingCAPBytePrefix) + require.Equal(t, uint8(10), providertypes.PendingCRPBytePrefix) + require.Equal(t, uint8(11), providertypes.UnbondingOpBytePrefix) + require.Equal(t, uint8(12), providertypes.UnbondingOpIndexBytePrefix) + require.Equal(t, uint8(13), providertypes.ValsetUpdateBlockHeightBytePrefix) + require.Equal(t, uint8(14), providertypes.ConsumerGenesisBytePrefix) + require.Equal(t, uint8(15), providertypes.SlashAcksBytePrefix) + require.Equal(t, uint8(16), providertypes.InitChainHeightBytePrefix) + require.Equal(t, uint8(17), providertypes.PendingVSCsBytePrefix) + require.Equal(t, uint8(18), providertypes.VscSendTimestampBytePrefix) + require.Equal(t, uint8(19), providertypes.ThrottledPacketDataSizeBytePrefix) + require.Equal(t, uint8(20), providertypes.ThrottledPacketDataBytePrefix) + require.Equal(t, uint8(21), providertypes.GlobalSlashEntryBytePrefix) + require.Equal(t, uint8(22), providertypes.ConsumerValidatorsBytePrefix) + require.Equal(t, uint8(23), providertypes.ValidatorsByConsumerAddrBytePrefix) + require.Equal(t, uint8(24), providertypes.KeyAssignmentReplacementsBytePrefix) + require.Equal(t, uint8(25), providertypes.ConsumerAddrsToPruneBytePrefix) + require.Equal(t, uint8(26), providertypes.SlashLogBytePrefix) + require.Equal(t, uint8(27), providertypes.ConsumerRewardDenomsBytePrefix) + require.Equal(t, uint8(28), providertypes.VSCMaturedHandledThisBlockBytePrefix) + require.Equal(t, uint8(29), providertypes.EquivocationEvidenceMinHeightBytePrefix) + require.Equal(t, uint8(30), providertypes.ProposedConsumerChainByteKey) + require.Equal(t, uint8(31), providertypes.ConsumerValidatorBytePrefix) + require.Equal(t, uint8(32), providertypes.OptedInBytePrefix) + require.Equal(t, uint8(33), providertypes.TopNBytePrefix) + require.Equal(t, uint8(34), providertypes.ValidatorsPowerCapPrefix) + require.Equal(t, uint8(35), providertypes.ValidatorSetCapPrefix) + require.Equal(t, uint8(36), providertypes.AllowlistPrefix) + require.Equal(t, uint8(37), providertypes.DenylistPrefix) + require.Equal(t, uint8(38), providertypes.ConsumerRewardsAllocationBytePrefix) + require.Equal(t, uint8(39), providertypes.ConsumerCommissionRatePrefix) + require.Equal(t, uint8(40), providertypes.MinimumPowerInTopNBytePrefix) + require.Equal(t, uint8(41), providertypes.ConsumerAddrsToPruneV2BytePrefix) +} + // Returns all key prefixes to fully resolved keys, any of which should be a single, unique byte. func getAllKeyPrefixes() []byte { return []byte{ From ed41483095e1ae63ccf0c4c6b31fd24d328d5362 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jul 2024 12:56:50 +0200 Subject: [PATCH 68/81] fix migration; wip --- x/ccv/provider/keeper/keeper.go | 4 + x/ccv/provider/migrations/migrator.go | 30 +++-- .../provider/migrations/v4/migration_test.go | 27 +++++ x/ccv/provider/migrations/v4/migrations.go | 18 +++ .../provider/migrations/v5/migration_test.go | 30 +++++ x/ccv/provider/migrations/v5/migrations.go | 21 ++++ .../provider/migrations/v6/migration_test.go | 27 +++++ x/ccv/provider/migrations/v6/migrations.go | 47 ++++++++ x/ccv/provider/migrations/v7/legacy_params.go | 104 ++++++++++++++++++ x/ccv/provider/migrations/v7/migrations.go | 21 ++++ .../provider/migrations/v7/migrations_test.go | 56 ++++++++++ 11 files changed, 378 insertions(+), 7 deletions(-) create mode 100644 x/ccv/provider/migrations/v4/migration_test.go create mode 100644 x/ccv/provider/migrations/v4/migrations.go create mode 100644 x/ccv/provider/migrations/v5/migration_test.go create mode 100644 x/ccv/provider/migrations/v5/migrations.go create mode 100644 x/ccv/provider/migrations/v6/migration_test.go create mode 100644 x/ccv/provider/migrations/v6/migrations.go create mode 100644 x/ccv/provider/migrations/v7/legacy_params.go create mode 100644 x/ccv/provider/migrations/v7/migrations.go create mode 100644 x/ccv/provider/migrations/v7/migrations_test.go diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index c910d27cfb..755644f241 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -1165,3 +1165,7 @@ func (k Keeper) UnbondingCanComplete(ctx sdk.Context, id uint64) error { func (k Keeper) UnbondingTime(ctx sdk.Context) (time.Duration, error) { return k.stakingKeeper.UnbondingTime(ctx) } + +func (k Keeper) GetBinaryCodec() codec.BinaryCodec { + return k.cdc +} diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index 13011e6bcf..c349590922 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -1,12 +1,18 @@ package migrations import ( + "fmt" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + v4 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v4" + v5 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v5" + v6 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v6" + v7 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v7" v8 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v8" ) @@ -28,42 +34,52 @@ func NewMigrator(providerKeeper providerkeeper.Keeper, paramSpace paramtypes.Sub // First run provider@v2.x.y in production to migrate from consensus version 1 to 2. // Then, in order to migrate to consensus version 3, first upgrade to provider@v3.x.y. func (m Migrator) Migrate1to2(ctx sdktypes.Context) error { - return nil + return fmt.Errorf("state migration failed: " + + "first run provider@v2.x.y in production to migrate from consensus version 1 to 2; " + + "then, in order to migrate to consensus version 3, first upgrade to provider@v3.x.y") } // Migrate2to3 migrates x/ccvprovider state from consensus version 2 to 3. -// First run provider@v3.x.y in production to migrate from consensus version 2 to 3. -// TODO (mpoke) This should probably return an error. -// TODO (mpoke) Check versions. +// First run provider@v4.0.x in production to migrate from consensus version 2 to 3. func (m Migrator) Migrate2to3(ctx sdktypes.Context) error { - return nil + return fmt.Errorf("state migration failed: " + + "first run provider@v4.0.x in production to migrate from consensus version 2 to 3") } // Migrate3to4 migrates x/ccvprovider state from consensus version 3 to 4. // The migration consists of provider chain params additions. func (m Migrator) Migrate3to4(ctx sdktypes.Context) error { + v4.MigrateParams(ctx, m.paramSpace) return nil } // Migrate4to5 migrates x/ccvprovider state from consensus version 4 to 5. // The migration consists of setting a top N of 95 for all registered consumer chains. func (m Migrator) Migrate4to5(ctx sdktypes.Context) error { + v5.MigrateTopNForRegisteredChains(ctx, m.providerKeeper) return nil } -// Migrate5to6 consists of setting the `NumberOfEpochsToStartReceivingRewards` param, as well as +// Migrate5to6 migrates x/ccvprovider state from consensus version 5 to 6. +// It consists of setting the `NumberOfEpochsToStartReceivingRewards` param, as well as // computing and storing the minimal power in the top N for all registered consumer chains. func (m Migrator) Migrate5to6(ctx sdktypes.Context) error { + v6.MigrateParams(ctx, m.paramSpace) + v6.MigrateMinPowerInTopN(ctx, m.providerKeeper) return nil } // Migrate6to7 migrates x/ccvprovider state from consensus version 6 to 7. // The migration consists of initializing new provider chain params using params from the legacy store. func (m Migrator) Migrate6to7(ctx sdktypes.Context) error { - return nil + return v7.MigrateLegacyParams(ctx, m.providerKeeper, m.paramSpace) } // Migrate7to8 migrates x/ccvprovider state from consensus version 7 to 8. +// The migration consists of the following actions: +// - complete the outstanding paused unbonding ops waiting for VSCMaturedPackets from consumer chains +// - migrate the ConsumerAddrsToPrune index to ConsumerAddrsToPruneV2 +// - cleanup deprecated state func (m Migrator) Migrate7to8(ctx sdktypes.Context) error { store := ctx.KVStore(m.storeKey) v8.CompleteUnbondingOps(ctx, store, m.providerKeeper) diff --git a/x/ccv/provider/migrations/v4/migration_test.go b/x/ccv/provider/migrations/v4/migration_test.go new file mode 100644 index 0000000000..4423842149 --- /dev/null +++ b/x/ccv/provider/migrations/v4/migration_test.go @@ -0,0 +1,27 @@ +package v4 + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +func TestMigrateParams(t *testing.T) { + inMemParams := testutil.NewInMemKeeperParams(t) + _, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + // initially blocks per epoch param does not exist + require.False(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyBlocksPerEpoch)) + + MigrateParams(ctx, *inMemParams.ParamsSubspace) + + // after migration, blocks per epoch param should exist and be equal to default + require.True(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyBlocksPerEpoch)) + var blocksPerEpochParam int64 + inMemParams.ParamsSubspace.Get(ctx, providertypes.KeyBlocksPerEpoch, &blocksPerEpochParam) + require.Equal(t, providertypes.DefaultBlocksPerEpoch, blocksPerEpochParam) +} diff --git a/x/ccv/provider/migrations/v4/migrations.go b/x/ccv/provider/migrations/v4/migrations.go new file mode 100644 index 0000000000..e60c98700e --- /dev/null +++ b/x/ccv/provider/migrations/v4/migrations.go @@ -0,0 +1,18 @@ +package v4 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +// MigrateParams adds missing provider chain params to the param store. +func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { + if paramsSubspace.HasKeyTable() { + paramsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, providertypes.DefaultBlocksPerEpoch) + } else { + paramsSubspace.WithKeyTable(providertypes.ParamKeyTable()) + paramsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, providertypes.DefaultBlocksPerEpoch) + } +} diff --git a/x/ccv/provider/migrations/v5/migration_test.go b/x/ccv/provider/migrations/v5/migration_test.go new file mode 100644 index 0000000000..907aa1b019 --- /dev/null +++ b/x/ccv/provider/migrations/v5/migration_test.go @@ -0,0 +1,30 @@ +package v5 + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" +) + +func TestMigrateParams(t *testing.T) { + inMemParams := testutil.NewInMemKeeperParams(t) + provKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + provKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + + // initially top N should not exist + topN, found := provKeeper.GetTopN(ctx, "chainID") + require.False(t, found) + require.Zero(t, topN) + + // migrate + MigrateTopNForRegisteredChains(ctx, provKeeper) + + // after migration, top N should be 95 + topN, found = provKeeper.GetTopN(ctx, "chainID") + require.True(t, found) + require.Equal(t, uint32(95), topN) +} diff --git a/x/ccv/provider/migrations/v5/migrations.go b/x/ccv/provider/migrations/v5/migrations.go new file mode 100644 index 0000000000..411efd49e1 --- /dev/null +++ b/x/ccv/provider/migrations/v5/migrations.go @@ -0,0 +1,21 @@ +package v5 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" +) + +// This migration only takes already registered chains into account. +// If a chain is in voting while the upgrade happens, this is not sufficient, +// and a migration to rewrite the proposal is needed. +func MigrateTopNForRegisteredChains(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { + // Set the topN of each chain to 95 + for _, chainID := range providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) { + providerKeeper.SetTopN(ctx, chainID, 95) + } +} + +// // If there are consumer addition proposals in the voting period at the upgrade time, they may need the topN value updated. +// func MigrateTopNForVotingPeriodChains(ctx sdk.Context, govKeeper govkeeper.Keeper, providerKeeper providerkeeper.Keeper) { +// } diff --git a/x/ccv/provider/migrations/v6/migration_test.go b/x/ccv/provider/migrations/v6/migration_test.go new file mode 100644 index 0000000000..9396a3e05d --- /dev/null +++ b/x/ccv/provider/migrations/v6/migration_test.go @@ -0,0 +1,27 @@ +package v6 + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +func TestMigrateParams(t *testing.T) { + inMemParams := testutil.NewInMemKeeperParams(t) + _, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + // initially number of epochs param does not exist + require.False(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards)) + + MigrateParams(ctx, *inMemParams.ParamsSubspace) + + // after migration, number of epochs to start receiving rewards param should exist and be equal to default + require.True(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards)) + var numberOfEpochsParam int64 + inMemParams.ParamsSubspace.Get(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, &numberOfEpochsParam) + require.Equal(t, providertypes.DefaultNumberOfEpochsToStartReceivingRewards, numberOfEpochsParam) +} diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go new file mode 100644 index 0000000000..5829f29222 --- /dev/null +++ b/x/ccv/provider/migrations/v6/migrations.go @@ -0,0 +1,47 @@ +package v6 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +// MigrateParams adds missing provider chain params to the param store. +func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { + if !paramsSubspace.HasKeyTable() { + paramsSubspace.WithKeyTable(providertypes.ParamKeyTable()) + } + paramsSubspace.Set(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, providertypes.DefaultNumberOfEpochsToStartReceivingRewards) +} + +func MigrateMinPowerInTopN(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { + // we only get the registered consumer chains and not also the proposed consumer chains because + // the minimal power is first set when the consumer chain addition proposal passes + registeredConsumerChains := providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) + + for _, chain := range registeredConsumerChains { + // get the top N + topN, found := providerKeeper.GetTopN(ctx, chain) + if !found { + providerKeeper.Logger(ctx).Error("failed to get top N", "chain", chain) + continue + } else if topN == 0 { + providerKeeper.Logger(ctx).Info("top N is 0, not setting minimal power", "chain", chain) + } else { + // set the minimal power in the top N + bondedValidators, err := providerKeeper.GetLastBondedValidators(ctx) + if err != nil { + providerKeeper.Logger(ctx).Error("failed to get last bonded validators", "chain", chain, "error", err) + continue + } + minPower, err := providerKeeper.ComputeMinPowerInTopN(ctx, bondedValidators, topN) + if err != nil { + providerKeeper.Logger(ctx).Error("failed to compute min power in top N", "chain", chain, "topN", topN, "error", err) + continue + } + providerKeeper.SetMinimumPowerInTopN(ctx, chain, minPower) + } + } +} diff --git a/x/ccv/provider/migrations/v7/legacy_params.go b/x/ccv/provider/migrations/v7/legacy_params.go new file mode 100644 index 0000000000..052b1dbbf0 --- /dev/null +++ b/x/ccv/provider/migrations/v7/legacy_params.go @@ -0,0 +1,104 @@ +package v7 + +import ( + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +var ( + KeyInitTimeoutPeriod = []byte("InitTimeoutPeriod") + KeyVscTimeoutPeriod = []byte("VscTimeoutPeriod") +) + +// getTemplateClient returns the template client for provider proposals +func getTemplateClient(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) *ibctmtypes.ClientState { + var cs ibctmtypes.ClientState + paramSpace.Get(ctx, types.KeyTemplateClient, &cs) + return &cs +} + +// getTrustingPeriodFraction returns a TrustingPeriodFraction +// used to compute the provider IBC client's TrustingPeriod as UnbondingPeriod / TrustingPeriodFraction +func getTrustingPeriodFraction(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) string { + var f string + paramSpace.Get(ctx, types.KeyTrustingPeriodFraction, &f) + return f +} + +// getCCVTimeoutPeriod returns the timeout period for sent ibc packets +func getCCVTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { + var p time.Duration + paramSpace.Get(ctx, ccvtypes.KeyCCVTimeoutPeriod, &p) + return p +} + +// getInitTimeoutPeriod returns the init timeout period +func getInitTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { + var p time.Duration + paramSpace.Get(ctx, KeyInitTimeoutPeriod, &p) + return p +} + +// getVscTimeoutPeriod returns the vsc timeout period +func getVscTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { + var p time.Duration + paramSpace.Get(ctx, KeyVscTimeoutPeriod, &p) + return p +} + +// getSlashMeterReplenishPeriod returns the period in which: +// Once the slash meter becomes not-full, the slash meter is replenished after this period. +func getSlashMeterReplenishPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { + var p time.Duration + paramSpace.Get(ctx, types.KeySlashMeterReplenishPeriod, &p) + return p +} + +// getSlashMeterReplenishFraction returns the string fraction of total voting power that is replenished +// to the slash meter every replenish period. This param also serves as a maximum fraction of total +// voting power that the slash meter can hold. +func getSlashMeterReplenishFraction(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) string { + var f string + paramSpace.Get(ctx, types.KeySlashMeterReplenishFraction, &f) + return f +} + +func getConsumerRewardDenomRegistrationFee(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) sdk.Coin { + var c sdk.Coin + paramSpace.Get(ctx, types.KeyConsumerRewardDenomRegistrationFee, &c) + return c +} + +func getBlocksPerEpoch(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) int64 { + var b int64 + paramSpace.Get(ctx, types.KeyBlocksPerEpoch, &b) + return b +} + +func getNumberOfEpochsToStartReceivingRewards(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) int64 { + var b int64 + paramSpace.Get(ctx, types.KeyNumberOfEpochsToStartReceivingRewards, &b) + return b +} + +// Legacy: Only for migration purposes. GetParamsLegacy returns the paramset for the provider +// module from a given param subspace +func GetParamsLegacy(ctx sdk.Context, paramspace ccvtypes.LegacyParamSubspace) types.Params { + return types.NewParams( + getTemplateClient(ctx, paramspace), + getTrustingPeriodFraction(ctx, paramspace), + getCCVTimeoutPeriod(ctx, paramspace), + getInitTimeoutPeriod(ctx, paramspace), + getVscTimeoutPeriod(ctx, paramspace), + getSlashMeterReplenishPeriod(ctx, paramspace), + getSlashMeterReplenishFraction(ctx, paramspace), + getConsumerRewardDenomRegistrationFee(ctx, paramspace), + getBlocksPerEpoch(ctx, paramspace), + getNumberOfEpochsToStartReceivingRewards(ctx, paramspace), + ) +} diff --git a/x/ccv/provider/migrations/v7/migrations.go b/x/ccv/provider/migrations/v7/migrations.go new file mode 100644 index 0000000000..3c2f171dac --- /dev/null +++ b/x/ccv/provider/migrations/v7/migrations.go @@ -0,0 +1,21 @@ +package v7 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +// MigrateParams migrates the provider module's parameters from the x/params to self store. +func MigrateLegacyParams(ctx sdk.Context, keeper providerkeeper.Keeper, legacyParamspace ccvtypes.LegacyParamSubspace) error { + ctx.Logger().Info("starting provider legacy params migration") + params := GetParamsLegacy(ctx, legacyParamspace) + err := params.Validate() + if err != nil { + return err + } + + keeper.SetParams(ctx, params) + keeper.Logger(ctx).Info("successfully migrated legacy provider parameters") + return nil +} diff --git a/x/ccv/provider/migrations/v7/migrations_test.go b/x/ccv/provider/migrations/v7/migrations_test.go new file mode 100644 index 0000000000..f4ee763263 --- /dev/null +++ b/x/ccv/provider/migrations/v7/migrations_test.go @@ -0,0 +1,56 @@ +package v7 + +import ( + "testing" + + testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/stretchr/testify/require" +) + +func TestMigrateParams(t *testing.T) { + t.Helper() + inMemParams := testutil.NewInMemKeeperParams(t) + k, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + if !inMemParams.ParamsSubspace.HasKeyTable() { + inMemParams.ParamsSubspace.WithKeyTable(providertypes.ParamKeyTable()) + } + + defaultParams := providertypes.DefaultParams() + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTemplateClient, defaultParams.TemplateClient) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTrustingPeriodFraction, defaultParams.TrustingPeriodFraction) + inMemParams.ParamsSubspace.Set(ctx, ccvtypes.KeyCCVTimeoutPeriod, defaultParams.CcvTimeoutPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyInitTimeoutPeriod, defaultParams.InitTimeoutPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyVscTimeoutPeriod, defaultParams.VscTimeoutPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishPeriod, defaultParams.SlashMeterReplenishPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishFraction, defaultParams.SlashMeterReplenishFraction) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyConsumerRewardDenomRegistrationFee, defaultParams.ConsumerRewardDenomRegistrationFee) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, defaultParams.BlocksPerEpoch) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, defaultParams.NumberOfEpochsToStartReceivingRewards) + + // confirms that inMemParams.ParamsSubspace works as expected + require.NotPanics(t, func() { + GetParamsLegacy(ctx, inMemParams.ParamsSubspace) + }) + + // no "new" params should be available before migration + // "new" params are stored under providertypes.ParametersKey() + emptyParams := k.GetParams(ctx) + require.Empty(t, emptyParams) + + // make sure that the legacy params are equal to the default params (they were set using inMemParams.ParamsSubspace.Set()) + legacyParams := GetParamsLegacy(ctx, inMemParams.ParamsSubspace) + require.NotNil(t, legacyParams) + require.Equal(t, defaultParams, legacyParams) + + err := MigrateLegacyParams(ctx, k, inMemParams.ParamsSubspace) + require.NoError(t, err) + + // check that "new" params are available after migration and equal to defaults + migratedParams := k.GetParams(ctx) + require.NotEmpty(t, migratedParams) + require.Equal(t, defaultParams, migratedParams) +} From eb67addac366902ab4010b36de3749b8e20d36be Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jul 2024 14:02:57 +0200 Subject: [PATCH 69/81] remove throttle_legacy as not needed --- x/ccv/provider/keeper/throttle_legacy.go | 111 ----------------------- 1 file changed, 111 deletions(-) delete mode 100644 x/ccv/provider/keeper/throttle_legacy.go diff --git a/x/ccv/provider/keeper/throttle_legacy.go b/x/ccv/provider/keeper/throttle_legacy.go deleted file mode 100644 index 53c6f39c72..0000000000 --- a/x/ccv/provider/keeper/throttle_legacy.go +++ /dev/null @@ -1,111 +0,0 @@ -package keeper - -import ( - "fmt" - - storetypes "cosmossdk.io/store/types" - sdktypes "github.com/cosmos/cosmos-sdk/types" - - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" -) - -// Pending packet data type enum, used to encode the type of packet data stored at each entry in the mutual queue. -// Note this type is copy/pasted from throttle v1 code. -const ( - slashPacketData byte = iota - vscMaturedPacketData -) - -// Deprecated: LegacyGetAllThrottledPacketData is deprecated for ICS >= v4.0.0. -// LegacyGetAllThrottledPacketData returns all throttled packet data that was queued on the provider for a given consumer chain. -func (k Keeper) LegacyGetAllThrottledPacketData(ctx sdktypes.Context, consumerChainID string) ( - slashData []ccvtypes.SlashPacketData, vscMaturedData []ccvtypes.VSCMaturedPacketData, -) { - slashData = []ccvtypes.SlashPacketData{} - vscMaturedData = []ccvtypes.VSCMaturedPacketData{} - - store := ctx.KVStore(k.storeKey) - iteratorPrefix := providertypes.ChainIdWithLenKey(providertypes.ThrottledPacketDataBytePrefix, consumerChainID) - iterator := storetypes.KVStorePrefixIterator(store, iteratorPrefix) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - bz := iterator.Value() - switch bz[0] { - case slashPacketData: - d := ccvtypes.SlashPacketData{} - if err := d.Unmarshal(bz[1:]); err != nil { - k.Logger(ctx).Error(fmt.Sprintf("failed to unmarshal slash packet data: %v", err)) - continue - } - slashData = append(slashData, d) - case vscMaturedPacketData: - d := ccvtypes.VSCMaturedPacketData{} - if err := d.Unmarshal(bz[1:]); err != nil { - k.Logger(ctx).Error(fmt.Sprintf("failed to unmarshal vsc matured packet data: %v", err)) - continue - } - vscMaturedData = append(vscMaturedData, d) - default: - k.Logger(ctx).Error(fmt.Sprintf("invalid packet data type: %v", bz[0])) - continue - } - } - - return slashData, vscMaturedData -} - -// Deprecated: LegacyDeleteThrottledPacketDataForConsumer is deprecated for ICS >= v4.0.0. -// LegacyDeleteThrottledPacketDataForConsumer removes all throttled packet data that was queued on the provider for a given consumer chain. -func (k Keeper) LegacyDeleteThrottledPacketDataForConsumer(ctx sdktypes.Context, consumerChainID string) { - store := ctx.KVStore(k.storeKey) - iteratorPrefix := providertypes.ChainIdWithLenKey(providertypes.ThrottledPacketDataBytePrefix, consumerChainID) - iterator := storetypes.KVStorePrefixIterator(store, iteratorPrefix) - defer iterator.Close() - - keysToDel := [][]byte{} - for ; iterator.Valid(); iterator.Next() { - keysToDel = append(keysToDel, iterator.Key()) - } - // Delete data for this consumer - for _, key := range keysToDel { - store.Delete(key) - } - - // Delete size of data queue for this consumer - store.Delete(providertypes.ThrottledPacketDataSizeKey(consumerChainID)) -} - -// Deprecated: LegacyQueueThrottledPacketData is deprecated for ICS >= v4.0.0. -// LegacyQueueThrottledPacketData queues throttled packet data for a given consumer chain on the provider. -// The method should not be used because the provider does not process throttled packet data anymore. -func (k Keeper) LegacyQueueThrottledPacketData( - ctx sdktypes.Context, consumerChainID string, ibcSeqNum uint64, packetData interface{}, -) error { - store := ctx.KVStore(k.storeKey) - - var bz []byte - var err error - switch data := packetData.(type) { - case ccvtypes.SlashPacketData: - bz, err = data.Marshal() - if err != nil { - return fmt.Errorf("failed to marshal slash packet data: %v", err) - } - bz = append([]byte{slashPacketData}, bz...) - case ccvtypes.VSCMaturedPacketData: - bz, err = data.Marshal() - if err != nil { - return fmt.Errorf("failed to marshal vsc matured packet data: %v", err) - } - bz = append([]byte{vscMaturedPacketData}, bz...) - default: - // Indicates a developer error, this method should only be called - // by tests, QueueThrottledSlashPacketData, or QueueThrottledVSCMaturedPacketData. - panic(fmt.Sprintf("unexpected packet data type: %T", data)) - } - - store.Set(providertypes.ThrottledPacketDataKey(consumerChainID, ibcSeqNum), bz) - return nil -} From 70daf5b304879a9360943c3e5c5703c569be4e3d Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 25 Jul 2024 09:54:23 +0200 Subject: [PATCH 70/81] fix v7 migration --- x/ccv/provider/migrations/v7/legacy_params.go | 21 ------------- .../provider/migrations/v7/migrations_test.go | 2 -- x/ccv/provider/migrations/v8/migrations.go | 31 +++++++++++++------ x/ccv/provider/types/keys.go | 16 +++++----- 4 files changed, 29 insertions(+), 41 deletions(-) diff --git a/x/ccv/provider/migrations/v7/legacy_params.go b/x/ccv/provider/migrations/v7/legacy_params.go index 052b1dbbf0..39c4f65788 100644 --- a/x/ccv/provider/migrations/v7/legacy_params.go +++ b/x/ccv/provider/migrations/v7/legacy_params.go @@ -10,11 +10,6 @@ import ( ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -var ( - KeyInitTimeoutPeriod = []byte("InitTimeoutPeriod") - KeyVscTimeoutPeriod = []byte("VscTimeoutPeriod") -) - // getTemplateClient returns the template client for provider proposals func getTemplateClient(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) *ibctmtypes.ClientState { var cs ibctmtypes.ClientState @@ -37,20 +32,6 @@ func getCCVTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspac return p } -// getInitTimeoutPeriod returns the init timeout period -func getInitTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, KeyInitTimeoutPeriod, &p) - return p -} - -// getVscTimeoutPeriod returns the vsc timeout period -func getVscTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, KeyVscTimeoutPeriod, &p) - return p -} - // getSlashMeterReplenishPeriod returns the period in which: // Once the slash meter becomes not-full, the slash meter is replenished after this period. func getSlashMeterReplenishPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { @@ -93,8 +74,6 @@ func GetParamsLegacy(ctx sdk.Context, paramspace ccvtypes.LegacyParamSubspace) t getTemplateClient(ctx, paramspace), getTrustingPeriodFraction(ctx, paramspace), getCCVTimeoutPeriod(ctx, paramspace), - getInitTimeoutPeriod(ctx, paramspace), - getVscTimeoutPeriod(ctx, paramspace), getSlashMeterReplenishPeriod(ctx, paramspace), getSlashMeterReplenishFraction(ctx, paramspace), getConsumerRewardDenomRegistrationFee(ctx, paramspace), diff --git a/x/ccv/provider/migrations/v7/migrations_test.go b/x/ccv/provider/migrations/v7/migrations_test.go index f4ee763263..4b983205cc 100644 --- a/x/ccv/provider/migrations/v7/migrations_test.go +++ b/x/ccv/provider/migrations/v7/migrations_test.go @@ -23,8 +23,6 @@ func TestMigrateParams(t *testing.T) { inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTemplateClient, defaultParams.TemplateClient) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTrustingPeriodFraction, defaultParams.TrustingPeriodFraction) inMemParams.ParamsSubspace.Set(ctx, ccvtypes.KeyCCVTimeoutPeriod, defaultParams.CcvTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyInitTimeoutPeriod, defaultParams.InitTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyVscTimeoutPeriod, defaultParams.VscTimeoutPeriod) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishPeriod, defaultParams.SlashMeterReplenishPeriod) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishFraction, defaultParams.SlashMeterReplenishFraction) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyConsumerRewardDenomRegistrationFee, defaultParams.ConsumerRewardDenomRegistrationFee) diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index 30dfc6903c..ffffcc2b9b 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -11,10 +11,20 @@ import ( providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) +const ( + LegacyUnbondingOpBytePrefix = 11 + LegacyConsumerAddrsToPruneBytePrefix = 25 + LegacyMaturedUnbondingOpsByteKey = 1 + LegacyUnbondingOpIndexBytePrefix = 12 + LegacyInitTimeoutTimestampBytePrefix = 8 + LegacyVscSendTimestampBytePrefix = 18 + LegacyVSCMaturedHandledThisBlockBytePrefix = 28 +) + // CompleteUnbondingOps completes all unbonding operations. // Note that it must be executed before CleanupState. func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) { - iterator := storetypes.KVStorePrefixIterator(store, []byte{providertypes.UnbondingOpBytePrefix}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{LegacyUnbondingOpBytePrefix}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -28,17 +38,17 @@ func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk provider // MigrateConsumerAddrsToPrune migrates the ConsumerAddrsToPrune index to ConsumerAddrsToPruneV2. // Note: This migration must be done before removing the VscSendTimestamp index func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) { - iterator := storetypes.KVStorePrefixIterator(store, []byte{providertypes.ConsumerAddrsToPruneBytePrefix}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{LegacyConsumerAddrsToPruneBytePrefix}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(providertypes.ConsumerAddrsToPruneBytePrefix, iterator.Key()) + chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, iterator.Key()) if err != nil { pk.Logger(ctx).Error("ParseChainIdAndUintIdKey failed", "key", string(iterator.Key())) continue } // use the VscSendTimestamp index to compute the timestamp after which this consumer address can be pruned - vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(providertypes.VscSendTimestampBytePrefix, chainID, vscID) + vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) var sentTime time.Time if timeBz := store.Get(vscSendTimestampKey); timeBz != nil { if ts, err := sdk.ParseTimeBytes(timeBz); err == nil { @@ -80,12 +90,13 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p // CleanupState removes deprecated state func CleanupState(store storetypes.KVStore) { - removePrefix(store, providertypes.MaturedUnbondingOpsByteKey) - removePrefix(store, providertypes.UnbondingOpBytePrefix) - removePrefix(store, providertypes.UnbondingOpIndexBytePrefix) - removePrefix(store, providertypes.InitTimeoutTimestampBytePrefix) - removePrefix(store, providertypes.VscSendTimestampBytePrefix) - removePrefix(store, providertypes.VSCMaturedHandledThisBlockBytePrefix) + removePrefix(store, LegacyMaturedUnbondingOpsByteKey) + removePrefix(store, LegacyUnbondingOpBytePrefix) + removePrefix(store, LegacyUnbondingOpIndexBytePrefix) + removePrefix(store, LegacyInitTimeoutTimestampBytePrefix) + removePrefix(store, LegacyVscSendTimestampBytePrefix) + removePrefix(store, LegacyVSCMaturedHandledThisBlockBytePrefix) + removePrefix(store, LegacyConsumerAddrsToPruneBytePrefix) } func removePrefix(store storetypes.KVStore, prefix byte) { diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 827c362f9d..6c90c92b48 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -41,7 +41,7 @@ const ( PortKeyName = "PortKey" - DeprecatedMaturedUnbondingOpsKeyName = "MaturedUnbondingOpsKey" + DeprecatedMaturedUnbondingOpsKeyName = "DeprecatedMaturedUnbondingOpsKey" ValidatorSetUpdateIdKeyName = "ValidatorSetUpdateIdKey" @@ -55,15 +55,15 @@ const ( ChainToClientKeyName = "ChainToClientKey" - DeprecatedInitTimeoutTimestampKeyName = "InitTimeoutTimestampKey" + DeprecatedInitTimeoutTimestampKeyName = "DeprecatedInitTimeoutTimestampKey" PendingCAPKeyName = "PendingCAPKey" PendingCRPKeyName = "PendingCRPKey" - DeprecatedUnbondingOpKeyName = "UnbondingOpKey" + DeprecatedUnbondingOpKeyName = "DeprecatedUnbondingOpKey" - DeprecatedUnbondingOpIndexKeyName = "UnbondingOpIndexKey" + DeprecatedUnbondingOpIndexKeyName = "DeprecatedUnbondingOpIndexKey" ValsetUpdateBlockHeightKeyName = "ValsetUpdateBlockHeightKey" @@ -75,7 +75,7 @@ const ( PendingVSCsKeyName = "PendingVSCsKey" - DeprecatedVscSendTimestampKeyName = "VscSendTimestampKey" + DeprecatedVscSendTimestampKeyName = "DeprecatedVscSendTimestampKey" ThrottledPacketDataSizeKeyName = "ThrottledPacketDataSizeKey" @@ -87,15 +87,15 @@ const ( ValidatorsByConsumerAddrKeyName = "ValidatorsByConsumerAddrKey" - DeprecatedKeyAssignmentReplacementsKeyName = "KeyAssignmentReplacementsKey" + DeprecatedKeyAssignmentReplacementsKeyName = "DeprecatedKeyAssignmentReplacementsKey" - DeprecatedConsumerAddrsToPruneKeyName = "ConsumerAddrsToPruneKey" + DeprecatedConsumerAddrsToPruneKeyName = "DeprecatedConsumerAddrsToPruneKey" SlashLogKeyName = "SlashLogKey" ConsumerRewardDenomsKeyName = "ConsumerRewardDenomsKey" - DeprecatedVSCMaturedHandledThisBlockKeyName = "VSCMaturedHandledThisBlockKey" + DeprecatedVSCMaturedHandledThisBlockKeyName = "DeprecatedVSCMaturedHandledThisBlockKey" EquivocationEvidenceMinHeightKeyName = "EquivocationEvidenceMinHeightKey" From 46caa60e1484a4fc34fbd5d3eda60550ed3b013e Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 25 Jul 2024 10:39:06 +0200 Subject: [PATCH 71/81] remove GetBinaryCodec --- x/ccv/provider/keeper/keeper.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 714cfe15ee..7f1e633e24 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -1165,7 +1165,3 @@ func (k Keeper) UnbondingCanComplete(ctx sdk.Context, id uint64) error { func (k Keeper) UnbondingTime(ctx sdk.Context) (time.Duration, error) { return k.stakingKeeper.UnbondingTime(ctx) } - -func (k Keeper) GetBinaryCodec() codec.BinaryCodec { - return k.cdc -} From 2a3f4a6ba83688cda69fc2ca1cc05a8e9a136ec9 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 25 Jul 2024 10:45:41 +0200 Subject: [PATCH 72/81] avoid calling ConsumerAddrsToPruneV2Key twice --- x/ccv/provider/keeper/key_assignment.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 7b7fe0e82d..cd94fe2843 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -250,7 +250,8 @@ func (k Keeper) AppendConsumerAddrsToPrune( consumerAddr types.ConsumerConsAddress, ) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, pruneTs)) + storeKey := types.ConsumerAddrsToPruneV2Key(chainID, pruneTs) + bz := store.Get(storeKey) var consumerAddrsToPrune types.AddressList if bz != nil { err := consumerAddrsToPrune.Unmarshal(bz) @@ -267,7 +268,7 @@ func (k Keeper) AppendConsumerAddrsToPrune( // consumerAddrsToPrune is instantiated in this method and should be able to be marshaled. panic(err) } - store.Set(types.ConsumerAddrsToPruneV2Key(chainID, pruneTs), bz) + store.Set(storeKey, bz) } // GetConsumerAddrsToPrune returns the list of consumer addresses to prune stored under timestamp ts. From 67eb577c20e737698cc8d29eea818ab53bbe0766 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 25 Jul 2024 12:10:42 +0200 Subject: [PATCH 73/81] convert keys prefixes to byte --- x/ccv/provider/migrations/v8/migrations.go | 14 ++--- x/ccv/provider/types/keys_test.go | 70 +++++++++++----------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index ffffcc2b9b..be92c5b046 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -12,13 +12,13 @@ import ( ) const ( - LegacyUnbondingOpBytePrefix = 11 - LegacyConsumerAddrsToPruneBytePrefix = 25 - LegacyMaturedUnbondingOpsByteKey = 1 - LegacyUnbondingOpIndexBytePrefix = 12 - LegacyInitTimeoutTimestampBytePrefix = 8 - LegacyVscSendTimestampBytePrefix = 18 - LegacyVSCMaturedHandledThisBlockBytePrefix = 28 + LegacyUnbondingOpBytePrefix = byte(11) + LegacyConsumerAddrsToPruneBytePrefix = byte(25) + LegacyMaturedUnbondingOpsByteKey = byte(1) + LegacyUnbondingOpIndexBytePrefix = byte(12) + LegacyInitTimeoutTimestampBytePrefix = byte(8) + LegacyVscSendTimestampBytePrefix = byte(18) + LegacyVSCMaturedHandledThisBlockBytePrefix = byte(28) ) // CompleteUnbondingOps completes all unbonding operations. diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index baccbdb7f9..cf97c79ad7 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -27,91 +27,91 @@ func TestNoDuplicates(t *testing.T) { // Test that the value of all byte prefixes is preserved func TestPreserveBytePrefix(t *testing.T) { i := 0 - require.Equal(t, uint8(0xFF), providertypes.ParametersKey()[0]) + require.Equal(t, byte(0xFF), providertypes.ParametersKey()[0]) i++ - require.Equal(t, uint8(0), providertypes.PortKey()[0]) + require.Equal(t, byte(0), providertypes.PortKey()[0]) i++ // reserve 1 as deprecated i++ - require.Equal(t, uint8(2), providertypes.ValidatorSetUpdateIdKey()[0]) + require.Equal(t, byte(2), providertypes.ValidatorSetUpdateIdKey()[0]) i++ - require.Equal(t, uint8(3), providertypes.SlashMeterKey()[0]) + require.Equal(t, byte(3), providertypes.SlashMeterKey()[0]) i++ - require.Equal(t, uint8(4), providertypes.SlashMeterReplenishTimeCandidateKey()[0]) + require.Equal(t, byte(4), providertypes.SlashMeterReplenishTimeCandidateKey()[0]) i++ - require.Equal(t, uint8(5), providertypes.ChainToChannelKey("chainID")[0]) + require.Equal(t, byte(5), providertypes.ChainToChannelKey("chainID")[0]) i++ - require.Equal(t, uint8(6), providertypes.ChannelToChainKeyPrefix()[0]) + require.Equal(t, byte(6), providertypes.ChannelToChainKeyPrefix()[0]) i++ - require.Equal(t, uint8(7), providertypes.ChainToClientKeyPrefix()[0]) + require.Equal(t, byte(7), providertypes.ChainToClientKeyPrefix()[0]) i++ // reserve 8 as deprecated i++ - require.Equal(t, uint8(9), providertypes.PendingCAPKeyPrefix()[0]) + require.Equal(t, byte(9), providertypes.PendingCAPKeyPrefix()[0]) i++ - require.Equal(t, uint8(10), providertypes.PendingCRPKeyPrefix()[0]) + require.Equal(t, byte(10), providertypes.PendingCRPKeyPrefix()[0]) i++ // reserve 11 as deprecated i++ // reserve 12 as deprecated i++ - require.Equal(t, uint8(13), providertypes.ValsetUpdateBlockHeightKeyPrefix()[0]) + require.Equal(t, byte(13), providertypes.ValsetUpdateBlockHeightKeyPrefix()[0]) i++ - require.Equal(t, uint8(14), providertypes.ConsumerGenesisKey("chainID")[0]) + require.Equal(t, byte(14), providertypes.ConsumerGenesisKey("chainID")[0]) i++ - require.Equal(t, uint8(15), providertypes.SlashAcksKey("chainID")[0]) + require.Equal(t, byte(15), providertypes.SlashAcksKey("chainID")[0]) i++ - require.Equal(t, uint8(16), providertypes.InitChainHeightKey("chainID")[0]) + require.Equal(t, byte(16), providertypes.InitChainHeightKey("chainID")[0]) i++ - require.Equal(t, uint8(17), providertypes.PendingVSCsKey("chainID")[0]) + require.Equal(t, byte(17), providertypes.PendingVSCsKey("chainID")[0]) i++ // reserve 18 as deprecated i++ - require.Equal(t, uint8(19), providertypes.ThrottledPacketDataSizeKey("chainID")[0]) + require.Equal(t, byte(19), providertypes.ThrottledPacketDataSizeKey("chainID")[0]) i++ - require.Equal(t, uint8(20), providertypes.ThrottledPacketDataKeyPrefix()) + require.Equal(t, byte(20), providertypes.ThrottledPacketDataKeyPrefix()) i++ - require.Equal(t, uint8(21), providertypes.GlobalSlashEntryKeyPrefix()[0]) + require.Equal(t, byte(21), providertypes.GlobalSlashEntryKeyPrefix()[0]) i++ - require.Equal(t, uint8(22), providertypes.ConsumerValidatorsKeyPrefix()) + require.Equal(t, byte(22), providertypes.ConsumerValidatorsKeyPrefix()) i++ - require.Equal(t, uint8(23), providertypes.ValidatorsByConsumerAddrKeyPrefix()) + require.Equal(t, byte(23), providertypes.ValidatorsByConsumerAddrKeyPrefix()) i++ // reserve 24 as deprecated i++ // reserve 25 as deprecated i++ - require.Equal(t, uint8(26), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05}))[0]) + require.Equal(t, byte(26), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05}))[0]) i++ - require.Equal(t, uint8(27), providertypes.ConsumerRewardDenomsKeyPrefix()[0]) + require.Equal(t, byte(27), providertypes.ConsumerRewardDenomsKeyPrefix()[0]) i++ // reserve 28 as deprecated i++ - require.Equal(t, uint8(29), providertypes.EquivocationEvidenceMinHeightKey("chainID")[0]) + require.Equal(t, byte(29), providertypes.EquivocationEvidenceMinHeightKey("chainID")[0]) i++ - require.Equal(t, uint8(30), providertypes.ProposedConsumerChainKeyPrefix()[0]) + require.Equal(t, byte(30), providertypes.ProposedConsumerChainKeyPrefix()[0]) i++ - require.Equal(t, uint8(31), providertypes.ConsumerValidatorKeyPrefix()) + require.Equal(t, byte(31), providertypes.ConsumerValidatorKeyPrefix()) i++ - require.Equal(t, uint8(32), providertypes.OptedInKeyPrefix()) + require.Equal(t, byte(32), providertypes.OptedInKeyPrefix()) i++ - require.Equal(t, uint8(33), providertypes.TopNKey("chainID")[0]) + require.Equal(t, byte(33), providertypes.TopNKey("chainID")[0]) i++ - require.Equal(t, uint8(34), providertypes.ValidatorsPowerCapKey("chainID")[0]) + require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("chainID")[0]) i++ - require.Equal(t, uint8(35), providertypes.ValidatorSetCapKey("chainID")[0]) + require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("chainID")[0]) i++ - require.Equal(t, uint8(36), providertypes.AllowlistKeyPrefix()) + require.Equal(t, byte(36), providertypes.AllowlistKeyPrefix()) i++ - require.Equal(t, uint8(37), providertypes.DenylistKeyPrefix()) + require.Equal(t, byte(37), providertypes.DenylistKeyPrefix()) i++ - require.Equal(t, uint8(38), providertypes.ConsumerRewardsAllocationKey("chainID")[0]) + require.Equal(t, byte(38), providertypes.ConsumerRewardsAllocationKey("chainID")[0]) i++ - require.Equal(t, uint8(39), providertypes.ConsumerCommissionRateKeyPrefix()) + require.Equal(t, byte(39), providertypes.ConsumerCommissionRateKeyPrefix()) i++ - require.Equal(t, uint8(40), providertypes.MinimumPowerInTopNKey("chainID")[0]) + require.Equal(t, byte(40), providertypes.MinimumPowerInTopNKey("chainID")[0]) i++ - require.Equal(t, uint8(41), providertypes.ConsumerAddrsToPruneV2KeyPrefix()) + require.Equal(t, byte(41), providertypes.ConsumerAddrsToPruneV2KeyPrefix()) i++ prefixes := providertypes.GetAllKeyPrefixes() require.Equal(t, len(prefixes), i) From 64f064cb0784841a695d587ebff4caa76fe1536a Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 26 Jul 2024 10:04:56 +0200 Subject: [PATCH 74/81] add changelog entries --- .../api-breaking/provider/2098-vscmatured-removal.md | 7 +++++++ .../features/provider/2098-vscmatured-removal.md | 8 ++++++++ .../state-breaking/provider/2098-vscmatured-removal.md | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 .changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md create mode 100644 .changelog/unreleased/features/provider/2098-vscmatured-removal.md create mode 100644 .changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md diff --git a/.changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md b/.changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md new file mode 100644 index 0000000000..b5bb3ff5cc --- /dev/null +++ b/.changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md @@ -0,0 +1,7 @@ +- The removal of `VSCMaturedPackets` entail several API breaking changes. + ([\#2098](https://github.com/cosmos/interchain-security/pull/2098)) + + - Remove the `oldest_unconfirmed_vsc` query -- used to get + the send timestamp of the oldest unconfirmed VSCPacket. + - Deprecate the `init_timeout_period` and `vsc_timeout_period` parameters + from the provider module. diff --git a/.changelog/unreleased/features/provider/2098-vscmatured-removal.md b/.changelog/unreleased/features/provider/2098-vscmatured-removal.md new file mode 100644 index 0000000000..aa370d81d2 --- /dev/null +++ b/.changelog/unreleased/features/provider/2098-vscmatured-removal.md @@ -0,0 +1,8 @@ +- Remove `VSCMaturedPackets` from the provider module, which entails the following + changes to the provider. + ([\#2098](https://github.com/cosmos/interchain-security/pull/2098)) + + - Remove unbonding operations pausing. + - Remove the CCV channel initialization timeout. + - Remove `VSCPackets` timeout. + - Redesign key assignment pruning -- prune old consumer keys after the unbonding period elapses. diff --git a/.changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md b/.changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md new file mode 100644 index 0000000000..bc2dc743c2 --- /dev/null +++ b/.changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md @@ -0,0 +1,2 @@ +- Remove `VSCMaturedPackets` from the provider module. + ([\#2098](https://github.com/cosmos/interchain-security/pull/2098)) From f6dd4488df8d85a1c13b841feed9bfb0d62919de Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 26 Jul 2024 10:11:28 +0200 Subject: [PATCH 75/81] update docs --- docs/docs/introduction/params.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/docs/docs/introduction/params.md b/docs/docs/introduction/params.md index 8d917b3070..3b52e772ab 100644 --- a/docs/docs/introduction/params.md +++ b/docs/docs/introduction/params.md @@ -61,21 +61,6 @@ CCVTimeoutPeriod may have different values on the provider and consumer chains. - `CCVTimeoutPeriod` on the provider **must** be larger than `ConsumerUnbondingPeriod` - `CCVTimeoutPeriod` on the consumer is initial set via the `ConsumerAdditionProposal` -### InitTimeoutPeriod -`InitTimeoutPeriod` is the maximum allowed duration for CCV channel initialization to execute. - -For any consumer chain, if the CCV channel is not established within `InitTimeoutPeriod` then the consumer chain will be removed and therefore will not be secured by the provider chain. - -The countdown starts when the `spawn_time` specified in the `ConsumerAdditionProposal` is reached. - -### VscTimeoutPeriod -`VscTimeoutPeriod` is the provider-side param that enables the provider to timeout VSC packets even when a consumer chain is not live. -If the `VscTimeoutPeriod` is ever reached for a consumer chain that chain will be considered not live and removed from interchain security. - -:::tip -`VscTimeoutPeriod` MUST be larger than the `ConsumerUnbondingPeriod`. -::: - ### BlocksPerDistributionTransmission `BlocksPerDistributionTransmission` is the number of blocks between rewards transfers from the consumer to the provider. From 67fe4d15b4a4f3040a0b58ab1518bb6fb61f543c Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 26 Jul 2024 10:14:47 +0200 Subject: [PATCH 76/81] remove duplicate event type --- x/ccv/types/events.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index 4c597ded56..3c63fd7954 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -15,7 +15,6 @@ const ( EventTypeExecuteConsumerChainSlash = "execute_consumer_chain_slash" EventTypeFeeDistribution = "fee_distribution" EventTypeConsumerSlashRequest = "consumer_slash_request" - EventTypeVSCMatured = "vsc_matured" AttributeKeyAckSuccess = "success" AttributeKeyAck = "acknowledgement" From 42cb3ad8efd4488c6602e696eb9fb5f04f6ecc67 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 26 Jul 2024 10:17:49 +0200 Subject: [PATCH 77/81] revert changes to test.yml --- .github/workflows/test.yml | 85 +++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54d9283371..9f283ee3d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,11 +53,11 @@ jobs: if: env.GIT_DIFF run: | make test-unit-cov - # - uses: actions/upload-artifact@v4 - # if: env.GIT_DIFF - # with: - # name: "${{ github.sha }}-coverage" - # path: ./profile.out + - uses: actions/upload-artifact@v4 + if: env.GIT_DIFF + with: + name: "${{ github.sha }}-coverage" + path: ./profile.out test-integration: runs-on: Gaia-Runner-medium @@ -84,11 +84,45 @@ jobs: if: env.GIT_DIFF run: | make test-integration-cov - # - uses: actions/upload-artifact@v4 - # if: env.GIT_DIFF - # with: - # name: "${{ github.sha }}-integration-coverage" - # path: ./integration-profile.out + - uses: actions/upload-artifact@v4 + if: env.GIT_DIFF + with: + name: "${{ github.sha }}-integration-coverage" + path: ./integration-profile.out + + repo-analysis: + runs-on: ubuntu-latest + needs: [tests, test-integration] + steps: + - uses: actions/checkout@v4 + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + **/*.go + go.mod + go.sum + **/go.mod + **/go.sum + - uses: actions/download-artifact@v4 + if: env.GIT_DIFF + with: + name: "${{ github.sha }}-coverage" + - uses: actions/download-artifact@v4 + if: env.GIT_DIFF + with: + name: "${{ github.sha }}-integration-coverage" + - uses: actions/download-artifact@v4 + if: env.GIT_DIFF + with: + name: "${{ github.sha }}-mbt-coverage" + continue-on-error: true + - name: sonarcloud + if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }} + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} test-e2e: runs-on: Gaia-Runner-medium @@ -121,6 +155,37 @@ jobs: run: | make test-e2e-short + test-e2e-compatibility: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - name: checkout LFS objects + run: git lfs checkout + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + check-latest: true + cache: true + cache-dependency-path: go.sum + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + **/*.go + go.mod + go.sum + **/go.mod + **/go.sum + **/Makefile + Makefile + Dockerfile* + - name: e2e compatibility tests + if: env.GIT_DIFF + run: | + make test-e2e-compatibility-tests-latest + model-analysis: runs-on: ubuntu-latest steps: From 80e90f8d2902d2a74ed1dab8ebb82592af9aa960 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 26 Jul 2024 10:26:57 +0200 Subject: [PATCH 78/81] apply review suggestions --- x/ccv/provider/keeper/key_assignment.go | 14 +++++++++++--- x/ccv/provider/keeper/key_assignment_test.go | 9 +++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index cd94fe2843..23dd20109d 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -318,10 +318,14 @@ func (k Keeper) ConsumeConsumerAddrsToPrune( if _, pruneTs, err := types.ParseChainIdAndTsKey(consumerAddrsToPruneKeyPrefix, iterator.Key()); err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. - panic(err) + k.Logger(ctx).Error("ParseChainIdAndTsKey failed", + "key", string(iterator.Key()), + "error", err.Error(), + ) + continue } else if pruneTs.After(ts) { // An error here would indicate something is wrong the iterator - k.Logger(ctx).Error("iterator in GetConsumerAddrsToPrune failed", "key", string(iterator.Key())) + k.Logger(ctx).Error("iterator in ConsumeConsumerAddrsToPrune failed", "key", string(iterator.Key())) continue } @@ -331,7 +335,11 @@ func (k Keeper) ConsumeConsumerAddrsToPrune( if err := addrs.Unmarshal(iterator.Value()); err != nil { // An error here would indicate something is very wrong, // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPrune. - panic(err) + k.Logger(ctx).Error("unmarshaling in ConsumeConsumerAddrsToPrune failed", + "key", string(iterator.Key()), + "error", err.Error(), + ) + continue } consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, addrs.Addresses...) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 50bc351ec2..159f9891ae 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -225,15 +225,16 @@ func TestConsumerAddrsToPruneCRUD(t *testing.T) { keeper.AppendConsumerAddrsToPrune(ctx, chainID, ts1, consumerAddr1) - addrsToPrune = keeper.ConsumeConsumerAddrsToPrune(ctx, chainID, ts2).Addresses + addrsToPrune = keeper.ConsumeConsumerAddrsToPrune(ctx, chainID, ts1).Addresses require.NotEmpty(t, addrsToPrune, "addresses to prune was returned") - require.Len(t, addrsToPrune, 2, "addresses to prune is not len 2") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") require.Equal(t, addrsToPrune[0], consumerAddr1.ToSdkConsAddr().Bytes()) - require.Equal(t, addrsToPrune[1], consumerAddr2.ToSdkConsAddr().Bytes()) addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses require.Empty(t, addrsToPrune, "addresses to prune was returned") addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts2).Addresses - require.Empty(t, addrsToPrune, "addresses to prune was returned") + require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") + require.Equal(t, addrsToPrune[0], consumerAddr2.ToSdkConsAddr().Bytes()) } func TestGetAllConsumerAddrsToPrune(t *testing.T) { From 7846cbb1cc7b597e59e0a81104522e72a52b2362 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 26 Jul 2024 10:40:10 +0200 Subject: [PATCH 79/81] apply minor changes --- docs/docs/adrs/adr-018-remove-vscmatured.md | 2 +- x/ccv/provider/migrations/v8/migrations.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md index e2359d5e94..9a1b5b736e 100644 --- a/docs/docs/adrs/adr-018-remove-vscmatured.md +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -155,7 +155,7 @@ Note that these removals require state migration. To stop the consumer chains from sending `VSCMaturedPackets`, it is sufficient to not store the maturity time of `VSCPacket`s when receiving them, i.e., do not call `SetPacketMaturityTime` from the `OnRecvVSCPacket()` method. Note that eventually, no additional `VSCMaturedPackets` will be added to the sending queue as `QueueVSCMaturedPackets` iterates over elapsed maturity times. -In addition, to cleanup the code, the `QueueVSCMaturedPackets` must be removed. +In addition, to clean up the code, the `QueueVSCMaturedPackets` must be removed. #### Messages diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index be92c5b046..baa8d1731b 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -25,7 +25,11 @@ const ( // Note that it must be executed before CleanupState. func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) { iterator := storetypes.KVStorePrefixIterator(store, []byte{LegacyUnbondingOpBytePrefix}) - defer iterator.Close() + defer func() { + if err := iterator.Close(); err != nil { + pk.Logger(ctx).Error("Failed to close iterator", "error", err) + } + }() for ; iterator.Valid(); iterator.Next() { id := binary.BigEndian.Uint64(iterator.Key()[1:]) @@ -44,7 +48,10 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p for ; iterator.Valid(); iterator.Next() { chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, iterator.Key()) if err != nil { - pk.Logger(ctx).Error("ParseChainIdAndUintIdKey failed", "key", string(iterator.Key())) + pk.Logger(ctx).Error("ParseChainIdAndUintIdKey failed while migrating ConsumerAddrsToPrune", + "key", string(iterator.Key()), + "error", err.Error(), + ) continue } // use the VscSendTimestamp index to compute the timestamp after which this consumer address can be pruned From eafb76f6c6a80907acbf817a417e9805b15d430c Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 26 Jul 2024 12:30:25 +0200 Subject: [PATCH 80/81] add test for MigrateConsumerAddrsToPrune --- app/provider/app.go | 6 +- x/ccv/provider/ibc_module_test.go | 8 +- x/ccv/provider/migrations/migrator.go | 18 ++- x/ccv/provider/migrations/v8/migrations.go | 18 +-- .../provider/migrations/v8/migrations_test.go | 140 ++++++++++++++++++ x/ccv/provider/module.go | 14 +- x/ccv/provider/module_test.go | 2 +- 7 files changed, 182 insertions(+), 24 deletions(-) create mode 100644 x/ccv/provider/migrations/v8/migrations_test.go diff --git a/app/provider/app.go b/app/provider/app.go index 23262161b4..4867b6368c 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -505,7 +505,11 @@ func New( govtypes.NewMultiGovHooks(app.ProviderKeeper.Hooks()), ) - providerModule := ibcprovider.NewAppModule(&app.ProviderKeeper, app.GetSubspace(providertypes.ModuleName)) + providerModule := ibcprovider.NewAppModule( + &app.ProviderKeeper, + app.GetSubspace(providertypes.ModuleName), + keys[providertypes.StoreKey], + ) app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index fdae2a03ba..58573d3e3b 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -31,7 +31,7 @@ func TestOnChanOpenInit(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx( t, keeperParams) defer ctrl.Finish() - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) // OnChanOpenInit must error for provider even with correct arguments _, err := providerModule.OnChanOpenInit( @@ -119,7 +119,7 @@ func TestOnChanOpenTry(t *testing.T) { keeperParams := testkeeper.NewInMemKeeperParams(t) providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx( t, keeperParams) - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) providerKeeper.SetPort(ctx, ccv.ProviderPortID) providerKeeper.SetConsumerClientId(ctx, "consumerChainID", "clientIDToConsumer") @@ -190,7 +190,7 @@ func TestOnChanOpenAck(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx( t, keeperParams) defer ctrl.Finish() - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) // OnChanOpenAck must error for provider even with correct arguments err := providerModule.OnChanOpenAck( @@ -312,7 +312,7 @@ func TestOnChanOpenConfirm(t *testing.T) { providerKeeper.SetChainToChannel(ctx, "consumerChainID", "existingChannelID") } - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) err := providerModule.OnChanOpenConfirm(ctx, "providerPortID", "channelID") diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index c349590922..4678fe83cd 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -4,7 +4,6 @@ import ( "fmt" storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -20,13 +19,20 @@ import ( type Migrator struct { providerKeeper providerkeeper.Keeper paramSpace paramtypes.Subspace - cdc codec.BinaryCodec storeKey storetypes.StoreKey } // NewMigrator returns a new Migrator. -func NewMigrator(providerKeeper providerkeeper.Keeper, paramSpace paramtypes.Subspace) Migrator { - return Migrator{providerKeeper: providerKeeper, paramSpace: paramSpace} +func NewMigrator( + providerKeeper providerkeeper.Keeper, + paramSpace paramtypes.Subspace, + storeKey storetypes.StoreKey, +) Migrator { + return Migrator{ + providerKeeper: providerKeeper, + paramSpace: paramSpace, + storeKey: storeKey, + } } // Migrating consensus version 1 to 2 is a no-op. @@ -83,7 +89,9 @@ func (m Migrator) Migrate6to7(ctx sdktypes.Context) error { func (m Migrator) Migrate7to8(ctx sdktypes.Context) error { store := ctx.KVStore(m.storeKey) v8.CompleteUnbondingOps(ctx, store, m.providerKeeper) - v8.MigrateConsumerAddrsToPrune(ctx, store, m.providerKeeper) + if err := v8.MigrateConsumerAddrsToPrune(ctx, store, m.providerKeeper); err != nil { + return err + } v8.CleanupState(store) return nil diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index baa8d1731b..cdf299f91f 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -41,10 +41,15 @@ func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk provider // MigrateConsumerAddrsToPrune migrates the ConsumerAddrsToPrune index to ConsumerAddrsToPruneV2. // Note: This migration must be done before removing the VscSendTimestamp index -func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) { +func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) error { iterator := storetypes.KVStorePrefixIterator(store, []byte{LegacyConsumerAddrsToPruneBytePrefix}) defer iterator.Close() + unbondingPeriod, err := pk.UnbondingTime(ctx) + if err != nil { + return err + } + for ; iterator.Valid(); iterator.Next() { chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, iterator.Key()) if err != nil { @@ -72,14 +77,7 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p ) continue } - unbondingPeriod, err := pk.UnbondingTime(ctx) - if err != nil { - pk.Logger(ctx).Error( - "MigrateConsumerAddrsToPrune cannot get unbonding period from staking module", - ) - continue - } - pruneAfterTs := sentTime.Add(unbondingPeriod) + pruneAfterTs := sentTime.Add(unbondingPeriod).UTC() var addrs providertypes.AddressList err = addrs.Unmarshal(iterator.Value()) @@ -93,6 +91,8 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p pk.AppendConsumerAddrsToPrune(ctx, chainID, pruneAfterTs, consumerAddr) } } + + return nil } // CleanupState removes deprecated state diff --git a/x/ccv/provider/migrations/v8/migrations_test.go b/x/ccv/provider/migrations/v8/migrations_test.go new file mode 100644 index 0000000000..8c23fccc64 --- /dev/null +++ b/x/ccv/provider/migrations/v8/migrations_test.go @@ -0,0 +1,140 @@ +package v8 + +import ( + "testing" + "time" + + "github.com/golang/mock/gomock" + + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/stretchr/testify/require" +) + +func legacyConsumerAddrsToPruneKey(chainID string, vscID uint64) []byte { + return providertypes.ChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, chainID, vscID) +} + +func legacyAppendConsumerAddrsToPrune( + store storetypes.KVStore, + chainID string, + vscID uint64, + consumerAddr providertypes.ConsumerConsAddress, +) { + bz := store.Get(legacyConsumerAddrsToPruneKey(chainID, vscID)) + var consumerAddrsToPrune providertypes.AddressList + if bz != nil { + err := consumerAddrsToPrune.Unmarshal(bz) + if err != nil { + // An error here would indicate something is very wrong, + // the data bytes are assumed to be correctly serialized by previous calls to this method. + panic(err) + } + } + consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, consumerAddr.ToSdkConsAddr()) + bz, err := consumerAddrsToPrune.Marshal() + if err != nil { + // An error here would indicate something is very wrong, + // consumerAddrsToPrune is instantiated in this method and should be able to be marshaled. + panic(err) + } + store.Set(legacyConsumerAddrsToPruneKey(chainID, vscID), bz) +} + +func legacyVscSendingTimestampKey(chainID string, vscID uint64) []byte { + return providertypes.ChainIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) +} + +func legacySetVscSendTimestamp( + store storetypes.KVStore, + chainID string, + vscID uint64, + timestamp time.Time, +) { + // Convert timestamp into bytes for storage + timeBz := sdk.FormatTimeBytes(timestamp) + + store.Set(legacyVscSendingTimestampKey(chainID, vscID), timeBz) +} + +func TestMigrateConsumerAddrsToPrune(t *testing.T) { + t.Helper() + inMemParams := testutil.NewInMemKeeperParams(t) + pk, ctx, ctrl, mocks := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + store := ctx.KVStore(inMemParams.StoreKey) + + consumerAddrsToPrune := []struct { + chainId string + vscId uint64 + address providertypes.ConsumerConsAddress + }{ + {"chain-1", 1, providertypes.NewConsumerConsAddress([]byte{0x01})}, + {"chain-1", 1, providertypes.NewConsumerConsAddress([]byte{0x02})}, + {"chain-2", 1, providertypes.NewConsumerConsAddress([]byte{0x03})}, + {"chain-1", 2, providertypes.NewConsumerConsAddress([]byte{0x04})}, + {"chain-1", 3, providertypes.NewConsumerConsAddress([]byte{0x05})}, + } + for _, x := range consumerAddrsToPrune { + legacyAppendConsumerAddrsToPrune(store, x.chainId, x.vscId, x.address) + } + + ts1 := time.Now().UTC() + ts2 := ts1.Add(time.Minute).UTC() + ts3 := ts2.Add(time.Hour).UTC() + vscSendTimestamps := []struct { + chainId string + vscId uint64 + ts time.Time + }{ + {"chain-1", 1, ts1}, + {"chain-1", 2, ts2}, + {"chain-1", 3, ts3}, + {"chain-2", 1, ts1}, + } + for _, x := range vscSendTimestamps { + legacySetVscSendTimestamp(store, x.chainId, x.vscId, x.ts) + } + + gomock.InOrder( + mocks.MockStakingKeeper.EXPECT().UnbondingTime(ctx).Times(2), + ) + + unbondingPeriod, err := pk.UnbondingTime(ctx) + require.NoError(t, err) + + err = MigrateConsumerAddrsToPrune(ctx, store, pk) + require.NoError(t, err) + + consumerAddrs := pk.GetAllConsumerAddrsToPrune(ctx, "chain-1") + require.Len(t, consumerAddrs, 3) + // two addresses with ts1 + require.Equal(t, ts1.Add(unbondingPeriod).UTC(), consumerAddrs[0].PruneTs) + require.Len(t, consumerAddrs[0].ConsumerAddrs.Addresses, 2) + consumerAddr := providertypes.NewConsumerConsAddress(consumerAddrs[0].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[0].address, consumerAddr) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[0].ConsumerAddrs.Addresses[1]) + require.Equal(t, consumerAddrsToPrune[1].address, consumerAddr) + // one address with ts2 + require.Equal(t, ts2.Add(unbondingPeriod).UTC(), consumerAddrs[1].PruneTs) + require.Len(t, consumerAddrs[1].ConsumerAddrs.Addresses, 1) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[1].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[3].address, consumerAddr) + // one address with ts3 + require.Equal(t, ts3.Add(unbondingPeriod).UTC(), consumerAddrs[2].PruneTs) + require.Len(t, consumerAddrs[2].ConsumerAddrs.Addresses, 1) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[2].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[4].address, consumerAddr) + + consumerAddrs = pk.GetAllConsumerAddrsToPrune(ctx, "chain-2") + require.Len(t, consumerAddrs, 1) + // one address with ts1 + require.Equal(t, ts1.Add(unbondingPeriod).UTC(), consumerAddrs[0].PruneTs) + require.Len(t, consumerAddrs[0].ConsumerAddrs.Addresses, 1) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[0].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[2].address, consumerAddr) + +} diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 7b0d0c8511..c8e646ded9 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -9,6 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -101,13 +102,15 @@ type AppModule struct { AppModuleBasic keeper *keeper.Keeper paramSpace paramtypes.Subspace + storeKey storetypes.StoreKey } // NewAppModule creates a new provider module -func NewAppModule(k *keeper.Keeper, paramSpace paramtypes.Subspace) AppModule { +func NewAppModule(k *keeper.Keeper, paramSpace paramtypes.Subspace, storeKey storetypes.StoreKey) AppModule { return AppModule{ keeper: k, paramSpace: paramSpace, + storeKey: storeKey, } } @@ -121,7 +124,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { providertypes.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) providertypes.RegisterQueryServer(cfg.QueryServer(), am.keeper) - migrator := migrations.NewMigrator(*am.keeper, am.paramSpace) + migrator := migrations.NewMigrator(*am.keeper, am.paramSpace, am.storeKey) if err := cfg.RegisterMigration(providertypes.ModuleName, 2, migrator.Migrate2to3); err != nil { panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 2 -> 3", providertypes.ModuleName, err)) } @@ -132,10 +135,13 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 4 -> 5", providertypes.ModuleName, err)) } if err := cfg.RegisterMigration(providertypes.ModuleName, 5, migrator.Migrate5to6); err != nil { - panic(fmt.Sprintf("failed to register migrator for %s: %s", providertypes.ModuleName, err)) + panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 5 -> 6", providertypes.ModuleName, err)) } if err := cfg.RegisterMigration(providertypes.ModuleName, 6, migrator.Migrate6to7); err != nil { - panic(fmt.Sprintf("failed to register migrator for %s: %s", providertypes.ModuleName, err)) + panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 6 -> 7", providertypes.ModuleName, err)) + } + if err := cfg.RegisterMigration(providertypes.ModuleName, 7, migrator.Migrate7to8); err != nil { + panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 7 -> 8", providertypes.ModuleName, err)) } } diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 253d2adb16..b6a2e1e1be 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -95,7 +95,7 @@ func TestInitGenesis(t *testing.T) { keeperParams := testkeeper.NewInMemKeeperParams(t) providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - appModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + appModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) genState := types.NewGenesisState( providerKeeper.GetValidatorSetUpdateId(ctx), nil, From fa759e173212b41d0376b2d67228db93ae20e8db Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 30 Jul 2024 10:36:32 +0200 Subject: [PATCH 81/81] apply review suggestion --- x/ccv/provider/keeper/key_assignment_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 159f9891ae..910d008ec9 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -814,7 +814,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { } // Set the unbonding time to 60s so that a key is prunable after 60s - unbondingTimeInNs := time.Duration(60 * 1_000_000_000) // 60 seconds + unbondingTimeInNs := 60 * time.Second // 60 seconds mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeInNs, nil).AnyTimes() // The consumer chain has not yet been registered