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

ci: fix matrix exclude for solidity packages #3255

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Oct 9, 2024

Description
A clear and concise description of the features you're adding in this pull request.

Additional context
Add any other context about the problem you're solving.

Metadata

  • Fixes #[Link to Issue]

Summary by CodeRabbit

  • New Features
    • Introduced GasBenchmarkTest contracts in both contracts-core and solidity-devops packages for future gas benchmarking tests.
  • Documentation
    • Added comments to clarify the exclusion of the solidity-devops package from specific jobs in the workflow configuration.
  • Chores
    • Restructured the exclusion logic for improved clarity and consistency in the workflow.

@github-actions github-actions bot added M-ci Module: CI M-contracts Module: Contracts 2-reviewers C-Protocol-Critical PRs that modify protocol-critical code. size/xs labels Oct 9, 2024
Copy link
Contributor

coderabbitai bot commented Oct 9, 2024

Walkthrough

The changes in this pull request involve modifications to the .github/workflows/solidity.yml file, focusing on the exclusion of the solidity-devops package from specific jobs. Comments were added for clarity, and the exclusion logic was restructured. Additionally, two new Solidity test contracts named GasBenchmarkTest were introduced in separate files, each containing a public function that is currently empty. These changes do not affect the core functionality of the workflow or the existing job definitions.

Changes

File Path Change Summary
.github/workflows/solidity.yml Added comments and restructured exclusion logic for solidity-devops package in jobs like slither, gas-diff, and size-check. Retained if conditions for job execution based on package changes.
packages/contracts-core/test/GasBenchmark.t.sol Introduced GasBenchmarkTest contract with an empty testGasBenchmark function; noted no gas benchmark is required for contracts-core.
packages/solidity-devops/test/GasBenchmark.t.sol Introduced GasBenchmarkTest contract with an empty testGasBenchmark function; noted no gas benchmark is required for solidity-devops.

Possibly related PRs

Suggested labels

needs-go-generate-services/rfq

Suggested reviewers

  • trajan0x
  • bigboydiamonds

🐰 In the meadow, changes bloom,
With contracts new, there's plenty of room.
Exclusions clear, the workflow's bright,
Gas benchmarks stand, ready for flight.
Hop along, let progress ring,
In the code, we joyfully spring! 🌼


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

cloudflare-workers-and-pages bot commented Oct 9, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7c298ac
Status: ✅  Deploy successful!
Preview URL: https://be1a9e4b.sanguine-fe.pages.dev
Branch Preview URL: https://ci-matrix-package-exclude.sanguine-fe.pages.dev

View logs

@github-actions github-actions bot removed the M-ci Module: CI label Oct 9, 2024
Copy link
Contributor

@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)
packages/solidity-devops/test/GasBenchmark.t.sol (1)

1-2: Consider upgrading Solidity version

The current Solidity version (^0.8.0) is relatively recent, but you might want to consider upgrading to a more recent version (e.g., ^0.8.19 or ^0.8.20) to take advantage of the latest optimizations and security improvements.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 847600b and 7c298ac.

