From 8ef991e3ee3857ca7a313cf7d22cfc9f821e1034 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 13 Nov 2024 17:27:54 +0100 Subject: [PATCH] test: add test for 7702 with v --- Cargo.toml | 2 +- crates/rpc-types-eth/src/transaction/mod.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 497fb0edcc9..8151ae78716 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ alloy-chains = { version = "0.1.18", default-features = false } # eips alloy-eip2930 = { version = "0.1.0", default-features = false } -alloy-eip7702 = { version = "0.4", default-features = false } +alloy-eip7702 = { version = "0.4.1", default-features = false } # ethereum ethereum_ssz_derive = "0.8" diff --git a/crates/rpc-types-eth/src/transaction/mod.rs b/crates/rpc-types-eth/src/transaction/mod.rs index a552ad2ac5c..3966aa57ed6 100644 --- a/crates/rpc-types-eth/src/transaction/mod.rs +++ b/crates/rpc-types-eth/src/transaction/mod.rs @@ -418,4 +418,12 @@ mod tests { assert_eq!(legacy_tx.block_number, Some(4)); assert_eq!(legacy_tx.effective_gas_price, Some(0x23237dee)); } + + // + #[test] + fn deserialize_7702_v() { + let raw = r#"{"blockHash":"0xb14eac260f0cb7c3bbf4c9ff56034defa4f566780ed3e44b7a79b6365d02887c","blockNumber":"0xb022","from":"0x6d2d4e1c2326a069f36f5d6337470dc26adb7156","gas":"0xf8ac","gasPrice":"0xe07899f","maxFeePerGas":"0xe0789a0","maxPriorityFeePerGas":"0xe078998","hash":"0xadc3f24d05f05f1065debccb1c4b033eaa35917b69b343d88d9062cdf8ecad83","input":"0x","nonce":"0x1a","to":"0x6d2d4e1c2326a069f36f5d6337470dc26adb7156","transactionIndex":"0x0","value":"0x0","type":"0x4","accessList":[],"chainId":"0x1a5ee289c","authorizationList":[{"chainId":"0x1a5ee289c","address":"0x529f773125642b12a44bd543005650989eceaa2a","nonce":"0x1a","v":"0x0","r":"0x9b3de20cf8bd07f3c5c55c38c920c146f081bc5ab4580d0c87786b256cdab3c2","s":"0x74841956f4832bace3c02aed34b8f0a2812450da3728752edbb5b5e1da04497"}],"v":"0x1","r":"0xb3bf7d6877864913bba04d6f93d98009a5af16ee9c12295cd634962a2346b67c","s":"0x31ca4a874afa964ec7643e58c6b56b35b1bcc7698eb1b5e15e61e78b353bd42d","yParity":"0x1"}"#; + let tx = serde_json::from_str::(raw).unwrap(); + assert!(tx.inner.is_eip7702()); + } }