Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: standardize naming conventions throughout the codebase (OZ N-13) #1047

Merged
merged 13 commits into from
Oct 2, 2024

Conversation

MoonBoi9001
Copy link
Member

@MoonBoi9001 MoonBoi9001 commented Sep 20, 2024

Motivation:

Title:

N-13 Naming Suggestions

Details:

Throughout the codebase, multiple instances where code would benefit from renaming were identified:

  • function releaseStake(uint256 n) could be function releaseStake(uint256 numClaimsToRelease).
  • function _setPartialPaused(bool _toPause) could be function _setPartialPaused(bool _toPartialPause).
  • lastPausePartialTime could be lastPartialPauseTime.
  • acceptProvision could be acceptProvisionPendingParameters. Additionally, staged could be pending.
  • Multiple variables follow the convention of _DEPRECATED{variable_name}, whereas they will only be deprecated after the transition period. Consider renaming them to _DEPRECATING{variable_name} and switching to the current naming after they are truly deprecated.
  • IHorizonStakingMain could be IHorizonStaking to ease reading and match the implementing contract.
  • maxVerifierCut and thawingPeriod could be newMaxVerifierCut and newThawingPeriod.
  • sharesThawing and tokensThawing could be sharesStillThawing and tokensStillThawing.
  • onlyProvisionAuthorized could be onlyAuthorizedForProvision.
  • ProvisionAccepted could be ProvisionPendingParametersAccepted.
  • releaseAt could be releasableAt.
  • _tokens could be amount.
  • Resolve the conflicting dispute could be Draw the conflicting dispute.
  • In order to avoid confusion, consider limiting the use of thawing and unthawing to only instances referring to provisions. We suggest renaming MAX_THAWING_PERIOD to MAX_WAIT_PERIOD and taking a likewise approach when dealing with all the similar occurrences in the PaymentsEscrow contract.
  • In the DisputeManager contract, the terms "challenger" and "submitter" are used interchangeably with "fisherman", leading to potential confusion. Consider consistently using the term "fisherman".
    Consider reviewing the aforementioned suggestions and applying them to improve code clarity and readability.

Review suggestion

  • It might make more sense to look at the induvidual commits instead of the files changed.

Key changes

Ignored suggestions

  • Multiple variables follow the convention of _DEPRECATED{variable_name}, whereas they will only be deprecated after the transition period. Consider renaming them to _DEPRECATING{variable_name} and switching to the current naming after they are truly deprecated.
  • IHorizonStakingMain could be IHorizonStaking to ease reading and match the implementing contract.
  • sharesThawing and tokensThawing could be sharesStillThawing and tokensStillThawing.
  • _tokens could be amount.

Copy link

openzeppelin-code bot commented Sep 20, 2024

fix: standardize naming conventions throughout the codebase (OZ N-13)

Generated at commit: e33bf12ae2fdbbac69700dc8dc08a04a5ac3f649

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
2
4
0
15
40
61
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.51%. Comparing base (374f57d) to head (e33bf12).
Report is 60 commits behind head on horizon.

Additional details and impacted files
@@           Coverage Diff            @@
##           horizon    #1047   +/-   ##
========================================
  Coverage    92.51%   92.51%           
========================================
  Files           46       46           
  Lines         2392     2392           
  Branches       428      428           
========================================
  Hits          2213     2213           
  Misses         179      179           
Flag Coverage Δ
unittests 92.51% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MoonBoi9001 MoonBoi9001 marked this pull request as ready for review September 30, 2024 14:21
@MoonBoi9001 MoonBoi9001 requested review from tmigone, Maikol and pcarranzav and removed request for tmigone September 30, 2024 14:21
Copy link
Contributor

@tmigone tmigone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one comment:

This contract we dont need to change packages/contracts/contracts/disputes/DisputeManager.sol. That's the old (current) Dispute Manager which we won't be touching/deploying, instead we have a new one in packages/subgraph-service/... which you already updated.

@MoonBoi9001
Copy link
Member Author

Have reverted changes to that contract now :)

Copy link
Contributor

@tmigone tmigone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@MoonBoi9001 MoonBoi9001 merged commit 31d57b2 into horizon Oct 2, 2024
11 of 13 checks passed
@MoonBoi9001 MoonBoi9001 deleted the fix_oz_n-13 branch October 2, 2024 17:38
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