Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AllDenomMetadata BankQuery #1703

Merged
merged 16 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,15 @@ jobs:
- run:
name: Build library for native target (all features)
working_directory: ~/project/packages/std
command: cargo build --locked --features abort,iterator,staking,stargate,cosmwasm_1_2
command: cargo build --locked --features abort,iterator,staking,stargate,cosmwasm_1_3
- run:
name: Build library for wasm target (all features)
working_directory: ~/project/packages/std
command: cargo wasm --locked --features abort,iterator,staking,stargate,cosmwasm_1_2
command: cargo wasm --locked --features abort,iterator,staking,stargate,cosmwasm_1_3
- run:
name: Run unit tests (all features)
working_directory: ~/project/packages/std
command: cargo test --locked --features abort,iterator,staking,stargate,cosmwasm_1_2
command: cargo test --locked --features abort,iterator,staking,stargate,cosmwasm_1_3
- save_cache:
paths:
- /usr/local/cargo/registry
Expand Down Expand Up @@ -907,7 +907,7 @@ jobs:
- run:
name: Clippy linting on std (all feature flags)
working_directory: ~/project/packages/std
command: cargo clippy --all-targets --features abort,iterator,staking,stargate,cosmwasm_1_2 -- -D warnings
command: cargo clippy --all-targets --features abort,iterator,staking,stargate,cosmwasm_1_3 -- -D warnings
- run:
name: Clippy linting on storage (no feature flags)
working_directory: ~/project/packages/storage
Expand Down Expand Up @@ -984,7 +984,7 @@ jobs:
CRYPTO=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/crypto --packages cosmwasm-crypto"
DERIVE=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/derive --packages cosmwasm-derive"
SCHEMA=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/schema --packages cosmwasm-schema"
STD=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/std --packages cosmwasm-std --features abort,iterator,staking,stargate,cosmwasm_1_2"
STD=" cargo tarpaulin --skip-clean --out Xml --output-dir reports/std --packages cosmwasm-std --features abort,iterator,staking,stargate,cosmwasm_1_3"
STORAGE="cargo tarpaulin --skip-clean --out Xml --output-dir reports/storage --packages cosmwasm-storage"
docker run --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin:0.21.0 \
sh -c "$CRYPTO && $DERIVE && $SCHEMA && $STD && $STORAGE"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"rust-analyzer.cargo.features": ["abort", "stargate", "staking", "cosmwasm_1_2"]
"rust-analyzer.cargo.features": ["abort", "stargate", "staking", "cosmwasm_1_3"]
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ and this project adheres to

### Added

