-
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
base: master
Are you sure you want to change the base?
Changes from all commits
01d147a
55ff8e0
97d541e
45a0042
2deb55a
cec6fe1
12ae313
7900ded
758be48
dbce0a1
b08c9bd
77feb56
9760701
a21b775
0c1cb52
44f03f9
9394d4d
c8583e9
b8978f2
35cea0b
43fde57
385000b
dfa5288
d38495c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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) | ||
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. I don't think it's a part of specification. We're specifying something different here. |
||
|
||
===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. | ||
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. will will 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. Probably just |
||
|
||
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>. | ||
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. Maybe refer to NEP-16 and NEP-15 here. I also don't understand
here. Only |
||
|
||
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? 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. Maybe better as |
||
|
||
===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 |
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.
s/NEO/Neo
.s/standize/a standard/
? I'm also not sure we need to say anything about callbacks. It's about standard API to update contracts, what it does internally is not motivation probably.