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

Receipts for deployments with COAs have both contractAddress and to fields present #535

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

m-Peter
Copy link
Collaborator

@m-Peter m-Peter commented Sep 9, 2024

Description

When the contractAddress field is present, the to field should be absent, as per the JSON-RPC API specification for transaction receipts.


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Summary by CodeRabbit

  • New Features

    • Enhanced handling of contract deployment transactions to ensure the to address is set to nil for contract creation.
  • Bug Fixes

    • Improved validation in transaction receipt tests to ensure accurate assertions based on transaction context, enhancing overall test robustness.

@m-Peter m-Peter added this to the Flow-EVM-M2 milestone Sep 9, 2024
@m-Peter m-Peter self-assigned this Sep 9, 2024

This comment was marked as outdated.

@m-Peter m-Peter changed the title Receipts for deployments with COAs have contractAddress and to fields present Receipts for deployments with COAs have both contractAddress and to fields present Sep 9, 2024
@m-Peter m-Peter added Bugfix and removed Improvement labels Sep 9, 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: 1

Outside diff range, codebase verification and nitpick comments (1)
tests/web3js/eth_non_interactive_test.js (1)

65-75: Enhanced test case for transaction receipt validation.

The added assertions in the get block test case correctly validate the transaction receipt based on the transaction context. This enhancement ensures that the receipt fields are accurately checked for both contract deployments and standard transactions.

Consider adding more detailed comments in the test to explain the rationale behind these assertions, which will improve the maintainability and readability of the test code.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 88c3830 and b06e297.

Files selected for processing (2)
  • models/transaction.go (1 hunks)
  • tests/web3js/eth_non_interactive_test.js (1 hunks)

Comment on lines +72 to +76
// for contract deployments, `to` should always be `nil`
if dc.SubType == types.DeployCallSubType {
return nil
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct implementation for contract deployments.

The added logic in the To() method correctly handles contract deployments by setting the to address to nil when the SubType is DeployCallSubType. This change ensures compliance with the JSON-RPC API specifications for transaction receipts.

Consider adding a unit test to verify that the to field is set to nil for deployment transactions. Would you like me to help with this?

@sideninja sideninja merged commit 452d42a into main Sep 10, 2024
2 checks passed
@m-Peter m-Peter deleted the fix-coa-deployment-receipts branch September 10, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants