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

chore(contracts-rfq): gas bench script #3283

Merged
merged 2 commits into from
Oct 14, 2024
Merged

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Oct 14, 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 a new script for gas usage benchmarking in the @synapsecns/contracts-rfq package.
  • Improvements

    • Enhanced GitHub Actions workflow for Solidity projects, optimizing job conditions and execution efficiency.

@ChiTimesChi ChiTimesChi requested a review from trajan0x as a code owner October 14, 2024 09:55
Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

The pull request introduces significant updates to the GitHub Actions workflow for Solidity projects, specifically in the .github/workflows/solidity.yml file. Key modifications include changes to the gas-diff job to utilize npm scripts for gas reports, conditional execution of certain jobs based on package counts, and enhanced job dependencies. Additionally, the package.json for the @synapsecns/contracts-rfq package has been updated to include a new script for gas benchmarking. These changes aim to streamline the workflow and improve clarity.

Changes

File Change Summary
.github/workflows/solidity.yml Updated gas-diff job to use npm scripts for gas reports, added conditional execution for jobs, refined job dependencies, and set environment variables for Vercel deployment.
packages/contracts-rfq/package.json Added new script "gas:bench" for gas usage benchmarking during tests.

Possibly related PRs

Suggested labels

M-ci, size/s, M-docs

Suggested reviewers

  • trajan0x
  • bigboydiamonds
  • abtestingalpha

🐇 In the meadow, we hop and play,
With gas reports brightening our day.
Scripts now dance, oh what a sight,
Benchmarking gas with all our might!
So let’s celebrate, with a joyful cheer,
For smoother workflows, we hold dear! 🌼


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.

@github-actions github-actions bot added M-ci Module: CI size/xs labels Oct 14, 2024
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.77404%. Comparing base (0df8f08) to head (ce4f92e).
Report is 2 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##              master       #3283   +/-   ##
=============================================
  Coverage   90.77404%   90.77404%           
=============================================
  Files             60          60           
  Lines           1279        1279           
  Branches         159         159           
=============================================
  Hits            1161        1161           
  Misses           114         114           
  Partials           4           4           
Flag Coverage Δ
packages 90.44834% <ø> (ø)
solidity 92.09486% <ø> (ø)

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.

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: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/solidity.yml (1)

270-272: Approve the change to use npm scripts for gas benchmarking.

This change improves flexibility by allowing package-specific gas benchmarking scripts. The use of --if-present is a good practice for optional scripts.

Consider adding a comment explaining the purpose of the gas:bench script for better maintainability.

You could add a comment like this:

# Run gas benchmarking script if present in the package
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bc21cfa and ce4f92e.

📒 Files selected for processing (2)
  • .github/workflows/solidity.yml (1 hunks)
  • packages/contracts-rfq/package.json (1 hunks)
🧰 Additional context used

@@ -20,6 +20,7 @@
"build:slither": "forge build --out=out --build-info --force",
"test:coverage": "echo 'Please use foundry'",
"test": "forge test",
"gas:bench": "forge test --mc GasBenchmark --gas-report",
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

GasBenchmark contract not found

The new gas:bench script references a GasBenchmark contract, but no such contract exists in the codebase. Only GasBenchmarkTest contracts are present.

  • Verify if the intended contract name is GasBenchmarkTest and update the script accordingly.
🔗 Analysis chain

LGTM! Consider adding a description comment.

The new gas:bench script is a valuable addition for gas usage benchmarking. It correctly uses Forge to run tests specifically for the GasBenchmark contract and generates a gas report.

Consider adding a brief description comment above the script for clarity:

+    // Run gas benchmarking tests and generate a report
     "gas:bench": "forge test --mc GasBenchmark --gas-report",

To ensure the script will work as intended, let's verify the existence of a GasBenchmark contract in the test files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for the existence of a GasBenchmark contract in test files

# Test: Search for a contract named GasBenchmark in Solidity test files
rg --type solidity -g 'test/**/*.sol' 'contract\s+GasBenchmark'

Length of output: 98


Script:

#!/bin/bash
# Description: Check for the existence of a GasBenchmark contract in Solidity test files

# Test: Search for a contract named GasBenchmark in .sol files within the test directory
rg -g '*.sol' 'contract\s+GasBenchmark' test/

Length of output: 93


Script:

#!/bin/bash
# Description: Check for the existence of a GasBenchmark contract in all Solidity files

# Test: Search for a contract named GasBenchmark in any .sol file
rg -g '*.sol' 'contract\s+GasBenchmark'

Length of output: 210

Copy link

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: ce4f92e
Status: ✅  Deploy successful!
Preview URL: https://1628f878.sanguine-fe.pages.dev
Branch Preview URL: https://chore-gas-bench-script.sanguine-fe.pages.dev

View logs

@ChiTimesChi ChiTimesChi merged commit de92c1f into master Oct 14, 2024
51 checks passed
@ChiTimesChi ChiTimesChi deleted the chore/gas-bench-script branch October 14, 2024 10:20
@coderabbitai coderabbitai bot mentioned this pull request Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-ci Module: CI size/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant