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: eth: handle unresolvable addresses #11433

Merged
merged 2 commits into from
Nov 29, 2023
Merged

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Nov 20, 2023

Related Issues

Part of #11355.

Proposed Changes

Correctly handle "unresolvable" to/from addresses in top-level messages in the Ethereum API. Specifically:

  1. Fail if we can't resolve the from address. As far as I can tell, this should be impossible (the message statically couldn't have been included in the block if the sender didn't exist).
  2. If we can't resolve the "to" address to an ID, use "max uint64" as the ID (0xff0000000000000000000000ffffffffffffffff). This will only happen if the transaction was reverted. It'll be a little confusing, but the alternative is to (a) use an empty address (will look like a contract creation, which is definitely wrong) or (b) use a random/hashed address which will likely be more confusing as it won't be "obviously weird".

Additional Info

  • I haven't touched the tracing API yet.
  • I also refactored the tests as the single "native eth txn" test was rather long.

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@Stebalien Stebalien requested a review from a team as a code owner November 20, 2023 23:37
Copy link
Contributor

@fridrik01 fridrik01 left a comment

Choose a reason for hiding this comment

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

LGTM

node/impl/full/eth_utils.go Outdated Show resolved Hide resolved
Co-authored-by: Friðrik Ásmundsson <fridrik01@gmail.com>
@Stebalien Stebalien enabled auto-merge (squash) November 29, 2023 12:03
@Stebalien Stebalien merged commit a34cc5e into master Nov 29, 2023
80 of 87 checks passed
@Stebalien Stebalien deleted the steb/fix-address-translation branch November 29, 2023 12:12
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.

None yet

2 participants