As described here:
A function that does not
await
in its body is guaranteed to execute atomically - in particular, the environment cannot change the state of the actor while the function is executing. If a function performs anawait
, however, atomicity is no longer guaranteed. Between suspension and resumption around theawait
, the state of the enclosing actor may change due to concurrent processing of other incoming actor messages. It is the programmer’s responsibility to guard against non-synchronized state changes.
Cross-canister calls are not guaranteed. And I test three canisters: canister A call canister B and canister C in order, and successfully executed in B, asserted in C. B’s state var is changed and C’s is not.
So when we code, we should check first, and modify last. Also, flash loans may be impossible