-
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?
Conversation
Co-authored-by: Erik van den Brink <[email protected]>
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.
LGTM
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.
It'd be nice to have this, I'd change our examples to use this standard interface.
Add |
|
@roman-khimov @erikzhang Added. Please review again. |
NEP-22:
I don't see |
I'm not sure if it should be part of this PR, but obviously it should be included in a document. Also, don't forget the |
Added. |
@erikzhang @roman-khimov Is it OK? |
It's a method soup now to me. I'd rather have separate NEPs for |
I can kind of see the relationship. |
Is it related? Probably so. Can be it be used without all the other things? Sure it is. Can all the other things in this proposal be used without |
I agree in principle with the idea of having independent standards. But I suspect there are many others like myself who also have a mental block at the future thought of these long lists of numbers with no meaning. Maybe we could package them together under a standard group, but at that point, is it that much different from what we have now? |
@roman-khimov this one can be the most general description of base methods, as for specific method that should have a seperate NEP, we can create another NEPs for them, like Verify, no need to complete them in one NEP. |
It's a guideline proposal for someone doesn't know where to start. It doesn't mean that you must implement all of these. In fact, you can even don't apply any of these, but it can remind these people some important points when starting to write neo smart contract. |
Let's get back to #135 that started all of this for a moment. What people really wanted there is a convention for methods that contract authors can use to have some common way to update/destroy contracts. In this sense it's somewhat similar to NEP-11/17/24. And this is only about two methods:
to update my contract (because 3rd-party tools couldn't easily create an update transaction for me in this case, unlike when they deal with a compliant But what we also have here now are:
At least we need to move |
According to recent discussions, I agree that |
Totally agree with Roman, we should adjust this NEP to standardize a single update method. The rest of methods standards should be moved to a separate granular NEPs. |
Should |
@roman-khimov @shargon @cschuchardt88 @Jim8y Now I changed it to |
@shargon @roman-khimov Done. |
} | ||
</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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just MUST call
|
||
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 comment
The 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."
Some examples here?
|
||
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. | ||
|
||
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better as this method
, since we're talking about update
method here. Also, I don't understand what is to check whether the <code>signer</code> address equals the <code>owner</code> hash of contract
. Transaction can have a lot of signers. We should care more about owner allowing this action (CheckWitness
). And NEP-30 is a different thing in general, most of contracts will not have contract-based owners, they're usually just multisig.
|
||
==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. |
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.
|
||
==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 comment
The 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.
} | ||
</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 comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just MUST call
|
||
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>. |
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.
Maybe refer to NEP-16 and NEP-15 here. I also don't understand
It will be passed to
_deploy
.
here. Only data
is going to be passed and that's exactly where a reference to NEP-29 is needed.
|
||
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. | ||
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better as this method
, since we're talking about update
method here. Also, I don't understand what is to check whether the <code>signer</code> address equals the <code>owner</code> hash of contract
. Transaction can have a lot of signers. We should care more about owner allowing this action (CheckWitness
). And NEP-30 is a different thing in general, most of contracts will not have contract-based owners, they're usually just multisig.
Close: #135