Skip to content

Real-time smart contract storage auditor.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.md
MIT
LICENSE-MIT.md
Notifications You must be signed in to change notification settings

0xPolygon/storage-delta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

117bf04 Β· Jan 11, 2024

History

49 Commits
Dec 12, 2023
Dec 2, 2023
Nov 30, 2023
Nov 30, 2023
Dec 7, 2023
Dec 7, 2023
Dec 7, 2023
Jan 11, 2024
Jan 11, 2024
Dec 12, 2023
Dec 12, 2023
Jan 11, 2024

Repository files navigation

⟁ Storage Delta

Storage Delta is a tool for auditing storage layout changes during contract upgrades.

Demo

Install

Powered by Foundry.

forge install 0xPolygon/storage-delta

Run

Storage Delta analyzes the entire contract suite against any previous version.

bash lib/storage-delta/run.sh <COMMIT_OR_TAG>

./storage_delta will be generated if there are findings. Open OLD and NEW files side by side for the best experience.

Detectors

Description
🌱 New
🏴 Problematic
🏳️ Moved
🏁 Moved & problematic
πŸͺ¦ Removed
Dirty bytes

New

When a variable with a unique name and type is added.

    uint256 a
    uint256 a
🌱  bool b

Problematic

When a new variable is added, but conflicts with the existing storage.

    uint256 a
🏴  bool b

Moved

When an existing variable is moved.

    uint256 a
    ...
    ...
🏳️  uint256 a

Moved & problematic

When an existing variable is moved and conflicts with the existing storage.

    uint256 a
    bool b
🏁  bool b
🏁  uint256 a

Removed

When a variable no longer exists.

    uint256 a
    bool b
    uint256 a
πŸͺ¦

Dirty bytes

When the storage is not clean.

    uint256 a
🏴  uint128 a
    16 dirty bytes

Configuration

Option Values Description
--omit new Do not generate a report with only those findings.

Requirements

Files should be named after the contract they hold. Example β†’ Example.sol

The script utilizes Node.js to run. We recommend the node version defined in the .nvmrc file.

License

​ Licensed under either of ​

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


Β© 2023 PT Services DMCC