Skip to content

Commit

Permalink
Merge pull request #1942 from CosmWasm/1779-remove-default-ibc-receiv…
Browse files Browse the repository at this point in the history
…e-response

Remove `Default` impl for `IbcReceiveResponse`
  • Loading branch information
chipshort authored Nov 9, 2023
2 parents ab9dff9 + 6c6159d commit cf25c49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ and this project adheres to
`ConversionOverflowError` and `DivideByZeroError`. ([#1896])
- cosmwasm-std: Remove old IBC version and make v3 the default. ([#1875])
- cosmwasm-storage: Removed, use [cw-storage-plus] instead. ([#1936])
- cosmwasm-std: Remove `IbcReceiveResponse`'s `Default` implementation. Use
`IbcReceiveResponse::new` instead. ([#1942])

[cw-storage-plus]: https://github.com/CosmWasm/cw-storage-plus
[#1875]: https://github.com/CosmWasm/cosmwasm/pull/1875
[#1890]: https://github.com/CosmWasm/cosmwasm/pull/1890
[#1896]: https://github.com/CosmWasm/cosmwasm/pull/1896
[#1936]: https://github.com/CosmWasm/cosmwasm/pull/1936
[#1942]: https://github.com/CosmWasm/cosmwasm/pull/1942

## [1.5.0] - 2023-10-31

Expand Down
11 changes: 7 additions & 4 deletions MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,15 @@ major releases of `cosmwasm`. Note that you can also view the
+const item: Item<Uint128> = Item::new("item");
```

- Replace all uses of `IbcReceiveResponse::set_ack` with calls to
`IbcReceiveResponse::new`:
- Replace all uses of `IbcReceiveResponse::set_ack` and
`IbcReceiveResponse::default` with calls to `IbcReceiveResponse::new`:

```diff
- Ok(IbcReceiveResponse::new().set_ack(b"{}"))
+ Ok(IbcReceiveResponse::new(b"{}"))
-Ok(IbcReceiveResponse::new().set_ack(b"{}"))
+Ok(IbcReceiveResponse::new(b"{}"))

-Ok(IbcReceiveResponse::default())
+Ok(IbcReceiveResponse::new(b""))
```

## 1.4.x -> 1.5.0
Expand Down
12 changes: 0 additions & 12 deletions packages/std/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,18 +623,6 @@ pub struct IbcReceiveResponse<T = Empty> {
pub events: Vec<Event>,
}

// Custom implementation in order to implement it for all `T`, even if `T` is not `Default`.
impl<T> Default for IbcReceiveResponse<T> {
fn default() -> Self {
IbcReceiveResponse {
acknowledgement: Binary::default(),
messages: vec![],
attributes: vec![],
events: vec![],
}
}
}

impl<T> IbcReceiveResponse<T> {
/// Create a new response with the given acknowledgement.
///
Expand Down

0 comments on commit cf25c49

Please sign in to comment.