- cosmwasm-std: Implement `BankQuery::AllDenomMetadata` to allow querying all
chipshort marked this conversation as resolved.
Show resolved Hide resolved
the denom metadata and `BankQuery::DenomMetadata` to query a specific one. In
order to use this query in a contract, the `cosmwasm_1_3` feature needs to be
enabled for the `cosmwasm_std` dependency. This makes the contract
incompatible with chains running anything lower than CosmWasm `1.3.0`.
([#1647])
- cosmwasm-vm: Add `Cache::save_wasm_unchecked` to save Wasm blobs that have
been checked before. This is useful for state-sync where we know the Wasm code
was checked when it was first uploaded. ([#1635])
- cosmwasm-std: Add `FromStr` impl for `Coin`. ([#1684])

[#1635]: https://github.com/CosmWasm/cosmwasm/pull/1635
[#1647]: https://github.com/CosmWasm/cosmwasm/pull/1647
[#1684]: https://github.com/CosmWasm/cosmwasm/pull/1684

### Changed
Expand Down
27 changes: 27 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ This guide explains what is needed to upgrade contracts when migrating over
major releases of `cosmwasm`. Note that you can also view the
[complete CHANGELOG](./CHANGELOG.md) to understand the differences.

## 1.2.x -> 1.3.0

- Update `cosmwasm-*` dependencies in Cargo.toml (skip the ones you don't use):

```
[dependencies]
cosmwasm-std = "1.3.0"
cosmwasm-storage = "1.3.0"
# ...

[dev-dependencies]
cosmwasm-schema = "1.3.0"
cosmwasm-vm = "1.3.0"
# ...
```

- If you want to use a feature that is only available on CosmWasm 1.3+ chains,
use this feature:

```diff
-cosmwasm-std = { version = "1.3.0", features = ["stargate"] }
+cosmwasm-std = { version = "1.3.0", features = ["stargate", "cosmwasm_1_3"] }
```

Please note that `cosmwasm_1_2` implies `cosmwasm_1_1`, and `cosmwasm_1_3`
implies `cosmwasm_1_2`, and so on, so there is no need to set multiple.

## 1.1.x -> 1.2.0

- Update `cosmwasm-*` dependencies in Cargo.toml (skip the ones you don't use):
Expand Down
2 changes: 1 addition & 1 deletion contracts/cyberpunk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ backtraces = ["cosmwasm-std/backtraces", "cosmwasm-vm/backtraces"]

[dependencies]
cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["abort"] }
cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["abort", "cosmwasm_1_3"] }
rust-argon2 = "0.8"
thiserror = "1.0.26"

Expand Down
186 changes: 186 additions & 0 deletions contracts/cyberpunk/schema/cyberpunk.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,198 @@
}
},
"additionalProperties": false
},
{
"description": "Queries `AllDenomMetadata` from the bank module repeatedly and returns all entries",
"type": "object",
"required": [
"denoms"
],
"properties": {
"denoms": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Queries `DenomMetadata` from the bank module and returns the result",
"type": "object",
"required": [
"denom"
],
"properties": {
"denom": {
"type": "object",
"required": [
"denom"
],
"properties": {
"denom": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
"migrate": null,
"sudo": null,
"responses": {
"denom": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DenomMetadata",
"description": "Replicates the cosmos-sdk bank module Metadata type",
"type": "object",
"required": [
"base",
"denom_units",
"description",
"display",
"name",
"symbol",
"uri",
"uri_hash"
],
"properties": {
"base": {
"type": "string"
},
"denom_units": {
"type": "array",
"items": {
"$ref": "#/definitions/DenomUnit"
}
},
"description": {
"type": "string"
},
"display": {
"type": "string"
},
"name": {
"type": "string"
},
"symbol": {
"type": "string"
},
"uri": {
"type": "string"
},
"uri_hash": {
"type": "string"
}
},
"definitions": {
"DenomUnit": {
"description": "Replicates the cosmos-sdk bank module DenomUnit type",
"type": "object",
"required": [
"aliases",
"denom",
"exponent"
],
"properties": {
"aliases": {
"type": "array",
"items": {
"type": "string"
}
},
"denom": {
"type": "string"
},
"exponent": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
}
}
}
},
"denoms": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Array_of_DenomMetadata",
"type": "array",
"items": {
"$ref": "#/definitions/DenomMetadata"
},
"definitions": {
"DenomMetadata": {
"description": "Replicates the cosmos-sdk bank module Metadata type",
"type": "object",
"required": [
"base",
"denom_units",
"description",
"display",
"name",
"symbol",
"uri",
"uri_hash"
],
"properties": {
"base": {
"type": "string"
},
"denom_units": {
"type": "array",
"items": {
"$ref": "#/definitions/DenomUnit"
}
},
"description": {
"type": "string"
},
"display": {
"type": "string"
},
"name": {
"type": "string"
},
"symbol": {
"type": "string"
},
"uri": {
"type": "string"
},
"uri_hash": {
"type": "string"
}
}
},
"DenomUnit": {
"description": "Replicates the cosmos-sdk bank module DenomUnit type",
"type": "object",
"required": [
"aliases",
"denom",
"exponent"
],
"properties": {
"aliases": {
"type": "array",
"items": {
"type": "string"
}
},
"denom": {
"type": "string"
},
"exponent": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
}
}
}
},
"mirror_env": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Env",
Expand Down
36 changes: 36 additions & 0 deletions contracts/cyberpunk/schema/raw/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,42 @@
}
},
"additionalProperties": false
},
{
"description": "Queries `AllDenomMetadata` from the bank module repeatedly and returns all entries",
"type": "object",
"required": [
"denoms"
],
"properties": {
"denoms": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Queries `DenomMetadata` from the bank module and returns the result",
"type": "object",
"required": [
"denom"
],
"properties": {
"denom": {
"type": "object",
"required": [
"denom"
],
"properties": {
"denom": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
}
Loading