From 08451ef278dfaa8818738d7d67e653833c52f6b7 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 9 Nov 2024 10:05:15 +0100 Subject: [PATCH] chore: rm unused file (#12420) --- .../{transaction/mod.rs => transaction.rs} | 0 .../src/transaction/signature.rs | 52 ------------------- 2 files changed, 52 deletions(-) rename crates/rpc/rpc-types-compat/src/{transaction/mod.rs => transaction.rs} (100%) delete mode 100644 crates/rpc/rpc-types-compat/src/transaction/signature.rs diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction.rs similarity index 100% rename from crates/rpc/rpc-types-compat/src/transaction/mod.rs rename to crates/rpc/rpc-types-compat/src/transaction.rs diff --git a/crates/rpc/rpc-types-compat/src/transaction/signature.rs b/crates/rpc/rpc-types-compat/src/transaction/signature.rs deleted file mode 100644 index 77ae365b2d..0000000000 --- a/crates/rpc/rpc-types-compat/src/transaction/signature.rs +++ /dev/null @@ -1,52 +0,0 @@ -use alloy_primitives::{Signature as PrimitiveSignature, U256}; -use alloy_rpc_types::{Parity, Signature}; -use reth_primitives::{transaction::legacy_parity, TxType}; - -/// Creates a new rpc signature from a legacy [primitive -/// signature](alloy_primitives::Signature), using the give chain id to compute the signature's -/// recovery id. -/// -/// If the chain id is `Some`, the recovery id is computed according to [EIP-155](https://eips.ethereum.org/EIPS/eip-155). -pub fn from_legacy_primitive_signature( - signature: PrimitiveSignature, - chain_id: Option, -) -> Signature { - Signature { - r: signature.r(), - s: signature.s(), - v: U256::from(legacy_parity(&signature, chain_id).to_u64()), - y_parity: None, - } -} - -/// Creates a new rpc signature from a non-legacy [primitive -/// signature](alloy_primitives::Signature). This sets the `v` value to `0` or `1` depending on -/// the signature's `odd_y_parity`. -pub fn from_typed_primitive_signature(signature: PrimitiveSignature) -> Signature { - Signature { - r: signature.r(), - s: signature.s(), - v: U256::from(signature.v().y_parity_byte()), - y_parity: Some(Parity(signature.v().y_parity())), - } -} - -/// Creates a new rpc signature from a legacy [primitive -/// signature](alloy_primitives::Signature). -/// -/// The tx type is used to determine whether or not to use the `chain_id` to compute the -/// signature's recovery id. -/// -/// If the transaction is a legacy transaction, it will use the `chain_id` to compute the -/// signature's recovery id. If the transaction is a typed transaction, it will set the `v` -/// value to `0` or `1` depending on the signature's `odd_y_parity`. -pub fn from_primitive_signature( - signature: PrimitiveSignature, - tx_type: TxType, - chain_id: Option, -) -> Signature { - match tx_type { - TxType::Legacy => from_legacy_primitive_signature(signature, chain_id), - _ => from_typed_primitive_signature(signature), - } -}