diff --git a/CHANGELOG.md b/CHANGELOG.md index 962e6f9d6da0..af28e11cc1a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,7 +68,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * `MkConsKeyOutput` * `MkValKeyOutput` * `MkAccKeyOutput` -* [\#10077](https://github.com/cosmos/cosmos-sdk/pull/10077) Remove telemetry on `GasKV` and `CacheKV` store Get/Set operations, significantly improving their performance. +* [\#10077](https://github.com/cosmos/cosmos-sdk/pull/10077),[\#10334](https://github.com/cosmos/cosmos-sdk/pull/10334) Remove telemetry on `GasKV` and `CacheKV` store operations, significantly improving their performance. * [\#10022](https://github.com/cosmos/cosmos-sdk/pull/10022) `AuthKeeper` interface in `x/auth` now includes a function `HasAccount`. * [\#9759](https://github.com/cosmos/cosmos-sdk/pull/9759) `NewAccountKeeeper` in `x/auth` now takes an additional `bech32Prefix` argument that represents `sdk.Bech32MainPrefix`. * [\#9628](https://github.com/cosmos/cosmos-sdk/pull/9628) Rename `x/{mod}/legacy` to `x/{mod}/migrations`. diff --git a/docs/core/telemetry.md b/docs/core/telemetry.md index 9e434eef2bec..11c31413748e 100644 --- a/docs/core/telemetry.md +++ b/docs/core/telemetry.md @@ -131,14 +131,6 @@ The following examples expose too much cardinality and may not even prove to be | `store_iavl_delete` | Duration of an IAVL `Store#Delete` call | ms | summary | | `store_iavl_commit` | Duration of an IAVL `Store#Commit` call | ms | summary | | `store_iavl_query` | Duration of an IAVL `Store#Query` call | ms | summary | -| `store_gaskv_get` | Duration of a GasKV `Store#Get` call | ms | summary | -| `store_gaskv_set` | Duration of a GasKV `Store#Set` call | ms | summary | -| `store_gaskv_has` | Duration of a GasKV `Store#Has` call | ms | summary | -| `store_gaskv_delete` | Duration of a GasKV `Store#Delete` call | ms | summary | -| `store_cachekv_get` | Duration of a CacheKV `Store#Get` call | ms | summary | -| `store_cachekv_set` | Duration of a CacheKV `Store#Set` call | ms | summary | -| `store_cachekv_write` | Duration of a CacheKV `Store#Write` call | ms | summary | -| `store_cachekv_delete` | Duration of a CacheKV `Store#Delete` call | ms | summary | ## Next {hide} diff --git a/store/cachekv/store.go b/store/cachekv/store.go index 799805c2ae1f..221a96e679a4 100644 --- a/store/cachekv/store.go +++ b/store/cachekv/store.go @@ -5,7 +5,6 @@ import ( "io" "sort" "sync" - "time" dbm "github.com/tendermint/tm-db" @@ -13,7 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/store/listenkv" "github.com/cosmos/cosmos-sdk/store/tracekv" "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/telemetry" "github.com/cosmos/cosmos-sdk/types/kv" ) @@ -91,7 +89,6 @@ func (store *Store) Has(key []byte) bool { func (store *Store) Delete(key []byte) { store.mtx.Lock() defer store.mtx.Unlock() - defer telemetry.MeasureSince(time.Now(), "store", "cachekv", "delete") types.AssertValidKey(key) store.setCacheValue(key, nil, true, true) @@ -101,7 +98,6 @@ func (store *Store) Delete(key []byte) { func (store *Store) Write() { store.mtx.Lock() defer store.mtx.Unlock() - defer telemetry.MeasureSince(time.Now(), "store", "cachekv", "write") // We need a copy of all of the keys. // Not the best, but probably not a bottleneck depending. diff --git a/store/gaskv/store.go b/store/gaskv/store.go index 182b04e07c67..845e59cf9363 100644 --- a/store/gaskv/store.go +++ b/store/gaskv/store.go @@ -2,10 +2,8 @@ package gaskv import ( "io" - "time" "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/telemetry" ) var _ types.KVStore = &Store{} @@ -58,14 +56,12 @@ func (gs *Store) Set(key []byte, value []byte) { // Implements KVStore. func (gs *Store) Has(key []byte) bool { - defer telemetry.MeasureSince(time.Now(), "store", "gaskv", "has") gs.gasMeter.ConsumeGas(gs.gasConfig.HasCost, types.GasHasDesc) return gs.parent.Has(key) } // Implements KVStore. func (gs *Store) Delete(key []byte) { - defer telemetry.MeasureSince(time.Now(), "store", "gaskv", "delete") // charge gas to prevent certain attack vectors even though space is being freed gs.gasMeter.ConsumeGas(gs.gasConfig.DeleteCost, types.GasDeleteDesc) gs.parent.Delete(key) diff --git a/x/auth/spec/07_client.md b/x/auth/spec/07_client.md new file mode 100644 index 000000000000..d7f2fbe3d797 --- /dev/null +++ b/x/auth/spec/07_client.md @@ -0,0 +1,45 @@ + + +# Client + +## CLI + +A user can query and interact with the `vesting` module using the CLI. + +### Transactions + +The `tx` commands allow users to interact with the `vesting` module. + +```bash +simd tx vesting --help +``` + +#### create-periodic-vesting-account + +The `create-periodic-vesting-account` command creates a new vesting account funded with an allocation of tokens, where a sequence of coins and period length in seconds. Periods are sequential, in that the duration of of a period only starts at the end of the previous period. The duration of the first period starts upon account creation. + +```bash +simd tx vesting create-periodic-vesting-account [to_address] [periods_json_file] [flags] +``` + +Example: + +```bash +simd tx vesting create-periodic-vesting-account cosmos1.. periods.json +``` + +#### create-vesting-account + +The `create-vesting-account` command creates a new vesting account funded with an allocation of tokens. The account can either be a delayed or continuous vesting account, which is determined by the '--delayed' flag. All vesting accouts created will have their start time set by the committed block's time. The end_time must be provided as a UNIX epoch timestamp. + +```bash +simd tx vesting create-vesting-account [to_address] [amount] [end_time] [flags] +``` + +Example: + +```bash +simd tx vesting create-vesting-account cosmos1.. 100stake 2592000 +``` \ No newline at end of file diff --git a/x/auth/spec/README.md b/x/auth/spec/README.md index b8a96aaa7ce1..99ebabb0ca99 100644 --- a/x/auth/spec/README.md +++ b/x/auth/spec/README.md @@ -36,4 +36,6 @@ This module is used in the Cosmos Hub. - [Genesis Initialization](05_vesting.md#genesis-initialization) - [Examples](05_vesting.md#examples) - [Glossary](05_vesting.md#glossary) -6. **[Parameters](07_params.md)** +6. **[Parameters](06_params.md)** +7. **[Client](07_client.md)** + - [CLI](07_client.md#cli) diff --git a/x/mint/spec/06_client.md b/x/mint/spec/06_client.md new file mode 100644 index 000000000000..078f5cfb3a3f --- /dev/null +++ b/x/mint/spec/06_client.md @@ -0,0 +1,228 @@ + + +# Client + + +## CLI + +A user can query and interact with the `mint` module using the CLI. + +### Query + +The `query` commands allow users to query `mint` state. + +``` +simd query mint --help +``` + +#### annual-provisions + +The `annual-provisions` command allow users to query the current minting annual provisions value + +``` +simd query mint annual-provisions [flags] +``` + +Example: + +``` +simd query mint annual-provisions +``` + +Example Output: + +``` +22268504368893.612100895088410693 +``` + + +#### inflation + +The `inflation` command allow users to query the current minting inflation value + +``` +simd query mint inflation [flags] +``` + +Example: + +``` +simd query mint inflation +``` + +Example Output: + +``` +0.199200302563256955 +``` + +#### params + +The `params` command allow users to query the current minting parameters + + +``` +simd query mint params [flags] +``` + +Example: + +``` +blocks_per_year: "4360000" +goal_bonded: "0.670000000000000000" +inflation_max: "0.200000000000000000" +inflation_min: "0.070000000000000000" +inflation_rate_change: "0.130000000000000000" +mint_denom: stake +``` + +## gRPC + +A user can query the `mint` module using gRPC endpoints. + +### AnnualProvisions + +The `AnnualProvisions` endpoint allow users to query the current minting annual provisions value + +``` +/cosmos.mint.v1beta1.Query/AnnualProvisions +``` + +Example: + +``` +grpcurl -plaintext localhost:9090 cosmos.mint.v1beta1.Query/AnnualProvisions +``` + +Example Output: + +``` +{ + "annualProvisions": "1432452520532626265712995618" +} +``` + +### Inflation + +The `Inflation` endpoint allow users to query the current minting inflation value + +``` +/cosmos.mint.v1beta1.Query/Inflation +``` + +Example: + +``` +grpcurl -plaintext localhost:9090 cosmos.mint.v1beta1.Query/Inflation +``` + +Example Output: + +``` +{ + "inflation": "130197115720711261" +} +``` + +### Params + +The `Params` endpoint allow users to query the current minting parameters + + +``` +/cosmos.mint.v1beta1.Query/Params +``` + +Example: + +``` +grpcurl -plaintext localhost:9090 cosmos.mint.v1beta1.Query/Params +``` + +Example Output: + +``` +{ + "params": { + "mintDenom": "stake", + "inflationRateChange": "130000000000000000", + "inflationMax": "200000000000000000", + "inflationMin": "70000000000000000", + "goalBonded": "670000000000000000", + "blocksPerYear": "6311520" + } +} +``` + +## REST + +A user can query the `mint` module using REST endpoints. + +### annual-provisions + +``` +/cosmos/mint/v1beta1/annual_provisions +``` + +Example: + +``` +curl "localhost:1317/cosmos/mint/v1beta1/annual_provisions" +``` + +Example Output: + +``` +{ + "annualProvisions": "1432452520532626265712995618" +} +``` + +### inflation + +``` +/cosmos/mint/v1beta1/inflation +``` + +Example: + +``` +curl "localhost:1317/cosmos/mint/v1beta1/inflation" +``` + +Example Output: + +``` +{ + "inflation": "130197115720711261" +} +``` + +### params + +``` +/cosmos/mint/v1beta1/params +``` + +Example: + +``` +curl "localhost:1317/cosmos/mint/v1beta1/params" +``` + +Example Output: + +``` +{ + "params": { + "mintDenom": "stake", + "inflationRateChange": "130000000000000000", + "inflationMax": "200000000000000000", + "inflationMin": "70000000000000000", + "goalBonded": "670000000000000000", + "blocksPerYear": "6311520" + } +} +``` diff --git a/x/mint/spec/README.md b/x/mint/spec/README.md index dc60da99959e..f5c41b53f6fd 100644 --- a/x/mint/spec/README.md +++ b/x/mint/spec/README.md @@ -20,3 +20,7 @@ parent: 4. **[Parameters](04_params.md)** 5. **[Events](05_events.md)** - [BeginBlocker](05_events.md#beginblocker) +6. **[Client](06_client.md)** + - [CLI](06_client.md#cli) + - [gRPC](06_client.md#grpc) + - [REST](06_client.md#rest)