5

Imagine there is a smart contract which calls other smart contracts using TRANSFER_TOKENS and in the end lots of operations are created.

Are these operations baked in a block atomically? I mean, is it assured all of them are registered in the same block or fail entirely? Or they can be separated into more than one blocks (therefore some may fail later)?

If it is atomic, if a contract creates a too huge list of operations for one block, the contract call will never succeed. Is it correct?

Is there a specification explains the semantics of this call chain?

3

Short answer: all the call chain has to fit in one block.

Transactions issued by the smart contract are called "internal operations" and are successively executed until there are no more internal transactions or one of the transactions fails (be it due to a call to Fail in a contract, to a lack of gas, or to an invalid transaction). And if one of the transactions fails, the whole call chain (and any side-effects) are rolled back.

So you are guaranteed that they will be executed atomically in the block: they will not even be interleaved with other transactions from the same block.

This is documented in the Michelson documentation, under inter-transaction semantics. You can also find the relevant piece of code in the file src/proto_alpha/lib_protocol/apply.ml in the definition of apply_internal_manager_operations

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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