EIP-2535 Diamonds

Share this post
Common Diamond Errors
eip2535diamonds.substack.com

Common Diamond Errors

Nick Mudge šŸ’Ž
Nov 5, 2021
3
Share this post
Common Diamond Errors
eip2535diamonds.substack.com

1. A state variable in AppStorage has the wrong value

A state variable in AppStorage has the wrong value or the value 0 when it should not. This is caused by declaring state variables outside AppStorage and Diamond Storage which causes a misalignment of data. This error is commonly caused by a facet inheriting a contract that declares state variables outside AppStorage and Diamond Storage.

The solution is to remove any declarations of state variables outside AppStorage or Diamond Storage and put them in AppStorage or Diamond Storage.

2. Can't add function that already exists

This error is caused by trying to add a function to a diamond that already exists.

You can see what functions are in a diamond by using the ABI of the diamond with the loupe functions. The `diamondCut` function allows a function to be replaced if it already exists but does not allow a function to be added if it already exists.

3. ProviderError: VM Exception while processing transaction: revert

This error can happen when calling the diamondCut function to add many functions and not enough gas is used. This can be solved by increasing the amount of gas for the transaction. If using ethersjs then checkout the ā€œgasLimitā€ override.

Share this post
Common Diamond Errors
eip2535diamonds.substack.com
Comments

Create your profile

0 subscriptions will be displayed on your profile (edit)

Skip for now

Only paid subscribers can comment on this post

Already a paid subscriber? Sign in

Check your email

For your security, we need to re-authenticate you.

Click the link we sent to , or click here to sign in.

TopNewCommunity

No posts

Ready for more?

Ā© 2022 Nick Mudge šŸ’Ž aavegotchi
Privacy āˆ™ Terms āˆ™ Collection notice
Publish on Substack Get the app
SubstackĀ is the home for great writing