Skip to content

Upgrade Contract Code #154

@ajlopez

Description

@ajlopez

Although the concept of smart contract is based on inmutability of the logic, the alternative upgradable contract is gaining momentum. There are many implementations in Ethereum, most of them using a proxy contract.

This improvement proposal allows that any contract could be upgradble, given a control logic to accept the change.

The idea is based on invoke a defined public method:

function upgradeCode(bytes memory newcode) public returns (bytes memory)

In this function, explicitly added by the contract author, the logic could accept or not the new code (the bytes sent in the parameter). The bytes returned ARE THE NEW ACCEPTED code. So, the logic could control the sender account, or some freeze logic in the contract that reject the change.

The virtual machine execution code should be modified so the return of this invocation (if the returned value is not the empty byte array) changes the code of the contract account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions