Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 1.19 KB

Functions with unexpected side-effects.md

File metadata and controls

32 lines (25 loc) · 1.19 KB

Some functions have side-effects.

For example, the _getLatestFundingRate function of the FundingRateApplier contract might also update the funding rate and send rewards.

The getPrice function of the OptimisticOracle contract might also settle a price request.

These side-effect actions are not clear in the name of the functions and are thus unexpected, which could lead to mistakes when the code is modified by new developers not experienced in all the implementation details of the project.

Recommendation:

Consider splitting these functions in separate getters and setters.

Alternatively, consider renaming the functions to describe all the actions that they perform.


Slide Screenshot

190.jpg


Slide Text

  • OpenZeppelin UMA Protocol Finding M02
  • Specification
  • Function Names
  • Unexpected Side-effects
  • Sync Names -> Actions
  • Specific Setters/Getters

References


Tags