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

test(evm): backend tests with test network and real txs #2045

Merged
merged 2 commits into from
Sep 21, 2024

Conversation

onikonychev
Copy link
Contributor

@onikonychev onikonychev commented Sep 20, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new TransactionReceipt structure for improved transaction receipt handling.
    • Enhanced test coverage for Ethereum transaction functionalities, including various new tests for transaction receipts and block retrieval methods.
  • Bug Fixes

    • Simplified error handling in various methods, ensuring more robust transaction processing and retrieval.
  • Refactor

    • Streamlined the IEthAPI interface by removing methods related to sending transactions and signing typed data.
    • Updated method signatures across the backend to use consistent address types.
  • Documentation

    • Improved comments and documentation for clarity throughout the codebase.

@onikonychev onikonychev requested a review from a team as a code owner September 20, 2024 09:49
Copy link
Contributor

coderabbitai bot commented Sep 20, 2024

Walkthrough

The changes encompass a significant refactoring of the Ethereum RPC backend, focusing on simplifying error handling, updating method signatures, and enhancing test coverage. Notable modifications include the removal of transaction-related functionalities, standardization of address types, and the introduction of a new TransactionReceipt structure. The changes aim to streamline the codebase, improve clarity, and enhance the robustness of testing for various backend functionalities.

Changes

Files Change Summary
CHANGELOG.md Added entry for backend tests for EVM, referencing pull request #2045.
eth/chain_id.go Updated ParseEthChainID to return *big.Int directly, removing error handling.
eth/eip712/encoding.go, eth/eip712/encoding_legacy.go Simplified error handling in decodeAminoSignDoc and decodeProtobufSignDoc, removing checks for eth.ParseEthChainID.
eth/rpc/backend/account_info.go, eth/rpc/backend/account_info_test.go Changed address parameter type from common.Address to gethcommon.Address in multiple methods; added comprehensive tests for various Ethereum functionalities.
eth/rpc/backend/backend.go, eth/rpc/backend/backend_suite_test.go Simplified NewBackend function's chain ID assignment; enhanced test suite for transaction handling and contract deployment.
eth/rpc/backend/blocks.go, eth/rpc/backend/blocks_test.go Standardized address type to gethcommon.Address; added tests for block retrieval methods.
eth/rpc/backend/call_tx.go, eth/rpc/backend/call_tx_test.go Removed Resend function; updated SendRawTransaction and SetTxDefaults methods; added tests for transaction handling and gas price retrieval.
eth/rpc/backend/chain_info.go, eth/rpc/backend/chain_info_test.go Simplified ChainID method; changed return type of GlobalMinGasPrice; added tests for various chain functionalities.
eth/rpc/backend/filters.go, eth/rpc/backend/filters_test.go Removed filters.go and associated tests, eliminating log retrieval functionalities.
eth/rpc/backend/node_info.go, eth/rpc/backend/node_info_test.go Updated Accounts method to use gethcommon.Address; added tests for backend RPC functionalities.
eth/rpc/backend/sign_tx.go, eth/rpc/backend/sign_tx_test.go Removed transaction signing functionalities and associated tests.
eth/rpc/backend/tracing.go Replaced common.Hash with gethcommon.Hash in tracing methods.
eth/rpc/backend/tx_info.go, eth/rpc/backend/tx_info_test.go Introduced TransactionReceipt struct; updated GetTransactionReceipt method; enhanced tests for transaction receipt handling.
eth/rpc/backend/utils.go, eth/rpc/backend/utils_test.go Renamed processBlock to retrieveEVMTxFeesFromBlock; added tests for log retrieval and proof handling.
eth/rpc/rpcapi/eth_api.go Updated GetTransactionReceipt return type; removed SendTransaction, SignTypedData, and Resend methods from IEthAPI.
eth/rpc/rpcapi/net_api.go Simplified chain ID parsing in NewImplNetAPI.

Poem

🐰 In the code where bunnies hop,
Changes made, we’ll never stop!
Simplified paths, new tests in sight,
Backend dances, oh what a delight!
With every line, we cheer and play,
Hooray for changes, hip-hip-hooray! 🥳


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

coderabbitai[bot]

This comment was marked as resolved.

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 91.42857% with 6 lines in your changes missing coverage. Please review.

Project coverage is 65.76%. Comparing base (0929266) to head (8bde049).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
eth/chain_id.go 0.00% 2 Missing ⚠️
eth/rpc/backend/tx_info.go 92.00% 2 Missing ⚠️
eth/rpc/backend/blocks.go 87.50% 1 Missing ⚠️
eth/rpc/backend/call_tx.go 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2045      +/-   ##
==========================================
+ Coverage   62.89%   65.76%   +2.87%     
==========================================
  Files         266      264       -2     
  Lines       16826    16636     -190     
==========================================
+ Hits        10582    10940     +358     
+ Misses       5434     4808     -626     
- Partials      810      888      +78     
Files with missing lines Coverage Δ
eth/eip712/encoding.go 80.00% <100.00%> (+2.80%) ⬆️
eth/eip712/encoding_legacy.go 78.78% <100.00%> (+2.31%) ⬆️
eth/rpc/backend/account_info.go 56.25% <100.00%> (+45.53%) ⬆️
eth/rpc/backend/backend.go 85.71% <100.00%> (+10.71%) ⬆️
eth/rpc/backend/chain_info.go 64.36% <100.00%> (+47.87%) ⬆️
eth/rpc/backend/node_info.go 68.29% <100.00%> (+64.03%) ⬆️
eth/rpc/backend/tracing.go 53.14% <100.00%> (ø)
eth/rpc/backend/utils.go 65.75% <100.00%> (+52.73%) ⬆️
eth/rpc/rpcapi/eth_api.go 42.10% <100.00%> (+2.84%) ⬆️
eth/rpc/rpcapi/net_api.go 78.94% <100.00%> (+7.51%) ⬆️
... and 4 more

@onikonychev onikonychev merged commit 5214349 into main Sep 21, 2024
16 checks passed
@onikonychev onikonychev deleted the test/evm-backend-tests branch September 21, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants