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

safe-global / safe-smart-account / 12694580242
94%

Build:
DEFAULT BRANCH: main
Ran 09 Jan 2025 04:49PM UTC
Jobs 1
Files 42
Run time 22min
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

09 Jan 2025 04:48PM UTC coverage: 93.957% (+0.02%) from 93.936%
12694580242

push

github

web-flow
[Certora Audit] G-09. Cache array length outside of loop (#896)

This pull request includes several optimizations to the `OwnerManager`
and `ERC165Handler` contracts by reducing the number of times array
lengths are accessed within loops. These changes aim to improve the
efficiency of the code by storing the array lengths in variables before
the loops.

If not cached, the solidity compiler will always read the length of the
array during each iteration. That is, if it is a storage array, this is
an extra sload operation (100 additional extra gas for each iteration
except for the first) and if it is a memory array, this is an extra
mload operation (3 additional gas for each iteration except for the
first).

Optimizations in `OwnerManager` contract:

*
[`contracts/base/OwnerManager.sol`](diffhunk://#diff-<a class=hub.com/safe-global/safe-smart-account/commit/795fb06764b4c2d991707584a31509badf0b036c">795fb06769401bfbcb82d6bc9fdebab82L38-R39):
Stored `_owners.length` in a variable `ownersLength` before the loop to
avoid repeatedly accessing the array length.
*
[`contracts/base/OwnerManager.sol`](diffhunk://#diff-795fb06764b4c2d991707584a31509badf0b036c9401bfbcb82d6bc9fdebab82L49-R50):
Updated `ownerCount` to use the `ownersLength` variable instead of
accessing `_owners.length` again.

Optimizations in `ERC165Handler` contract:

*
[`contracts/handler/extensible/ERC165Handler.sol`](diffhunk://#diff-<a class=hub.com/safe-global/safe-smart-account/commit/aa0838f20fd3f37b00dc661645b4641500e68762">aa0838f20b9b624addb99465fcc65a3e0L56-R57):
Stored `handlerWithSelectors.length` in a variable `len` before the loop
in `addSupportedInterfaceBatch` to avoid repeatedly accessing the array
length.
*
[`contracts/handler/extensible/ERC165Handler.sol`](diffhunk://#diff-aa0838f20fd3f37b00dc661645b4641500e68762b9b624addb99465fcc65a3e0L78-R80):
Stored `selectors.length` in a variable `len` before the loop in
`removeSupportedInterfaceBatch` to avoid repeatedly accessing the array
length.

325 of 366 branches covered (88.8%)

Branch coverage included in aggregate %.

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

499 of 511 relevant lines covered (97.65%)

100.88 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-$ - 12694580242.1 09 Jan 2025 04:49PM UTC 0
93.96
GitHub Action Run
Source Files on build 12694580242
Detailed source file information is not available for this build.
  • Back to Repo
  • Github Actions Build #12694580242
  • b2c60870 on github
  • Prev Build on main (#12694122752)
  • Next Build on main (#12694954649)
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