Closed enitrat closed 1 month ago
But why is that an issue specifically? it is the decision of the contract writer to know they only are reading valid values.
adding a diagnostic now may even be more confusing - even possibly marking any of the existing keys as #[default]
causing a storage layout change.
(not saying no - just want to make sure the cure is better than the disease)
it is the decision of the contract writer to know they only are reading valid values.
I consider it an issue because I don't think reading a value from storage should default to a panic if that value is not set. By ensuring a default variant exists, you are leveraging the compiler so that:
None
variant that fulfills this role.
I think enums without a default variant should throw an error at compile time if they try to derive
starknet::Store
- otherwise, attempting a storage read on an uninitialized slot will cause a runtime panic.See description in https://github.com/cairo-book/cairo-book/issues/990