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

fix(evm): removed deprecated root key from eth_getTransactionReceipt #2108

Merged
merged 3 commits into from
Nov 8, 2024

Conversation

onikonychev
Copy link
Contributor

@onikonychev onikonychev commented Nov 8, 2024

Hardhat deploy failed on parsing 0x root value of eth_getTransactionReceipt result.

As soon as we have status value returned - that key is not required, see doc: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt

Summary by CodeRabbit

  • New Features
    • Introduced validation for fun token creation fees.
    • Added validation for WASM multi-message execution.
  • Improvements
    • Enhanced ERC20 metadata usage during FunToken creation.
    • Adjusted gas fee calculations for better efficiency.
    • Improved state consistency in precompile execution.
    • Enhanced gas consumption handling in ERC20 contract execution.
  • Bug Fixes
    • Removed deprecated root key from the eth_getTransactionReceipt method to improve compatibility with Hardhat.
  • Documentation
    • Updated CHANGELOG.md with new entries for unreleased features and fixes.

@onikonychev onikonychev requested a review from a team as a code owner November 8, 2024 10:42
Copy link
Contributor

coderabbitai bot commented Nov 8, 2024

Walkthrough

The changes in this pull request primarily involve updates to the CHANGELOG.md file and modifications to the MarshalJSON method in the eth/rpc/backend/tx_info.go file. The changelog now includes new features, bug fixes, and improvements related to the Nibiru EVM project, such as WASM light clients and ERC20 enhancements. Additionally, the deprecated "root" key has been removed from the JSON output of transaction receipts, improving compatibility with parsing tools.

Changes

File Change Summary
CHANGELOG.md Updated to reflect new features, bug fixes, and improvements, including WASM light clients, ERC20 enhancements, gas fee adjustments, and removal of deprecated keys.
eth/rpc/backend/tx_info.go Modified MarshalJSON method to remove deprecated "root" key from JSON output for compatibility.

Poem

In the land of code where rabbits play,
Changes hop in a joyful array.
With logs of progress, we take our flight,
Removing the root, making things right.
New features bloom, like flowers in spring,
Hopping along, let the updates sing! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 563e5e2 and 1993520.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🔇 Additional comments (1)
CHANGELOG.md (1)

105-105: LGTM! The changelog entry for PR #2108 is well documented.

The entry properly describes the removal of the deprecated root key from eth_getTransactionReceipt, links to the PR, and is correctly categorized as a bug fix. This aligns with the PR objectives of resolving Hardhat parsing issues.


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.

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

🧹 Outside diff range and nitpick comments (2)
CHANGELOG.md (2)

Line range hint 1-24: Consider standardizing version link formatting.

While the changelog follows good practices overall, there are some inconsistencies in how version links are formatted. Some versions use the full GitHub URL format like [v0.19.4](https://github.com/NibiruChain/nibiru/releases/tag/v0.19.4) while others use a simpler format like [v1.0.0]. Consider standardizing to use the full URL format consistently for better accessibility.


Line range hint 25-1200: Consider improving changelog organization for better readability.

A few suggestions to enhance the changelog organization:

  1. Consolidate duplicate entries that appear in multiple categories
  2. Consider grouping all dependency updates into a single section per version
  3. Make entries more concise by focusing on the key changes
  4. Use consistent formatting for PR links throughout

This would make the changelog easier to navigate and understand.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 94db838 and 563e5e2.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • eth/rpc/backend/tx_info.go (1 hunks)
🧰 Additional context used
📓 Learnings (1)
eth/rpc/backend/tx_info.go (1)
Learnt from: onikonychev
PR: NibiruChain/nibiru#2101
File: eth/rpc/backend/tx_info.go:144-170
Timestamp: 2024-10-31T16:39:44.773Z
Learning: In the file `eth/rpc/backend/tx_info.go`, when implementing the `MarshalJSON` method for `TransactionReceipt`, using a custom struct for marshaling instead of an intermediate `map[string]interface{}` does not work.
🔇 Additional comments (2)
eth/rpc/backend/tx_info.go (1)

170-172: LGTM! The change correctly removes the deprecated root key.

The removal of the deprecated "root" key aligns with Ethereum's specification and fixes Hardhat deployment issues. The implementation is correct and well-documented.

Let's verify that the "root" key is not required in other Ethereum JSON-RPC responses:

✅ Verification successful

Removal of deprecated "root" key is correct and safe

The verification confirms that:

  1. The "root" key is only used in transaction receipts, embedded from go-ethereum's core.Receipt
  2. Tests show proper JSON marshaling without any dependency on the "root" field
  3. No other critical usages of receipt root exist in the codebase

The change aligns with Ethereum's post-Byzantium specification and correctly fixes Hardhat compatibility issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if "root" key is used elsewhere in the codebase
# Expected: No other critical usages of the "root" key in Ethereum RPC responses

# Search for "root" usage in JSON struct tags and RPC-related code
rg -g '*.go' '"root"' 

# Search for any remaining references to transaction receipt root
rg -g '*.go' 'receipt.*root|root.*receipt'

Length of output: 616


Script:

#!/bin/bash
# Let's search more specifically for the transaction receipt structure and its usage

# Search for Receipt struct definition and its root field
ast-grep --pattern 'type Receipt struct {
  $$$
  root $_ $_
  $$$
}'

# Search for any references to receipt root in comments or documentation
rg -g '*.go' -i 'receipt.*root|root.*receipt' -A 3 -B 3

# Search for any ethereum receipt related structs and their fields
rg -g '*.go' 'type.*Receipt.*struct' -A 10 -B 1

Length of output: 1692


Script:

#!/bin/bash
# Let's examine the go-ethereum core Receipt structure that we're embedding

# Search for any imports of go-ethereum/core to understand the embedded Receipt
rg -g '*.go' 'gethcore "github.com/ethereum/go-ethereum/core"' -A 5 -B 5

# Look for any other references to Receipt root in the codebase
rg -g '*.go' 'Receipt.*root|root.*Receipt' -A 3 -B 3

# Check for any tests related to transaction receipts
rg -g '*_test.go' 'TransactionReceipt|Receipt.*MarshalJSON' -A 5 -B 5

Length of output: 5638

CHANGELOG.md (1)

103-103: LGTM! Changelog entry follows guidelines and accurately describes the change.

The changelog entry properly documents the removal of the deprecated root key from eth_getTransactionReceipt, which aligns with the PR objectives to fix Hardhat deployment issues. The entry follows the proper format with PR link and concise description.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.66%. Comparing base (8907a61) to head (1993520).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2108   +/-   ##
=======================================
  Coverage   64.66%   64.66%           
=======================================
  Files         273      273           
  Lines       21598    21600    +2     
=======================================
+ Hits        13966    13968    +2     
  Misses       6655     6655           
  Partials      977      977           
Files with missing lines Coverage Δ
eth/rpc/backend/tx_info.go 46.22% <100.00%> (+0.32%) ⬆️

@onikonychev onikonychev enabled auto-merge (squash) November 8, 2024 15:48
@onikonychev onikonychev merged commit 6ec8200 into main Nov 8, 2024
14 checks passed
@onikonychev onikonychev deleted the fix/tx_receipt branch November 8, 2024 15:58
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