-
Notifications
You must be signed in to change notification settings - Fork 1k
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
OnPersist semantics for native contracts #1913
Comments
Also relevant for |
I am up for the first solution (calling it for all contracts). In |
Solved by #2119. |
Every contract now has these and they're always invoked. See neo-project/neo#1913 and neo-project/neo#2119.
Summary or problem description
#751 has brought with it a new method for native contracts,
OnPersist
, and added a call to it into persisting logic. It did so with an explicit whitelist of contracts to call this method for, back then it included all existing contracts. Later (with #758) a Policy contract was added, but it wasn't included in this list as it has no actions required to do when persisting a block.Policy contract technically still has an
OnPersist
method inherited fromNativeContract
that is visible in its manifest. And supposedly any new native contract will have it too, but at the same time it won't automatically be called when persisting a block which makes it a little unclear what was the real intention here.Do you have any solution you want to propose?
If we want all native contracts to have
OnPersist
that would be called when persisting a block then this method should be called for all of them (iterating overNativeContract.Contracts
probably, instead of explicit whitelist).If we don't expect all contracts to have
OnPersist
, then it shouldn't be present in theNativeContract
class, this way Policy won't have it in the manifest and we can actually make a decision on whether to callOnPersist
for a contract or not based on its manifest (which either will have it or not).In any event, I expect all native contracts to be treated the same way wrt this method, whitelisting shouldn't be used if it's a generic native contract feature.
Neo Version
Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: