This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Return ContractReverted
from dispatchables when top level contract reverted
#9338
Labels
J0-enhancement
An additional feature request.
Z1-easy
Can be fixed primarily by duplicating and adapting code by an intermediate coder
Contracts have the possibility to set a flag that reverts all the changes they made. The calling contract can evaluate these flags and act on it. However, if the top level contract sets the revert flag when returning the extrinsic is counted as
Ok
. We should introduce a new pallet level errorErr(ContractReverted)
that is returned instead.Please note that
seal_return
allows to return a result buffer that can be used to encode additional error information. The buffer is only accessible when calling via RPC of course. How this buffer is to be decoded (by a UI) for a specific contract should be defined by the userspace ABI (json). When called via RPC we returnOk
so that buffer is accessible. UIs should inspect theflags
field in order to determine whether the call was a success.Please note that this should only happen if the call/instantiate was submitted as transaction where the
flags
field cannot be read. An RPC call should still return OK and it is up to the UI to classify it as error by readingflags
. Reason is that on dispatch error no output buffer could be returned.The text was updated successfully, but these errors were encountered: