Skip to content

Improve native contract update mechanism #3210

@AnnaShaleva

Description

@AnnaShaleva

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):

public virtual Hardfork? ActiveIn { get; } = null;

public Hardfork? ActiveIn { get; init; } = null;

public Hardfork? ActiveIn { get; init; } = null;

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionInitial issue state - proposed but not yet acceptedEnhancementType - Changes that may affect performance, usability or add new features to existing modules.P1High Priority: Targeting The Next Release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions