Safe upgrades: Add healthcheck function and call it when upgrading a contract
Checking that an upgrade is correct and is compatible with the currently deployed governance state. This will check that for example AMM contract is being upgraded with an AMM contract and not by a token contract.
Generic governance upgrades are inherently risky, because it’s an upgrade of the contract itself. Before application of a passed generic proposal, a test will be run that library calls a health check function on the governance (or core protocol, governance token,...) contract to ensure that it’s truly a contract of the same type (of version higher than current to ensure no incompatibilities).
Aug 1st - wrote a check_if_healthy function and am currently testing it. Not fully functioning but fix should be easy.
Also side note, I'm using the old staking curve and functions to test because the old staking curve functions were used in proposals and its easier to test this way.
Only issue at the moment is figuring out how to call check_if_healthy on the separate testing file. I am not sure that the tests are correctly calling it, but I've tested with hard coding and it works.
Checks are working correctly, I'm just having some weird contract deployment error iff it returns false. (Requested contract address ContractAddress(PatriciaKey(StarkFelt("0x0000000000000000000000000000000000000000000000000000000000000000"))) is not deployed.)
Can you open a pull request?