massa icon indicating copy to clipboard operation
massa copied to clipboard

rpc call `execute_read_only_call` to be extended with an optional json payload for returning final state

Open BatiGencho opened this issue 2 years ago • 3 comments

Smart contracts might often have code like this:

export function getSomeData(address: string): string {
  const data = Storage.get("KEY");
  generateEvent(data);

  return data;
}

If this read-only method is being called using execute_read_only_call, as discussed with Damir, the state reading will be based on a simulated execution at the time of call giving us a transient state.

Since transient states are subject to change, we need to have an rpc call execute_read_only_call targeting final states and thus returning finality state data. I suggest adding a new param to the json rpc payload to force the rpc call to return only final slot storage data, if not set, same as now, transient.

BatiGencho avatar Aug 31 '22 13:08 BatiGencho

@damip I tried to understand this issue, but I need more details to implement it.

aoudiamoncef avatar Nov 11 '22 16:11 aoudiamoncef

Basically add a parameter to the execute read only api to request readonly execution at the latest final slot instead of the latest speculative slot. Changes are needed on the Execution side as well to add this feature

damip avatar Nov 11 '22 20:11 damip

This PR can be grouped with https://github.com/massalabs/massa/issues/2951 to solve both at the same time

damip avatar Nov 11 '22 21:11 damip

Done in https://github.com/massalabs/massa/pull/3405

AurelienFT avatar Jan 23 '23 07:01 AurelienFT