diff --git a/CHANGELOG.md b/CHANGELOG.md index 942f21a987..0278d0630c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ and this project adheres to - all: Change the encoding of the key/value region of the `db_next` import to a more generic encoding that supports an arbitrary number of sections. This encoding can then be reused for other multi value regions. +- all: Remove the `info: MessageInfo` argument from the `migrate` entry point + ([#690]). - cosmwasm-std: Remove `from_address` from `BankMsg::Send`, as it always sends from the contract address, and this is consistent with other `CosmosMsg` variants. @@ -65,6 +67,7 @@ and this project adheres to [#696]: https://github.com/CosmWasm/cosmwasm/issues/696 [#697]: https://github.com/CosmWasm/cosmwasm/issues/697 [#736]: https://github.com/CosmWasm/cosmwasm/pull/736 +[#690]: https://github.com/CosmWasm/cosmwasm/issues/690 ## [0.13.2] - 2021-01-14 diff --git a/MIGRATING.md b/MIGRATING.md index b0ea2a2c1e..153daba3dd 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -116,6 +116,34 @@ major releases of `cosmwasm`. Note that you can also view the } ``` +- Remove the `info: MessageInfo` field from the `migrate` entry point: + + ```rust + // Before + pub fn migrate( + deps: DepsMut, + env: Env, + _info: MessageInfo, + msg: MigrateMsg, + ) -> StdResult { + // ... + } + + // After + pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> StdResult { + // ... + } + ``` + + `MessageInfo::sent_funds` was always empty since [MsgMigrateContract] does not + have a funds field. `MessageInfo::sender` should not be needed for + authentication because the chain checks permissions before calling `migrate`. + If the sender's address is needed for anything else, this should be expressed + as part of the migrate message. + + [msgmigratecontract]: + https://github.com/CosmWasm/wasmd/blob/v0.15.0/x/wasm/internal/types/tx.proto#L86-L96 + ## 0.12 -> 0.13 - The minimum Rust supported version for 0.13 is 1.47.0. diff --git a/packages/std/schema/message_info.json b/packages/std/schema/message_info.json index 3251ebf048..ce8b070bd5 100644 --- a/packages/std/schema/message_info.json +++ b/packages/std/schema/message_info.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "MessageInfo", - "description": "MessageInfo is sent with `init`, `handle`, and `migrate` calls, but not with queries. It contains the essential info for authorization - identity of the call, and payment", + "description": "Additional information from [MsgInstantiateContract] and [MsgExecuteContract], which is passed along with the contract execution message into the `init` and `handle` entry points.\n\nIt contains the essential info for authorization - identity of the call, and payment.\n\n[MsgInstantiateContract]: https://github.com/CosmWasm/wasmd/blob/v0.15.0/x/wasm/internal/types/tx.proto#L47-L61 [MsgExecuteContract]: https://github.com/CosmWasm/wasmd/blob/v0.15.0/x/wasm/internal/types/tx.proto#L68-L78", "type": "object", "required": [ "sender", @@ -9,7 +9,7 @@ ], "properties": { "sender": { - "description": "The `sender` field from the `wasm/MsgStoreCode`, `wasm/MsgInstantiateContract`, `wasm/MsgMigrateContract` or `wasm/MsgExecuteContract` message. You can think of this as the address that initiated the action (i.e. the message). What that means exactly heavily depends on the application.\n\nThe x/wasm module ensures that the sender address signed the transaction. Additional signers of the transaction that are either needed for other messages or contain unnecessary signatures are not propagated into the contract.\n\nThere is a discussion to open up this field to multiple initiators, which you're welcome to join if you have a specific need for that feature: https://github.com/CosmWasm/cosmwasm/issues/293", + "description": "The `sender` field from `MsgInstantiateContract` and `MsgExecuteContract`. You can think of this as the address that initiated the action (i.e. the message). What that means exactly heavily depends on the application.\n\nThe x/wasm module ensures that the sender address signed the transaction or is otherwise authorized to send the message.\n\nAdditional signers of the transaction that are either needed for other messages or contain unnecessary signatures are not propagated into the contract.", "allOf": [ { "$ref": "#/definitions/HumanAddr" diff --git a/packages/std/src/types.rs b/packages/std/src/types.rs index 6d3f604981..d169dd155c 100644 --- a/packages/std/src/types.rs +++ b/packages/std/src/types.rs @@ -64,21 +64,24 @@ pub struct BlockInfo { pub chain_id: String, } -/// MessageInfo is sent with `init`, `handle`, and `migrate` calls, but not with queries. -/// It contains the essential info for authorization - identity of the call, and payment +/// Additional information from [MsgInstantiateContract] and [MsgExecuteContract], which is passed +/// along with the contract execution message into the `init` and `handle` entry points. +/// +/// It contains the essential info for authorization - identity of the call, and payment. +/// +/// [MsgInstantiateContract]: https://github.com/CosmWasm/wasmd/blob/v0.15.0/x/wasm/internal/types/tx.proto#L47-L61 +/// [MsgExecuteContract]: https://github.com/CosmWasm/wasmd/blob/v0.15.0/x/wasm/internal/types/tx.proto#L68-L78 #[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, JsonSchema)] pub struct MessageInfo { - /// The `sender` field from the `wasm/MsgStoreCode`, `wasm/MsgInstantiateContract`, `wasm/MsgMigrateContract` - /// or `wasm/MsgExecuteContract` message. + /// The `sender` field from `MsgInstantiateContract` and `MsgExecuteContract`. /// You can think of this as the address that initiated the action (i.e. the message). What that /// means exactly heavily depends on the application. /// - /// The x/wasm module ensures that the sender address signed the transaction. + /// The x/wasm module ensures that the sender address signed the transaction or + /// is otherwise authorized to send the message. + /// /// Additional signers of the transaction that are either needed for other messages or contain unnecessary /// signatures are not propagated into the contract. - /// - /// There is a discussion to open up this field to multiple initiators, which you're welcome to join - /// if you have a specific need for that feature: https://github.com/CosmWasm/cosmwasm/issues/293 pub sender: HumanAddr, pub sent_funds: Vec, }