New POC for Borrowing "non store" Child Objects from Parents#95
Draft
chrisgitiota wants to merge 3 commits into
Draft
New POC for Borrowing "non store" Child Objects from Parents#95chrisgitiota wants to merge 3 commits into
chrisgitiota wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
DON'T MERGE THIS PULL REQUEST
This PR is only a POC and will never be merged but may be the base for a future component
This PR provides a POC demonstrating how "non store" child Objects can be borrowed from Parent objects.
The POC main Move file is: borrow_non_store_obj_poc/sources/parent.move
The POC also introduces a
BorrowedChildenum which can be used to abstract away multiple types of child objects (not havingstoreability) that shall be borrowed from their parent objects where childs have been send to their parents as been described here. This pattern is needed in case multiple object types (child types), not havingstoreability, shall be borrowed by multiple object types (parent types).The
BorrowedChildenum helps to collect all child dependencies in theborrowed_childmodule so that parent object implementations only need to depend onborrowed_child.Motivation
The problem:
Pparent types andCchild types, allPparent modules would need to implement the child specific transfers, receives etc. forCchild types in their modules. This results inP*Calmost redundant implementations.Pparent modules would need to be extended accordingly.How
BorrowedChildsolves this:borrowed_childmodule.P*Cimplementations of child specific code, onlyBorrowedChildspecific code andBorrowedChildimplementation for theCchild types are neededborrowed_childmodule:BorrowedChildfrom parent moduleBorrowedChildinto child type and aPledge(hot potato) usingborrowed_childmodule functionsBorrowedChildusing child type specific functions provided by theborrowed_childmodule (Pledgewill be needed for this)BorrowedChildto the parentTo see the
borrow_non_store_obj_poc::parent::borrow_child()andborrow_non_store_obj_poc::parent::put_back()function in action, have a look into the testtest_borrow_child_and_put_back()in the borrow_non_store_obj_poc/tests/parent_tests.move file.Tests
The file
borrow_non_store_obj_poc/source/parent_tests.moveis used to test the implementation:Additionally the files
deploy.shandpoc.shin theborrow_non_store_obj_pocfolder can be used for tests using real networks as been described in the project README.md file.