From 9b02cb9fe69f651b7d787124e4517151543526cb Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sun, 20 Oct 2024 20:15:29 +0200 Subject: [PATCH] eips: impl From for BlockId --- crates/eips/src/eip1898.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/eips/src/eip1898.rs b/crates/eips/src/eip1898.rs index df61d1edbee..67d675c9428 100644 --- a/crates/eips/src/eip1898.rs +++ b/crates/eips/src/eip1898.rs @@ -397,7 +397,7 @@ impl From for BlockId { fn from(block: HashOrNumber) -> Self { match block { HashOrNumber::Hash(hash) => { - Self::Hash(RpcBlockHash { block_hash: hash, require_canonical: None }) + RpcBlockHash { block_hash: hash, require_canonical: None }.into() } HashOrNumber::Number(num) => Self::Number(BlockNumberOrTag::Number(num)), } @@ -406,13 +406,19 @@ impl From for BlockId { impl From for BlockId { fn from(block_hash: B256) -> Self { - Self::Hash(RpcBlockHash { block_hash, require_canonical: None }) + RpcBlockHash { block_hash, require_canonical: None }.into() } } impl From<(B256, Option)> for BlockId { fn from(hash_can: (B256, Option)) -> Self { - Self::Hash(RpcBlockHash { block_hash: hash_can.0, require_canonical: hash_can.1 }) + RpcBlockHash { block_hash: hash_can.0, require_canonical: hash_can.1 }.into() + } +} + +impl From for BlockId { + fn from(value: RpcBlockHash) -> Self { + Self::Hash(value) } }