{"record":{"id":"3528b5d69107e4d0","repo":"nautechsystems/nautilus_trader","slug":"eth-getstorageat-returned-no-result","errorCode":null,"errorMessage":"eth_getStorageAt returned no result","messagePattern":"eth_getStorageAt returned no result","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":403,"sourceCode":"    /// Returns an error if the RPC call fails or the result is missing or malformed.\n    #[cfg(feature = \"hypersync\")]\n    #[allow(\n        dead_code,\n        reason = \"Used by the independent verification read inventory\"\n    )]\n    pub(crate) async fn get_storage_at(\n        &self,\n        address: &Address,\n        slot: &B256,\n        block: u64,\n    ) -> anyhow::Result<B256> {\n        let result: Option<String> = self\n            .execute_execution_rpc_call(\n                \"eth_getStorageAt\",\n                serde_json::json!([address, slot, block_parameter(Some(block))]),\n            )\n            .await?;\n        let value = result.ok_or_else(|| anyhow::anyhow!(\"eth_getStorageAt returned no result\"))?;\n        B256::from_str(&value)\n            .map_err(|_| anyhow::anyhow!(\"Failed to parse eth_getStorageAt response\"))\n    }\n\n    async fn get_code_with_block(\n        &self,\n        address: &Address,\n        block: Option<u64>,\n    ) -> anyhow::Result<Bytes> {\n        let result: Option<String> = self\n            .execute_execution_rpc_call(\n                \"eth_getCode\",\n                serde_json::json!([address, block_parameter(block)]),\n            )\n            .await?;\n        let hex_string = result.ok_or_else(|| anyhow::anyhow!(\"eth_getCode returned no result\"))?;\n        let stripped = hex_string.strip_prefix(\"0x\").unwrap_or(&hex_string);\n        let bytes = hex::decode(stripped)","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L385-L421","documentation":"`get_storage_at` requires the `eth_getStorageAt` result to be present; the parsed `Option<String>` result being `None` (JSON-RPC success with null result) produces this error. The library treats a null storage slot response as a failure rather than returning a default.","triggerScenarios":"Calling `get_storage_at` for an address/slot where the node returns `result: null` — e.g. a nonexistent contract address, a block before the contract existed, or a non-compliant node omitting the result field.","commonSituations":"Querying storage at a block height before the contract was deployed, querying an EOA address, or a node that returns null instead of the zero value for empty slots.","solutions":["Verify the address is a contract at the queried block (eth_getCode != 0x)","Query at a block height at or after contract deployment","Treat empty slots as B256::ZERO if your node returns null for zero storage","Try a different node implementation that returns 0x000...0 for empty slots"],"exampleFix":"// before: assuming slot always returns a value\nlet value = client.get_storage_at(&addr, slot, Some(block)).await?;\n// after: check contract exists at that block first\nif client.get_code_at(&addr, Some(block)).await?.as_ref().is_empty() {\n    return Ok(B256::ZERO); // no contract -> no storage\n}\nlet value = client.get_storage_at(&addr, slot, Some(block)).await?;","handlingStrategy":"fallback","validationCode":"// ensure the address is a contract with code at the queried block\nlet code = client.get_code_at(&address, Some(block)).await?;\nif code.as_ref().is_empty() { /* no storage to read */ }","typeGuard":null,"tryCatchPattern":"let slot_value = match client.get_storage_at(&addr, slot, Some(block)).await {\n    Ok(v) => v,\n    Err(_) if !has_code => B256::ZERO, // treat missing storage as zero\n    Err(e) => return Err(e),\n};","preventionTips":["Confirm contract deployment block before querying historical storage","Only query storage on addresses with bytecode at the target block","Use nodes that return 0x000...0 instead of null for empty slots","Validate addresses/slots before querying"],"tags":["rpc","storage","null-result","blockchain"],"backgroundTag":"empty-result-set","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}