Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hardhat-storage-layout-changes

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardhat-storage-layout-changes

Hardhat plugin to check for storage layout changes

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
468
increased by8.08%
Maintainers
1
Weekly downloads
 
Created
Source

hardhat-storage-layout-changes

Hardhat plugin to check for storage layout changes

What

When working with complex and upgradable contracts, it can be difficult to manually see whether some solidity changes broke the storage layout or not. A mistake can cause undefined behavior in deployed contracts. This plugin aims to help notice any storage layout breakings while dev works on solidity changes.

Installation

npm install hardhat-storage-layout-changes

Import the plugin in your hardhat.config.js:

require("hardhat-storage-layout-changes");

Or if you are using TypeScript, in your hardhat.config.ts:

import "hardhat-storage-layout-changes";

Tasks

This plugin adds the storage-layout task to Hardhat:

Usage: hardhat [GLOBAL OPTIONS] storage-layout [--check] [--update]

OPTIONS:

  --check       Checks if storage layout has changed
  --update      Updates storage layout artifact

Configuration

This plugin extends the HardhatUserConfig's ProjectPathsUserConfig object with an optional storageLayouts field and also adds a storageLayoutConfig.

This is an example of how to set it:

module.exports = {
  paths: {
    storageLayouts: ".storage-layouts",
  },
  storageLayoutConfig: {
    contracts: ["Pool"],
    fullPath: false
  };
};

Usage

npx hardhat storage-layout --check

Contract: Pool
   "accounts": at same location
         "user": at same location
         "balance": at same location
   "owner": changed slot from 1 to 2
   "lastUpdate": found new storage entry at slot 1 offset 0
   "owner": found new storage entry at slot 2 offset 0

Error: Storage Layout Changed. If this was intentional, please update the storage layout files using "npx hardhat storage-layout --update".

npx hardhat storage-layout --update

Contract: Pool
updating Pool.json

Keywords

FAQs

Package last updated on 11 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc