Improve native contract update mechanism
AnnaShaleva opened this issue · comments
Summary or problem description
Native contract update mechanism introduced in #2942 allows to enable new methods and events starting from some hardfork, and it's good. However, we're missing the following functionality:
- update method's signature (change the parameters name, add/remove parameters from method) without introducing new method
- update event's name or parameter list starting from some hardfork
- exclude method/event starting from some hardfork
- destroy native contract
Without this functionality implemented, changes like #3209 will inevitably require node resync, so we consider this functionality a useful one.
Do you have any solution you want to propose?
Almost all cases may be solved with ActiveTill
field added to the native contract/method/event. The handler logic for this field should be similar to the logic of the following fields (with single adjustment: ActiveTill
prevents contract/method/event from being active):
Another option was suggested by @roman-khimov (correct me, if I'm wrong, please): we may have a set of separate classes for every version of native contract. Starting from every hardfork, a specific version of the contract should be used (if specified).
Where in the software does this update applies to?
- Native contracts
I think that we can add it when needed
A part of this issue (methods' "active till") is implemented in the #3234. We need to implement events' "active till" (ref. #3234 (comment)) and improve ContractMethodAttribute constructor (ref. #3234 (comment)).