massalabs/massa

Improve caller_address usage in read_only API

Leo-Besancon opened this issue · 0 comments

When calling execute_read_only_call (and probably the same is true for execute_read_only_bytecode), the caller_address is optionnal. If we do not provide one, it is generated randomly by the node.

This is good because sometimes we are sure that the call does not depend on the caller_address. However, it may lead to difficult to debug errors if the address is expected to be in the ledger.

If fee or coins argument is present, it will lead to the following error, as the randomly generated address does not exist in the ledger:

readonly call failed: Runtime error: spending address AU1KACmd3HvyqcqK4LDmhtSmoHnEiMmS7e4xHrzAx97AMCafdhLf not found"

TODO:

  • Provide a better error if fee or coins is set but not caller_address
  • See if other improvements can be made