Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
af6e388
Add migration guide from ink! 4.x to 5.0
cmichi Jan 24, 2024
abed487
Add Krest to compatible production chains
cmichi Jan 24, 2024
062b65d
Merge remote-tracking branch 'origin/master' into cmichi-add-migratio…
cmichi Jan 24, 2024
c90d2ba
Add screenshot of `cargo contract storage`
cmichi Jan 24, 2024
29980d7
Add steps to upgrade
cmichi Jan 25, 2024
95e84b1
Add breaking decode behavior change
cmichi Jan 25, 2024
1d6e623
Add note for `StorageVec`
cmichi Jan 25, 2024
1beaff2
Add note on support for multiple chain extensions
cmichi Jan 25, 2024
c39589e
Add note on stabilized `call_runtime`
cmichi Jan 25, 2024
0d4876a
Add note on chain extension syntax change
cmichi Jan 25, 2024
3a969d7
Move `StorageVec` section up
cmichi Jan 25, 2024
04125e5
Add note on new fallible methods
cmichi Jan 25, 2024
d314a0a
Move `StorageVec` and fallible methods to important section
cmichi Jan 25, 2024
d46d35b
Improve docs on fallible methods
cmichi Jan 25, 2024
7b37142
Improve `StorageVec` text
cmichi Jan 25, 2024
fecf707
Mention `non_fallible_api` lint
cmichi Jan 25, 2024
c55baa0
Update list of fallible `StorageVec` methods
cmichi Jan 25, 2024
95d2498
Update text on recommendations
cmichi Jan 29, 2024
b0c4455
Update section on chain extensions
cmichi Jan 29, 2024
9ff89d4
Mention contract verification
cmichi Jan 29, 2024
31309ed
Add note on fallible methods
cmichi Jan 29, 2024
48c822d
Apply suggestions from code review
Jan 30, 2024
47d2005
Explain reason for data migration better
cmichi Jan 30, 2024
4710bae
Move custom signature topics to Events 2.0
cmichi Jan 30, 2024
bd3f1a9
Added E2E builder API changes
cmichi Jan 30, 2024
b4e161f
Link to more infos about safe math in Rust
cmichi Jan 30, 2024
d69be1d
Improve text on safe math
cmichi Jan 30, 2024
2a7b82d
Clarify text
cmichi Jan 30, 2024
d550fba
Improve text
cmichi Jan 30, 2024
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
Prev Previous commit
Next Next commit
Update text on recommendations
  • Loading branch information
cmichi committed Jan 29, 2024
commit 95d249877a0f95c8ff0059fd6a7c1aef7b3f48c9
18 changes: 8 additions & 10 deletions versioned_docs/version-5.x/faq/migrating-from-ink-4-to-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,31 +282,29 @@ of the whole vector is limited by the size of [ink!'s static buffer](https://git
used during ABI encoding and decoding (default 16 KiB).
`StorageVec` on the other hand allows to access each element individually.

We recommend reviewing your uses of `Vec` and transition to `StorageVec`.
For most use cases this will make sense.

With a `Vec` it's possible to e.g. introduce a security issue in your contract
where an attacker can fill the `Vec`, making it very costly for other users to
access it or write to it.

You can find verbatim documentation on `StorageVec` [here](/5.x/datastructures/storagevec),
the Rust docs can be found [here](https://docs.rs/ink/5.0.0-rc/ink/storage/struct.StorageVec.html).
You can find verbatim documentation on `StorageVec` [here](/5.x/datastructures/storagevec).
The page explains when to use `StorageVec` and when not.
The Rust docs can be found [here](https://docs.rs/ink/5.0.0-rc/ink/storage/struct.StorageVec.html).

## We added fallible methods for `Lazy`, `Mapping`, `StorageVec`

In [#1910](https://github.com/paritytech/ink/pull/1910) we added `try_*` methods for
reading and writing `Lazy` and `Mapping` values to and from storage.
The try methods correspond to `Mapping::{insert, get, take}`, `Lazy::{set, get}`.

Please see the individual Rust docs for these new methods:

* [`StorageVec`](https://docs.rs/ink/5.0.0-rc/ink/storage/struct.StorageVec.html)
* [`Lazy`](https://docs.rs/ink/5.0.0-rc/ink/storage/struct.Lazy.html)
* [`Mapping`](https://docs.rs/ink/5.0.0-rc/ink/storage/struct.Mapping.html). For `Mapping`, the encoded size of the key is also accounted for.

We recommend transitioning usages of `Mapping::{insert, get, take}`, `Lazy::{set, get}`,
`StorageVec::{peek, get, set, pop, push}` to these new methods.
You will thereby be forced to think about how to handle failure cases that
can occur, but have so far not been reflected in the API.
Possible failure cases are described in the individual Rust docs.
You should use the `try_*` methods for dynamically sized values, unless you made sure
otherwise they will fit into the static buffer. The [static buffer in ink!](https://github.com/paritytech/ink/blob/master/ARCHITECTURE.md#communication-with-the-pallet)
is 16 kB by default.

We added a lint to `cargo-contract` 4.0 that will detect
potentially unsafe uses of methods for which there are safer alternatives:
Expand Down