Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Remove RET execution on PushOnly #35

Closed
shargon opened this issue Apr 6, 2018 · 9 comments
Closed

Remove RET execution on PushOnly #35

shargon opened this issue Apr 6, 2018 · 9 comments
Labels

Comments

@shargon
Copy link
Member

shargon commented Apr 6, 2018

I think that is not necessary allow execute ' RET' command while only push is allowed

if (opcode > OpCode.PUSH16 && opcode != OpCode.RET && context.PushOnly)

What do you think @erikzhang ?

@erikzhang
Copy link
Member

erikzhang commented Apr 8, 2018

I think we can remove PushOnly. Can you evaluate the security if we remove PushOnly and allow all the instructions in Neo.Core.Witness::InvocationScript? @shargon

@shargon
Copy link
Member Author

shargon commented Apr 8, 2018

I do not really like the idea of removing PushOnly because it could cause them to execute any code without the need for a smartContract. I think that you can not eliminate PushOnly, What benefits could it bring?

I Asked by RET to avoid fattening the script with unnecessary code type

PUSH ORIGINAL_PARAMETERS
RET
PUSHBYTES...
PUSHBYTES...
PUSHBYTES...
PUSHBYTES...
PUSHBYTES...

And the execution is still valid, but it would make the chain fatter

@erikzhang
Copy link
Member

The most direct advantage is that after removing PushOnly, we can use the instructions such as NEWARRAY, NEWSTRUCT, PACK to create parameters in Neo.Core.Witness::InvocationScript. And there's no reason to limit it now.

@shargon
Copy link
Member Author

shargon commented Apr 9, 2018

All these instructions are executed in a different ExecutionContext, so there is not possible to change storages of the contract. But it could be used to invoke TXs and these TXs could create a different StorageContext to save arbitrary data

@erikzhang
Copy link
Member

Contracts can't save any data if they are started with Verification trigger.

@shargon
Copy link
Member Author

shargon commented Apr 9, 2018

But this pushOnly flag is not only used under Verification, is used for arguments of invokes too, right?

@erikzhang
Copy link
Member

Currently, it is for Verification only.

@erikzhang
Copy link
Member

@shargon Do you think it's ok to remove PushOnly?

@shargon
Copy link
Member Author

shargon commented May 4, 2018

Yes, it’s ok for me 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants