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(ctb): Speed up chained compilation #10088

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Conversation

clabby
Copy link
Member

@clabby clabby commented Apr 9, 2024

Overview

Requires ast = true for all foundry profiles, which dramatically speeds up chaining pre-PR tasks (bindings, snapshots, etc.) together for contracts-bedrock due to not requiring re-compilation several times with and without generating the AST in artifacts.

Summary by CodeRabbit

  • Refactor
    • Adjusted settings for handling the Abstract Syntax Tree (AST) in the project configuration.
    • Modified the build script to remove the --ast flag for a streamlined build process.

@clabby clabby requested a review from a team as a code owner April 9, 2024 22:41
@clabby clabby requested a review from refcell April 9, 2024 22:41
Copy link
Contributor

coderabbitai bot commented Apr 9, 2024

Walkthrough

The recent modifications streamline the handling of the Abstract Syntax Tree (AST) within the project's configuration. By adjusting settings in the foundry.toml and altering a script in the package.json, the project now manages AST generation more efficiently, centralizing its configuration and simplifying build commands. This refinement enhances the build process, making it cleaner and potentially more performant.

Changes

Files Change Summary
.../contracts-bedrock/foundry.toml Moved ast = true from script to build_info_path, centralizing AST configuration.
.../contracts-bedrock/package.json Modified snapshots script to exclude --ast flag from forge build, simplifying the command.

Recent Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c2135f1 and d165835.
Files selected for processing (2)
  • packages/contracts-bedrock/foundry.toml (2 hunks)
  • packages/contracts-bedrock/package.json (1 hunks)
Additional comments not posted (2)
packages/contracts-bedrock/foundry.toml (1)

28-28: Adding ast = true under build_info_path aligns with the PR's objective to optimize the build process. Ensure this setting's impact is consistent across different profiles.

Verification successful

The addition of ast = true under the build_info_path in the [profile.default] section of the foundry.toml file is appropriate and aligns with optimizing the build process for development and testing purposes. The absence of this setting in other profiles, such as [profile.ci], [profile.lite], [profile.kdeploy], and [profile.kprove], does not indicate an inconsistency but rather suggests that these profiles are configured with specific needs in mind, where AST generation may not be necessary or beneficial. Therefore, the original review comment stands as valid within the context of the default profile's optimization goal.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify if `ast = true` setting is consistently beneficial or required across other profiles.
echo "Review other profiles in foundry.toml to ensure consistency and optimal configuration."

Length of output: 182



Script:

#!/bin/bash
# Display the contents of the foundry.toml file to assess the presence and consistency of the `ast = true` setting across different profiles.
cat packages/contracts-bedrock/foundry.toml

Length of output: 2812

packages/contracts-bedrock/package.json (1)

30-30: Removing the --ast flag from the forge build command in the snapshots script aligns with centralizing AST generation settings. Ensure this change does not affect the functionality of the script or related workflows.

Verification successful

Based on the provided context from the shell script executions, we can conclude the following:

  1. The snapshots script in package.json for the contracts-bedrock package is defined as forge build && npx tsx scripts/autogen/generate-snapshots.ts && ./test/kontrol/scripts/make-summary-deployment.sh. This confirms the script's presence and its components, aligning with the initial review comment.

  2. The search for documentation or comments related to the snapshots script and the --ast flag did not directly mention the impact of removing the --ast flag. However, it provided insights into how the snapshots script and related functionalities, such as state diff generation and deployment summaries, are utilized within the project.

  3. The references to snapshots across various scripts and documentation indicate that the script is integral to generating ABI and storage layout snapshots, checking snapshots against committed versions, and supporting deployment processes. The removal of the --ast flag from the forge build command within the snapshots script does not appear to be directly addressed in the provided context, but the script's functionality seems to be well understood and documented within the project.

Given the information gathered, it appears that the removal of the --ast flag is a deliberate decision aligned with the project's configuration and workflow optimizations. However, without explicit documentation or comments on the specific impact of removing the --ast flag, we recommend closely monitoring the script's execution and related workflows to ensure they continue to function as expected without the flag.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the removal of `--ast` flag does not negatively impact the snapshots script functionality.
echo "Review the functionality of the `snapshots` script and related workflows to ensure they operate as expected without the `--ast` flag."

Length of output: 412



Script:

#!/bin/bash
# Extract the 'snapshots' script definition from 'package.json'
fd package.json --exec cat {} | jq -r '.scripts.snapshots'

# Search for documentation or comments related to the 'snapshots' script and the '--ast' flag
rg "snapshots script|--ast flag" -C 3

# Identify and review any tests or related scripts that could be impacted by the removal of the '--ast' flag
rg "snapshots" -C 3

Length of output: 22384

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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
Member Author

clabby commented Apr 9, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @clabby and the rest of your teammates on Graphite Graphite

@clabby clabby self-assigned this Apr 9, 2024
@clabby clabby added the A-pkg-contracts-bedrock Area: packages/contracts-bedrock label Apr 9, 2024
Copy link

codecov bot commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.22%. Comparing base (d72fb46) to head (d165835).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #10088       +/-   ##
============================================
- Coverage    42.40%   29.22%   -13.18%     
============================================
  Files           73       31       -42     
  Lines         4830     2898     -1932     
  Branches       766      614      -152     
============================================
- Hits          2048      847     -1201     
+ Misses        2676     1976      -700     
+ Partials       106       75       -31     
Flag Coverage Δ
cannon-go-tests ?
chain-mon-tests 27.14% <ø> (ø)
common-ts-tests ?
contracts-ts-tests 12.25% <ø> (ø)
core-utils-tests ?
sdk-tests 40.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 42 files with indirect coverage changes

Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

Ahh I didn't consider this. Nice one.

@clabby clabby added this pull request to the merge queue Apr 10, 2024
Merged via the queue into develop with commit 0913776 Apr 10, 2024
72 checks passed
@clabby clabby deleted the cl/ctb/speed-up-prs branch April 10, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pkg-contracts-bedrock Area: packages/contracts-bedrock
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants