From 2671cd1cb6432a910a83129be3ab7491fd55a87b Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Tue, 6 Dec 2022 01:02:01 -0500 Subject: [PATCH] chore(primitives): impl serde traits for ForkId (#342) --- crates/primitives/src/forkid.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/primitives/src/forkid.rs b/crates/primitives/src/forkid.rs index 68e6853543..62853d5e5e 100644 --- a/crates/primitives/src/forkid.rs +++ b/crates/primitives/src/forkid.rs @@ -8,6 +8,7 @@ use crate::{BlockNumber, H256}; use crc::crc32; use maplit::btreemap; use reth_rlp::*; +use serde::{Deserialize, Serialize}; use std::{ collections::{BTreeMap, BTreeSet}, ops::{Add, AddAssign}, @@ -25,6 +26,8 @@ use thiserror::Error; RlpEncodableWrapper, RlpDecodableWrapper, RlpMaxEncodedLen, + Serialize, + Deserialize, )] pub struct ForkHash(pub [u8; 4]); @@ -51,7 +54,19 @@ impl Add for ForkHash { /// A fork identifier as defined by EIP-2124. /// Serves as the chain compatibility identifier. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, RlpEncodable, RlpDecodable, RlpMaxEncodedLen)] +#[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + RlpEncodable, + RlpDecodable, + RlpMaxEncodedLen, + Serialize, + Deserialize, +)] pub struct ForkId { /// CRC32 checksum of the all fork blocks from genesis. pub hash: ForkHash,