From 6efa7ca85f41d0f7dc28db1d308667b26557c1e8 Mon Sep 17 00:00:00 2001
From: Dan Cline <6798349+Rjected@users.noreply.github.com>
Date: Sun, 18 Dec 2022 06:40:43 -0500
Subject: [PATCH] fix(core): decode to correctly in Transaction (#1946)
* would not correctly decode a create transaction because 0x80 was not
properly decoded
---
ethers-core/src/types/transaction/eip1559.rs | 2 +-
ethers-core/src/types/transaction/mod.rs | 2 +-
ethers-core/src/types/transaction/request.rs | 2 +-
ethers-core/src/types/transaction/response.rs | 35 ++++++++++++++-----
4 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/ethers-core/src/types/transaction/eip1559.rs b/ethers-core/src/types/transaction/eip1559.rs
index ba080e19..ba937fe6 100644
--- a/ethers-core/src/types/transaction/eip1559.rs
+++ b/ethers-core/src/types/transaction/eip1559.rs
@@ -208,7 +208,7 @@ impl Eip1559TransactionRequest {
*offset += 1;
tx.gas = Some(rlp.val_at(*offset)?);
*offset += 1;
- tx.to = decode_to(rlp, offset)?;
+ tx.to = decode_to(rlp, offset)?.map(NameOrAddress::Address);
tx.value = Some(rlp.val_at(*offset)?);
*offset += 1;
let data = rlp::Rlp::new(rlp.at(*offset)?.as_raw()).data()?;
diff --git a/ethers-core/src/types/transaction/mod.rs b/ethers-core/src/types/transaction/mod.rs
index efe70780..816f4539 100644
--- a/ethers-core/src/types/transaction/mod.rs
+++ b/ethers-core/src/types/transaction/mod.rs
@@ -75,7 +75,7 @@ fn decode_signature(
fn decode_to(
rlp: &rlp::Rlp,
offset: &mut usize,
-) -> Result