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

gnosis / solidity-data-structures / 136 / 1
100%
master: 100%

Build:
DEFAULT BRANCH: master
Ran 08 Apr 2020 08:57PM UTC
Files 6
Run time 5s
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

08 Apr 2020 08:55PM UTC coverage: 100.0%. Remained the same
136.1

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 %.

49 of 49 relevant lines covered (100.0%)

6.82 hits per line

Source Files on job 136.1
  • Tree
  • List 0
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 85
  • Travis Job 136.1
  • b511d0ad on github
  • Prev Job for on master (#134.1)
  • Next Job for on master (#139.1)
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

© 2026 Coveralls, Inc