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

Upgrade geth to 1.13 #2416

Merged
merged 27 commits into from
Jun 9, 2024
Merged

Upgrade geth to 1.13 #2416

merged 27 commits into from
Jun 9, 2024

Conversation

aureliusbtc
Copy link
Contributor

@aureliusbtc aureliusbtc commented Apr 1, 2024

Description

Blocking issues:

  • Gas pricing for sending anvil legacy txes is broken

Summary by CodeRabbit

  • New Features

    • Introduced functions to retrieve code and execute contract calls at specific block hashes.
    • Added error handling for unsupported block hash access.
  • Bug Fixes

    • Improved error handling and transaction signing in simulated backend.
    • Corrected receipt retrieval by reading header information first.
  • Chores

    • Updated various dependencies across multiple services, including go-ethereum and others.
    • Enhanced .gitignore to exclude __debug_bin directories.
    • Adjusted .golangci.yml configuration.
  • Tests

    • Added and adjusted tests to accommodate new features and dependency updates.

Copy link
Contributor

coderabbitai bot commented Apr 1, 2024

Walkthrough

The recent changes include updates to error handling, function enhancements, and dependency adjustments across multiple Go modules. Key updates involve the introduction of new functions for block and contract operations, improved test coverage, and dependency upgrades to align with the latest versions. These changes aim to enhance functionality, improve error reporting, and ensure compatibility with updated libraries.

Changes

File Path Change Summary
ethergo/backends/simulated/... Replaced fmt.Errorf with errors.New, added new functions for block and contract operations, and improved error handling.
ethergo/chain/client/lifecycle_test.go Adjusted calls to mockPermitter.AssertNumberOfCalls using dynamic values.
ethergo/go.mod Updated github.com/ethereum/go-ethereum version, added and removed various dependencies.
ethergo/submitter/submitter_test.go Added a test skip line with a TODO comment in TestCheckAndSetConfirmation.
services/.../go.mod Updated dependency versions and added new dependencies across multiple service modules.
ethergo/util/converter.go Modified TxToCall function to adjust GasPrice based on transaction type.
.gitignore Added pattern to exclude __debug_bin directories recursively.
.golangci.yml Updated new-from-rev value.
ethergo/backends/base/base.go Added import for sanguine/core and modified error message construction in WaitForConfirmation.
ethergo/util/converter_test.go Adjusted comparison logic in TestTxToCall based on transaction type.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SimulatedBackend
    participant Blockchain
    participant Contract

    User->>SimulatedBackend: SendTransaction
    SimulatedBackend->>Blockchain: Create signer with block.Time()
    Blockchain-->>SimulatedBackend: Signer created
    SimulatedBackend-->>User: Transaction sent

    User->>SimulatedBackend: AdjustTime
    SimulatedBackend-->>User: Time adjusted

    User->>SimulatedBackend: GetReceipts
    SimulatedBackend->>Blockchain: Read header information
    Blockchain-->>SimulatedBackend: Header information retrieved
    SimulatedBackend-->>User: Receipts retrieved

    User->>SimulatedBackend: CodeAtHash
    SimulatedBackend->>Blockchain: Retrieve code by block hash
    Blockchain-->>SimulatedBackend: Code retrieved
    SimulatedBackend-->>User: Code returned

    User->>SimulatedBackend: CallContractAtHash
    SimulatedBackend->>Contract: Execute contract call by block hash
    Contract-->>SimulatedBackend: Contract call executed
    SimulatedBackend-->>User: Contract call result
Loading

Poem

In the world of code so bright,
Errors fixed and functions light,
Dependencies now up to date,
SimulatedBackend's future great.
Contracts called with hash in hand,
Blockchain flows like grains of sand.
Here's to progress, swift and grand! 🚀🐇


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 as 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.

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

Review Status

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 4fbad16 and 640951a.
Files ignored due to path filters (12)
  • 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/stiprelayer/go.mod is excluded by !**/*.mod
  • services/stiprelayer/go.sum is excluded by !**/*.sum
Files selected for processing (1)
  • services/cctp-relayer/external/synapse-contracts (1 hunks)
Files skipped from review due to trivial changes (1)
  • services/cctp-relayer/external/synapse-contracts
Additional Context Used

Copy link

cloudflare-workers-and-pages bot commented Apr 1, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: f458ffe
Status:🚫  Build failed.

View logs

@aureliusbtc aureliusbtc requested a review from ChiTimesChi as a code owner April 1, 2024 21:51
@github-actions github-actions bot added go Pull requests that update Go code size/s needs-go-generate-ethergo and removed size/xs labels Apr 1, 2024
Copy link

codecov bot commented Apr 1, 2024

Codecov Report

Attention: Patch coverage is 76.78571% with 13 lines in your changes missing coverage. Please review.

Project coverage is 47.76307%. Comparing base (70be4cb) to head (f458ffe).
Report is 3 commits behind head on master.

Files Patch % Lines
ethergo/backends/base/base.go 0.00000% 5 Missing ⚠️
ethergo/backends/anvil/anvil.go 0.00000% 3 Missing ⚠️
ethergo/util/converter.go 78.57143% 2 Missing and 1 partial ⚠️
ethergo/backends/geth/geth.go 92.85714% 1 Missing ⚠️
ethergo/backends/geth/logger.go 85.71429% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2416         +/-   ##
===================================================
+ Coverage   38.94594%   47.76307%   +8.81712%     
===================================================
  Files            168         317        +149     
  Lines          13244       23112       +9868     
  Branches          80          80                 
===================================================
+ Hits            5158       11039       +5881     
- Misses          7435       10989       +3554     
- Partials         651        1084        +433     
Flag Coverage Δ
cctp-relayer 44.68619% <ø> (?)
core 64.54836% <ø> (?)
ethergo 59.73822% <76.78571%> (?)
explorer 24.16714% <ø> (ø)
git-changes-action 68.75000% <ø> (?)
omnirpc 53.15110% <ø> (ø)
promexporter 75.91241% <ø> (?)
rfq 31.07135% <ø> (-0.04647%) ⬇️
screener-api 66.97039% <ø> (+0.22778%) ⬆️
scribe 51.84275% <ø> (-0.18429%) ⬇️
stiprelayer 3.33333% <ø> (ø)
tools 39.03421% <ø> (ø)

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.

Actionable comments posted: 0

Review Status

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 640951a and 6a6304f.
Files ignored due to path filters (16)
  • agents/go.mod is excluded by !**/*.mod
  • committee/go.mod is excluded by !**/*.mod
  • contrib/git-changes-action/go.mod is excluded by !**/*.mod
  • contrib/promexporter/go.mod is excluded by !**/*.mod
  • contrib/screener-api/go.mod is excluded by !**/*.mod
  • core/go.mod is excluded by !**/*.mod
  • ethergo/go.mod is excluded by !**/*.mod
  • go.work.sum is excluded by !**/*.sum
  • services/cctp-relayer/go.sum is excluded by !**/*.sum
  • services/explorer/go.sum is excluded by !**/*.sum
  • services/omnirpc/go.sum is excluded by !**/*.sum
  • services/rfq/go.sum is excluded by !**/*.sum
  • services/scribe/go.sum is excluded by !**/*.sum
  • services/stiprelayer/go.sum is excluded by !**/*.sum
  • sin-executor/go.mod is excluded by !**/*.mod
  • tools/go.mod is excluded by !**/*.mod
Files selected for processing (6)
  • ethergo/backends/anvil/anvil.go (2 hunks)
  • ethergo/backends/geth/geth.go (3 hunks)
  • ethergo/backends/simulated/multibackend/simulated_gen.go (2 hunks)
  • ethergo/backends/simulated/simulated.go (3 hunks)
  • ethergo/chain/gas/londinium/gasprice.go (2 hunks)
  • ethergo/chain/gas/london/oracle_backend.go (1 hunks)
Additional Context Used
Additional comments not posted (10)
ethergo/chain/gas/london/oracle_backend.go (1)

67-67: The addition of block.Time() as a parameter to the DeriveFields method call is noted. Ensure that the use of block.Time() within DeriveFields aligns with the intended logic and has been thoroughly tested, especially in scenarios where block time might significantly influence the derived fields.

ethergo/chain/gas/londinium/gasprice.go (1)

125-125: The addition of the time parameter to the getBlockPrices calls within the SuggestPrice method is noted. Ensure that the use of the time parameter within getBlockPrices is correctly implemented for accurate gas price calculation. It's crucial to verify how block time influences the price calculation and to test this functionality thoroughly.

ethergo/backends/simulated/simulated.go (2)

6-8: The addition of imports (math/big, testing, time) aligns with the updated functionalities within the file, such as handling block times and big integers. Ensure these packages are utilized as intended throughout the file.


55-55: The modification to include latestBlock.Time() in the types.MakeSigner call within the Signer method is noted. Ensure that the use of latestBlock.Time() is correctly implemented for accurate transaction signing. It's crucial to verify how the block time influences the signing process and to test this functionality thoroughly.

ethergo/backends/geth/geth.go (2)

122-122: The removal of the parameter 0 from the StartMining function calls is noted. Ensure that mining functionality is correctly initiated without this parameter and verify that this change aligns with the updated method signature and intended behavior.


185-185: The modification to include latestBlock.Time() in the types.MakeSigner call within the Signer method is noted. Ensure that the use of latestBlock.Time() is correctly implemented for accurate transaction signing. It's crucial to verify how the block time influences the signing process and to test this functionality thoroughly.

ethergo/backends/anvil/anvil.go (2)

13-16: The addition of imports (github.com/ipfs/go-log, github.com/lmittmann/w3/w3types, github.com/ory/dockertest/v3) aligns with the updated functionalities within the file, such as logging, handling web3 types, and Docker container management in tests. Ensure these packages are utilized as intended throughout the file.


290-294: The modification to include latestBlock.Time() in the types.MakeSigner call within the Signer method is noted. Ensure that the use of latestBlock.Time() is correctly implemented for accurate transaction signing. It's crucial to verify how the block time influences the signing process and to test this functionality thoroughly.

ethergo/backends/simulated/multibackend/simulated_gen.go (2)

689-689: The addition of the block time parameter to the MakeSigner call in the SendTransaction function aligns with the upgrade requirements for Geth 1.12. This change ensures that the transaction signing process considers the block time, which is crucial for accurately simulating transactions in a test environment.


889-889: The inclusion of the block time parameter in the ReadReceipts call within the GetReceipts function is a necessary adjustment for compatibility with Geth 1.12. This modification ensures that receipt reading behavior accurately reflects the new block time considerations introduced in the upgraded Geth version.

@aureliusbtc aureliusbtc changed the title Upgrade geth to 1.12 Upgrade geth to 1.13 Apr 1, 2024
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

Review Status

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 6a6304f and 80b06f9.
Files ignored due to path filters (16)
  • agents/go.mod is excluded by !**/*.mod
  • committee/go.mod is excluded by !**/*.mod
  • contrib/git-changes-action/go.mod is excluded by !**/*.mod
  • contrib/promexporter/go.mod is excluded by !**/*.mod
  • contrib/screener-api/go.mod is excluded by !**/*.mod
  • core/go.mod is excluded by !**/*.mod
  • ethergo/go.mod is excluded by !**/*.mod
  • go.work.sum is excluded by !**/*.sum
  • services/cctp-relayer/go.mod is excluded by !**/*.mod
  • services/explorer/go.mod is excluded by !**/*.mod
  • services/omnirpc/go.mod is excluded by !**/*.mod
  • services/rfq/go.mod is excluded by !**/*.mod
  • services/scribe/go.mod is excluded by !**/*.mod
  • services/stiprelayer/go.mod is excluded by !**/*.mod
  • sin-executor/go.mod is excluded by !**/*.mod
  • tools/go.mod is excluded by !**/*.mod
Files selected for processing (13)
  • agents/testutil/simulated_backends_suite.go (1 hunks)
  • ethergo/backends/geth/config.go (3 hunks)
  • ethergo/backends/geth/geth.go (6 hunks)
  • ethergo/backends/preset/presets.go (2 hunks)
  • ethergo/backends/simulated/multibackend/chainid.go (2 hunks)
  • ethergo/backends/simulated/multibackend/simulated_gen.go (2 hunks)
  • ethergo/chain/chain_test.go (1 hunks)
  • ethergo/chain/client/client_test.go (3 hunks)
  • ethergo/chain/client/config.go (2 hunks)
  • ethergo/chain/client/config_test.go (2 hunks)
  • ethergo/chain/gas/londinium/gasprice_test.go (3 hunks)
  • ethergo/chain/gas/london/oracle_backend.go (2 hunks)
  • services/omnirpc/rpcinfo/latency_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • ethergo/backends/geth/geth.go
  • ethergo/backends/simulated/multibackend/simulated_gen.go
Additional Context Used
Additional comments not posted (23)
ethergo/chain/chain_test.go (1)

17-17: The change from GetRinkeby() to GetSepolia() in TestNewFromURL aligns with the PR's objective. Ensure that this change does not inadvertently affect other tests or functionalities that might rely on the Rinkeby configuration.

ethergo/chain/client/config_test.go (2)

4-6: The added imports (math, math/big, and time) are necessary for the changes in the TestChainSigner function and are correctly placed.


42-42: The inclusion of time.Now().Unix() as an additional argument in the types.MakeSigner call is a significant update. Ensure that this change is consistent with the expected behavior and does not introduce any unintended side effects.

ethergo/backends/geth/config.go (2)

4-6: The added imports (math/big and testing) are necessary for the changes in the makeEthConfig function and are correctly placed.


49-49: The adjustment in the core.DeveloperGenesisBlock function call by removing an argument likely reflects an update in the underlying library. Ensure that this change does not affect the expected Ethereum configuration.

services/omnirpc/rpcinfo/latency_test.go (2)

22-26: The update from BSC Testnet to Matic Mumbai and from Avalanche Local to Sepolia in the TestRPCLatency function aligns with the PR's objective. Ensure that these changes are consistent with the intended testing scenarios.


5-9: The reorganization of imports, including the addition of net/http and net/http/httptest, improves the readability and organization of the file.

ethergo/backends/preset/presets.go (2)

12-20: The alteration of the GetRinkeby function to GetSepolia, updating chain configurations and RPC URLs for the Sepolia preset backend, aligns with the PR's objective. Ensure that this change does not affect other functionalities that might rely on the Rinkeby configuration.


45-45: The adjustments made to the GetMaticMumbai function related to the London block configuration are significant. Ensure that this change is consistent with the expected behavior and does not introduce any unintended side effects.

ethergo/chain/gas/london/oracle_backend.go (1)

68-73: The addition of block.Time() and blobGasPrice calculation in the DeriveFields method call for receipts is significant. Ensure that this change is consistent with the expected behavior and does not introduce any unintended side effects related to gas price calculations.

ethergo/chain/client/client_test.go (3)

4-6: The added imports (os and time) are necessary for the changes in the TestAttemptReconnect function and are correctly placed.


26-26: The update from Rinkeby to Sepolia in the TestAttemptReconnect function aligns with the PR's objective. Ensure that this change does not affect other tests or functionalities that might rely on the Rinkeby configuration.


26-26: Setting a reset timeout for the client in the TestAttemptReconnect function is significant. Ensure that this change does not introduce any unintended side effects on client behavior.

ethergo/backends/simulated/multibackend/chainid.go (3)

12-12: The addition of the trie package import is necessary for the changes in the NewSimulatedBackendWithConfig function and is correctly placed.


51-51: The introduction of the triedb variable using trie.NewDatabase is significant. Ensure that this change is consistent with the expected behavior and does not introduce any unintended side effects related to database management.


54-54: The modification of genesis.MustCommit to include triedb as an argument is significant. Ensure that this change is consistent with the expected behavior and does not introduce any unintended side effects related to genesis block creation.

ethergo/chain/gas/londinium/gasprice_test.go (3)

25-26: The addition of imports for the trie package and the londinium package itself is appropriate for the functionality being tested. Ensure that these packages are used effectively within the test cases.


76-76: The initialization of triedb with trie.NewDatabase(db, nil) introduces a second parameter, which is nil in this context. It's important to verify that passing nil as the second argument aligns with the expected behavior of trie.NewDatabase. If this parameter is meant to configure certain aspects of the database, consider whether a non-nil value should be provided for more comprehensive testing.


90-90: The creation of disktriedb with trie.NewDatabase(diskdb, nil) mirrors the earlier initialization of triedb. As with the previous comment, ensure that the use of nil for the second parameter is intentional and appropriate for the tests being conducted.

ethergo/chain/client/config.go (2)

4-5: The addition of the math/big package is necessary for working with big integers, which are common in blockchain configurations. This change is appropriate for the functionality of the file.


337-337: Reordering the chain configurations in chainConfigs and removing duplicate entries improves the maintainability and readability of the code. It's important to ensure that all necessary configurations are still present and correctly ordered after these changes.

agents/testutil/simulated_backends_suite.go (2)

420-420: Changing the chain ID to Sepolia's chain ID for the anvilOptsOrigin setup is a significant update that aligns with the PR's objective of upgrading Geth to version 1.13. This change ensures that the test environment reflects the updated network configurations. Ensure that all dependent tests and functionalities are compatible with Sepolia.


425-425: Using Sepolia for the TestBackendOrigin setup without Anvil indicates a broader shift in the test network preference. This change should be reflected across all tests and documentation to avoid confusion.

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 Apr 16, 2024
@github-actions github-actions bot closed this Apr 21, 2024
@trajan0x trajan0x reopened this Jun 8, 2024
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

Outside diff range and nitpick comments (2)
ethergo/backends/geth/geth.go (2)

128-129: Consider setting a non-zero gas tip to avoid potential issues with transaction processing.

It's generally a good practice to set a realistic gas tip to ensure transactions are processed in a timely manner, especially in a simulated environment where you might want to mimic real-world conditions.


230-230: Consider using a more dynamic calculation for the gas limit.

Using half of the genesis block's gas limit may not always be optimal. Consider a strategy that adjusts based on network conditions or specific test requirements.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 24f5511 and caf227c.

