VersionField

https://github.com/zcom-cloud-blockchain/solidity/blob/master/contracts/VersionField.sol

Overview

This is the parent class of the class that holds the field part of the target contract.

VersionField

It holds the addresses of the previous and current versions and supports seamless version upgrade of the data group registered with the old version at the time of version upgrade.

Subclass implementation policies

  • Controlling caller access

    Each Field implementation must control caller access using ContractNameService#isVersionLogic ().

    (In the above diagram, it is necessary to restrict callers to the Logic for contracts registered as "Someone" to the CNS.)

  • Contract inheritance policy

    When upgrading to the next version do not extend from the previous version.

    This is to deal with the problem of logic enlargement due to inheritance. Each version should be separate to reduce the size of individual contracts.

  • Preparation of accessor (getter/setter)

    If you need to access data after upgrading in the future, you will not be able to do this without accessors.

    Since the accessors are limited to trusted Logic classes, when implementing a Field contract, prepare accessors for all fields from the beginning.

  • Version upgrade support

    For upgraded versions, when accessing each field, it is necessary to check whether the data of the target ID is data from a previous version.

    In the case of getters, it is necessary to implement return logic for default values, and in the case of setters, upgrade handling (setting of default value for fields (like age, someField above) added by version upgrade etc.) should be implemented.

Reference implementation class

results matching ""

    No results matching ""