Neo: Direct SYSCALL parameters

Created on 13 Aug 2019  路  6Comments  路  Source: neo-project/neo

I think that we should support direct SYSCALL parameters, since in some cases they may be necessary (see Callback discussion; checked deploy discussion;...)

Example:

SYSCALL Execute.My.Command 02 PARAM1 PARAM2

Positive aspects: more power to syscall development, that may require (or not), hardcoded script parameters.

Negative aspects: perhaps an extra byte value (00) is necessary on every syscall, to indicate 00 parameters, if not used.

compiler design enhancement vm

Most helpful comment

That's it,one good example for you Shargon.. try to do a JMP taking offset from stack @shargon.

...

Now try to make this dapp secure :joy:
thats the reason why other projects banned relative-address stack jumps.
Its also very bad for optimizations, finding dead/unused codes... (since jumps could go virtually anywhere on code, even in the middle of other functions,imagine that).
Right now all syscalls dont rely on these security measures,but the Callback proposal I'm discussing with Erik, will require that...
Its useful for verified deploys too. Its necessary for Static invokes too (we lost them,and they are useful!)

All 6 comments

@shargon @erikzhang what do you think?

This allows implementing JMP as syscall,which is currently not possible.

Parameters could follow standard type serialization.

It also allows implementing Static Invokes, as only dynamic invokes exist now.

I can't see the difference with push and then the syscall

That's it,one good example for you Shargon.. try to do a JMP taking offset from stack @shargon.

...

Now try to make this dapp secure :joy:
thats the reason why other projects banned relative-address stack jumps.
Its also very bad for optimizations, finding dead/unused codes... (since jumps could go virtually anywhere on code, even in the middle of other functions,imagine that).
Right now all syscalls dont rely on these security measures,but the Callback proposal I'm discussing with Erik, will require that...
Its useful for verified deploys too. Its necessary for Static invokes too (we lost them,and they are useful!)

@shargon best example is static vs dynamic invokes on neo2. We dont have static invoke on neo3, and it's impossible to code it right now, because we dont have this feature here.

@igormcoelho I still can't see the difference.
How this SYSCALL Execute.My.Command 02 PARAM1 PARAM2 would be stored? Can you give more examples?

Can you give more examples?

Sure, examples are necessary to clarify this important issue. I'll quote the proposal of item serialization (https://github.com/neo-project/neo/issues/1027) which will be necessary here.

Consider this table:

0x00 - signature
0x01 - bool
0x02 - int
0x03 - hash160
0x04 - hash256
0x05 - bytearray
0x06 - pubkey 
0x07 - string
0x10 - array
0xf0 - interop
0xff - void

I'll also quote the callback proposal by Erik, that will need this (https://github.com/neo-project/neo/issues/284). Please go there to see the example, it's easier :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shargon picture shargon  路  4Comments

vncoelho picture vncoelho  路  3Comments

lock9 picture lock9  路  4Comments

roman-khimov picture roman-khimov  路  3Comments

doubiliu picture doubiliu  路  3Comments