-
Notifications
You must be signed in to change notification settings - Fork 113
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
NEP 22: Contract Update Standard #154
Open
superboyiii
wants to merge
24
commits into
neo-project:master
Choose a base branch
from
superboyiii:upgrade-standard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
01d147a
NEP: Contract Basic Method Guideline
superboyiii 55ff8e0
Update nep-xx.mediawiki
superboyiii 97d541e
Update nep-xx.mediawiki
superboyiii 45a0042
Update nep-xx.mediawiki
superboyiii 2deb55a
fix update
superboyiii cec6fe1
fix format
superboyiii 12ae313
advice from Roman
superboyiii 7900ded
fix format
superboyiii 758be48
accept
erikzhang dbce0a1
add _initialize
superboyiii b08c9bd
add verify()
superboyiii 77feb56
Update nep-22.mediawiki
superboyiii 9760701
improve
superboyiii a21b775
fix
superboyiii 0c1cb52
rm _initialize
superboyiii 44f03f9
fix
superboyiii 9394d4d
Merge branch 'neo-project:master' into upgrade-standard
superboyiii c8583e9
contract update method
superboyiii b8978f2
add references
superboyiii 35cea0b
fix
superboyiii 43fde57
fix
superboyiii 385000b
Update nep-22.mediawiki
shargon dfa5288
Update nep-22.mediawiki
shargon d38495c
improvement
superboyiii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<pre> | ||
NEP: 22 | ||
Title: Contract Update Function | ||
Author: Owen Zhang <[email protected]>, Fernando Díaz Toledano <[email protected]>, Erik Zhang <[email protected]>, Roman Khimov <[email protected]> | ||
Type: Standard | ||
Status: Accepted | ||
Created: 2021-04-19 | ||
</pre> | ||
|
||
|
||
==Abstract== | ||
|
||
This proposal outlines a standard for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract update. | ||
|
||
==Motivation== | ||
|
||
As the NEO blockchain scales, Smart Contract Update will become increasingly important. We need standize <code>update</code> method in contract to callback native <code>ContractManagement</code> correctly. | ||
|
||
==Specification== | ||
|
||
Neo N3 has a native <code>ContractManagement</code> contract that is used for contract deployment and update via <code>deploy</code> and <code>update</code> methods of it. After settling with the new NEF and manifest both of them will invoke a special <code>_deploy</code> method if it's implemented by the contract. More details in [NEP-29](https://github.com/neo-project/proposals/blob/master/nep-29.mediawiki) | ||
|
||
===Methods=== | ||
|
||
====update==== | ||
|
||
<pre> | ||
{ | ||
"name": "update", | ||
"safe": false, | ||
"parameters": [ | ||
{ | ||
"name": "nefFile", | ||
"type": "ByteArray" | ||
}, | ||
{ | ||
"name": "manifest", | ||
"type": "ByteArray" | ||
}, | ||
{ | ||
"name": "data", | ||
"type": "Any" | ||
} | ||
], | ||
"returntype": "Void" | ||
} | ||
</pre> | ||
|
||
This method will will callback <code>Update</code> method in native <code>ContractManagement</code> contract. It will update contract state if it's exectued successfully. | ||
|
||
Updating a smart contract MUST have <code>nefFile</code> or <code>manifest.json</code>. If just update one of them at a time is OK, another SHOULD be set as null. It will be passed to <code>_deploy</code>. | ||
|
||
The parameter <code>data</code> can be any type of supported parameters for contract-specific purpose. For example some kinds of json parameters can be put into data for specific check. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "For example some kinds of json parameters can be put into data for specific check." |
||
|
||
This function SHOULD check whether the <code>signer</code> address equals the <code>owner</code> hash of contract. This function SHOULD use the SYSCALL <code>Neo.Runtime.CheckWitness</code> to verify the <code>signer</code>. Details has been explained in [NEP-30](https://github.com/superboyiii/proposals/blob/upgrade-standard/nep-30.mediawiki). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function? Which function? |
||
|
||
===References=== | ||
|
||
https://github.com/neo-project/proposals/blob/master/nep-29.mediawiki | ||
|
||
https://github.com/neo-project/proposals/blob/master/nep-30.mediawiki | ||
|
||
===Implementation=== | ||
|
||
* C#: https://github.com/neo-project/neo-devpack-dotnet/blob/003a50095efe88f63f518a0c989921be086409f3/examples/Example.SmartContract.NEP17/SampleNep17Token.cs#L130 | ||
|
||
* Go: https://github.com/nspcc-dev/neofs-contract/blob/99fb86c35a48ed12017423aa4fee13f7d07fa4c0/contracts/proxy/contract.go#L33 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will will