Skip to content

Commit

Permalink
📝 Delete arrays, might add later.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfps committed May 18, 2024
1 parent 0142b3a commit 35f95e3
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@ more than enough to fit into the next slot, then, we can load the next storage l

## General `<type>[]` Deduction.

Once the concept of type storages is understood, you can use that to figure out how the array versions of that type
will be stored.
Once the concept of type storages is understood, you can use that to figure out how the array versions of that type will be stored.

You can use the knowledge of arrays to write to any array index, or read from an array index.
To retrieve an element from a packed array is quite tricky and is not readily advised.

To retrieve an element from a packed array is quite trick and is not readily advised.

> 🚨 The use of Yul to read and write arrays is not advised. It is a very tricky business.
> 🚨 The use of Yul to read and write arrays is not advised. It is a very tricky business, considering the fact that small types are packed and large types occupy one slot, it is a whole new level of stress to take in packing, and other considerations while storing values into an array from Yul. Allow Solidity to handle the intricacies for you.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ contract Yul {
}
```

> 🚨 Due to the tricky nature of the storage of `int[n]` types, apply more care when storing and manipulating values from storage.
> 🚨 Due to the tricky nature of the storage of `int[n]` types, apply more care when storing and manipulating values from storage.
> 🚨 Do not store negative `int[n]` values directly from your Yul block of code, Yul treats it as a `uint[n]` type overflow, meaning that `-1` will be converted to `(2^256) - 1`. This can lead to security breaches.

0 comments on commit 35f95e3

Please sign in to comment.