pub struct JsonStorageKey(pub B256);
Expand description
A storage key type that can be serialized to and from a hex string up to 32 bytes. Used for
eth_getStorageAt
and eth_getProof
RPCs.
This is a wrapper type meant to mirror geth’s serialization and deserialization behavior for storage keys.
In eth_getStorageAt
, this is used for deserialization of the index
field. Internally, the
index is a B256, but in eth_getStorageAt
requests, its serialization can be up to 32
bytes. To support this, the storage key is deserialized first as a U256, and converted to a
B256 for use internally.
eth_getProof
also takes storage keys up to 32 bytes as input, so the keys
field is
similarly deserialized. However, geth populates the storage proof key
fields in the response
by mirroring the key
field used in the input.
See how storageKey
s (the input) are populated in the StorageResult
(the output):
https://github.com/ethereum/go-ethereum/blob/00a73fbcce3250b87fc4160f3deddc44390848f4/internal/ethapi/api.go#L658-L690
The contained B256 and From implementation for String are used to preserve the input and implement this behavior from geth.
Tuple Fields§
§0: B256
Trait Implementations§
source§impl Clone for JsonStorageKey
impl Clone for JsonStorageKey
source§fn clone(&self) -> JsonStorageKey
fn clone(&self) -> JsonStorageKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for JsonStorageKey
impl Debug for JsonStorageKey
source§impl Default for JsonStorageKey
impl Default for JsonStorageKey
source§fn default() -> JsonStorageKey
fn default() -> JsonStorageKey
source§impl<'de> Deserialize<'de> for JsonStorageKey
impl<'de> Deserialize<'de> for JsonStorageKey
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<FixedBytes<32>> for JsonStorageKey
impl From<FixedBytes<32>> for JsonStorageKey
source§impl From<JsonStorageKey> for String
impl From<JsonStorageKey> for String
source§fn from(value: JsonStorageKey) -> Self
fn from(value: JsonStorageKey) -> Self
source§impl From<Uint<256, 4>> for JsonStorageKey
impl From<Uint<256, 4>> for JsonStorageKey
source§impl PartialEq for JsonStorageKey
impl PartialEq for JsonStorageKey
source§impl Serialize for JsonStorageKey
impl Serialize for JsonStorageKey
impl Copy for JsonStorageKey
impl Eq for JsonStorageKey
impl StructuralPartialEq for JsonStorageKey
Auto Trait Implementations§
impl Freeze for JsonStorageKey
impl RefUnwindSafe for JsonStorageKey
impl Send for JsonStorageKey
impl Sync for JsonStorageKey
impl Unpin for JsonStorageKey
impl UnwindSafe for JsonStorageKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)