There are always 4 arguments on stack when recv_internal
is called.
By declaring recv_internal
with less than 4 arguments you force FunC to ignore most deep variables (they still will be there, but your code will be unaware for the whole TVM execution).
in_msg_full - cell with raw message cell that contains all the flags and additional fields
in_msg_body - slice that only contain body of the message
Please check https://ton.org/docs/learn/tvm-instructions/tvm-overview#initialization-of-tvm for more informations.
each of the following recv_internal declarations is correct, but those with fewer variables will spend slightly less gas (each unused argument adds additional DROP instructions).
() recv_internal(int balance, int msg_value, cell in_msg_cell, slice in_msg) {}
() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) {}
() recv_internal(cell in_msg_cell, slice in_msg) {}
() recv_internal(slice in_msg) {}
You have to parse in_msg_body to retrieve the op code based on how sender stored op code in the message.
Ususally, it is stored as the first 32 bit inside in_msg_body.