-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update execution_engine API to the latest spec
Co-authored-by: weekday <weekday@grandine.io>
- Loading branch information
1 parent
c08cf43
commit 62182e7
Showing
6 changed files
with
271 additions
and
306 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{de::Error as _, ser::Error as _, Deserializer, Serializer}; | ||
use ssz::{SszReadDefault, SszWrite}; | ||
|
||
pub fn deserialize<'de, T: SszReadDefault, D: Deserializer<'de>>( | ||
deserializer: D, | ||
) -> Result<T, D::Error> { | ||
let bytes = serde_utils::prefixed_hex_or_bytes_cow::deserialize(deserializer)?; | ||
T::from_ssz_default(bytes).map_err(D::Error::custom) | ||
} | ||
|
||
pub fn serialize<S: Serializer>(value: impl SszWrite, serializer: S) -> Result<S::Ok, S::Error> { | ||
let bytes = value.to_ssz().map_err(S::Error::custom)?; | ||
serde_utils::prefixed_hex_or_bytes_slice::serialize(bytes, serializer) | ||
} |
Oops, something went wrong.