|
| 1 | +# Consumer Chain Metrics |
| 2 | + |
| 3 | +Consumer chains (e.g., Stride or Neutron), as defined by the Cosmos [Interchain Security Standard](https://tutorials.cosmos.network/academy/2-cosmos-concepts/14-interchain-security.html), rely on a provider chain (e.g., Cosmos Hub) for security. If a validator node on a consumer chain misbehaves, the corresponding validator on the provider chain will be penalized. |
| 4 | + |
| 5 | +CVMS supports tracking metrics of consumer chain validators by linking them to their provider validators via the [Interchain Security Module](https://buf.build/cosmos/interchain-security). |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Tracks and resolves consumer chain validators to their provider validators. |
| 10 | +- Gathers and tags metrics based on linked provider validator addresses. |
| 11 | + |
| 12 | +## Example: Getting Validator Metrics for Stride |
| 13 | + |
| 14 | +To correctly track metrics for a consumer chain, define the `provider_nodes` variable in the configuration. |
| 15 | + |
| 16 | +```yaml |
| 17 | +monikers: |
| 18 | + - 'Cosmostation' |
| 19 | + |
| 20 | +chains: |
| 21 | + - display_name: 'stride' |
| 22 | + chain_id: 'stride-1' |
| 23 | + nodes: |
| 24 | + - rpc: 'https://rpc-stride.endpoint.xyz' |
| 25 | + api: 'https://lcd-stride.endpoint.xyz' |
| 26 | + grpc: 'grpc-stride.endpoint.xyz:9090' |
| 27 | + |
| 28 | + provider_nodes: |
| 29 | + - rpc: 'https://rpc-cosmos.endpoint.xyz' |
| 30 | + api: 'https://lcd-cosmos.endpoint.xyz' |
| 31 | + grpc: 'grpc-cosmos.endpoint.xyz:9090' |
| 32 | +``` |
| 33 | +Metrics gathered using this configuration are tagged with the linked provider validator addresses: |
| 34 | +``` |
| 35 | +# HELP cvms_uptime_jailed |
| 36 | +# TYPE cvms_uptime_jailed gauge |
| 37 | +cvms_uptime_jailed{chain="stride",chain_id="stride-1",mainnet="true",moniker="SuperAwesomeValidator",package="uptime",proposer_address="ABCDEFG...",table_chain_id="stride_1",validator_consensus_address="cosmosvalconsxyz",validator_operator_address="cosmosvaloperxyz"} 0 |
| 38 | +``` |
| 39 | + |
| 40 | +## How It Works |
| 41 | +CVMS performs the following steps to return correct validator-related metrics: |
| 42 | + |
| 43 | +1. Lookup the Consumer Chain ID on the Provider Network |
| 44 | + - Uses the Interchain Security Provider Module API. |
| 45 | + - Returns a list of consumer chains supported by the provider network. |
| 46 | +2. Resolve Provider Validators Securing Consumer Validators |
| 47 | + - Calls the Interchain Security Provider Module on the provider network. |
| 48 | + - Returns a list of validators securing the consumer chain validators. |
| 49 | +3. Get the Bech32 Consensus Address of the Consumer Validator |
| 50 | + - Calculates the Bech32 consensus address (valcons) from the provider validator's pubkey. |
| 51 | + - Requires the Human Readable Part (HRP) of the consumer chain and the provider validator's pubkey. |
| 52 | + |
| 53 | +4. Retrieve Signing Information from the Consumer Chain |
| 54 | + - Queries the signing information using the calculated consensus address. |
| 55 | + - Uses the [Slashing Module](https://buf.build/cosmos/cosmos-sdk/docs/main:cosmos.slashing.v1beta1#cosmos.slashing.v1beta1.QuerySigningInfoRequest) API. |
| 56 | + |
| 57 | +## References |
| 58 | +- [Interchain Security Standard](https://tutorials.cosmos.network/academy/2-cosmos-concepts/14-interchain-security.html) |
| 59 | +- [Interchain Security Module](https://buf.build/cosmos/interchain-security) |
| 60 | +- [Cosmos SDK Slashing Module](https://buf.build/cosmos/cosmos-sdk/docs/main:cosmos.slashing.v1beta1) |
0 commit comments