konoha icon indicating copy to clipboard operation
konoha copied to clipboard

Safe upgrades: Add healthcheck function and call it when upgrading a contract

Open ondrejsojka opened this issue 1 year ago • 4 comments

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).

ondrejsojka avatar Jul 22 '24 15:07 ondrejsojka

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.

scobi7 avatar Aug 01 '24 20:08 scobi7

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.

scobi7 avatar Aug 05 '24 10:08 scobi7

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.)

scobi7 avatar Aug 06 '24 10:08 scobi7

Can you open a pull request?

ondrejsojka avatar Aug 06 '24 10:08 ondrejsojka