Near-One / near-plugins

Implementation of common patterns used for NEAR smart contracts.
Creative Commons Zero v1.0 Universal
27 stars 12 forks source link

ACL: Remove `__acl` field #84

Closed karim-en closed 1 year ago

karim-en commented 1 year ago

Currently, the ACL plugins can't be added to already deployed contracts without migration due to the __acl field. This pull request removes the __acl field and uses the storage key instead.

Added internal/private API:

fn acl_get_storage(&self) -> Option<#acl_type>
fn acl_get_or_init(&mut self) -> #acl_type
fn acl_init_storage_unchecked(&mut self)
karim-en commented 1 year ago

https://github.com/aurora-is-near/near-plugins/pull/84#pullrequestreview-1315085648

@mooori @birchmd

Personally, I prefer panic instead of returning default values because normally it shouldn't panic if the contract was implemented correctly, so it indicates there is some bug in the initialization or migration code.

But anyway I've implemented this proposal 35635bc6e6e4c9ec7fcf4383ab9d183034809ff0, to be able to merge this pull request asap.