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

[WIP] build(contracts-rfq): increase optimizer_runs [SLT-294] #3218

Closed
wants to merge 1 commit into from

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Oct 3, 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 configuration option for enhanced contract compilation optimization, allowing for up to 100,000 optimization runs.

Copy link
Contributor

coderabbitai bot commented Oct 3, 2024

Walkthrough

The changes introduce a new configuration option in the foundry.toml file located in the packages/contracts-rfq directory. Specifically, the optimizer_runs parameter is added under the [profile.default] section and is set to 100,000. This adjustment allows for an increased number of optimization runs during the contract compilation process.

Changes

File Change Summary
packages/contracts-rfq/foundry.toml Added optimizer_runs = 100_000 under [profile.default] section.

Possibly related PRs

🐇 In the meadow, contracts bloom,
With optimizations, they find more room.
A hundred thousand runs, oh what a sight,
Building dreams with all their might!
Hops of joy in every line,
In the code, our futures shine! 🌟


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 244529c and ad46d98.

📒 Files selected for processing (1)
  • packages/contracts-rfq/foundry.toml (1 hunks)
🔇 Additional comments (1)
packages/contracts-rfq/foundry.toml (1)

5-5: Increased optimizer runs may impact compilation time and contract size.

The addition of optimizer_runs = 100_000 in the default profile will instruct the Solidity compiler to optimize the contracts more aggressively. This change has the following implications:

  1. Potential gas savings: Higher optimizer runs can lead to more gas-efficient contracts, which is beneficial for frequently used functions.
  2. Increased compilation time: The compilation process may take longer due to the increased number of optimization attempts.
  3. Possible contract size increase: In some cases, aggressive optimization can lead to larger contract bytecode.

Consider the following:

  1. Ensure that the increased compilation time doesn't significantly impact your development workflow.
  2. Monitor the resulting contract sizes to ensure they don't exceed deployment limits (especially important for chains with strict size limits).
  3. Verify that this change aligns with your gas optimization strategy for the RFQ contracts.

To verify the impact of this change, you can run the following script:

This script will help you assess the impact on compilation time and contract sizes.


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

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: ad46d98
Status: ✅  Deploy successful!
Preview URL: https://1816d319.sanguine-fe.pages.dev
Branch Preview URL: https://feat-fbv2-increase-optimizer.sanguine-fe.pages.dev

View logs

Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@244529c). Learn more about missing BASE report.
Report is 131 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master       #3218   +/-   ##
============================================
  Coverage          ?   89.40678%           
============================================
  Files             ?           6           
  Lines             ?         236           
  Branches          ?          68           
============================================
  Hits              ?         211           
  Misses            ?          23           
  Partials          ?           2           
Flag Coverage Δ
solidity 89.40678% <ø> (?)

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

github-actions bot commented Oct 3, 2024

Changes to gas cost

Generated at commit: b7432421e00973dd07d53235aa91edc16b6b14a1, compared to commit: 68821a7c7bca7b397abd7d54d5cf880af2a638b6

🧾 Summary (50% most significant diffs)

Contract Method Avg (+/-) %
FastBridgeV2 bridgeProofs
bridgeRelayDetails
bridgeStatuses
canClaim
getBridgeTransaction
getBridgeTransactionV2
protocolFees
refund
-64 ✅
-13 ✅
-22 ✅
-74 ✅
-143 ✅
-100 ✅
-56 ✅
-335 ✅
-9.91%
-2.05%
-1.85%
-2.32%
-4.89%
-3.21%
-4.89%
-0.67%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
FastBridgeV2 3,347,893 (+647,217) GOVERNOR_ROLE
GUARD_ROLE
REFUNDER_ROLE
RELAYER_ROLE
bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))
bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes))
bridgeProofs
bridgeRelayDetails
bridgeStatuses
canClaim
claim(bytes)
claim(bytes,address)
dispute
getBridgeTransaction
getBridgeTransactionV2
grantRole
nonce
protocolFees
prove(bytes,bytes32)
prove(bytes32,bytes32,address)
refund
relay(bytes)
relay(bytes,address)
setProtocolFeeRate
306 (-10)
287 (+23)
307 (-22)
307 (-22)
66,878 (-289)
68,989 (-337)
582 (-64)
620 (-13)
594 (-22)
3,111 (-74)
42,545 (-209)
45,431 (-154)
31,146 (-28)
2,783 (-143)
3,013 (-100)
101,193 (-212)
285 (+23)
589 (-56)
34,949 (-140)
32,058 (-82)
46,285 (-229)
65,277 (-208)
65,702 (-220)
47,360 (-61)
-3.16%
+8.71%
-6.69%
-6.69%
-0.43%
-0.49%
-9.91%
-2.05%
-3.57%
-2.32%
-0.49%
-0.34%
-0.09%
-4.89%
-3.21%
-0.21%
+8.78%
-8.68%
-0.40%
-0.26%
-0.49%
-0.32%
-0.33%
-0.13%
306 (-10)
287 (+23)
307 (-22)
307 (-22)
81,729 (-436)
79,675 (-484)
582 (-64)
620 (-13)
1,169 (-22)
3,111 (-74)
49,967 (-321)
51,603 (-266)
31,146 (-28)
2,783 (-143)
3,013 (-100)
114,459 (-212)
285 (+23)
1,089 (-56)
34,976 (-140)
32,058 (-82)
49,885 (-335)
71,051 (-329)
71,476 (-341)
47,360 (-61)
-3.16%
+8.71%
-6.69%
-6.69%
-0.53%
-0.60%
-9.91%
-2.05%
-1.85%
-2.32%
-0.64%
-0.51%
-0.09%
-4.89%
-3.21%
-0.18%
+8.78%
-4.89%
-0.40%
-0.26%
-0.67%
-0.46%
-0.47%
-0.13%
306 (-10)
287 (+23)
307 (-22)
307 (-22)
77,564 (-436)
79,675 (-484)
582 (-64)
620 (-13)
594 (-22)
3,111 (-74)
49,976 (-321)
51,612 (-266)
31,146 (-28)
2,783 (-143)
3,013 (-100)
118,293 (-212)
285 (+23)
589 (-56)
34,979 (-140)
32,058 (-82)
49,894 (-335)
71,051 (-329)
71,476 (-341)
47,360 (-61)
-3.16%
+8.71%
-6.69%
-6.69%
-0.56%
-0.60%
-9.91%
-2.05%
-3.57%
-2.32%
-0.64%
-0.51%
-0.09%
-4.89%
-3.21%
-0.18%
+8.78%
-8.68%
-0.40%
-0.26%
-0.67%
-0.46%
-0.47%
-0.13%
306 (-10)
287 (+23)
307 (-22)
307 (-22)
105,350 (-583)
90,362 (-631)
582 (-64)
620 (-13)
2,594 (-22)
3,111 (-74)
57,371 (-433)
57,757 (-378)
31,146 (-28)
2,783 (-143)
3,013 (-100)
118,293 (-212)
285 (+23)
2,589 (-56)
35,093 (-140)
32,058 (-82)
53,467 (-441)
76,825 (-451)
77,250 (-463)
47,360 (-61)
-3.16%
+8.71%
-6.69%
-6.69%
-0.55%
-0.69%
-9.91%
-2.05%
-0.84%
-2.32%
-0.75%
-0.65%
-0.09%
-4.89%
-3.21%
-0.18%
+8.78%
-2.12%
-0.40%
-0.26%
-0.82%
-0.58%
-0.60%
-0.13%
19 (0)
41 (0)
41 (0)
82 (0)
156 (0)
4 (0)
8 (0)
4 (0)
264 (0)
8 (0)
4 (0)
4 (0)
4 (0)
1 (0)
1 (0)
183 (0)
3 (0)
328 (0)
42 (0)
42 (0)
8 (0)
2 (0)
2 (0)
19 (0)

@ChiTimesChi
Copy link
Collaborator Author

Converting this to draft until gas extensive PRs such as #3215 are merged in

@ChiTimesChi ChiTimesChi marked this pull request as draft October 3, 2024 15:26
@ChiTimesChi ChiTimesChi changed the title build(contracts-rfq): increase optimizer_runs build(contracts-rfq): increase optimizer_runs [SLT-294] Oct 3, 2024
@ChiTimesChi ChiTimesChi changed the title build(contracts-rfq): increase optimizer_runs [SLT-294] [WIP] build(contracts-rfq): increase optimizer_runs [SLT-294] Oct 7, 2024
Copy link

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Oct 22, 2024
@github-actions github-actions bot closed this Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant