-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Proptest regressions for inversion of Time serde * Test property that Time's from_value inverts its to_value * Add parse time PBT failure * Use prop_assert! for cleaner results * Test that Time can parse RFC3339 timestamps * Remove spurious test failure * Only generate stamps for valid times And don't test dates before the epoch * Reduce range of input params in Time PBT * Add regression cases * Make timestamp serialization safe Without this change, serde of timestamps would result in a panic if the stamp was before the UNIX epoch. In discussion with @thanethomson, we agreed this opened up a potential attack vector, since a node could be sent messages causing it to crash on deserialization. It also violated the documented contract implied by the `From` trait: > Note: This trait must not fail. If the conversion can fail, use TryFrom. https://doc.rust-lang.org/std/convert/trait.From.html The fix is simply to use `impl From(DateTime<Utc>) for SystemTime` supplied by chrono. * Cleanup and comment * More succinct parameter in safe timestamps test * Clippy fixes
- Loading branch information
Shon Feder
authored
Feb 23, 2021
1 parent
a2596d5
commit 3c7754b
Showing
3 changed files
with
191 additions
and
17 deletions.
There are no files selected for viewing
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,9 @@ | ||
# Seeds for failure cases proptest has generated in the past. It is | ||
# automatically read and these particular cases re-run before any | ||
# novel cases are generated. | ||
# | ||
# It is recommended to check this file in to source control so that | ||
# everyone who runs the test benefits from these saved cases. | ||
cc 7dcafc2d86a88d57fde70fe8b6dfbe9359a4d470b04fcd4bf3a7b0f05c2274a0 # shrinks to time = Time(1970-01-01T00:00:01Z) | ||
cc 9f588cd1ad2e3715e8f3cae1b2e2738bef53f9f75c582e4e9e0f2b887328e6c2 # shrinks to time = Time(2262-04-11T23:47:17Z) | ||
cc 6e17ffd49bafd6f5e8ddabc01784b27eea9c5213235aaca28f78607b1906f819 # shrinks to stamp = "0000-01-01T00:00:00-00:00" |
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