-
Notifications
You must be signed in to change notification settings - Fork 245
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: correctly process chainId field #370
Conversation
let serialized = serde_json::to_string(&transaction).unwrap(); | ||
assert_eq!( | ||
serialized, | ||
r#"{"hash":"0x0000000000000000000000000000000000000000000000000000000000000001","nonce":"0x2","blockHash":null,"blockNumber":null,"transactionIndex":null,"from":"0x0000000000000000000000000000000000000006","to":null,"value":"0x8","gas":"0xa","input":"0x0b0c0d"}"# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this fixture from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's just a fixture from the test above with all options set to None, the idea was to test that we can handle any of the optional fields missing
I can change it to a valid legacy tx payload so we avoid unexpected test failures when modifying Transaction
in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pedantic style nit, otherwise lgtm
#[serde(default)] | ||
#[serde(with = "alloy_serde::u64_hex_opt")] | ||
#[serde(skip_serializing_if = "Option::is_none")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we collapse them into a single serde attribute?
the skip is also fine because this field should be ignored
Motivation
WIthout
serde(default)
legacy transactions without chainId field can't be deserialized right nowSolution
PR Checklist