SWC-registry
SWC-registry copied to clipboard
New SWC: Avoid Block Number as a proxy for time
SWC-116: timestamp dependence says:
Remediation Developers should write smart contracts with the notion that block timestamp and real timestamp may vary up to half a minute. Alternatively, they can use block number or external source of timestamp via oracles.
Depending on the block number to accurately predict time is also dangerous:
https://medium.com/spankchain/spankchain-purchase-phase-to-end-prematurely-11-13-at-10am-pst-49c58133715a
The best practices address this situation as well: https://consensys.github.io/smart-contract-best-practices/recommendations/#avoid-using-blocknumber-as-a-timestamp
https://github.com/SmartContractSecurity/SWC-registry/pull/232
This has been fixed, and could be closed