Why in Ownable are events emitted before state changes

Tyler asked on Telegram

Why openzeppelin emits events before changing states?

Ethereum transactions are atomic, so it’s irrelevant whether the event is emitted before or after modifying storage. Order is only relevant among other observable effects so if there were multiple events or if there was an external function call we would have to worry about when the event is emitted relative to that other “effect”.

2 Likes