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

NET-80 upgrade diff report render #1024

Merged
merged 2 commits into from
Sep 9, 2024
Merged

Conversation

jterzis
Copy link
Contributor

@jterzis jterzis commented Sep 9, 2024

NET-80 - splits out bytecode-diff improvements from #1008 (originally kept them there to test github action) into this pr, leaving that pr solely focused on the ci implementation of the bytecode-diff e2e system.

In this pr:

  • upgrade-facets.sh bash script that takes a diff report as input and runs the appropriate make target from /contracts depending on the environment attempting to upgrade facets that show a diff in the yaml report.
  • new command add-hashes in bytecode-diff that fetches remote bytecode from output of upgrade-facets.sh and adds keccak256 hash to combined report. Report is then rendered in html using a go based html template.
  • split out diffing tool commands into separate package from run_util to simplify main.go.

Copy link
Contributor

coderabbitai bot commented Sep 9, 2024

Walkthrough

This pull request introduces several enhancements to the bytecode-diff tool, including the addition of a command-line interface for comparing contract bytecode, updates to documentation, and the introduction of new scripts for managing Ethereum bytecode hashes. It also modifies the .prettierignore file to exclude specific templates from formatting, updates the go.mod file for YAML parsing, and includes a new HTML report template.

Changes

File Change Summary
.prettierignore Added scripts/bytecode-diff/templates/* to exclude from Prettier formatting.
scripts/bytecode-diff/README.md Added documentation for generating keccak256 hashes for deployed contracts.
scripts/bytecode-diff/cmd/root.go Introduced CLI tool for comparing contract bytecode differences with various commands and flags.
scripts/bytecode-diff/cmd/run_util.go Added utility for managing Ethereum bytecode hashes, including command for adding hashes to YAML.
scripts/bytecode-diff/go.mod Added dependency on gopkg.in/yaml.v3 v3.0.1 for YAML processing.
scripts/bytecode-diff/main.go Refactored to call cmd.Execute() for a modular command-based architecture.
scripts/bytecode-diff/scripts/upgrade-facets.sh Introduced script for deploying smart contracts based on YAML configuration files.
scripts/bytecode-diff/templates/report.html Added HTML template for generating bytecode diff reports.
scripts/bytecode-diff/utils/ethereum.go Added GetContractCodeHash function and modified existing functions for improved functionality.

Possibly related PRs

Tip

New features

Walkthrough comment now includes:

  • Possibly related PRs: A list of potentially related PRs to help you recall past context.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs. You can also provide custom labeling instructions in the UI or configuration file.

Notes:

  • Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2d8c5d3 and b4518a4.

Files selected for processing (9)
  • .prettierignore (1 hunks)
  • scripts/bytecode-diff/README.md (1 hunks)
  • scripts/bytecode-diff/cmd/root.go (1 hunks)
  • scripts/bytecode-diff/cmd/run_util.go (1 hunks)
  • scripts/bytecode-diff/go.mod (1 hunks)
  • scripts/bytecode-diff/main.go (1 hunks)
  • scripts/bytecode-diff/scripts/upgrade-facets.sh (1 hunks)
  • scripts/bytecode-diff/templates/report.html (1 hunks)
  • scripts/bytecode-diff/utils/ethereum.go (5 hunks)
Files skipped from review due to trivial changes (1)
  • .prettierignore
Additional context used
Shellcheck
scripts/bytecode-diff/scripts/upgrade-facets.sh

[warning] 2-2: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 54-54: Prefer mapfile or read -a to split command output (or quote to avoid splitting).

(SC2207)


[warning] 76-76: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 92-92: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 112-112: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 113-113: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 114-114: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 115-115: Declare and assign separately to avoid masking return values.

(SC2155)

Additional comments not posted (11)
scripts/bytecode-diff/main.go (2)

3-3: LGTM!

The import statement is approved.


5-7: LGTM!

The refactored main function is approved. The changes improve the clarity and focus of the entry point.

scripts/bytecode-diff/go.mod (1)

11-11: Verify compatibility with the new YAML library version.

The new dependency is approved. However, ensure that the codebase is updated to handle any changes or new features introduced by gopkg.in/yaml.v3 v3.0.1.

scripts/bytecode-diff/templates/report.html (1)

1-118: LGTM!

The HTML template file is approved. It is well-structured, includes relevant information for the bytecode diff report, and uses Go template syntax effectively for dynamic report generation. The included CSS styles ensure a consistent and readable format.

scripts/bytecode-diff/cmd/run_util.go (1)

1-175: LGTM!

The code changes are approved.

scripts/bytecode-diff/README.md (1)

86-106: Documentation looks good!

The added documentation for running keccak256 hash generation on deployed contracts is clear and provides a good example.

scripts/bytecode-diff/utils/ethereum.go (4)

93-102: LGTM!

The changes to add throttling and improve error handling are approved.


137-143: LGTM!

The change to the function signature is approved.


196-199: LGTM!

The additional check for the HTTP response status code is approved.


231-240: LGTM!

The new GetContractCodeHash function is approved.

scripts/bytecode-diff/cmd/root.go (1)

1-370: LGTM!

The scripts/bytecode-diff/cmd/root.go file is approved. The implementation of the root command for the bytecode-diff tool using Cobra is well-structured, modular, and follows best practices. The use of flags and environment variables provides flexibility in configuring the tool.


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.
    • @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: 5

@jterzis jterzis merged commit c55ab1d into main Sep 9, 2024
7 checks passed
@jterzis jterzis deleted the jt/net-80-upgrade-diff-report-render branch September 9, 2024 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants