Skip to content
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
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,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_1
command: cargo build --locked --features abort,iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2
- 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_1
command: cargo wasm --locked --features abort,iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2
- run:
name: Run unit tests (all features)
working_directory: ~/project/packages/std
command: cargo test --locked --features abort,iterator,staking,stargate,cosmwasm_1_1
command: cargo test --locked --features abort,iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2
- save_cache:
paths:
- /usr/local/cargo/registry
Expand Down Expand Up @@ -882,7 +882,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 -- -D warnings
command: cargo clippy --all-targets --features abort,iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2 -- -D warnings
- run:
name: Clippy linting on storage (no feature flags)
working_directory: ~/project/packages/storage
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ and this project adheres to
of CosmWasm earlier than 1.2.0 ([#1481]).
- cosmwasm-std: Add `instantiate2_address` which allows calculating the
predictable addresses for `MsgInstantiateContract2` ([#1437]).
- cosmwasm-std: Add `WasmMsg::Instantiate2` (requires `cosmwasm_1_2`, see
`GovMsg::VoteWeighted` above) to instantiate contracts at a predictable
address ([#1436]).
- cosmwasm-schema: In contracts, `cosmwasm schema` will now output a separate
JSON Schema file for each entrypoint in the `raw` subdirectory ([#1478],
[#1533]).
- cosmwasm-std: Upgrade `serde-json-wasm` dependency to 0.5.0 which adds map
support to `to_vec`/`to_binary` and friends.
- cosmwasm-std: Implement `AsRef<[u8]>` for `Binary` and `HexBinary` ([#1550]).

[#1436]: https://github.com/CosmWasm/cosmwasm/issues/1436
[#1437]: https://github.com/CosmWasm/cosmwasm/issues/1437
[#1481]: https://github.com/CosmWasm/cosmwasm/pull/1481
[#1478]: https://github.com/CosmWasm/cosmwasm/pull/1478
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc-reflect-send/schema/ibc-reflect-send.json
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc-reflect-send/schema/packet_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc-reflect-send/schema/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc-reflect-send/schema/raw/migrate.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc-reflect-send/schema/raw/sudo.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc-reflect/schema/packet_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/reflect/schema/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/reflect/schema/raw/migrate.json
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/reflect/schema/raw/sudo.json
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion contracts/reflect/schema/reflect.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
"additionalProperties": false
},
{
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.",
"description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.",
"type": "object",
"required": [
"instantiate"
Expand Down
2 changes: 1 addition & 1 deletion devtools/check_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cargo fmt
(
cd packages/std
cargo check
cargo check --features iterator,staking,stargate
cargo check --features iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2
cargo wasm-debug
cargo wasm-debug --features iterator,staking,stargate
cargo clippy --all-targets --features iterator,staking,stargate -- -D warnings
Expand Down
4 changes: 2 additions & 2 deletions docs/CAPABILITIES-BUILT-IN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ might define others.
chains that don't use this (e.g. Tgrade).
- `cosmwasm_1_1` enables the `BankQuery::Supply` query. Only chains running
CosmWasm `1.1.0` or higher support this.
- `cosmwasm_1_2` enables the `GovMsg::VoteWeighted` message. Only chains running
CosmWasm `1.2.0` or higher support this.
- `cosmwasm_1_2` enables the `GovMsg::VoteWeighted` and `WasmMsg::Instantiate2`
messages. Only chains running CosmWasm `1.2.0` or higher support this.
2 changes: 1 addition & 1 deletion packages/check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use colored::Colorize;
use cosmwasm_vm::capabilities_from_csv;
use cosmwasm_vm::internals::{check_wasm, compile};

const DEFAULT_AVAILABLE_CAPABILITIES: &str = "iterator,staking,stargate,cosmwasm_1_1";
const DEFAULT_AVAILABLE_CAPABILITIES: &str = "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2";

pub fn main() {
let matches = App::new("Contract checking")
Expand Down
26 changes: 25 additions & 1 deletion packages/std/src/results/cosmos_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ pub enum WasmMsg {
},
/// Instantiates a new contracts from previously uploaded Wasm code.
///
/// This is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61).
/// The contract address is non-predictable. But it is guaranteed that
/// when emitting the same Instantiate message multiple times,
/// multiple instances on different addresses will be generated. See also
/// Instantiate2.
///
/// This is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71).
/// `sender` is automatically filled with the current contract's address.
Instantiate {
admin: Option<String>,
Expand All @@ -153,6 +158,25 @@ pub enum WasmMsg {
/// A human-readbale label for the contract
label: String,
},
/// Instantiates a new contracts from previously uploaded Wasm code
/// using a predictable address derivation algorithm implemented in
/// [`cosmwasm_std::instantiate2_address`].
///
/// This is translated to a [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L73-L96).
/// `sender` is automatically filled with the current contract's address.
#[cfg(feature = "cosmwasm_1_2")]
Instantiate2 {
admin: Option<String>,
code_id: u64,
/// A human-readbale label for the contract
label: String,
/// msg is the JSON-encoded InstantiateMsg struct (as raw Binary)
#[derivative(Debug(format_with = "binary_to_string"))]
msg: Binary,
funds: Vec<Coin>,
salt: Binary,
fix_msg: bool,
},
/// Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to
/// customize behavior.
///
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/src/testing/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub struct MockInstanceOptions<'a> {
impl MockInstanceOptions<'_> {
fn default_capabilities() -> HashSet<String> {
#[allow(unused_mut)]
let mut out = capabilities_from_csv("iterator,staking,cosmwasm_1_1");
let mut out = capabilities_from_csv("iterator,staking,cosmwasm_1_1,cosmwasm_1_2");
#[cfg(feature = "stargate")]
out.insert("stargate".to_string());
out
Expand Down