-
Notifications
You must be signed in to change notification settings - Fork 213
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 range boundary filtering for listTransactions
.
#613
Fix range boundary filtering for listTransactions
.
#613
Conversation
1357d90
to
4135162
Compare
Ranges tested: * Small ranges that marginally cover a transaction. * Ranges with end times that are marginally earlier than the transaction. * Ranges with start times that are marginally later than the transaction.
a602836
to
e141a93
Compare
listTransactions
.listTransactions
.
This calculation should add an offset of `slotLength − 1 picosecond`, rather than `slotLength − 1 second`, since `UTCTime` time values have picosecond resolution. The `Enum` instance for `NominalDiffTime` converts to and from an integer number of picoseconds, so we can use the `pred` function to subtract a picosecond from `slotLength`.
e141a93
to
c4c16bd
Compare
I am/was working on a similar range suite as part of #608 but with a precision of 1 second (as I thought this is the least we're operating at, since API is returning results with a precision up to the second as well). In any case - lgtm! (when it comes to test scenarios) |
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.
👍
Thanks for looking at this. Feel free to change anything that I've done to fit in better with your framework!
I thought about this a bit over the weekend. One issue with using seconds-based precision is that the Of course, we could change I suspect it's just easier to allow any valid ISO 8601 date+time values, as we currently do. Luckily, it's easy to increment or decrement values of % a = fromJust $ utcTimeFromText iso8601 "2000-01-01T00:00:00Z"
% a
2000-01-01 00:00:00 UTC
% addUTCTime (succ 0) a
2000-01-01 00:00:00.000000000001 UTC
% addUTCTime (pred 0) a
1999-12-31 23:59:59.999999999999 UTC |
Issue Number
#466
Overview
After adding some API tests to verify that
listTransactions
handles range boundaries correctly, I found that the function can sometimes return transactions that fall outside of the time range specified.To fix this, I adjusted the
recenter
function to use the correct offset ofslotLength − 1 picosecond
, rather thanslotLength − 1 second
, sinceUTCTime
values are of picosecond resolution.The
Enum
instance fornominalDiffTime
converts to and from an integer number of picoseconds, so we can use thepred
function to subtract a single picosecond fromslotLength
.Ranges tested by tests in this PR:
listTransactions
.