Skip to content

Commit

Permalink
Merge branch 'master' into aleem/9966-authz-granter-grants
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 11, 2021
2 parents c6236d2 + 7e6151e commit 8f68775
Show file tree
Hide file tree
Showing 18 changed files with 388 additions and 30 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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`.
Expand Down Expand Up @@ -151,6 +151,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### State Machine Breaking

* (x/staking) [#10254](https://github.com/cosmos/cosmos-sdk/pull/10254) Instead of using the shares to determine if a delegation should be removed, use the truncated (token) amount.
* (store) [#10247](https://github.com/cosmos/cosmos-sdk/pull/10247) Charge gas for the key length in gas meter.
* (store) [#10218](https://github.com/cosmos/cosmos-sdk/pull/10218) Charge gas even when there are no entries while seeking.
* (x/auth)[\#9596](https://github.com/cosmos/cosmos-sdk/pull/9596) Enable creating periodic vesting accounts with a transactions instead of requiring them to be created in genesis.
Expand Down
8 changes: 0 additions & 8 deletions docs/core/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/hashicorp/golang-lru v0.5.4
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87
github.com/improbable-eng/grpc-web v0.14.1
github.com/jhump/protoreflect v1.10.0
github.com/jhump/protoreflect v1.10.1
github.com/kr/text v0.2.0 // indirect
github.com/magiconair/properties v1.8.5
github.com/mattn/go-isatty v0.0.14
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH
github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jhump/protoreflect v1.10.0 h1:mbS/mqFrJSliRdPuNP+LY0JqitVP0SW58GQ7A2l2dTI=
github.com/jhump/protoreflect v1.10.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
github.com/jhump/protoreflect v1.10.1 h1:iH+UZfsbRE6vpyZH7asAjTPWJf7RJbpZ9j/N3lDlKs0=
github.com/jhump/protoreflect v1.10.1/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
Expand Down
4 changes: 0 additions & 4 deletions store/cachekv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import (
"io"
"sort"
"sync"
"time"

dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/internal/conv"
"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"
)

Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions store/gaskv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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)
Expand Down
45 changes: 45 additions & 0 deletions x/auth/spec/07_client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--
order: 7
-->

# 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
```
4 changes: 3 additions & 1 deletion x/auth/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
228 changes: 228 additions & 0 deletions x/mint/spec/06_client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
<!--
order: 6
-->

# 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"
}
}
```
Loading

0 comments on commit 8f68775

Please sign in to comment.