Skip to content

Check safeMethods#2120

Merged
shargon merged 8 commits intoneo-project:masterfrom
shargon:safe-method
Dec 9, 2020
Merged

Check safeMethods#2120
shargon merged 8 commits intoneo-project:masterfrom
shargon:safe-method

Conversation

@shargon
Copy link
Member

@shargon shargon commented Dec 4, 2020

Close #2117

@erikzhang
Copy link
Member

Maybe we can move safemethods to abi.

{
  "name": "symbol",
  "parameters": [],
  "returntype": "String",
  "offset": 0,
  "safe": true
}

@shargon
Copy link
Member Author

shargon commented Dec 4, 2020

Maybe we can move safemethods to abi.

I will do that

@erikzhang
Copy link
Member

Native contracts' abi should be updated too.

@erikzhang
Copy link
Member

@neo-project/ngd-shanghai Can you test it?

@shargon
Copy link
Member Author

shargon commented Dec 5, 2020

@neo-project/ngd-shanghai you can use neo-project/neo-devpack-dotnet#401

throw new InvalidOperationException($"Cannot Call Method {method} Of Contract {contractHash} From Contract {CurrentScriptHash}");
if (md.Safe)
{
flags &= ~CallFlags.AllowModifyStates;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a method is marked as Safe, will it not be allowed to modify states?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@fyrchik
Copy link
Contributor

fyrchik commented Dec 8, 2020

What about having RequiredCallFlags instead of Safe?
This will unify native and other contracts, while also providing some security.

@shargon
Copy link
Member Author

shargon commented Dec 8, 2020

What about having RequiredCallFlags instead of Safe?

I think developers should know more about the core to use this properly, it is easier for adoption to make things easier.

erikzhang
erikzhang previously approved these changes Dec 8, 2020
erikzhang
erikzhang previously approved these changes Dec 8, 2020
@shargon shargon merged commit f520ee5 into neo-project:master Dec 9, 2020
@shargon shargon deleted the safe-method branch December 9, 2020 13:00
ShawnYun pushed a commit to ShawnYun/neo that referenced this pull request Jan 8, 2021
* Check safemethod

* Move safe method to Abi

* Native safe

* Fix merge

Co-authored-by: Erik Zhang <erik@neo.org>
cloud8little pushed a commit to cloud8little/neo that referenced this pull request Jan 24, 2021
* Check safemethod

* Move safe method to Abi

* Native safe

* Fix merge

Co-authored-by: Erik Zhang <erik@neo.org>
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SafeMethods never checked in ApplicationEngine

4 participants