Files selected for processing (2)
  • ethergo/backends/geth/config.go (3 hunks)
  • ethergo/backends/geth/geth.go (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • ethergo/backends/geth/config.go
Additional context used
GitHub Check: Lint (ethergo)
ethergo/backends/geth/geth.go

[failure] 97-97:
ineffectual assignment to err (ineffassign)

Additional comments not posted (1)
ethergo/backends/geth/geth.go (1)

46-46: Ensure the default address is intentional.

#!/bin/bash
# Description: Verify if the default address is used elsewhere for specific configurations.

# Test: Search for the default address usage. Expect: Specific configurations or none.
rg --type go 'common.Address{}'

@@ -140,7 +146,7 @@
if embedded.ethBackend.IsMining() {
cancelMiningCtx()
} else {
_ = embedded.ethBackend.APIBackend.StartMining(0)
_ = embedded.ethBackend.APIBackend.StartMining()
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle potential failure from StartMining in the retry logic.

- _ = embedded.ethBackend.APIBackend.StartMining()
+ if err := embedded.ethBackend.APIBackend.StartMining(); err != nil {
+     logger.Error("Failed to start mining: ", err)
+     return
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
_ = embedded.ethBackend.APIBackend.StartMining()
if err := embedded.ethBackend.APIBackend.StartMining(); err != nil {
logger.Error("Failed to start mining: ", err)
return
}

@@ -183,7 +189,7 @@
latestBlock, err := f.BlockByNumber(f.Context(), nil)
assert.Nil(f.T(), err)

return types.MakeSigner(f.ChainConfig(), latestBlock.Number())
return types.MakeSigner(f.ChainConfig(), latestBlock.Number(), latestBlock.Time())
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure the latest block is successfully retrieved before using it.

- latestBlock, err := f.BlockByNumber(f.Context(), nil)
- return types.MakeSigner(f.ChainConfig(), latestBlock.Number(), latestBlock.Time())
+ latestBlock, err := f.BlockByNumber(f.Context(), nil)
+ if err != nil {
+     f.T().Error("Failed to retrieve latest block: ", err)
+     return nil
+ }
+ return types.MakeSigner(f.ChainConfig(), latestBlock.Number(), latestBlock.Time())
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
return types.MakeSigner(f.ChainConfig(), latestBlock.Number(), latestBlock.Time())
latestBlock, err := f.BlockByNumber(f.Context(), nil)
if err != nil {
f.T().Error("Failed to retrieve latest block: ", err)
return nil
}
return types.MakeSigner(f.ChainConfig(), latestBlock.Number(), latestBlock.Time())

@@ -92,6 +93,11 @@
embedded.ethBackend, err = eth.New(embedded.Node, ethConfig)
assert.Nil(t, err)

// setup the consensus client
simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
Copy link
Contributor

Choose a reason for hiding this comment

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

Address the ineffectual assignment to err.

- simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
+ simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
+ if err != nil {
+     return nil, err
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
if err != nil {
return nil, err
}
Tools
GitHub Check: Lint (ethergo)

[failure] 97-97:
ineffectual assignment to err (ineffassign)

Comment on lines 96 to 100
// setup the consensus client
simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
catalyst.RegisterSimulatedBeaconAPIs(embedded.Node, simBeacon)
embedded.Node.RegisterLifecycle(simBeacon)

Copy link
Contributor

Choose a reason for hiding this comment

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

Consider handling errors from NewSimulatedBeacon and RegisterSimulatedBeaconAPIs.

- simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
- catalyst.RegisterSimulatedBeaconAPIs(embedded.Node, simBeacon)
+ simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
+ if err != nil {
+     return nil, err
+ }
+ err = catalyst.RegisterSimulatedBeaconAPIs(embedded.Node, simBeacon)
+ if err != nil {
+     return nil, err
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
// setup the consensus client
simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
catalyst.RegisterSimulatedBeaconAPIs(embedded.Node, simBeacon)
embedded.Node.RegisterLifecycle(simBeacon)
// setup the consensus client
simBeacon, err := catalyst.NewSimulatedBeacon(1, embedded.ethBackend)
if err != nil {
return nil, err
}
err = catalyst.RegisterSimulatedBeaconAPIs(embedded.Node, simBeacon)
if err != nil {
return nil, err
}
embedded.Node.RegisterLifecycle(simBeacon)
Tools
GitHub Check: Lint (ethergo)

[failure] 97-97:
ineffectual assignment to err (ineffassign)

@@ -291,7 +297,7 @@
auth.GasPrice, err = f.Client().SuggestGasPrice(ctx)
assert.Nil(f.T(), err)

auth.GasLimit = ethCore.DeveloperGenesisBlock(0, gasLimit, f.faucetAddr.Address).GasLimit / 2
auth.GasLimit = ethCore.DeveloperGenesisBlock(gasLimit, f.faucetAddr.Address).GasLimit / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate logic for setting GasLimit. Consider refactoring to avoid code duplication.

- auth.GasLimit = ethCore.DeveloperGenesisBlock(gasLimit, f.faucetAddr.Address).GasLimit / 2
+ auth.GasLimit = calculateOptimalGasLimit(gasLimit, f.faucetAddr.Address)

And define a new function calculateOptimalGasLimit that encapsulates the logic for determining the gas limit.

Committable suggestion was skipped due to low confidence.

@github-actions github-actions bot added size/l and removed size/m labels Jun 8, 2024
@trajan0x
Copy link
Contributor

trajan0x commented Jun 9, 2024

Seeing issues possibly related to:

golang/go#66556
golang/go#54023

when trying to debug locally

image image image

Appears to be happening in submitter_suite which has two different test suites:

image

Possible testify issue?

Also going to try upgrading goland

Goland upgrade no work.

Tried reinstalling xcode, that also didn't work:

go-delve/delve#2794 (comment)

tried clearing testcache:

go clean -testcache

What's oddest is this error:

could not get the Go version for the moduledata extraction: no goversion found because go version is specified in ethergo's go.mod

I managed to fix the issue w/o the debugger: 65d2116

will review later

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

Outside diff range and nitpick comments (4)
ethergo/backends/simulated/multibackend/simulated_gen.go (1)

Line range hint 720-742: Improve error handling and messaging in SendTransaction.

- return errors.New("could not fetch parent")
+ return fmt.Errorf("could not fetch parent block for transaction: %w", err)
- return fmt.Errorf("invalid transaction: %v", err)
+ return fmt.Errorf("invalid transaction due to sender verification failure: %w", err)
agents/agents/executor/executor_test.go (2)

Line range hint 1-100: Consider refactoring to improve readability.

- func (e *ExecutorSuite) TestVerifyState() {
+ func (e *ExecutorSuite) setupTestVerifyState() {
+   // Setup code here
+ }
+
+ func (e *ExecutorSuite) executeTestVerifyState() {
+   // Execution code here
+ }
+
+ func (e *ExecutorSuite) verifyTestVerifyState() {
+   // Verification code here
+ }
+
+ func (e *ExecutorSuite) TestVerifyState() {
+   e.setupTestVerifyState()
+   e.executeTestVerifyState()
+   e.verifyTestVerifyState()
+ }

Line range hint 101-200: Add detailed comments to explain asynchronous operations.

+ // Start the Scribe service asynchronously and handle any errors.
  go func() {
    scribeError := scribe.Start(e.GetTestContext())
    if !testDone {
      e.Nil(scribeError)
    }
  }()
agents/agents/guard/fraud_test.go (1)

605-605: Consider adding a comment explaining the purpose of recipientDestination.

Adding a comment here would improve code readability and maintainability, especially for new developers or for future reference.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between caf227c and 65d2116.

Files ignored due to path filters (14)
  • agents/go.sum is excluded by !**/*.sum
  • contrib/git-changes-action/go.sum is excluded by !**/*.sum
  • contrib/promexporter/go.sum is excluded by !**/*.sum
  • contrib/screener-api/go.sum is excluded by !**/*.sum
  • core/go.sum is excluded by !**/*.sum
  • ethergo/go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • services/cctp-relayer/go.sum is excluded by !**/*.sum
  • services/explorer/go.sum is excluded by !**/*.sum
  • services/omnirpc/go.sum is excluded by !**/*.sum
  • services/rfq/go.sum is excluded by !**/*.sum
  • services/scribe/go.sum is excluded by !**/*.sum
  • services/stiprelayer/go.sum is excluded by !**/*.sum
  • tools/go.sum is excluded by !**/*.sum
Files selected for processing (26)
  • agents/agents/agentsintegration/agentsintegration_test.go (1 hunks)
  • agents/agents/executor/executor_test.go (1 hunks)
  • agents/agents/guard/fraud_test.go (1 hunks)
  • agents/go.mod (4 hunks)
  • contrib/git-changes-action/go.mod (1 hunks)
  • contrib/promexporter/go.mod (9 hunks)
  • contrib/screener-api/go.mod (3 hunks)
  • core/go.mod (5 hunks)
  • ethergo/backends/anvil/anvil.go (2 hunks)
  • ethergo/backends/geth/config.go (3 hunks)
  • ethergo/backends/geth/geth.go (8 hunks)
  • ethergo/backends/geth/geth_test.go (1 hunks)
  • ethergo/backends/geth/logger.go (4 hunks)
  • ethergo/backends/preset/presets.go (4 hunks)
  • ethergo/backends/simulated/multibackend/simulated_gen.go (14 hunks)
  • ethergo/backends/simulated/multibackend/simulated_gen_test.go (30 hunks)
  • ethergo/chain/client/lifecycle_test.go (1 hunks)
  • ethergo/go.mod (9 hunks)
  • ethergo/submitter/submitter_test.go (1 hunks)
  • services/cctp-relayer/go.mod (8 hunks)
  • services/explorer/go.mod (9 hunks)
  • services/omnirpc/go.mod (8 hunks)
  • services/rfq/go.mod (9 hunks)
  • services/scribe/go.mod (10 hunks)
  • services/stiprelayer/go.mod (9 hunks)
  • tools/go.mod (6 hunks)
Files skipped from review due to trivial changes (3)
  • contrib/git-changes-action/go.mod
  • ethergo/submitter/submitter_test.go
  • services/stiprelayer/go.mod
Files skipped from review as they are similar to previous changes (3)
  • ethergo/backends/geth/config.go
  • ethergo/backends/geth/geth.go
  • ethergo/backends/simulated/multibackend/simulated_gen_test.go
Additional comments not posted (98)
ethergo/backends/geth/geth_test.go (2)

19-19: LGTM! Good use of context management and balance verification in TestFaucet.


19-19: Ensure the hardcoded block number 1 is intentional and appropriate for this test scenario.

Verification successful

Let's expand our search to verify the usage of hardcoded block numbers across the entire repository and not just within the specified file.


Let's refine our search to include other potential patterns related to block numbers and ensure we capture any relevant context.


The search results indicate that the hardcoded block number 1 is used intentionally in multiple test files, including ethergo/backends/geth/geth_test.go. This suggests that the usage of uint64(1) in the test is deliberate and consistent with other parts of the codebase.

  • ethergo/backends/geth/geth_test.go: Equal(g.T(), height.Number.Uint64(), uint64(1))
  • ethergo/backends/simulated/multibackend/simulated_gen_test.go: if block.NumberU64() != 1 { ... }
  • ethergo/backends/simulated/multibackend/empty.go: if block.Number().Uint64() != 1 { ... }

Given this context, the hardcoded block number 1 appears to be an intentional part of the test scenarios.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the block number used in tests.
# Test: Search for hardcoded block numbers in tests. Expect: Only intentional uses.
rg --type go 'uint64(1)' ethergo/backends/geth/geth_test.go

Length of output: 61



Script:

#!/bin/bash
# Description: Verify the block number used in tests across the entire repository.
# Test: Search for hardcoded block numbers in tests. Expect: Only intentional uses.
rg --type go 'uint64(1)'

Length of output: 26



Script:

#!/bin/bash
# Description: Verify the block number used in tests across the entire repository.
# Test: Search for various patterns related to block numbers in tests. Expect: Only intentional uses.
rg --type go 'block.Number' --context 5
rg --type go 'height.Number' --context 5

Length of output: 7500

ethergo/backends/preset/presets.go (4)

12-20: LGTM! Correct setup for the Sepolia network configuration.


27-27: LGTM! Correct setup for the BSC Testnet configuration.


40-43: LGTM! Correct setup for the Matic network configuration, including the handling of the London hard fork.


55-55: LGTM! Correct setup for the fake Matic network configuration.

tools/go.mod (1)

Line range hint 8-105: Dependency updates are consistent with the PR objectives to upgrade Ethereum and enhance functionality.

ethergo/chain/client/lifecycle_test.go (2)

79-80: The test assertions for permit acquisitions and releases use the length of skipMethods to adjust the expected number of calls. This dynamic approach ensures that any future modifications to the skipMethods list will automatically reflect in the assertions without further code changes.


83-84: The skipMethods array has been updated to reflect the current methods that should be skipped during testing. This update is crucial for maintaining the accuracy of the test coverage.

core/go.mod (1)

16-16: The go-ethereum library has been updated to v1.13.8. This update is part of the overall effort to upgrade dependencies across the project. It's important to ensure that this version is compatible with other dependencies and does not introduce any breaking changes.

contrib/screener-api/go.mod (1)

62-62: The go-ethereum library version has been updated to v1.13.8 in an indirect manner. This change should be reviewed to ensure it aligns with the direct dependencies and their compatibility.

contrib/promexporter/go.mod (11)

23-23: Updated github.com/ethereum/go-ethereum to v1.13.8.

This update aligns with the PR's objective to upgrade the Go Ethereum client to version 1.13, addressing issues with gas pricing.


64-64: Added github.com/bits-and-blooms/bitset as a new dependency.

Ensure that this new dependency is utilized appropriately in the project, and consider adding documentation or comments in the code where it is used.


82-82: Added github.com/cockroachdb/tokenbucket.

This addition should be reviewed to ensure it meets the project's requirements for rate limiting or resource management functionalities.


83-83: Added github.com/consensys/bavard.

Verify that the addition of this library is justified by the need for its specific functionalities in the project.


84-84: Added github.com/consensys/gnark-crypto.

This cryptographic library should be used with caution. Ensure that security reviews are conducted if it's used for critical cryptographic operations.


86-86: Added github.com/crate-crypto/go-ipa.

This library's usage should be clearly documented, especially if it involves cryptographic processes or data integrity mechanisms.


87-87: Added github.com/crate-crypto/go-kzg-4844.

As with other cryptographic libraries, ensure that usage of this library is secure and reviewed, particularly if it's involved in consensus or transaction verification processes.


94-94: Added github.com/ethereum/c-kzg-4844.

This addition likely relates to specific Ethereum functionalities. Confirm that it integrates well with the existing Ethereum-related modules in the project.


101-101: Added github.com/gballet/go-verkle.

This library is specific to Ethereum's verkle tree functionalities. Ensure its integration is tested thoroughly, especially in terms of compatibility with other Ethereum components.


193-193: Added github.com/supranational/blst.

This library is used for BLS signatures. It's crucial to ensure that its integration does not introduce security vulnerabilities, particularly in the cryptographic signing processes.


245-245: Added rsc.io/tmplfunc.

This utility library for handling template functions should be used carefully to avoid introducing template injection vulnerabilities.

services/omnirpc/go.mod (11)

18-18: Updated github.com/ethereum/go-ethereum to v1.13.8 aligns with the PR's objective to upgrade Go Ethereum.


71-71: Added github.com/bits-and-blooms/bitset as a new dependency.


86-86: Added github.com/cockroachdb/pebble as a new dependency.


88-88: Added github.com/cockroachdb/tokenbucket as a new dependency.


89-89: Added github.com/consensys/bavard as a new dependency.


90-90: Added github.com/consensys/gnark-crypto as a new dependency.


93-93: Added github.com/crate-crypto/go-ipa as a new dependency.


94-94: Added github.com/crate-crypto/go-kzg-4844 as a new dependency.


106-106: Added github.com/ethereum/c-kzg-4844 as a new dependency.


113-113: Added github.com/gballet/go-verkle as a new dependency.


273-273: Added rsc.io/tmplfunc as a new dependency.

ethergo/backends/anvil/anvil.go (2)

13-16: Added imports for github.com/ipfs/go-log, github.com/lmittmann/w3/w3types, and github.com/ory/dockertest/v3.


290-294: The method Signer retrieves the latest block and creates a signer based on the chain configuration and block details. Ensure that error handling is robust, especially for network-related operations.

ethergo/go.mod (3)

23-23: Upgrade of go-ethereum to v1.13.8 looks appropriate and aligns with the PR's objectives.


198-199: Removal of go-colorable and go-isatty. Verify that this does not impact any logging or console output functionalities in the project.


97-97: Addition of new dependencies such as cryptographic libraries and database management tools. Ensure these are necessary for the project's functionality and check for any potential security implications.

Also applies to: 109-109, 114-114, 115-115, 116-116, 119-119, 120-120, 132-132, 139-139, 235-235, 282-282

services/explorer/go.mod (10)

25-25: Updated github.com/ethereum/go-ethereum to v1.13.8.

This update aligns with the PR's objective to upgrade the Go Ethereum client to address gas pricing issues.


76-76: Added github.com/bits-and-blooms/bitset as a new dependency.

Ensure that this new dependency is utilized appropriately in the project and does not introduce redundancy with existing libraries.


93-93: Added github.com/cockroachdb/pebble as a new dependency.

Verify that the addition of this dependency is necessary for the project's requirements and check for potential overlaps with existing database management systems.


95-95: Added github.com/cockroachdb/tokenbucket as a new dependency.

Ensure that this library's functionality is required for rate-limiting or similar features within the project.


96-96: Added github.com/consensys/bavard as a new dependency.

Confirm that this dependency is used for its intended purpose, likely related to blockchain or cryptographic functions.


100-100: Added github.com/crate-crypto/go-ipa as a new dependency.

This addition should be justified by the need for specific cryptographic operations provided by this library.


101-101: Added github.com/crate-crypto/go-kzg-4844 as a new dependency.

Ensure that the functionalities provided by this cryptographic library are essential for the project's operations.


117-117: Added github.com/ethereum/c-kzg-4844 as a new dependency.

This library is likely related to specific cryptographic needs; verify its integration and usage within the project.


125-125: Added github.com/gballet/go-verkle as a new dependency.

Check the necessity of this library for handling Verkle trees or related cryptographic structures in the project.


294-294: Added rsc.io/tmplfunc as a new dependency.

Confirm the usage of this library for template functions and ensure it does not overlap with existing template handling libraries.

services/scribe/go.mod (10)

28-28: Updated github.com/ethereum/go-ethereum to v1.13.8.

This update is consistent with the PR's objective to upgrade the Go Ethereum client to address gas pricing issues.


90-90: Added github.com/bits-and-blooms/bitset as a new dependency.

Ensure that this new dependency is utilized appropriately in the project and does not introduce redundancy with existing libraries.


108-108: Added github.com/cockroachdb/pebble as a new dependency.

Verify that the addition of this dependency is necessary for the project's requirements and check for potential overlaps with existing database management systems.


110-110: Added github.com/cockroachdb/tokenbucket as a new dependency.

Ensure that this library's functionality is required for rate-limiting or similar features within the project.


111-111: Added github.com/consensys/bavard as a new dependency.

Confirm that this dependency is used for its intended purpose, likely related to blockchain or cryptographic functions.


115-115: Added github.com/crate-crypto/go-ipa as a new dependency.

This addition should be justified by the need for specific cryptographic operations provided by this library.


116-116: Added github.com/crate-crypto/go-kzg-4844 as a new dependency.

Ensure that the functionalities provided by this cryptographic library are essential for the project's operations.


132-132: Added github.com/ethereum/c-kzg-4844 as a new dependency.

This library is likely related to specific cryptographic needs; verify its integration and usage within the project.


141-141: Added github.com/gballet/go-verkle as a new dependency.

Check the necessity of this library for handling Verkle trees or related cryptographic structures in the project.


309-309: Added rsc.io/tmplfunc as a new dependency.

Confirm the usage of this library for template functions and ensure it does not overlap with existing template handling libraries.

services/cctp-relayer/go.mod (12)

11-11: Dependency update for github.com/ethereum/go-ethereum to v1.13.8 aligns with the PR's objective to upgrade Go Ethereum.


67-67: Added new dependency github.com/bits-and-blooms/bitset. Ensure this library is used appropriately in the project and check for any licensing issues.


85-85: Added new dependency github.com/cockroachdb/pebble. Verify its integration and performance impact, especially for database operations.


193-193: Added new dependency github.com/mmcloughlin/addchain. Ensure it's used for its intended purpose in optimizing cryptographic operations.


114-114: Added new dependency github.com/gballet/go-verkle. This is a cryptographic library; ensure it's integrated properly and used securely.


229-229: Added new dependency github.com/supranational/blst. This is a cryptographic library; ensure its secure integration and usage.


157-157: Added new dependency github.com/holiman/billy. Verify its usage, especially in file system operations.


106-106: Added new dependency github.com/ethereum/c-kzg-4844. This is likely related to cryptographic operations; verify its integration and usage.


92-92: Added new dependency github.com/crate-crypto/go-ipa. Ensure that it's used for cryptographic purposes as intended.


88-88: Added new dependency github.com/consensys/bavard. Confirm its usage in logging or code generation scenarios.


291-291: Added new dependency rsc.io/tmplfunc. Verify its usage in template generation or similar functionalities.


87-87: Added new dependency github.com/cockroachdb/tokenbucket. Ensure it's used for rate limiting or similar functionalities as intended.

services/rfq/go.mod (12)

9-9: Dependency update for github.com/ethereum/go-ethereum to v1.13.8 aligns with the PR's objective to upgrade Go Ethereum.


99-99: Added new dependency github.com/consensys/bavard. Confirm its usage in logging or code generation scenarios.


78-78: Added new dependency github.com/bits-and-blooms/bitset. Ensure this library is used appropriately in the project and check for any licensing issues.


98-98: Added new dependency github.com/cockroachdb/tokenbucket. Ensure it's used for rate limiting or similar functionalities as intended.


118-118: Added new dependency github.com/ethereum/c-kzg-4844. This is likely related to cryptographic operations; verify its integration and usage.


208-208: Added new dependency github.com/mmcloughlin/addchain. Ensure it's used for its intended purpose in optimizing cryptographic operations.


103-103: Added new dependency github.com/crate-crypto/go-ipa. Ensure that it's used for cryptographic purposes as intended.


245-245: Added new dependency github.com/supranational/blst. This is a cryptographic library; ensure its secure integration and usage.


305-305: Added new dependency rsc.io/tmplfunc. Verify its usage in template generation or similar functionalities.


126-126: Added new dependency github.com/gballet/go-verkle. This is a cryptographic library; ensure it's integrated properly and used securely.


171-171: ```shell
#!/bin/bash

Description: Search for the billy package in the identified go.mod and go.sum files.

rg 'billy' agents/go.mod contrib/git-changes-action/go.mod contrib/promexporter/go.mod contrib/screener-api/go.mod core/go.mod ethergo/go.mod services/cctp-relayer/go.mod services/explorer/go.mod services/omnirpc/go.mod services/rfq/go.mod services/scribe/go.mod services/stiprelayer/go.mod tools/go.mod
rg 'billy' agents/go.sum contrib/git-changes-action/go.sum contrib/promexporter/go.sum contrib/screener-api/go.sum core/go.sum ethergo/go.sum services/cctp-relayer/go.sum services/explorer/go.sum services/omnirpc/go.sum services/rfq/go.sum services/scribe/go.sum services/stiprelayer/go.sum tools/go.sum


---

`96-96`: Added new dependency `github.com/cockroachdb/pebble`. Verify its integration and performance impact, especially for database operations.

</blockquote></details>
<details>
<summary>agents/go.mod (14)</summary><blockquote>

`13-13`: Dependency Update: `github.com/ethereum/go-ethereum` upgraded to `v1.13.8`.

This upgrade aligns with the PR's objective to update the Go Ethereum client to version 1.13. Ensure that this version is compatible with other project dependencies and does not introduce breaking changes.

---

`51-51`: New Dependency: `github.com/bits-and-blooms/bitset` added.

Ensure that this new dependency is necessary for the project's functionality and does not introduce security vulnerabilities.

---

`55-55`: New Dependency: `github.com/cockroachdb/pebble` added.

Verify that the specific version of `pebble` used here (`v0.0.0-20230928194634-aa077af62593`) is stable and compatible with the project's requirements.

---

`57-57`: New Dependency: `github.com/cockroachdb/tokenbucket` added.

Confirm the usage of this library in rate limiting or similar functionalities within the project.

---

`58-58`: New Dependency: `github.com/consensys/bavard` added.

Check the integration of this library with existing logging or error handling frameworks in the project.

---

`59-59`: New Dependency: `github.com/consensys/gnark-crypto` added.

This library is likely used for cryptographic operations. Ensure it meets the security standards required by the project.

---

`60-60`: New Dependency: `github.com/crate-crypto/go-ipa` added.

This addition suggests enhancements in cryptographic proofs or similar areas. Validate its use case and security implications.

---

`61-61`: New Dependency: `github.com/crate-crypto/go-kzg-4844` added.

This library is related to cryptographic operations. Confirm its necessity and review its security aspects.

---

`65-65`: New Dependency: `github.com/ethereum/c-kzg-4844` added.

Ensure that this cryptographic library is compatible with other Ethereum-related dependencies and adheres to security best practices.

---

`69-69`: New Dependency: `github.com/gballet/go-verkle` added.

This library is related to Ethereum's Verkle tree implementation. Verify its integration and test for any potential issues in blockchain-related operations.

---

`76-76`: New Dependency: `github.com/holiman/billy` added.

Check the usage of this library for file system operations and ensure it does not introduce security vulnerabilities.

---

`84-84`: Dependency Update: `github.com/mmcloughlin/addchain` upgraded.

This upgrade should be reviewed for compatibility with existing cryptographic operations in the project.

---

`89-89`: Dependency Update: `github.com/supranational/blst` upgraded.

This cryptographic library's upgrade should be thoroughly tested to ensure it does not affect the integrity of cryptographic operations.

---

`96-96`: New Dependency: `rsc.io/tmplfunc` added.

Ensure that this template function library integrates well with the project's existing template handling mechanisms.

</blockquote></details>
<details>
<summary>agents/agents/executor/executor_test.go (2)</summary><blockquote>

Line range hint `201-300`: Well-structured function with proper resource management.

---

`568-568`: Ensure proper handling of transaction value.

<details>
<summary>Verification successful</summary>

Ensure proper handling of transaction value.

The extracted lines from the test files show that the transaction value is being set correctly before calling the `SendBaseMessage` function. Here are the relevant points:

- In `agents/agents/executor/executor_test.go`, the transaction value is set using `transactOpts.Value = types.TotalTips(msgTips)` before calling `SendBaseMessage`.
- In `agents/agents/guard/fraud_test.go`, `txContextOrigin.TransactOpts` is passed to `SendBaseMessage`, but the setting of the transaction value is not shown in the extracted lines.
- In `agents/agents/agentsintegration/agentsintegration_test.go`, `txContextOrigin.TransactOpts` is passed to `SendBaseMessage`, but the setting of the transaction value is not shown in the extracted lines.
- In `agents/contracts/origin/origin_test.go`, `txContext.TransactOpts` is passed to `SendBaseMessage`, but the setting of the transaction value is not shown in the extracted lines.

To ensure comprehensive verification, it is necessary to confirm that the transaction value is set correctly in the context where `txContextOrigin.TransactOpts` and `txContext.TransactOpts` are used.

---

The extracted lines confirm that the transaction value is being set correctly before calling the `SendBaseMessage` function in the relevant test files. Here are the key points:

- In `agents/agents/guard/fraud_test.go`, `txContextOrigin.Value = types.TotalTips(tips)` is set before calling `SendBaseMessage`.
- In `agents/agents/agentsintegration/agentsintegration_test.go`, `txContextOrigin.Value = types.TotalTips(tips)` is set before calling `SendBaseMessage`.
- In `agents/contracts/origin/origin_test.go`, the setting of the transaction value is not explicitly shown, but `txContext.TransactOpts` is used directly.

Based on this information, the transaction value handling appears to be correctly implemented in the test files.



</details>


<details>
<summary>Scripts executed</summary>

The following scripts were executed for the analysis:



---

Script:
```shell
#!/bin/bash
# Description: Verify that the transaction value is correctly set and used in the `SendBaseMessage` function.

# Test: Search for the function usage. Expect: Proper handling of transaction value.
rg --type go $'SendBaseMessage'

Length of output: 19686



Script:

#!/bin/bash
# Extract lines around the usage of SendBaseMessage in the relevant test files to verify the handling of the transaction value.

# Define the files to search in
files=(
  "agents/agents/guard/fraud_test.go"
  "agents/agents/executor/executor_test.go"
  "agents/agents/agentsintegration/agentsintegration_test.go"
  "agents/contracts/origin/origin_test.go"
)

# Loop through each file and extract lines around the usage of SendBaseMessage
for file in "${files[@]}"; do
  echo "File: $file"
  rg -C 5 'SendBaseMessage' "$file"
  echo "----------------------------------------"
done

Length of output: 4016



Script:

#!/bin/bash
# Extract lines around the definition and setting of transaction value in the relevant test files.

# Define the files to search in
files=(
  "agents/agents/guard/fraud_test.go"
  "agents/agents/agentsintegration/agentsintegration_test.go"
  "agents/contracts/origin/origin_test.go"
)

# Loop through each file and extract lines around the definition and setting of transaction value
for file in "${files[@]}"; do
  echo "File: $file"
  rg -C 10 'txContextOrigin|txContext' "$file"
  echo "----------------------------------------"
done

Length of output: 23337

@@ -52,6 +52,7 @@ var _ bind.ContractBackend = (*SimulatedBackend)(nil)

var (
errBlockNumberUnsupported = errors.New("simulatedBackend cannot access blocks other than the latest block")
errBlockHashUnsupported = errors.New("simulatedBackend cannot access blocks by hash other than the latest block")
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistent error message formatting.

- errBlockHashUnsupported    = errors.New("simulatedBackend cannot access blocks by hash other than the latest block")
+ errBlockHashUnsupported    = errors.New("simulatedBackend cannot access blocks by hash other than the latest one")
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
errBlockHashUnsupported = errors.New("simulatedBackend cannot access blocks by hash other than the latest block")
errBlockHashUnsupported = errors.New("simulatedBackend cannot access blocks by hash other than the latest one")

Comment on lines +851 to +865
return errors.New("could not adjust time on non-empty block")
}
// Get the last block
block := b.blockchain.GetBlockByHash(b.pendingBlock.ParentHash())
if block == nil {
return fmt.Errorf("could not find parent")
return errors.New("could not find parent")
}

blocks, _ := core.GenerateChain(b.config, block, ethash.NewFaker(), b.database, 1, func(number int, block *core.BlockGen) {
block.OffsetTime(int64(adjustment.Seconds()))
})
stateDB, _ := b.blockchain.State()

stateDB, err := b.blockchain.State()
if err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle potential issues with non-empty block adjustments.

- return errors.New("could not adjust time on non-empty block")
+ return fmt.Errorf("time adjustment failed on non-empty block: %d transactions present", len(b.pendingBlock.Transactions()))
- return errors.New("could not find parent")
+ return fmt.Errorf("parent block not found for hash: %s", b.pendingBlock.ParentHash())
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return errors.New("could not adjust time on non-empty block")
}
// Get the last block
block := b.blockchain.GetBlockByHash(b.pendingBlock.ParentHash())
if block == nil {
return fmt.Errorf("could not find parent")
return errors.New("could not find parent")
}
blocks, _ := core.GenerateChain(b.config, block, ethash.NewFaker(), b.database, 1, func(number int, block *core.BlockGen) {
block.OffsetTime(int64(adjustment.Seconds()))
})
stateDB, _ := b.blockchain.State()
stateDB, err := b.blockchain.State()
if err != nil {
return err
}
return fmt.Errorf("time adjustment failed on non-empty block: %d transactions present", len(b.pendingBlock.Transactions()))
}
// Get the last block
block := b.blockchain.GetBlockByHash(b.pendingBlock.ParentHash())
if block == nil {
return fmt.Errorf("parent block not found for hash: %s", b.pendingBlock.ParentHash())
}
blocks, _ := core.GenerateChain(b.config, block, ethash.NewFaker(), b.database, 1, func(number int, block *core.BlockGen) {
block.OffsetTime(int64(adjustment.Seconds()))
})
stateDB, err := b.blockchain.State()
if err != nil {
return err
}

Comment on lines +205 to +206
return stateDB.GetCode(contract), nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor to reduce duplication in CodeAt and CodeAtHash.

- func (b *SimulatedBackend) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) {
-   b.mu.Lock()
-   defer b.mu.Unlock()
-   stateDB, err := b.stateByBlockNumber(ctx, blockNumber)
-   if err != nil {
-     return nil, err
-   }
-   return stateDB.GetCode(contract), nil
- }
- func (b *SimulatedBackend) CodeAtHash(ctx context.Context, contract common.Address, blockHash common.Hash) ([]byte, error) {
-   b.mu.Lock()
-   defer b.mu.Unlock()
-   header, err := b.headerByHash(blockHash)
-   if err != nil {
-     return nil, err
-   }
-   stateDB, err := b.blockchain.StateAt(header.Root)
-   if err != nil {
-     return nil, err
-   }
-   return stateDB.GetCode(contract), nil
- }
+ func (b *SimulatedBackend) getCode(ctx context.Context, contract common.Address, blockIdentifier interface{}) ([]byte, error) {
+   b.mu.Lock()
+   defer b.mu.Unlock()
+   var stateDB *state.StateDB
+   var err error
+   switch id := blockIdentifier.(type) {
+   case *big.Int:
+     stateDB, err = b.stateByBlockNumber(ctx, id)
+   case common.Hash:
+     header, err := b.headerByHash(id)
+     if err != nil {
+       return nil, err
+     }
+     stateDB, err = b.blockchain.StateAt(header.Root)
+   }
+   if err != nil {
+     return nil, err
+   }
+   return stateDB.GetCode(contract), nil
+ }

Also applies to: 208-221

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return stateDB.GetCode(contract), nil
}
return stateDB.GetCode(contract), nil
}
func (b *SimulatedBackend) getCode(ctx context.Context, contract common.Address, blockIdentifier interface{}) ([]byte, error) {
b.mu.Lock()
defer b.mu.Unlock()
var stateDB *state.StateDB
var err error
switch id := blockIdentifier.(type) {
case *big.Int:
stateDB, err = b.stateByBlockNumber(ctx, id)
case common.Hash:
header, err := b.headerByHash(id)
if err != nil {
return nil, err
}
stateDB, err = b.blockchain.StateAt(header.Root)
}
if err != nil {
return nil, err
}
return stateDB.GetCode(contract), nil
}

Comment on lines +344 to +345
return b.headerByHash(hash)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor to improve code reuse in HeaderByHash.

- func (b *SimulatedBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) {
-   b.mu.Lock()
-   defer b.mu.Unlock()
-   return b.headerByHash(hash)
- }
- func (b *SimulatedBackend) headerByHash(hash common.Hash) (*types.Header, error) {
-   if hash == b.pendingBlock.Hash() {
-     return b.pendingBlock.Header(), nil
-   }
-   header := b.blockchain.GetHeaderByHash(hash)
-   if header == nil {
-     return nil, errBlockDoesNotExist
-   }
-   return header, nil
- }
+ // Simplified and combined the two functions into one.
+ func (b *SimulatedBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) {
+   b.mu.Lock()
+   defer b.mu.Unlock()
+   if hash == b.pendingBlock.Hash() {
+     return b.pendingBlock.Header(), nil
+   }
+   header := b.blockchain.GetHeaderByHash(hash)
+   if header == nil {
+     return nil, errBlockDoesNotExist
+   }
+   return header, nil
+ }

Also applies to: 347-348

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return b.headerByHash(hash)
}
func (b *SimulatedBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) {
b.mu.Lock()
defer b.mu.Unlock()
if hash == b.pendingBlock.Hash() {
return b.pendingBlock.Header(), nil
}
header := b.blockchain.GetHeaderByHash(hash)
if header == nil {
return nil, errBlockDoesNotExist
}
return header, nil
}

@@ -217,7 +217,7 @@ func (u *AgentsIntegrationSuite) TestAgentsE2E() {

tips := types.NewTips(big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0))
optimisticSeconds := uint32(1)
recipientDestination := u.TestClientMetadataOnDestination.Address().Hash()
recipientDestination := common.BytesToHash(u.TestClientMetadataOnDestination.Address().Bytes())
Copy link
Contributor

Choose a reason for hiding this comment

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

The use of common.BytesToHash directly in the test setup could be abstracted to a helper function for better readability and reuse.

// Suggested helper function
func hashFromBytes(bytes []byte) common.Hash {
    return common.BytesToHash(bytes)
}

Comment on lines +30 to +34
return gethLog.LvlDebug
case zapcore.ErrorLevel:
return gethLog.LvlError
return gethLog.LvlDebug
case zapcore.DPanicLevel, zapcore.PanicLevel, zapcore.FatalLevel:
return gethLog.LvlCrit
return gethLog.LvlInfo
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect log level mappings detected. Consider adjusting the mappings to reflect the correct severity.

- return gethLog.LvlDebug
+ return gethLog.LvlWarn
- return gethLog.LvlDebug
+ return gethLog.LvlError
- return gethLog.LvlInfo
+ return gethLog.LvlCritical
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return gethLog.LvlDebug
case zapcore.ErrorLevel:
return gethLog.LvlError
return gethLog.LvlDebug
case zapcore.DPanicLevel, zapcore.PanicLevel, zapcore.FatalLevel:
return gethLog.LvlCrit
return gethLog.LvlInfo
return gethLog.LvlWarn
case zapcore.ErrorLevel:
return gethLog.LvlError
case zapcore.DPanicLevel, zapcore.PanicLevel, zapcore.FatalLevel:
return gethLog.LvlCritical

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 65d2116 and f3f4dd6.

Files selected for processing (1)
  • ethergo/util/converter.go (1 hunks)

Comment on lines +28 to +35
// gas price will getset to gastipcap + gas fee cap to account for legacy behavior so if
// tip/fee cap are set we need to make sure we nil gas price
if transaction.Type() == types.LegacyTxType {
callMessage.GasTipCap = nil
callMessage.GasFeeCap = nil
} else {
callMessage.GasPrice = nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify the logic for adjusting gas pricing.

The logic for adjusting GasPrice, GasFeeCap, and GasTipCap based on the transaction type is crucial and appears correct. However, adding comments to explain why GasPrice is set to nil in non-legacy transactions and why both GasTipCap and GasFeeCap are set to nil in legacy transactions would enhance maintainability and readability.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f3f4dd6 and 4b954b8.

Files selected for processing (1)
  • .gitignore (1 hunks)
Files skipped from review due to trivial changes (1)
  • .gitignore

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

Outside diff range and nitpick comments (1)
ethergo/util/converter_test.go (1)

42-47: Consider adding more comprehensive tests for the new transaction type handling logic.

It would be beneficial to include tests that cover scenarios where the transaction type might not be set correctly or is missing, to ensure robustness.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4b954b8 and f458ffe.

Files selected for processing (3)
  • .golangci.yml (2 hunks)
  • ethergo/backends/base/base.go (2 hunks)
  • ethergo/util/converter_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .golangci.yml
Additional comments not posted (1)
ethergo/backends/base/base.go (1)

206-210: Enhance error handling based on environment settings.

The addition of conditional error messaging based on the TRACELY_ENABLED environment variable is a good practice. It enhances the debugging capabilities without affecting the production performance.

Comment on lines +206 to +210
errMessage += fmt.Sprintf("\nFor more info run (before the process stops): cast run --rpc-url %s %s --trace-printer ", b.RPCAddress(), transaction.Hash())

if core.GetEnvBool("TRACELY_ENABLED", false) {
errMessage += b.addCastLabels(transaction, callMessage.From)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refactoring to reduce complexity.

The WaitForConfirmation function is quite complex. Consider breaking it down into smaller, more manageable functions or using helper functions to handle specific parts of the logic, such as error handling and transaction receipt processing.

@trajan0x trajan0x merged commit 25894d2 into master Jun 9, 2024
64 of 65 checks passed
@trajan0x trajan0x deleted the upgrade/geth branch June 9, 2024 17:38
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.

2 participants