From a08ebbaac3f569915cf9deeada1c79331fb1da1c Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 16 Jan 2024 13:12:11 +0100 Subject: [PATCH 01/27] add different Bech32Prefix for consumer and provider --- app/consumer-democracy/app.go | 2 +- .../ante/disabled_modules_ante_test.go | 4 +- app/consumer/ante/msg_filter_ante_test.go | 4 +- app/consumer/app.go | 2 +- app/{params => consumerparams}/config.go | 4 +- app/{params => consumerparams}/doc.go | 2 +- app/{params => consumerparams}/encoding.go | 2 +- app/{params => consumerparams}/params.go | 2 +- app/{params => consumerparams}/proto.go | 2 +- app/{params => consumerparams}/weights.go | 2 +- app/provider/app.go | 2 +- app/providerparams/config.go | 35 ++++++++++++++++ app/providerparams/doc.go | 19 +++++++++ app/providerparams/encoding.go | 16 +++++++ app/providerparams/params.go | 7 ++++ app/providerparams/proto.go | 22 ++++++++++ app/providerparams/weights.go | 42 +++++++++++++++++++ app/sovereign/app.go | 2 +- cmd/interchain-security-cd/cmd/root.go | 8 ++-- cmd/interchain-security-cdd/cmd/root.go | 8 ++-- cmd/interchain-security-pd/cmd/root.go | 8 ++-- cmd/interchain-security-sd/cmd/root.go | 8 ++-- 22 files changed, 172 insertions(+), 31 deletions(-) rename app/{params => consumerparams}/config.go (96%) rename app/{params => consumerparams}/doc.go (96%) rename app/{params => consumerparams}/encoding.go (95%) rename app/{params => consumerparams}/params.go (86%) rename app/{params => consumerparams}/proto.go (96%) rename app/{params => consumerparams}/weights.go (98%) create mode 100644 app/providerparams/config.go create mode 100644 app/providerparams/doc.go create mode 100644 app/providerparams/encoding.go create mode 100644 app/providerparams/params.go create mode 100644 app/providerparams/proto.go create mode 100644 app/providerparams/weights.go diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index e740c89406..0345277840 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -103,7 +103,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" consumer "github.com/cosmos/interchain-security/v4/x/ccv/consumer" consumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" diff --git a/app/consumer/ante/disabled_modules_ante_test.go b/app/consumer/ante/disabled_modules_ante_test.go index 2b12bed63a..12faa51636 100644 --- a/app/consumer/ante/disabled_modules_ante_test.go +++ b/app/consumer/ante/disabled_modules_ante_test.go @@ -13,11 +13,11 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/interchain-security/v4/app/consumer/ante" - "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" ) func TestDisabledModulesDecorator(t *testing.T) { - txCfg := params.MakeTestEncodingConfig().TxConfig + txCfg := appparams.MakeTestEncodingConfig().TxConfig authzMsgExecSlashing := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&slashingtypes.MsgUnjail{}}) authzMsgExecEvidence := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&evidencetypes.MsgSubmitEvidence{}}) nestedAuthzMsgExecSlashing := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&authzMsgExecSlashing}) diff --git a/app/consumer/ante/msg_filter_ante_test.go b/app/consumer/ante/msg_filter_ante_test.go index 47538dad1a..63dc0b34d3 100644 --- a/app/consumer/ante/msg_filter_ante_test.go +++ b/app/consumer/ante/msg_filter_ante_test.go @@ -10,7 +10,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/interchain-security/v4/app/consumer/ante" - "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" ) type consumerKeeper struct { @@ -28,7 +28,7 @@ func noOpAnteDecorator() sdk.AnteHandler { } func TestMsgFilterDecorator(t *testing.T) { - txCfg := params.MakeTestEncodingConfig().TxConfig + txCfg := appparams.MakeTestEncodingConfig().TxConfig testCases := []struct { name string diff --git a/app/consumer/app.go b/app/consumer/app.go index 220be5ed80..87742dd995 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -87,7 +87,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" ibcconsumer "github.com/cosmos/interchain-security/v4/x/ccv/consumer" ibcconsumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" diff --git a/app/params/config.go b/app/consumerparams/config.go similarity index 96% rename from app/params/config.go rename to app/consumerparams/config.go index e4f7308498..ddeb2ef702 100644 --- a/app/params/config.go +++ b/app/consumerparams/config.go @@ -1,11 +1,11 @@ -package params +package consumerparams import ( sdk "github.com/cosmos/cosmos-sdk/types" ) var ( - Bech32Prefix = "cosmos" + Bech32Prefix = "consumer" // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address Bech32PrefixAccAddr = Bech32Prefix diff --git a/app/params/doc.go b/app/consumerparams/doc.go similarity index 96% rename from app/params/doc.go rename to app/consumerparams/doc.go index 49b5f6d1e7..d3c15813b4 100644 --- a/app/params/doc.go +++ b/app/consumerparams/doc.go @@ -16,4 +16,4 @@ file with the weights defined for each of the transaction operations: In the example above, the `MsgSend` has 60% chance to be simulated, while the `MsgDelegate` will always be simulated. */ -package params +package consumerparams diff --git a/app/params/encoding.go b/app/consumerparams/encoding.go similarity index 95% rename from app/params/encoding.go rename to app/consumerparams/encoding.go index 8ff9ea04b3..d838e3c872 100644 --- a/app/params/encoding.go +++ b/app/consumerparams/encoding.go @@ -1,4 +1,4 @@ -package params +package consumerparams import ( "github.com/cosmos/cosmos-sdk/client" diff --git a/app/params/params.go b/app/consumerparams/params.go similarity index 86% rename from app/params/params.go rename to app/consumerparams/params.go index b6aa5fb55e..49c21c535d 100644 --- a/app/params/params.go +++ b/app/consumerparams/params.go @@ -1,4 +1,4 @@ -package params +package consumerparams // Simulation parameter constants const ( diff --git a/app/params/proto.go b/app/consumerparams/proto.go similarity index 96% rename from app/params/proto.go rename to app/consumerparams/proto.go index d11fe8d06c..89f8bf47e8 100644 --- a/app/params/proto.go +++ b/app/consumerparams/proto.go @@ -1,4 +1,4 @@ -package params +package consumerparams import ( "github.com/cosmos/cosmos-sdk/codec" diff --git a/app/params/weights.go b/app/consumerparams/weights.go similarity index 98% rename from app/params/weights.go rename to app/consumerparams/weights.go index 4e5452c9b2..99734a61ab 100644 --- a/app/params/weights.go +++ b/app/consumerparams/weights.go @@ -1,4 +1,4 @@ -package params +package consumerparams // Default simulation operation weights for messages and gov proposals const ( diff --git a/app/provider/app.go b/app/provider/app.go index c1f3c4d6ff..74ee4954ac 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -100,7 +100,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/providerparams" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" ibcprovider "github.com/cosmos/interchain-security/v4/x/ccv/provider" ibcproviderclient "github.com/cosmos/interchain-security/v4/x/ccv/provider/client" diff --git a/app/providerparams/config.go b/app/providerparams/config.go new file mode 100644 index 0000000000..6c3147a801 --- /dev/null +++ b/app/providerparams/config.go @@ -0,0 +1,35 @@ +package providerparams + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + Bech32Prefix = "provider" + + // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address + Bech32PrefixAccAddr = Bech32Prefix + // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key + Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic + // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address + Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key + Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic + // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address + Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key + Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic +) + +// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format. +// Not sealed yet +func SetAddressPrefixes() { + cfg := sdk.GetConfig() + cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) + cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) + cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) +} + +func init() { + SetAddressPrefixes() +} diff --git a/app/providerparams/doc.go b/app/providerparams/doc.go new file mode 100644 index 0000000000..7fccc09110 --- /dev/null +++ b/app/providerparams/doc.go @@ -0,0 +1,19 @@ +/* +Package params defines the simulation parameters in the gaia. + +It contains the default weights used for each transaction used on the module's +simulation. These weights define the chance for a transaction to be simulated at +any given operation. + +You can replace the default values for the weights by providing a params.json +file with the weights defined for each of the transaction operations: + + { + "op_weight_msg_send": 60, + "op_weight_msg_delegate": 100, + } + +In the example above, the `MsgSend` has 60% chance to be simulated, while the +`MsgDelegate` will always be simulated. +*/ +package providerparams diff --git a/app/providerparams/encoding.go b/app/providerparams/encoding.go new file mode 100644 index 0000000000..2ce60781c2 --- /dev/null +++ b/app/providerparams/encoding.go @@ -0,0 +1,16 @@ +package providerparams + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" +) + +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Codec codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} diff --git a/app/providerparams/params.go b/app/providerparams/params.go new file mode 100644 index 0000000000..972a48b4d6 --- /dev/null +++ b/app/providerparams/params.go @@ -0,0 +1,7 @@ +package providerparams + +// Simulation parameter constants +const ( + StakePerAccount = "stake_per_account" + InitiallyBondedValidators = "initially_bonded_validators" +) diff --git a/app/providerparams/proto.go b/app/providerparams/proto.go new file mode 100644 index 0000000000..d3afb74e95 --- /dev/null +++ b/app/providerparams/proto.go @@ -0,0 +1,22 @@ +package providerparams + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/auth/tx" +) + +// MakeTestEncodingConfig creates an EncodingConfig for an amino based test configuration. +func MakeTestEncodingConfig() EncodingConfig { + amino := codec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + chainCodec := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(chainCodec, tx.DefaultSignModes) + + return EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Codec: chainCodec, + TxConfig: txCfg, + Amino: amino, + } +} diff --git a/app/providerparams/weights.go b/app/providerparams/weights.go new file mode 100644 index 0000000000..d8b1e4c7b3 --- /dev/null +++ b/app/providerparams/weights.go @@ -0,0 +1,42 @@ +package providerparams + +// Default simulation operation weights for messages and gov proposals +const ( + DefaultWeightMsgSend int = 100 + DefaultWeightMsgMultiSend int = 10 + DefaultWeightMsgSetWithdrawAddress int = 50 + DefaultWeightMsgWithdrawDelegationReward int = 50 + DefaultWeightMsgWithdrawValidatorCommission int = 50 + DefaultWeightMsgFundCommunityPool int = 50 + DefaultWeightMsgDeposit int = 100 + DefaultWeightMsgVote int = 67 + DefaultWeightMsgUnjail int = 100 + DefaultWeightMsgCreateValidator int = 100 + DefaultWeightMsgEditValidator int = 5 + DefaultWeightMsgDelegate int = 100 + DefaultWeightMsgUndelegate int = 100 + DefaultWeightMsgBeginRedelegate int = 100 + + DefaultWeightCommunitySpendProposal int = 5 + DefaultWeightTextProposal int = 5 + DefaultWeightParamChangeProposal int = 5 + + DefaultWeightMsgStoreCode int = 50 + DefaultWeightMsgInstantiateContract int = 100 + DefaultWeightMsgExecuteContract int = 100 + DefaultWeightMsgUpdateAdmin int = 25 + DefaultWeightMsgClearAdmin int = 10 + DefaultWeightMsgMigrateContract int = 50 + + DefaultWeightStoreCodeProposal int = 5 + DefaultWeightInstantiateContractProposal int = 5 + DefaultWeightUpdateAdminProposal int = 5 + DefaultWeightExecuteContractProposal int = 5 + DefaultWeightClearAdminProposal int = 5 + DefaultWeightMigrateContractProposal int = 5 + DefaultWeightSudoContractProposal int = 5 + DefaultWeightPinCodesProposal int = 5 + DefaultWeightUnpinCodesProposal int = 5 + DefaultWeightUpdateInstantiateConfigProposal int = 5 + DefaultWeightStoreAndInstantiateContractProposal int = 5 +) diff --git a/app/sovereign/app.go b/app/sovereign/app.go index 55967df923..96e9e24304 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -106,7 +106,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" ) diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index 64e7b76d3d..ee866663b9 100644 --- a/cmd/interchain-security-cd/cmd/root.go +++ b/cmd/interchain-security-cd/cmd/root.go @@ -32,7 +32,7 @@ import ( "github.com/cometbft/cometbft/libs/log" consumer "github.com/cosmos/interchain-security/v4/app/consumer" - "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := consumer.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(consumer.DefaultNodeHome)) - encodingConfig := params.EncodingConfig{ + encodingConfig := appparams.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, consumer.ModuleBasics, consumer.DefaultNodeHome) for _, sub_cmd := range cmds { diff --git a/cmd/interchain-security-cdd/cmd/root.go b/cmd/interchain-security-cdd/cmd/root.go index b69bd57636..c7ec3a85c4 100644 --- a/cmd/interchain-security-cdd/cmd/root.go +++ b/cmd/interchain-security-cdd/cmd/root.go @@ -32,7 +32,7 @@ import ( "github.com/cometbft/cometbft/libs/log" cdd "github.com/cosmos/interchain-security/v4/app/consumer-democracy" - "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := cdd.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(cdd.DefaultNodeHome)) - encodingConfig := params.EncodingConfig{ + encodingConfig := appparams.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, cdd.ModuleBasics, cdd.DefaultNodeHome) for _, sub_cmd := range cmds { diff --git a/cmd/interchain-security-pd/cmd/root.go b/cmd/interchain-security-pd/cmd/root.go index 1f752d758b..9f9585076a 100644 --- a/cmd/interchain-security-pd/cmd/root.go +++ b/cmd/interchain-security-pd/cmd/root.go @@ -31,8 +31,8 @@ import ( tmcfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/interchain-security/v4/app/params" providerApp "github.com/cosmos/interchain-security/v4/app/provider" + appparams "github.com/cosmos/interchain-security/v4/app/providerparams" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := providerApp.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(providerApp.DefaultNodeHome)) - encodingConfig := params.EncodingConfig{ + encodingConfig := appparams.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, providerApp.ModuleBasics, providerApp.DefaultNodeHome) for _, sub_cmd := range cmds { cmd.AddCommand(sub_cmd) diff --git a/cmd/interchain-security-sd/cmd/root.go b/cmd/interchain-security-sd/cmd/root.go index 0862e92836..da33be19e8 100644 --- a/cmd/interchain-security-sd/cmd/root.go +++ b/cmd/interchain-security-sd/cmd/root.go @@ -31,7 +31,7 @@ import ( tmcfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/interchain-security/v4/app/params" + appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" sovereignApp "github.com/cosmos/interchain-security/v4/app/sovereign" ) @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := sovereignApp.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(sovereignApp.DefaultNodeHome)) - encodingConfig := params.EncodingConfig{ + encodingConfig := appparams.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, sovereignApp.ModuleBasics, sovereignApp.DefaultNodeHome) for _, sub_cmd := range cmds { cmd.AddCommand(sub_cmd) From cfaacdb5e0c6a742144053b1356dfdd4e93d784b Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 16 Jan 2024 14:32:01 +0100 Subject: [PATCH 02/27] separate app encoding and params --- app/consumer-democracy/app.go | 10 ++--- .../ante/disabled_modules_ante_test.go | 4 +- app/consumer/ante/msg_filter_ante_test.go | 4 +- app/consumer/app.go | 10 ++--- app/consumerparams/config.go | 35 ---------------- app/consumerparams/doc.go | 19 --------- app/consumerparams/encoding.go | 16 ------- app/consumerparams/params.go | 7 ---- app/consumerparams/proto.go | 22 ---------- app/consumerparams/weights.go | 42 ------------------- .../proto.go => encoding/encoding.go} | 12 +++++- app/params/config.go | 28 +++++++++++++ app/provider/app.go | 10 ++--- app/providerparams/config.go | 35 ---------------- app/providerparams/doc.go | 19 --------- app/providerparams/encoding.go | 16 ------- app/providerparams/params.go | 7 ---- app/providerparams/weights.go | 42 ------------------- app/sovereign/app.go | 10 ++--- cmd/interchain-security-cd/cmd/root.go | 8 ++-- cmd/interchain-security-cd/main.go | 3 +- cmd/interchain-security-cdd/cmd/root.go | 8 ++-- cmd/interchain-security-cdd/main.go | 3 +- cmd/interchain-security-pd/cmd/root.go | 8 ++-- cmd/interchain-security-pd/main.go | 3 +- cmd/interchain-security-sd/cmd/root.go | 8 ++-- cmd/interchain-security-sd/main.go | 3 +- 27 files changed, 87 insertions(+), 305 deletions(-) delete mode 100644 app/consumerparams/config.go delete mode 100644 app/consumerparams/doc.go delete mode 100644 app/consumerparams/encoding.go delete mode 100644 app/consumerparams/params.go delete mode 100644 app/consumerparams/proto.go delete mode 100644 app/consumerparams/weights.go rename app/{providerparams/proto.go => encoding/encoding.go} (61%) create mode 100644 app/params/config.go delete mode 100644 app/providerparams/config.go delete mode 100644 app/providerparams/doc.go delete mode 100644 app/providerparams/encoding.go delete mode 100644 app/providerparams/params.go delete mode 100644 app/providerparams/weights.go diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 0345277840..ce140516a3 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -103,7 +103,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" consumer "github.com/cosmos/interchain-security/v4/x/ccv/consumer" consumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" @@ -1005,8 +1005,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino // should be used only in tests or when creating a new app instance (NewApp*()). // App user shouldn't create new codecs - use the app.AppCodec instead. // [DEPRECATED] -func MakeTestEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func MakeTestEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) @@ -1014,8 +1014,8 @@ func MakeTestEncodingConfig() appparams.EncodingConfig { return encodingConfig } -func makeEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func makeEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/app/consumer/ante/disabled_modules_ante_test.go b/app/consumer/ante/disabled_modules_ante_test.go index 12faa51636..7fa95f37c6 100644 --- a/app/consumer/ante/disabled_modules_ante_test.go +++ b/app/consumer/ante/disabled_modules_ante_test.go @@ -13,11 +13,11 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/interchain-security/v4/app/consumer/ante" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" ) func TestDisabledModulesDecorator(t *testing.T) { - txCfg := appparams.MakeTestEncodingConfig().TxConfig + txCfg := appencoding.MakeTestEncodingConfig().TxConfig authzMsgExecSlashing := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&slashingtypes.MsgUnjail{}}) authzMsgExecEvidence := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&evidencetypes.MsgSubmitEvidence{}}) nestedAuthzMsgExecSlashing := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&authzMsgExecSlashing}) diff --git a/app/consumer/ante/msg_filter_ante_test.go b/app/consumer/ante/msg_filter_ante_test.go index 63dc0b34d3..bfc1bb0a50 100644 --- a/app/consumer/ante/msg_filter_ante_test.go +++ b/app/consumer/ante/msg_filter_ante_test.go @@ -10,7 +10,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/interchain-security/v4/app/consumer/ante" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" ) type consumerKeeper struct { @@ -28,7 +28,7 @@ func noOpAnteDecorator() sdk.AnteHandler { } func TestMsgFilterDecorator(t *testing.T) { - txCfg := appparams.MakeTestEncodingConfig().TxConfig + txCfg := appencoding.MakeTestEncodingConfig().TxConfig testCases := []struct { name string diff --git a/app/consumer/app.go b/app/consumer/app.go index 87742dd995..2a96ff0e07 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -87,7 +87,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" ibcconsumer "github.com/cosmos/interchain-security/v4/x/ccv/consumer" ibcconsumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" @@ -830,8 +830,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino // return encodingConfig // } -func MakeTestEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func MakeTestEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) @@ -839,8 +839,8 @@ func MakeTestEncodingConfig() appparams.EncodingConfig { return encodingConfig } -func makeEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func makeEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/app/consumerparams/config.go b/app/consumerparams/config.go deleted file mode 100644 index ddeb2ef702..0000000000 --- a/app/consumerparams/config.go +++ /dev/null @@ -1,35 +0,0 @@ -package consumerparams - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - Bech32Prefix = "consumer" - - // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address - Bech32PrefixAccAddr = Bech32Prefix - // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key - Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic - // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address - Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator - // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key - Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic - // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address - Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus - // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key - Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic -) - -// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format. -// Not sealed yet -func SetAddressPrefixes() { - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) - cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) - cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) -} - -func init() { - SetAddressPrefixes() -} diff --git a/app/consumerparams/doc.go b/app/consumerparams/doc.go deleted file mode 100644 index d3c15813b4..0000000000 --- a/app/consumerparams/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Package params defines the simulation parameters in the gaia. - -It contains the default weights used for each transaction used on the module's -simulation. These weights define the chance for a transaction to be simulated at -any given operation. - -You can replace the default values for the weights by providing a params.json -file with the weights defined for each of the transaction operations: - - { - "op_weight_msg_send": 60, - "op_weight_msg_delegate": 100, - } - -In the example above, the `MsgSend` has 60% chance to be simulated, while the -`MsgDelegate` will always be simulated. -*/ -package consumerparams diff --git a/app/consumerparams/encoding.go b/app/consumerparams/encoding.go deleted file mode 100644 index d838e3c872..0000000000 --- a/app/consumerparams/encoding.go +++ /dev/null @@ -1,16 +0,0 @@ -package consumerparams - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" -) - -// EncodingConfig specifies the concrete encoding types to use for a given app. -// This is provided for compatibility between protobuf and amino implementations. -type EncodingConfig struct { - InterfaceRegistry types.InterfaceRegistry - Codec codec.Codec - TxConfig client.TxConfig - Amino *codec.LegacyAmino -} diff --git a/app/consumerparams/params.go b/app/consumerparams/params.go deleted file mode 100644 index 49c21c535d..0000000000 --- a/app/consumerparams/params.go +++ /dev/null @@ -1,7 +0,0 @@ -package consumerparams - -// Simulation parameter constants -const ( - StakePerAccount = "stake_per_account" - InitiallyBondedValidators = "initially_bonded_validators" -) diff --git a/app/consumerparams/proto.go b/app/consumerparams/proto.go deleted file mode 100644 index 89f8bf47e8..0000000000 --- a/app/consumerparams/proto.go +++ /dev/null @@ -1,22 +0,0 @@ -package consumerparams - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/x/auth/tx" -) - -// MakeTestEncodingConfig creates an EncodingConfig for an amino based test configuration. -func MakeTestEncodingConfig() EncodingConfig { - amino := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - chainCodec := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(chainCodec, tx.DefaultSignModes) - - return EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: chainCodec, - TxConfig: txCfg, - Amino: amino, - } -} diff --git a/app/consumerparams/weights.go b/app/consumerparams/weights.go deleted file mode 100644 index 99734a61ab..0000000000 --- a/app/consumerparams/weights.go +++ /dev/null @@ -1,42 +0,0 @@ -package consumerparams - -// Default simulation operation weights for messages and gov proposals -const ( - DefaultWeightMsgSend int = 100 - DefaultWeightMsgMultiSend int = 10 - DefaultWeightMsgSetWithdrawAddress int = 50 - DefaultWeightMsgWithdrawDelegationReward int = 50 - DefaultWeightMsgWithdrawValidatorCommission int = 50 - DefaultWeightMsgFundCommunityPool int = 50 - DefaultWeightMsgDeposit int = 100 - DefaultWeightMsgVote int = 67 - DefaultWeightMsgUnjail int = 100 - DefaultWeightMsgCreateValidator int = 100 - DefaultWeightMsgEditValidator int = 5 - DefaultWeightMsgDelegate int = 100 - DefaultWeightMsgUndelegate int = 100 - DefaultWeightMsgBeginRedelegate int = 100 - - DefaultWeightCommunitySpendProposal int = 5 - DefaultWeightTextProposal int = 5 - DefaultWeightParamChangeProposal int = 5 - - DefaultWeightMsgStoreCode int = 50 - DefaultWeightMsgInstantiateContract int = 100 - DefaultWeightMsgExecuteContract int = 100 - DefaultWeightMsgUpdateAdmin int = 25 - DefaultWeightMsgClearAdmin int = 10 - DefaultWeightMsgMigrateContract int = 50 - - DefaultWeightStoreCodeProposal int = 5 - DefaultWeightInstantiateContractProposal int = 5 - DefaultWeightUpdateAdminProposal int = 5 - DefaultWeightExecuteContractProposal int = 5 - DefaultWeightClearAdminProposal int = 5 - DefaultWeightMigrateContractProposal int = 5 - DefaultWeightSudoContractProposal int = 5 - DefaultWeightPinCodesProposal int = 5 - DefaultWeightUnpinCodesProposal int = 5 - DefaultWeightUpdateInstantiateConfigProposal int = 5 - DefaultWeightStoreAndInstantiateContractProposal int = 5 -) diff --git a/app/providerparams/proto.go b/app/encoding/encoding.go similarity index 61% rename from app/providerparams/proto.go rename to app/encoding/encoding.go index d3afb74e95..6897e53634 100644 --- a/app/providerparams/proto.go +++ b/app/encoding/encoding.go @@ -1,11 +1,21 @@ -package providerparams +package encoding import ( + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/x/auth/tx" ) +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Codec codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} + // MakeTestEncodingConfig creates an EncodingConfig for an amino based test configuration. func MakeTestEncodingConfig() EncodingConfig { amino := codec.NewLegacyAmino() diff --git a/app/params/config.go b/app/params/config.go new file mode 100644 index 0000000000..e994a735ec --- /dev/null +++ b/app/params/config.go @@ -0,0 +1,28 @@ +package params + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format. +// Not sealed yet +func SetAddressPrefixes(bech32Prefix string) { + cfg := sdk.GetConfig() + + // bech32PrefixAccAddr defines the Bech32 prefix of an account's address + bech32PrefixAccAddr := bech32Prefix + // bech32PrefixAccPub defines the Bech32 prefix of an account's public key + bech32PrefixAccPub := bech32Prefix + sdk.PrefixPublic + // bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address + bech32PrefixValAddr := bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + // bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key + bech32PrefixValPub := bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic + // bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address + bech32PrefixConsAddr := bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + // bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key + bech32PrefixConsPub := bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic + + cfg.SetBech32PrefixForAccount(bech32PrefixAccAddr, bech32PrefixAccPub) + cfg.SetBech32PrefixForValidator(bech32PrefixValAddr, bech32PrefixValPub) + cfg.SetBech32PrefixForConsensusNode(bech32PrefixConsAddr, bech32PrefixConsPub) +} diff --git a/app/provider/app.go b/app/provider/app.go index 74ee4954ac..7527756d45 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -100,7 +100,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/providerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" ibcprovider "github.com/cosmos/interchain-security/v4/x/ccv/provider" ibcproviderclient "github.com/cosmos/interchain-security/v4/x/ccv/provider/client" @@ -930,8 +930,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino // return encodingConfig // } -func MakeTestEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func MakeTestEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) @@ -939,8 +939,8 @@ func MakeTestEncodingConfig() appparams.EncodingConfig { return encodingConfig } -func makeEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func makeEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/app/providerparams/config.go b/app/providerparams/config.go deleted file mode 100644 index 6c3147a801..0000000000 --- a/app/providerparams/config.go +++ /dev/null @@ -1,35 +0,0 @@ -package providerparams - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - Bech32Prefix = "provider" - - // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address - Bech32PrefixAccAddr = Bech32Prefix - // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key - Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic - // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address - Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator - // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key - Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic - // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address - Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus - // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key - Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic -) - -// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format. -// Not sealed yet -func SetAddressPrefixes() { - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) - cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) - cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) -} - -func init() { - SetAddressPrefixes() -} diff --git a/app/providerparams/doc.go b/app/providerparams/doc.go deleted file mode 100644 index 7fccc09110..0000000000 --- a/app/providerparams/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Package params defines the simulation parameters in the gaia. - -It contains the default weights used for each transaction used on the module's -simulation. These weights define the chance for a transaction to be simulated at -any given operation. - -You can replace the default values for the weights by providing a params.json -file with the weights defined for each of the transaction operations: - - { - "op_weight_msg_send": 60, - "op_weight_msg_delegate": 100, - } - -In the example above, the `MsgSend` has 60% chance to be simulated, while the -`MsgDelegate` will always be simulated. -*/ -package providerparams diff --git a/app/providerparams/encoding.go b/app/providerparams/encoding.go deleted file mode 100644 index 2ce60781c2..0000000000 --- a/app/providerparams/encoding.go +++ /dev/null @@ -1,16 +0,0 @@ -package providerparams - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" -) - -// EncodingConfig specifies the concrete encoding types to use for a given app. -// This is provided for compatibility between protobuf and amino implementations. -type EncodingConfig struct { - InterfaceRegistry types.InterfaceRegistry - Codec codec.Codec - TxConfig client.TxConfig - Amino *codec.LegacyAmino -} diff --git a/app/providerparams/params.go b/app/providerparams/params.go deleted file mode 100644 index 972a48b4d6..0000000000 --- a/app/providerparams/params.go +++ /dev/null @@ -1,7 +0,0 @@ -package providerparams - -// Simulation parameter constants -const ( - StakePerAccount = "stake_per_account" - InitiallyBondedValidators = "initially_bonded_validators" -) diff --git a/app/providerparams/weights.go b/app/providerparams/weights.go deleted file mode 100644 index d8b1e4c7b3..0000000000 --- a/app/providerparams/weights.go +++ /dev/null @@ -1,42 +0,0 @@ -package providerparams - -// Default simulation operation weights for messages and gov proposals -const ( - DefaultWeightMsgSend int = 100 - DefaultWeightMsgMultiSend int = 10 - DefaultWeightMsgSetWithdrawAddress int = 50 - DefaultWeightMsgWithdrawDelegationReward int = 50 - DefaultWeightMsgWithdrawValidatorCommission int = 50 - DefaultWeightMsgFundCommunityPool int = 50 - DefaultWeightMsgDeposit int = 100 - DefaultWeightMsgVote int = 67 - DefaultWeightMsgUnjail int = 100 - DefaultWeightMsgCreateValidator int = 100 - DefaultWeightMsgEditValidator int = 5 - DefaultWeightMsgDelegate int = 100 - DefaultWeightMsgUndelegate int = 100 - DefaultWeightMsgBeginRedelegate int = 100 - - DefaultWeightCommunitySpendProposal int = 5 - DefaultWeightTextProposal int = 5 - DefaultWeightParamChangeProposal int = 5 - - DefaultWeightMsgStoreCode int = 50 - DefaultWeightMsgInstantiateContract int = 100 - DefaultWeightMsgExecuteContract int = 100 - DefaultWeightMsgUpdateAdmin int = 25 - DefaultWeightMsgClearAdmin int = 10 - DefaultWeightMsgMigrateContract int = 50 - - DefaultWeightStoreCodeProposal int = 5 - DefaultWeightInstantiateContractProposal int = 5 - DefaultWeightUpdateAdminProposal int = 5 - DefaultWeightExecuteContractProposal int = 5 - DefaultWeightClearAdminProposal int = 5 - DefaultWeightMigrateContractProposal int = 5 - DefaultWeightSudoContractProposal int = 5 - DefaultWeightPinCodesProposal int = 5 - DefaultWeightUnpinCodesProposal int = 5 - DefaultWeightUpdateInstantiateConfigProposal int = 5 - DefaultWeightStoreAndInstantiateContractProposal int = 5 -) diff --git a/app/sovereign/app.go b/app/sovereign/app.go index 96e9e24304..a61dac5cc9 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -106,7 +106,7 @@ import ( "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" testutil "github.com/cosmos/interchain-security/v4/testutil/integration" ) @@ -864,8 +864,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino // return encodingConfig // } -func MakeTestEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func MakeTestEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) @@ -873,8 +873,8 @@ func MakeTestEncodingConfig() appparams.EncodingConfig { return encodingConfig } -func makeEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +func makeEncodingConfig() appencoding.EncodingConfig { + encodingConfig := appencoding.MakeTestEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index ee866663b9..215b45317a 100644 --- a/cmd/interchain-security-cd/cmd/root.go +++ b/cmd/interchain-security-cd/cmd/root.go @@ -32,7 +32,7 @@ import ( "github.com/cometbft/cometbft/libs/log" consumer "github.com/cosmos/interchain-security/v4/app/consumer" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := consumer.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(consumer.DefaultNodeHome)) - encodingConfig := appparams.EncodingConfig{ + encodingConfig := appencoding.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appencoding.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appencoding.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, consumer.ModuleBasics, consumer.DefaultNodeHome) for _, sub_cmd := range cmds { diff --git a/cmd/interchain-security-cd/main.go b/cmd/interchain-security-cd/main.go index 3ecd26f899..a64a2a8645 100644 --- a/cmd/interchain-security-cd/main.go +++ b/cmd/interchain-security-cd/main.go @@ -7,12 +7,13 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" app "github.com/cosmos/interchain-security/v4/app/consumer" + appparams "github.com/cosmos/interchain-security/v4/app/params" "github.com/cosmos/interchain-security/v4/cmd/interchain-security-cd/cmd" ) func main() { + appparams.SetAddressPrefixes("consumer") rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: diff --git a/cmd/interchain-security-cdd/cmd/root.go b/cmd/interchain-security-cdd/cmd/root.go index c7ec3a85c4..6b2e6cc726 100644 --- a/cmd/interchain-security-cdd/cmd/root.go +++ b/cmd/interchain-security-cdd/cmd/root.go @@ -32,7 +32,7 @@ import ( "github.com/cometbft/cometbft/libs/log" cdd "github.com/cosmos/interchain-security/v4/app/consumer-democracy" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := cdd.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(cdd.DefaultNodeHome)) - encodingConfig := appparams.EncodingConfig{ + encodingConfig := appencoding.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appencoding.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appencoding.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, cdd.ModuleBasics, cdd.DefaultNodeHome) for _, sub_cmd := range cmds { diff --git a/cmd/interchain-security-cdd/main.go b/cmd/interchain-security-cdd/main.go index 430ab60591..9b6aacd759 100644 --- a/cmd/interchain-security-cdd/main.go +++ b/cmd/interchain-security-cdd/main.go @@ -7,12 +7,13 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" app "github.com/cosmos/interchain-security/v4/app/consumer-democracy" + appparams "github.com/cosmos/interchain-security/v4/app/params" "github.com/cosmos/interchain-security/v4/cmd/interchain-security-cdd/cmd" ) func main() { + appparams.SetAddressPrefixes("consumer") rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: diff --git a/cmd/interchain-security-pd/cmd/root.go b/cmd/interchain-security-pd/cmd/root.go index 9f9585076a..8a8f5fec32 100644 --- a/cmd/interchain-security-pd/cmd/root.go +++ b/cmd/interchain-security-pd/cmd/root.go @@ -31,8 +31,8 @@ import ( tmcfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" providerApp "github.com/cosmos/interchain-security/v4/app/provider" - appparams "github.com/cosmos/interchain-security/v4/app/providerparams" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := providerApp.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(providerApp.DefaultNodeHome)) - encodingConfig := appparams.EncodingConfig{ + encodingConfig := appencoding.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appencoding.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appencoding.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, providerApp.ModuleBasics, providerApp.DefaultNodeHome) for _, sub_cmd := range cmds { cmd.AddCommand(sub_cmd) diff --git a/cmd/interchain-security-pd/main.go b/cmd/interchain-security-pd/main.go index 6091c60156..096b011f5d 100644 --- a/cmd/interchain-security-pd/main.go +++ b/cmd/interchain-security-pd/main.go @@ -6,13 +6,14 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + appparams "github.com/cosmos/interchain-security/v4/app/params" app "github.com/cosmos/interchain-security/v4/app/provider" "github.com/cosmos/interchain-security/v4/cmd/interchain-security-pd/cmd" ) func main() { + appparams.SetAddressPrefixes("provider") rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: diff --git a/cmd/interchain-security-sd/cmd/root.go b/cmd/interchain-security-sd/cmd/root.go index da33be19e8..28520ef1a4 100644 --- a/cmd/interchain-security-sd/cmd/root.go +++ b/cmd/interchain-security-sd/cmd/root.go @@ -31,7 +31,7 @@ import ( tmcfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" - appparams "github.com/cosmos/interchain-security/v4/app/consumerparams" + appencoding "github.com/cosmos/interchain-security/v4/app/encoding" sovereignApp "github.com/cosmos/interchain-security/v4/app/sovereign" ) @@ -40,7 +40,7 @@ import ( func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration tempApp := sovereignApp.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(sovereignApp.DefaultNodeHome)) - encodingConfig := appparams.EncodingConfig{ + encodingConfig := appencoding.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), @@ -186,7 +186,7 @@ lru_size = 0` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appencoding.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -276,7 +276,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appencoding.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, sovereignApp.ModuleBasics, sovereignApp.DefaultNodeHome) for _, sub_cmd := range cmds { cmd.AddCommand(sub_cmd) diff --git a/cmd/interchain-security-sd/main.go b/cmd/interchain-security-sd/main.go index 239b08022b..2265afad90 100644 --- a/cmd/interchain-security-sd/main.go +++ b/cmd/interchain-security-sd/main.go @@ -6,13 +6,14 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + appparams "github.com/cosmos/interchain-security/v4/app/params" app "github.com/cosmos/interchain-security/v4/app/sovereign" "github.com/cosmos/interchain-security/v4/cmd/interchain-security-sd/cmd" ) func main() { + appparams.SetAddressPrefixes("consumer") rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: From 0f2388cb178e42bdb341d798654766f7461bdbbe Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 16 Jan 2024 14:32:32 +0100 Subject: [PATCH 03/27] remove ConsumerValPubKey from ValidatorConfig --- tests/e2e/config.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 311ee67c89..c9ae24a989 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -30,7 +30,6 @@ type ValidatorConfig struct { ConsumerDelAddress string ConsumerValoperAddress string ConsumerValconsAddress string - ConsumerValPubKey string ConsumerPrivValidatorKey string ConsumerNodeKey string UseConsumerKey bool // if true the validator node will start with consumer key @@ -105,7 +104,6 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { ConsumerDelAddress: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", ConsumerValoperAddress: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", ConsumerValconsAddress: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", - ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, UseConsumerKey: false, @@ -124,7 +122,6 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { ConsumerDelAddress: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", ConsumerValoperAddress: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", ConsumerValconsAddress: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, UseConsumerKey: false, @@ -143,7 +140,6 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { ConsumerDelAddress: "cosmos1sx6j9g2rh324a342a5f0rnx7me34r9nwgf0mc7", ConsumerValoperAddress: "cosmosvaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwdamw5d", ConsumerValconsAddress: "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", - ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, ConsumerPrivValidatorKey: `{"address":"B41C3A40142963AA5B12DDD1C4E5890C0B3926B1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"3YaBAZLA+sl/E73lLfbFbG0u6DYm33ayr/0UpCt/vFBSLkZ/X6a1ZR0fy7fGWbN0ogP4Xc8rSx9dnvcZnqrqKw=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"rxBzFedtD3pqgfJQblbxGusKOr47oBfr8ba0Iz14gobtDRZQZlSZ/UGP4pSHkVf+4vtkrkO1vRHBYJobuiP+7A=="}}`, UseConsumerKey: true, @@ -410,8 +406,8 @@ func ConsumerMisbehaviourTestConfig() TestConfig { ValidatorID("alice"): { Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", DelAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", - ValoperAddress: "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", - ValconsAddress: "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + ValoperAddress: "providervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7dd2ukck3", + ValconsAddress: "providervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7x029tue", PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, IpSuffix: "4", @@ -421,7 +417,6 @@ func ConsumerMisbehaviourTestConfig() TestConfig { ConsumerDelAddress: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", ConsumerValoperAddress: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", ConsumerValconsAddress: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", - ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, UseConsumerKey: true, @@ -440,7 +435,6 @@ func ConsumerMisbehaviourTestConfig() TestConfig { ConsumerDelAddress: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", ConsumerValoperAddress: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", ConsumerValconsAddress: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, UseConsumerKey: false, From fb721a13a78afc6099e7186906f9cf855bdaed2d Mon Sep 17 00:00:00 2001 From: mpoke Date: Tue, 16 Jan 2024 23:37:17 +0100 Subject: [PATCH 04/27] update addresses in tests --- tests/e2e/actions.go | 123 ++++++++--- tests/e2e/config.go | 208 +++++++++++------- tests/e2e/state.go | 65 ++++-- tests/e2e/steps_consumer_misbehaviour.go | 6 +- tests/e2e/steps_start_chains.go | 32 +-- tests/e2e/testnet-scripts/fork-consumer.sh | 4 +- .../testnet-scripts/sovereign-genesis.json | 8 +- .../consumer-double-sign.json | 8 +- .../consumer-misbehaviour.json | 4 +- .../e2e/tracehandler_testdata/democracy.json | 8 +- .../democracyRewardsSteps.json | 8 +- .../e2e/tracehandler_testdata/happyPath.json | 24 +- .../multipleConsumers.json | 16 +- .../e2e/tracehandler_testdata/shorthappy.json | 8 +- .../tracehandler_testdata/slashThrottle.json | 8 +- x/ccv/consumer/keeper/params_test.go | 6 +- 16 files changed, 343 insertions(+), 193 deletions(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index e98fd611e3..6476f39d79 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -33,13 +33,33 @@ func (tr TestConfig) sendTokens( action SendTokensAction, verbose bool, ) { + fromValCfg := tr.validatorConfigs[action.From] + toValCfg := tr.validatorConfigs[action.To] + fromAddress := fromValCfg.DelAddress + toAddress := toValCfg.DelAddress + if action.Chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if fromValCfg.UseConsumerKey { + fromAddress = fromValCfg.ConsumerDelAddress + } else { + // use the same address as on the provider but with different prefix + fromAddress = fromValCfg.DelAddressOnConsumer + } + if toValCfg.UseConsumerKey { + toAddress = toValCfg.ConsumerDelAddress + } else { + // use the same address as on the provider but with different prefix + toAddress = toValCfg.DelAddressOnConsumer + } + } + binaryName := tr.chainConfigs[action.Chain].BinaryName //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, binaryName, "tx", "bank", "send", - tr.validatorConfigs[action.From].DelAddress, - tr.validatorConfigs[action.To].DelAddress, + fromAddress, + toAddress, fmt.Sprint(action.Amount)+`stake`, `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), @@ -653,7 +673,7 @@ type AddChainToRelayerAction struct { const hermesChainConfigTemplate = ` [[chains]] -account_prefix = "cosmos" +account_prefix = "%s" clock_drift = "5s" gas_multiplier = 1.1 grpc_addr = "%s" @@ -687,7 +707,7 @@ const gorelayerChainConfigTemplate = ` "key": "default", "chain-id": "%s", "rpc-addr": "%s", - "account-prefix": "cosmos", + "account-prefix": "%s", "keyring-backend": "test", "gas-adjustment": 1.2, "gas-prices": "0.00stake", @@ -717,7 +737,15 @@ func (tr TestConfig) addChainToGorelayer( ChainId := tr.chainConfigs[action.Chain].ChainId rpcAddr := "http://" + queryNodeIP + ":26658" + var accountPrefix string + if ChainId == ChainID("provi") { + accountPrefix = "provider" + } else { + accountPrefix = "consumer" + } + chainConfig := fmt.Sprintf(gorelayerChainConfigTemplate, + accountPrefix, ChainId, rpcAddr, ) @@ -758,7 +786,15 @@ func (tr TestConfig) addChainToHermes( grpcAddr := "tcp://" + queryNodeIP + ":9091" wsAddr := "ws://" + queryNodeIP + ":26658/websocket" + var accountPrefix string + if ChainId == ChainID("provi") { + accountPrefix = "provider" + } else { + accountPrefix = "consumer" + } + chainConfig := fmt.Sprintf(hermesChainConfigTemplate, + accountPrefix, grpcAddr, ChainId, keyName, @@ -1311,15 +1347,22 @@ func (tr TestConfig) delegateTokens( verbose bool, ) { toValCfg := tr.validatorConfigs[action.To] - delegateAddr := toValCfg.ValoperAddress - if action.Chain != ChainID("provi") && toValCfg.UseConsumerKey { - delegateAddr = toValCfg.ConsumerValoperAddress + validatorAddress := toValCfg.ValoperAddress + if action.Chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if toValCfg.UseConsumerKey { + validatorAddress = toValCfg.ConsumerValoperAddress + } else { + // use the same address as on the provider but with different prefix + validatorAddress = toValCfg.ValoperAddressOnConsumer + } } + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "delegate", - delegateAddr, + validatorAddress, fmt.Sprint(action.Amount)+`stake`, `--from`, `validator`+fmt.Sprint(action.From), @@ -1354,16 +1397,23 @@ func (tr TestConfig) unbondTokens( action UnbondTokensAction, verbose bool, ) { - unbondFrom := tr.validatorConfigs[action.UnbondFrom].ValoperAddress - if tr.validatorConfigs[action.UnbondFrom].UseConsumerKey { - unbondFrom = tr.validatorConfigs[action.UnbondFrom].ConsumerValoperAddress + unbondFromValCfg := tr.validatorConfigs[action.UnbondFrom] + validatorAddress := unbondFromValCfg.ValoperAddress + if action.Chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if unbondFromValCfg.UseConsumerKey { + validatorAddress = unbondFromValCfg.ConsumerValoperAddress + } else { + // use the same address as on the provider but with different prefix + validatorAddress = unbondFromValCfg.ValoperAddressOnConsumer + } } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "unbond", - unbondFrom, + validatorAddress, fmt.Sprint(action.Amount)+`stake`, `--from`, `validator`+fmt.Sprint(action.Sender), @@ -1399,17 +1449,32 @@ func (tr TestConfig) cancelUnbondTokens( action CancelUnbondTokensAction, verbose bool, ) { - validator := tr.validatorConfigs[action.Validator].ValoperAddress - if tr.validatorConfigs[action.Validator].UseConsumerKey { - validator = tr.validatorConfigs[action.Validator].ConsumerValoperAddress + valCfg := tr.validatorConfigs[action.Validator] + delCfg := tr.validatorConfigs[action.Delegator] + validatorAddress := valCfg.ValoperAddress + delegatorAddress := delCfg.DelAddress + if action.Chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if valCfg.UseConsumerKey { + validatorAddress = valCfg.ConsumerValoperAddress + } else { + // use the same address as on the provider but with different prefix + validatorAddress = valCfg.ValoperAddressOnConsumer + } + if delCfg.UseConsumerKey { + delegatorAddress = delCfg.ConsumerDelAddress + } else { + // use the same address as on the provider but with different prefix + delegatorAddress = delCfg.DelAddressOnConsumer + } } // get creation-height from state //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "q", "staking", "unbonding-delegation", - tr.validatorConfigs[action.Delegator].DelAddress, - validator, + delegatorAddress, + validatorAddress, `--home`, tr.getValidatorHome(action.Chain, action.Delegator), `--node`, tr.getValidatorNode(action.Chain, action.Delegator), `-o`, `json`, @@ -1430,7 +1495,7 @@ func (tr TestConfig) cancelUnbondTokens( //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd = exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "cancel-unbond", - validator, + validatorAddress, fmt.Sprint(action.Amount)+`stake`, fmt.Sprint(creationHeight), `--from`, `validator`+fmt.Sprint(action.Delegator), @@ -1467,16 +1532,24 @@ type RedelegateTokensAction struct { func (tr TestConfig) redelegateTokens(action RedelegateTokensAction, verbose bool) { srcCfg := tr.validatorConfigs[action.Src] dstCfg := tr.validatorConfigs[action.Dst] - redelegateSrc := srcCfg.ValoperAddress - if action.Chain != ChainID("provi") && srcCfg.UseConsumerKey { - redelegateSrc = srcCfg.ConsumerValoperAddress - } - redelegateDst := dstCfg.ValoperAddress - if action.Chain != ChainID("provi") && dstCfg.UseConsumerKey { - redelegateDst = dstCfg.ConsumerValoperAddress + if action.Chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if srcCfg.UseConsumerKey { + redelegateSrc = srcCfg.ConsumerValoperAddress + } else { + // use the same address as on the provider but with different prefix + redelegateSrc = srcCfg.ValoperAddressOnConsumer + } + if dstCfg.UseConsumerKey { + redelegateDst = dstCfg.ConsumerValoperAddress + } else { + // use the same address as on the provider but with different prefix + redelegateDst = dstCfg.ValoperAddressOnConsumer + } } + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, diff --git a/tests/e2e/config.go b/tests/e2e/config.go index c9ae24a989..57ff15bc72 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -15,24 +15,31 @@ type ( // Attributes that are unique to a validator. Allows us to map (part of) // the set of strings defined above to a set of viable validators type ValidatorConfig struct { - Mnemonic string - DelAddress string - ValoperAddress string - ValconsAddress string - PrivValidatorKey string - NodeKey string + Mnemonic string + DelAddress string // Provider delegator address - Bech32Prefix = "provider" + DelAddressOnConsumer string // Provider delegator address - Bech32Prefix = "consumer" + ValoperAddress string // Provider valoperator address - Bech32Prefix = "provider" + ValoperAddressOnConsumer string // Provider valoperator address - Bech32Prefix = "consumer" + ValconsAddress string // Provider valconsensus address - Bech32Prefix = "provider" + ValconsAddressOnConsumer string // Provider valconsensus address - Bech32Prefix = "consumer" + PrivValidatorKey string + NodeKey string // Must be an integer greater than 0 and less than 253 IpSuffix string // consumer chain key assignment data // keys are used on a new node - ConsumerMnemonic string - ConsumerDelAddress string - ConsumerValoperAddress string - ConsumerValconsAddress string - ConsumerPrivValidatorKey string - ConsumerNodeKey string - UseConsumerKey bool // if true the validator node will start with consumer key + ConsumerMnemonic string + ConsumerDelAddress string // Consumer delegator address - Bech32Prefix = "consumer" + ConsumerDelAddressOnProvider string // Consumer delegator address - Bech32Prefix = "provider" + ConsumerValoperAddress string // Consumer valoperator address - Bech32Prefix = "consumer" + ConsumerValoperAddressOnProvider string // Consumer valoperator address - Bech32Prefix = "provider" + ConsumerValconsAddress string // Consumer valconsensus address - Bech32Prefix = "consumer" + ConsumerValconsAddressOnProvider string // Consumer valconsensus address - Bech32Prefix = "provider" + ConsumerValPubKey string + ConsumerPrivValidatorKey string + ConsumerNodeKey string + UseConsumerKey bool // if true the validator node will start with consumer key } // Attributes that are unique to a chain. Allows us to map (part of) @@ -91,58 +98,79 @@ func (tr *TestConfig) Initialize() { func getDefaultValidators() map[ValidatorID]ValidatorConfig { return map[ValidatorID]ValidatorConfig{ ValidatorID("alice"): { - Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", - DelAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", - ValoperAddress: "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", - ValconsAddress: "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", - PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, - NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, - IpSuffix: "4", + Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", + DelAddress: "provider19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddeeglea", + DelAddressOnConsumer: "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", + ValoperAddress: "providervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7dd2ukck3", + ValoperAddressOnConsumer: "consumervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddy6jwzg", + ValconsAddress: "providervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7x029tue", + ValconsAddressOnConsumer: "consumervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xpvpagq", + PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, + IpSuffix: "4", // consumer chain assigned key - ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", - ConsumerDelAddress: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", - ConsumerValoperAddress: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", - ConsumerValconsAddress: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", - ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, - ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, - UseConsumerKey: false, + ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", + ConsumerDelAddress: "consumer1eeeggku6dzk3mv7wph3zq035rhtd890sh9rl32", + ConsumerDelAddressOnProvider: "provider1eeeggku6dzk3mv7wph3zq035rhtd890s9763yt", + ConsumerValoperAddress: "consumervaloper1eeeggku6dzk3mv7wph3zq035rhtd890scaqql7", + ConsumerValoperAddressOnProvider: "providervaloper1eeeggku6dzk3mv7wph3zq035rhtd890skmykt8", + ConsumerValconsAddress: "consumervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfk9q5ce", + ConsumerValconsAddressOnProvider: "providervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfcryzvq", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, + ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, + UseConsumerKey: false, }, ValidatorID("bob"): { - Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", - DelAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", - ValoperAddress: "cosmosvaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qakmjnw", - ValconsAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, - NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, - IpSuffix: "5", + Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", + DelAddress: "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem", + DelAddressOnConsumer: "consumer1dkas8mu4kyhl5jrh4nzvm65qz588hy9qahzgv6", + ValoperAddress: "providervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9quf9pkh", + ValoperAddressOnConsumer: "consumervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qj0phzw", + ValconsAddress: "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", + ValconsAddressOnConsumer: "consumervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klhuqtq9", + PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, + IpSuffix: "5", // consumer chain assigned key - ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", - ConsumerDelAddress: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", - ConsumerValoperAddress: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", - ConsumerValconsAddress: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, - ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, - UseConsumerKey: false, + ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", + ConsumerDelAddress: "consumer1q90l6j6lzzgt460ehjj56azknlt5yrd44y2uke", + ConsumerDelAddressOnProvider: "provider1q90l6j6lzzgt460ehjj56azknlt5yrd48lnjrc", + ConsumerValoperAddress: "consumervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd46ufrcd", + ConsumerValoperAddressOnProvider: "providervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd456d4v5", + ConsumerValconsAddress: "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", + ConsumerValconsAddressOnProvider: "providervalcons1uuec3cjxajv5te08p220usrjhkfhg9wydlduwz", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, + ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, + UseConsumerKey: false, }, ValidatorID("carol"): { - Mnemonic: "sight similar better jar bitter laptop solve fashion father jelly scissors chest uniform play unhappy convince silly clump another conduct behave reunion marble animal", - DelAddress: "cosmos19hz4m226ztankqramvt4a7t0shejv4dc79gp9u", - ValoperAddress: "cosmosvaloper19hz4m226ztankqramvt4a7t0shejv4dcm3u5f0", - ValconsAddress: "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", - PrivValidatorKey: `{"address":"C888306A908A217B9A943D1DAD8790044D0947A4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"IHo4QEikWZfIKmM0X+N+BjKttz8HOzGs2npyjiba3Xk="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"z08bmSB91uFVpVmR3t2ewd/bDjZ/AzwQpe5rKjWiPG0gejhASKRZl8gqYzRf434GMq23Pwc7MazaenKOJtrdeQ=="}}`, - NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"WLTcHEjbwB24Wp3z5oBSYTvtGQonz/7IQabOFw85BN0UkkyY5HDf38o8oHlFxVI26f+DFVeICuLbe9aXKGnUeg=="}}`, - IpSuffix: "6", + Mnemonic: "sight similar better jar bitter laptop solve fashion father jelly scissors chest uniform play unhappy convince silly clump another conduct behave reunion marble animal", + DelAddress: "provider19hz4m226ztankqramvt4a7t0shejv4dcftuqr6", + DelAddressOnConsumer: "consumer19hz4m226ztankqramvt4a7t0shejv4dcms9wkm", + ValoperAddress: "providervaloper19hz4m226ztankqramvt4a7t0shejv4dc6wz8vk", + ValoperAddressOnConsumer: "consumervaloper19hz4m226ztankqramvt4a7t0shejv4dc5gx3c0", + ValconsAddress: "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr", + ValconsAddressOnConsumer: "consumervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayds0ea6", + PrivValidatorKey: `{"address":"C888306A908A217B9A943D1DAD8790044D0947A4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"IHo4QEikWZfIKmM0X+N+BjKttz8HOzGs2npyjiba3Xk="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"z08bmSB91uFVpVmR3t2ewd/bDjZ/AzwQpe5rKjWiPG0gejhASKRZl8gqYzRf434GMq23Pwc7MazaenKOJtrdeQ=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"WLTcHEjbwB24Wp3z5oBSYTvtGQonz/7IQabOFw85BN0UkkyY5HDf38o8oHlFxVI26f+DFVeICuLbe9aXKGnUeg=="}}`, + IpSuffix: "6", // consumer chain assigned key - ConsumerMnemonic: "clip choose cake west range gun slam cry village receive juice galaxy lend ritual range provide ritual can since verify breeze vacant play dragon", - ConsumerDelAddress: "cosmos1sx6j9g2rh324a342a5f0rnx7me34r9nwgf0mc7", - ConsumerValoperAddress: "cosmosvaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwdamw5d", - ConsumerValconsAddress: "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", - ConsumerPrivValidatorKey: `{"address":"B41C3A40142963AA5B12DDD1C4E5890C0B3926B1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"3YaBAZLA+sl/E73lLfbFbG0u6DYm33ayr/0UpCt/vFBSLkZ/X6a1ZR0fy7fGWbN0ogP4Xc8rSx9dnvcZnqrqKw=="}}`, - ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"rxBzFedtD3pqgfJQblbxGusKOr47oBfr8ba0Iz14gobtDRZQZlSZ/UGP4pSHkVf+4vtkrkO1vRHBYJobuiP+7A=="}}`, - UseConsumerKey: true, + ConsumerMnemonic: "clip choose cake west range gun slam cry village receive juice galaxy lend ritual range provide ritual can since verify breeze vacant play dragon", + ConsumerDelAddress: "consumer1sx6j9g2rh324a342a5f0rnx7me34r9nwduz5te", + ConsumerDelAddressOnProvider: "provider1sx6j9g2rh324a342a5f0rnx7me34r9nwl8m67c", + ConsumerValoperAddress: "consumervaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwzypt9d", + ConsumerValoperAddressOnProvider: "providervaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwvz9a35", + ConsumerValconsAddress: "consumervalcons1kswr5sq599365kcjmhgufevfps9njf43kv9tuk", + ConsumerValconsAddressOnProvider: "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + ConsumerPrivValidatorKey: `{"address":"B41C3A40142963AA5B12DDD1C4E5890C0B3926B1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"3YaBAZLA+sl/E73lLfbFbG0u6DYm33ayr/0UpCt/vFBSLkZ/X6a1ZR0fy7fGWbN0ogP4Xc8rSx9dnvcZnqrqKw=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"rxBzFedtD3pqgfJQblbxGusKOr47oBfr8ba0Iz14gobtDRZQZlSZ/UGP4pSHkVf+4vtkrkO1vRHBYJobuiP+7A=="}}`, + UseConsumerKey: true, }, } } @@ -404,40 +432,54 @@ func ConsumerMisbehaviourTestConfig() TestConfig { }, validatorConfigs: map[ValidatorID]ValidatorConfig{ ValidatorID("alice"): { - Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", - DelAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", - ValoperAddress: "providervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7dd2ukck3", - ValconsAddress: "providervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7x029tue", - PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, - NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, - IpSuffix: "4", + Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", + DelAddress: "provider19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddeeglea", + DelAddressOnConsumer: "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", + ValoperAddress: "providervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7dd2ukck3", + ValoperAddressOnConsumer: "consumervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddy6jwzg", + ValconsAddress: "providervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7x029tue", + ValconsAddressOnConsumer: "consumervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xpvpagq", + PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, + IpSuffix: "4", // consumer chain assigned key - ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", - ConsumerDelAddress: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", - ConsumerValoperAddress: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", - ConsumerValconsAddress: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", - ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, - ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, - UseConsumerKey: true, + ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", + ConsumerDelAddress: "consumer1eeeggku6dzk3mv7wph3zq035rhtd890sh9rl32", + ConsumerDelAddressOnProvider: "provider1eeeggku6dzk3mv7wph3zq035rhtd890s9763yt", + ConsumerValoperAddress: "consumervaloper1eeeggku6dzk3mv7wph3zq035rhtd890scaqql7", + ConsumerValoperAddressOnProvider: "providervaloper1eeeggku6dzk3mv7wph3zq035rhtd890skmykt8", + ConsumerValconsAddress: "consumervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfk9q5ce", + ConsumerValconsAddressOnProvider: "providervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfcryzvq", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, + ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, + UseConsumerKey: true, }, ValidatorID("bob"): { - Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", - DelAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", - ValoperAddress: "cosmosvaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qakmjnw", - ValconsAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, - NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, - IpSuffix: "5", + Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", + DelAddress: "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem", + DelAddressOnConsumer: "consumer1dkas8mu4kyhl5jrh4nzvm65qz588hy9qahzgv6", + ValoperAddress: "providervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9quf9pkh", + ValoperAddressOnConsumer: "consumervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qj0phzw", + ValconsAddress: "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", + ValconsAddressOnConsumer: "consumervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klhuqtq9", + PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, + IpSuffix: "5", // consumer chain assigned key - ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", - ConsumerDelAddress: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", - ConsumerValoperAddress: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", - ConsumerValconsAddress: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, - ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, - UseConsumerKey: false, + ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", + ConsumerDelAddress: "consumer1q90l6j6lzzgt460ehjj56azknlt5yrd44y2uke", + ConsumerDelAddressOnProvider: "provider1q90l6j6lzzgt460ehjj56azknlt5yrd48lnjrc", + ConsumerValoperAddress: "consumervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd46ufrcd", + ConsumerValoperAddressOnProvider: "providervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd456d4v5", + ConsumerValconsAddress: "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", + ConsumerValconsAddressOnProvider: "providervalcons1uuec3cjxajv5te08p220usrjhkfhg9wydlduwz", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, + ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, + UseConsumerKey: false, }, }, chainConfigs: map[ChainID]ChainConfig{ diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 6578aad03a..41edbe5a1c 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -316,9 +316,16 @@ func (tr TestConfig) getRewards(chain ChainID, modelState Rewards) Rewards { } func (tr TestConfig) getReward(chain ChainID, validator ValidatorID, blockHeight uint, isNativeDenom bool) float64 { - delAddresss := tr.validatorConfigs[validator].DelAddress - if chain != ChainID("provi") && tr.validatorConfigs[validator].UseConsumerKey { - delAddresss = tr.validatorConfigs[validator].ConsumerDelAddress + valCfg := tr.validatorConfigs[validator] + delAddresss := valCfg.DelAddress + if chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if valCfg.UseConsumerKey { + delAddresss = valCfg.ConsumerDelAddress + } else { + // use the same address as on the provider but with different prefix + delAddresss = valCfg.DelAddressOnConsumer + } } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. @@ -345,9 +352,16 @@ func (tr TestConfig) getReward(chain ChainID, validator ValidatorID, blockHeight func (tr TestConfig) getBalance(chain ChainID, validator ValidatorID) uint { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - valDelAddress := tr.validatorConfigs[validator].DelAddress - if chain != ChainID("provi") && tr.validatorConfigs[validator].UseConsumerKey { - valDelAddress = tr.validatorConfigs[validator].ConsumerDelAddress + valCfg := tr.validatorConfigs[validator] + valDelAddress := valCfg.DelAddress + if chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if valCfg.UseConsumerKey { + valDelAddress = valCfg.ConsumerDelAddress + } else { + // use the same address as on the provider but with different prefix + valDelAddress = valCfg.DelAddressOnConsumer + } } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. @@ -485,6 +499,7 @@ type ValPubKey struct { Value string `yaml:"value"` } +// TODO (mpoke) Return powers for multiple validators func (tr TestConfig) getValPower(chain ChainID, validator ValidatorID) uint { if *verbose { log.Println("getting validator power for chain: ", chain, " validator: ", validator) @@ -519,16 +534,25 @@ func (tr TestConfig) getValPower(chain ChainID, validator ValidatorID) uint { } for _, val := range valset.Validators { - if val.Address == tr.validatorConfigs[validator].ValconsAddress || - val.Address == tr.validatorConfigs[validator].ConsumerValconsAddress { - - votingPower, err := strconv.Atoi(val.VotingPower) - if err != nil { - log.Fatalf("strconv.Atoi returned an error while converting validator voting power: %v, voting power string: %s, validator set: %s", err, val.VotingPower, pretty.Sprint(valset)) + if chain == ChainID("provi") { + // use binary with Bech32Prefix set to "provider" + if val.Address != tr.validatorConfigs[validator].ValconsAddress { + continue } + } else { + // use binary with Bech32Prefix set to "consumer" + if val.Address != tr.validatorConfigs[validator].ValconsAddressOnConsumer && + val.Address != tr.validatorConfigs[validator].ConsumerValconsAddress { + continue + } + } - return uint(votingPower) + votingPower, err := strconv.Atoi(val.VotingPower) + if err != nil { + log.Fatalf("strconv.Atoi returned an error while converting validator voting power: %v, voting power string: %s, validator set: %s", err, val.VotingPower, pretty.Sprint(valset)) } + + return uint(votingPower) } // Validator not in set, its validator power is zero. @@ -536,11 +560,22 @@ func (tr TestConfig) getValPower(chain ChainID, validator ValidatorID) uint { } func (tr TestConfig) getValStakedTokens(chain ChainID, validator ValidatorID) uint { + valoperAddress := tr.validatorConfigs[validator].ValoperAddress + if chain != ChainID("provi") { + // use binary with Bech32Prefix set to "consumer" + if tr.validatorConfigs[validator].UseConsumerKey { + valoperAddress = tr.validatorConfigs[validator].ConsumerValoperAddress + } else { + // use the same address as on the provider but with different prefix + valoperAddress = tr.validatorConfigs[validator].ValoperAddressOnConsumer + } + } + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "staking", "validator", - tr.validatorConfigs[validator].ValoperAddress, + valoperAddress, `--node`, tr.getQueryNode(chain), `-o`, `json`, @@ -641,7 +676,7 @@ func (tr TestConfig) getProviderAddressFromConsumer(consumerChain ChainID, valid cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName, "query", "provider", "validator-provider-key", - string(consumerChain), tr.validatorConfigs[validator].ConsumerValconsAddress, + string(consumerChain), tr.validatorConfigs[validator].ConsumerValconsAddressOnProvider, `--node`, tr.getQueryNode(ChainID("provi")), `-o`, `json`, ) diff --git a/tests/e2e/steps_consumer_misbehaviour.go b/tests/e2e/steps_consumer_misbehaviour.go index 4df7b9daec..3cb4ce0f1b 100644 --- a/tests/e2e/steps_consumer_misbehaviour.go +++ b/tests/e2e/steps_consumer_misbehaviour.go @@ -61,7 +61,7 @@ func stepsStartChainsWithSoftOptOut(consumerName string) []Step { Action: AssignConsumerPubKeyAction{ Chain: ChainID(consumerName), Validator: ValidatorID("alice"), - ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, + ConsumerPubkey: getDefaultValidators()[ValidatorID("alice")].ConsumerValPubKey, // consumer chain has not started // we don't need to reconfigure the node // since it will start with consumer key @@ -70,10 +70,10 @@ func stepsStartChainsWithSoftOptOut(consumerName string) []Step { State: State{ ChainID(consumerName): ChainState{ AssignedKeys: &map[ValidatorID]string{ - ValidatorID("alice"): "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", + ValidatorID("alice"): getDefaultValidators()[ValidatorID("alice")].ConsumerValconsAddressOnProvider, }, ProviderKeys: &map[ValidatorID]string{ - ValidatorID("alice"): "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + ValidatorID("alice"): getDefaultValidators()[ValidatorID("alice")].ValconsAddress, }, }, }, diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index b1fdb65df5..08732e3f37 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -64,7 +64,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint Action: AssignConsumerPubKeyAction{ Chain: ChainID(consumerName), Validator: ValidatorID("carol"), - ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, // consumer chain has not started // we don't need to reconfigure the node // since it will start with consumer key @@ -73,10 +73,10 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint State: State{ ChainID(consumerName): ChainState{ AssignedKeys: &map[ValidatorID]string{ - ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ConsumerValconsAddressOnProvider, }, ProviderKeys: &map[ValidatorID]string{ - ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ValconsAddress, }, }, }, @@ -86,7 +86,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint Action: AssignConsumerPubKeyAction{ Chain: ChainID(consumerName), Validator: ValidatorID("carol"), - ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, ReconfigureNode: false, ExpectError: true, ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", @@ -99,7 +99,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint Chain: ChainID(consumerName), Validator: ValidatorID("bob"), // same pub key as carol - ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, ReconfigureNode: false, ExpectError: true, ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", @@ -107,11 +107,11 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint State: State{ ChainID(consumerName): ChainState{ AssignedKeys: &map[ValidatorID]string{ - ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ConsumerValconsAddressOnProvider, ValidatorID("bob"): "", }, ProviderKeys: &map[ValidatorID]string{ - ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ValconsAddress, }, }, }, @@ -235,7 +235,7 @@ func stepsAssignConsumerKeyOnStartedChain(consumerName, validator string) []Step Validator: ValidatorID("bob"), // reconfigure the node -> validator was using provider key // until this point -> key matches config.consumerValPubKey for "bob" - ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, + ConsumerPubkey: getDefaultValidators()[ValidatorID("bob")].ConsumerValPubKey, ReconfigureNode: true, }, State: State{ @@ -257,12 +257,12 @@ func stepsAssignConsumerKeyOnStartedChain(consumerName, validator string) []Step ValidatorID("carol"): 500, }, AssignedKeys: &map[ValidatorID]string{ - ValidatorID("bob"): "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + ValidatorID("bob"): getDefaultValidators()[ValidatorID("bob")].ConsumerValconsAddressOnProvider, + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ConsumerValconsAddressOnProvider, }, ProviderKeys: &map[ValidatorID]string{ - ValidatorID("bob"): "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ValidatorID("bob"): getDefaultValidators()[ValidatorID("bob")].ValconsAddress, + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ValconsAddress, }, }, }, @@ -293,12 +293,12 @@ func stepsAssignConsumerKeyOnStartedChain(consumerName, validator string) []Step ValidatorID("carol"): 500, }, AssignedKeys: &map[ValidatorID]string{ - ValidatorID("bob"): "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + ValidatorID("bob"): getDefaultValidators()[ValidatorID("bob")].ConsumerValconsAddressOnProvider, + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ConsumerValconsAddressOnProvider, }, ProviderKeys: &map[ValidatorID]string{ - ValidatorID("bob"): "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ValidatorID("bob"): getDefaultValidators()[ValidatorID("bob")].ValconsAddress, + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ValconsAddress, }, }, }, diff --git a/tests/e2e/testnet-scripts/fork-consumer.sh b/tests/e2e/testnet-scripts/fork-consumer.sh index 7c12438b71..6280ff031f 100644 --- a/tests/e2e/testnet-scripts/fork-consumer.sh +++ b/tests/e2e/testnet-scripts/fork-consumer.sh @@ -53,7 +53,7 @@ enabled = true [[chains]] id = "consu" ccv_consumer_chain = true -account_prefix = "cosmos" +account_prefix = "consumer" clock_drift = "5s" gas_multiplier = 1.1 grpc_addr = "tcp://$CONS_CHAIN_PREFIX.252:9091" @@ -75,7 +75,7 @@ event_source = { mode = 'push', url = 'ws://$CONS_CHAIN_PREFIX.252:26658/websock [[chains]] id = "provi" -account_prefix = "cosmos" +account_prefix = "provider" clock_drift = "5s" gas_multiplier = 1.1 grpc_addr = "tcp://$PROV_CHAIN_PREFIX.4:9091" diff --git a/tests/e2e/testnet-scripts/sovereign-genesis.json b/tests/e2e/testnet-scripts/sovereign-genesis.json index c3ae9da36c..af7f1e30b3 100644 --- a/tests/e2e/testnet-scripts/sovereign-genesis.json +++ b/tests/e2e/testnet-scripts/sovereign-genesis.json @@ -35,7 +35,7 @@ "accounts": [ { "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", + "address": "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", "pub_key": null, "account_number": "0", "sequence": "0" @@ -52,7 +52,7 @@ }, "balances": [ { - "address": "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", + "address": "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", "coins": [ { "denom": "stake", @@ -125,8 +125,8 @@ "max_change_rate": "0.010000000000000000" }, "min_self_delegation": "1", - "delegator_address": "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", - "validator_address": "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", + "delegator_address": "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", + "validator_address": "consumervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddy6jwzg", "pubkey": { "@type": "/cosmos.crypto.ed25519.PubKey", "key": "RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10=" diff --git a/tests/e2e/tracehandler_testdata/consumer-double-sign.json b/tests/e2e/tracehandler_testdata/consumer-double-sign.json index e93049cf8b..bd35ba1183 100644 --- a/tests/e2e/tracehandler_testdata/consumer-double-sign.json +++ b/tests/e2e/tracehandler_testdata/consumer-double-sign.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json index 43e242e7dc..aa4083d785 100644 --- a/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json +++ b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json @@ -107,10 +107,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "alice": "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe" + "alice": "consumervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfk9q5ce" }, "ProviderKeys": { - "alice": "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq" + "alice": "consumervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xpvpagq" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/democracy.json b/tests/e2e/tracehandler_testdata/democracy.json index 10c9838122..197e9161b5 100644 --- a/tests/e2e/tracehandler_testdata/democracy.json +++ b/tests/e2e/tracehandler_testdata/democracy.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json index 7e6d90cace..5e746a8c14 100644 --- a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json +++ b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/happyPath.json b/tests/e2e/tracehandler_testdata/happyPath.json index 5b9505e848..546fa11013 100644 --- a/tests/e2e/tracehandler_testdata/happyPath.json +++ b/tests/e2e/tracehandler_testdata/happyPath.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -471,12 +471,12 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "bob": "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "bob": "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "bob": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "bob": "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -526,12 +526,12 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "bob": "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "bob": "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "bob": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "bob": "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/multipleConsumers.json b/tests/e2e/tracehandler_testdata/multipleConsumers.json index fdb69d1e47..23546c3307 100644 --- a/tests/e2e/tracehandler_testdata/multipleConsumers.json +++ b/tests/e2e/tracehandler_testdata/multipleConsumers.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -380,10 +380,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -425,10 +425,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/shorthappy.json b/tests/e2e/tracehandler_testdata/shorthappy.json index 607c1d6d7c..c53d29216c 100644 --- a/tests/e2e/tracehandler_testdata/shorthappy.json +++ b/tests/e2e/tracehandler_testdata/shorthappy.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/slashThrottle.json b/tests/e2e/tracehandler_testdata/slashThrottle.json index e99e7e2973..d9ec05da89 100644 --- a/tests/e2e/tracehandler_testdata/slashThrottle.json +++ b/tests/e2e/tracehandler_testdata/slashThrottle.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { - "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/x/ccv/consumer/keeper/params_test.go b/x/ccv/consumer/keeper/params_test.go index e2975a0b31..dd9302873f 100644 --- a/x/ccv/consumer/keeper/params_test.go +++ b/x/ccv/consumer/keeper/params_test.go @@ -38,7 +38,7 @@ func TestParams(t *testing.T) { require.Equal(t, expParams, params) newParams := ccv.NewParams(false, 1000, - "channel-2", "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", + "channel-2", "provider19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddeeglea", 7*24*time.Hour, 25*time.Hour, "0.5", 500, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}, 2*time.Hour) consumerKeeper.SetParams(ctx, newParams) params = consumerKeeper.GetConsumerParams(ctx) @@ -52,10 +52,10 @@ func TestParams(t *testing.T) { gotChan := consumerKeeper.GetDistributionTransmissionChannel(ctx) require.Equal(t, gotChan, "channel-7") - consumerKeeper.SetProviderFeePoolAddrStr(ctx, "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la") + consumerKeeper.SetProviderFeePoolAddrStr(ctx, "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem") gotAddr := consumerKeeper. GetProviderFeePoolAddrStr(ctx) - require.Equal(t, gotAddr, "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la") + require.Equal(t, gotAddr, "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem") consumerKeeper.SetUnbondingPeriod(ctx, time.Hour*24*10) storedUnbondingPeriod := consumerKeeper.GetUnbondingPeriod(ctx) From f4e78c4baa91b024f13040f53b51c44845e3e4f6 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 17 Jan 2024 01:12:26 +0100 Subject: [PATCH 05/27] make SlashAcks consistent across chains --- x/ccv/consumer/keeper/keeper.go | 8 ++------ x/ccv/consumer/keeper/relay.go | 4 +++- x/ccv/provider/keeper/relay.go | 5 +++-- x/ccv/provider/keeper/relay_test.go | 5 +++-- x/ccv/types/wire.go | 2 +- x/ccv/types/wire_test.go | 9 +++++---- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index a43a773862..b8751344b8 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -501,13 +501,9 @@ func (k Keeper) SetOutstandingDowntime(ctx sdk.Context, address sdk.ConsAddress) } // DeleteOutstandingDowntime deletes the outstanding downtime flag for the given validator consensus address -func (k Keeper) DeleteOutstandingDowntime(ctx sdk.Context, consAddress string) { - consAddr, err := sdk.ConsAddressFromBech32(consAddress) - if err != nil { - return // TODO: this should panic with appropriate tests to validate the panic won't happen in normal cases. - } +func (k Keeper) DeleteOutstandingDowntime(ctx sdk.Context, address sdk.ConsAddress) { store := ctx.KVStore(k.storeKey) - store.Delete(types.OutstandingDowntimeKey(consAddr)) + store.Delete(types.OutstandingDowntimeKey(address)) } // GetAllOutstandingDowntimes gets an array of the validator addresses of outstanding downtime flags diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index 0de4b0c35f..3a58f1e0a2 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -82,7 +82,9 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new // remove outstanding slashing flags of the validators // for which the slashing was acknowledged by the provider chain - for _, addr := range newChanges.GetSlashAcks() { + for _, ack := range newChanges.GetSlashAcks() { + // note that the error was already checked when the packet data was validated + addr, _ := sdk.ConsAddressFromHex(ack) k.DeleteOutstandingDowntime(ctx, addr) } diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 2c00d40441..1e585b94c0 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -1,6 +1,7 @@ package keeper import ( + "encoding/hex" "fmt" "strconv" @@ -421,8 +422,8 @@ 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()) + // Note: do not use consumerConsAddr.String() as it converts it to Bech32 + k.AppendSlashAck(ctx, chainID, hex.EncodeToString(consumerConsAddr.Address)) // jail validator if !validator.IsJailed() { diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 02df262d53..f76d9da08c 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "encoding/hex" "strings" "testing" @@ -433,8 +434,8 @@ func TestHandleSlashPacket(t *testing.T) { if tc.expectedSlashAcksLen == 1 { // must match the consumer address - require.Equal(t, consumerConsAddr.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) - require.NotEqual(t, providerConsAddr.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) + require.Equal(t, hex.EncodeToString(consumerConsAddr.Address), providerKeeper.GetSlashAcks(ctx, chainId)[0]) + require.NotEqual(t, hex.EncodeToString(providerConsAddr.Address), providerKeeper.GetSlashAcks(ctx, chainId)[0]) require.NotEqual(t, providerConsAddr.String(), consumerConsAddr.String()) } diff --git a/x/ccv/types/wire.go b/x/ccv/types/wire.go index c7cbe9e126..a5c995f37c 100644 --- a/x/ccv/types/wire.go +++ b/x/ccv/types/wire.go @@ -32,7 +32,7 @@ func (vsc ValidatorSetChangePacketData) Validate() error { } // Validate the slash acks - must be consensus addresses for _, ack := range vsc.SlashAcks { - _, err := sdk.ConsAddressFromBech32(ack) + _, err := sdk.ConsAddressFromHex(ack) if err != nil { return err } diff --git a/x/ccv/types/wire_test.go b/x/ccv/types/wire_test.go index e8ba966c8c..b9ee5e9008 100644 --- a/x/ccv/types/wire_test.go +++ b/x/ccv/types/wire_test.go @@ -1,6 +1,7 @@ package types_test import ( + "encoding/hex" "strings" "testing" @@ -23,8 +24,8 @@ func TestPacketDataValidateBasic(t *testing.T) { require.NoError(t, err) cId := crypto.NewCryptoIdentityFromIntSeed(4732894342) - validSlashAck := cId.SDKValConsAddress().String() - tooLongSlashAck := string(make([]byte, 1024)) + validSlashAck := hex.EncodeToString(cId.ConsumerConsAddress().Address) + invalidSlashAck := "invalidAddress" cases := []struct { name string @@ -74,7 +75,7 @@ func TestPacketDataValidateBasic(t *testing.T) { ), }, { - "invalid: slash ack is too long", + "invalid: slash ack is not an hex address", true, types.NewValidatorSetChangePacketData( []abci.ValidatorUpdate{ @@ -85,7 +86,7 @@ func TestPacketDataValidateBasic(t *testing.T) { }, 5, []string{ - tooLongSlashAck, + invalidSlashAck, }, ), }, From 47d3a9cfa1c9719dd09191461cf7e64b8f4def07 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 17 Jan 2024 09:57:20 +0100 Subject: [PATCH 06/27] add comments for clarity --- tests/e2e/config.go | 67 ++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 57ff15bc72..da8f6c591a 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -15,31 +15,60 @@ type ( // Attributes that are unique to a validator. Allows us to map (part of) // the set of strings defined above to a set of viable validators type ValidatorConfig struct { - Mnemonic string - DelAddress string // Provider delegator address - Bech32Prefix = "provider" - DelAddressOnConsumer string // Provider delegator address - Bech32Prefix = "consumer" - ValoperAddress string // Provider valoperator address - Bech32Prefix = "provider" - ValoperAddressOnConsumer string // Provider valoperator address - Bech32Prefix = "consumer" - ValconsAddress string // Provider valconsensus address - Bech32Prefix = "provider" - ValconsAddressOnConsumer string // Provider valconsensus address - Bech32Prefix = "consumer" - PrivValidatorKey string - NodeKey string + // Seed phrase to generate a secp256k1 key used by the validator on the provider + Mnemonic string + // Validator account address on provider marshaled to string using Bech32 + // with Bech32Prefix = "provider" + DelAddress string + // Validator account address on provider marshaled to string using Bech32 + // with Bech32Prefix = "consumer" + DelAddressOnConsumer string + // Validator operator address on provider marshaled to string using Bech32 + // with Bech32Prefix = "provider" + ValoperAddress string + // Validator operator address on provider marshaled to string using Bech32 + // with Bech32Prefix = "consumer" + ValoperAddressOnConsumer string + // Validator consensus address on provider marshaled to string using Bech32 + // with Bech32Prefix = "provider". It matches the PrivValidatorKey bellow. + ValconsAddress string + // Validator consensus address on provider marshaled to string using Bech32 + // with Bech32Prefix = "consumer". + ValconsAddressOnConsumer string + // Key used for consensus on provider + PrivValidatorKey string + NodeKey string // Must be an integer greater than 0 and less than 253 IpSuffix string // consumer chain key assignment data // keys are used on a new node - ConsumerMnemonic string - ConsumerDelAddress string // Consumer delegator address - Bech32Prefix = "consumer" - ConsumerDelAddressOnProvider string // Consumer delegator address - Bech32Prefix = "provider" - ConsumerValoperAddress string // Consumer valoperator address - Bech32Prefix = "consumer" - ConsumerValoperAddressOnProvider string // Consumer valoperator address - Bech32Prefix = "provider" - ConsumerValconsAddress string // Consumer valconsensus address - Bech32Prefix = "consumer" - ConsumerValconsAddressOnProvider string // Consumer valconsensus address - Bech32Prefix = "provider" + + // Seed phrase to generate a secp256k1 key used by the validator on the consumer + ConsumerMnemonic string + // Validator account address on consumer marshaled to string using Bech32 + // with Bech32Prefix = "consumer" + ConsumerDelAddress string // Consumer delegator address - Bech32Prefix = "consumer" + // Validator account address on consumer marshaled to string using Bech32 + // with Bech32Prefix = "provider" + ConsumerDelAddressOnProvider string + // Validator operator address on consumer marshaled to string using Bech32 + // with Bech32Prefix = "consumer" + ConsumerValoperAddress string + // Validator operator address on consumer marshaled to string using Bech32 + // with Bech32Prefix = "provider" + ConsumerValoperAddressOnProvider string + // Validator consensus address on consumer marshaled to string using Bech32 + // with Bech32Prefix = "consumer". It matches the PrivValidatorKey bellow. + ConsumerValconsAddress string + // Validator consensus address on consumer marshaled to string using Bech32 + // with Bech32Prefix = "provider". + ConsumerValconsAddressOnProvider string ConsumerValPubKey string - ConsumerPrivValidatorKey string - ConsumerNodeKey string - UseConsumerKey bool // if true the validator node will start with consumer key + // Key used for consensus on consumer + ConsumerPrivValidatorKey string + ConsumerNodeKey string + UseConsumerKey bool // if true the validator node will start with consumer key } // Attributes that are unique to a chain. Allows us to map (part of) From f9b3bdfdc607ade57abb622be92dc142f9e2a6c5 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 17 Jan 2024 11:30:38 +0100 Subject: [PATCH 07/27] Regenerate traces --- tests/e2e/tracehandler_testdata/consumer-misbehaviour.json | 4 ++-- tests/e2e/tracehandler_testdata/happyPath.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json index aa4083d785..fa24279ebe 100644 --- a/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json +++ b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json @@ -107,10 +107,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "alice": "consumervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfk9q5ce" + "alice": "providervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfcryzvq" }, "ProviderKeys": { - "alice": "consumervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xpvpagq" + "alice": "providervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7x029tue" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/happyPath.json b/tests/e2e/tracehandler_testdata/happyPath.json index 546fa11013..92bddbff35 100644 --- a/tests/e2e/tracehandler_testdata/happyPath.json +++ b/tests/e2e/tracehandler_testdata/happyPath.json @@ -471,7 +471,7 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "bob": "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", + "bob": "providervalcons1uuec3cjxajv5te08p220usrjhkfhg9wydlduwz", "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { @@ -526,7 +526,7 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "bob": "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", + "bob": "providervalcons1uuec3cjxajv5te08p220usrjhkfhg9wydlduwz", "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" }, "ProviderKeys": { From 40271580ce8e4144c5070615ee0b150c009031e4 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 17 Jan 2024 11:51:03 +0100 Subject: [PATCH 08/27] Fix argument order --- tests/e2e/actions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 6476f39d79..4029d57306 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -745,9 +745,9 @@ func (tr TestConfig) addChainToGorelayer( } chainConfig := fmt.Sprintf(gorelayerChainConfigTemplate, - accountPrefix, ChainId, rpcAddr, + accountPrefix, ) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. From 1ce3a93ae7c5b801f2ab17b8908ecd6dcf345958 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 17 Jan 2024 12:09:33 +0100 Subject: [PATCH 09/27] set bech32prefix for provider to cosmos --- cmd/interchain-security-pd/main.go | 2 +- tests/e2e/actions.go | 4 +- tests/e2e/config.go | 72 +++++++++---------- tests/e2e/state.go | 2 +- tests/e2e/testnet-scripts/fork-consumer.sh | 2 +- .../consumer-double-sign.json | 8 +-- .../e2e/tracehandler_testdata/democracy.json | 8 +-- .../democracyRewardsSteps.json | 8 +-- .../e2e/tracehandler_testdata/happyPath.json | 20 +++--- .../multipleConsumers.json | 16 ++--- .../e2e/tracehandler_testdata/shorthappy.json | 8 +-- .../tracehandler_testdata/slashThrottle.json | 8 +-- x/ccv/consumer/keeper/params_test.go | 6 +- 13 files changed, 82 insertions(+), 82 deletions(-) diff --git a/cmd/interchain-security-pd/main.go b/cmd/interchain-security-pd/main.go index 096b011f5d..7788f06bff 100644 --- a/cmd/interchain-security-pd/main.go +++ b/cmd/interchain-security-pd/main.go @@ -12,7 +12,7 @@ import ( ) func main() { - appparams.SetAddressPrefixes("provider") + appparams.SetAddressPrefixes("cosmos") rootCmd := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { switch e := err.(type) { diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 6476f39d79..522bb54133 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -739,7 +739,7 @@ func (tr TestConfig) addChainToGorelayer( var accountPrefix string if ChainId == ChainID("provi") { - accountPrefix = "provider" + accountPrefix = "cosmos" } else { accountPrefix = "consumer" } @@ -788,7 +788,7 @@ func (tr TestConfig) addChainToHermes( var accountPrefix string if ChainId == ChainID("provi") { - accountPrefix = "provider" + accountPrefix = "cosmos" } else { accountPrefix = "consumer" } diff --git a/tests/e2e/config.go b/tests/e2e/config.go index da8f6c591a..88f5c03de3 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -18,19 +18,19 @@ type ValidatorConfig struct { // Seed phrase to generate a secp256k1 key used by the validator on the provider Mnemonic string // Validator account address on provider marshaled to string using Bech32 - // with Bech32Prefix = "provider" + // with Bech32Prefix = "cosmos" DelAddress string // Validator account address on provider marshaled to string using Bech32 // with Bech32Prefix = "consumer" DelAddressOnConsumer string // Validator operator address on provider marshaled to string using Bech32 - // with Bech32Prefix = "provider" + // with Bech32Prefix = "cosmos" ValoperAddress string // Validator operator address on provider marshaled to string using Bech32 // with Bech32Prefix = "consumer" ValoperAddressOnConsumer string // Validator consensus address on provider marshaled to string using Bech32 - // with Bech32Prefix = "provider". It matches the PrivValidatorKey bellow. + // with Bech32Prefix = "cosmos". It matches the PrivValidatorKey bellow. ValconsAddress string // Validator consensus address on provider marshaled to string using Bech32 // with Bech32Prefix = "consumer". @@ -50,19 +50,19 @@ type ValidatorConfig struct { // with Bech32Prefix = "consumer" ConsumerDelAddress string // Consumer delegator address - Bech32Prefix = "consumer" // Validator account address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "provider" + // with Bech32Prefix = "cosmos" ConsumerDelAddressOnProvider string // Validator operator address on consumer marshaled to string using Bech32 // with Bech32Prefix = "consumer" ConsumerValoperAddress string // Validator operator address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "provider" + // with Bech32Prefix = "cosmos" ConsumerValoperAddressOnProvider string // Validator consensus address on consumer marshaled to string using Bech32 // with Bech32Prefix = "consumer". It matches the PrivValidatorKey bellow. ConsumerValconsAddress string // Validator consensus address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "provider". + // with Bech32Prefix = "cosmos". ConsumerValconsAddressOnProvider string ConsumerValPubKey string // Key used for consensus on consumer @@ -128,11 +128,11 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { return map[ValidatorID]ValidatorConfig{ ValidatorID("alice"): { Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", - DelAddress: "provider19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddeeglea", + DelAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", DelAddressOnConsumer: "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", - ValoperAddress: "providervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7dd2ukck3", + ValoperAddress: "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", ValoperAddressOnConsumer: "consumervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddy6jwzg", - ValconsAddress: "providervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7x029tue", + ValconsAddress: "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", ValconsAddressOnConsumer: "consumervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xpvpagq", PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, @@ -141,11 +141,11 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { // consumer chain assigned key ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", ConsumerDelAddress: "consumer1eeeggku6dzk3mv7wph3zq035rhtd890sh9rl32", - ConsumerDelAddressOnProvider: "provider1eeeggku6dzk3mv7wph3zq035rhtd890s9763yt", + ConsumerDelAddressOnProvider: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", ConsumerValoperAddress: "consumervaloper1eeeggku6dzk3mv7wph3zq035rhtd890scaqql7", - ConsumerValoperAddressOnProvider: "providervaloper1eeeggku6dzk3mv7wph3zq035rhtd890skmykt8", + ConsumerValoperAddressOnProvider: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", ConsumerValconsAddress: "consumervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfk9q5ce", - ConsumerValconsAddressOnProvider: "providervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfcryzvq", + ConsumerValconsAddressOnProvider: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, @@ -153,11 +153,11 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { }, ValidatorID("bob"): { Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", - DelAddress: "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem", + DelAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", DelAddressOnConsumer: "consumer1dkas8mu4kyhl5jrh4nzvm65qz588hy9qahzgv6", - ValoperAddress: "providervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9quf9pkh", + ValoperAddress: "cosmosvaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qakmjnw", ValoperAddressOnConsumer: "consumervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qj0phzw", - ValconsAddress: "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", + ValconsAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", ValconsAddressOnConsumer: "consumervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klhuqtq9", PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, @@ -166,11 +166,11 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { // consumer chain assigned key ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", ConsumerDelAddress: "consumer1q90l6j6lzzgt460ehjj56azknlt5yrd44y2uke", - ConsumerDelAddressOnProvider: "provider1q90l6j6lzzgt460ehjj56azknlt5yrd48lnjrc", + ConsumerDelAddressOnProvider: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", ConsumerValoperAddress: "consumervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd46ufrcd", - ConsumerValoperAddressOnProvider: "providervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd456d4v5", + ConsumerValoperAddressOnProvider: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", ConsumerValconsAddress: "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", - ConsumerValconsAddressOnProvider: "providervalcons1uuec3cjxajv5te08p220usrjhkfhg9wydlduwz", + ConsumerValconsAddressOnProvider: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, @@ -178,11 +178,11 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { }, ValidatorID("carol"): { Mnemonic: "sight similar better jar bitter laptop solve fashion father jelly scissors chest uniform play unhappy convince silly clump another conduct behave reunion marble animal", - DelAddress: "provider19hz4m226ztankqramvt4a7t0shejv4dcftuqr6", + DelAddress: "cosmos19hz4m226ztankqramvt4a7t0shejv4dc79gp9u", DelAddressOnConsumer: "consumer19hz4m226ztankqramvt4a7t0shejv4dcms9wkm", - ValoperAddress: "providervaloper19hz4m226ztankqramvt4a7t0shejv4dc6wz8vk", + ValoperAddress: "cosmosvaloper19hz4m226ztankqramvt4a7t0shejv4dcm3u5f0", ValoperAddressOnConsumer: "consumervaloper19hz4m226ztankqramvt4a7t0shejv4dc5gx3c0", - ValconsAddress: "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr", + ValconsAddress: "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", ValconsAddressOnConsumer: "consumervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayds0ea6", PrivValidatorKey: `{"address":"C888306A908A217B9A943D1DAD8790044D0947A4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"IHo4QEikWZfIKmM0X+N+BjKttz8HOzGs2npyjiba3Xk="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"z08bmSB91uFVpVmR3t2ewd/bDjZ/AzwQpe5rKjWiPG0gejhASKRZl8gqYzRf434GMq23Pwc7MazaenKOJtrdeQ=="}}`, NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"WLTcHEjbwB24Wp3z5oBSYTvtGQonz/7IQabOFw85BN0UkkyY5HDf38o8oHlFxVI26f+DFVeICuLbe9aXKGnUeg=="}}`, @@ -191,11 +191,11 @@ func getDefaultValidators() map[ValidatorID]ValidatorConfig { // consumer chain assigned key ConsumerMnemonic: "clip choose cake west range gun slam cry village receive juice galaxy lend ritual range provide ritual can since verify breeze vacant play dragon", ConsumerDelAddress: "consumer1sx6j9g2rh324a342a5f0rnx7me34r9nwduz5te", - ConsumerDelAddressOnProvider: "provider1sx6j9g2rh324a342a5f0rnx7me34r9nwl8m67c", + ConsumerDelAddressOnProvider: "cosmos1sx6j9g2rh324a342a5f0rnx7me34r9nwgf0mc7", ConsumerValoperAddress: "consumervaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwzypt9d", - ConsumerValoperAddressOnProvider: "providervaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwvz9a35", + ConsumerValoperAddressOnProvider: "cosmosvaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwdamw5d", ConsumerValconsAddress: "consumervalcons1kswr5sq599365kcjmhgufevfps9njf43kv9tuk", - ConsumerValconsAddressOnProvider: "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0", + ConsumerValconsAddressOnProvider: "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, ConsumerPrivValidatorKey: `{"address":"B41C3A40142963AA5B12DDD1C4E5890C0B3926B1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"3YaBAZLA+sl/E73lLfbFbG0u6DYm33ayr/0UpCt/vFBSLkZ/X6a1ZR0fy7fGWbN0ogP4Xc8rSx9dnvcZnqrqKw=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"rxBzFedtD3pqgfJQblbxGusKOr47oBfr8ba0Iz14gobtDRZQZlSZ/UGP4pSHkVf+4vtkrkO1vRHBYJobuiP+7A=="}}`, @@ -462,11 +462,11 @@ func ConsumerMisbehaviourTestConfig() TestConfig { validatorConfigs: map[ValidatorID]ValidatorConfig{ ValidatorID("alice"): { Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", - DelAddress: "provider19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddeeglea", + DelAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", DelAddressOnConsumer: "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", - ValoperAddress: "providervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7dd2ukck3", + ValoperAddress: "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", ValoperAddressOnConsumer: "consumervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddy6jwzg", - ValconsAddress: "providervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7x029tue", + ValconsAddress: "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", ValconsAddressOnConsumer: "consumervalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xpvpagq", PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, @@ -475,11 +475,11 @@ func ConsumerMisbehaviourTestConfig() TestConfig { // consumer chain assigned key ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", ConsumerDelAddress: "consumer1eeeggku6dzk3mv7wph3zq035rhtd890sh9rl32", - ConsumerDelAddressOnProvider: "provider1eeeggku6dzk3mv7wph3zq035rhtd890s9763yt", + ConsumerDelAddressOnProvider: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", ConsumerValoperAddress: "consumervaloper1eeeggku6dzk3mv7wph3zq035rhtd890scaqql7", - ConsumerValoperAddressOnProvider: "providervaloper1eeeggku6dzk3mv7wph3zq035rhtd890skmykt8", + ConsumerValoperAddressOnProvider: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", ConsumerValconsAddress: "consumervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfk9q5ce", - ConsumerValconsAddressOnProvider: "providervalcons1muys5jyqk4xd27e208nym85kn0t4zjcfcryzvq", + ConsumerValconsAddressOnProvider: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, @@ -487,11 +487,11 @@ func ConsumerMisbehaviourTestConfig() TestConfig { }, ValidatorID("bob"): { Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", - DelAddress: "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem", + DelAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", DelAddressOnConsumer: "consumer1dkas8mu4kyhl5jrh4nzvm65qz588hy9qahzgv6", - ValoperAddress: "providervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9quf9pkh", + ValoperAddress: "cosmosvaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qakmjnw", ValoperAddressOnConsumer: "consumervaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qj0phzw", - ValconsAddress: "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", + ValconsAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", ValconsAddressOnConsumer: "consumervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klhuqtq9", PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, @@ -500,11 +500,11 @@ func ConsumerMisbehaviourTestConfig() TestConfig { // consumer chain assigned key ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", ConsumerDelAddress: "consumer1q90l6j6lzzgt460ehjj56azknlt5yrd44y2uke", - ConsumerDelAddressOnProvider: "provider1q90l6j6lzzgt460ehjj56azknlt5yrd48lnjrc", + ConsumerDelAddressOnProvider: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", ConsumerValoperAddress: "consumervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd46ufrcd", - ConsumerValoperAddressOnProvider: "providervaloper1q90l6j6lzzgt460ehjj56azknlt5yrd456d4v5", + ConsumerValoperAddressOnProvider: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", ConsumerValconsAddress: "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", - ConsumerValconsAddressOnProvider: "providervalcons1uuec3cjxajv5te08p220usrjhkfhg9wydlduwz", + ConsumerValconsAddressOnProvider: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 41edbe5a1c..08b8c4a710 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -535,7 +535,7 @@ func (tr TestConfig) getValPower(chain ChainID, validator ValidatorID) uint { for _, val := range valset.Validators { if chain == ChainID("provi") { - // use binary with Bech32Prefix set to "provider" + // use binary with Bech32Prefix set to "cosmos" if val.Address != tr.validatorConfigs[validator].ValconsAddress { continue } diff --git a/tests/e2e/testnet-scripts/fork-consumer.sh b/tests/e2e/testnet-scripts/fork-consumer.sh index 6280ff031f..db8199d192 100644 --- a/tests/e2e/testnet-scripts/fork-consumer.sh +++ b/tests/e2e/testnet-scripts/fork-consumer.sh @@ -75,7 +75,7 @@ event_source = { mode = 'push', url = 'ws://$CONS_CHAIN_PREFIX.252:26658/websock [[chains]] id = "provi" -account_prefix = "provider" +account_prefix = "cosmos" clock_drift = "5s" gas_multiplier = 1.1 grpc_addr = "tcp://$PROV_CHAIN_PREFIX.4:9091" diff --git a/tests/e2e/tracehandler_testdata/consumer-double-sign.json b/tests/e2e/tracehandler_testdata/consumer-double-sign.json index bd35ba1183..e93049cf8b 100644 --- a/tests/e2e/tracehandler_testdata/consumer-double-sign.json +++ b/tests/e2e/tracehandler_testdata/consumer-double-sign.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/democracy.json b/tests/e2e/tracehandler_testdata/democracy.json index 197e9161b5..10c9838122 100644 --- a/tests/e2e/tracehandler_testdata/democracy.json +++ b/tests/e2e/tracehandler_testdata/democracy.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json index 5e746a8c14..7e6d90cace 100644 --- a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json +++ b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/happyPath.json b/tests/e2e/tracehandler_testdata/happyPath.json index 546fa11013..22f5369102 100644 --- a/tests/e2e/tracehandler_testdata/happyPath.json +++ b/tests/e2e/tracehandler_testdata/happyPath.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -472,11 +472,11 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "bob": "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "bob": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -527,11 +527,11 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "consumervalcons1uuec3cjxajv5te08p220usrjhkfhg9wyref26m", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "bob": "providervalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6kle6ya5u", - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "bob": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/multipleConsumers.json b/tests/e2e/tracehandler_testdata/multipleConsumers.json index 23546c3307..fdb69d1e47 100644 --- a/tests/e2e/tracehandler_testdata/multipleConsumers.json +++ b/tests/e2e/tracehandler_testdata/multipleConsumers.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -380,10 +380,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -425,10 +425,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/shorthappy.json b/tests/e2e/tracehandler_testdata/shorthappy.json index c53d29216c..607c1d6d7c 100644 --- a/tests/e2e/tracehandler_testdata/shorthappy.json +++ b/tests/e2e/tracehandler_testdata/shorthappy.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/tests/e2e/tracehandler_testdata/slashThrottle.json b/tests/e2e/tracehandler_testdata/slashThrottle.json index d9ec05da89..e99e7e2973 100644 --- a/tests/e2e/tracehandler_testdata/slashThrottle.json +++ b/tests/e2e/tracehandler_testdata/slashThrottle.json @@ -115,10 +115,10 @@ "Rewards": null, "ConsumerChains": null, "AssignedKeys": { - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, @@ -160,10 +160,10 @@ "ConsumerChains": null, "AssignedKeys": { "bob": "", - "carol": "providervalcons1kswr5sq599365kcjmhgufevfps9njf43c2pag0" + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" }, "ProviderKeys": { - "carol": "providervalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayrkt0fr" + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" }, "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, diff --git a/x/ccv/consumer/keeper/params_test.go b/x/ccv/consumer/keeper/params_test.go index dd9302873f..e2975a0b31 100644 --- a/x/ccv/consumer/keeper/params_test.go +++ b/x/ccv/consumer/keeper/params_test.go @@ -38,7 +38,7 @@ func TestParams(t *testing.T) { require.Equal(t, expParams, params) newParams := ccv.NewParams(false, 1000, - "channel-2", "provider19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddeeglea", + "channel-2", "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", 7*24*time.Hour, 25*time.Hour, "0.5", 500, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}, 2*time.Hour) consumerKeeper.SetParams(ctx, newParams) params = consumerKeeper.GetConsumerParams(ctx) @@ -52,10 +52,10 @@ func TestParams(t *testing.T) { gotChan := consumerKeeper.GetDistributionTransmissionChannel(ctx) require.Equal(t, gotChan, "channel-7") - consumerKeeper.SetProviderFeePoolAddrStr(ctx, "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem") + consumerKeeper.SetProviderFeePoolAddrStr(ctx, "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la") gotAddr := consumerKeeper. GetProviderFeePoolAddrStr(ctx) - require.Equal(t, gotAddr, "provider1dkas8mu4kyhl5jrh4nzvm65qz588hy9q0vmxem") + require.Equal(t, gotAddr, "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la") consumerKeeper.SetUnbondingPeriod(ctx, time.Hour*24*10) storedUnbondingPeriod := consumerKeeper.GetUnbondingPeriod(ctx) From 22f400632d40b1d2695c43e73316396fdd2cc674 Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 17 Jan 2024 12:32:14 +0100 Subject: [PATCH 10/27] add changelog entries --- .changelog/unreleased/bug-fixes/1570-slashack-bech32.md | 2 ++ .changelog/unreleased/state-breaking/1570-slashack-bech32.md | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/1570-slashack-bech32.md create mode 100644 .changelog/unreleased/state-breaking/1570-slashack-bech32.md diff --git a/.changelog/unreleased/bug-fixes/1570-slashack-bech32.md b/.changelog/unreleased/bug-fixes/1570-slashack-bech32.md new file mode 100644 index 0000000000..40845dcca6 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1570-slashack-bech32.md @@ -0,0 +1,2 @@ +- Fix the validation of VSCPackets to not fail due to to marshaling to string using Bech32. + ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file diff --git a/.changelog/unreleased/state-breaking/1570-slashack-bech32.md b/.changelog/unreleased/state-breaking/1570-slashack-bech32.md new file mode 100644 index 0000000000..40845dcca6 --- /dev/null +++ b/.changelog/unreleased/state-breaking/1570-slashack-bech32.md @@ -0,0 +1,2 @@ +- Fix the validation of VSCPackets to not fail due to to marshaling to string using Bech32. + ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file From 413c43bde16aa5f988e2d9df43be1373c004ff28 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 00:46:35 +0100 Subject: [PATCH 11/27] add consumer-double-downtime e2e test --- tests/e2e/main.go | 6 ++ tests/e2e/steps.go | 8 ++ tests/e2e/steps_downtime.go | 198 ++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+) diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 13e3fae1e7..624d372c7e 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -128,6 +128,12 @@ var stepChoices = map[string]StepChoice{ description: "consumer double signing tests", testConfig: DefaultTestConfig(), }, + "consumer-double-downtime": { + name: "consumer-double-downtime", + steps: consumerDoubleDowntimeSteps, + description: "jail a validator for two (different) downtime infractions on consumer", + testConfig: DefaultTestConfig(), + }, } func executeTests(tests []testStepsWithConfig) (err error) { diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index 783d976a3a..1626df0de2 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -114,3 +114,11 @@ var consumerDoubleSignSteps = concatSteps( // make a consumer validator double sign and get jailed stepsCauseDoubleSignOnConsumer("consu", "provi"), ) + +var consumerDoubleDowntimeSteps = concatSteps( + stepsStartChains([]string{"consu"}, false), + stepsDelegate("consu"), + stepsUnbond("consu"), + stepsRedelegateShort("consu"), + stepsDoubleDowntime("consu"), +) diff --git a/tests/e2e/steps_downtime.go b/tests/e2e/steps_downtime.go index f63d0a31c9..a8506bf518 100644 --- a/tests/e2e/steps_downtime.go +++ b/tests/e2e/steps_downtime.go @@ -211,6 +211,204 @@ func stepsDowntime(consumerName string) []Step { } } +// stepsDowstepsDoubleDowntime time tests that a validator can get jailed twice +// on a consumer. +// These are the steps: +// - a validator is down on a consumer +// - the validator gets jailed on the provider (when the SlashPacket is received) +// - the validator gets removed from the consumer (when the VSCPacket is received) +// - the validator gets unjailed on the provider +// - the validator is added to the consumer (when the VSCPacket is received) +// - the validator is down again on the consumer +// - the validator gets jailed on the provider (when the SlashPacket is received) +// - the validator gets removed from the consumer (when the VSCPacket is received) +func stepsDoubleDowntime(consumerName string) []Step { + return []Step{ + { + Action: DowntimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), + }, + State: State{ + // validator should be slashed on consumer, powers not affected on either chain yet + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // Downtime jailing and corresponding voting power change are processed by provider + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // Bob's stake may or may not be slashed at this point depending on comet vs cometmock + // See https://github.com/cosmos/interchain-security/issues/1304 + ValidatorID("carol"): 501, + }, + }, + }, + }, + // A block is incremented each action, hence why VSC is committed on provider, + // and can now be relayed as packet to consumer + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // VSC now seen on consumer + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, + }, + }, + }, + }, + { + Action: UnjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // bob's stake should not be slashed + // since the slash was initiated from consumer + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // bob's stake should not be slashed + // since the slash was initiated from consumer + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, + }, + }, + }, + }, + // Try to jail bob again on the consumer + { + Action: DowntimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), + }, + State: State{ + // validator should be slashed on consumer, powers not affected on either chain yet + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // Downtime jailing and corresponding voting power change are processed by provider + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // Bob's stake may or may not be slashed at this point depending on comet vs cometmock + // See https://github.com/cosmos/interchain-security/issues/1304 + ValidatorID("carol"): 501, + }, + }, + }, + }, + // A block is incremented each action, hence why VSC is committed on provider, + // and can now be relayed as packet to consumer + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + // VSC now seen on consumer + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, + }, + }, + }, + }, + } +} + // stepsDowntimeWithOptOut returns steps validating that alice can incur downtime // and not be slashed/jailed, since her voting power is less than 5% of the total. // From 47aac5508a213bd51909900621853880209261a8 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 00:47:05 +0100 Subject: [PATCH 12/27] update nightly-e2e workflow --- .github/workflows/manual-e2e.yml | 103 ------------------------------ .github/workflows/nightly-e2e.yml | 55 +++++++++++++++- 2 files changed, 52 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/manual-e2e.yml diff --git a/.github/workflows/manual-e2e.yml b/.github/workflows/manual-e2e.yml deleted file mode 100644 index f9ca0ca33d..0000000000 --- a/.github/workflows/manual-e2e.yml +++ /dev/null @@ -1,103 +0,0 @@ -# manually run full E2E test suite -# all tests are run sequentially -name: manual-e2e-main -on: - workflow_dispatch: - -jobs: - happy-path-test: - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - uses: actions/checkout@v4 - - name: Checkout LFS objects - run: git lfs checkout - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" # The Go version to download (if necessary) and use. - - name: E2E happy-path test - run: go run ./tests/e2e/... --tc happy-path - changeover-test: - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - uses: actions/checkout@v4 - - name: Checkout LFS objects - run: git lfs checkout - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" # The Go version to download (if necessary) and use. - - name: E2E changeover test - run: go run ./tests/e2e/... --tc changeover - democracy-reward-test: - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - uses: actions/checkout@v4 - - name: Checkout LFS objects - run: git lfs checkout - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" # The Go version to download (if necessary) and use. - - name: E2E democracy-reward tests - run: go run ./tests/e2e/... --tc democracy-reward - democracy-test: - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - uses: actions/checkout@v4 - - name: Checkout LFS objects - run: git lfs checkout - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" # The Go version to download (if necessary) and use. - - name: E2E democracy tests - run: go run ./tests/e2e/... --tc democracy - slash-throttle-test: - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - uses: actions/checkout@v4 - - name: Checkout LFS objects - run: git lfs checkout - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" # The Go version to download (if necessary) and use. - - name: E2E slash-throttle tests - run: go run ./tests/e2e/... --tc slash-throttle - multiconsumer-test: - runs-on: ubuntu-latest - timeout-minutes: 40 - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - uses: actions/checkout@v4 - - name: Checkout LFS objects - run: git lfs checkout - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" # The Go version to download (if necessary) and use. - - name: E2E multi-consumer tests - run: go run ./tests/e2e/... --tc multiconsumer diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index 2e6e60d042..043f19fc1a 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -1,9 +1,7 @@ # Run integration tests nightly on main - -# !! Relevant changes to this file should be propagated manual-integration.yml - name: nightly-e2e-main on: + workflow_dispatch: schedule: # run every day at 03:00 UTC # ┌───────────── minute (0 - 59) @@ -114,6 +112,54 @@ jobs: go-version: "1.21" # The Go version to download (if necessary) and use. - name: E2E multi-consumer tests run: go run ./tests/e2e/... --tc multiconsumer + consumer-misbehaviour-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.21" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" # The Go version to download (if necessary) and use. + - name: E2E consumer-misbehaviour tests + run: go run ./tests/e2e/... --tc consumer-misbehaviour + consumer-double-sign-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.21" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" # The Go version to download (if necessary) and use. + - name: E2E consumer-double-sign tests + run: go run ./tests/e2e/... --tc consumer-double-sign + consumer-double-downtime-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.21" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" # The Go version to download (if necessary) and use. + - name: E2E consumer-double-downtime tests + run: go run ./tests/e2e/... --tc consumer-double-downtime nightly-test-fail: needs: @@ -123,6 +169,9 @@ jobs: - democracy-test - slash-throttle-test - multiconsumer-test + - consumer-misbehaviour-test + - consumer-double-sign-test + - consumer-double-downtime-test if: ${{ failure() }} runs-on: ubuntu-latest steps: From e78593d8b9a2a071fd6dae79d91eeb035796c21e Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 00:49:43 +0100 Subject: [PATCH 13/27] fix typo --- .changelog/unreleased/bug-fixes/1570-slashack-bech32.md | 2 +- .changelog/unreleased/state-breaking/1570-slashack-bech32.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.changelog/unreleased/bug-fixes/1570-slashack-bech32.md b/.changelog/unreleased/bug-fixes/1570-slashack-bech32.md index 40845dcca6..a0e9fe9262 100644 --- a/.changelog/unreleased/bug-fixes/1570-slashack-bech32.md +++ b/.changelog/unreleased/bug-fixes/1570-slashack-bech32.md @@ -1,2 +1,2 @@ -- Fix the validation of VSCPackets to not fail due to to marshaling to string using Bech32. +- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file diff --git a/.changelog/unreleased/state-breaking/1570-slashack-bech32.md b/.changelog/unreleased/state-breaking/1570-slashack-bech32.md index 40845dcca6..a0e9fe9262 100644 --- a/.changelog/unreleased/state-breaking/1570-slashack-bech32.md +++ b/.changelog/unreleased/state-breaking/1570-slashack-bech32.md @@ -1,2 +1,2 @@ -- Fix the validation of VSCPackets to not fail due to to marshaling to string using Bech32. +- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file From e5bd41d2b8f517881ab56066f5d2ced9dfec2efc Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 11:37:24 +0100 Subject: [PATCH 14/27] add consumer-double-downtime to testConfigs --- tests/e2e/main.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 624d372c7e..5f3ea71e74 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -54,14 +54,15 @@ var ( // map the test config names to their structs to allow for easy selection of test configs, // and also to programmatically set parameters, i.e. see DemocracyTestConfig testConfigs = map[string]TestConfig{ - "default": DefaultTestConfig(), - "changeover": ChangeoverTestConfig(), - "democracy": DemocracyTestConfig(false), - "democracy-reward": DemocracyTestConfig(true), - "slash-throttle": SlashThrottleTestConfig(), - "multiconsumer": MultiConsumerTestConfig(), - "consumer-misbehaviour": ConsumerMisbehaviourTestConfig(), - "consumer-double-sign": DefaultTestConfig(), + "default": DefaultTestConfig(), + "changeover": ChangeoverTestConfig(), + "democracy": DemocracyTestConfig(false), + "democracy-reward": DemocracyTestConfig(true), + "slash-throttle": SlashThrottleTestConfig(), + "multiconsumer": MultiConsumerTestConfig(), + "consumer-misbehaviour": ConsumerMisbehaviourTestConfig(), + "consumer-double-sign": DefaultTestConfig(), + "consumer-double-downtime": DefaultTestConfig(), } ) @@ -238,6 +239,7 @@ func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet) (tests []t "changeover", "happy-path", "democracy-reward", "democracy", "slash-throttle", "consumer-double-sign", "consumer-misbehaviour", + "consumer-double-downtime", } if includeMultiConsumer != nil && *includeMultiConsumer { selectedPredefinedTests = append(selectedPredefinedTests, "multiconsumer") From fb9b336457ca54f1133b26de56867ae26e3f4dce Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 12:17:36 +0100 Subject: [PATCH 15/27] remove changes on provider --- x/ccv/consumer/keeper/relay.go | 14 ++++-- x/ccv/consumer/keeper/relay_test.go | 4 +- x/ccv/provider/keeper/relay.go | 5 +- x/ccv/provider/keeper/relay_test.go | 5 +- x/ccv/types/utils.go | 17 +++++++ x/ccv/types/wire.go | 7 --- x/ccv/types/wire_test.go | 74 ++++------------------------- 7 files changed, 44 insertions(+), 82 deletions(-) diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index 3a58f1e0a2..b726dc37bb 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -83,9 +83,17 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new // remove outstanding slashing flags of the validators // for which the slashing was acknowledged by the provider chain for _, ack := range newChanges.GetSlashAcks() { - // note that the error was already checked when the packet data was validated - addr, _ := sdk.ConsAddressFromHex(ack) - k.DeleteOutstandingDowntime(ctx, addr) + // get consensus address from bech32 address + consAddr, err := ccv.GetConsAddrFromBech32(ack) + if err != nil { + // Do not return an error as it would lead to the consumer being + // removed by the provider + k.Logger(ctx).Error("invalid consensus address in VSCPacket.SlashAcks", + "vscID", newChanges.ValsetUpdateId, + "SlashAck", ack, + "error", err) + } + k.DeleteOutstandingDowntime(ctx, consAddr) } k.Logger(ctx).Info("finished receiving/handling VSCPacket", diff --git a/x/ccv/consumer/keeper/relay_test.go b/x/ccv/consumer/keeper/relay_test.go index 7c30c3e4f0..46a805a85a 100644 --- a/x/ccv/consumer/keeper/relay_test.go +++ b/x/ccv/consumer/keeper/relay_test.go @@ -123,8 +123,8 @@ func TestOnRecvVSCPacket(t *testing.T) { }}, }, { - "failure on packet with invalid slash acks", - true, + "success on packet with invalid slash acks", + false, channeltypes.NewPacket(pd3.GetBytes(), 4, types.ProviderPortID, providerCCVChannelID, types.ConsumerPortID, consumerCCVChannelID, clienttypes.NewHeight(1, 0), 0), types.ValidatorSetChangePacketData{ValidatorUpdates: []abci.ValidatorUpdate{ diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 1e585b94c0..2c00d40441 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -1,7 +1,6 @@ package keeper import ( - "encoding/hex" "fmt" "strconv" @@ -422,8 +421,8 @@ 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 - // Note: do not use consumerConsAddr.String() as it converts it to Bech32 - k.AppendSlashAck(ctx, chainID, hex.EncodeToString(consumerConsAddr.Address)) + // TODO: consumer cons address should be accepted here + k.AppendSlashAck(ctx, chainID, consumerConsAddr.String()) // jail validator if !validator.IsJailed() { diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index f76d9da08c..02df262d53 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "encoding/hex" "strings" "testing" @@ -434,8 +433,8 @@ func TestHandleSlashPacket(t *testing.T) { if tc.expectedSlashAcksLen == 1 { // must match the consumer address - require.Equal(t, hex.EncodeToString(consumerConsAddr.Address), providerKeeper.GetSlashAcks(ctx, chainId)[0]) - require.NotEqual(t, hex.EncodeToString(providerConsAddr.Address), providerKeeper.GetSlashAcks(ctx, chainId)[0]) + require.Equal(t, consumerConsAddr.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) + require.NotEqual(t, providerConsAddr.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) require.NotEqual(t, providerConsAddr.String(), consumerConsAddr.String()) } diff --git a/x/ccv/types/utils.go b/x/ccv/types/utils.go index f6e7ffc3aa..ae85240256 100644 --- a/x/ccv/types/utils.go +++ b/x/ccv/types/utils.go @@ -1,8 +1,10 @@ package types import ( + "errors" "reflect" "sort" + "strings" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -13,6 +15,7 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" abci "github.com/cometbft/cometbft/abci/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" @@ -106,3 +109,17 @@ func PanicIfZeroOrNil(x interface{}, nameForPanicMsg string) { panic("zero or nil value for " + nameForPanicMsg) } } + +// GetConsAddrFromBech32 returns a ConsAddress from a Bech32 with an arbitrary prefix +func GetConsAddrFromBech32(bech32str string) (sdk.ConsAddress, error) { + bech32Addr := strings.TrimSpace(bech32str) + if len(bech32Addr) == 0 { + return nil, errors.New("couldn't parse empty input") + } + // remove bech32 prefix + _, addr, err := bech32.DecodeAndConvert(bech32Addr) + if err != nil { + return nil, errors.New("couldn't find valid bech32") + } + return sdk.ConsAddress(addr), nil +} diff --git a/x/ccv/types/wire.go b/x/ccv/types/wire.go index a5c995f37c..9c22522b74 100644 --- a/x/ccv/types/wire.go +++ b/x/ccv/types/wire.go @@ -30,13 +30,6 @@ func (vsc ValidatorSetChangePacketData) Validate() error { if vsc.ValsetUpdateId == 0 { return errorsmod.Wrap(ErrInvalidPacketData, "valset update id cannot be equal to zero") } - // Validate the slash acks - must be consensus addresses - for _, ack := range vsc.SlashAcks { - _, err := sdk.ConsAddressFromHex(ack) - if err != nil { - return err - } - } return nil } diff --git a/x/ccv/types/wire_test.go b/x/ccv/types/wire_test.go index b9ee5e9008..ab6692912e 100644 --- a/x/ccv/types/wire_test.go +++ b/x/ccv/types/wire_test.go @@ -1,7 +1,6 @@ package types_test import ( - "encoding/hex" "strings" "testing" @@ -18,93 +17,40 @@ import ( ) func TestPacketDataValidateBasic(t *testing.T) { - pk1, err := cryptocodec.ToTmProtoPublicKey(ed25519.GenPrivKey().PubKey()) - require.NoError(t, err) - pk2, err := cryptocodec.ToTmProtoPublicKey(ed25519.GenPrivKey().PubKey()) + pk, err := cryptocodec.ToTmProtoPublicKey(ed25519.GenPrivKey().PubKey()) require.NoError(t, err) - cId := crypto.NewCryptoIdentityFromIntSeed(4732894342) - validSlashAck := hex.EncodeToString(cId.ConsumerConsAddress().Address) - invalidSlashAck := "invalidAddress" - cases := []struct { name string expError bool packetData types.ValidatorSetChangePacketData }{ { - "invalid: nil packet data", + "invalid: zero ValsetUpdateId", true, - types.NewValidatorSetChangePacketData(nil, 1, nil), + types.NewValidatorSetChangePacketData([]abci.ValidatorUpdate{}, 0, nil), }, { - "valid: empty packet data", - false, - types.NewValidatorSetChangePacketData([]abci.ValidatorUpdate{}, 2, nil), - }, - { - "invalid: slash ack not consensus address", + "invalid: nil ValidatorUpdates", true, - types.NewValidatorSetChangePacketData( - []abci.ValidatorUpdate{ - { - PubKey: pk1, - Power: 30, - }, - }, - 3, - []string{ - "some_string", - }, - ), + types.NewValidatorSetChangePacketData(nil, 1, nil), }, { - "valid: packet data with valid slash ack", + "valid: empty ValidatorUpdates", false, - types.NewValidatorSetChangePacketData( - []abci.ValidatorUpdate{ - { - PubKey: pk2, - Power: 20, - }, - }, - 4, - []string{ - validSlashAck, - }, - ), - }, - { - "invalid: slash ack is not an hex address", - true, - types.NewValidatorSetChangePacketData( - []abci.ValidatorUpdate{ - { - PubKey: pk2, - Power: 20, - }, - }, - 5, - []string{ - invalidSlashAck, - }, - ), + types.NewValidatorSetChangePacketData([]abci.ValidatorUpdate{}, 2, nil), }, { - "valid: packet data with nil slash ack", + "valid: one validator update", false, types.NewValidatorSetChangePacketData( []abci.ValidatorUpdate{ { - PubKey: pk1, + PubKey: pk, Power: 30, }, - { - PubKey: pk2, - Power: 20, - }, }, - 6, + 3, nil, ), }, From 2094cf476a9b1dec45c482f060bd2095147c0a5e Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 12:22:05 +0100 Subject: [PATCH 16/27] skip invalid SlashAcks --- x/ccv/consumer/keeper/relay.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index b726dc37bb..2d4e16510a 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -92,6 +92,7 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new "vscID", newChanges.ValsetUpdateId, "SlashAck", ack, "error", err) + continue } k.DeleteOutstandingDowntime(ctx, consAddr) } From 4979dfc063e9f85af2080b88de7b7a39164777f6 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 17:36:37 +0100 Subject: [PATCH 17/27] seal the config --- app/params/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/params/config.go b/app/params/config.go index e994a735ec..c4e3cb7e3c 100644 --- a/app/params/config.go +++ b/app/params/config.go @@ -25,4 +25,6 @@ func SetAddressPrefixes(bech32Prefix string) { cfg.SetBech32PrefixForAccount(bech32PrefixAccAddr, bech32PrefixAccPub) cfg.SetBech32PrefixForValidator(bech32PrefixValAddr, bech32PrefixValPub) cfg.SetBech32PrefixForConsensusNode(bech32PrefixConsAddr, bech32PrefixConsPub) + + cfg.Seal() } From 905d6662efe52ae9b5a9a4e81e09a427ad7360aa Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 17:37:16 +0100 Subject: [PATCH 18/27] clear the outstanding downtime flag for new vals --- x/ccv/consumer/keeper/validators.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/ccv/consumer/keeper/validators.go b/x/ccv/consumer/keeper/validators.go index 31e803bad4..24a1c5a57c 100644 --- a/x/ccv/consumer/keeper/validators.go +++ b/x/ccv/consumer/keeper/validators.go @@ -59,6 +59,10 @@ func (k Keeper) ApplyCCValidatorChanges(ctx sdk.Context, changes []abci.Validato // AfterValidatorBonded is called by the Slashing module and should not return an error. panic(err) } + // Sanity check: making sure the outstanding downtime flag is not + // set for this new validator. This is especially useful to deal with + // https://github.com/cosmos/interchain-security/issues/1569. + k.DeleteOutstandingDowntime(ctx, consAddr) } else { // edge case: we received an update for 0 power // but the validator is already deleted. Do not forward From 4626b78831a0ac670d839418a522f15c36a7598f Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 18 Jan 2024 17:37:47 +0100 Subject: [PATCH 19/27] add info on upgrading to v4.0.0 --- UPGRADING.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/UPGRADING.md b/UPGRADING.md index cc7de42395..374b60f107 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -12,9 +12,45 @@ Upgrading a provider from `v3.3.0` to `v4.0.0` will require state migrations, se ### Consumer +***Note that consumer chains can upgrade directly from `v3.1.0` to `v4.0.0`.*** + Upgrading a consumer from `v3.2.0` to `v4.0.0` will not require state migration, however, upgrading directly from `v3.1.0` to `v4.0.0` will require state migrations, see https://github.com/cosmos/interchain-security/blob/release/v4.0.x/x/ccv/consumer/keeper/migrations.go#L22. -Note that consumer chains can upgrade directly from `v3.1.0` to `v4.0.0`. +In addition, the following migration needs to be added to the upgrade handler of the consumer chain: +```golang +func migrateICSOutstandingDowntime(ctx sdk.Context, keepers *upgrades.UpgradeKeepers) error { + ctx.Logger().Info("Migrating ICS oustanding downtime...") + + downtimes := keepers.ConsumerKeeper.GetAllOutstandingDowntimes(ctx) + for _, od := range downtimes { + consAddr, err := sdk.ConsAddressFromBech32(od.ValidatorConsensusAddress) + if err != nil { + return err + } + // Remove outstanding downtime flags for validators that have the + // signingInfo.JailedUntil zero (the initial value when a new signing + // info is created). + // The reasoning is that when a validator gets jailed on the consumer, + // signingInfo.JailedUntil is updated and the outstanding downtime flag + // is set. This flag is usually cleared when the consumer receives a + // VSCPacket with the validator's consensus address in the list of + // SlashAcks. Due to a bug, this mechanism was not working in versions + // Date: Fri, 19 Jan 2024 09:27:38 +0100 Subject: [PATCH 20/27] fix upgrade handler --- UPGRADING.md | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 374b60f107..851f31fe78 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -27,21 +27,7 @@ func migrateICSOutstandingDowntime(ctx sdk.Context, keepers *upgrades.UpgradeKee if err != nil { return err } - // Remove outstanding downtime flags for validators that have the - // signingInfo.JailedUntil zero (the initial value when a new signing - // info is created). - // The reasoning is that when a validator gets jailed on the consumer, - // signingInfo.JailedUntil is updated and the outstanding downtime flag - // is set. This flag is usually cleared when the consumer receives a - // VSCPacket with the validator's consensus address in the list of - // SlashAcks. Due to a bug, this mechanism was not working in versions - // Date: Fri, 19 Jan 2024 09:46:36 +0100 Subject: [PATCH 21/27] fix changeover e2e test --- tests/e2e/testnet-scripts/sovereign-genesis.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/testnet-scripts/sovereign-genesis.json b/tests/e2e/testnet-scripts/sovereign-genesis.json index af7f1e30b3..ba95b2fbce 100644 --- a/tests/e2e/testnet-scripts/sovereign-genesis.json +++ b/tests/e2e/testnet-scripts/sovereign-genesis.json @@ -166,7 +166,7 @@ "tip": null }, "signatures": [ - "c7aD9dWzb85fn+Aq0ijMdhyJNJSOsOcFLvJt8ctvdxAAbwdrzKPVFbq9IYf1qCwKmfmQUrlFy40qiuQeXaZ8pg==" + "AZROMEeaBL9cDOWQJYYdAG3KDl+w37SK0XP88ecS+WwQQLj8rXuEKNDl1PXpZR0AFIJ8coSwhFEtbpV44j6uVQ==" ] } ] From 4c9588c327edb735e6c73eccfdbd822190a2b3e0 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Fri, 19 Jan 2024 11:41:27 +0100 Subject: [PATCH 22/27] Update tests/e2e/config.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> --- tests/e2e/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 88f5c03de3..9118e928af 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -59,7 +59,7 @@ type ValidatorConfig struct { // with Bech32Prefix = "cosmos" ConsumerValoperAddressOnProvider string // Validator consensus address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "consumer". It matches the PrivValidatorKey bellow. + // with Bech32Prefix = "consumer". It matches the PrivValidatorKey below. ConsumerValconsAddress string // Validator consensus address on consumer marshaled to string using Bech32 // with Bech32Prefix = "cosmos". From 1c0006350832a8e9d26df9cf85865a4db4abfd03 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Fri, 19 Jan 2024 11:41:38 +0100 Subject: [PATCH 23/27] Update tests/e2e/config.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> --- tests/e2e/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 9118e928af..ff2f58f590 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -30,7 +30,7 @@ type ValidatorConfig struct { // with Bech32Prefix = "consumer" ValoperAddressOnConsumer string // Validator consensus address on provider marshaled to string using Bech32 - // with Bech32Prefix = "cosmos". It matches the PrivValidatorKey bellow. + // with Bech32Prefix = "cosmos". It matches the PrivValidatorKey below. ValconsAddress string // Validator consensus address on provider marshaled to string using Bech32 // with Bech32Prefix = "consumer". From 7a8a5d55cc9f09df83c0e34a2ca0ba1a899b52af Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 19 Jan 2024 11:56:06 +0100 Subject: [PATCH 24/27] add AccountPrefix to ChainConfig --- tests/e2e/actions.go | 18 ++---------------- tests/e2e/config.go | 45 +++++++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 58e41dfa14..7eb64ac855 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -737,17 +737,10 @@ func (tr TestConfig) addChainToGorelayer( ChainId := tr.chainConfigs[action.Chain].ChainId rpcAddr := "http://" + queryNodeIP + ":26658" - var accountPrefix string - if ChainId == ChainID("provi") { - accountPrefix = "cosmos" - } else { - accountPrefix = "consumer" - } - chainConfig := fmt.Sprintf(gorelayerChainConfigTemplate, ChainId, rpcAddr, - accountPrefix, + tr.chainConfigs[action.Chain].AccountPrefix, ) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. @@ -786,15 +779,8 @@ func (tr TestConfig) addChainToHermes( grpcAddr := "tcp://" + queryNodeIP + ":9091" wsAddr := "ws://" + queryNodeIP + ":26658/websocket" - var accountPrefix string - if ChainId == ChainID("provi") { - accountPrefix = "cosmos" - } else { - accountPrefix = "consumer" - } - chainConfig := fmt.Sprintf(hermesChainConfigTemplate, - accountPrefix, + tr.chainConfigs[action.Chain].AccountPrefix, grpcAddr, ChainId, keyName, diff --git a/tests/e2e/config.go b/tests/e2e/config.go index ff2f58f590..1ae52b8c50 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -6,6 +6,11 @@ import ( "time" ) +var ( + ProviderAccountPrefix = "cosmos" + ConsumerAccountPrefix = "consumer" +) + // TODO: Determine if user defined type (wrapping a primitive string) is desired in long run type ( ChainID string @@ -18,22 +23,22 @@ type ValidatorConfig struct { // Seed phrase to generate a secp256k1 key used by the validator on the provider Mnemonic string // Validator account address on provider marshaled to string using Bech32 - // with Bech32Prefix = "cosmos" + // with Bech32Prefix = ProviderAccountPrefix DelAddress string // Validator account address on provider marshaled to string using Bech32 - // with Bech32Prefix = "consumer" + // with Bech32Prefix = ConsumerAccountPrefix DelAddressOnConsumer string // Validator operator address on provider marshaled to string using Bech32 - // with Bech32Prefix = "cosmos" + // with Bech32Prefix = ProviderAccountPrefix ValoperAddress string // Validator operator address on provider marshaled to string using Bech32 - // with Bech32Prefix = "consumer" + // with Bech32Prefix = ConsumerAccountPrefix ValoperAddressOnConsumer string // Validator consensus address on provider marshaled to string using Bech32 - // with Bech32Prefix = "cosmos". It matches the PrivValidatorKey below. + // with Bech32Prefix = ProviderAccountPrefix. It matches the PrivValidatorKey below. ValconsAddress string // Validator consensus address on provider marshaled to string using Bech32 - // with Bech32Prefix = "consumer". + // with Bech32Prefix = ConsumerAccountPrefix. ValconsAddressOnConsumer string // Key used for consensus on provider PrivValidatorKey string @@ -47,22 +52,22 @@ type ValidatorConfig struct { // Seed phrase to generate a secp256k1 key used by the validator on the consumer ConsumerMnemonic string // Validator account address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "consumer" - ConsumerDelAddress string // Consumer delegator address - Bech32Prefix = "consumer" + // with Bech32Prefix = ConsumerAccountPrefix + ConsumerDelAddress string // Validator account address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "cosmos" + // with Bech32Prefix = ProviderAccountPrefix ConsumerDelAddressOnProvider string // Validator operator address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "consumer" + // with Bech32Prefix = ConsumerAccountPrefix ConsumerValoperAddress string // Validator operator address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "cosmos" + // with Bech32Prefix = ProviderAccountPrefix ConsumerValoperAddressOnProvider string // Validator consensus address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "consumer". It matches the PrivValidatorKey below. + // with Bech32Prefix = ConsumerAccountPrefix. It matches the PrivValidatorKey below. ConsumerValconsAddress string // Validator consensus address on consumer marshaled to string using Bech32 - // with Bech32Prefix = "cosmos". + // with Bech32Prefix = ProviderAccountPrefix. ConsumerValconsAddressOnProvider string ConsumerValPubKey string // Key used for consensus on consumer @@ -75,6 +80,8 @@ type ValidatorConfig struct { // the set of strings defined above to a set of viable chains type ChainConfig struct { ChainId ChainID + // The account prefix configured on the chain. For example, on the Hub, this is "cosmos" + AccountPrefix string // Must be unique per chain IpPrefix string VotingWaitTime uint @@ -217,6 +224,7 @@ func SlashThrottleTestConfig() TestConfig { chainConfigs: map[ChainID]ChainConfig{ ChainID("provi"): { ChainId: ChainID("provi"), + AccountPrefix: ProviderAccountPrefix, BinaryName: "interchain-security-pd", IpPrefix: "7.7.7", VotingWaitTime: 20, @@ -232,6 +240,7 @@ func SlashThrottleTestConfig() TestConfig { }, ChainID("consu"): { ChainId: ChainID("consu"), + AccountPrefix: ConsumerAccountPrefix, BinaryName: "interchain-security-cd", IpPrefix: "7.7.8", VotingWaitTime: 20, @@ -263,6 +272,7 @@ func DefaultTestConfig() TestConfig { chainConfigs: map[ChainID]ChainConfig{ ChainID("provi"): { ChainId: ChainID("provi"), + AccountPrefix: ProviderAccountPrefix, BinaryName: "interchain-security-pd", IpPrefix: "7.7.7", VotingWaitTime: 20, @@ -278,6 +288,7 @@ func DefaultTestConfig() TestConfig { }, ChainID("consu"): { ChainId: ChainID("consu"), + AccountPrefix: ConsumerAccountPrefix, BinaryName: "interchain-security-cd", IpPrefix: "7.7.8", VotingWaitTime: 20, @@ -321,6 +332,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { chainConfigs: map[ChainID]ChainConfig{ ChainID("provi"): { ChainId: ChainID("provi"), + AccountPrefix: ProviderAccountPrefix, BinaryName: "interchain-security-pd", IpPrefix: "7.7.7", VotingWaitTime: 20, @@ -335,6 +347,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { }, ChainID("democ"): { ChainId: ChainID("democ"), + AccountPrefix: ConsumerAccountPrefix, BinaryName: "interchain-security-cdd", IpPrefix: "7.7.9", VotingWaitTime: 20, @@ -361,6 +374,7 @@ func MultiConsumerTestConfig() TestConfig { chainConfigs: map[ChainID]ChainConfig{ ChainID("provi"): { ChainId: ChainID("provi"), + AccountPrefix: ProviderAccountPrefix, BinaryName: "interchain-security-pd", IpPrefix: "7.7.7", VotingWaitTime: 20, @@ -375,6 +389,7 @@ func MultiConsumerTestConfig() TestConfig { }, ChainID("consu"): { ChainId: ChainID("consu"), + AccountPrefix: ConsumerAccountPrefix, BinaryName: "interchain-security-cd", IpPrefix: "7.7.8", VotingWaitTime: 20, @@ -386,6 +401,7 @@ func MultiConsumerTestConfig() TestConfig { }, ChainID("densu"): { ChainId: ChainID("densu"), + AccountPrefix: ConsumerAccountPrefix, BinaryName: "interchain-security-cd", IpPrefix: "7.7.9", VotingWaitTime: 20, @@ -416,6 +432,7 @@ func ChangeoverTestConfig() TestConfig { chainConfigs: map[ChainID]ChainConfig{ ChainID("provi"): { ChainId: ChainID("provi"), + AccountPrefix: ProviderAccountPrefix, BinaryName: "interchain-security-pd", IpPrefix: "7.7.7", VotingWaitTime: 20, @@ -431,6 +448,7 @@ func ChangeoverTestConfig() TestConfig { }, ChainID("sover"): { ChainId: ChainID("sover"), + AccountPrefix: ConsumerAccountPrefix, BinaryName: "interchain-security-sd", UpgradeBinary: "interchain-security-cdd", IpPrefix: "7.7.8", @@ -514,6 +532,7 @@ func ConsumerMisbehaviourTestConfig() TestConfig { chainConfigs: map[ChainID]ChainConfig{ ChainID("provi"): { ChainId: ChainID("provi"), + AccountPrefix: ProviderAccountPrefix, BinaryName: "interchain-security-pd", IpPrefix: "7.7.7", VotingWaitTime: 20, From db8feb1127b5e4ee15f28c1d935c419f7b8bd279 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 19 Jan 2024 12:19:30 +0100 Subject: [PATCH 25/27] fix docstrings --- tests/e2e/actions.go | 10 +++++----- tests/e2e/state.go | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 7eb64ac855..84c3020b91 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -38,7 +38,7 @@ func (tr TestConfig) sendTokens( fromAddress := fromValCfg.DelAddress toAddress := toValCfg.DelAddress if action.Chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if fromValCfg.UseConsumerKey { fromAddress = fromValCfg.ConsumerDelAddress } else { @@ -1335,7 +1335,7 @@ func (tr TestConfig) delegateTokens( toValCfg := tr.validatorConfigs[action.To] validatorAddress := toValCfg.ValoperAddress if action.Chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if toValCfg.UseConsumerKey { validatorAddress = toValCfg.ConsumerValoperAddress } else { @@ -1386,7 +1386,7 @@ func (tr TestConfig) unbondTokens( unbondFromValCfg := tr.validatorConfigs[action.UnbondFrom] validatorAddress := unbondFromValCfg.ValoperAddress if action.Chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if unbondFromValCfg.UseConsumerKey { validatorAddress = unbondFromValCfg.ConsumerValoperAddress } else { @@ -1440,7 +1440,7 @@ func (tr TestConfig) cancelUnbondTokens( validatorAddress := valCfg.ValoperAddress delegatorAddress := delCfg.DelAddress if action.Chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if valCfg.UseConsumerKey { validatorAddress = valCfg.ConsumerValoperAddress } else { @@ -1521,7 +1521,7 @@ func (tr TestConfig) redelegateTokens(action RedelegateTokensAction, verbose boo redelegateSrc := srcCfg.ValoperAddress redelegateDst := dstCfg.ValoperAddress if action.Chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if srcCfg.UseConsumerKey { redelegateSrc = srcCfg.ConsumerValoperAddress } else { diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 08b8c4a710..0b2c2d1835 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -319,7 +319,7 @@ func (tr TestConfig) getReward(chain ChainID, validator ValidatorID, blockHeight valCfg := tr.validatorConfigs[validator] delAddresss := valCfg.DelAddress if chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if valCfg.UseConsumerKey { delAddresss = valCfg.ConsumerDelAddress } else { @@ -355,7 +355,7 @@ func (tr TestConfig) getBalance(chain ChainID, validator ValidatorID) uint { valCfg := tr.validatorConfigs[validator] valDelAddress := valCfg.DelAddress if chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if valCfg.UseConsumerKey { valDelAddress = valCfg.ConsumerDelAddress } else { @@ -535,12 +535,12 @@ func (tr TestConfig) getValPower(chain ChainID, validator ValidatorID) uint { for _, val := range valset.Validators { if chain == ChainID("provi") { - // use binary with Bech32Prefix set to "cosmos" + // use binary with Bech32Prefix set to ProviderAccountPrefix if val.Address != tr.validatorConfigs[validator].ValconsAddress { continue } } else { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if val.Address != tr.validatorConfigs[validator].ValconsAddressOnConsumer && val.Address != tr.validatorConfigs[validator].ConsumerValconsAddress { continue @@ -562,7 +562,7 @@ func (tr TestConfig) getValPower(chain ChainID, validator ValidatorID) uint { func (tr TestConfig) getValStakedTokens(chain ChainID, validator ValidatorID) uint { valoperAddress := tr.validatorConfigs[validator].ValoperAddress if chain != ChainID("provi") { - // use binary with Bech32Prefix set to "consumer" + // use binary with Bech32Prefix set to ConsumerAccountPrefix if tr.validatorConfigs[validator].UseConsumerKey { valoperAddress = tr.validatorConfigs[validator].ConsumerValoperAddress } else { From fc86224a0089f973c8e067513353bb277ab2df56 Mon Sep 17 00:00:00 2001 From: mpoke Date: Fri, 19 Jan 2024 12:20:35 +0100 Subject: [PATCH 26/27] update AccountAddressPrefix in app.go --- app/consumer-democracy/app.go | 2 +- app/consumer/app.go | 2 +- app/sovereign/app.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index ce140516a3..e90d35760e 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -116,7 +116,7 @@ import ( const ( AppName = "interchain-security-cd" upgradeName = "sovereign-changeover" // arbitrary name, define your own appropriately named upgrade - AccountAddressPrefix = "cosmos" + AccountAddressPrefix = "consumer" ) var ( diff --git a/app/consumer/app.go b/app/consumer/app.go index 2a96ff0e07..9853145117 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -97,7 +97,7 @@ import ( const ( AppName = "interchain-security-c" upgradeName = "ics-v1-to-v2" - AccountAddressPrefix = "cosmos" + AccountAddressPrefix = "consumer" ) var ( diff --git a/app/sovereign/app.go b/app/sovereign/app.go index a61dac5cc9..4017ca9d4f 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -113,7 +113,7 @@ import ( const ( AppName = "interchain-security-s" upgradeName = "v07-Theta" // arbitrary name, define your own appropriately named upgrade - AccountAddressPrefix = "cosmos" + AccountAddressPrefix = "consumer" ) var ( From 03e740ce0e62ff17185a7d5561946429eea32e5b Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Fri, 19 Jan 2024 16:55:27 +0100 Subject: [PATCH 27/27] fix consumer-misb e2e test --- tests/e2e/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 1ae52b8c50..c2079af0c3 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -548,6 +548,7 @@ func ConsumerMisbehaviourTestConfig() TestConfig { }, ChainID("consu"): { ChainId: ChainID("consu"), + AccountPrefix: ConsumerAccountPrefix, BinaryName: "interchain-security-cd", IpPrefix: "7.7.8", VotingWaitTime: 20,