answer for your questions about storage field key generation using AutoKey and ManualKey in the context of upgradable contracts.
1 - Does the use of ManualKey in some storage fields impact the keys generated by AutoKey for the rest of the fields?
No, using ManualKey in some storage fields does not impact the keys generated by AutoKey for the rest of the fields. AutoKey generates sequential integer keys starting from 0, regardless of whether some fields use ManualKey or not. So, you can use ManualKey for some fields and AutoKey for others without any issues.
2 - Can the change in the ordering of the fields which uses ManualKey impact the fields (keys) generated by AutoKey?
No, the ordering of the fields that use ManualKey does not impact the keys generated by AutoKey. AutoKey generates keys sequentially based on the number of storage fields, regardless of their order or the use of ManualKey.
3 - Should we use ManualKey for every storage field in the case of upgradable contracts?
It depends on your use case. ManualKey can be useful for controlling the storage key of a specific field, which can be important for upgradable contracts. However, using ManualKey for every storage field may not always be necessary or efficient.
3a - If so does that imply that each field will be loaded lazily? and does this result in higher read/write overhead?
Yes, if you use Lazy storage for fields that use ManualKey, it implies that those fields will be loaded lazily, which can result in higher read/write overhead. However, if you don't use Lazy storage, the field will be eagerly loaded.
4 - Can the use of sequentially numbered ManualKeys cause collisions?
Yes, if you use sequentially numbered ManualKeys for multiple fields, it can cause collisions. It's important to ensure that each ManualKey value is unique within the storage struct.
Here are some things to keep in mind while using ManualKey for upgradable contracts:
Make sure to choose unique values for each ManualKey to avoid collisions.
Using Lazy storage for fields that use ManualKey can result in higher read/write overhead.
Be mindful of the storage size and cost when choosing ManualKey values.
If you plan on upgrading the contract, be sure to consider the impact on storage layout and key generation when making changes to the storage struct.