Skip to content

Commit

Permalink
chores: bump sdk v0.42.7 (cosmos#97)
Browse files Browse the repository at this point in the history
* Fixed parse key issue (backport cosmos#9299) (cosmos#9561)

* Fixed parse key issue (cosmos#9299)

* Fixed parse key issue

* Added getconfig in root command

* uncommented changes in parse.go

(cherry picked from commit d7dd1d7)

# Conflicts:
#	simapp/simd/cmd/root.go

* Add changelog

Co-authored-by: Prathyusha Lakkireddy <prathyusha@vitwit.com>
Co-authored-by: Amaury M <1293565+amaurym@users.noreply.github.com>

* feat: return trace value from baseapp (backport cosmos#9578) (cosmos#9580)

* feat: return trace value from baseapp (cosmos#9578)

## Description

Closes: #XXXX

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

* fix: Dumping upgrade info interrupted by cosmovisor (cosmos#9384) (cosmos#9608)

Solution:
- dumping upgrade info before emit `UPGRADED NEEDED` log which will
  cause cosmovisor to kill chain process

<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

The problematic procedure:

1. chain process output UPGRADE NEEDED log
2. cosmovisor see the message and kill the chain binary
3. chain process dump upgrade info and panic itself

the step 2 and 3 runs concurrently, so the dumping process can be interrupted by cosmovisor's terminate signal. The proposed solution is to dump upgrade info before emitting the log.
there are two problematic situation:
1. the upgrade info file is created, but content is not written or flushed before killed, when the chain process restart, it'll panic because of json parsing error.
2. the upgrade info file is not created at all, when the chain process restart, the [store upgrades](https://github.com/crypto-org-chain/chain-main/blob/master/app/app.go#L436) are not activated, will cause app hash mismatch error later on.

* feat: Error on blank chain-id in multisign command (backport cosmos#9593) (cosmos#9605)

* feat: Error on blank chain-id in multisign command (cosmos#9593)

Error on `tx multisign` command if chain-id is blank. This is a common cause of signature verification failures when combining signatures and the error message doesn't provide any clues to this common cause.

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)

(cherry picked from commit f65b6c9)

# Conflicts:
#	CHANGELOG.md

* fix conflicts

* less change diff

Co-authored-by: Zaki Manian <zaki@manian.org>
Co-authored-by: Amaury M <1293565+amaurym@users.noreply.github.com>

* x/capability: Cap Initialization Fix (cosmos#9392)

* fix: correct ibc metric labels (cosmos#9645)

* backport cosmos/ibc-go#223

* add changelog

* fix unnecessary changes

* fix: Fix IBC Transfer Event (cosmos#9640)

* fix event type

* CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Amaury M <1293565+amaurym@users.noreply.github.com>

* chore: v0.42.7 release notes & changelog (cosmos#9661)

* chore: v0.42.7 release notes & changelog

* Add ibc

* fix(keyring): update keyring for kwallet fix (backport cosmos#9563) (cosmos#9579)

* fix(keyring): update keyring for kwallet fix (cosmos#9563)

## Description

Closes: cosmos#9562

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Prathyusha Lakkireddy <prathyusha@vitwit.com>
Co-authored-by: Amaury M <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Zaki Manian <zaki@manian.org>
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
  • Loading branch information
7 people authored Jul 9, 2021
1 parent 7d3a610 commit 717e05b
Show file tree
Hide file tree
Showing 18 changed files with 135 additions and 70 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 6 additions & 18 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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(<amount>, <description>)` 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.
5 changes: 5 additions & 0 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
2 changes: 2 additions & 0 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 4 additions & 0 deletions x/auth/client/cli/tx_multisign.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion x/bank/simulation/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
25 changes: 25 additions & 0 deletions x/capability/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}

Expand Down
23 changes: 12 additions & 11 deletions x/ibc/applications/transfer/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -101,16 +102,16 @@ 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
// chain inside the packet data. The receiving chain will perform denom
// 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)
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"),
),
)
}()
Expand Down Expand Up @@ -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"),
),
)
}()
Expand Down
2 changes: 1 addition & 1 deletion x/ibc/applications/transfer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
),
)

Expand Down
5 changes: 2 additions & 3 deletions x/ibc/applications/transfer/simulation/params.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package simulation

import (
"fmt"
"math/rand"

gogotypes "github.com/gogo/protobuf/types"
Expand All @@ -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}))
},
),
}
Expand Down
16 changes: 8 additions & 8 deletions x/ibc/core/02-client/keeper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())},
)
}()

Expand Down Expand Up @@ -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"),
},
)
}()
Expand Down Expand Up @@ -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),
},
)
}()
Expand Down Expand Up @@ -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()),
},
)
}()
Expand Down
6 changes: 3 additions & 3 deletions x/ibc/core/02-client/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
)
}()
Expand Down
9 changes: 9 additions & 0 deletions x/ibc/core/02-client/types/metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package types

// Prometheus metric labels.
const (
LabelClientType = "client_type"
LabelClientID = "client_id"
LabelUpdateType = "update_type"
LabelMsgType = "msg_type"
)
Loading

0 comments on commit 717e05b

Please sign in to comment.