As we know transactions on Ethereum are atomic. If something throws, everything rolls back. Do we have something similar in Substrate? Or all changes I should manually revert?
At the time of this post, Substrate does not have a "revert" behavior by default.
That is, any change made to storage will be committed to the chain at the end of the block.
We are in the process of changing this and introducing a storage layer by default for each transaction to the chain. That will be such that all changes caused by a transaction could be reverted automatically if the extrinsic return an error.
Until then, we recommend updating the logic of your code to only write to storage when you know everything will be committed, or use the
#[transactional] tag mentioned above.
But it is coming soon!