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

fix(l1): don't return an error if forkChoiceUpdate contains null PayloadAttributes #1543

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

fmoletta
Copy link
Contributor

Motivation
When we receive a payload with null payload attributes we return an error: Could not parse params invalid type: null, expected struct PayloadAttributesV3, when this is perfectly acceptable behaviour

Description

  • Parse payload attributes as Option<PayloadAttributes> instead of just PayloadAttributes

Closes #issue_number

@fmoletta fmoletta changed the title fix(l1): don't return an error if forkChoiceUpdate contains null PayloadAttributes fix(l1): don't return an error if forkChoiceUpdate contains null PayloadAttributes Dec 19, 2024
@fmoletta fmoletta marked this pull request as ready for review December 19, 2024 20:01
@fmoletta fmoletta requested a review from a team as a code owner December 19, 2024 20:01
match serde_json::from_value::<PayloadAttributesV3>(params[1].clone()) {
Ok(attributes) => Some(attributes),
match serde_json::from_value::<Option<PayloadAttributesV3>>(params[1].clone()) {
Ok(attributes) => attributes,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are having an Option, should you now match to Some?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have three scenarios:
A) We receive a PayloadAttributes Ok(Some(attributes)) -> We return Some(attributes)
B) We receive a null payload attributes Ok(None) -> We return None
C) We receive an invalid PayloadAttributes Err() -> We show an error message and return None
In both A & B we just return whatever is inside the Ok()

@mpaulucci mpaulucci added this pull request to the merge queue Dec 20, 2024
Merged via the queue into main with commit 50e7de0 Dec 20, 2024
15 checks passed
@mpaulucci mpaulucci deleted the dont-fail-on-null-payload branch December 20, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants