I heard that Michelson helps with avoiding re-entrancy bug. Why is that? Is there some feature in the language that prevent it?
2 Answers
Michelson (and higher level language like Liquidity on top of it) does not allow a smart contract to call another smart contract without commmitting its state/storage first. It makes reentrancy attacks less likely to happen, but not impossible.
-
Would it be possible to extend your answer or at least refer to another source that could explain a case where this could happen? Feb 1, 2019 at 8:45
To call another smart contract, you call TRANSFER_TOKENS.
The semantics of contract evaluation has been adapted (around alphanet, I'm not exactly sure when this happened) so that all transactions/operations such as TRANSFER_TOKENS are really executed after the contract evaluation returns.
This implies that the contract is not subject to immediate reentrancy.