• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gnosis / solidity-data-structures / 136
100%

Build:
DEFAULT BRANCH: master
Ran 08 Apr 2020 08:57PM CUT
Jobs 1
Files 6
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
136

push

travis-ci

web-flow
Remove unbounded loop in size() implementation (#21)

More context: https://github.com/gnosis/dex-contracts/issues/641

`size()` is currently iterating over all items making it potentially very gas costly. Since this behaviour is internal to the library it is easy for dependent contracts to oversee the consequences.

This PR therefore changes the implementation so that every insert will increment the size variable.

Due to the fact that the size variable is aligned (last takes 160 bits leaving 96 in the word), the amount of gas used on insertion barely changes (by measuring test suite with eth-gas-reporter):

||min|max|avg
|---|---|---|---
No storage| 25713|66479|56044
U96|25469|66552|53192
U256|25469|86700|64361

I also removed the `atIndex` method as it is subject to the same flaw and therefore of questionable use anyway.

24 of 24 branches covered (100.0%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 2 files covered. (100.0%)

49 of 49 relevant lines covered (100.0%)

6.82 hits per line

Jobs
ID Job ID Ran Files Coverage
1 136.1 08 Apr 2020 08:57PM CUT 0
100.0
Travis Job 136.1
Source Files on build 136
  • List 0
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Loading...
Coverage∆FileLinesRelevantCoveredMissedHits/LineBranch HitsBranch Misses
No data available in table
Showing 0 to 0 of 0 entries
  • Previous
  • Next
  • Back to Repo
  • Travis Build #136
  • b511d0ad on github
  • Prev Build on master (#134)
  • Next Build on master (#139)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc