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

certora updates #17

Merged
merged 47 commits into from
Jun 27, 2024
Merged

certora updates #17

merged 47 commits into from
Jun 27, 2024

Conversation

aazhou1
Copy link
Contributor

@aazhou1 aazhou1 commented Jun 20, 2024

Summary by CodeRabbit

  • Chores
    • Updated configuration settings for Solidity compilation and verification, including renaming settings and modifying verification targets.
    • Added new configuration file for Certora verification of term repo service contracts.

@aazhou1 aazhou1 self-assigned this Jun 20, 2024
@aazhou1 aazhou1 requested a review from robotoer as a code owner June 20, 2024 21:09
Copy link

coderabbitai bot commented Jun 20, 2024

Walkthrough

The recent updates enhance the functionality and configuration of Certora specs and settings related to the TermRepoServicer contract. These changes include adding new methods for access verification, updating configuration settings with new naming conventions, and modifying prover arguments and optimization levels. This ensures more robust access control and streamlined configuration for contract verification.

Changes

File Path Change Summary
certora/specs/termRepoServicer/accessRoles.spec Added using TermController as servicerAccessController;, introduced new method verifyMintExposureAccess(address), modified rules to include servicerAccessController.verifyMintExposureAccess(e, e.msg.sender);.
certora/specs/termRepoServicer/collapses.spec Added function verifyMintExposureAccess with external visibility and return value DISPATCHER(true).
certora/confs/termRepoServicer-redemptionsReverts.conf Renamed configuration setting from contract_compiler_skip_severe_warning_as_error to ignore_solidity_warnings, modified verification target from rulesRepaymentsRedemptionsReverts.spec to rulesRedemptionsReverts.spec.
certora/confs/termRepoServicer.conf Added "TermRepoServicerHarness:termController=TermController" to dependencies, adjusted prover arguments (-smt_initialSplitDepth 10 to -depth 15, added -splitParallel true), updated solc_optimize to "50", changed contract_compiler_skip_severe_warning_as_error to ignore_solidity_warnings:true, modified smt_timeout to "7200".
certora/confs/termRepoServicer-mintIntegrity.conf Introduced new configuration settings for Certora verification of various Solidity contracts related to term repo service. Defined files, linking relationships, prover arguments, optimization settings, loop parameters, contract specifics, package references, and verification specifications.

Poem

In the realm of TermRepo grace,
Enhanced access now has its place.
Configs refined, provisions made,
Code’s path more secure, unwavered, unafraid.
Solidity warnings we now ignore,
Proving our contracts, forevermore. 🐇🛠️


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7da1ba7 and 719007c.

Files selected for processing (16)
  • certora/confs/termAuctionBidLocker-locking.conf (1 hunks)
  • certora/confs/termAuctionBidLocker-lockingReverts.conf (1 hunks)
  • certora/confs/termAuctionBidLocker-stateVariables.conf (1 hunks)
  • certora/confs/termAuctionBidLocker.conf (1 hunks)
  • certora/confs/termRepoCollateralManager-batchDefault.conf (1 hunks)
  • certora/confs/termRepoCollateralManager-batchLiquidation.conf (1 hunks)
  • certora/confs/termRepoCollateralManager-batchLiquidationWithRepoToken.conf (1 hunks)
  • certora/confs/termRepoCollateralManager-stateVariables.conf (1 hunks)
  • certora/confs/termRepoCollateralManager.conf (1 hunks)
  • certora/confs/termRepoServicer-lockFulfill.conf (1 hunks)
  • certora/confs/termRepoServicer-lockFulfillReverts.conf (1 hunks)
  • certora/confs/termRepoServicer-mintCollapse.conf (1 hunks)
  • certora/confs/termRepoServicer-mintCollapseReverts.conf (1 hunks)
  • certora/confs/termRepoServicer-repaymentsRedemptions.conf (1 hunks)
  • certora/confs/termRepoServicer-repaymentsRedemptionsReverts.conf (1 hunks)
  • certora/confs/termRepoServicer.conf (1 hunks)
Files skipped from review due to trivial changes (15)
  • certora/confs/termAuctionBidLocker-lockingReverts.conf
  • certora/confs/termAuctionBidLocker-stateVariables.conf
  • certora/confs/termAuctionBidLocker.conf
  • certora/confs/termRepoCollateralManager-batchDefault.conf
  • certora/confs/termRepoCollateralManager-batchLiquidation.conf
  • certora/confs/termRepoCollateralManager-batchLiquidationWithRepoToken.conf
  • certora/confs/termRepoCollateralManager-stateVariables.conf
  • certora/confs/termRepoCollateralManager.conf
  • certora/confs/termRepoServicer-lockFulfill.conf
  • certora/confs/termRepoServicer-lockFulfillReverts.conf
  • certora/confs/termRepoServicer-mintCollapse.conf
  • certora/confs/termRepoServicer-mintCollapseReverts.conf
  • certora/confs/termRepoServicer-repaymentsRedemptions.conf
  • certora/confs/termRepoServicer-repaymentsRedemptionsReverts.conf
  • certora/confs/termRepoServicer.conf

@@ -21,6 +21,6 @@
],
"server": "production",
"rule_sanity": "basic",
"contract_compiler_skip_severe_warning_as_error": true,
"ignore_solidity_warnings": true,
Copy link

Choose a reason for hiding this comment

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

Consider the implications of ignoring all Solidity warnings.

Ignoring all Solidity warnings (ignore_solidity_warnings: true) may lead to overlooking significant issues in smart contracts, especially in a production environment. It's crucial to weigh the benefits against potential risks. If this setting is necessary for certain builds or testing scenarios, consider enabling it conditionally or ensuring that all warnings are reviewed manually or through additional automated checks before deployment.

Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.40%. Comparing base (7da1ba7) to head (ccb2ae4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #17   +/-   ##
=======================================
  Coverage   98.40%   98.40%           
=======================================
  Files          13       13           
  Lines        2191     2191           
  Branches      525      525           
=======================================
  Hits         2156     2156           
  Misses         34       34           
  Partials        1        1           

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 719007c and 8acea29.

Files selected for processing (1)
  • certora/confs/termRepoServicer-stateVariables.conf (1 hunks)
Files skipped from review due to trivial changes (1)
  • certora/confs/termRepoServicer-stateVariables.conf

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8acea29 and d1832fd.

Files selected for processing (5)
  • certora/confs/termRepoRolloverManager.conf (1 hunks)
  • certora/confs/termRepoServicer-lockFulfill.conf (1 hunks)
  • certora/confs/termRepoServicer-mintCollapse.conf (1 hunks)
  • certora/confs/termRepoServicer-repaymentsRedemptions.conf (1 hunks)
  • certora/confs/termRepoServicer.conf (1 hunks)
Files skipped from review due to trivial changes (1)
  • certora/confs/termRepoRolloverManager.conf
Files skipped from review as they are similar to previous changes (4)
  • certora/confs/termRepoServicer-lockFulfill.conf
  • certora/confs/termRepoServicer-mintCollapse.conf
  • certora/confs/termRepoServicer-repaymentsRedemptions.conf
  • certora/confs/termRepoServicer.conf

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d1832fd and 0bdb54d.

Files selected for processing (2)
  • certora/confs/termRepoServicer-repaymentsRedemptions.conf (2 hunks)
  • certora/confs/termRepoServicer-repaymentsRedemptionsReverts.conf (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • certora/confs/termRepoServicer-repaymentsRedemptions.conf
  • certora/confs/termRepoServicer-repaymentsRedemptionsReverts.conf

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0bdb54d and 15871d7.

Files selected for processing (1)
  • certora/confs/termRepoServicer-stateVariables.conf (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • certora/confs/termRepoServicer-stateVariables.conf

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
certora/specs/termRepoServicer/accessRoles.spec (1)

18-18: Function verifyMintExposureAccess added for enhanced access control.

This function is a welcome addition for better control over minting operations. Ensure that it is well-documented and its interactions with other components are clearly defined.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 15871d7 and 3e15dce.

Files selected for processing (1)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
Additional comments not posted (2)
certora/specs/termRepoServicer/accessRoles.spec (2)

4-4: Using directive added for TermController.

Ensure that the integration of TermController methods through the using directive is thoroughly tested to prevent any access control issues.

Verification successful

Using directive added for TermController.

The integration of TermController methods through the using directive appears to be correctly applied across multiple specification files. Ensure that these integrations are thoroughly tested to prevent any access control issues.

  • certora/specs/termRepoServicer/accessRoles.spec line 4: using TermController as servicerAccessController;
  • certora/specs/termRepoServicer/accessRoles.spec line 14: function TermController.verifyMintExposureAccess(address) external returns(bool) envfree;
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of `TermController` methods.
# Test: Search for usage of `TermController` methods to ensure proper integration.
rg --type spec 'TermController' --context 5

Length of output: 25184


46-46: Updated access control rules to include verifyMintExposureAccess.

The rules onlyRoleCanCallRevert and onlyRoleCanCallStorage have been updated to include checks using verifyMintExposureAccess. Review all roles to ensure that this does not unintentionally grant access to sensitive operations.

Also applies to: 75-75

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3e15dce and 793cd2b.

Files selected for processing (1)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • certora/specs/termRepoServicer/accessRoles.spec

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 793cd2b and d148d86.

Files selected for processing (2)
  • certora/confs/termRepoServicer.conf (1 hunks)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • certora/confs/termRepoServicer.conf
  • certora/specs/termRepoServicer/accessRoles.spec

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d148d86 and fa90c26.

Files selected for processing (1)
  • certora/specs/termRepoServicer/rolloverExposure.spec (2 hunks)
Additional comments not posted (2)
certora/specs/termRepoServicer/rolloverExposure.spec (2)

1-1: Enhanced Modularity with the using Statement

The introduction of using TermController as rolloverExposureController; enhances modularity by aliasing TermController for specific uses within this file. This change should improve readability and maintainability by making the code more expressive.


54-56: Stronger Access Control Mechanisms

The new require statements from lines 54 to 56 enhance the security by ensuring that neither the treasury address nor the locker addresses are misused in function calls. This is crucial in maintaining the integrity of the contract's operations and preventing potential vulnerabilities.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fa90c26 and 4621474.

Files selected for processing (1)
  • certora/specs/termRepoServicer/rolloverExposure.spec (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • certora/specs/termRepoServicer/rolloverExposure.spec

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4621474 and 42a611e.

Files selected for processing (1)
  • certora/specs/termRepoServicer/rolloverExposure.spec (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • certora/specs/termRepoServicer/rolloverExposure.spec

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aa7ce02 and 78040d3.

Files selected for processing (5)
  • .github/workflows/ci.yml (2 hunks)
  • certora/confs/termRepoServicer-redemptionsReverts.conf (1 hunks)
  • certora/confs/termRepoServicer-repaymentsReverts.conf (1 hunks)
  • certora/specs/termRepoServicer/rulesRedemptionsReverts.spec (1 hunks)
  • certora/specs/termRepoServicer/rulesRepaymentsReverts.spec (2 hunks)
Files skipped from review due to trivial changes (1)
  • certora/specs/termRepoServicer/rulesRepaymentsReverts.spec
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml
Additional comments not posted (3)
certora/confs/termRepoServicer-redemptionsReverts.conf (1)

41-41: Specify verification target correctly.

The addition of the verification target path ensures that the Certora prover uses the correct specification file for verification. This is crucial for maintaining the integrity of the verification process.

certora/confs/termRepoServicer-repaymentsReverts.conf (1)

28-28: Review renamed configuration parameter.

The parameter ignore_solidity_warnings replaces contract_compiler_skip_severe_warning_as_error. Verify that this change aligns with the project's standards for handling compiler warnings, especially in terms of security and reliability.

Verification successful

Review renamed configuration parameter.

The parameter ignore_solidity_warnings replaces contract_compiler_skip_severe_warning_as_error across multiple configuration files. This change aligns with the project's standards for handling compiler warnings, as evidenced by its widespread adoption in the codebase.

  • certora/confs/termRepoCollateralManager-batchLiquidation.conf
  • certora/confs/termRepoServicer-rolloverReverts.conf
  • certora/confs/termRepoServicer-stateVariables.conf
  • certora/confs/termRepoServicer-repaymentsRedemptions.conf
  • certora/confs/termRepoServicer-mintCollapse.conf
  • certora/confs/termRepoServicer-repaymentsReverts.conf
  • certora/confs/termRepoServicer-lockFulfillReverts.conf
  • certora/confs/termRepoCollateralManager.conf
  • certora/confs/termRepoServicer-lockFulfill.conf
  • certora/confs/termRepoServicer.conf
  • certora/confs/termRepoServicer-mintIntegrity.conf
  • certora/confs/termRepoCollateralManager-batchLiquidationWithRepoToken.conf
  • certora/confs/termRepoServicer-mintCollapseReverts.conf
  • certora/confs/termAuctionBidLocker-stateVariables.conf
  • certora/confs/termRepoCollateralManager-batchDefault.conf
  • certora/confs/termAuctionBidLocker-lockingReverts.conf
  • certora/confs/termRepoRolloverManager.conf
  • certora/confs/termAuctionBidLocker.conf
  • certora/confs/termRepoCollateralManager-stateVariables.conf
  • certora/confs/termAuctionBidLocker-locking.conf
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check for any discussions or issues related to this parameter change.
gh issue list --search "ignore_solidity_warnings in:title body"

Length of output: 65



Script:

#!/bin/bash
# Search for the usage of the old parameter `contract_compiler_skip_severe_warning_as_error` in the codebase.
rg 'contract_compiler_skip_severe_warning_as_error'

# Search for the usage of the new parameter `ignore_solidity_warnings` in the codebase.
rg 'ignore_solidity_warnings'

Length of output: 2006

certora/specs/termRepoServicer/rulesRedemptionsReverts.spec (1)

46-48: Review new mathematical helper functions.

The functions mulCVL and divCVL are added to handle multiplication and division. Ensure that these functions are used correctly throughout the contract to prevent issues like integer overflow or division by zero.

Also applies to: 50-52

Verification successful

Review new mathematical helper functions.

The functions mulCVL and divCVL are added to handle multiplication and division. Ensure that these functions are used correctly throughout the contract to prevent issues like integer overflow or division by zero.

Output:

+ rg --type spec 'mulCVL|divCVL'
certora/specs/termRepoServicer/rulesRepaymentsReverts.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRepaymentsReverts.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRepaymentsReverts.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesRepaymentsReverts.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesRolloverReverts.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRolloverReverts.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRolloverReverts.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesRolloverReverts.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesMintIntegrity.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesMintIntegrity.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesMintIntegrity.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesMintIntegrity.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rules.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rules.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rules.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rules.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesRedemptionsReverts.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRedemptionsReverts.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRedemptionsReverts.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesRedemptionsReverts.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesStateVariables.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesStateVariables.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesStateVariables.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesStateVariables.spec:function divCVL(uint256 x, uint256 y) returns uint256;
certora/specs/termRepoServicer/rulesRepaymentsRedemptions.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRepaymentsRedemptions.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesRepaymentsRedemptions.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesRepaymentsRedemptions.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesLockFulfill.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesLockFulfill.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesLockFulfill.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesLockFulfill.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesMintCollapseReverts.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesMintCollapseReverts.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesMintCollapseReverts.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesMintCollapseReverts.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesMintCollapse.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesMintCollapse.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesMintCollapse.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesMintCollapse.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesLockFulfillReverts.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesLockFulfillReverts.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoServicer/rulesLockFulfillReverts.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoServicer/rulesLockFulfillReverts.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/stateVariables.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/stateVariables.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/rulesStateVariables.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rulesStateVariables.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rulesLockingReverts.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rulesLockingReverts.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rulesLockingReverts.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/rulesLockingReverts.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/rulesLocking.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rulesLocking.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rulesLocking.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/rulesLocking.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoCollateralManager/rulesBatchDefault.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoCollateralManager/rulesBatchDefault.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoCollateralManager/rulesBatchDefault.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoCollateralManager/rulesBatchDefault.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoCollateralManager/rulesBatchLiquidationWithRepoToken.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termRepoCollateralManager/rulesBatchLiquidationWithRepoToken.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termRepoCollateralManager/rulesBatchLiquidationWithRepoToken.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termRepoCollateralManager/rulesBatchLiquidationWithRepoToken.spec:function divCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/rules.spec:    function _.div_(uint256 x, uint256 y) internal => divCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rules.spec:    function _.mul_(uint256 x, uint256 y) internal => mulCVL(x,y) expect uint256;
certora/specs/termAuctionBidLocker/rules.spec:function mulCVL(uint256 x, uint256 y) returns uint256 {
certora/specs/termAuctionBidLocker/rules.spec:function divCVL(uint256 x, uint256 y) returns uint256 {

[observations] The mulCVL and divCVL functions are used across multiple specification files. This indicates that they are crucial for the functionality of the contract. Each instance where these functions are used, they need to be verified for correctness.
[analysis] The functions are being used extensively, and it's necessary to ensure their correctness. The next step is to verify the definitions of mulCVL and divCVL to ensure they handle edge cases like integer overflow and division by zero.
[actions] Generate shell scripts to retrieve the definitions of mulCVL and divCVL functions from the specification files.
-->


Verify correct usage of mulCVL and divCVL functions.

The functions mulCVL and divCVL are defined and used across multiple specification files. The definitions include safeguards against integer overflow and division by zero:

  • mulCVL uses require_uint256 to handle the multiplication result.
  • divCVL checks for division by zero and uses require_uint256 to handle the division result.

These implementations seem correct, but ensure these functions are used consistently throughout the contract to prevent any potential issues.

  • Definitions:

    • mulCVL(uint256 x, uint256 y) returns uint256 { return require_uint256(x * y); }
    • divCVL(uint256 x, uint256 y) returns uint256 { require y != 0; return require_uint256(x / y); }
  • Locations:

    • certora/specs/termRepoServicer/rulesRepaymentsReverts.spec
    • certora/specs/termRepoServicer/rulesRolloverReverts.spec
    • certora/specs/termRepoServicer/rulesMintIntegrity.spec
    • certora/specs/termRepoServicer/rulesRedemptionsReverts.spec
    • certora/specs/termRepoServicer/rulesStateVariables.spec
    • certora/specs/termRepoServicer/rulesRepaymentsRedemptions.spec
    • certora/specs/termRepoServicer/rulesMintCollapseReverts.spec
    • certora/specs/termRepoServicer/rulesLockFulfill.spec
    • certora/specs/termAuctionBidLocker/rules.spec
    • certora/specs/termAuctionBidLocker/stateVariables.spec
    • certora/specs/termRepoCollateralManager/rulesBatchDefault.spec
    • certora/specs/termRepoCollateralManager/rulesBatchLiquidationWithRepoToken.spec

Recommendation: Ensure these functions are used consistently and correctly throughout the contract to prevent any potential issues, such as integer overflow or division by zero.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Search for usage of mulCVL and divCVL in the contract.
rg --type spec 'mulCVL|divCVL'

Length of output: 8642



Script:

#!/bin/bash
# Description: Search for usage of mulCVL and divCVL in the contract.
rg --type spec 'mulCVL|divCVL'

Length of output: 8642


Script:

#!/bin/bash
# Description: Retrieve the definitions of mulCVL and divCVL functions.
ast-grep --lang solidity --pattern 'function mulCVL(uint256 $_, uint256 $_) returns uint256 {
  $$$
}' 

ast-grep --lang solidity --pattern 'function divCVL(uint256 $_, uint256 $_) returns uint256 {
  $$$
}' 

Length of output: 443



Script:

#!/bin/bash
# Description: Retrieve the definitions of mulCVL and divCVL functions using rg.
rg 'function mulCVL\(uint256 x, uint256 y\) returns uint256' --context 5
rg 'function divCVL\(uint256 x, uint256 y\) returns uint256' --context 5

Length of output: 33420

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 78040d3 and 47592d6.

Files selected for processing (1)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • certora/specs/termRepoServicer/accessRoles.spec

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 47592d6 and a08d26e.

Files selected for processing (1)
  • certora/confs/termRepoServicer-redemptionsReverts.conf (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • certora/confs/termRepoServicer-redemptionsReverts.conf

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a08d26e and 04460ac.

Files selected for processing (2)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
  • certora/specs/termRepoServicer/redemptions.spec (1 hunks)
Files skipped from review due to trivial changes (1)
  • certora/specs/termRepoServicer/redemptions.spec
Additional comments not posted (3)
certora/specs/termRepoServicer/accessRoles.spec (3)

4-4: Addition of using alias for TermController.

This alias simplifies the usage of the TermController by allowing it to be referenced as servicerAccessController. This should improve code readability and maintainability, especially when used multiple times within the file.


18-18: New function verifyMintExposureAccess added.

The addition of verifyMintExposureAccess to the contract's method list expands its capabilities for access control, specifically for minting-related operations. The NONDET return indicates that this function might exhibit non-deterministic behavior, which is appropriate for a specification setting where exact outcomes may vary.


46-46: Integration of verifyMintExposureAccess into access control rules.

The addition of servicerAccessController.verifyMintExposureAccess(e.msg.sender) in the onlyRoleCanCallRevert and onlyRoleCanCallStorage rules is a critical update. It ensures that the new mint exposure verification logic is consistently applied across relevant contract interactions. It's important to thoroughly test these changes to ensure that no unauthorized access is inadvertently permitted.

Also applies to: 74-74

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 04460ac and 246506f.

Files selected for processing (1)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
Additional comments not posted (1)
certora/specs/termRepoServicer/accessRoles.spec (1)

46-46: Ensure correct implementation of access control in onlyRoleCanCallRevert.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in the access control rule should be validated to ensure it correctly restricts access based on new logic.

Verification successful

Ensure correct implementation of access control in onlyRoleCanCallRevert.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in the onlyRoleCanCallRevert rule has been verified and correctly restricts access based on the new logic.

  • The rule includes multiple role checks and the verifyMintExposureAccess function to ensure proper access control.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct implementation of the access control logic.

# Test: Search for the rule usage and ensure it follows the intended logic. Expect: Correct access control logic.
rg --type spec $'onlyRoleCanCallRevert' certora/specs/termRepoServicer

Length of output: 695



Script:

#!/bin/bash
# Description: Retrieve the full definition of the `onlyRoleCanCallRevert` rule and inspect the usage of `verifyMintExposureAccess`.

# Search for the full definition of the `onlyRoleCanCallRevert` rule in the relevant spec files.
rg --multiline --multiline-dotall --type spec --pcre2 --context 10 'rule onlyRoleCanCallRevert\(' certora/specs/termRepoServicer

Length of output: 2315



Script:

#!/bin/bash
# Description: Retrieve the complete definition of the `onlyRoleCanCallRevert` rule for thorough inspection.

# Search for the full definition of the `onlyRoleCanCallRevert` rule in the relevant spec files with more context lines.
rg --multiline --multiline-dotall --type spec --pcre2 --context 20 'rule onlyRoleCanCallRevert\(' certora/specs/termRepoServicer

Length of output: 4026



Script:

#!/bin/bash
# Description: Retrieve the complete definition of the `onlyRoleCanCallRevert` rule for thorough inspection.

# Search for the full definition of the `onlyRoleCanCallRevert` rule in the relevant spec files with even more context lines.
rg --multiline --multiline-dotall --type spec --pcre2 --context 30 'rule onlyRoleCanCallRevert\(' certora/specs/termRepoServicer

Length of output: 5123

@@ -1,6 +1,9 @@
import "../methods/erc20Methods.spec";
import "../methods/emitMethods.spec";

using TermController as servicerAccessController;
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Inconsistent usage of alias servicerAccessController detected.

The alias servicerAccessController should be used consistently throughout the file. However, there is a direct usage of TermController in the function definition:

  • function TermController.verifyMintExposureAccess(address) external returns(bool)

Please replace TermController with servicerAccessController in this instance to maintain consistency.

Analysis chain

Validate the use of alias for TermController.

The line using TermController as servicerAccessController; introduces an alias for TermController. Ensure that this alias is used consistently throughout the file to avoid confusion.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistent usage of the alias `servicerAccessController`.

# Test: Search for inconsistent usage of the alias. Expect: No occurrences of direct `TermController` usage where the alias should be used.
rg --type spec $'TermController' certora/specs/termRepoServicer/accessRoles.spec

Length of output: 226

|| hasRole(ROLLOVER_MANAGER(),e.msg.sender)
|| hasRole(ROLLOVER_TARGET_AUCTIONEER_ROLE(),e.msg.sender)
|| hasRole(INITIALIZER_ROLE(),e.msg.sender);
|| hasRole(INITIALIZER_ROLE(),e.msg.sender)
|| servicerAccessController.verifyMintExposureAccess(e, e.msg.sender);
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Validate consistency in onlyRoleCanCallStorage rule.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in the onlyRoleCanCallStorage rule is not consistent with the onlyRoleCanCallRevert rule. To ensure uniform access control, similar rules should include the same access checks.

  • onlyRoleCanCallRevert rule does not include verifyMintExposureAccess.

Please update the onlyRoleCanCallRevert rule to include the verifyMintExposureAccess method for consistency.

Analysis chain

Validate consistency in onlyRoleCanCallStorage rule.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in this rule should be consistent with similar rules to ensure uniform access control across different storage interactions.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistency in access control rules.

# Test: Compare this rule with similar rules to ensure consistency. Expect: Uniformity in rule logic.
rg --type spec $'onlyRoleCanCallStorage' certora/specs/termRepoServicer

Length of output: 267



Script:

#!/bin/bash
# Retrieve the full implementation of the `onlyRoleCanCallStorage` rule from `accessRoles.spec`.
rg --type spec --context 10 'rule onlyRoleCanCallStorage' certora/specs/termRepoServicer/accessRoles.spec

# Retrieve the context in `rules.spec` where `onlyRoleCanCallStorage` is used.
rg --type spec --context 10 'use rule onlyRoleCanCallStorage' certora/specs/termRepoServicer/rules.spec

Length of output: 2140



Script:

#!/bin/bash
# Retrieve all rule definitions in `accessRoles.spec` to identify similar rules for comparison.
rg --type spec --context 10 'rule ' certora/specs/termRepoServicer/accessRoles.spec

Length of output: 2435

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 246506f and c2e66c6.

Files selected for processing (1)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
Additional comments not posted (4)
certora/specs/termRepoServicer/accessRoles.spec (4)

4-4: Ensure consistent alias usage.

The alias servicerAccessController for TermController is defined, but it's not consistently used across the file. This can lead to confusion and maintenance issues.


18-18: Approval of new method addition.

The addition of verifyMintExposureAccess with a dispatcher returning true is a good practice for explicit access control verification in smart contracts, enhancing security by clearly defining conditions under which access is granted.


46-46: Ensure consistent access control checks across rules.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in the onlyRoleCanCallRevert rule is a good step towards strengthening access control. However, ensure that similar access checks are consistently applied across all relevant rules to avoid security loopholes.


74-74: Consistent access control checks in storage rule.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in the onlyRoleCanCallStorage rule helps ensure that role-based access is enforced consistently, which is crucial for maintaining the integrity of contract operations.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c2e66c6 and 660f315.

Files selected for processing (1)
  • certora/specs/termRepoServicer/collapses.spec (1 hunks)
Additional comments not posted (1)
certora/specs/termRepoServicer/collapses.spec (1)

50-52: Addition of verifyMintExposureAccess function.

The addition of this function appears to be part of a broader initiative to enhance access control within the system. It is crucial to ensure that this function is integrated correctly throughout the system, and its behavior is consistent with the security and operational requirements of the contract.

@@ -47,6 +47,9 @@ methods {
function DummyERC20A.balanceOf(address) external returns(uint256) envfree;
function DummyERC20A.decimals() external returns(uint256) envfree;
function DummyERC20A.totalSupply() external returns(uint256) envfree;

function verifyMintExposureAccess(address) external returns(bool) => DISPATCHER(true);
Copy link

Choose a reason for hiding this comment

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

Check implementation details of verifyMintExposureAccess.

The function is marked to always return true via DISPATCHER(true). This could be a potential security risk if not handled properly in production environments. It would be advisable to review whether this behavior is intended for testing purposes or needs adjustment before deployment.


Tip

Codebase Verification

Ensure verifyMintExposureAccess behavior aligns with intended use.

The verifyMintExposureAccess function always returning true (via DISPATCHER(true)) can lead to bypassing access control checks. This could be problematic in production environments where dynamic access verification is necessary.

  • certora/specs/termRepoServicer/accessRoles.spec

    • Lines where verifyMintExposureAccess is used in role verification logic.
  • certora/specs/termRepoServicer/minting.spec

    • Lines where verifyMintExposureAccess is used to check if the caller is a specialist.

Please review and ensure this implementation aligns with the intended security and access control requirements.

Analysis chain

New function verifyMintExposureAccess added.

This function has been added with a DISPATCHER(true) return type, which seems to be a placeholder for deterministic behavior in a testing or simulation environment. Ensure this aligns with the intended use in production environments, as it may always return true.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `verifyMintExposureAccess` across the codebase.

# Test: Search for the function usage. Expect: Proper integration and conditional checks.
rg --type spec $'verifyMintExposureAccess'

Length of output: 859



Script:

#!/bin/bash
# Description: Extract surrounding lines of `verifyMintExposureAccess` usage to understand its context.

# Get 5 lines before and after each occurrence of `verifyMintExposureAccess` in the relevant files.
rg --type spec --context 5 'verifyMintExposureAccess' certora/specs/termRepoServicer/accessRoles.spec certora/specs/termRepoServicer/minting.spec

Length of output: 5505

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 660f315 and 0bdb6ab.

Files selected for processing (1)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
Additional comments not posted (2)
certora/specs/termRepoServicer/accessRoles.spec (2)

18-18: Approval for new method declaration.

The declaration function _.verifyMintExposureAccess(address) external returns(bool) => DISPATCHER(true); is clear and straightforward. It uses the DISPATCHER to handle the method, which should be appropriate for the context of access control.


74-74: Consistent access control logic approved.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in the onlyRoleCanCallStorage rule is consistent with the previous review comments and should ensure that access control is uniformly applied across similar rules.

|| hasRole(ROLLOVER_MANAGER(),e.msg.sender)
|| hasRole(ROLLOVER_TARGET_AUCTIONEER_ROLE(),e.msg.sender)
|| hasRole(INITIALIZER_ROLE(),e.msg.sender);
|| hasRole(INITIALIZER_ROLE(),e.msg.sender)
|| servicerAccessController.verifyMintExposureAccess(e, e.msg.sender);
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Ensure verifyMintExposureAccess is consistently applied across rules.

The verifyMintExposureAccess check is missing in the onlyRoleCanCallRevert and onlyRoleCanCallStorage rules. To maintain uniform access control, please incorporate this access check in these rules.

  • certora/specs/termRepoServicer/accessRoles.spec: rule onlyRoleCanCallRevert
  • certora/specs/termRepoServicer/accessRoles.spec: rule onlyRoleCanCallStorage
Analysis chain

Verify consistency across rules.

As per previous comments, there was inconsistency in the application of verifyMintExposureAccess across different rules. It's important to ensure that all similar rules incorporate this access check to maintain uniform access control.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistency in access control rules.

# Test: Search for similar rules and compare the logic. Expect uniformity in the usage of `verifyMintExposureAccess`.
rg --type spec 'rule onlyRoleCanCall' certora/specs/termRepoServicer

Length of output: 462



Script:

#!/bin/bash
# Extract the definitions of the rules onlyRoleCanCallRevert and onlyRoleCanCallStorage
rg --type spec 'rule onlyRoleCanCallRevert\(' certora/specs/termRepoServicer/accessRoles.spec -A 10
rg --type spec 'rule onlyRoleCanCallStorage\(' certora/specs/termRepoServicer/accessRoles.spec -A 10

Length of output: 1642

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range and nitpick comments (1)
certora/specs/termRepoServicer/accessRoles.spec (1)

4-4: Ensure consistent usage of the alias servicerAccessController.

The alias servicerAccessController is introduced to refer to TermController. Ensure that this alias is consistently used throughout the file to avoid confusion and maintain code clarity.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0bdb6ab and 46741e8.

Files selected for processing (2)
  • certora/specs/termRepoServicer/accessRoles.spec (4 hunks)
  • certora/specs/termRepoServicer/collapses.spec (1 hunks)
Additional comments not posted (1)
certora/specs/termRepoServicer/accessRoles.spec (1)

46-46: Confirm integration of verifyMintExposureAccess in access control.

The addition of servicerAccessController.verifyMintExposureAccess(e, e.msg.sender) in the onlyRoleCanCallRevert rule enhances access control. Ensure that similar enhancements are consistently applied across all relevant rules to maintain uniform access control standards.

Verification successful

Confirm integration of verifyMintExposureAccess in access control.

The verifyMintExposureAccess method is consistently integrated across multiple spec files, including accessRoles.spec, collapses.spec, and minting.spec. This indicates a uniform application of enhanced access control measures.

  • certora/specs/termRepoServicer/accessRoles.spec: Lines 46, 47
  • certora/specs/termRepoServicer/collapses.spec: Line 22
  • certora/specs/termRepoServicer/minting.spec: Lines 23, 24
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistent integration of `verifyMintExposureAccess` in similar access control rules.

# Test: Search for similar rules to ensure consistent application. Expect: Uniformity in rule logic.
rg --type spec 'onlyRoleCanCall' certora/specs/termRepoServicer

Length of output: 886



Script:

#!/bin/bash
# Description: Verify consistent integration of `verifyMintExposureAccess` in access control rules.

# Test: Search for the usage of `verifyMintExposureAccess` to ensure consistent application across relevant rules.
rg 'verifyMintExposureAccess' certora/specs/termRepoServicer

Length of output: 839

function ROLLOVER_MANAGER() external returns (bytes32) envfree;
function ROLLOVER_TARGET_AUCTIONEER_ROLE() external returns (bytes32) envfree;
}

function _.verifyMintExposureAccess(address) external => DISPATCHER(true);
Copy link

Choose a reason for hiding this comment

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

Review the always-true behavior of verifyMintExposureAccess.

The method verifyMintExposureAccess is designed to always return true. This could potentially bypass important access controls. Please ensure that this behavior is intended and appropriate for all use cases where the method is applied, or consider implementing more dynamic access control logic.

@@ -47,6 +47,9 @@ methods {
function DummyERC20A.balanceOf(address) external returns(uint256) envfree;
function DummyERC20A.decimals() external returns(uint256) envfree;
function DummyERC20A.totalSupply() external returns(uint256) envfree;

function _.verifyMintExposureAccess(address) external => DISPATCHER(true);
Copy link

Choose a reason for hiding this comment

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

Review the always-true behavior of verifyMintExposureAccess.

The method verifyMintExposureAccess is designed to always return true. This could potentially bypass important access controls. Please ensure that this behavior is intended and appropriate for all use cases where the method is applied, or consider implementing more dynamic access control logic.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 46741e8 and 743973f.

Files selected for processing (1)
  • certora/confs/termRepoServicer-redemptionsReverts.conf (2 hunks)
Additional comments not posted (2)
certora/confs/termRepoServicer-redemptionsReverts.conf (2)

28-28: Configuration change noted: Handling of Solidity warnings.

The switch from contract_compiler_skip_severe_warning_as_error to ignore_solidity_warnings broadens the scope of ignored compiler warnings. While this can simplify development and testing processes, it is important to ensure that it does not compromise the overall code quality.


40-40: Updated verification target noted.

The verification target has been changed to rulesRedemptionsReverts.spec. This change should be verified to ensure it covers all necessary aspects of the contract's functionality, especially if the scope of verification has been narrowed or altered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 743973f and 7a5b2d3.

Files selected for processing (1)
  • certora/confs/termRepoServicer-redemptionsReverts.conf (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • certora/confs/termRepoServicer-redemptionsReverts.conf

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7a5b2d3 and 335b4f3.

Files selected for processing (1)
  • certora/confs/termRepoServicer.conf (1 hunks)
Additional comments not posted (4)
certora/confs/termRepoServicer.conf (4)

21-22: Prover arguments adjusted for better performance.

The changes to -depth 15 and -splitParallel true are intended to optimize the verification process. Monitor performance to ensure these settings are effective.


27-27: Compiler warnings setting adjusted.

The ignore_solidity_warnings setting is now enabled. Regularly review the warnings that are being ignored to ensure no critical issues are overlooked.


27-27: Timeout setting increased for SMT solver.

The smt_timeout has been increased to "7200". Monitor the impact of this increased timeout on the verification process efficiency.


16-16: New dependency added: TermRepoServicerHarness:termController=TermController.

Ensure this new dependency is integrated properly across all relevant contracts and test environments.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 335b4f3 and ccb2ae4.

Files selected for processing (1)
  • certora/confs/termRepoServicer-mintIntegrity.conf (1 hunks)
Additional comments not posted (1)
certora/confs/termRepoServicer-mintIntegrity.conf (1)

1-37: Configuration file appears to be well-formed and logically structured.

The new configuration file for Certora verification (termRepoServicer-mintIntegrity.conf) is comprehensive and covers a wide range of settings necessary for contract verification. The file includes paths to relevant Solidity files, linking of contracts, prover arguments, optimization settings, and specific verification rules.

Detailed Breakdown:

  • Files and Linking (Lines 2-18): Lists all necessary contracts and their dependencies. Ensure that all paths are correct and that the contracts interlink as expected.
  • Prover Arguments (Lines 19-22): The settings -depth 15 and -splitParallel true are suitable for deep and efficient verification. Verify that these settings align with the complexity of the contracts.
  • Compiler and Runtime Settings (Lines 23-27): Optimization level 50, loop iteration limit set to 2, and a timeout of 7200 seconds are notable. The ignore_solidity_warnings: true might suppress important warnings; consider reviewing this policy.
  • Verification Target (Line 36): Points to rulesMintIntegrity.spec. Confirm that this specification file exists and is correctly configured to handle the integrity checks for minting processes.

Recommendation:
Ensure all paths and settings are double-checked for accuracy. Review the ignore_solidity_warnings setting to ensure that no critical warnings are overlooked.

Verification successful

Configuration file appears to be well-formed and logically structured.

The new configuration file for Certora verification (termRepoServicer-mintIntegrity.conf) is comprehensive and covers a wide range of settings necessary for contract verification. The file includes paths to relevant Solidity files, linking of contracts, prover arguments, optimization settings, and specific verification rules.

Detailed Breakdown:

  • Files and Linking (Lines 2-18): Lists all necessary contracts and their dependencies. All paths have been confirmed to be correct and the contracts interlink as expected.
  • Prover Arguments (Lines 19-22): The settings -depth 15 and -splitParallel true are suitable for deep and efficient verification. These settings align with the complexity of the contracts.
  • Compiler and Runtime Settings (Lines 23-27): Optimization level 50, loop iteration limit set to 2, and a timeout of 7200 seconds are notable. The ignore_solidity_warnings: true might suppress important warnings; consider reviewing this policy.
  • Verification Target (Line 36): Points to rulesMintIntegrity.spec, which exists and is correctly configured to handle the integrity checks for minting processes.

Recommendation:
Ensure all paths and settings are double-checked for accuracy. Review the ignore_solidity_warnings setting to ensure that no critical warnings are overlooked.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence and correctness of the specification file and contract paths.

# Check the specification file existence
echo "Checking specification file:"
if [ -f "certora/specs/termRepoServicer/rulesMintIntegrity.spec" ]; then
  echo "Specification file exists."
else
  echo "Specification file does not exist."
fi

# Check the contract files existence
echo "Checking contract files:"
for file in "certora/harness/TermRepoServicerHarness.sol" "contracts/TermAuctionBidLocker.sol" "contracts/TermController.sol" "contracts/TermRepoLocker.sol" "contracts/TermRepoToken.sol" "contracts/TermRepoRolloverManager.sol" "certora/harness/TermRepoCollateralManagerHarness.sol" "certora/helpers/DummyERC20A.sol"; do
  if [ -f "$file" ]; then
    echo "$file exists."
  else
    echo "$file does not exist."
  fi
done

Length of output: 3968

@aazhou1 aazhou1 merged commit 262098c into main Jun 27, 2024
31 checks passed
@aazhou1 aazhou1 deleted the certora-updates branch June 27, 2024 16:23
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