📒 Files selected for processing (3)
  • .github/workflows/solidity.yml (3 hunks)
  • packages/contracts-core/test/GasBenchmark.t.sol (1 hunks)
  • packages/solidity-devops/test/GasBenchmark.t.sol (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/solidity.yml

133-133: unexpected key "exclude" for "strategy" section. expected one of "fail-fast", "matrix", "max-parallel"

(syntax-check)


249-249: unexpected key "exclude" for "strategy" section. expected one of "fail-fast", "matrix", "max-parallel"

(syntax-check)


300-300: unexpected key "exclude" for "strategy" section. expected one of "fail-fast", "matrix", "max-parallel"

(syntax-check)

🔇 Additional comments (7)
packages/solidity-devops/test/GasBenchmark.t.sol (3)

4-4: LGTM: Appropriate import for Forge test

The import statement is correct and follows best practices by importing only the necessary Test contract from Forge's standard library.


6-7: Clarify the purpose of this contract

The comment states that no gas benchmark is required for solidity-devops, yet this contract is named GasBenchmarkTest. If no benchmark is needed, consider explaining why this contract exists or if it should be removed to avoid confusion.

Could you provide more context on why this contract is necessary if no gas benchmark is required?


8-9: ⚠️ Potential issue

Clarify the purpose of the empty testGasBenchmark function

The testGasBenchmark function is currently empty, which seems to align with the comment stating no gas benchmark is required. However, this raises a few questions:

  1. If no benchmark is needed, why does this function exist?
  2. If a benchmark is intended in the future, should there be a TODO comment explaining what needs to be implemented?
  3. Could this function be removed if it's not serving any purpose?

Consider either removing the function if it's not needed, or adding a comment explaining its future use if it's a placeholder.

Could you provide more information on the intended use of this function?

.github/workflows/solidity.yml (4)

132-134: LGTM: Appropriate exclusion for solidity-devops in the slither job

The exclusion of the solidity-devops package from the slither job is correctly implemented and well-commented. This is appropriate since the package contains only devops scripts rather than deployed contracts, making Slither analysis unnecessary.

Note: The static analysis tool flagged the exclude key as unexpected, but this is a false positive. The exclude key is valid and commonly used in GitHub Actions workflow files under the strategy section to exclude specific matrix combinations.

🧰 Tools
🪛 actionlint

133-133: unexpected key "exclude" for "strategy" section. expected one of "fail-fast", "matrix", "max-parallel"

(syntax-check)


249-250: LGTM: Appropriate exclusion for solidity-devops in the gas-diff job

The exclusion of the solidity-devops package from the gas-diff job is correctly implemented and well-commented. This exclusion is appropriate since the package contains only devops scripts rather than deployed contracts, making gas diff analysis irrelevant.

Note: As with the previous section, the static analysis tool's warning about the exclude key can be safely ignored as it's a false positive.

🧰 Tools
🪛 actionlint

249-249: unexpected key "exclude" for "strategy" section. expected one of "fail-fast", "matrix", "max-parallel"

(syntax-check)


299-301: LGTM: Appropriate exclusion for solidity-devops in the size-check job

The exclusion of the solidity-devops package from the size-check job is correctly implemented and well-commented. This exclusion is appropriate since the package contains only devops scripts rather than deployed contracts, making size check analysis irrelevant.

As with the previous sections, the static analysis tool's warning about the exclude key can be safely ignored as it's a false positive in the context of GitHub Actions workflows.

🧰 Tools
🪛 actionlint

300-300: unexpected key "exclude" for "strategy" section. expected one of "fail-fast", "matrix", "max-parallel"

(syntax-check)


Line range hint 132-301: Summary: Improved workflow efficiency by excluding solidity-devops from irrelevant jobs

The changes made to this workflow file consistently exclude the solidity-devops package from the slither, gas-diff, and size-check jobs. These exclusions are appropriate and well-implemented for the following reasons:

  1. They prevent unnecessary processing of a package that contains only devops scripts and no deployed contracts.
  2. Each exclusion is accompanied by a clear comment explaining the rationale, which enhances maintainability.
  3. The exclusions are correctly implemented using the exclude key under the strategy section in each relevant job.

These changes will improve the efficiency of the CI pipeline by avoiding irrelevant analyses on the solidity-devops package. The added comments also make the workflow more understandable for future maintainers.

Note: The static analysis warnings about the exclude key can be safely ignored, as they are false positives in the context of GitHub Actions workflows.

🧰 Tools
🪛 actionlint

249-249: unexpected key "exclude" for "strategy" section. expected one of "fail-fast", "matrix", "max-parallel"

(syntax-check)

Comment on lines +8 to +9
// solhint-disable-next-line no-empty-blocks
function testGasBenchmark() public {}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Reconsider the empty test function

The testGasBenchmark() function is currently empty. Empty test functions don't provide any value and may give a false sense of security.

Consider one of the following options:

  1. If gas benchmarking is needed, implement the actual benchmark logic.
  2. If no benchmark is required, remove this function and potentially the entire contract.
  3. If this is a placeholder for future implementation, add a TODO comment explaining the intended functionality.

Example of option 3:

 // solhint-disable-next-line no-empty-blocks
-function testGasBenchmark() public {}
+function testGasBenchmark() public {
+    // TODO: Implement gas benchmark logic for specific core contract operations
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// solhint-disable-next-line no-empty-blocks
function testGasBenchmark() public {}
// solhint-disable-next-line no-empty-blocks
function testGasBenchmark() public {
// TODO: Implement gas benchmark logic for specific core contract operations
}

Comment on lines +6 to +7
/// @notice No gas benchmark is required for contracts-core
contract GasBenchmarkTest is Test {
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Remove the unnecessary GasBenchmarkTest contract

The comment indicates that no gas benchmark is required for contracts-core, yet the GasBenchmarkTest contract is defined in packages/contracts-core/test/GasBenchmark.t.sol without any references or functionality. Consider removing this contract to eliminate confusion and maintain consistency.

🔗 Analysis chain

Clarify the purpose of this contract

The comment states that no gas benchmark is required for contracts-core, yet a GasBenchmarkTest contract is defined. This seems contradictory and may lead to confusion.

Could you please clarify the intended purpose of this contract? If no gas benchmark is truly required, consider removing this file entirely.


Retrying search with correct file extension for Solidity files

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for references to GasBenchmarkTest in the codebase

# Test: Search for references to GasBenchmarkTest
rg --type solidity "GasBenchmarkTest"

Length of output: 70


Script:

#!/bin/bash
# Description: Check for references to GasBenchmarkTest in Solidity files

rg -g "*.sol" "GasBenchmarkTest"

Length of output: 621

@ChiTimesChi ChiTimesChi merged commit 768209d into master Oct 9, 2024
48 of 50 checks passed
@ChiTimesChi ChiTimesChi deleted the ci/matrix-package-exclude branch October 9, 2024 13:51
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@847600b). Learn more about missing BASE report.
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master       #3255   +/-   ##
============================================
  Coverage          ?   93.10658%           
============================================
  Files             ?          89           
  Lines             ?        2205           
  Branches          ?         278           
============================================
  Hits              ?        2053           
  Misses            ?         143           
  Partials          ?           9           
Flag Coverage Δ
packages 90.43902% <ø> (?)
solidity 95.42373% <ø> (?)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant