Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] custom deserde impl for executionpayload #2015

Closed
siosw opened this issue Feb 6, 2025 · 1 comment
Closed

[Feature] custom deserde impl for executionpayload #2015

siosw opened this issue Feb 6, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@siosw
Copy link
Contributor

siosw commented Feb 6, 2025

Component

rpc

Describe the feature you would like

as described in #2004

/// An execution payload, which can be either [ExecutionPayloadV1], [ExecutionPayloadV2], or
/// [ExecutionPayloadV3].
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
pub enum ExecutionPayload {

right now if we have a ExecutionPayloadV3 json, we can still do:
let payload: ExecutionPayloadV2 = serde_json::from_str(json).unwrap();

and extra fields just implicitly get ignored. but obv you can no longer roundtrip then.

Originally posted by @siosw in #2004

a custom deserde impl could enforce that executionpayload can only be deserialized into the correct version

Additional context

@mattsse i think i have a PR that fixes this but it adds a lot of boilerplate, maybe there is a better way to do it

@siosw siosw added the enhancement New feature or request label Feb 6, 2025
@siosw
Copy link
Contributor Author

siosw commented Feb 9, 2025

closed by #2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant