diff --git a/crates/rpc/rpc-types/src/eth/state.rs b/crates/rpc/rpc-types/src/eth/state.rs index 35b6b87648de..38e971083a5e 100644 --- a/crates/rpc/rpc-types/src/eth/state.rs +++ b/crates/rpc/rpc-types/src/eth/state.rs @@ -30,3 +30,22 @@ pub struct AccountOverride { #[serde(default, skip_serializing_if = "Option::is_none")] pub state_diff: Option>, } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_state_override() { + let s = r#"{ + "0x0000000000000000000000000000000000000124": { + "code": "0x6080604052348015600e575f80fd5b50600436106026575f3560e01c80632096525514602a575b5f80fd5b60306044565b604051901515815260200160405180910390f35b5f604e600242605e565b5f0360595750600190565b505f90565b5f82607757634e487b7160e01b5f52601260045260245ffd5b50069056fea2646970667358221220287f77a4262e88659e3fb402138d2ee6a7ff9ba86bae487a95aa28156367d09c64736f6c63430008140033" + } + }"#; + let state_override: StateOverride = serde_json::from_str(s).unwrap(); + let acc = state_override + .get(&"0x0000000000000000000000000000000000000124".parse().unwrap()) + .unwrap(); + assert!(acc.code.is_some()); + } +}