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

rip out tenderly (prereq to #1767) #1863

Merged
merged 3 commits into from
Jan 14, 2024
Merged

rip out tenderly (prereq to #1767) #1863

merged 3 commits into from
Jan 14, 2024

Conversation

trajan0x
Copy link
Contributor

@trajan0x trajan0x commented Jan 14, 2024

Description

Rremoves tenderly-cli dependency

Summary by CodeRabbit

  • Refactor

    • Streamlined backend initialization and contract verification processes.
    • Updated parser logic and data types for enhanced contract handling.
  • Bug Fixes

    • Removed unsupported tenderly integration to ensure backend stability.
  • Documentation

    • Adjusted import paths in test files for better maintainability.
  • Chores

    • Introduced new structures for contract representation in the hardhat parser.

Copy link
Contributor

coderabbitai bot commented Jan 14, 2024

Warning

Rate Limit Exceeded

@trajan0x has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 52 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between ef4fbc0 and fb76a69.

Walkthrough

The project has undergone a significant refactoring, with a focus on simplifying the backend infrastructure by removing dependencies on the tenderly and debug packages. This streamlining effort extends to tests and parser enhancements for the Hardhat environment, with types and methods being updated to reflect the new structures and types introduced.

Changes

File(s) Summary
ethergo/Makefile Added reference to ../make/go.Makefile.
.../backends/base/base.go
.../backends/geth/geth_test.go
.../backends/backend.go
.../backends/mocks/simulated_test_backend.go
.../backends/simulated/simulated.go
Removed tenderly and debug packages; refactored backend initialization; modified methods; removed EnableTenderly method.
.../parser/hardhat/export_test.go
.../parser/hardhat/parser.go
.../parser/hardhat/parser_test.go
.../parser/hardhat/types.go
Updated methods and types for handling Hardhat contracts and metadata; changed import paths and function calls.
services/scribe/config/generate_test.go Removed import of github.com/tenderly/tenderly-cli/providers; changed parameter type in the getDeploymentsTxHash function.

🐇✨
In the warren of code, a refactor's done,
Tenderly removed, the backend's spun.
Hardhat parsers align, with types anew,
A rabbit hops forth, to the future we pursue! 🚀🌟
✨🐇

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added go Pull requests that update Go code size/l labels Jan 14, 2024
Copy link

codecov bot commented Jan 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (61542bf) 51.08388% compared to head (fb76a69) 51.61072%.
Report is 11 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #1863         +/-   ##
===================================================
+ Coverage   51.08388%   51.61072%   +0.52684%     
===================================================
  Files            397         409         +12     
  Lines          27171       28062        +891     
  Branches         307         307                 
===================================================
+ Hits           13880       14483        +603     
- Misses         11936       12159        +223     
- Partials        1355        1420         +65     
Flag Coverage Δ
cctp-relayer 63.00863% <ø> (?)
ethergo 60.77554% <100.00000%> (+0.46159%) ⬆️
omnirpc 53.23194% <ø> (ø)
promexporter 74.80916% <ø> (?)
rfq 40.54291% <ø> (ø)
scribe 52.21130% <ø> (ø)
sinner 64.60481% <ø> (ø)
tools 21.98661% <ø> (ø)

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 982e0c8 and c4e8378.
Files ignored due to path filters (18)
  • agents/go.mod is excluded by: !**/*.mod
  • agents/go.sum is excluded by: !**/*.sum
  • contrib/promexporter/go.mod is excluded by: !**/*.mod
  • contrib/promexporter/go.sum is excluded by: !**/*.sum
  • ethergo/go.mod is excluded by: !**/*.mod
  • ethergo/go.sum is excluded by: !**/*.sum
  • services/cctp-relayer/go.mod is excluded by: !**/*.mod
  • services/cctp-relayer/go.sum is excluded by: !**/*.sum
  • services/explorer/go.mod is excluded by: !**/*.mod
  • services/explorer/go.sum is excluded by: !**/*.sum
  • services/omnirpc/go.mod is excluded by: !**/*.mod
  • services/omnirpc/go.sum is excluded by: !**/*.sum
  • services/rfq/go.mod is excluded by: !**/*.mod
  • services/rfq/go.sum is excluded by: !**/*.sum
  • services/scribe/go.mod is excluded by: !**/*.mod
  • services/scribe/go.sum is excluded by: !**/*.sum
  • services/sinner/go.mod is excluded by: !**/*.mod
  • services/sinner/go.sum is excluded by: !**/*.sum
Files selected for processing (7)
  • ethergo/Makefile (1 hunks)
  • ethergo/backends/base/base.go (5 hunks)
  • ethergo/backends/geth/geth_test.go (1 hunks)
  • ethergo/parser/hardhat/export_test.go (1 hunks)
  • ethergo/parser/hardhat/parser.go (6 hunks)
  • ethergo/parser/hardhat/parser_test.go (4 hunks)
  • ethergo/parser/hardhat/types.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • ethergo/backends/geth/geth_test.go
Additional comments: 15
ethergo/parser/hardhat/export_test.go (3)
  • 5-6: The changes to GetCompiler and GetSources methods to return ContractCompiler and ContractSources types respectively are consistent with the removal of the tenderly-cli dependency and the refactoring of the codebase to use internal types.

  • 18-18: The GetMetadata function now accepts a HardhatContract instead of hardhat.HardhatContract. Ensure that all references to this function have been updated to pass the correct type.

  • 22-22: The GetNetworks function has been updated to accept HardhatContract and return a map of ContractNetwork. This change should be verified across the codebase to ensure compatibility.

Verification successful

The broader ast-grep search has successfully located the definition of the GetNetworks function within ethergo/parser/hardhat/export_test.go. This confirms the presence of the function in the codebase, and since no calls to this function were found in the previous searches, it can be inferred that the update to the GetNetworks function's signature does not affect any existing code.

Based on the information gathered, the review comment concerning the need to verify compatibility across the codebase for the GetNetworks function update appears to be addressed. There are no instances of the function being called with either the old or new type, which means there are no compatibility issues detected within the current scope of the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for instances where GetNetworks is called with the old type.
ast-grep --lang go --pattern $'GetNetworks(hardhat.HardhatContract($_), $_)'

Length of output: 77



Script:

#!/bin/bash
# Search for any instances where GetNetworks is called, regardless of the type passed.
ast-grep --lang go --pattern $'GetNetworks($_, $_)'

Length of output: 52



Script:

#!/bin/bash
# Verify the presence of the GetNetworks function in the codebase.
ast-grep --lang go --pattern $'func GetNetworks($_, $_) { $$$ }'

Length of output: 65



Script:

#!/bin/bash
# Broaden the search to find the definition of the GetNetworks function without specifying the function body structure.
ast-grep --lang go --pattern $'func GetNetworks($_, $_)'

Length of output: 326

ethergo/Makefile (2)
  • 1-1: The inclusion of ../make/go.Makefile at the top of the Makefile suggests that common make functionalities are being centralized. This is a good practice for maintainability and reuse of make logic.

  • 1-1: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [78-82]

The initialization of the Backend struct has been refactored to remove the tenderly and debug fields. This aligns with the PR's objective to remove dependencies on tenderly-cli.

ethergo/parser/hardhat/parser_test.go (3)
  • 8-8: The import path has been corrected to reference the hardhat package directly. This change is likely part of the refactoring process and should be consistent throughout the codebase.

  • 18-18: The call to GetDeployments has been updated to use the hardhat package. This change should be verified to ensure that all instances of GetDeployments are updated accordingly.

Verification successful

Given the results of the ast-grep searches, which did not find any instances of GetDeployments being used either with hardhatParser or hardhat, and considering the broader search for GetDeployments also returned no results, it appears that the method is not present in the codebase outside of the instance mentioned in the review comment. This suggests that the change to use the hardhat package for the GetDeployments call has been implemented correctly and there are no remaining references to an old package qualifier.

Based on the information gathered, the review comment has been addressed properly in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for instances where GetDeployments is called with the old package.
ast-grep --lang go --pattern $'hardhatParser.GetDeployments($_)'

Length of output: 65



Script:

#!/bin/bash
# Search for instances where GetDeployments is called with the new package.
ast-grep --lang go --pattern $'hardhat.GetDeployments($_)'

Length of output: 59



Script:

#!/bin/bash
# Broad search for any usage of GetDeployments to ensure it's not being called with a different qualifier.
ast-grep --lang go --pattern $'GetDeployments($_)'

Length of output: 51

* 37-38: The `GetNetworks` function is now being called with the `hardhat.HardhatContract` type. This change should be verified to ensure that all instances of `GetNetworks` are updated accordingly.
Verification successful

The ast-grep search for the GetNetworks function usage has returned results from ethergo/parser/hardhat/parser_test.go, showing that the function is indeed being called with the new hardhat.HardhatContract type. Since no other instances were found, it suggests that either this is the only place where GetNetworks is used or all instances have been updated to the new type.

Based on the provided context and the results of the scripts, it appears that the review comment has been addressed correctly in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for instances where GetNetworks is called with the old type.
ast-grep --lang go --pattern $'hardhatParser.GetNetworks($_, $_)'

Length of output: 66



Script:

#!/bin/bash
# Search for any usage of the GetNetworks function to ensure all instances have been updated.
ast-grep --lang go --pattern $'hardhat.GetNetworks($_, $_)'

Length of output: 374

ethergo/parser/hardhat/types.go (1)
  • 8-23: The Contract struct has been updated with new fields and types. This change is likely part of the refactoring process to remove the tenderly-cli dependency and should be consistent with the new data structures used throughout the codebase.
ethergo/parser/hardhat/parser.go (4)
  • 16-17: The hardhatMetadata struct has been updated to use ContractCompiler and ContractSources types. This change is consistent with the refactoring of the codebase to use internal types instead of those provided by tenderly-cli.

  • 21-21: The getMetadata function's parameter and return types have been changed to use HardhatContract and hardhatMetadata types. This change should be verified across the codebase to ensure compatibility.

  • 32-32: The getNetworks function's parameter and return types have been changed to use HardhatContract and ContractNetwork types. This change should be verified across the codebase to ensure compatibility.

  • 62-62: The GetDeployments function's return type has been changed to use Contract type. This change should be verified across the codebase to ensure compatibility.

Verification successful

The search results indicate that the GetDeployments function is indeed being used in multiple places within the codebase:

  • services/scribe/config/generate_test.go
  • services/scribe/config/generate.go
  • ethergo/parser/hardhat/parser_test.go

In each of these instances, the function is called and the return value is being handled. Since the function signature in ethergo/parser/hardhat/parser.go has been updated to return []Contract, any code that calls this function must be compatible with the new return type.

Given that the search results do not indicate any issues with the usage of the updated GetDeployments function, and there are no errors or mismatches in the return type handling, it appears that the change to the GetDeployments function's return type has been successfully integrated into the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for instances where GetDeployments is called with the old return type.
ast-grep --lang go --pattern $'GetDeployments($_)'

Length of output: 51



Script:

#!/bin/bash
# Broaden the search to find any usage of GetDeployments to verify the impact of the return type change.
rg 'GetDeployments' --go

Length of output: 453



Script:

#!/bin/bash
# Correct the search to find any usage of GetDeployments within Go files.
rg 'GetDeployments' -g '*.go'

Length of output: 538

ethergo/backends/base/base.go (2)
  • 78-82: The Backend struct has been refactored to remove the tenderly and debug fields, which is in line with the PR's objective to remove the tenderly-cli dependency.

  • 78-82: The logic within the VerifyContract and WaitForConfirmation methods has been modified. Ensure that these changes do not introduce any regressions or unexpected behaviors.

Comment on lines +78 to +82
Chain: chn,
ctx: ctx,
t: t,
Manager: nonce.NewNonceManager(ctx, chn, chn.GetBigChainID()),
store: NewInMemoryKeyStore(),
Copy link
Contributor

Choose a reason for hiding this comment

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

The search using rg for the string "EnableTenderly" has returned several results. It appears that the EnableTenderly method is still present in the codebase in various files:

  • ethergo/backends/mocks/simulated_test_backend.go: Contains a mock function definition and implementation of EnableTenderly.
  • ethergo/backends/simulated/simulated_test.go: Calls the EnableTenderly method.
  • ethergo/backends/simulated/simulated.go: Contains a comment explaining the purpose of EnableTenderly and its implementation for the simulated backend.
  • ethergo/backends/backend.go: Contains an interface definition that includes EnableTenderly.

These findings indicate that there are indeed remaining references and calls to the EnableTenderly method in the codebase. This contradicts the review comment's expectation that the method should have been completely removed.

Analysis chain

The EnableTenderly method has been removed from the Backend. This is expected as part of the removal of the tenderly-cli dependency. Ensure that there are no remaining calls to this method in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for instances where EnableTenderly is called.
ast-grep --lang go --pattern $'EnableTenderly()'

Length of output: 49



Script:

#!/bin/bash
# Perform a more general search for the string "EnableTenderly" to ensure it's not being called anywhere.
rg "EnableTenderly"

Length of output: 734

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c4e8378 and ef4fbc0.
Files ignored due to path filters (7)
  • agents/go.sum is excluded by: !**/*.sum
  • contrib/promexporter/go.sum is excluded by: !**/*.sum
  • services/cctp-relayer/go.sum is excluded by: !**/*.sum
  • services/explorer/go.sum is excluded by: !**/*.sum
  • services/scribe/go.mod is excluded by: !**/*.mod
  • services/scribe/go.sum is excluded by: !**/*.sum
  • services/sinner/go.sum is excluded by: !**/*.sum
Files selected for processing (4)
  • ethergo/backends/backend.go (1 hunks)
  • ethergo/backends/mocks/simulated_test_backend.go (1 hunks)
  • ethergo/backends/simulated/simulated.go (1 hunks)
  • services/scribe/config/generate_test.go (2 hunks)
Additional comments: 4
ethergo/backends/backend.go (1)
  • 27-32: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-59]

The removal of the EnableTenderly method from the SimulatedTestBackend interface aligns with the PR's objective to remove tenderly-cli dependencies. Ensure that all implementations of this interface and any code that relied on this method have been appropriately refactored.

services/scribe/config/generate_test.go (1)
  • 11-16: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-82]

The removal of the Tenderly import and the change in the getDeploymentsTxHash function parameter type from []providers.Contract to []hardhat.Contract are consistent with the PR's goal of removing Tenderly dependencies. Verify that the new hardhat.Contract type provides all necessary fields and methods that were used from the old providers.Contract type.

Verification successful

The hardhat.Contract type has been successfully located in ethergo/parser/hardhat/types.go and contains several fields such as Name, Abi, Bytecode, DeployedBytecode, SourceMap, DeployedSourceMap, Source, SourcePath, Ast, Compiler, Networks, SchemaVersion, and UpdatedAt. These fields are likely to provide the necessary data previously obtained from the providers.Contract type.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the hardhat.Contract type has the necessary fields and methods.
ast-grep --lang go --pattern $'type Contract struct { $$$ }' src/ethergo/parser/hardhat/types.go

Length of output: 180



Script:

#!/bin/bash
# Search for the file that defines the hardhat.Contract type
fd 'types.go' --exec ast-grep --lang go --pattern $'type Contract struct { $$$ }'

Length of output: 1510

ethergo/backends/simulated/simulated.go (1)
  • 74-79: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-261]

The removal of the EnableTenderly method from the Backend type is in line with the PR's objectives. Confirm that no other parts of the codebase are attempting to call this method on instances of Backend.

ethergo/backends/mocks/simulated_test_backend.go (1)
  • 370-375: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [1-366]

The removal of the EnableTenderly function from the SimulatedTestBackend mock is consistent with the removal of the method from the interface. Ensure that any tests that might have used this mock function are updated accordingly.

@trajan0x trajan0x merged commit fbf66eb into master Jan 14, 2024
55 checks passed
@trajan0x trajan0x deleted the fix/remove-tenderly branch January 14, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant