aptos-core
aptos-core copied to clipboard
[move] Decouple APIs for resource and code storage
Description
This PR removes MoveResolver
so that resource and code storage is not coupled under the same trait with the same lifetime. In particular, for loading of modules, functions, types one needs to pass the module resolver which will be used to fetch code from storage. Transaction data cache stores only resource resolver, and is not responsible for anything code related (Note: it still is somewhat because we store compiled script and module caches there, these will go away with the new code cache).
Moreover, APIs for ModuleResolver
(to be renamed into ModuleStorage
) and TModuleView
(renamed into AptosModuleStorage
) are changed, so that we can fetch size, bytes, deserialized representation, dependencies & friends directly. This allows us to cache deserialization inside MVHashMap for modules. Note that we DO NOT HAVE AptosModuleStorage: ModuleStorage
yet, because this requires implementing an adapter for state view, which can be done in a separate PR.
Modules are now stored not as WriteOp
s, but as structs which contain more information about serialized and deserialized data. This allows us to avoid duplicate deserializer calls.
Type of Change
- [x] New feature
- [ ] Bug fix
- [ ] Breaking change
- [ ] Performance improvement
- [x] Refactoring
- [ ] Dependency update
- [ ] Documentation update
- [ ] Tests
Which Components or Systems Does This Change Impact?
- [ ] Validator Node
- [ ] Full Node (API, Indexer, etc.)
- [x] Move/Aptos Virtual Machine
- [ ] Aptos Framework
- [ ] Aptos CLI/SDK
- [ ] Developer Infrastructure
- [ ] Other (specify)
How Has This Been Tested?
Key Areas to Review
Checklist
- [ ] I have read and followed the CONTRIBUTING doc
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I identified and added all stakeholders and component owners affected by this change as reviewers
- [ ] I tested both happy and unhappy path of the functionality
- [ ] I have made corresponding changes to the documentation