mirror of
https://github.com/autistic-symposium/blockchains-security-toolkit.git
synced 2025-10-25 11:36:03 -04:00
960 B
960 B
Random security notes
tx.originis used: you want to replace it by “msg.sender” because otherwise any contract you call can act on your behalf.- Avoid potential reetrancy bugs:
msg.sender.transfer(amount);
balances[msg.sender] -= amount;
- Inline assembly should be used only in rare cases.
- Unclear semantics:
nowis alias forblock.timestampnot current time; use of low levelcall,callcode,delegatecallshould be avoided whenever possible; usetransferwhenever failure of ether transfer should rollnack the whole transaction. - Beware of caller contracts:
selfdestructcan block calling contracts unexpectedly. - Invocation of local functions via
this: never usethisto call functions in the same contract, it only consumes more gas than normal call. - Transferring Ether in a for/while/do-while loop should be avoid due to the block gas limit.
- ERC20
decimalsshould haveuint8as return type.