Skip to content

Commit bb83d0b

Browse files
authored
Merge pull request cosmostation#23 from qwertzlbert/add-more-information-related-to-consumer-chains
Add more information related to consumer chains
2 parents a03966b + 9a0bad5 commit bb83d0b

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

docs/consumer_chains.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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)

internal/common/types/cosmos.go

+4
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ type ConsensusPubkey struct {
186186
}
187187

188188
// ccv module
189+
// Returns the list of validators of a specific consumer chain
189190
var (
190191
ProviderValidatorsQueryPath = func(consumerID string) string {
191192
return fmt.Sprintf("/interchain_security/ccv/provider/consumer_validators/%s", consumerID)
@@ -207,6 +208,9 @@ type ProviderValidator struct {
207208
Jailed bool `json:"jailed"`
208209
}
209210

211+
// see https://buf.build/cosmos/interchain-security/docs/main:interchain_security.ccv.provider.v1#interchain_security.ccv.provider.v1.QueryConsumerChainsRequest
212+
// The phase of the consumer chains returned (optional)
213+
// Registered=1|Initialized=2|Launched=3|Stopped=4|Deleted=5
210214
var ConsumerChainListQueryPath string = "/interchain_security/ccv/provider/consumer_chains/3"
211215

212216
type CosmosConsumerChainsResponse struct {

0 commit comments

Comments
 (0)