6 ms·
Btw, small bone to pick with the Pact whitepaper[1]: > EVM and Solidity have no support for atomic execution. Ethereum contracts simply abort on error, leaving
by cdetrio 10y ago
Btw, small bone to pick with the Pact whitepaper[1]:
> EVM and Solidity have no support for atomic execution. Ethereum contracts simply abort on error, leaving developers with the impossible task of undoing previous writes and contract creates after any possible error condition.
EVM transactions are atomic; all state changes are reverted on aborts (out-of-gas errors and throws). Ethereum state changes are committed only after successful transaction execution, so developers never have to worry about writes from half-executed transactions.
1. http://kadena.io/docs/Kadena-PactWhitepaper-Oct2016.pdf http://kadena.io/docs/Kadena-PactWhitepaper-Oct2016.pdf
- buckie 10y agoFor the case(s) you've mentioned, you are correct: the state that is built up disappears on error. However, when last I checked, there are several operations that fall outside of this guarantee, e.g. new account creation, that are not rolled back on error. This would be as easy fix but to my knowledge is still unaddressed. Hopefully, they've changed this and if they have please let me know. Edit: I stand corrected, thanks!
- spopejoy 10y agoIs this commit from Oct 4 what you're referring to? https://github.com/ethereum/go-ethereum/commit/46a527d01485102a798bf27f24622fc6274f58d9 https://github.com/ethereum/go-ethereum/commit/46a527d014851... Ethereum is decidedly non-transactional in certain cases, like nested contract creation for instance. I don't know about this commit though.
- cdetrio 10y agoThe spec [http://gavwood.com/Paper.pdf http://gavwood.com/Paper.pdf] has been to revert on errors since day 1: > Just as with contract creation, if the execution halts in an exceptional fashion (i.e. due to an exhausted gas supply, stack underflow, invalid jump destination or invalid instruction), then no gas is refunded to the caller and the state is reverted to the point immediately prior to balance transfer (i.e. σ). The Oct 4 commit just optimizes the way that reverts are implemented in go-ethereum (use a journal rather than deep copies).