This repository has been archived by the owner on May 4, 2024. It is now read-only.
[Feature Request] Introduce verifier annotation, such as private_generics #1043
Labels
enhancement
New feature or request
🚀 Feature Request
Motivation
In Move, the verifier ensures that the generic parameters of the global storage instructions must be defined in the caller's module.
Such as
move_to<T>|move_from<T>|borrow_global<T>|borrow_global_mut<T>
The type
T
must be defined in the caller's current module.The move developer also needs this feature to restrict the function's generic type. Still, this feature is hardcode in the verifier, and the developer can not use this feature for their function.
So, if we introduce some verifier annotation, we can provide this feature to the developer.
Pitch
Describe the solution you'd like
#[private_generics(T)]
, indicating the function's generic parameterT
is private, which requires the same restriction toT
as global storage instructions.UseCase
#140 The TypeTable also requires this feature to ensure Type Safety.
bcs::from_bytes
As described in the issue(rooch-network/rooch#145) mentioned, relying on
private_generics
alone cannot guarantee type safety. We need two other annotations,#[self_struct]
and#[require_self_struct(T)]
. The name for the annotations is yet to be determined.T
must have#[self_struct]
annotation.Are you willing to open a pull request? (See CONTRIBUTING)
Yes
Additional context
The text was updated successfully, but these errors were encountered: