centrifuge / centrifuge-chain

Centrifuge Chain: the layer-1 blockchain for real-world assets, built on Substrate.
https://centrifuge.io
GNU Lesser General Public License v3.0
184 stars 81 forks source link

Feat: Add `try_state` invariants to pallets #1846

Open wischli opened 6 months ago

wischli commented 6 months ago

Description

So far, we have not made use of the try_state hooks which are part of the try-runtime feature. It provides checks which should ensure that the state of the pallet is consistent and correct. Usually, these checks should check all of the invariants that are expected to be held on all of the storage items of some particular pallet. This hook should not alter any storage though.

This issue should serve as an entry point and only be closed once we have try_state implemented for all pallets or decided certain pallets don't need it.

Research/based on

How will this affect the code base

What are foreseen obstacles or hurdles to overcome?

lemunozm commented 6 months ago

Love it!

I think can be quite useful for pallet-loans, checking that i.e. the portfolio can be correctly computed after a migration