11

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 2

16

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.

1
  • Would it be possible to extend your answer or at least refer to another source that could explain a case where this could happen?
    – latte_jed
    Feb 1, 2019 at 8:45
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.