-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(core): Guarantee system accounts existence for programs #3961
Conversation
53c13ff
to
255c089
Compare
84c4177
to
7cf1ad5
Compare
Seems ready to be reviewed once fixed benches? |
Yes, pretty much. |
4f41138
to
989e2fe
Compare
…f insufficient value in transfers
989e2fe
to
e196360
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
merge master @ekovalev ? |
@breathx final thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests to be re-reviewed once applied suggested changes
otherwise well done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im only worried now about match error branches and panics. Otherwise seems awesome 👍🏻 great job
@techraed kindly asking you to double check the changes and my comments above |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
I remember we agreed to use locks and to introduce integrational test, which tests that underlying Currency
implementor locks & account existence invariants works as expected.
So, could you, please, introduce the test in this PR?
Resolves #3924.
The idea is to separate the notion of value ownership/transfer by actors in Actor space from the underlying system accounts management level (e.g. Substrate's frame-system and balances pallets).
Programs (a.k.a. actors) should not care about their "wallets" implementation details and whether or not they require things like existential deposits to stay alive or have to respect limits on transferred value amounts imposed by the system level. Instead, the protocol must guarantee an invariant that for any active program there always is an account able to store any amount of value at any point throughout the program's lifetime.
This change, once implemented, renders useless numerous checks of a value validity in balances transfers - any value should be valid for a transfer and not cause program's account removal.
Specifically, the PR implements:
Gear::upload_program
andGear::create_program
extrinsicsgr_create_program
syscall (by decrementing the value counter) and further actual transfer of the ED inJournalNote::StoreNewPrograms
handlergr_exit
syscall (program deactivation)check_value
) in all send-like extrinsics and all backend send-like syscallscore-processor/ext
unit tests)Existence::AllowDeath
requirements (since the platform guarantees the account will not die as long as the program remains in active state)