4 ms·
One effort along these lines is the Consensys best practices document: https://consensys.github.io/smart-contract-best-practices/ https://consensys.github.io/s
by DennisP 9y ago
One effort along these lines is the Consensys best practices document:
https://consensys.github.io/smart-contract-best-practices/ https://consensys.github.io/smart-contract-best-practices/
- ChuckMcM 9y agoThat looks like it is headed in the right direction. I observe that in companies there are stories (often with particpant's names) which exemplify bad practices. Part of the motivation to do better seems to come from not wanting to be the person in one of these stories.
- luckyt 9y agoIn the "Known Attacks" section, they advocate using a mutex to prevent reentrant situations, but they're using a boolean, setting it to true before the operation and setting it to false afterwards. This is not secure -- it's possible for two threads to set it to true at the same time! You need to use an atomic concurrency operation like compare-and-swap [1] to implement a mutex. [1] https://en.wikipedia.org/wiki/Compare-and-swap https://en.wikipedia.org/wiki/Compare-and-swap
- socrates1024 9y agoThe Ethereum VM is single threaded, so this isn't actually a problem