diff --git a/CHANGELOG.md b/CHANGELOG.md index 117306c22c6a..90bebf64c64e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,24 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## Unreleased + + +## [v0.42.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.7) - 2021-07-09 + +### Improvements + +* (baseapp) [\#9578](https://github.com/cosmos/cosmos-sdk/pull/9578) Return `Baseapp`'s `trace` value for logging error stack traces. +* (cli) [\#9593](https://github.com/cosmos/cosmos-sdk/pull/9593) Check if chain-id is blank before verifying signatures in multisign and error. + +### Bug Fixes + +* (x/ibc) [\#9640](https://github.com/cosmos/cosmos-sdk/pull/9640) Fix IBC Transfer Ack Success event as it was initially emitting opposite value. +* [\#9645](https://github.com/cosmos/cosmos-sdk/pull/9645) Use correct Prometheus format for metric labels. +* [\#9299](https://github.com/cosmos/cosmos-sdk/pull/9299) Fix `[appd] keys parse cosmos1...` freezing. +* (keyring) [\#9563](https://github.com/cosmos/cosmos-sdk/pull/9563) fix keyring kwallet backend when using with empty wallet. + + ## [v0.42.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.6) - 2021-06-18 ### Improvements diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4f649677e7ef..78536d4d7b99 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,22 +1,10 @@ -# Cosmos SDK v0.42.6 "Stargate" Release Notes +# Cosmos SDK v0.42.7 "Stargate" Release Notes This release includes various minor bugfixes and improvments, including: -- x/bank's InitGenesis optimization, which should significantly decrease genesis initialization time, -- bump Tendermint to v0.34.11 to fix state sync issues, -- add `cosmos_sdk_version` to `node_info` to be able to query the SDK version used by a node, -- IBC bugfixes and improvements (see below for more info), -- new fields on `sdk.Context` (see below for more info). +- a x/capability initialization fix, which fixes the consensus error when using statesync, +- CLI improvements such as fixing the `{appd} keys parse` subcommand and a better user error when `--chain-id` is not passed in the `{appd} tx multisign` subcommand, +- add a new `Trace()` method on BaseApp to return the `trace` value for logging error stack traces, +- IBC fixes for the `Transfer` event and telemetry metrics. -See the [Cosmos SDK v0.42.6 milestone](https://github.com/cosmos/cosmos-sdk/milestone/45?closed=1) on our issue tracker for the exhaustive list of all changes. - -### IBC Bugfixes and Improvements - -The `[appd] query ibc client header` is fixed and allows querying by height for the header and node-state command. This allows easier venerability of which IBC tokens belong to which chains. IBC's ExportGenesis now exports all fields, including previously missing `NextClientSequence`, `NextConnectionSequence` and `NextChannelSequence`. A new subcommand `[appd] query ibc-transfer escrow-address` has been added to get the escrow address for a channel; it can be used to then query balance of escrowed tokens. - -### New Fields on `sdk.Context` - -Two fields have been added on `sdk.Context`: - -- `ctx.HeaderHash` adds the current block header hash obtained during abci.RequestBeginBlock to the Context, -- `ctx.GasMeter().RefundGas(, )` adds support for refunding gas directly to the gas meter. +See the [Cosmos SDK v0.42.7 milestone](https://github.com/cosmos/cosmos-sdk/milestone/48?closed=1) on our issue tracker for the exhaustive list of all changes. diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index a79aed801b6f..f52f377eda30 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -180,6 +180,11 @@ func (app *BaseApp) Logger() log.Logger { return app.logger } +// Trace returns the boolean value for logging error stack traces. +func (app *BaseApp) Trace() bool { + return app.trace +} + // MsgServiceRouter returns the MsgServiceRouter of a BaseApp. func (app *BaseApp) MsgServiceRouter() *MsgServiceRouter { return app.msgServiceRouter } diff --git a/go.mod b/go.mod index 1c06f7e60eb9..4f83be4fc327 100644 --- a/go.mod +++ b/go.mod @@ -64,3 +64,5 @@ replace google.golang.org/grpc => google.golang.org/grpc v1.33.2 replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 replace github.com/tendermint/tendermint => github.com/fetchai/tendermint v1.0.0 + +replace github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 diff --git a/go.sum b/go.sum index d8b2cd040014..0274c8cf106d 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,6 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/99designs/keyring v1.1.6 h1:kVDC2uCgVwecxCk+9zoCt2uEL6dt+dfVzMvGgnVcIuM= -github.com/99designs/keyring v1.1.6/go.mod h1:16e0ds7LGQQcT59QqkTg72Hh5ShM51Byv5PEmW6uoRU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= @@ -104,6 +102,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= github.com/cosmos/iavl v0.16.0 h1:ICIOB8xysirTX27GmVAaoeSpeozzgSu9d49w36xkVJA= github.com/cosmos/iavl v0.16.0/go.mod h1:2A8O/Jz9YwtjqXMO0CjnnbTYEEaovE8jWcwrakH3PoE= +github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= +github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -353,7 +353,6 @@ github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index 4b20b73167e2..5b1cd1ca5eb7 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -75,6 +75,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { authclient.Codec = encodingConfig.Marshaler + cfg := sdk.GetConfig() + cfg.Seal() rootCmd.AddCommand( genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome), diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index cd5c687eac6b..1b7a68a9c729 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -108,6 +108,10 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { return err } + if txFactory.ChainID() == "" { + return fmt.Errorf("set the chain id with either the --chain-id flag or config file") + } + signingData := signing.SignerData{ ChainID: txFactory.ChainID(), AccountNumber: txFactory.AccountNumber(), diff --git a/x/bank/simulation/params.go b/x/bank/simulation/params.go index c3da182205b7..222f88acaba2 100644 --- a/x/bank/simulation/params.go +++ b/x/bank/simulation/params.go @@ -23,7 +23,7 @@ func ParamChanges(r *rand.Rand) []simtypes.ParamChange { if err != nil { panic(err) } - return fmt.Sprintf("%s", paramsBytes) + return string(paramsBytes) }, ), simulation.NewSimParamChange(types.ModuleName, string(types.KeyDefaultSendEnabled), diff --git a/x/capability/keeper/keeper.go b/x/capability/keeper/keeper.go index 61de0338991c..b92dfc94bafb 100644 --- a/x/capability/keeper/keeper.go +++ b/x/capability/keeper/keeper.go @@ -13,6 +13,14 @@ import ( "github.com/cosmos/cosmos-sdk/x/capability/types" ) +// initialized is a global variable used by GetCapability to ensure that the memory store +// and capability map are correctly populated. A state-synced node may copy over all the persistent +// state and start running the application without having the in-memory state required for x/capability. +// Thus, we must initialized the memory stores on-the-fly during tx execution once the first GetCapability +// is called. +// This is a temporary fix and should be replaced by a more robust solution in the next breaking release. +var initialized = false + type ( // Keeper defines the capability module's keeper. It is responsible for provisioning, // tracking, and authenticating capabilities at runtime. During application @@ -342,6 +350,22 @@ func (sk ScopedKeeper) ReleaseCapability(ctx sdk.Context, cap *types.Capability) // by name. The module is not allowed to retrieve capabilities which it does not // own. func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capability, bool) { + // Create a keeper that will set all in-memory mappings correctly into memstore and capmap if scoped keeper is not initialized yet. + // This ensures that the in-memory mappings are correctly filled in, in case this is a state-synced node. + // This is a temporary non-breaking fix, a future PR should store the reverse mapping in the persistent store and reconstruct forward mapping and capmap on the fly. + if !initialized { + // create context with infinite gas meter to avoid app state mismatch. + initCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + k := Keeper{ + cdc: sk.cdc, + storeKey: sk.storeKey, + memKey: sk.memKey, + capMap: sk.capMap, + } + k.InitializeAndSeal(initCtx) + initialized = true + } + if strings.TrimSpace(name) == "" { return nil, false } @@ -358,6 +382,7 @@ func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capab // so we delete here to remove unnecessary values in map // TODO: Delete index correctly from capMap by storing some reverse lookup // in-memory map. Issue: https://github.com/cosmos/cosmos-sdk/issues/7805 + return nil, false } diff --git a/x/ibc/applications/transfer/keeper/relay.go b/x/ibc/applications/transfer/keeper/relay.go index 4889014a40af..cbe4a0749b0f 100644 --- a/x/ibc/applications/transfer/keeper/relay.go +++ b/x/ibc/applications/transfer/keeper/relay.go @@ -13,6 +13,7 @@ import ( clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types" host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host" + coretypes "github.com/cosmos/cosmos-sdk/x/ibc/core/types" ) // SendTransfer handles transfer sending logic. There are 2 possible cases: @@ -101,8 +102,8 @@ func (k Keeper) SendTransfer( } labels := []metrics.Label{ - telemetry.NewLabel("destination-port", destinationPort), - telemetry.NewLabel("destination-channel", destinationChannel), + telemetry.NewLabel(coretypes.LabelDestinationPort, destinationPort), + telemetry.NewLabel(coretypes.LabelDestinationChannel, destinationChannel), } // NOTE: SendTransfer simply sends the denomination as it exists on its own @@ -110,7 +111,7 @@ func (k Keeper) SendTransfer( // prefixing as necessary. if types.SenderChainIsSource(sourcePort, sourceChannel, fullDenomPath) { - labels = append(labels, telemetry.NewLabel("source", "true")) + labels = append(labels, telemetry.NewLabel(coretypes.LabelSource, "true")) // create the escrow address for the tokens escrowAddress := types.GetEscrowAddress(sourcePort, sourceChannel) @@ -123,7 +124,7 @@ func (k Keeper) SendTransfer( } } else { - labels = append(labels, telemetry.NewLabel("source", "false")) + labels = append(labels, telemetry.NewLabel(coretypes.LabelSource, "false")) // transfer the coins to the module account and burn them if err := k.bankKeeper.SendCoinsFromAccountToModule( @@ -165,7 +166,7 @@ func (k Keeper) SendTransfer( telemetry.SetGaugeWithLabels( []string{"tx", "msg", "ibc", "transfer"}, float32(token.Amount.Int64()), - []metrics.Label{telemetry.NewLabel("denom", fullDenomPath)}, + []metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, fullDenomPath)}, ) telemetry.IncrCounterWithLabels( @@ -200,8 +201,8 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t } labels := []metrics.Label{ - telemetry.NewLabel("source-port", packet.GetSourcePort()), - telemetry.NewLabel("source-channel", packet.GetSourceChannel()), + telemetry.NewLabel(coretypes.LabelSourcePort, packet.GetSourcePort()), + telemetry.NewLabel(coretypes.LabelSourceChannel, packet.GetSourceChannel()), } // This is the prefix that would have been prefixed to the denomination @@ -244,14 +245,14 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t telemetry.SetGaugeWithLabels( []string{"ibc", types.ModuleName, "packet", "receive"}, float32(data.Amount), - []metrics.Label{telemetry.NewLabel("denom", unprefixedDenom)}, + []metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, unprefixedDenom)}, ) telemetry.IncrCounterWithLabels( []string{"ibc", types.ModuleName, "receive"}, 1, append( - labels, telemetry.NewLabel("source", "true"), + labels, telemetry.NewLabel(coretypes.LabelSource, "true"), ), ) }() @@ -303,14 +304,14 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t telemetry.SetGaugeWithLabels( []string{"ibc", types.ModuleName, "packet", "receive"}, float32(data.Amount), - []metrics.Label{telemetry.NewLabel("denom", data.Denom)}, + []metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, data.Denom)}, ) telemetry.IncrCounterWithLabels( []string{"ibc", types.ModuleName, "receive"}, 1, append( - labels, telemetry.NewLabel("source", "false"), + labels, telemetry.NewLabel(coretypes.LabelSource, "false"), ), ) }() diff --git a/x/ibc/applications/transfer/module.go b/x/ibc/applications/transfer/module.go index f0d8aa2cb5c6..79de4e77b4cf 100644 --- a/x/ibc/applications/transfer/module.go +++ b/x/ibc/applications/transfer/module.go @@ -343,7 +343,7 @@ func (am AppModule) OnRecvPacket( sdk.NewAttribute(types.AttributeKeyReceiver, data.Receiver), sdk.NewAttribute(types.AttributeKeyDenom, data.Denom), sdk.NewAttribute(types.AttributeKeyAmount, fmt.Sprintf("%d", data.Amount)), - sdk.NewAttribute(types.AttributeKeyAckSuccess, fmt.Sprintf("%t", err != nil)), + sdk.NewAttribute(types.AttributeKeyAckSuccess, fmt.Sprintf("%t", err == nil)), ), ) diff --git a/x/ibc/applications/transfer/simulation/params.go b/x/ibc/applications/transfer/simulation/params.go index 67c61f514ed1..0f4fefb93b43 100644 --- a/x/ibc/applications/transfer/simulation/params.go +++ b/x/ibc/applications/transfer/simulation/params.go @@ -1,7 +1,6 @@ package simulation import ( - "fmt" "math/rand" gogotypes "github.com/gogo/protobuf/types" @@ -19,13 +18,13 @@ func ParamChanges(r *rand.Rand) []simtypes.ParamChange { simulation.NewSimParamChange(types.ModuleName, string(types.KeySendEnabled), func(r *rand.Rand) string { sendEnabled := RadomEnabled(r) - return fmt.Sprintf("%s", types.ModuleCdc.MustMarshalJSON(&gogotypes.BoolValue{Value: sendEnabled})) + return string(types.ModuleCdc.MustMarshalJSON(&gogotypes.BoolValue{Value: sendEnabled})) }, ), simulation.NewSimParamChange(types.ModuleName, string(types.KeyReceiveEnabled), func(r *rand.Rand) string { receiveEnabled := RadomEnabled(r) - return fmt.Sprintf("%s", types.ModuleCdc.MustMarshalJSON(&gogotypes.BoolValue{Value: receiveEnabled})) + return string(types.ModuleCdc.MustMarshalJSON(&gogotypes.BoolValue{Value: receiveEnabled})) }, ), } diff --git a/x/ibc/core/02-client/keeper/client.go b/x/ibc/core/02-client/keeper/client.go index e822402bfb3e..b4ca97f81bcd 100644 --- a/x/ibc/core/02-client/keeper/client.go +++ b/x/ibc/core/02-client/keeper/client.go @@ -47,7 +47,7 @@ func (k Keeper) CreateClient( telemetry.IncrCounterWithLabels( []string{"ibc", "client", "create"}, 1, - []metrics.Label{telemetry.NewLabel("client-type", clientState.ClientType())}, + []metrics.Label{telemetry.NewLabel(types.LabelClientType, clientState.ClientType())}, ) }() @@ -90,9 +90,9 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.H []string{"ibc", "client", "update"}, 1, []metrics.Label{ - telemetry.NewLabel("client-type", clientState.ClientType()), - telemetry.NewLabel("client-id", clientID), - telemetry.NewLabel("update-type", "msg"), + telemetry.NewLabel(types.LabelClientType, clientState.ClientType()), + telemetry.NewLabel(types.LabelClientID, clientID), + telemetry.NewLabel(types.LabelUpdateType, "msg"), }, ) }() @@ -151,8 +151,8 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e []string{"ibc", "client", "upgrade"}, 1, []metrics.Label{ - telemetry.NewLabel("client-type", updatedClientState.ClientType()), - telemetry.NewLabel("client-id", clientID), + telemetry.NewLabel(types.LabelClientType, updatedClientState.ClientType()), + telemetry.NewLabel(types.LabelClientID, clientID), }, ) }() @@ -195,8 +195,8 @@ func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, misbehaviour ex []string{"ibc", "client", "misbehaviour"}, 1, []metrics.Label{ - telemetry.NewLabel("client-type", misbehaviour.ClientType()), - telemetry.NewLabel("client-id", misbehaviour.GetClientID()), + telemetry.NewLabel(types.LabelClientType, misbehaviour.ClientType()), + telemetry.NewLabel(types.LabelClientID, misbehaviour.GetClientID()), }, ) }() diff --git a/x/ibc/core/02-client/keeper/proposal.go b/x/ibc/core/02-client/keeper/proposal.go index 6b17278e09dd..17244562aed8 100644 --- a/x/ibc/core/02-client/keeper/proposal.go +++ b/x/ibc/core/02-client/keeper/proposal.go @@ -42,9 +42,9 @@ func (k Keeper) ClientUpdateProposal(ctx sdk.Context, p *types.ClientUpdatePropo []string{"ibc", "client", "update"}, 1, []metrics.Label{ - telemetry.NewLabel("client-type", clientState.ClientType()), - telemetry.NewLabel("client-id", p.ClientId), - telemetry.NewLabel("update-type", "proposal"), + telemetry.NewLabel(types.LabelClientType, clientState.ClientType()), + telemetry.NewLabel(types.LabelClientID, p.ClientId), + telemetry.NewLabel(types.LabelUpdateType, "proposal"), }, ) }() diff --git a/x/ibc/core/02-client/types/metrics.go b/x/ibc/core/02-client/types/metrics.go new file mode 100644 index 000000000000..879e79a40d13 --- /dev/null +++ b/x/ibc/core/02-client/types/metrics.go @@ -0,0 +1,9 @@ +package types + +// Prometheus metric labels. +const ( + LabelClientType = "client_type" + LabelClientID = "client_id" + LabelUpdateType = "update_type" + LabelMsgType = "msg_type" +) diff --git a/x/ibc/core/keeper/msg_server.go b/x/ibc/core/keeper/msg_server.go index dcddcaed16d4..7a65b2a1fd77 100644 --- a/x/ibc/core/keeper/msg_server.go +++ b/x/ibc/core/keeper/msg_server.go @@ -13,6 +13,7 @@ import ( channel "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types" porttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/05-port/types" + coretypes "github.com/cosmos/cosmos-sdk/x/ibc/core/types" ) var _ clienttypes.MsgServer = Keeper{} @@ -462,10 +463,10 @@ func (k Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPacke []string{"tx", "msg", "ibc", msg.Type()}, 1, []metrics.Label{ - telemetry.NewLabel("source-port", msg.Packet.SourcePort), - telemetry.NewLabel("source-channel", msg.Packet.SourceChannel), - telemetry.NewLabel("destination-port", msg.Packet.DestinationPort), - telemetry.NewLabel("destination-channel", msg.Packet.DestinationChannel), + telemetry.NewLabel(coretypes.LabelSourcePort, msg.Packet.SourcePort), + telemetry.NewLabel(coretypes.LabelSourceChannel, msg.Packet.SourceChannel), + telemetry.NewLabel(coretypes.LabelDestinationPort, msg.Packet.DestinationPort), + telemetry.NewLabel(coretypes.LabelDestinationChannel, msg.Packet.DestinationChannel), }, ) }() @@ -509,11 +510,11 @@ func (k Keeper) Timeout(goCtx context.Context, msg *channeltypes.MsgTimeout) (*c []string{"ibc", "timeout", "packet"}, 1, []metrics.Label{ - telemetry.NewLabel("source-port", msg.Packet.SourcePort), - telemetry.NewLabel("source-channel", msg.Packet.SourceChannel), - telemetry.NewLabel("destination-port", msg.Packet.DestinationPort), - telemetry.NewLabel("destination-channel", msg.Packet.DestinationChannel), - telemetry.NewLabel("timeout-type", "height"), + telemetry.NewLabel(coretypes.LabelSourcePort, msg.Packet.SourcePort), + telemetry.NewLabel(coretypes.LabelSourceChannel, msg.Packet.SourceChannel), + telemetry.NewLabel(coretypes.LabelDestinationPort, msg.Packet.DestinationPort), + telemetry.NewLabel(coretypes.LabelDestinationChannel, msg.Packet.DestinationChannel), + telemetry.NewLabel(coretypes.LabelTimeoutType, "height"), }, ) }() @@ -560,11 +561,11 @@ func (k Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTimeo []string{"ibc", "timeout", "packet"}, 1, []metrics.Label{ - telemetry.NewLabel("source-port", msg.Packet.SourcePort), - telemetry.NewLabel("source-channel", msg.Packet.SourceChannel), - telemetry.NewLabel("destination-port", msg.Packet.DestinationPort), - telemetry.NewLabel("destination-channel", msg.Packet.DestinationChannel), - telemetry.NewLabel("timeout-type", "channel-closed"), + telemetry.NewLabel(coretypes.LabelSourcePort, msg.Packet.SourcePort), + telemetry.NewLabel(coretypes.LabelSourceChannel, msg.Packet.SourceChannel), + telemetry.NewLabel(coretypes.LabelDestinationPort, msg.Packet.DestinationPort), + telemetry.NewLabel(coretypes.LabelDestinationChannel, msg.Packet.DestinationChannel), + telemetry.NewLabel(coretypes.LabelTimeoutType, "channel-closed"), }, ) }() @@ -604,10 +605,10 @@ func (k Keeper) Acknowledgement(goCtx context.Context, msg *channeltypes.MsgAckn []string{"tx", "msg", "ibc", msg.Type()}, 1, []metrics.Label{ - telemetry.NewLabel("source-port", msg.Packet.SourcePort), - telemetry.NewLabel("source-channel", msg.Packet.SourceChannel), - telemetry.NewLabel("destination-port", msg.Packet.DestinationPort), - telemetry.NewLabel("destination-channel", msg.Packet.DestinationChannel), + telemetry.NewLabel(coretypes.LabelSourcePort, msg.Packet.SourcePort), + telemetry.NewLabel(coretypes.LabelSourceChannel, msg.Packet.SourceChannel), + telemetry.NewLabel(coretypes.LabelDestinationPort, msg.Packet.DestinationPort), + telemetry.NewLabel(coretypes.LabelDestinationChannel, msg.Packet.DestinationChannel), }, ) }() diff --git a/x/ibc/core/types/metrics.go b/x/ibc/core/types/metrics.go new file mode 100644 index 000000000000..9fcd348a7d6e --- /dev/null +++ b/x/ibc/core/types/metrics.go @@ -0,0 +1,12 @@ +package types + +// Prometheus metric labels. +const ( + LabelSourcePort = "source_port" + LabelSourceChannel = "source_channel" + LabelDestinationPort = "destination_port" + LabelDestinationChannel = "destination_channel" + LabelTimeoutType = "timeout_type" + LabelDenom = "denom" + LabelSource = "source" +) diff --git a/x/upgrade/abci.go b/x/upgrade/abci.go index fa95c4c4aa63..d14cd4e7253d 100644 --- a/x/upgrade/abci.go +++ b/x/upgrade/abci.go @@ -56,10 +56,6 @@ func BeginBlocker(k keeper.Keeper, ctx sdk.Context, _ abci.RequestBeginBlock) { } if !k.HasHandler(plan.Name) { - upgradeMsg := BuildUpgradeNeededMsg(plan) - // We don't have an upgrade handler for this upgrade name, meaning this software is out of date so shutdown - ctx.Logger().Error(upgradeMsg) - // Write the upgrade info to disk. The UpgradeStoreLoader uses this info to perform or skip // store migrations. err := k.DumpUpgradeInfoToDisk(ctx.BlockHeight(), plan.Name) @@ -67,6 +63,10 @@ func BeginBlocker(k keeper.Keeper, ctx sdk.Context, _ abci.RequestBeginBlock) { panic(fmt.Errorf("unable to write upgrade info to filesystem: %s", err.Error())) } + upgradeMsg := BuildUpgradeNeededMsg(plan) + // We don't have an upgrade handler for this upgrade name, meaning this software is out of date so shutdown + ctx.Logger().Error(upgradeMsg) + panic(upgradeMsg) } // We have an upgrade handler for this upgrade name, so apply the upgrade