-
Notifications
You must be signed in to change notification settings - Fork 3
Description
The move apps only use the instruction_data for now. the program_id and the accounts array are unused by the entrypoint(generated by the compiler) as well as the entry function(in the move programs).
Currently the workaround is to pass accounts data as args (in the instruction_data) but this doesn't look clean. The upside of this approach is that there is no extra cost for apps who dont need to use the data, and can chose not to pass those as args.
There are different approaches we can take but we should make sure any approach we take is long term as it will be hard to change it in the future. We probably need to safeguard the stack to make sure a program doesn't access anything outside.
-
[The original idea from Dmitri] VM sets up the stack of the entry function with program_id, accounts, and instruction_data parameters. The move compiler generates code that is executed before entry function proper code starts, to deserialize the actual arguments of this entry function based on its knowledge of the parameter types.
-
Entry function can have a pointer to the data (which is stored on stack) as their first parameter. entry function can chose to parse the data or not.