You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In contracts/CapabilityFactory.cdc:17, the function addFactory() doesn’t check if the type that is being added already exists or not. If the type to be added already exists, it may be overwritten by mistake.
Recommendation
We recommend implementing a updateFactory() function which allows updating existing factory types and modifying the addFactory() function only to accept new types. Alternatively, we recommend documenting the intended behavior of the function to educate developers.
The text was updated successfully, but these errors were encountered:
Closes: #73
Coverage: 75.6%
Added pre condition to `Manager.addFactory()` to prevent overwriting
existing factories. Also added `Manager.updateFactory()` which
overwrites Factories on given Type, and adds if it didn't already exist.
The thought here is that the behavior is more explicit and provides a
safer method to add new Factory types depending on developer preference,
but open to feedback on this behavior.
Also added comments to CapabilityFactory contract.
Last note, I added a delimiter `'_'` to derived canonical paths between
the prefix and deployment Address. I thought this would make it easier
to split the strings should the need arise.
Description
Recommendation
The text was updated successfully, but these errors were encountered: