Skip to content

Tweak location info for SWC-128#212

Merged
muellerberndt merged 2 commits intoSmartContractSecurity:masterfrom
cd1m0:master
Oct 23, 2019
Merged

Tweak location info for SWC-128#212
muellerberndt merged 2 commits intoSmartContractSecurity:masterfrom
cd1m0:master

Conversation

@cd1m0
Copy link
Copy Markdown
Contributor

@cd1m0 cd1m0 commented Oct 22, 2019

In SWC-128 a data structure may grow very large over a series of successful transactions to a point where some function that iterates over that data structure requires too much gas, causing a DoS. There are 2 general places where you can fix this issue:

  1. Prevent the datastructure from growing unboundedly

  2. Re-write all functions that iterate over the data structure to be able to do so over multiple transactions.

The text of SWC-128, and especially the remediation parts focus on (2). E.g.

"Caution is advised when you expect to have large arrays that grow over time. Actions that require looping across the entire data structure should be avoided.

If you absolutely must loop over an array of unknown size, then you should plan for it to potentially take multiple blocks, and therefore require multiple transactions."

2 of the 3 examples however(dos_number.sol and dos_simple.sol) point out the location where the data structure grows instead of the location that iterates and causes the DoS.

This PR proposes to change the location of these two samples.

Note: A more complete solution would be to report both locations as contributing to the issue, however doing this cleanly requires support for multiple tagged locations associated with a single issue. After this has been implemented we can expand the source location for these issues.

@muellerberndt muellerberndt merged commit 59eee1a into SmartContractSecurity:master Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants