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
[compiler v2] Resource access control (read-write sets) (aptos-labs#10480)
* [compiler v2] Resource access control (read-write sets)
This is an e2e implementation of resource access control for Move, with most parts in place:
- Replaces the acquires syntax in a downwards-compatible way
- The extended syntax is only available in compiler v2
- One can now specify `acquires`, `reads`, and `writes`
- One can specify the address of a resource in dependency of parameters
- Multiple levels of wildcards are allowed, e.g. `acquires *(object::address_of(param))` specifies that all resources at the given address are read or written.
- Implements parsing->expansion->move model->file format generator
- Extends `file_format::FunctionHandle` to carry the new information, introducing bytecode version v7. v7 became the new experimental version only available in test code for now.
- TODO: dynamic runtime checking of resource access. Static analysis is also on the horizon, but not needed for an MVP of this feature.
- TODO: bytecode verification of access specifiers
An AIP for this new feature will be filed soon.
As an example, here is some extract from the tests:
```move
module 0x42::m {
struct S has store {}
struct R has store {}
struct T has store {}
struct G<T> has store {}
fun f1() acquires S {
}
fun f2() reads S {
}
fun f3() writes S {
}
fun f4() acquires S(*) {
}
fun f_multiple() acquires R reads R writes T, S reads G<u64> {
}
fun f5() acquires 0x42::*::* {
}
fun f6() acquires 0x42::m::R {
}
fun f7() acquires *(*) {
}
fun f8() acquires *(0x42) {
}
fun f9(a: address) acquires *(a) {
}
fun f10(x: u64) acquires *(make_up_address(x)) {
}
fun make_up_address(x: u64): address {
@0x42
}
}
```
* Addressing reviewer comments
* Addressing reviewer comments #2
* Addressing reviewer comments aptos-labs#3
* Addressing reviewer comments aptos-labs#4
* Reviewer comments aptos-labs#5
0 commit comments