diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 1bbdee1498..3859f6b7d0 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -76,27 +76,3 @@ message ValsetUpdateIdToHeight { uint64 valset_update_id = 1; uint64 height = 2; } - -// Used to serialize the ValidatorConsumerPubKey index from key assignment -// ValidatorConsumerPubKey: (chainID, providerAddr consAddr) -> consumerKey tmprotocrypto.PublicKey -message ValidatorConsumerPubKey { - string chain_id = 1; - bytes provider_addr = 2; - tendermint.crypto.PublicKey consumer_key = 3; -} - -// Used to serialize the ValidatorConsumerAddr index from key assignment -// ValidatorByConsumerAddr: (chainID, consumerAddr consAddr) -> providerAddr consAddr -message ValidatorByConsumerAddr { - string chain_id = 1; - bytes consumer_addr = 2; - bytes provider_addr = 3; -} - -// Used to serialize the ConsumerAddrsToPrune index from key assignment -// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList -message ConsumerAddrsToPrune { - string chain_id = 1; - uint64 vsc_id = 2; - AddressList consumer_addrs = 3; -} \ No newline at end of file diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 16f3a7bff6..0f3e4f3c9f 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -104,7 +104,7 @@ message GlobalSlashEntry { // This field is used to obtain validator power in HandleThrottleQueues. // // This field is not used in the store key, but is persisted in value bytes, see QueueGlobalSlashEntry. - bytes provider_val_cons_addr = 4; + ProviderConsAddress provider_val_cons_addr = 4; } // Params defines the parameters for CCV Provider module @@ -143,7 +143,7 @@ message HandshakeMetadata { string version = 2; } -// SlashAcks contains addesses of consumer chain validators +// SlashAcks contains cons addresses of consumer chain validators // successfully slashed on the provider chain message SlashAcks { repeated string addresses = 1; @@ -161,11 +161,6 @@ message ConsumerRemovalProposals { repeated ConsumerRemovalProposal pending = 1; } -// AddressList contains a list of consensus addresses -message AddressList { - repeated bytes addresses = 1; -} - message ChannelToChain { string channel_id = 1; string chain_id = 2; @@ -196,9 +191,57 @@ message VscSendTimestamp { google.protobuf.Timestamp timestamp = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } +// +// Key assignment section +// + +// A validator's assigned consensus address for a consumer chain. +// Note this type is for type safety within provider code, consumer code uses normal sdk.ConsAddress, +// since there's no notion of provider vs consumer address. +message ConsumerConsAddress { + // Do not generate stringer for this type, we'll use sdk.ConsAddress.String() instead + option (gogoproto.goproto_stringer) = false; + bytes address = 1; +} + +// A validator's consensus address on the provider chain +message ProviderConsAddress { + // Do not generate stringer for this type, we'll use sdk.ConsAddress.String() instead + option (gogoproto.goproto_stringer) = false; + bytes address = 1; +} + +// ConsumerAddressList contains a list of consumer consensus addresses +message ConsumerAddressList { + repeated ConsumerConsAddress addresses = 1; +} + message KeyAssignmentReplacement { - bytes provider_addr = 1; + ProviderConsAddress provider_addr = 1; tendermint.crypto.PublicKey prev_c_key = 2; int64 power = 3; } +// Used to serialize the ValidatorConsumerPubKey index from key assignment +// ValidatorConsumerPubKey: (chainID, providerAddr consAddr) -> consumerKey tmprotocrypto.PublicKey +message ValidatorConsumerPubKey { + string chain_id = 1; + ProviderConsAddress provider_addr = 2; + tendermint.crypto.PublicKey consumer_key = 3; +} + +// Used to serialize the ValidatorConsumerAddr index from key assignment +// ValidatorByConsumerAddr: (chainID, consumerAddr consAddr) -> providerAddr consAddr +message ValidatorByConsumerAddr { + string chain_id = 1; + ConsumerConsAddress consumer_addr = 2; + ProviderConsAddress provider_addr = 3; +} + +// Used to serialize the ConsumerAddrsToPrune index from key assignment +// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList +message ConsumerAddrsToPrune { + string chain_id = 1; + uint64 vsc_id = 2; + ConsumerAddressList consumer_addrs = 3; +} diff --git a/tests/e2e/slashing.go b/tests/e2e/slashing.go index f59bb30e6c..97f161607e 100644 --- a/tests/e2e/slashing.go +++ b/tests/e2e/slashing.go @@ -14,13 +14,14 @@ import ( clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" keepertestutil "github.com/cosmos/interchain-security/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" tmtypes "github.com/tendermint/tendermint/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/ed25519" ) -// TestRelayAndApplySlashPacket tests that downtime slash packets can be properly relayed +// TestRelayAndApplyDowntimePacket tests that downtime slash packets can be properly relayed // from consumer to provider, handled by provider, with a VSC and jailing // eventually effective on consumer and provider. // @@ -45,7 +46,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().NoError(err) pubkey, err := cryptocodec.FromTmProtoPublicKey(val.GetPubKey()) s.Require().Nil(err) - consumerConsAddr := sdk.GetConsAddress(pubkey) + consumerConsAddr := providertypes.NewConsumerConsAddress(sdk.GetConsAddress(pubkey)) // map consumer consensus address to provider consensus address providerConsAddr, found := providerKeeper.GetValidatorByConsumerAddr( s.providerCtx(), @@ -54,7 +55,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { ) s.Require().True(found) - stakingVal, found := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr) + stakingVal, found := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr.ToSdkConsAddr()) s.Require().True(found) valOldBalance := stakingVal.Tokens @@ -72,7 +73,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().NoError(err) // Set outstanding slashing flag for first consumer, it's important to use the consumer's cons addr here - firstConsumerKeeper.SetOutstandingDowntime(s.consumerCtx(), consumerConsAddr) + firstConsumerKeeper.SetOutstandingDowntime(s.consumerCtx(), consumerConsAddr.ToSdkConsAddr()) // Note: RecvPacket advances two blocks. Let's say the provider is currently at height N. // The received slash packet will be queued during N, and handled by the ccv module during @@ -126,7 +127,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { } // Get staking keeper's validator obj after the relayed slash packet - stakingValAfter, ok := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr) + stakingValAfter, ok := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr.ToSdkConsAddr()) s.Require().True(ok) // check that the validator's tokens were NOT slashed on provider @@ -134,7 +135,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().Equal(valOldBalance, valNewBalance) // Get signing info for the validator - valSignInfo, found := providerSlashingKeeper.GetValidatorSigningInfo(s.providerCtx(), providerConsAddr) + valSignInfo, found := providerSlashingKeeper.GetValidatorSigningInfo(s.providerCtx(), providerConsAddr.ToSdkConsAddr()) s.Require().True(found) // check that the validator is successfully jailed on provider @@ -147,7 +148,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { // check that the outstanding slashing flag is reset on first consumer, // since that consumer originally sent the slash packet. // It's important to use the consumer's cons addr here. - pFlag := firstConsumerKeeper.OutstandingDowntime(s.consumerCtx(), consumerConsAddr) + pFlag := firstConsumerKeeper.OutstandingDowntime(s.consumerCtx(), consumerConsAddr.ToSdkConsAddr()) s.Require().False(pFlag) // check that slashing packet gets acknowledged successfully @@ -175,7 +176,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDoubleSignPacket() { s.Require().NoError(err) pubkey, err := cryptocodec.FromTmProtoPublicKey(val.GetPubKey()) s.Require().Nil(err) - consumerConsAddr := sdk.GetConsAddress(pubkey) + consumerConsAddr := providertypes.NewConsumerConsAddress(sdk.GetConsAddress(pubkey)) // map consumer consensus address to provider consensus address providerConsAddr, found := providerKeeper.GetValidatorByConsumerAddr( s.providerCtx(), @@ -183,7 +184,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDoubleSignPacket() { consumerConsAddr) s.Require().True(found) - stakingVal, found := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr) + stakingVal, found := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr.ToSdkConsAddr()) s.Require().True(found) valOldBalance := stakingVal.Tokens @@ -213,7 +214,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDoubleSignPacket() { s.Require().Len(s.providerChain.Vals.Validators, validatorsPerChain) // Get staking keeper's validator obj after the relayed slash packet - stakingValAfter, ok := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr) + stakingValAfter, ok := providerStakingKeeper.GetValidatorByConsAddr(s.providerCtx(), providerConsAddr.ToSdkConsAddr()) s.Require().True(ok) // check that the validator's tokens were NOT slashed on provider @@ -221,7 +222,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDoubleSignPacket() { s.Require().Equal(valOldBalance, valNewBalance) // Get signing info for the validator - valSignInfo, found := providerSlashingKeeper.GetValidatorSigningInfo(s.providerCtx(), providerConsAddr) + valSignInfo, found := providerSlashingKeeper.GetValidatorSigningInfo(s.providerCtx(), providerConsAddr.ToSdkConsAddr()) s.Require().True(found) // check that the validator's unjailing time is NOT updated on provider diff --git a/tests/e2e/stop_consumer.go b/tests/e2e/stop_consumer.go index 1a8e80eac5..2f66f4f83d 100644 --- a/tests/e2e/stop_consumer.go +++ b/tests/e2e/stop_consumer.go @@ -85,7 +85,7 @@ func (s *CCVTestSuite) TestStopConsumerChain() { // Queue slash and vsc packet data for consumer 0, these queue entries will be removed firstBundle := s.getFirstBundle() - globalEntry := types.NewGlobalSlashEntry(s.providerCtx().BlockTime(), firstBundle.Chain.ChainID, 7, []byte{}) + globalEntry := types.NewGlobalSlashEntry(s.providerCtx().BlockTime(), firstBundle.Chain.ChainID, 7, types.ProviderConsAddress{}) providerKeeper.QueueGlobalSlashEntry(s.providerCtx(), globalEntry) err := providerKeeper.QueueThrottledSlashPacketData(s.providerCtx(), firstBundle.Chain.ChainID, 1, ccv.SlashPacketData{ValsetUpdateId: 1}) @@ -96,7 +96,7 @@ func (s *CCVTestSuite) TestStopConsumerChain() { // Queue slash and vsc packet data for consumer 1, these queue entries will be not be removed secondBundle := s.getBundleByIdx(1) - globalEntry = types.NewGlobalSlashEntry(s.providerCtx().BlockTime(), secondBundle.Chain.ChainID, 7, []byte{}) + globalEntry = types.NewGlobalSlashEntry(s.providerCtx().BlockTime(), secondBundle.Chain.ChainID, 7, types.ProviderConsAddress{}) providerKeeper.QueueGlobalSlashEntry(s.providerCtx(), globalEntry) err = providerKeeper.QueueThrottledSlashPacketData(s.providerCtx(), secondBundle.Chain.ChainID, 1, ccv.SlashPacketData{ValsetUpdateId: 1}) diff --git a/tests/e2e/throttle.go b/tests/e2e/throttle.go index 153f3d49bd..9d4cf87e57 100644 --- a/tests/e2e/throttle.go +++ b/tests/e2e/throttle.go @@ -407,9 +407,11 @@ func (s *CCVTestSuite) TestDoubleSignDoesNotAffectThrottling() { // 4th validator should have no slash log, all the others do if val != s.providerChain.Vals.Validators[3] { - s.Require().True(providerKeeper.GetSlashLog(s.providerCtx(), sdk.ConsAddress(val.Address))) + s.Require().True(providerKeeper.GetSlashLog(s.providerCtx(), + providertypes.NewProviderConsAddress([]byte(val.Address)))) } else { - s.Require().False(providerKeeper.GetSlashLog(s.providerCtx(), sdk.ConsAddress(val.Address))) + s.Require().False(providerKeeper.GetSlashLog(s.providerCtx(), + providertypes.NewProviderConsAddress([]byte(val.Address)))) } } } diff --git a/testutil/crypto/crypto.go b/testutil/crypto/crypto.go index 6b77726dba..ef2c1becbe 100644 --- a/testutil/crypto/crypto.go +++ b/testutil/crypto/crypto.go @@ -11,6 +11,7 @@ import ( sdkcryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdktypes "github.com/cosmos/cosmos-sdk/types" sdkstakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" tmcrypto "github.com/tendermint/tendermint/crypto" tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" @@ -98,3 +99,17 @@ func (v *CryptoIdentity) SDKValOpAddress() sdktypes.ValAddress { func (v *CryptoIdentity) SDKValConsAddress() sdktypes.ConsAddress { return sdktypes.ConsAddress(v.ConsensusSDKPubKey().Address()) } + +// Returns the cons address of the crypto identity as a ProviderConsAddress. +// In most cases, one crypto identity should NOT be casted to both a ProviderConsAddress and ConsumerConsAddress. +// However, test intention is left to the caller. +func (v *CryptoIdentity) ProviderConsAddress() providertypes.ProviderConsAddress { + return providertypes.NewProviderConsAddress(v.SDKValConsAddress()) +} + +// Returns the cons address of the crypto identity as a ConsumerConsAddress. +// In most cases, one crypto identity should NOT be casted to both a ProviderConsAddress and ConsumerConsAddress. +// However, test intention is left to the caller. +func (v *CryptoIdentity) ConsumerConsAddress() providertypes.ConsumerConsAddress { + return providertypes.NewConsumerConsAddress(v.SDKValConsAddress()) +} diff --git a/testutil/keeper/expectations.go b/testutil/keeper/expectations.go index 249f81ef0d..c11a73f550 100644 --- a/testutil/keeper/expectations.go +++ b/testutil/keeper/expectations.go @@ -10,6 +10,7 @@ import ( conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" + providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" "github.com/golang/mock/gomock" host "github.com/cosmos/ibc-go/v4/modules/core/24-host" @@ -92,31 +93,31 @@ func GetMocksForStopConsumerChain(ctx sdk.Context, mocks *MockedKeepers) []*gomo } func GetMocksForHandleSlashPacket(ctx sdk.Context, mocks MockedKeepers, - expectedProviderValConsAddr sdk.ConsAddress, + expectedProviderValConsAddr providertypes.ProviderConsAddress, valToReturn stakingtypes.Validator, expectJailing bool) []*gomock.Call { // These first two calls are always made. calls := []*gomock.Call{ mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( - ctx, expectedProviderValConsAddr).Return( + ctx, expectedProviderValConsAddr.ToSdkConsAddr()).Return( valToReturn, true, ).Times(1), mocks.MockSlashingKeeper.EXPECT().IsTombstoned(ctx, - sdk.ConsAddress(expectedProviderValConsAddr)).Return(false).Times(1), + expectedProviderValConsAddr.ToSdkConsAddr()).Return(false).Times(1), } if expectJailing { calls = append(calls, mocks.MockStakingKeeper.EXPECT().Jail( gomock.Eq(ctx), - gomock.Eq(sdk.ConsAddress(expectedProviderValConsAddr)), + gomock.Eq(expectedProviderValConsAddr.ToSdkConsAddr()), ).Return()) // JailUntil is set in this code path. calls = append(calls, mocks.MockSlashingKeeper.EXPECT().DowntimeJailDuration(ctx).Return(time.Hour).Times(1)) calls = append(calls, mocks.MockSlashingKeeper.EXPECT().JailUntil(ctx, - sdk.ConsAddress(expectedProviderValConsAddr), gomock.Any()).Times(1)) + expectedProviderValConsAddr.ToSdkConsAddr(), gomock.Any()).Times(1)) } return calls diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index 95f72689e0..31003b4218 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -381,7 +381,7 @@ func (k Keeper) SetOutstandingDowntime(ctx sdk.Context, address sdk.ConsAddress) func (k Keeper) DeleteOutstandingDowntime(ctx sdk.Context, consAddress string) { consAddr, err := sdk.ConsAddressFromBech32(consAddress) if err != nil { - return + return // TODO: this should panic with appropriate tests to validate the panic wont happen in normal cases. } store := ctx.KVStore(k.storeKey) store.Delete(types.OutstandingDowntimeKey(consAddr)) diff --git a/x/ccv/provider/handler_test.go b/x/ccv/provider/handler_test.go index bfe108e4af..8579d41d6d 100644 --- a/x/ccv/provider/handler_test.go +++ b/x/ccv/provider/handler_test.go @@ -15,7 +15,7 @@ import ( testkeeper "github.com/cosmos/interchain-security/testutil/keeper" "github.com/cosmos/interchain-security/x/ccv/provider" keeper "github.com/cosmos/interchain-security/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/x/ccv/provider/types" + providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" ) func TestInvalidMsg(t *testing.T) { @@ -29,8 +29,12 @@ func TestInvalidMsg(t *testing.T) { func TestAssignConsensusKeyForConsumerChain(t *testing.T) { - testValProvider := testcrypto.NewCryptoIdentityFromIntSeed(0) - testValConsumer := testcrypto.NewCryptoIdentityFromIntSeed(1) + providerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(0) + providerConsAddr := providerCryptoId.ProviderConsAddress() + + consumerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(1) + consumerConsAddr := consumerCryptoId.ConsumerConsAddress() + consumerKey := consumerCryptoId.ConsensusSDKPubKey() testCases := []struct { name string @@ -46,11 +50,11 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, testValProvider.SDKValOpAddress(), + ctx, providerCryptoId.SDKValOpAddress(), // Return a valid validator, found! - ).Return(testValProvider.SDKStakingValidator(), true).Times(1), + ).Return(providerCryptoId.SDKStakingValidator(), true).Times(1), mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - testValConsumer.SDKValConsAddress(), + consumerConsAddr.ToSdkConsAddr(), ).Return(stakingtypes.Validator{}, false), ) }, @@ -64,7 +68,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, testValProvider.SDKValOpAddress(), + ctx, providerCryptoId.SDKValOpAddress(), // return false: not found! ).Return(stakingtypes.Validator{}, false).Times(1), ) @@ -78,15 +82,15 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { k keeper.Keeper, mocks testkeeper.MockedKeepers) { // Use the consumer key already - k.SetValidatorByConsumerAddr(ctx, "chainid", testValConsumer.SDKValConsAddress(), testValProvider.SDKValConsAddress()) + k.SetValidatorByConsumerAddr(ctx, "chainid", consumerConsAddr, providerConsAddr) gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, testValProvider.SDKValOpAddress(), + ctx, providerCryptoId.SDKValOpAddress(), // Return a valid validator, found! - ).Return(testValProvider.SDKStakingValidator(), true).Times(1), + ).Return(providerCryptoId.SDKStakingValidator(), true).Times(1), mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - testValConsumer.SDKValConsAddress(), + consumerConsAddr.ToSdkConsAddr(), ).Return(stakingtypes.Validator{}, false), ) }, @@ -102,8 +106,8 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { tc.setup(ctx, k, mocks) - msg, err := types.NewMsgAssignConsumerKey(tc.chainID, - testValProvider.SDKValOpAddress(), testValConsumer.ConsensusSDKPubKey(), + msg, err := providertypes.NewMsgAssignConsumerKey(tc.chainID, + providerCryptoId.SDKValOpAddress(), consumerKey, ) require.NoError(t, err) diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 21292af09e..02ac8c81d3 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -73,16 +73,16 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { // Import key assignment state for _, item := range genState.ValidatorConsumerPubkeys { - k.SetValidatorConsumerPubKey(ctx, item.ChainId, item.ProviderAddr, *item.ConsumerKey) + k.SetValidatorConsumerPubKey(ctx, item.ChainId, *item.ProviderAddr, *item.ConsumerKey) } for _, item := range genState.ValidatorsByConsumerAddr { - k.SetValidatorByConsumerAddr(ctx, item.ChainId, item.ConsumerAddr, item.ProviderAddr) + k.SetValidatorByConsumerAddr(ctx, item.ChainId, *item.ConsumerAddr, *item.ProviderAddr) } for _, item := range genState.ConsumerAddrsToPrune { for _, addr := range item.ConsumerAddrs.Addresses { - k.AppendConsumerAddrsToPrune(ctx, item.ChainId, item.VscId, addr) + k.AppendConsumerAddrsToPrune(ctx, item.ChainId, item.VscId, *addr) } } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 251be0de1e..d9f371bc2a 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -4,12 +4,11 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" host "github.com/cosmos/ibc-go/v4/modules/core/24-host" + "github.com/cosmos/interchain-security/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/testutil/keeper" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types" "github.com/cosmos/interchain-security/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" @@ -28,12 +27,13 @@ func TestInitAndExportGenesis(t *testing.T) { ubdIndex := []uint64{0, 1, 2} params := providertypes.DefaultParams() - // create validator keys and addresses for key assignement - provAddr := sdk.ConsAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - consPubKey := ed25519.GenPrivKey().PubKey() - consTmPubKey, err := cryptocodec.ToTmProtoPublicKey(consPubKey) - require.NoError(t, err) - consAddr := sdk.ConsAddress(consPubKey.Address().Bytes()) + // create validator keys and addresses for key assignment + providerCryptoId := crypto.NewCryptoIdentityFromIntSeed(7896) + provAddr := providerCryptoId.ProviderConsAddress() + + consumerCryptoId := crypto.NewCryptoIdentityFromIntSeed(7897) + consumerTmPubKey := consumerCryptoId.TMProtoCryptoPublicKey() + consumerConsAddr := consumerCryptoId.ConsumerConsAddress() // create genesis struct provGenesis := providertypes.NewGenesisState(vscID, @@ -79,22 +79,22 @@ func TestInitAndExportGenesis(t *testing.T) { []providertypes.ValidatorConsumerPubKey{ { ChainId: cChainIDs[0], - ProviderAddr: provAddr, - ConsumerKey: &consTmPubKey, + ProviderAddr: &provAddr, + ConsumerKey: &consumerTmPubKey, }, }, []providertypes.ValidatorByConsumerAddr{ { ChainId: cChainIDs[0], - ProviderAddr: provAddr, - ConsumerAddr: consAddr, + ProviderAddr: &provAddr, + ConsumerAddr: &consumerConsAddr, }, }, []providertypes.ConsumerAddrsToPrune{ { ChainId: cChainIDs[0], VscId: vscID, - ConsumerAddrs: &providertypes.AddressList{Addresses: [][]byte{consAddr}}, + ConsumerAddrs: &providertypes.ConsumerAddressList{Addresses: []*providertypes.ConsumerConsAddress{&consumerConsAddr}}, }, }, ) @@ -147,21 +147,22 @@ func TestInitAndExportGenesis(t *testing.T) { gotConsTmPubKey, found := pk.GetValidatorConsumerPubKey(ctx, cChainIDs[0], provAddr) require.True(t, found) - require.True(t, consTmPubKey.Equal(gotConsTmPubKey)) + require.Equal(t, consumerTmPubKey, gotConsTmPubKey) - providerAddr, found := pk.GetValidatorByConsumerAddr(ctx, cChainIDs[0], consAddr) + providerAddr, found := pk.GetValidatorByConsumerAddr(ctx, cChainIDs[0], consumerConsAddr) require.True(t, found) require.Equal(t, provAddr, providerAddr) addrs := pk.GetConsumerAddrsToPrune(ctx, cChainIDs[0], vscID) - require.Equal(t, [][]byte{consAddr}, addrs.Addresses) + // Expect same list as what was provided in provGenesis + expectedAddrList := providertypes.ConsumerAddressList{Addresses: []*providertypes.ConsumerConsAddress{&consumerConsAddr}} + require.Equal(t, expectedAddrList, addrs) // check provider chain's consumer chain states assertConsumerChainStates(ctx, t, pk, provGenesis.ConsumerStates...) // check the exported genesis require.Equal(t, provGenesis, pk.ExportGenesis(ctx)) - } func assertConsumerChainStates(ctx sdk.Context, t *testing.T, pk keeper.Keeper, consumerStates ...providertypes.ConsumerState) { diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 261c5b04d9..1d159496cb 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -92,10 +92,11 @@ func (k Keeper) QueryValidatorConsumerAddr(goCtx context.Context, req *types.Que ctx := sdk.UnwrapSDKContext(goCtx) - providerAddr, err := sdk.ConsAddressFromBech32(req.ProviderAddress) + providerAddrTmp, err := sdk.ConsAddressFromBech32(req.ProviderAddress) if err != nil { return nil, err } + providerAddr := types.NewProviderConsAddress(providerAddrTmp) consumerKey, found := k.GetValidatorConsumerPubKey(ctx, req.ChainId, providerAddr) if !found { @@ -119,10 +120,11 @@ func (k Keeper) QueryValidatorProviderAddr(goCtx context.Context, req *types.Que ctx := sdk.UnwrapSDKContext(goCtx) - consumerAddr, err := sdk.ConsAddressFromBech32(req.ConsumerAddress) + consumerAddrTmp, err := sdk.ConsAddressFromBech32(req.ConsumerAddress) if err != nil { return nil, err } + consumerAddr := types.NewConsumerConsAddress(consumerAddrTmp) providerAddr, found := k.GetValidatorByConsumerAddr(ctx, req.ChainId, consumerAddr) if !found { diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index db99600c80..15f3dc5bbc 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -6,7 +6,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/x/ccv/provider/types" + providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" "github.com/cosmos/interchain-security/x/ccv/utils" ) @@ -35,7 +35,7 @@ func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, ID uint64) error { return nil } valsetUpdateID := h.k.GetValidatorSetUpdateId(ctx) - unbondingOp := types.UnbondingOp{ + unbondingOp := providertypes.UnbondingOp{ Id: ID, UnbondingConsumerChains: consumerChainIDS, } @@ -85,7 +85,7 @@ func ValidatorConsensusKeyInUse(k *Keeper, ctx sdk.Context, valAddr sdk.ValAddre inUse := false for _, validatorConsumerAddrs := range k.GetAllValidatorsByConsumerAddr(ctx, nil) { - if sdk.ConsAddress(validatorConsumerAddrs.ConsumerAddr).Equals(consensusAddr) { + if validatorConsumerAddrs.ConsumerAddr.ToSdkConsAddr().Equals(consensusAddr) { inUse = true break } @@ -103,14 +103,15 @@ func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, valConsAddr sdk.ConsAddress, valAddr sdk.ValAddress) { for _, validatorConsumerPubKey := range h.k.GetAllValidatorConsumerPubKeys(ctx, nil) { - if sdk.ConsAddress(validatorConsumerPubKey.ProviderAddr).Equals(valConsAddr) { - consumerAddr, err := utils.TMCryptoPublicKeyToConsAddr(*validatorConsumerPubKey.ConsumerKey) + if validatorConsumerPubKey.ProviderAddr.ToSdkConsAddr().Equals(valConsAddr) { + consumerAddrTmp, err := utils.TMCryptoPublicKeyToConsAddr(*validatorConsumerPubKey.ConsumerKey) if err != nil { // An error here would indicate something is very wrong panic("cannot get address of consumer key") } + consumerAddr := providertypes.NewConsumerConsAddress(consumerAddrTmp) h.k.DeleteValidatorByConsumerAddr(ctx, validatorConsumerPubKey.ChainId, consumerAddr) - h.k.DeleteValidatorConsumerPubKey(ctx, validatorConsumerPubKey.ChainId, validatorConsumerPubKey.ProviderAddr) + h.k.DeleteValidatorConsumerPubKey(ctx, validatorConsumerPubKey.ChainId, *validatorConsumerPubKey.ProviderAddr) } } } diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index c34e815e16..c0698cc1a9 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -33,7 +33,10 @@ func TestValidatorConsensusKeyInUse(t *testing.T) { setup: func(ctx sdk.Context, k providerkeeper.Keeper) { // We are trying to add a new validator, but its address has already been used // by another validator - k.SetValidatorByConsumerAddr(ctx, "chainid", newValidator.SDKValConsAddress(), anotherValidator0.SDKValConsAddress()) + k.SetValidatorByConsumerAddr(ctx, "chainid", + newValidator.ConsumerConsAddress(), + anotherValidator0.ProviderConsAddress(), + ) }, expect: true, }, @@ -42,8 +45,14 @@ func TestValidatorConsensusKeyInUse(t *testing.T) { setup: func(ctx sdk.Context, k providerkeeper.Keeper) { // We are trying to add a new validator, but its address has already been used // by another validator, of which there are several, across potentially several chains - k.SetValidatorByConsumerAddr(ctx, "chainid0", newValidator.SDKValConsAddress(), anotherValidator0.SDKValConsAddress()) - k.SetValidatorByConsumerAddr(ctx, "chainid1", anotherValidator1.SDKValConsAddress(), anotherValidator1.SDKValConsAddress()) + k.SetValidatorByConsumerAddr(ctx, "chainid0", + newValidator.ConsumerConsAddress(), + anotherValidator0.ProviderConsAddress(), + ) + k.SetValidatorByConsumerAddr(ctx, "chainid1", + anotherValidator1.ConsumerConsAddress(), + anotherValidator1.ProviderConsAddress(), + ) }, expect: true, }, diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index dc612b110a..a6bafe4112 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -680,6 +680,9 @@ func (k Keeper) DeleteValsetUpdateBlockHeight(ctx sdk.Context, valsetUpdateId ui } // SetSlashAcks sets the slash acks under the given chain ID +// +// TODO: SlashAcks should be persisted as a list of ConsumerConsAddr types, not strings. +// See https://github.com/cosmos/interchain-security/issues/728 func (k Keeper) SetSlashAcks(ctx sdk.Context, chainID string, acks []string) { store := ctx.KVStore(k.storeKey) @@ -696,6 +699,9 @@ func (k Keeper) SetSlashAcks(ctx sdk.Context, chainID string, acks []string) { } // GetSlashAcks returns the slash acks stored under the given chain ID +// +// TODO: SlashAcks should be persisted as a list of ConsumerConsAddr types, not strings. +// See https://github.com/cosmos/interchain-security/issues/728 func (k Keeper) GetSlashAcks(ctx sdk.Context, chainID string) []string { store := ctx.KVStore(k.storeKey) bz := store.Get(types.SlashAcksKey(chainID)) @@ -730,7 +736,9 @@ func (k Keeper) DeleteSlashAcks(ctx sdk.Context, chainID string) { } // AppendSlashAck appends the given slash ack to the given chain ID slash acks in store -func (k Keeper) AppendSlashAck(ctx sdk.Context, chainID, ack string) { +func (k Keeper) AppendSlashAck(ctx sdk.Context, chainID, + ack string, // TODO: consumer cons addr should be accepted here, see https://github.com/cosmos/interchain-security/issues/728 +) { acks := k.GetSlashAcks(ctx, chainID) acks = append(acks, ack) k.SetSlashAcks(ctx, chainID, acks) @@ -996,7 +1004,7 @@ func (k Keeper) GetFirstVscSendTimestamp(ctx sdk.Context, chainID string) (vscSe // double signing slash packet was received by the provider from at least one consumer chain func (k Keeper) SetSlashLog( ctx sdk.Context, - providerAddr sdk.ConsAddress, + providerAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) store.Set(types.SlashLogKey(providerAddr), []byte{}) @@ -1006,7 +1014,7 @@ func (k Keeper) SetSlashLog( // True will be returned if an entry exists for a given validator address func (k Keeper) GetSlashLog( ctx sdk.Context, - providerAddr sdk.ConsAddress, + providerAddr types.ProviderConsAddress, ) (found bool) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.SlashLogKey(providerAddr)) diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index 7127081904..0dfa301c43 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -525,8 +525,8 @@ func TestSetSlashLog(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - addrWithDoubleSigns := cryptotestutil.NewCryptoIdentityFromIntSeed(1).SDKValConsAddress() - addrWithoutDoubleSigns := cryptotestutil.NewCryptoIdentityFromIntSeed(2).SDKValConsAddress() + addrWithDoubleSigns := cryptotestutil.NewCryptoIdentityFromIntSeed(1).ProviderConsAddress() + addrWithoutDoubleSigns := cryptotestutil.NewCryptoIdentityFromIntSeed(2).ProviderConsAddress() providerKeeper.SetSlashLog(ctx, addrWithDoubleSigns) require.True(t, providerKeeper.GetSlashLog(ctx, addrWithDoubleSigns)) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 0fb3273601..4374713c70 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -18,7 +18,7 @@ import ( func (k Keeper) GetValidatorConsumerPubKey( ctx sdk.Context, chainID string, - providerAddr sdk.ConsAddress, + providerAddr types.ProviderConsAddress, ) (consumerKey tmprotocrypto.PublicKey, found bool) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ConsumerValidatorsKey(chainID, providerAddr)) @@ -38,7 +38,7 @@ func (k Keeper) GetValidatorConsumerPubKey( func (k Keeper) SetValidatorConsumerPubKey( ctx sdk.Context, chainID string, - providerAddr sdk.ConsAddress, + providerAddr types.ProviderConsAddress, consumerKey tmprotocrypto.PublicKey, ) { store := ctx.KVStore(k.storeKey) @@ -72,12 +72,14 @@ func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, chainID *string) iterator := sdk.KVStorePrefixIterator(store, prefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - chainID, providerAddr, err := types.ParseChainIdAndConsAddrKey(types.ConsumerValidatorsBytePrefix, iterator.Key()) + // TODO: store chainID and provider cons address in value bytes, marshaled as protobuf type + chainID, providerAddrTmp, err := types.ParseChainIdAndConsAddrKey(types.ConsumerValidatorsBytePrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, // the store key is assumed to be correctly serialized in SetValidatorConsumerPubKey. panic(err) } + providerAddr := types.NewProviderConsAddress(providerAddrTmp) var consumerKey tmprotocrypto.PublicKey err = consumerKey.Unmarshal(iterator.Value()) if err != nil { @@ -88,7 +90,7 @@ func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, chainID *string) validatorConsumerPubKeys = append(validatorConsumerPubKeys, types.ValidatorConsumerPubKey{ ChainId: chainID, - ProviderAddr: providerAddr, + ProviderAddr: &providerAddr, ConsumerKey: &consumerKey, }) } @@ -97,7 +99,7 @@ func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, chainID *string) } // DeleteValidatorConsumerPubKey deletes a validator's public key assigned for a consumer chain -func (k Keeper) DeleteValidatorConsumerPubKey(ctx sdk.Context, chainID string, providerAddr sdk.ConsAddress) { +func (k Keeper) DeleteValidatorConsumerPubKey(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) { store := ctx.KVStore(k.storeKey) store.Delete(types.ConsumerValidatorsKey(chainID, providerAddr)) } @@ -107,8 +109,8 @@ func (k Keeper) DeleteValidatorConsumerPubKey(ctx sdk.Context, chainID string, p func (k Keeper) GetValidatorByConsumerAddr( ctx sdk.Context, chainID string, - consumerAddr sdk.ConsAddress, -) (providerAddr sdk.ConsAddress, found bool) { + consumerAddr types.ConsumerConsAddress, +) (providerAddr types.ProviderConsAddress, found bool) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ValidatorsByConsumerAddrKey(chainID, consumerAddr)) if bz == nil { @@ -128,12 +130,16 @@ func (k Keeper) GetValidatorByConsumerAddr( func (k Keeper) SetValidatorByConsumerAddr( ctx sdk.Context, chainID string, - consumerAddr sdk.ConsAddress, - providerAddr sdk.ConsAddress, + consumerAddr types.ConsumerConsAddress, + providerAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) // Cons address is a type alias for a byte string, no marshaling needed - bz := providerAddr + bz, err := providerAddr.Marshal() + if err != nil { + // An error here would indicate something is very wrong, + panic(fmt.Sprintf("failed to marshal provider address: %v", err)) + } store.Set(types.ValidatorsByConsumerAddrKey(chainID, consumerAddr), bz) } @@ -159,13 +165,15 @@ func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, chainID *string) iterator := sdk.KVStorePrefixIterator(store, prefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - chainID, consumerAddr, err := types.ParseChainIdAndConsAddrKey(types.ValidatorsByConsumerAddrBytePrefix, iterator.Key()) + // TODO: store chainID and consumer cons address in value bytes, marshaled as protobuf type + chainID, consumerAddrTmp, err := types.ParseChainIdAndConsAddrKey(types.ValidatorsByConsumerAddrBytePrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in SetValidatorByConsumerAddr. panic(fmt.Sprintf("failed to parse chainID and consumer address: %v", err)) } - var providerAddr sdk.ConsAddress + consumerAddr := types.NewConsumerConsAddress(consumerAddrTmp) + var providerAddr types.ProviderConsAddress err = providerAddr.Unmarshal(iterator.Value()) if err != nil { // An error here would indicate something is very wrong, @@ -174,8 +182,8 @@ func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, chainID *string) } validatorConsumerAddrs = append(validatorConsumerAddrs, types.ValidatorByConsumerAddr{ - ConsumerAddr: consumerAddr, - ProviderAddr: providerAddr, + ConsumerAddr: &consumerAddr, + ProviderAddr: &providerAddr, ChainId: chainID, }) } @@ -185,7 +193,7 @@ func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, chainID *string) // DeleteValidatorByConsumerAddr deletes the mapping from a validator's consensus address on a consumer // to the validator's consensus address on the provider -func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, consumerAddr sdk.ConsAddress) { +func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, consumerAddr types.ConsumerConsAddress) { store := ctx.KVStore(k.storeKey) store.Delete(types.ValidatorsByConsumerAddrKey(chainID, consumerAddr)) } @@ -196,7 +204,7 @@ func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, c func (k Keeper) GetKeyAssignmentReplacement( ctx sdk.Context, chainID string, - providerAddr sdk.ConsAddress, + providerAddr types.ProviderConsAddress, ) (prevCKey tmprotocrypto.PublicKey, power int64, found bool) { var pubKeyAndPower abci.ValidatorUpdate store := ctx.KVStore(k.storeKey) @@ -220,7 +228,7 @@ func (k Keeper) GetKeyAssignmentReplacement( func (k Keeper) SetKeyAssignmentReplacement( ctx sdk.Context, chainID string, - providerAddr sdk.ConsAddress, + providerAddr types.ProviderConsAddress, prevCKey tmprotocrypto.PublicKey, power int64, ) { @@ -249,12 +257,14 @@ func (k Keeper) GetAllKeyAssignmentReplacements(ctx sdk.Context, chainID string) iterator := sdk.KVStorePrefixIterator(store, iteratorPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - _, providerAddr, err := types.ParseChainIdAndConsAddrKey(types.KeyAssignmentReplacementsBytePrefix, iterator.Key()) + // TODO: store chainID and provider cons address in value bytes, marshaled as protobuf type + _, providerAddrTmp, err := types.ParseChainIdAndConsAddrKey(types.KeyAssignmentReplacementsBytePrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in SetKeyAssignmentReplacement. panic(err) } + providerAddr := types.NewProviderConsAddress(providerAddrTmp) var pubKeyAndPower abci.ValidatorUpdate err = pubKeyAndPower.Unmarshal(iterator.Value()) if err != nil { @@ -264,7 +274,7 @@ func (k Keeper) GetAllKeyAssignmentReplacements(ctx sdk.Context, chainID string) } replacements = append(replacements, types.KeyAssignmentReplacement{ - ProviderAddr: providerAddr, + ProviderAddr: &providerAddr, PrevCKey: &pubKeyAndPower.PubKey, Power: pubKeyAndPower.Power, }) @@ -276,7 +286,7 @@ func (k Keeper) GetAllKeyAssignmentReplacements(ctx sdk.Context, chainID string) // DeleteKeyAssignmentReplacement deletes the previous assigned consumer key and the current power // for a provider validator for which a key assignment was received in this block. Both are // needed to update the validator's power on the consumer chain at the end of the current block. -func (k Keeper) DeleteKeyAssignmentReplacement(ctx sdk.Context, chainID string, providerAddr sdk.ConsAddress) { +func (k Keeper) DeleteKeyAssignmentReplacement(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) { store := ctx.KVStore(k.storeKey) store.Delete(types.KeyAssignmentReplacementsKey(chainID, providerAddr)) } @@ -289,10 +299,10 @@ func (k Keeper) DeleteKeyAssignmentReplacement(ctx sdk.Context, chainID string, // - 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 sdk.ConsAddress) { +func (k Keeper) AppendConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscID uint64, consumerAddr types.ConsumerConsAddress) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ConsumerAddrsToPruneKey(chainID, vscID)) - var consumerAddrsToPrune types.AddressList + var consumerAddrsToPrune types.ConsumerAddressList if bz != nil { err := consumerAddrsToPrune.Unmarshal(bz) if err != nil { @@ -301,7 +311,7 @@ func (k Keeper) AppendConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscI panic(err) } } - consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, consumerAddr) + consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, &consumerAddr) bz, err := consumerAddrsToPrune.Marshal() if err != nil { // An error here would indicate something is very wrong, @@ -317,7 +327,7 @@ func (k Keeper) GetConsumerAddrsToPrune( ctx sdk.Context, chainID string, vscID uint64, -) (consumerAddrsToPrune types.AddressList) { +) (consumerAddrsToPrune types.ConsumerAddressList) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ConsumerAddrsToPruneKey(chainID, vscID)) if bz == nil { @@ -349,7 +359,7 @@ func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (con // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. panic(err) } - var addrs types.AddressList + var addrs types.ConsumerAddressList err = addrs.Unmarshal(iterator.Value()) if err != nil { // An error here would indicate something is very wrong, @@ -382,18 +392,20 @@ func (k Keeper) AssignConsumerKey( consumerKey tmprotocrypto.PublicKey, ) error { - consumerAddr, err := utils.TMCryptoPublicKeyToConsAddr(consumerKey) + consAddrTmp, err := utils.TMCryptoPublicKeyToConsAddr(consumerKey) if err != nil { return err } + consumerAddr := types.NewConsumerConsAddress(consAddrTmp) - providerAddr, err := validator.GetConsAddr() + consAddrTmp, err = validator.GetConsAddr() if err != nil { return err } + providerAddr := types.NewProviderConsAddress(consAddrTmp) - if existingVal, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, consumerAddr); found { - // If there is a validator with using the consumer key to validate on the provider + if existingVal, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, consumerAddr.ToSdkConsAddr()); found { + // If there is a validator using the consumer key to validate on the provider // we prevent assigning the consumer key, unless the validator is assigning validator. // This ensures that a validator joining the active set who has not explicitly assigned // a consumer key, will be able to use their provider key as consumer key (as per default). @@ -421,10 +433,11 @@ func (k Keeper) AssignConsumerKey( // mark this old consumer key as prunable once the VSCMaturedPacket // for the current VSC ID is received; // note: this state is removed on receiving the VSCMaturedPacket - oldConsumerAddr, err := utils.TMCryptoPublicKeyToConsAddr(oldConsumerKey) + oldConsumerAddrTmp, err := utils.TMCryptoPublicKeyToConsAddr(oldConsumerKey) if err != nil { return err } + oldConsumerAddr := types.NewConsumerConsAddress(oldConsumerAddrTmp) k.AppendConsumerAddrsToPrune( ctx, chainID, @@ -463,10 +476,11 @@ func (k Keeper) AssignConsumerKey( // from the old consumer address to the provider address (if any) // get the previous key assigned for this validator on this consumer chain if oldConsumerKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, providerAddr); found { - oldConsumerAddr, err := utils.TMCryptoPublicKeyToConsAddr(oldConsumerKey) + oldConsumerAddrTmp, err := utils.TMCryptoPublicKeyToConsAddr(oldConsumerKey) if err != nil { return err } + oldConsumerAddr := types.NewConsumerConsAddress(oldConsumerAddrTmp) k.DeleteValidatorByConsumerAddr(ctx, chainID, oldConsumerAddr) } } @@ -493,10 +507,11 @@ func (k Keeper) MustApplyKeyAssignmentToValUpdates( valUpdates []abci.ValidatorUpdate, ) (newUpdates []abci.ValidatorUpdate) { for _, valUpdate := range valUpdates { - providerAddr, err := utils.TMCryptoPublicKeyToConsAddr(valUpdate.PubKey) + providerAddrTmp, err := utils.TMCryptoPublicKeyToConsAddr(valUpdate.PubKey) if err != nil { panic(fmt.Errorf("cannot get provider address from pub key: %s", err.Error())) } + providerAddr := types.NewProviderConsAddress(providerAddrTmp) // If a key assignment replacement is found, we remove the valupdate with the old consumer key, // create two new valupdates, @@ -543,13 +558,13 @@ func (k Keeper) MustApplyKeyAssignmentToValUpdates( // set the old consumer key's power to 0 and the new consumer key's power to the // power in the pending key assignment. for _, replacement := range k.GetAllKeyAssignmentReplacements(ctx, chainID) { - k.DeleteKeyAssignmentReplacement(ctx, chainID, replacement.ProviderAddr) + k.DeleteKeyAssignmentReplacement(ctx, chainID, *replacement.ProviderAddr) newUpdates = append(newUpdates, abci.ValidatorUpdate{ PubKey: *replacement.PrevCKey, Power: 0, }) - newConsumerKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, replacement.ProviderAddr) + newConsumerKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, *replacement.ProviderAddr) if !found { // This should never happen as for every KeyAssignmentReplacement there should // be a ValidatorConsumerPubKey that was stored when AssignConsumerKey() was called. @@ -569,13 +584,15 @@ func (k Keeper) MustApplyKeyAssignmentToValUpdates( func (k Keeper) GetProviderAddrFromConsumerAddr( ctx sdk.Context, chainID string, - consAddr sdk.ConsAddress, -) sdk.ConsAddress { + consumerAddr types.ConsumerConsAddress, +) types.ProviderConsAddress { // check if this address is known only to the consumer chain - if providerConsAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consAddr); found { + if providerConsAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerAddr); found { return providerConsAddr } - return consAddr + // If mapping from consumer -> provider addr is not found, there is no assigned key, + // and the consumer addr is the provider addr + return types.NewProviderConsAddress(consumerAddr.ToSdkConsAddr()) } // PruneKeyAssignments prunes the consumer addresses no longer needed @@ -583,10 +600,10 @@ func (k Keeper) GetProviderAddrFromConsumerAddr( func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string, vscID uint64) { consumerAddrs := k.GetConsumerAddrsToPrune(ctx, chainID, vscID) for _, addr := range consumerAddrs.Addresses { - k.DeleteValidatorByConsumerAddr(ctx, chainID, addr) + k.DeleteValidatorByConsumerAddr(ctx, chainID, *addr) k.Logger(ctx).Info("consumer address was pruned", "consumer chainID", chainID, - "consumer consensus addr", sdk.ConsAddress(addr).String(), + "consumer consensus addr", addr.String(), ) } @@ -597,17 +614,17 @@ func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string, vscID uint6 func (k Keeper) DeleteKeyAssignments(ctx sdk.Context, chainID string) { // delete ValidatorConsumerPubKey for _, validatorConsumerAddr := range k.GetAllValidatorConsumerPubKeys(ctx, &chainID) { - k.DeleteValidatorConsumerPubKey(ctx, chainID, validatorConsumerAddr.ProviderAddr) + k.DeleteValidatorConsumerPubKey(ctx, chainID, *validatorConsumerAddr.ProviderAddr) } // delete ValidatorsByConsumerAddr for _, validatorConsumerAddr := range k.GetAllValidatorsByConsumerAddr(ctx, &chainID) { - k.DeleteValidatorByConsumerAddr(ctx, chainID, validatorConsumerAddr.ConsumerAddr) + k.DeleteValidatorByConsumerAddr(ctx, chainID, *validatorConsumerAddr.ConsumerAddr) } // delete KeyAssignmentReplacements for _, keyAssignmentReplacement := range k.GetAllKeyAssignmentReplacements(ctx, chainID) { - k.DeleteKeyAssignmentReplacement(ctx, chainID, keyAssignmentReplacement.ProviderAddr) + k.DeleteKeyAssignmentReplacement(ctx, chainID, *keyAssignmentReplacement.ProviderAddr) } // delete ValidatorConsumerPubKey diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 35ea42d880..4192166abe 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -24,7 +24,7 @@ import ( func TestValidatorConsumerPubKeyCRUD(t *testing.T) { chainID := "consumer" - providerAddr := sdk.ConsAddress([]byte("providerAddr")) + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) consumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) @@ -54,11 +54,11 @@ func TestGetAllValidatorConsumerPubKey(t *testing.T) { testAssignments := []types.ValidatorConsumerPubKey{} for i := 0; i < numAssignments; i++ { consumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(i).TMProtoCryptoPublicKey() - providerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(numAssignments + i).SDKValConsAddress() + providerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(numAssignments + i).ProviderConsAddress() testAssignments = append(testAssignments, types.ValidatorConsumerPubKey{ ChainId: chainIDs[rand.Intn(len(chainIDs))], - ProviderAddr: providerAddr, + ProviderAddr: &providerAddr, ConsumerKey: &consumerKey, }, ) @@ -85,11 +85,11 @@ func TestGetAllValidatorConsumerPubKey(t *testing.T) { } // sorting by ValidatorConsumerPubKey.ProviderAddr sort.Slice(expectedGetAllOneConsumerOrder, func(i, j int) bool { - return bytes.Compare(expectedGetAllOneConsumerOrder[i].ProviderAddr, expectedGetAllOneConsumerOrder[j].ProviderAddr) == -1 + return bytes.Compare(expectedGetAllOneConsumerOrder[i].ProviderAddr.ToSdkConsAddr(), expectedGetAllOneConsumerOrder[j].ProviderAddr.ToSdkConsAddr()) == -1 }) for _, assignment := range testAssignments { - pk.SetValidatorConsumerPubKey(ctx, assignment.ChainId, assignment.ProviderAddr, *assignment.ConsumerKey) + pk.SetValidatorConsumerPubKey(ctx, assignment.ChainId, *assignment.ProviderAddr, *assignment.ConsumerKey) } result := pk.GetAllValidatorConsumerPubKeys(ctx, &chainID) @@ -101,8 +101,8 @@ func TestGetAllValidatorConsumerPubKey(t *testing.T) { func TestValidatorByConsumerAddrCRUD(t *testing.T) { chainID := "consumer" - providerAddr := sdk.ConsAddress([]byte("providerAddr")) - consumerAddr := sdk.ConsAddress([]byte("consumerAddr")) + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) + consumerAddr := types.NewConsumerConsAddress([]byte("consumerAddr")) keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -130,13 +130,13 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { numAssignments := 10 testAssignments := []types.ValidatorByConsumerAddr{} for i := 0; i < numAssignments; i++ { - consumerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(i).SDKValConsAddress() - providerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(numAssignments + i).SDKValConsAddress() + consumerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(i).ConsumerConsAddress() + providerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(numAssignments + i).ProviderConsAddress() testAssignments = append(testAssignments, types.ValidatorByConsumerAddr{ ChainId: chainIDs[rand.Intn(len(chainIDs))], - ConsumerAddr: consumerAddr, - ProviderAddr: providerAddr, + ConsumerAddr: &consumerAddr, + ProviderAddr: &providerAddr, }, ) } @@ -162,11 +162,11 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { } // sorting by ValidatorByConsumerAddr.ConsumerAddr sort.Slice(expectedGetAllOneConsumerOrder, func(i, j int) bool { - return bytes.Compare(expectedGetAllOneConsumerOrder[i].ConsumerAddr, expectedGetAllOneConsumerOrder[j].ConsumerAddr) == -1 + return bytes.Compare(expectedGetAllOneConsumerOrder[i].ConsumerAddr.ToSdkConsAddr(), expectedGetAllOneConsumerOrder[j].ConsumerAddr.ToSdkConsAddr()) == -1 }) for _, assignment := range testAssignments { - pk.SetValidatorByConsumerAddr(ctx, assignment.ChainId, assignment.ConsumerAddr, assignment.ProviderAddr) + pk.SetValidatorByConsumerAddr(ctx, assignment.ChainId, *assignment.ConsumerAddr, *assignment.ProviderAddr) } result := pk.GetAllValidatorsByConsumerAddr(ctx, &chainID) @@ -178,7 +178,7 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { func TestKeyAssignmentReplacementCRUD(t *testing.T) { chainID := "consumer" - providerAddr := sdk.ConsAddress([]byte("providerAddr")) + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) expCPubKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() var expPower int64 = 100 @@ -208,10 +208,10 @@ func TestGetAllKeyAssignmentReplacements(t *testing.T) { testAssignments := []types.KeyAssignmentReplacement{} for i := 0; i < numAssignments; i++ { consumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(i).TMProtoCryptoPublicKey() - providerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(numAssignments + i).SDKValConsAddress() + providerAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(numAssignments + i).ProviderConsAddress() testAssignments = append(testAssignments, types.KeyAssignmentReplacement{ - ProviderAddr: providerAddr, + ProviderAddr: &providerAddr, PrevCKey: &consumerKey, Power: rand.Int63(), }, @@ -220,12 +220,12 @@ func TestGetAllKeyAssignmentReplacements(t *testing.T) { expectedGetAllOrder := testAssignments // sorting by KeyAssignmentReplacement.ProviderAddr sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return bytes.Compare(expectedGetAllOrder[i].ProviderAddr, expectedGetAllOrder[j].ProviderAddr) == -1 + return bytes.Compare(expectedGetAllOrder[i].ProviderAddr.ToSdkConsAddr(), expectedGetAllOrder[j].ProviderAddr.ToSdkConsAddr()) == -1 }) - pk.SetKeyAssignmentReplacement(ctx, "consumer-2", testAssignments[0].ProviderAddr, *testAssignments[0].PrevCKey, testAssignments[0].Power) + pk.SetKeyAssignmentReplacement(ctx, "consumer-2", *testAssignments[0].ProviderAddr, *testAssignments[0].PrevCKey, testAssignments[0].Power) for _, assignment := range testAssignments { - pk.SetKeyAssignmentReplacement(ctx, chainID, assignment.ProviderAddr, *assignment.PrevCKey, assignment.Power) + pk.SetKeyAssignmentReplacement(ctx, chainID, *assignment.ProviderAddr, *assignment.PrevCKey, assignment.Power) } result := pk.GetAllKeyAssignmentReplacements(ctx, chainID) @@ -235,7 +235,7 @@ func TestGetAllKeyAssignmentReplacements(t *testing.T) { func TestConsumerAddrsToPruneCRUD(t *testing.T) { chainID := "consumer" - consumerAddr := sdk.ConsAddress([]byte("consumerAddr1")) + consumerAddr := types.NewConsumerConsAddress([]byte("consumerAddr1")) vscID := uint64(1) keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) @@ -249,7 +249,7 @@ func TestConsumerAddrsToPruneCRUD(t *testing.T) { addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).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, sdk.ConsAddress(addrsToPrune[0]), consumerAddr) + require.Equal(t, *addrsToPrune[0], consumerAddr) keeper.DeleteConsumerAddrsToPrune(ctx, chainID, vscID) addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).Addresses @@ -265,10 +265,10 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { numAssignments := 10 testAssignments := []types.ConsumerAddrsToPrune{} for i := 0; i < numAssignments; i++ { - consumerAddresses := types.AddressList{} + consumerAddresses := types.ConsumerAddressList{} for j := 0; j < 2*(i+1); j++ { - consumerAddresses.Addresses = append(consumerAddresses.Addresses, - cryptotestutil.NewCryptoIdentityFromIntSeed(i*j).SDKValConsAddress()) + addr := cryptotestutil.NewCryptoIdentityFromIntSeed(i * j).ConsumerConsAddress() + consumerAddresses.Addresses = append(consumerAddresses.Addresses, &addr) } testAssignments = append(testAssignments, types.ConsumerAddrsToPrune{ @@ -305,7 +305,7 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { for _, assignment := range testAssignments { for _, addr := range assignment.ConsumerAddrs.Addresses { - pk.AppendConsumerAddrsToPrune(ctx, assignment.ChainId, assignment.VscId, addr) + pk.AppendConsumerAddrsToPrune(ctx, assignment.ChainId, assignment.VscId, *addr) } } @@ -325,14 +325,13 @@ func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chain willBePruned := map[string]bool{} for _, consAddrToPrune := range k.GetAllConsumerAddrsToPrune(ctx, chainID) { for _, cAddr := range consAddrToPrune.ConsumerAddrs.Addresses { - addr := sdk.ConsAddress(cAddr) - willBePruned[addr.String()] = true + willBePruned[cAddr.String()] = true } } good := true for _, valByConsAddr := range k.GetAllValidatorsByConsumerAddr(ctx, nil) { - if _, ok := willBePruned[sdk.ConsAddress(valByConsAddr.ConsumerAddr).String()]; ok { + if _, ok := willBePruned[valByConsAddr.ConsumerAddr.String()]; ok { // Address will be pruned, everything is fine. continue } @@ -340,7 +339,7 @@ func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chain isCurrentlyAssigned := false for _, valconsPubKey := range k.GetAllValidatorConsumerPubKeys(ctx, &valByConsAddr.ChainId) { consumerAddr, _ := utils.TMCryptoPublicKeyToConsAddr(*valconsPubKey.ConsumerKey) - if consumerAddr.Equals(sdk.ConsAddress(valByConsAddr.ConsumerAddr)) { + if consumerAddr.Equals(valByConsAddr.ConsumerAddr.ToSdkConsAddr()) { isCurrentlyAssigned = true break } @@ -403,9 +402,10 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerIdentities[0].SDKValConsAddress()) + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) - require.Equal(t, providerIdentities[0].SDKValConsAddress(), providerAddr) + require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) }, }, { @@ -438,9 +438,10 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { consumerIdentities[1].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerIdentities[1].SDKValConsAddress()) + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + consumerIdentities[1].ConsumerConsAddress()) require.True(t, found) - require.Equal(t, providerIdentities[0].SDKValConsAddress(), providerAddr) + require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) }, }, { @@ -470,9 +471,10 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.Error(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerIdentities[0].SDKValConsAddress()) + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) - require.Equal(t, providerIdentities[0].SDKValConsAddress(), providerAddr) + require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) }, }, { @@ -508,9 +510,10 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerIdentities[0].SDKValConsAddress()) + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) - require.Equal(t, providerIdentities[0].SDKValConsAddress(), providerAddr) + require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) }, }, { @@ -536,9 +539,10 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { consumerIdentities[1].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerIdentities[1].SDKValConsAddress()) + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + consumerIdentities[1].ConsumerConsAddress()) require.True(t, found) - require.Equal(t, providerIdentities[0].SDKValConsAddress(), providerAddr) + require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) }, }, { @@ -564,9 +568,10 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.Error(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerIdentities[0].SDKValConsAddress()) + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) - require.Equal(t, providerIdentities[0].SDKValConsAddress(), providerAddr) + require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) }, }, { @@ -820,7 +825,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // For each active validator on the provider chain if 0 < providerValset.power[i] { // Get the assigned key - ck, found := k.GetValidatorConsumerPubKey(ctx, CHAINID, idP.SDKValConsAddress()) + ck, found := k.GetValidatorConsumerPubKey(ctx, CHAINID, idP.ProviderConsAddress()) if !found { // Use default if unassigned ck = idP.TMProtoCryptoPublicKey() @@ -839,13 +844,13 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Check validator set replication backward direction for i := range consumerValset.identities { // For each active validator on the consumer chain - consC := consumerValset.identities[i].SDKValConsAddress() + 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) { + if idP.SDKValConsAddress().Equals(consP.ToSdkConsAddr()) { // Ensure powers are the same require.Equal(t, providerValset.power[j], consumerValset.power[i]) } @@ -873,18 +878,18 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Build up the historicSlashQueries data structure for i := range consumerValset.identities { // For each active validator on the consumer chain - consC := consumerValset.identities[i].SDKValConsAddress() + 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[string(consC)]; !found { - historicSlashQueries[string(consC)] = map[uint64]string{} + 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[string(consC)][vscid] = string(consP) + historicSlashQueries[consC.String()][vscid] = consP.String() } } diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 9ffdb16709..fff9f28bbf 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -607,7 +607,7 @@ func (k Keeper) StopConsumerChainInCachedCtx(ctx sdk.Context, p types.ConsumerRe // Proposal will be accepted if a record in the SlashLog exists for a given validator address. func (k Keeper) HandleEquivocationProposal(ctx sdk.Context, p *types.EquivocationProposal) error { for _, ev := range p.Equivocations { - if !k.GetSlashLog(ctx, ev.GetConsensusAddress()) { + if !k.GetSlashLog(ctx, types.NewProviderConsAddress(ev.GetConsensusAddress())) { return fmt.Errorf("no equivocation record found for validator %s", ev.GetConsensusAddress().String()) } k.evidenceKeeper.HandleEquivocationEvidence(ctx, ev) diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index ee66a36e3d..ffd77a08ca 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -534,7 +534,7 @@ func TestStopConsumerChain(t *testing.T) { testkeeper.SetupForStoppingConsumerChain(t, ctx, providerKeeper, mocks) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry( - ctx.BlockTime(), "chainID", 1, cryptoutil.NewCryptoIdentityFromIntSeed(90).SDKValConsAddress())) + ctx.BlockTime(), "chainID", 1, cryptoutil.NewCryptoIdentityFromIntSeed(90).ProviderConsAddress())) err := providerKeeper.QueueThrottledSlashPacketData(ctx, "chainID", 1, testkeeper.GetNewSlashPacketData()) if err != nil { @@ -1080,10 +1080,10 @@ func TestHandleEquivocationProposal(t *testing.T) { // Set slash logs according to cons addrs in equivocations consAddr := equivocations[0].GetConsensusAddress() require.NotNil(t, consAddr, "consensus address could not be parsed") - keeper.SetSlashLog(ctx, consAddr) + keeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(consAddr)) consAddr = equivocations[1].GetConsensusAddress() require.NotNil(t, consAddr, "consensus address could not be parsed") - keeper.SetSlashLog(ctx, consAddr) + keeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(consAddr)) } if tc.expectEquivsHandled { diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 5482d6e45b..8a68967157 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -312,7 +312,7 @@ func (k Keeper) OnRecvSlashPacket(ctx sdk.Context, packet channeltypes.Packet, d // The slash packet validator address may be known only on the consumer chain, // in this case, it must be mapped back to the consensus address on the provider chain - consumerConsAddr := sdk.ConsAddress(data.Validator.Address) + consumerConsAddr := providertypes.NewConsumerConsAddress(data.Validator.Address) providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, chainID, consumerConsAddr) if data.Infraction == stakingtypes.DoubleSign { @@ -322,7 +322,7 @@ func (k Keeper) OnRecvSlashPacket(ctx sdk.Context, packet channeltypes.Packet, d k.SetSlashLog(ctx, providerConsAddr) k.Logger(ctx).Info("SlashPacket received for double-signing", "chainID", chainID, - "consumer cons addr", sdk.ConsAddress(data.Validator.Address).String(), + "consumer cons addr", consumerConsAddr.String(), "provider cons addr", providerConsAddr.String(), "vscID", data.ValsetUpdateId, "infractionHeight", infractionHeight, @@ -381,7 +381,7 @@ func (k Keeper) ValidateSlashPacket(ctx sdk.Context, chainID string, // This method should NEVER be called with a double-sign infraction. func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.SlashPacketData) { - consumerConsAddr := sdk.ConsAddress(data.Validator.Address) + consumerConsAddr := providertypes.NewConsumerConsAddress(data.Validator.Address) // Obtain provider chain consensus address using the consumer chain consensus address providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, chainID, consumerConsAddr) @@ -394,7 +394,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas ) // Obtain validator from staking keeper - validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerConsAddr) + validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerConsAddr.ToSdkConsAddr()) // make sure the validator is not yet unbonded; // stakingKeeper.Slash() panics otherwise @@ -403,12 +403,12 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // 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", data.Validator.Address) + k.Logger(ctx).Error("validator not found or is unbonded", "validator", providerConsAddr.String()) return } // tombstoned validators should not be slashed multiple times. - if k.slashingKeeper.IsTombstoned(ctx, providerConsAddr) { + 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", @@ -428,14 +428,15 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // for double-signing infractions are already dropped when received // append the validator address to the slash ack for its chain id + // TODO: consumer cons address should be accepted here k.AppendSlashAck(ctx, chainID, consumerConsAddr.String()) // jail validator if !validator.IsJailed() { - k.stakingKeeper.Jail(ctx, providerConsAddr) + k.stakingKeeper.Jail(ctx, providerConsAddr.ToSdkConsAddr()) k.Logger(ctx).Info("validator jailed", "provider cons addr", providerConsAddr.String()) jailTime := ctx.BlockTime().Add(k.slashingKeeper.DowntimeJailDuration(ctx)) - k.slashingKeeper.JailUntil(ctx, providerConsAddr, jailTime) + k.slashingKeeper.JailUntil(ctx, providerConsAddr.ToSdkConsAddr(), jailTime) } ctx.EventManager().EmitEvent( diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 763c38aaa3..229975ca19 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -257,10 +257,11 @@ func TestOnRecvDoubleSignSlashPacket(t *testing.T) { require.Equal(t, uint64(0), providerKeeper.GetThrottledPacketDataSize(ctx, "chain-1")) require.Equal(t, uint64(0), providerKeeper.GetThrottledPacketDataSize(ctx, "chain-2")) require.Equal(t, 0, len(providerKeeper.GetAllGlobalSlashEntries(ctx))) - require.True(t, providerKeeper.GetSlashLog(ctx, sdk.ConsAddress(packetData.Validator.Address))) + require.True(t, providerKeeper.GetSlashLog(ctx, + providertypes.NewProviderConsAddress(packetData.Validator.Address))) // slash log should be empty for a random validator address in this testcase - randomAddress := cryptotestutil.NewCryptoIdentityFromIntSeed(100).SDKValConsAddress() + randomAddress := cryptotestutil.NewCryptoIdentityFromIntSeed(100).ProviderConsAddress() require.False(t, providerKeeper.GetSlashLog(ctx, randomAddress)) } @@ -409,10 +410,8 @@ func TestHandleSlashPacket(t *testing.T) { chainId := "consumer-id" validVscID := uint64(234) - cid := crypto.NewCryptoIdentityFromIntSeed(78932) - providerConsAddr := cid.SDKValConsAddress() - cid = crypto.NewCryptoIdentityFromIntSeed(3242334) - consumerConsAddr := cid.SDKValConsAddress() + providerConsAddr := crypto.NewCryptoIdentityFromIntSeed(7842334).ProviderConsAddress() + consumerConsAddr := crypto.NewCryptoIdentityFromIntSeed(784987634).ConsumerConsAddress() testCases := []struct { name string @@ -424,7 +423,7 @@ func TestHandleSlashPacket(t *testing.T) { { "unfound validator", ccv.SlashPacketData{ - Validator: tmtypes.Validator{Address: consumerConsAddr}, + Validator: tmtypes.Validator{Address: consumerConsAddr.ToSdkConsAddr()}, ValsetUpdateId: validVscID, Infraction: stakingtypes.Downtime, }, @@ -435,7 +434,7 @@ func TestHandleSlashPacket(t *testing.T) { // We only expect a single call to GetValidatorByConsAddr. // Method will return once validator is not found. mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( - ctx, providerConsAddr).Return( + ctx, providerConsAddr.ToSdkConsAddr()).Return( stakingtypes.Validator{}, false, // false = Not found. ).Times(1), } @@ -445,7 +444,7 @@ func TestHandleSlashPacket(t *testing.T) { { "found, but tombstoned validator", ccv.SlashPacketData{ - Validator: tmtypes.Validator{Address: consumerConsAddr}, + Validator: tmtypes.Validator{Address: consumerConsAddr.ToSdkConsAddr()}, ValsetUpdateId: validVscID, Infraction: stakingtypes.Downtime, }, @@ -454,12 +453,12 @@ func TestHandleSlashPacket(t *testing.T) { ) []*gomock.Call { return []*gomock.Call{ mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( - ctx, providerConsAddr).Return( + ctx, providerConsAddr.ToSdkConsAddr()).Return( stakingtypes.Validator{}, true, // true = Found. ).Times(1), // Execution will stop after this call as validator is tombstoned. mocks.MockSlashingKeeper.EXPECT().IsTombstoned(ctx, - providerConsAddr).Return(true).Times(1), + providerConsAddr.ToSdkConsAddr()).Return(true).Times(1), } }, 0, @@ -467,7 +466,7 @@ func TestHandleSlashPacket(t *testing.T) { { "drop packet when infraction height not found", ccv.SlashPacketData{ - Validator: tmtypes.Validator{Address: consumerConsAddr}, + Validator: tmtypes.Validator{Address: consumerConsAddr.ToSdkConsAddr()}, ValsetUpdateId: 78, // Keeper doesn't have a height mapped to this vscID. Infraction: stakingtypes.Downtime, }, @@ -478,12 +477,12 @@ func TestHandleSlashPacket(t *testing.T) { return []*gomock.Call{ mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( - ctx, providerConsAddr).Return( + ctx, providerConsAddr.ToSdkConsAddr()).Return( stakingtypes.Validator{}, true, ).Times(1), mocks.MockSlashingKeeper.EXPECT().IsTombstoned(ctx, - providerConsAddr).Return(false).Times(1), + providerConsAddr.ToSdkConsAddr()).Return(false).Times(1), } }, 0, @@ -491,7 +490,7 @@ func TestHandleSlashPacket(t *testing.T) { { "full downtime packet handling, uses init chain height and non-jailed validator", *ccv.NewSlashPacketData( - tmtypes.Validator{Address: consumerConsAddr}, + tmtypes.Validator{Address: consumerConsAddr.ToSdkConsAddr()}, 0, // ValsetUpdateId = 0 uses init chain height. stakingtypes.Downtime), func(ctx sdk.Context, mocks testkeeper.MockedKeepers, @@ -508,7 +507,7 @@ func TestHandleSlashPacket(t *testing.T) { { "full downtime packet handling, uses valid vscID and jailed validator", *ccv.NewSlashPacketData( - tmtypes.Validator{Address: consumerConsAddr}, + tmtypes.Validator{Address: consumerConsAddr.ToSdkConsAddr()}, validVscID, stakingtypes.Downtime), func(ctx sdk.Context, mocks testkeeper.MockedKeepers, diff --git a/x/ccv/provider/keeper/throttle.go b/x/ccv/provider/keeper/throttle.go index b3e0c1fc99..6ff5bcd1fb 100644 --- a/x/ccv/provider/keeper/throttle.go +++ b/x/ccv/provider/keeper/throttle.go @@ -30,7 +30,7 @@ func (k Keeper) HandleThrottleQueues(ctx sdktypes.Context) { for _, globalEntry := range allEntries { // Subtract voting power that will be jailed/tombstoned from the slash meter - meter = meter.Sub(k.GetEffectiveValPower(ctx, globalEntry.ProviderValConsAddr)) + meter = meter.Sub(k.GetEffectiveValPower(ctx, *globalEntry.ProviderValConsAddr)) // Handle one slash and any trailing vsc matured packet data instances by passing in // chainID and appropriate callbacks, relevant packet data is deleted in this method. @@ -59,11 +59,11 @@ func (k Keeper) HandleThrottleQueues(ctx sdktypes.Context) { // Obtains the effective validator power relevant to a validator consensus address. func (k Keeper) GetEffectiveValPower(ctx sdktypes.Context, - valConsAddr sdktypes.ConsAddress, // Provider's validator consensus address + valConsAddr providertypes.ProviderConsAddress, ) sdktypes.Int { // Obtain staking module val object from the provider's consensus address. // Note: if validator is not found or unbonded, this will be handled appropriately in HandleSlashPacket - val, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, valConsAddr) + val, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, valConsAddr.ToSdkConsAddr()) if !found || val.IsJailed() { // If validator is not found, or found but jailed, it's power is 0. This path is explicitly defined since the @@ -195,7 +195,12 @@ func (k Keeper) GetSlashMeterAllowance(ctx sdktypes.Context) sdktypes.Int { func (k Keeper) QueueGlobalSlashEntry(ctx sdktypes.Context, entry providertypes.GlobalSlashEntry) { store := ctx.KVStore(k.storeKey) key := providertypes.GlobalSlashEntryKey(entry) - store.Set(key, entry.ProviderValConsAddr) + bz, err := entry.ProviderValConsAddr.Marshal() + if err != nil { + // This should never happen, since the provider val cons addr should be a valid sdk address + panic(fmt.Sprintf("failed to marshal validator consensus address: %s", err.Error())) + } + store.Set(key, bz) } // DeleteGlobalSlashEntriesForConsumer deletes all pending slash packet entries in the global queue, @@ -230,7 +235,12 @@ func (k Keeper) GetAllGlobalSlashEntries(ctx sdktypes.Context) []providertypes.G // MustParseGlobalSlashEntryKey should not panic, since we should be iterating over keys that're // assumed to be correctly serialized in QueueGlobalSlashEntry. recvTime, chainID, ibcSeqNum := providertypes.MustParseGlobalSlashEntryKey(iterator.Key()) - valAddr := iterator.Value() + valAddr := providertypes.ProviderConsAddress{} + err := valAddr.Unmarshal(iterator.Value()) + if err != nil { + // This should never happen, provider cons address is assumed to be correctly serialized in QueueGlobalSlashEntry + panic(fmt.Sprintf("failed to unmarshal validator consensus address: %s", err.Error())) + } entry := providertypes.NewGlobalSlashEntry(recvTime, chainID, ibcSeqNum, valAddr) entries = append(entries, entry) } diff --git a/x/ccv/provider/keeper/throttle_test.go b/x/ccv/provider/keeper/throttle_test.go index 4a5b32c5bb..7d5056c5e9 100644 --- a/x/ccv/provider/keeper/throttle_test.go +++ b/x/ccv/provider/keeper/throttle_test.go @@ -642,11 +642,11 @@ func TestGlobalSlashEntries(t *testing.T) { // Queue 3 entries for chainIDs 0, 1, 2, note their respective ibc seq nums are // ordered differently than the chainIDs would be iterated. providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry( - now.Local(), "chain-0", 15, cryptoutil.NewCryptoIdentityFromIntSeed(10).SDKValConsAddress())) + now.Local(), "chain-0", 15, cryptoutil.NewCryptoIdentityFromIntSeed(10).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry( - now.Local(), "chain-1", 10, cryptoutil.NewCryptoIdentityFromIntSeed(11).SDKValConsAddress())) + now.Local(), "chain-1", 10, cryptoutil.NewCryptoIdentityFromIntSeed(11).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry( - now.Local(), "chain-2", 5, cryptoutil.NewCryptoIdentityFromIntSeed(12).SDKValConsAddress())) + now.Local(), "chain-2", 5, cryptoutil.NewCryptoIdentityFromIntSeed(12).ProviderConsAddress())) globalEntries = providerKeeper.GetAllGlobalSlashEntries(ctx) require.Equal(t, 3, len(globalEntries)) @@ -654,13 +654,13 @@ func TestGlobalSlashEntries(t *testing.T) { // Queue 3 entries for chainIDs 0, 1, 2 an hour later, with incremented ibc seq nums providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry( now.Add(time.Hour).Local(), "chain-0", 16, // should appear last for this recv time - cryptoutil.NewCryptoIdentityFromIntSeed(20).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(20).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry( now.Add(time.Hour).Local(), "chain-1", 11, // should appear middle for this recv time - cryptoutil.NewCryptoIdentityFromIntSeed(21).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(21).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry( now.Add(time.Hour).Local(), "chain-2", 6, // should appear first for this recv time - cryptoutil.NewCryptoIdentityFromIntSeed(22).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(22).ProviderConsAddress())) // Retrieve entries from store globalEntries = providerKeeper.GetAllGlobalSlashEntries(ctx) @@ -677,14 +677,13 @@ func TestGlobalSlashEntries(t *testing.T) { // Queue 3 entries for chainIDs 5, 6, 7 another hour later providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour).Local(), "chain-5", 50, // should appear middle for this recv time - cryptoutil.NewCryptoIdentityFromIntSeed(96).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(96).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour).Local(), "chain-6", 60, // should appear last for this recv time - cryptoutil.NewCryptoIdentityFromIntSeed(97).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(97).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour).Local(), "chain-7", 40, // should appear first for this recv time - cryptoutil.NewCryptoIdentityFromIntSeed(98).SDKValConsAddress())) - + cryptoutil.NewCryptoIdentityFromIntSeed(98).ProviderConsAddress())) // Retrieve entries from store globalEntries = providerKeeper.GetAllGlobalSlashEntries(ctx) require.Equal(t, 9, len(globalEntries)) @@ -732,19 +731,19 @@ func TestDeleteGlobalSlashEntriesForConsumer(t *testing.T) { // Queue 2 global entries for a consumer chain ID providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry(time.Now().Add(time.Hour), "chain-78", 1, - cryptoutil.NewCryptoIdentityFromIntSeed(78).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(78).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry(time.Now().Add(time.Hour), "chain-78", 2, - cryptoutil.NewCryptoIdentityFromIntSeed(79).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(79).ProviderConsAddress())) // Queue 1 global entry for two other consumer chain IDs providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry(time.Now().Add(2*time.Hour), "chain-79", 1, - cryptoutil.NewCryptoIdentityFromIntSeed(80).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(80).ProviderConsAddress())) providerKeeper.QueueGlobalSlashEntry(ctx, providertypes.NewGlobalSlashEntry(time.Now().Add(3*time.Hour), "chain-80", 1, - cryptoutil.NewCryptoIdentityFromIntSeed(81).SDKValConsAddress())) + cryptoutil.NewCryptoIdentityFromIntSeed(81).ProviderConsAddress())) // Delete entries for chain-78, confirm those are deleted, and the other two remain providerKeeper.DeleteGlobalSlashEntriesForConsumer(ctx, "chain-78") @@ -766,15 +765,25 @@ func TestGlobalSlashEntryDeletion(t *testing.T) { entries := providerKeeper.GetAllGlobalSlashEntries(ctx) require.Equal(t, 0, len(entries)) + providerConsAddrs := []providertypes.ProviderConsAddress{ + cryptoutil.NewCryptoIdentityFromIntSeed(1).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(2).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(3).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(4).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(5).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(6).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(7).ProviderConsAddress(), + } + // Instantiate entries in the expected order we wish to get them back as (ordered by recv time) entries = []providertypes.GlobalSlashEntry{} - entries = append(entries, providertypes.NewGlobalSlashEntry(now, "chain-0", 1, cryptoutil.NewCryptoIdentityFromIntSeed(0).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(time.Hour).UTC(), "chain-1", 178, cryptoutil.NewCryptoIdentityFromIntSeed(1).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour).Local(), "chain-2", 89, cryptoutil.NewCryptoIdentityFromIntSeed(2).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(3*time.Hour).In(time.FixedZone("UTC-8", -8*60*60)), "chain-3", 23423, cryptoutil.NewCryptoIdentityFromIntSeed(3).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(4*time.Hour).Local(), "chain-4", 323, cryptoutil.NewCryptoIdentityFromIntSeed(4).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(5*time.Hour).UTC(), "chain-5", 18, cryptoutil.NewCryptoIdentityFromIntSeed(5).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(6*time.Hour).Local(), "chain-6", 2, cryptoutil.NewCryptoIdentityFromIntSeed(6).SDKValConsAddress())) + entries = append(entries, providertypes.NewGlobalSlashEntry(now, "chain-0", 1, providerConsAddrs[0])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(time.Hour).UTC(), "chain-1", 178, providerConsAddrs[1])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour).Local(), "chain-2", 89, providerConsAddrs[2])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(3*time.Hour).In(time.FixedZone("UTC-8", -8*60*60)), "chain-3", 23423, providerConsAddrs[3])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(4*time.Hour).Local(), "chain-4", 323, providerConsAddrs[4])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(5*time.Hour).UTC(), "chain-5", 18, providerConsAddrs[5])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(6*time.Hour).Local(), "chain-6", 2, providerConsAddrs[6])) // Instantiate shuffled copy of above slice shuffledEntries := append([]providertypes.GlobalSlashEntry{}, entries...) diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 0929ea90ef..570598034c 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -103,7 +103,7 @@ func TestProviderProposalHandler(t *testing.T) { testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) case tc.expValidEquivocation: - providerKeeper.SetSlashLog(ctx, equivocation.GetConsensusAddress()) + providerKeeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(equivocation.GetConsensusAddress())) mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocation) } diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index e60b42a4ea..b80f461c72 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -9,7 +9,7 @@ import ( types "github.com/cosmos/interchain-security/x/ccv/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - crypto "github.com/tendermint/tendermint/proto/tendermint/crypto" + _ "github.com/tendermint/tendermint/proto/tendermint/crypto" io "io" math "math" math_bits "math/bits" @@ -323,199 +323,10 @@ func (m *ValsetUpdateIdToHeight) GetHeight() uint64 { return 0 } -// Used to serialize the ValidatorConsumerPubKey index from key assignment -// ValidatorConsumerPubKey: (chainID, providerAddr consAddr) -> consumerKey tmprotocrypto.PublicKey -type ValidatorConsumerPubKey struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ProviderAddr []byte `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` - ConsumerKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` -} - -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_48411d9c7900d48e, []int{3} -} -func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidatorConsumerPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValidatorConsumerPubKey.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 *ValidatorConsumerPubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorConsumerPubKey.Merge(m, src) -} -func (m *ValidatorConsumerPubKey) XXX_Size() int { - return m.Size() -} -func (m *ValidatorConsumerPubKey) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorConsumerPubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidatorConsumerPubKey proto.InternalMessageInfo - -func (m *ValidatorConsumerPubKey) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ValidatorConsumerPubKey) GetProviderAddr() []byte { - if m != nil { - return m.ProviderAddr - } - return nil -} - -func (m *ValidatorConsumerPubKey) GetConsumerKey() *crypto.PublicKey { - if m != nil { - return m.ConsumerKey - } - return nil -} - -// Used to serialize the ValidatorConsumerAddr index from key assignment -// ValidatorByConsumerAddr: (chainID, consumerAddr consAddr) -> providerAddr consAddr -type ValidatorByConsumerAddr struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ConsumerAddr []byte `protobuf:"bytes,2,opt,name=consumer_addr,json=consumerAddr,proto3" json:"consumer_addr,omitempty"` - ProviderAddr []byte `protobuf:"bytes,3,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` -} - -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_48411d9c7900d48e, []int{4} -} -func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidatorByConsumerAddr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValidatorByConsumerAddr.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 *ValidatorByConsumerAddr) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorByConsumerAddr.Merge(m, src) -} -func (m *ValidatorByConsumerAddr) XXX_Size() int { - return m.Size() -} -func (m *ValidatorByConsumerAddr) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorByConsumerAddr.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidatorByConsumerAddr proto.InternalMessageInfo - -func (m *ValidatorByConsumerAddr) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ValidatorByConsumerAddr) GetConsumerAddr() []byte { - if m != nil { - return m.ConsumerAddr - } - return nil -} - -func (m *ValidatorByConsumerAddr) GetProviderAddr() []byte { - if m != nil { - return m.ProviderAddr - } - return nil -} - -// Used to serialize the ConsumerAddrsToPrune index from key assignment -// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList -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_48411d9c7900d48e, []int{5} -} -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 -} - func init() { proto.RegisterType((*GenesisState)(nil), "interchain_security.ccv.provider.v1.GenesisState") proto.RegisterType((*ConsumerState)(nil), "interchain_security.ccv.provider.v1.ConsumerState") proto.RegisterType((*ValsetUpdateIdToHeight)(nil), "interchain_security.ccv.provider.v1.ValsetUpdateIdToHeight") - 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") } func init() { @@ -523,69 +334,61 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 984 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xd1, 0x6e, 0xe3, 0x44, - 0x17, 0xae, 0xdb, 0x34, 0xdb, 0x4c, 0x92, 0xfe, 0xfd, 0x87, 0x92, 0xf5, 0xa6, 0x4b, 0xb6, 0xca, - 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34, 0x31, 0x30, - 0xf3, 0x4c, 0xcc, 0xb8, 0xc7, 0xb8, 0x79, 0xc1, 0xf5, 0x6e, 0xf1, 0x9d, 0xf5, 0xac, 0xfa, 0x45, - 0x27, 0x92, 0x80, 0xf0, 0x49, 0x5d, 0x7e, 0x47, 0xbd, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x81, 0xaf, 0x62, 0x9d, 0x96, 0x0a, 0x00, 0x00, + // 853 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x41, 0x8f, 0xdb, 0x44, + 0x14, 0x5e, 0xef, 0xa6, 0xdb, 0xcd, 0x6c, 0x77, 0x59, 0x86, 0x55, 0x70, 0xb3, 0x90, 0xae, 0x02, + 0x48, 0x91, 0x00, 0x1b, 0x07, 0x0e, 0x50, 0xe0, 0xd0, 0xb4, 0x12, 0x44, 0x08, 0x11, 0xa5, 0xdb, + 0x1e, 0xca, 0xc1, 0x9a, 0x8c, 0x47, 0xc9, 0x10, 0x7b, 0xc6, 0x9a, 0x19, 0x9b, 0x5a, 0x08, 0x89, + 0x8a, 0x3f, 0xc0, 0xbf, 0xa2, 0xc7, 0x1e, 0x39, 0x55, 0x68, 0xf7, 0x1f, 0xf0, 0x0b, 0x90, 0xc7, + 0x63, 0xd7, 0x5e, 0x12, 0x48, 0xb8, 0xc5, 0xef, 0x9b, 0xf7, 0x7d, 0xef, 0xcd, 0x9b, 0xf9, 0x26, + 0xc0, 0xa3, 0x4c, 0x11, 0x81, 0x17, 0x88, 0x32, 0x5f, 0x12, 0x9c, 0x08, 0xaa, 0x32, 0x17, 0xe3, + 0xd4, 0x8d, 0x05, 0x4f, 0x69, 0x40, 0x84, 0x9b, 0x7a, 0xee, 0x9c, 0x30, 0x22, 0xa9, 0x74, 0x62, + 0xc1, 0x15, 0x87, 0xef, 0xac, 0x48, 0x71, 0x30, 0x4e, 0x9d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 0xda, + 0x04, 0xe1, 0x25, 0x51, 0x0f, 0x90, 0x42, 0xe5, 0x4e, 0x1b, 0xf6, 0xc2, 0x63, 0x8a, 0x45, 0x12, + 0x7e, 0x00, 0xa0, 0x0c, 0x91, 0x5c, 0xf8, 0x01, 0xff, 0x91, 0x29, 0x1a, 0x11, 0x1f, 0xe1, 0xa5, + 0xbe, 0xad, 0xed, 0xe9, 0x89, 0x46, 0x1e, 0x18, 0xe0, 0x1e, 0x5e, 0xc2, 0x1f, 0xc0, 0x1b, 0x0d, + 0x17, 0xf5, 0x29, 0x0b, 0xc8, 0x53, 0xfb, 0x40, 0x17, 0xf8, 0xc9, 0x66, 0x47, 0x51, 0xe2, 0xba, + 0x79, 0x9a, 0xe2, 0x5e, 0xaf, 0x7b, 0xf6, 0x38, 0x27, 0xed, 0x3f, 0x01, 0x9d, 0xd5, 0x76, 0xb8, + 0xc5, 0xb3, 0xd6, 0x01, 0xfb, 0x66, 0xac, 0xbb, 0x1a, 0x37, 0x5f, 0xa3, 0x8b, 0xe7, 0x97, 0x3d, + 0xeb, 0xc5, 0x65, 0xcf, 0xfa, 0xf3, 0xb2, 0x67, 0xfd, 0x76, 0xd5, 0xdb, 0x79, 0x71, 0xd5, 0xdb, + 0xf9, 0xe3, 0xaa, 0xb7, 0xf3, 0xe4, 0xee, 0x9c, 0xaa, 0x45, 0x32, 0x73, 0x30, 0x8f, 0x5c, 0xcc, + 0x65, 0xc4, 0xa5, 0xfb, 0xaa, 0xab, 0x0f, 0xab, 0x67, 0xfa, 0x69, 0xf3, 0x0f, 0x81, 0xca, 0x62, + 0x22, 0x67, 0xfb, 0xfa, 0x19, 0xfe, 0xf8, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x19, 0x84, + 0x4a, 0xd5, 0x08, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -879,146 +682,6 @@ func (m *ValsetUpdateIdToHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) 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 = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.ProviderAddr) > 0 { - i -= len(m.ProviderAddr) - copy(dAtA[i:], m.ProviderAddr) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ProviderAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValidatorByConsumerAddr) 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 *ValidatorByConsumerAddr) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorByConsumerAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ProviderAddr) > 0 { - i -= len(m.ProviderAddr) - copy(dAtA[i:], m.ProviderAddr) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ProviderAddr))) - i-- - dAtA[i] = 0x1a - } - if len(m.ConsumerAddr) > 0 { - i -= len(m.ConsumerAddr) - copy(dAtA[i:], m.ConsumerAddr) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ConsumerAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - 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 = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.VscId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -1155,70 +818,8 @@ func (m *ValsetUpdateIdToHeight) Size() (n int) { return n } -func (m *ValidatorConsumerPubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.ProviderAddr) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if m.ConsumerKey != nil { - l = m.ConsumerKey.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func (m *ValidatorByConsumerAddr) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.ConsumerAddr) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.ProviderAddr) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - 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 + sovGenesis(uint64(l)) - } - if m.VscId != 0 { - n += 1 + sovGenesis(uint64(m.VscId)) - } - if m.ConsumerAddrs != nil { - l = m.ConsumerAddrs.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -2019,445 +1620,6 @@ func (m *ValsetUpdateIdToHeight) Unmarshal(dAtA []byte) error { } return nil } -func (m *ValidatorConsumerPubKey) 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 ErrIntOverflowGenesis - } - 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: ValidatorConsumerPubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorConsumerPubKey: 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 ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - 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 ProviderAddr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProviderAddr = append(m.ProviderAddr[:0], dAtA[iNdEx:postIndex]...) - if m.ProviderAddr == nil { - m.ProviderAddr = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", 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.ConsumerKey == nil { - m.ConsumerKey = &crypto.PublicKey{} - } - if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ValidatorByConsumerAddr) 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 ErrIntOverflowGenesis - } - 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: ValidatorByConsumerAddr: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorByConsumerAddr: 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 ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - 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 ConsumerAddr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConsumerAddr = append(m.ConsumerAddr[:0], dAtA[iNdEx:postIndex]...) - if m.ConsumerAddr == nil { - m.ConsumerAddr = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProviderAddr = append(m.ProviderAddr[:0], dAtA[iNdEx:postIndex]...) - if m.ProviderAddr == nil { - m.ProviderAddr = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - 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 ErrIntOverflowGenesis - } - 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 ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - 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 ErrIntOverflowGenesis - } - 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 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.ConsumerAddrs == nil { - m.ConsumerAddrs = &AddressList{} - } - if err := m.ConsumerAddrs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/key_assignment.go b/x/ccv/provider/types/key_assignment.go index 8ba32b648d..380b70c847 100644 --- a/x/ccv/provider/types/key_assignment.go +++ b/x/ccv/provider/types/key_assignment.go @@ -9,6 +9,44 @@ import ( ccvtypes "github.com/cosmos/interchain-security/x/ccv/types" ) +// NewProviderConsAddress creates a new ProviderConsAddress, +// a validator's consensus address on the provider chain. +func NewProviderConsAddress(addr sdk.ConsAddress) ProviderConsAddress { + return ProviderConsAddress{ + Address: addr, + } +} + +func (p *ProviderConsAddress) ToSdkConsAddr() sdk.ConsAddress { + return sdk.ConsAddress(p.Address) +} + +// String implements the Stringer interface for ProviderConsAddress, +// in the same format as sdk.ConsAddress +func (p *ProviderConsAddress) String() string { + return p.ToSdkConsAddr().String() +} + +// NewConsumerConsAddress creates a new ConsumerConsAddress, +// a validator's assigned consensus address for a consumer chain. +// Note this type is for type safety within provider code, consumer code uses normal sdk.ConsAddress, +// since there's no notion of provider vs consumer address. +func NewConsumerConsAddress(addr sdk.ConsAddress) ConsumerConsAddress { + return ConsumerConsAddress{ + Address: addr, + } +} + +func (c *ConsumerConsAddress) ToSdkConsAddr() sdk.ConsAddress { + return sdk.ConsAddress(c.Address) +} + +// String implements the Stringer interface for ConsumerConsAddress, +// in the same format as sdk.ConsAddress +func (c *ConsumerConsAddress) String() string { + return c.ToSdkConsAddr().String() +} + // KeyAssignmentValidateBasic validates all the genesis state for key assignment // This is a utility. Key Assignment does not define any new proto types, but // has a lot of nested data. @@ -21,7 +59,7 @@ func KeyAssignmentValidateBasic( if strings.TrimSpace(e.ChainId) == "" { return sdkerrors.Wrap(ccvtypes.ErrInvalidGenesis, "consumer chain id must not be blank") } - if err := sdk.VerifyAddressFormat(e.ProviderAddr); err != nil { + if err := sdk.VerifyAddressFormat(e.ProviderAddr.ToSdkConsAddr()); err != nil { return sdkerrors.Wrap(ccvtypes.ErrInvalidGenesis, fmt.Sprintf("invalid provider address: %s", e.ProviderAddr)) } if e.ConsumerKey == nil { @@ -32,10 +70,10 @@ func KeyAssignmentValidateBasic( if strings.TrimSpace(e.ChainId) == "" { return sdkerrors.Wrap(ccvtypes.ErrInvalidGenesis, "consumer chain id must not be blank") } - if err := sdk.VerifyAddressFormat(e.ProviderAddr); err != nil { + if err := sdk.VerifyAddressFormat(e.ProviderAddr.ToSdkConsAddr()); err != nil { return sdkerrors.Wrap(ccvtypes.ErrInvalidGenesis, fmt.Sprintf("invalid provider address: %s", e.ProviderAddr)) } - if err := sdk.VerifyAddressFormat(e.ConsumerAddr); err != nil { + if err := sdk.VerifyAddressFormat(e.ConsumerAddr.ToSdkConsAddr()); err != nil { return sdkerrors.Wrap(ccvtypes.ErrInvalidGenesis, fmt.Sprintf("invalid consumer address: %s", e.ConsumerAddr)) } } @@ -45,7 +83,7 @@ func KeyAssignmentValidateBasic( } // Don't check e.vscid, it's an unsigned integer for _, a := range e.ConsumerAddrs.Addresses { - if err := sdk.VerifyAddressFormat(a); err != nil { + if err := sdk.VerifyAddressFormat(a.ToSdkConsAddr()); err != nil { return sdkerrors.Wrap(ccvtypes.ErrInvalidGenesis, fmt.Sprintf("invalid consumer address: %s", a)) } } diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 3a3e1151e8..acb73aea29 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -266,20 +266,20 @@ func ParseVscSendingTimestampKey(bz []byte) (string, uint64, error) { // ConsumerValidatorsKey returns the key under which the // validator assigned keys for every consumer chain are stored -func ConsumerValidatorsKey(chainID string, addr sdk.ConsAddress) []byte { - return ChainIdAndConsAddrKey(ConsumerValidatorsBytePrefix, chainID, addr) +func ConsumerValidatorsKey(chainID string, addr ProviderConsAddress) []byte { + return ChainIdAndConsAddrKey(ConsumerValidatorsBytePrefix, chainID, addr.ToSdkConsAddr()) } // ValidatorsByConsumerAddrKey returns the key under which the mapping from validator addresses // on consumer chains to validator addresses on the provider chain is stored -func ValidatorsByConsumerAddrKey(chainID string, addr sdk.ConsAddress) []byte { - return ChainIdAndConsAddrKey(ValidatorsByConsumerAddrBytePrefix, chainID, addr) +func ValidatorsByConsumerAddrKey(chainID string, addr ConsumerConsAddress) []byte { + return ChainIdAndConsAddrKey(ValidatorsByConsumerAddrBytePrefix, chainID, addr.ToSdkConsAddr()) } // KeyAssignmentReplacementsKey returns the key under which the // key assignments that need to be replaced in the current block are stored -func KeyAssignmentReplacementsKey(chainID string, addr sdk.ConsAddress) []byte { - return ChainIdAndConsAddrKey(KeyAssignmentReplacementsBytePrefix, chainID, addr) +func KeyAssignmentReplacementsKey(chainID string, addr ProviderConsAddress) []byte { + return ChainIdAndConsAddrKey(KeyAssignmentReplacementsBytePrefix, chainID, addr.ToSdkConsAddr()) } // ConsumerAddrsToPruneKey returns the key under which the @@ -445,6 +445,6 @@ func ParseChainIdAndConsAddrKey(prefix byte, bz []byte) (string, sdk.ConsAddress } // SlashLogKey returns the key to a validator's slash log -func SlashLogKey(providerAddr sdk.ConsAddress) []byte { - return append([]byte{SlashAcksBytePrefix}, providerAddr.Bytes()...) +func SlashLogKey(providerAddr ProviderConsAddress) []byte { + return append([]byte{SlashAcksBytePrefix}, providerAddr.ToSdkConsAddr().Bytes()...) } diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index a9e3448510..5570c024c0 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -151,10 +151,17 @@ func TestThrottledPacketDataKeyAndParse(t *testing.T) { // Tests the construction and parsing of keys for global slash entries func TestGlobalSlashEntryKeyAndParse(t *testing.T) { now := time.Now() + + providerConsAddrs := []providertypes.ProviderConsAddress{ + cryptoutil.NewCryptoIdentityFromIntSeed(0).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(1).ProviderConsAddress(), + cryptoutil.NewCryptoIdentityFromIntSeed(2).ProviderConsAddress(), + } + entries := []providertypes.GlobalSlashEntry{} - entries = append(entries, providertypes.NewGlobalSlashEntry(now, "chain-0", 2, cryptoutil.NewCryptoIdentityFromIntSeed(0).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour), "chain-7896978", 3, cryptoutil.NewCryptoIdentityFromIntSeed(1).SDKValConsAddress())) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(3*time.Hour), "chain-1", 4723894, cryptoutil.NewCryptoIdentityFromIntSeed(2).SDKValConsAddress())) + entries = append(entries, providertypes.NewGlobalSlashEntry(now, "chain-0", 2, providerConsAddrs[0])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour), "chain-7896978", 3, providerConsAddrs[1])) + entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(3*time.Hour), "chain-1", 4723894, providerConsAddrs[2])) for _, entry := range entries { key := providertypes.GlobalSlashEntryKey(entry) diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index a52166adf3..c39f6fa2f5 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -260,7 +260,7 @@ type GlobalSlashEntry struct { // This field is used to obtain validator power in HandleThrottleQueues. // // This field is not used in the store key, but is persisted in value bytes, see QueueGlobalSlashEntry. - ProviderValConsAddr []byte `protobuf:"bytes,4,opt,name=provider_val_cons_addr,json=providerValConsAddr,proto3" json:"provider_val_cons_addr,omitempty"` + ProviderValConsAddr *ProviderConsAddress `protobuf:"bytes,4,opt,name=provider_val_cons_addr,json=providerValConsAddr,proto3" json:"provider_val_cons_addr,omitempty"` } func (m *GlobalSlashEntry) Reset() { *m = GlobalSlashEntry{} } @@ -317,7 +317,7 @@ func (m *GlobalSlashEntry) GetIbcSeqNum() uint64 { return 0 } -func (m *GlobalSlashEntry) GetProviderValConsAddr() []byte { +func (m *GlobalSlashEntry) GetProviderValConsAddr() *ProviderConsAddress { if m != nil { return m.ProviderValConsAddr } @@ -489,7 +489,7 @@ func (m *HandshakeMetadata) GetVersion() string { return "" } -// SlashAcks contains addesses of consumer chain validators +// SlashAcks contains cons addresses of consumer chain validators // successfully slashed on the provider chain type SlashAcks struct { Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` @@ -627,51 +627,6 @@ func (m *ConsumerRemovalProposals) GetPending() []*ConsumerRemovalProposal { return nil } -// AddressList contains a list of consensus addresses -type AddressList struct { - Addresses [][]byte `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` -} - -func (m *AddressList) Reset() { *m = AddressList{} } -func (m *AddressList) String() string { return proto.CompactTextString(m) } -func (*AddressList) ProtoMessage() {} -func (*AddressList) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{9} -} -func (m *AddressList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AddressList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AddressList.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 *AddressList) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddressList.Merge(m, src) -} -func (m *AddressList) XXX_Size() int { - return m.Size() -} -func (m *AddressList) XXX_DiscardUnknown() { - xxx_messageInfo_AddressList.DiscardUnknown(m) -} - -var xxx_messageInfo_AddressList proto.InternalMessageInfo - -func (m *AddressList) GetAddresses() [][]byte { - if m != nil { - return m.Addresses - } - return nil -} - type ChannelToChain struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -681,7 +636,7 @@ func (m *ChannelToChain) Reset() { *m = ChannelToChain{} } func (m *ChannelToChain) String() string { return proto.CompactTextString(m) } func (*ChannelToChain) ProtoMessage() {} func (*ChannelToChain) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{10} + return fileDescriptor_f22ec409a72b7b72, []int{9} } func (m *ChannelToChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -735,7 +690,7 @@ 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{11} + return fileDescriptor_f22ec409a72b7b72, []int{10} } func (m *VscUnbondingOps) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -790,7 +745,7 @@ 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{12} + return fileDescriptor_f22ec409a72b7b72, []int{11} } func (m *UnbondingOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -842,7 +797,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{13} + return fileDescriptor_f22ec409a72b7b72, []int{12} } func (m *InitTimeoutTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -894,7 +849,7 @@ 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{14} + return fileDescriptor_f22ec409a72b7b72, []int{13} } func (m *VscSendTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -937,17 +892,152 @@ func (m *VscSendTimestamp) GetTimestamp() time.Time { return time.Time{} } +// A validator's assigned consensus address for a consumer chain. +// Note this type is for type safety within provider code, consumer code uses normal sdk.ConsAddress, +// since there's no notion of provider vs consumer address. +type ConsumerConsAddress struct { + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *ConsumerConsAddress) Reset() { *m = ConsumerConsAddress{} } +func (*ConsumerConsAddress) ProtoMessage() {} +func (*ConsumerConsAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{14} +} +func (m *ConsumerConsAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerConsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerConsAddress.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 *ConsumerConsAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerConsAddress.Merge(m, src) +} +func (m *ConsumerConsAddress) XXX_Size() int { + return m.Size() +} +func (m *ConsumerConsAddress) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerConsAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerConsAddress proto.InternalMessageInfo + +func (m *ConsumerConsAddress) GetAddress() []byte { + if m != nil { + return m.Address + } + return nil +} + +// A validator's consensus address on the provider chain +type ProviderConsAddress struct { + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *ProviderConsAddress) Reset() { *m = ProviderConsAddress{} } +func (*ProviderConsAddress) ProtoMessage() {} +func (*ProviderConsAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{15} +} +func (m *ProviderConsAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProviderConsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProviderConsAddress.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 *ProviderConsAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProviderConsAddress.Merge(m, src) +} +func (m *ProviderConsAddress) XXX_Size() int { + return m.Size() +} +func (m *ProviderConsAddress) XXX_DiscardUnknown() { + xxx_messageInfo_ProviderConsAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_ProviderConsAddress proto.InternalMessageInfo + +func (m *ProviderConsAddress) GetAddress() []byte { + if m != nil { + return m.Address + } + return nil +} + +// AddressList contains a list of consumer consensus addresses +type ConsumerAddressList struct { + Addresses []*ConsumerConsAddress `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` +} + +func (m *ConsumerAddressList) Reset() { *m = ConsumerAddressList{} } +func (m *ConsumerAddressList) String() string { return proto.CompactTextString(m) } +func (*ConsumerAddressList) ProtoMessage() {} +func (*ConsumerAddressList) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{16} +} +func (m *ConsumerAddressList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerAddressList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerAddressList.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 *ConsumerAddressList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerAddressList.Merge(m, src) +} +func (m *ConsumerAddressList) XXX_Size() int { + return m.Size() +} +func (m *ConsumerAddressList) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerAddressList.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerAddressList proto.InternalMessageInfo + +func (m *ConsumerAddressList) GetAddresses() []*ConsumerConsAddress { + if m != nil { + return m.Addresses + } + 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"` - Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` + ProviderAddr *ProviderConsAddress `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"` + Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` } func (m *KeyAssignmentReplacement) Reset() { *m = KeyAssignmentReplacement{} } func (m *KeyAssignmentReplacement) String() string { return proto.CompactTextString(m) } func (*KeyAssignmentReplacement) ProtoMessage() {} func (*KeyAssignmentReplacement) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{15} + return fileDescriptor_f22ec409a72b7b72, []int{17} } func (m *KeyAssignmentReplacement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -976,7 +1066,7 @@ func (m *KeyAssignmentReplacement) XXX_DiscardUnknown() { var xxx_messageInfo_KeyAssignmentReplacement proto.InternalMessageInfo -func (m *KeyAssignmentReplacement) GetProviderAddr() []byte { +func (m *KeyAssignmentReplacement) GetProviderAddr() *ProviderConsAddress { if m != nil { return m.ProviderAddr } @@ -997,6 +1087,192 @@ func (m *KeyAssignmentReplacement) GetPower() int64 { return 0 } +// Used to serialize the ValidatorConsumerPubKey index from key assignment +// ValidatorConsumerPubKey: (chainID, providerAddr consAddr) -> consumerKey tmprotocrypto.PublicKey +type ValidatorConsumerPubKey struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ProviderAddr *ProviderConsAddress `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` + ConsumerKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` +} + +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{18} +} +func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorConsumerPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorConsumerPubKey.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 *ValidatorConsumerPubKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorConsumerPubKey.Merge(m, src) +} +func (m *ValidatorConsumerPubKey) XXX_Size() int { + return m.Size() +} +func (m *ValidatorConsumerPubKey) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorConsumerPubKey.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorConsumerPubKey proto.InternalMessageInfo + +func (m *ValidatorConsumerPubKey) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ValidatorConsumerPubKey) GetProviderAddr() *ProviderConsAddress { + if m != nil { + return m.ProviderAddr + } + return nil +} + +func (m *ValidatorConsumerPubKey) GetConsumerKey() *crypto.PublicKey { + if m != nil { + return m.ConsumerKey + } + return nil +} + +// Used to serialize the ValidatorConsumerAddr index from key assignment +// ValidatorByConsumerAddr: (chainID, consumerAddr consAddr) -> providerAddr consAddr +type ValidatorByConsumerAddr struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConsumerAddr *ConsumerConsAddress `protobuf:"bytes,2,opt,name=consumer_addr,json=consumerAddr,proto3" json:"consumer_addr,omitempty"` + ProviderAddr *ProviderConsAddress `protobuf:"bytes,3,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` +} + +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{19} +} +func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorByConsumerAddr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorByConsumerAddr.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 *ValidatorByConsumerAddr) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorByConsumerAddr.Merge(m, src) +} +func (m *ValidatorByConsumerAddr) XXX_Size() int { + return m.Size() +} +func (m *ValidatorByConsumerAddr) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorByConsumerAddr.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorByConsumerAddr proto.InternalMessageInfo + +func (m *ValidatorByConsumerAddr) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ValidatorByConsumerAddr) GetConsumerAddr() *ConsumerConsAddress { + if m != nil { + return m.ConsumerAddr + } + return nil +} + +func (m *ValidatorByConsumerAddr) GetProviderAddr() *ProviderConsAddress { + if m != nil { + return m.ProviderAddr + } + return nil +} + +// Used to serialize the ConsumerAddrsToPrune index from key assignment +// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList +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 *ConsumerAddressList `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{20} +} +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() *ConsumerAddressList { + if m != nil { + return m.ConsumerAddrs + } + return nil +} + func init() { proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") @@ -1007,13 +1283,18 @@ func init() { proto.RegisterType((*SlashAcks)(nil), "interchain_security.ccv.provider.v1.SlashAcks") proto.RegisterType((*ConsumerAdditionProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposals") 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((*ConsumerConsAddress)(nil), "interchain_security.ccv.provider.v1.ConsumerConsAddress") + proto.RegisterType((*ProviderConsAddress)(nil), "interchain_security.ccv.provider.v1.ProviderConsAddress") + proto.RegisterType((*ConsumerAddressList)(nil), "interchain_security.ccv.provider.v1.ConsumerAddressList") 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") } func init() { @@ -1021,95 +1302,106 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1406 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4b, 0x6f, 0xdb, 0xc6, - 0x16, 0x36, 0x2d, 0xf9, 0xa1, 0x91, 0x9f, 0xb4, 0x93, 0xd0, 0xb9, 0xbe, 0xb2, 0xa2, 0xdc, 0x7b, - 0xa1, 0x8b, 0x20, 0x14, 0xec, 0x6c, 0x0a, 0xa3, 0x45, 0x61, 0x2b, 0x0f, 0xbb, 0x6e, 0x12, 0x87, - 0x76, 0x5d, 0xb4, 0x5d, 0x10, 0xc3, 0xe1, 0x58, 0x1a, 0x98, 0xe4, 0x30, 0x33, 0x23, 0x26, 0xfa, - 0x07, 0x5d, 0xa6, 0xe8, 0x26, 0x40, 0x37, 0xf9, 0x07, 0xfd, 0x1b, 0x59, 0x66, 0xd9, 0x55, 0x5a, - 0x38, 0xcb, 0xee, 0xfa, 0x0b, 0x8a, 0x99, 0xe1, 0x43, 0x54, 0x1c, 0xc0, 0x41, 0xdb, 0x1d, 0xe7, - 0x9c, 0xef, 0x7c, 0xf3, 0x38, 0xe7, 0x7c, 0x33, 0x04, 0x5b, 0x24, 0x12, 0x98, 0xa1, 0x3e, 0x24, - 0x91, 0xcb, 0x31, 0x1a, 0x30, 0x22, 0x86, 0x1d, 0x84, 0x92, 0x4e, 0xcc, 0x68, 0x42, 0x7c, 0xcc, - 0x3a, 0xc9, 0x66, 0xfe, 0x6d, 0xc7, 0x8c, 0x0a, 0x6a, 0xde, 0xbc, 0x20, 0xc6, 0x46, 0x28, 0xb1, - 0x73, 0x5c, 0xb2, 0x79, 0x7d, 0xb5, 0x47, 0x7b, 0x54, 0xe1, 0x3b, 0xf2, 0x4b, 0x87, 0x5e, 0xdf, - 0xe8, 0x51, 0xda, 0x0b, 0x70, 0x47, 0x8d, 0xbc, 0xc1, 0x69, 0x47, 0x90, 0x10, 0x73, 0x01, 0xc3, - 0x38, 0x05, 0x34, 0xc6, 0x01, 0xfe, 0x80, 0x41, 0x41, 0x68, 0x94, 0x11, 0x10, 0x0f, 0x75, 0x10, - 0x65, 0xb8, 0x83, 0x02, 0x82, 0x23, 0x21, 0x97, 0xa7, 0xbf, 0x52, 0x40, 0x47, 0x02, 0x02, 0xd2, - 0xeb, 0x0b, 0x6d, 0xe6, 0x1d, 0x81, 0x23, 0x1f, 0xb3, 0x90, 0x68, 0x70, 0x31, 0x4a, 0x03, 0xd6, - 0x47, 0xfc, 0x88, 0x0d, 0x63, 0x41, 0x3b, 0x67, 0x78, 0xc8, 0x53, 0xef, 0xff, 0x10, 0xe5, 0x21, - 0xe5, 0x1d, 0x2c, 0x37, 0x16, 0x21, 0xdc, 0x49, 0x36, 0x3d, 0x2c, 0xe0, 0x66, 0x6e, 0xd0, 0xb8, - 0xd6, 0x8f, 0xd3, 0xc0, 0xea, 0xd2, 0x88, 0x0f, 0x42, 0xcc, 0x76, 0x7c, 0x9f, 0xc8, 0x25, 0x1f, - 0x32, 0x1a, 0x53, 0x0e, 0x03, 0x73, 0x15, 0x4c, 0x09, 0x22, 0x02, 0x6c, 0x19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b, - 0xed, 0xfc, 0x8f, 0xe9, 0x79, 0xf9, 0x9f, 0x49, 0x0c, 0x63, 0xcc, 0xbd, 0x69, 0x75, 0x24, 0x77, - 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x8d, 0x5d, 0x93, 0x64, 0x0d, 0x00, 0x00, + // 1570 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6e, 0x1b, 0xc9, + 0x11, 0xd6, 0x90, 0xd4, 0x0f, 0x9b, 0xfa, 0x1d, 0xc9, 0x2b, 0xca, 0x51, 0x28, 0xee, 0xe4, 0x07, + 0x0c, 0x82, 0x1d, 0x42, 0x5a, 0x2c, 0xb0, 0x10, 0x12, 0x2c, 0x24, 0x7a, 0x77, 0xa5, 0x28, 0xbb, + 0xe6, 0x8e, 0x18, 0x05, 0x49, 0x10, 0x0c, 0x7a, 0x7a, 0x5a, 0x64, 0x43, 0x33, 0xd3, 0xe3, 0xee, + 0x9e, 0x59, 0xf3, 0x0d, 0x72, 0x5c, 0x20, 0x97, 0x05, 0x72, 0xf1, 0x25, 0x87, 0x9c, 0xf2, 0x1a, + 0x06, 0x72, 0xf1, 0x21, 0x87, 0x9c, 0x9c, 0x40, 0x7e, 0x03, 0x3f, 0x41, 0xd0, 0x3d, 0xbf, 0xa4, + 0x69, 0x9b, 0x82, 0xbd, 0xb7, 0xe9, 0xea, 0xaa, 0xaf, 0xba, 0xaa, 0xab, 0xbe, 0x6a, 0x12, 0x1c, + 0x91, 0x40, 0x60, 0x86, 0x46, 0x90, 0x04, 0x36, 0xc7, 0x28, 0x62, 0x44, 0x8c, 0xbb, 0x08, 0xc5, + 0xdd, 0x90, 0xd1, 0x98, 0xb8, 0x98, 0x75, 0xe3, 0xc3, 0xfc, 0xdb, 0x0c, 0x19, 0x15, 0x54, 0xff, + 0xc9, 0x0c, 0x1b, 0x13, 0xa1, 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d, 0xed, 0xd4, 0xad, 0x42, 0x60, 0x08, 0xb0, 0xf7, 0xba, 0x07, 0x09, 0xd7, + 0x7f, 0x0f, 0x96, 0x43, 0xac, 0xa6, 0xa5, 0x32, 0x6c, 0x1c, 0xfd, 0x7a, 0xae, 0x06, 0x7c, 0x1d, + 0xa0, 0x95, 0xa1, 0x19, 0xac, 0x78, 0x06, 0x4d, 0x11, 0x3e, 0xd7, 0xaf, 0xa6, 0x9d, 0xfe, 0xea, + 0x4e, 0x4e, 0xa7, 0xf0, 0x0a, 0x9f, 0xbf, 0x01, 0xeb, 0xbd, 0x11, 0x0c, 0x02, 0xec, 0x0d, 0xa8, + 0x22, 0x24, 0xfd, 0xc7, 0x00, 0xa0, 0x44, 0x22, 0x89, 0x2c, 0xc9, 0x74, 0x3d, 0x95, 0x9c, 0xbb, + 0x13, 0x23, 0xa4, 0x32, 0x31, 0x42, 0x0c, 0x0b, 0x6c, 0x5c, 0x71, 0xf4, 0xbb, 0xec, 0x2d, 0xf1, + 0x30, 0xe4, 0xfa, 0x3d, 0xb0, 0x24, 0x3b, 0x21, 0x05, 0xaa, 0x59, 0x8b, 0x31, 0x47, 0xe7, 0xae, + 0xde, 0x29, 0xbf, 0x57, 0x68, 0x68, 0x13, 0x97, 0x37, 0x2b, 0xed, 0x6a, 0xa7, 0x66, 0xad, 0x47, + 0x85, 0xf9, 0xb9, 0xcb, 0x8d, 0x3f, 0x80, 0x46, 0x09, 0x50, 0x5f, 0x07, 0x95, 0x1c, 0xab, 0x42, + 0x5c, 0xfd, 0x18, 0xec, 0x15, 0x40, 0x93, 0x34, 0x9c, 0x20, 0xd6, 0xad, 0xdd, 0x5c, 0x61, 0x82, + 0x89, 0xb9, 0xf1, 0x10, 0xec, 0x9c, 0x17, 0xad, 0x9b, 0x93, 0xfc, 0x44, 0x84, 0xda, 0xe4, 0x90, + 0xdc, 0x07, 0xf5, 0xfc, 0xd1, 0xad, 0xa2, 0xaf, 0x59, 0x85, 0xc0, 0xf0,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, 0x1c, 0x91, 0x36, 0x32, 0x8b, 0x0b, 0x3c, 0x36, 0x5e, 0x96, 0xc3, 0x3a, 0x1d, 0x97, + 0xeb, 0xe3, 0x2d, 0x61, 0xe5, 0x7e, 0xef, 0x1c, 0xd6, 0xac, 0xba, 0xc9, 0xc3, 0x50, 0x9e, 0x5f, + 0xc9, 0x5a, 0xf5, 0x7d, 0x66, 0xcd, 0xf8, 0x87, 0x06, 0x76, 0xca, 0x91, 0xf2, 0x01, 0xed, 0xb3, + 0x28, 0xc0, 0x6f, 0x8a, 0xb8, 0x60, 0x81, 0x4a, 0x99, 0x05, 0x6c, 0xb0, 0x3e, 0x91, 0x08, 0x7e, + 0xa7, 0xa3, 0xce, 0x68, 0x47, 0x6b, 0xad, 0x9c, 0x09, 0x7e, 0x3a, 0x78, 0x7a, 0xdb, 0xd2, 0x9e, + 0xdd, 0xb6, 0xb4, 0xff, 0xdd, 0xb6, 0xb4, 0xef, 0x5e, 0xb4, 0x16, 0x9e, 0xbd, 0x68, 0x2d, 0xfc, + 0xe7, 0x45, 0x6b, 0xe1, 0x8f, 0xc7, 0x43, 0x22, 0x46, 0x91, 0x63, 0x22, 0xea, 0x77, 0xd3, 0x9f, + 0xe9, 0x85, 0xcf, 0x8f, 0xf2, 0x7f, 0x33, 0x1e, 0x4f, 0xfe, 0x9f, 0x21, 0xc6, 0x21, 0xe6, 0xce, + 0x92, 0x62, 0xa8, 0x8f, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x0a, 0x32, 0xf6, 0x00, 0x11, + 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -1352,10 +1644,15 @@ func (m *GlobalSlashEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ProviderValConsAddr) > 0 { - i -= len(m.ProviderValConsAddr) - copy(dAtA[i:], m.ProviderValConsAddr) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderValConsAddr))) + if m.ProviderValConsAddr != nil { + { + size, err := m.ProviderValConsAddr.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x22 } @@ -1371,12 +1668,12 @@ func (m *GlobalSlashEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RecvTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RecvTime):]) - if err7 != nil { - return 0, err7 + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RecvTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RecvTime):]) + if err8 != nil { + return 0, err8 } - i -= n7 - i = encodeVarintProvider(dAtA, i, uint64(n7)) + i -= n8 + i = encodeVarintProvider(dAtA, i, uint64(n8)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -1414,37 +1711,37 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.SlashMeterReplenishPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.SlashMeterReplenishPeriod):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintProvider(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0x32 - n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VscTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VscTimeoutPeriod):]) + n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.SlashMeterReplenishPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.SlashMeterReplenishPeriod):]) if err9 != nil { return 0, err9 } i -= n9 i = encodeVarintProvider(dAtA, i, uint64(n9)) i-- - dAtA[i] = 0x2a - n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) + dAtA[i] = 0x32 + n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VscTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VscTimeoutPeriod):]) if err10 != nil { return 0, err10 } i -= n10 i = encodeVarintProvider(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x22 - n11, err11 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) + dAtA[i] = 0x2a + n11, err11 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) if err11 != nil { return 0, err11 } i -= n11 i = encodeVarintProvider(dAtA, i, uint64(n11)) i-- + dAtA[i] = 0x22 + n12, err12 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_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) @@ -1611,38 +1908,6 @@ func (m *ConsumerRemovalProposals) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *AddressList) 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 *AddressList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AddressList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = encodeVarintProvider(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *ChannelToChain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1701,20 +1966,20 @@ func (m *VscUnbondingOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.UnbondingOpIds) > 0 { - dAtA14 := make([]byte, len(m.UnbondingOpIds)*10) - var j13 int + dAtA15 := make([]byte, len(m.UnbondingOpIds)*10) + var j14 int for _, num := range m.UnbondingOpIds { for num >= 1<<7 { - dAtA14[j13] = uint8(uint64(num)&0x7f | 0x80) + dAtA15[j14] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j13++ + j14++ } - dAtA14[j13] = uint8(num) - j13++ + dAtA15[j14] = uint8(num) + j14++ } - i -= j13 - copy(dAtA[i:], dAtA14[:j13]) - i = encodeVarintProvider(dAtA, i, uint64(j13)) + i -= j14 + copy(dAtA[i:], dAtA15[:j14]) + i = encodeVarintProvider(dAtA, i, uint64(j14)) i-- dAtA[i] = 0x12 } @@ -1818,12 +2083,12 @@ func (m *VscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n15, err15 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err15 != nil { - return 0, err15 + n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err16 != nil { + return 0, err16 } - i -= n15 - i = encodeVarintProvider(dAtA, i, uint64(n15)) + i -= n16 + i = encodeVarintProvider(dAtA, i, uint64(n16)) i-- dAtA[i] = 0x12 if m.VscId != 0 { @@ -1834,6 +2099,103 @@ func (m *VscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ConsumerConsAddress) 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 *ConsumerConsAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerConsAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ProviderConsAddress) 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 *ProviderConsAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProviderConsAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConsumerAddressList) 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 *ConsumerAddressList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerAddressList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Addresses[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 *KeyAssignmentReplacement) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1871,10 +2233,170 @@ func (m *KeyAssignmentReplacement) MarshalToSizedBuffer(dAtA []byte) (int, error 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))) + if m.ProviderAddr != nil { + { + size, err := m.ProviderAddr.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 *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 m.ProviderAddr != nil { + { + size, err := m.ProviderAddr.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 *ValidatorByConsumerAddr) 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 *ValidatorByConsumerAddr) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorByConsumerAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProviderAddr != nil { + { + size, err := m.ProviderAddr.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.ConsumerAddr != nil { + { + size, err := m.ConsumerAddr.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 *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 } @@ -2002,8 +2524,8 @@ func (m *GlobalSlashEntry) Size() (n int) { if m.IbcSeqNum != 0 { n += 1 + sovProvider(uint64(m.IbcSeqNum)) } - l = len(m.ProviderValConsAddr) - if l > 0 { + if m.ProviderValConsAddr != nil { + l = m.ProviderValConsAddr.Size() n += 1 + l + sovProvider(uint64(l)) } return n @@ -2103,22 +2625,7 @@ func (m *ConsumerRemovalProposals) Size() (n int) { return n } -func (m *AddressList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, b := range m.Addresses { - l = len(b) - n += 1 + l + sovProvider(uint64(l)) - } - } - return n -} - -func (m *ChannelToChain) Size() (n int) { +func (m *ChannelToChain) Size() (n int) { if m == nil { return 0 } @@ -2202,16 +2709,57 @@ func (m *VscSendTimestamp) Size() (n int) { return n } -func (m *KeyAssignmentReplacement) Size() (n int) { +func (m *ConsumerConsAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + +func (m *ProviderConsAddress) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ProviderAddr) + l = len(m.Address) if l > 0 { n += 1 + l + sovProvider(uint64(l)) } + return n +} + +func (m *ConsumerAddressList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, e := range m.Addresses { + l = e.Size() + n += 1 + l + sovProvider(uint64(l)) + } + } + return n +} + +func (m *KeyAssignmentReplacement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProviderAddr != nil { + l = m.ProviderAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } if m.PrevCKey != nil { l = m.PrevCKey.Size() n += 1 + l + sovProvider(uint64(l)) @@ -2222,6 +2770,68 @@ func (m *KeyAssignmentReplacement) Size() (n int) { return n } +func (m *ValidatorConsumerPubKey) 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.ProviderAddr != nil { + l = m.ProviderAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } + if m.ConsumerKey != nil { + l = m.ConsumerKey.Size() + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + +func (m *ValidatorByConsumerAddr) 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.ConsumerAddr != nil { + l = m.ConsumerAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } + if m.ProviderAddr != nil { + l = m.ProviderAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } + 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 sovProvider(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3121,7 +3731,7 @@ func (m *GlobalSlashEntry) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProviderValConsAddr", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -3131,24 +3741,26 @@ func (m *GlobalSlashEntry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderValConsAddr = append(m.ProviderValConsAddr[:0], dAtA[iNdEx:postIndex]...) if m.ProviderValConsAddr == nil { - m.ProviderValConsAddr = []byte{} + m.ProviderValConsAddr = &ProviderConsAddress{} + } + if err := m.ProviderValConsAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -3837,88 +4449,6 @@ func (m *ConsumerRemovalProposals) Unmarshal(dAtA []byte) error { } return nil } -func (m *AddressList) 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: AddressList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AddressList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, make([]byte, postIndex-iNdEx)) - copy(m.Addresses[len(m.Addresses)-1], 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 *ChannelToChain) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4482,7 +5012,7 @@ func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { } return nil } -func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { +func (m *ConsumerConsAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4505,15 +5035,15 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: KeyAssignmentReplacement: wiretype end group for non-group") + return fmt.Errorf("proto: ConsumerConsAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: KeyAssignmentReplacement: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsumerConsAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -4540,16 +5070,66 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddr = append(m.ProviderAddr[:0], dAtA[iNdEx:postIndex]...) - if m.ProviderAddr == nil { - m.ProviderAddr = []byte{} + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} } iNdEx = postIndex - case 2: + 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 *ProviderConsAddress) 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: ProviderConsAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProviderConsAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevCKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -4559,25 +5139,229 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - if m.PrevCKey == nil { - m.PrevCKey = &crypto.PublicKey{} + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} } - if err := m.PrevCKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 *ConsumerAddressList) 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: ConsumerAddressList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerAddressList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", 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.Addresses = append(m.Addresses, &ConsumerConsAddress{}) + if err := m.Addresses[len(m.Addresses)-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 + 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: KeyAssignmentReplacement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyAssignmentReplacement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", 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.ProviderAddr == nil { + m.ProviderAddr = &ProviderConsAddress{} + } + if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevCKey", 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.PrevCKey == nil { + m.PrevCKey = &crypto.PublicKey{} + } + if err := m.PrevCKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4621,6 +5405,451 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { } return nil } +func (m *ValidatorConsumerPubKey) 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: ValidatorConsumerPubKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorConsumerPubKey: 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 ProviderAddr", 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.ProviderAddr == nil { + m.ProviderAddr = &ProviderConsAddress{} + } + if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", 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.ConsumerKey == nil { + m.ConsumerKey = &crypto.PublicKey{} + } + if err := m.ConsumerKey.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 *ValidatorByConsumerAddr) 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: ValidatorByConsumerAddr: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorByConsumerAddr: 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 ConsumerAddr", 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.ConsumerAddr == nil { + m.ConsumerAddr = &ConsumerConsAddress{} + } + if err := m.ConsumerAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", 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.ProviderAddr == nil { + m.ProviderAddr = &ProviderConsAddress{} + } + if err := m.ProviderAddr.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 *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 = &ConsumerAddressList{} + } + 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 skipProvider(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/throttle.go b/x/ccv/provider/types/throttle.go index ab4239461b..9ddd7bbc7c 100644 --- a/x/ccv/provider/types/throttle.go +++ b/x/ccv/provider/types/throttle.go @@ -2,17 +2,15 @@ package types import ( "time" - - sdktypes "github.com/cosmos/cosmos-sdk/types" ) // NewGlobalSlashEntry creates a new GlobalSlashEntry. func NewGlobalSlashEntry(recvTime time.Time, consumerChainID string, - ibcSeqNum uint64, providerValConsAddr sdktypes.ConsAddress) GlobalSlashEntry { + ibcSeqNum uint64, providerValConsAddr ProviderConsAddress) GlobalSlashEntry { return GlobalSlashEntry{ RecvTime: recvTime.UTC(), // UTC prevents serialization inconsistencies ConsumerChainID: consumerChainID, IbcSeqNum: ibcSeqNum, - ProviderValConsAddr: providerValConsAddr, + ProviderValConsAddr: &providerValConsAddr, } }