fix(solc): skip 0x prefix for deserialize bytes decoding (#671)
This commit is contained in:
parent
991cda3f33
commit
f48fd88a97
|
@ -1223,7 +1223,13 @@ where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let value = String::deserialize(d)?;
|
let value = String::deserialize(d)?;
|
||||||
Ok(hex::decode(&value).map_err(|e| serde::de::Error::custom(e.to_string()))?.into())
|
if let Some(value) = value.strip_prefix("0x") {
|
||||||
|
hex::decode(value)
|
||||||
|
} else {
|
||||||
|
hex::decode(&value)
|
||||||
|
}
|
||||||
|
.map(Into::into)
|
||||||
|
.map_err(|e| serde::de::Error::custom(e.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deserialize_opt_bytes<'de, D>(d: D) -> std::result::Result<Option<Bytes>, D::Error>
|
pub fn deserialize_opt_bytes<'de, D>(d: D) -> std::result::Result<Option<Bytes>, D::Error>
|
||||||
|
|
Loading…
Reference in New Issue