What is a sufficient test suite to rely on a contract's upgradeability status?

Context

Hello all :hand_with_fingers_splayed: I'm converting my existing smart contracts to be upgradeable. The process seems fairly straight-forward. However, I can't tell when I can say "this set of smart contracts upgradeable".

My Setup

I deploy (and upgrade) my contracts using openzeppelin-foundry-upgrades framework. I use openzeppelin-contracts-upgradeable for OZ dependencies. I use `onlyInitializing` from `Initializable` in my initializer functions. Also, I use namespaced storage layout for all storage variables including state variables (they live in structs as well) with `uint256[50] __gap` padded.

Tests

I can see two main types of upgrade;

  • only impacts behavior, leaves storage untouched
  • impacts storage (behavior is probably impacted due to new storage layout)

I already tested behavioral change by adding new events, new methods and changing existing implementations. What's left is to test storage changes. The plan is;

  • to deprecate some storage variables in a chosen struct
  • add new variables to the same struct
  • update `__gap` accordingly
  • execute the mapping from old struct to the new one in the upgrade initializer

Question

Are there other critical processes I need to test before I can put my confidence in the contracts and say they are truly "upgradeable" ? Anything else I'm missing?

Thanks.

Hey @ericglau ,

Looking forward to hearing your opinions/suggestions about this :folded_hands: