code-423n4 / 2021-12-mellow-findings

0 stars 0 forks source link

Skip initialization of factory address in vault governance by predicting it before hand #127

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

0x421f

Vulnerability details

If I understand correctly vaultGov needs factory address and factory needs vaultGov so right now from deployment script flow is deploy vaultGov deploy factory (vaultGov address) Initilize in vaultGov (factory address)

we can avoid this 3rd step, by predicting address of factory before deployment using signer and nonce this is fair, as this are deployed only once and by protocol itself

This is going to save gas cost for 1 tx per type of vault (1 * 5) and gas cost for checking this require(initialized, ExceptionsLibrary.INITIALIZATION); in each deployVault of vault governance