Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

fix(core): decode to correctly in Transaction #1946

Merged
merged 1 commit into from
Dec 18, 2022

Conversation

Rjected
Copy link
Contributor

@Rjected Rjected commented Dec 17, 2022

Motivation

Currently Transactions do not decode correctly if they are contract creation transactions. This is when the to field is None, which is encoded in RLP as 0x80.

Solution

Refactor the decode_to method to instead return Result<Option<Address>, DecodeError>, and use it when decoding Transactions, not just transaction requests.

Add a test from #1393 that passes with the changes.

Fixes #1939

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog
  • Breaking changes

 * would not correctly decode a create transaction because 0x80 was not
   properly decoded
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@gakonst gakonst merged commit 6efa7ca into gakonst:master Dec 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ethers_core::types::Transaction fails to decode from RLP when "to" is None
3 participants