-
Notifications
You must be signed in to change notification settings - Fork 633
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
Height
and Time
derive Deserialize
without checks
#2559
Comments
Ouch. I think these De/serialize implementations are really weird and we shouldn't have released them. For the two And for In other words everything just passes through to the "real" type that's part of a transaction. |
Other options are:
|
Currently we are deriving the serde traits for the `absolute::{Height, Time}` types, this is incorrect because we maintain an invariant on the inner `u32` of both types that it is above or below the threshold. Manually implement the serde traits and pass the deserialized `u32` to `from_consensus` to maintain the invariant. Close: rust-bitcoin#2559
Flagging that, as mentioned above, this issue should only relate to |
OK, I suggest |
Yeah, that seems reasonable to me, if a little inconsistent between the two locktime types. My preference would be to either to |
Oh, I now realized why. It's a good question which is better. |
I don't understand this statement, I changed the issue description to be only about IMO the serde stuff for both |
Currently we are deriving the serde traits for the `absolute::{Height, Time}` types, this is incorrect because we maintain an invariant on the inner `u32` of both types that it is above or below the threshold. Manually implement the serde traits and pass the deserialized `u32` to `from_consensus` to maintain the invariant. Close: rust-bitcoin#2559
Could be considered as part of #2612 |
911f8cb fix: Manually implement serde traits (Tobin C. Harding) Pull request description: Currently we are deriving the serde traits for the `absolute::{Height, Time}` types, this is incorrect because we maintain an invariant on the inner `u32` of both types that it is above or below the threshold. Manually implement the serde traits and pass the deserialized `u32` to `from_consensus` to maintain the invariant. Close: #2559 ACKs for top commit: apoelstra: ACK 911f8cb sanket1729: ACK 911f8cb. Tree-SHA512: 28f9f3e23b2016e00216e5e94f35e22a5bfa6b29e1dd30fa3351575eafc2e47dbd98aa8e51631de2f09eec8d881b0e5e79231185c7a293c1ba0170a90fbbd19d
This is obviously wrong and would be great to fix for next release. It's also a backport candidate.
The text was updated successfully, but these errors were encountered: