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

build(contracts-rfq): increase optimizer runs to 1M [SLT-294] #3349

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Oct 28, 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 parameter for optimization runs, enhancing the efficiency of the compiler's output.
  • Workflow Updates
    • Modified the pull request workflow to exclude the fe-release branch from triggering the Solidity workflow, streamlining the development process.

Copy link
Contributor

coderabbitai bot commented Oct 28, 2024

Walkthrough

The changes introduce a new configuration parameter optimizer_runs, set to 1_000_000, in the [profile.default] section of the foundry.toml file located in the packages/contracts-rfq directory. This parameter specifies the number of optimization runs for the compiler, which can affect the efficiency of the generated bytecode. No other modifications were made to existing parameters or sections.

Changes

File Path Change Summary
packages/contracts-rfq/foundry.toml Added optimizer_runs = 1_000_000 under [profile.default]

Possibly related PRs

Suggested labels

M-ci, size/xs

Poem

In the land of code where bunnies hop,
A new tune plays, we won't stop!
With optimizer_runs set to a million,
Our bytecode dances, oh what a feeling!
Hops of joy in every line,
Optimized code, oh so fine! 🐇✨


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

🧹 Outside diff range and nitpick comments (1)
packages/contracts-rfq/foundry.toml (1)

5-5: Consider adding a comment explaining the optimization strategy.

To help future maintainers understand the reasoning behind this configuration:

 [profile.default]
 # 2024-01-01
 block_timestamp = 1_704_067_200
 evm_version = "paris"
+# High optimizer runs for RFQ contracts to minimize runtime gas costs
+# Trade-off: Longer compilation time and higher deployment costs
 optimizer_runs = 1_000_000
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6593f88 and 19e7bbc.

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

5-5: Verify the high optimizer runs value.

Setting optimizer_runs to 1M is significantly higher than typical values (200-10000). While this will produce more optimized runtime bytecode, it comes with tradeoffs:

  • Longer compilation times
  • Higher deployment costs
  • Better runtime gas efficiency

Please confirm this aggressive optimization is intentional and consider documenting the rationale.

Copy link

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

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0a96cec
Status: ✅  Deploy successful!
Preview URL: https://ff3553fd.sanguine-fe.pages.dev
Branch Preview URL: https://build-fbv2-optimizer-runs.sanguine-fe.pages.dev

View logs

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.81813%. Comparing base (e939e4e) to head (0a96cec).
Report is 2 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##              master       #3349   +/-   ##
=============================================
  Coverage   34.81813%   34.81813%           
=============================================
  Files            529         529           
  Lines          33787       33787           
  Branches          82          82           
=============================================
  Hits           11764       11764           
  Misses         21002       21002           
  Partials        1021        1021           
Flag Coverage Δ
packages 90.44834% <ø> (ø)
solidity 98.65772% <ø> (ø)

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.

@github-actions github-actions bot added the M-ci Module: CI label Oct 28, 2024
Copy link

github-actions bot commented Oct 28, 2024

Changes to gas cost

Generated at commit: 96668a686ae56fcb2020a10d529602f8ab33e585, compared to commit: e939e4e50d047cc433fc1c3ddfffa53da7897a11

🧾 Summary (50% most significant diffs)

Contract Method Avg (+/-) %
FastBridgeV2 bridgeProofs
bridgeRelayDetails
bridgeStatuses
canClaim
getBridgeTransaction
getBridgeTransactionV2
protocolFees
senderNonces
-86 ✅
-36 ✅
+23 ❌
-74 ✅
-267 ✅
-165 ✅
-12 ✅
-56 ✅
-12.87%
-5.31%
+1.92%
-2.42%
-6.21%
-6.51%
-1.07%
-4.98%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
FastBridgeV2 4,307,517 (+893,486) GOVERNOR_ROLE
GUARD_ROLE
REFUNDER_ROLE
RELAYER_ROLE
bridge
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)
senderNonces
setProtocolFeeRate
261 (-33)
287 (+23)
263 (+23)
307 (-44)
68,568 (-446)
582 (-86)
642 (-36)
639 (+23)
2,981 (-74)
39,864 (-96)
42,836 (-97)
30,946 (-58)
4,030 (-267)
1,028 (-79)
101,193 (-212)
285 (+23)
611 (-12)
34,449 (-106)
31,967 (-94)
44,163 (-163)
61,225 (-133)
61,620 (-145)
569 (-56)
47,360 (-61)
-11.22%
+8.71%
+9.58%
-12.54%
-0.65%
-12.87%
-5.31%
+3.73%
-2.42%
-0.24%
-0.23%
-0.19%
-6.21%
-7.14%
-0.21%
+8.78%
-1.93%
-0.31%
-0.29%
-0.37%
-0.22%
-0.23%
-8.96%
-0.13%
261 (-33)
287 (+23)
263 (+23)
307 (-44)
79,795 (-597)
582 (-86)
642 (-36)
1,221 (+23)
2,981 (-74)
46,665 (-206)
48,387 (-207)
30,956 (-58)
4,030 (-267)
2,369 (-165)
114,325 (-212)
285 (+23)
1,111 (-12)
34,762 (-106)
31,975 (-94)
48,028 (-269)
67,522 (-290)
67,917 (-302)
1,069 (-56)
47,360 (-61)
-11.22%
+8.71%
+9.58%
-12.54%
-0.74%
-12.87%
-5.31%
+1.92%
-2.42%
-0.44%
-0.43%
-0.19%
-6.21%
-6.51%
-0.19%
+8.78%
-1.07%
-0.30%
-0.29%
-0.56%
-0.43%
-0.44%
-4.98%
-0.13%
261 (-33)
287 (+23)
263 (+23)
307 (-44)
80,496 (-597)
582 (-86)
642 (-36)
639 (+23)
2,981 (-74)
47,247 (-208)
48,969 (-209)
30,958 (-58)
4,030 (-267)
2,963 (-208)
118,293 (-212)
285 (+23)
611 (-12)
34,473 (-106)
31,979 (-94)
48,163 (-269)
67,442 (-293)
67,837 (-305)
569 (-56)
47,360 (-61)
-11.22%
+8.71%
+9.58%
-12.54%
-0.74%
-12.87%
-5.31%
+3.73%
-2.42%
-0.44%
-0.42%
-0.19%
-6.21%
-6.56%
-0.18%
+8.78%
-1.93%
-0.31%
-0.29%
-0.56%
-0.43%
-0.45%
-8.96%
-0.13%
261 (-33)
287 (+23)
263 (+23)
307 (-44)
92,449 (-747)
582 (-86)
642 (-36)
2,639 (+23)
2,981 (-74)
54,594 (-320)
55,066 (-321)
30,958 (-58)
4,030 (-267)
3,116 (-208)
118,293 (-212)
285 (+23)
2,611 (-12)
35,413 (-106)
31,979 (-94)
52,163 (-375)
76,463 (-465)
76,858 (-477)
2,569 (-56)
47,360 (-61)
-11.22%
+8.71%
+9.58%
-12.54%
-0.80%
-12.87%
-5.31%
+0.88%
-2.42%
-0.58%
-0.58%
-0.19%
-6.21%
-6.26%
-0.18%
+8.78%
-0.46%
-0.30%
-0.29%
-0.71%
-0.60%
-0.62%
-2.13%
-0.13%
21 (0)
67 (0)
67 (0)
134 (0)
260 (0)
12 (0)
12 (0)
426 (0)
12 (0)
6 (0)
6 (0)
6 (0)
1 (0)
3 (0)
289 (0)
4 (0)
536 (0)
68 (0)
68 (0)
12 (0)
6 (0)
6 (0)
248 (0)
21 (0)

@github-actions github-actions bot removed the M-ci Module: CI label Oct 28, 2024
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