-
Notifications
You must be signed in to change notification settings - Fork 431
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
Replace Mapping::insert_return_size
with Mapping::insert
#1463
Conversation
Please give more context in the PR description e.g. "we added a new method to make it non-breaking, now we are doing 4.0 so we can make the breaking change" (it's what I assume the reasoning to be). Also links to relevant PRs are useful #1224 |
Codecov Report
@@ Coverage Diff @@
## master #1463 +/- ##
===========================================
+ Coverage 46.97% 63.96% +16.98%
===========================================
Files 201 201
Lines 6210 6210
===========================================
+ Hits 2917 3972 +1055
+ Misses 3293 2238 -1055
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Please add this to the Unreleased
section of CHANGELOG.md
before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks, but looks good.
Can you update the PR description to include Mapping::insert_return_size
in some way? Will make it easier to tell what actually got removed
CHANGELOG.md
Outdated
### Changed | ||
- Update `scale-info` requirement to `2.3` ‒ [#1467](https://github.com/paritytech/ink/pull/1467) | ||
|
||
### Removed | ||
- Remove `ink_env::random` function ‒ [#1442](https://github.com/paritytech/ink/pull/1442) | ||
- Remove previous insert `Mapping::insert(key, val)` method and replace by `Mapping::insert_return_size(key, val)` behaviour but under the same method name insert - [#1463](https://github.com/paritytech/ink/pull/1463) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap this to ~100 chars?
/// Insert the given `value` to the contract storage. | ||
/// | ||
/// Returns the size of the pre-existing value at the specified key if any. | ||
#[inline] | ||
pub fn insert_return_size<Q, R>(&mut self, key: Q, value: &R) -> Option<u32> | ||
pub fn insert<Q, R>(&mut self, key: Q, value: &R) -> Option<u32> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the docs can you also specify the returned size is in bytes?
Mapping::insert_return_size
with Mapping::insert
In the wake of this last change #1224 (comment) where Mapping::insert_return_size was added to make it non-breaking, this method would replace the current insert one for the release 4.0.
More precisely, the method
fn Mapping::insert_return_size(key, val) -> Option<u32>;
was merged into the methodfn Mapping::insert(key, val);