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 Any message with blanket implementation #1926

Merged
merged 6 commits into from
Nov 16, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ and this project adheres to
- cosmwasm-std: Change `DistributionQuerier::new` to take `IntoIterator` instead
of `HashMap`. ([#1941])
- cosmwasm-vm: Make `instantiate` entrypoint optional. ([#1933])
- cosmwasm-std: Rename `CosmosMsg::Stargate` to `CosmosMsg::Any` and use a
nested msg struct like in other messages. ([#1926])

[#1874]: https://github.com/CosmWasm/cosmwasm/pull/1874
[#1876]: https://github.com/CosmWasm/cosmwasm/pull/1876
Expand All @@ -55,6 +57,7 @@ and this project adheres to
[#1884]: https://github.com/CosmWasm/cosmwasm/pull/1884
[#1898]: https://github.com/CosmWasm/cosmwasm/pull/1898
[#1902]: https://github.com/CosmWasm/cosmwasm/pull/1902
[#1926]: https://github.com/CosmWasm/cosmwasm/pull/1926
[#1933]: https://github.com/CosmWasm/cosmwasm/pull/1933
[#1939]: https://github.com/CosmWasm/cosmwasm/pull/1939
[#1940]: https://github.com/CosmWasm/cosmwasm/pull/1940
Expand Down
7 changes: 7 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ major releases of `cosmwasm`. Note that you can also view the
+Ok(IbcReceiveResponse::new(b""))
```

- Replace all uses of `CosmosMsg::Stargate` with `CosmosMsg::Any`:

```diff
-CosmosMsg::Stargate { type_url, value }
+CosmosMsg::Any(AnyMsg { type_url, value })
```

## 1.4.x -> 1.5.0

- Update `cosmwasm-*` dependencies in Cargo.toml (skip the ones you don't use):
Expand Down
35 changes: 19 additions & 16 deletions contracts/ibc-reflect-send/schema/ibc-reflect-send.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@
}
],
"definitions": {
"AnyMsg": {
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
},
"BankMsg": {
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
"oneOf": [
Expand Down Expand Up @@ -241,26 +257,13 @@
"additionalProperties": false
},
{
"description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"stargate"
"any"
],
"properties": {
"stargate": {
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
"any": {
"$ref": "#/definitions/AnyMsg"
}
},
"additionalProperties": false
Expand Down
35 changes: 19 additions & 16 deletions contracts/ibc-reflect-send/schema/ibc/packet_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@
}
],
"definitions": {
"AnyMsg": {
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
},
"BankMsg": {
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
"oneOf": [
Expand Down Expand Up @@ -179,26 +195,13 @@
"additionalProperties": false
},
{
"description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"stargate"
"any"
],
"properties": {
"stargate": {
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
"any": {
"$ref": "#/definitions/AnyMsg"
}
},
"additionalProperties": false
Expand Down
35 changes: 19 additions & 16 deletions contracts/ibc-reflect-send/schema/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@
}
],
"definitions": {
"AnyMsg": {
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
},
"BankMsg": {
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
"oneOf": [
Expand Down Expand Up @@ -230,26 +246,13 @@
"additionalProperties": false
},
{
"description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"stargate"
"any"
],
"properties": {
"stargate": {
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
"any": {
"$ref": "#/definitions/AnyMsg"
}
},
"additionalProperties": false
Expand Down
35 changes: 19 additions & 16 deletions contracts/ibc-reflect/schema/ibc/packet_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@
}
],
"definitions": {
"AnyMsg": {
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
},
"BankMsg": {
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
"oneOf": [
Expand Down Expand Up @@ -215,26 +231,13 @@
"additionalProperties": false
},
{
"description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"stargate"
"any"
],
"properties": {
"stargate": {
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
"any": {
"$ref": "#/definitions/AnyMsg"
}
},
"additionalProperties": false
Expand Down
35 changes: 19 additions & 16 deletions contracts/reflect/schema/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@
}
],
"definitions": {
"AnyMsg": {
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
},
"BankMsg": {
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
"oneOf": [
Expand Down Expand Up @@ -200,26 +216,13 @@
"additionalProperties": false
},
{
"description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"stargate"
"any"
],
"properties": {
"stargate": {
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
"any": {
"$ref": "#/definitions/AnyMsg"
}
},
"additionalProperties": false
Expand Down
35 changes: 19 additions & 16 deletions contracts/reflect/schema/reflect.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@
}
],
"definitions": {
"AnyMsg": {
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
},
"BankMsg": {
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
"oneOf": [
Expand Down Expand Up @@ -210,26 +226,13 @@
"additionalProperties": false
},
{
"description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
"type": "object",
"required": [
"stargate"
"any"
],
"properties": {
"stargate": {
"type": "object",
"required": [
"type_url",
"value"
],
"properties": {
"type_url": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Binary"
}
}
"any": {
"$ref": "#/definitions/AnyMsg"
}
},
"additionalProperties": false
Expand Down
6 changes: 3 additions & 3 deletions packages/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ pub use crate::query::{
#[cfg(all(feature = "stargate", feature = "cosmwasm_1_2"))]
pub use crate::results::WeightedVoteOption;
pub use crate::results::{
attr, wasm_execute, wasm_instantiate, Attribute, BankMsg, ContractResult, CosmosMsg, CustomMsg,
Empty, Event, QueryResponse, Reply, ReplyOn, Response, SubMsg, SubMsgResponse, SubMsgResult,
SystemResult, WasmMsg,
attr, wasm_execute, wasm_instantiate, AnyMsg, Attribute, BankMsg, ContractResult, CosmosMsg,
CustomMsg, Empty, Event, QueryResponse, Reply, ReplyOn, Response, SubMsg, SubMsgResponse,
SubMsgResult, SystemResult, WasmMsg,
};
#[cfg(feature = "staking")]
pub use crate::results::{DistributionMsg, StakingMsg};
Expand Down
Loading
Loading