-
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
Finalize filtering in listTransactions
by converting Range UTCTime
to Range SlotId
#595
Conversation
f2a06d7
to
d45dc35
Compare
4aa664c
to
e23c506
Compare
listTransactions
by converting UTCTime
to SlotId
listTransactions
by converting Range UTCTime
to Range SlotId
d45dc35
to
b6c727b
Compare
lib/core/src/Cardano/Wallet.hs
Outdated
@@ -759,10 +759,11 @@ newWalletLayer tracer bp db nw tl = do | |||
ErrListTransactionsStartTimeLaterThanEndTime $ | |||
ErrStartTimeLaterThanEndTime start end | |||
_ -> pure () | |||
let slotIdRange = (error "TODO :: UTCTime -> SlotId") timeRange |
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.
Re
case (mStart, mEnd) of
(Just start, Just end) -> when (start > end) $ throwE $
ErrListTransactionsStartTimeLaterThanEndTime $
ErrStartTimeLaterThanEndTime start end
_ -> pure ()
I considered moving this logic to Primitive.Types
as isValid :: Range a -> Bool
, but then there is no nice way of constructing ErrStartTimeLaterThanEndTime
with pure UTCTime
s.
a99a8c9
to
820b63f
Compare
b6c727b
to
ff73e0a
Compare
We represent slot number in 'SlotId' as 'Word16', so it doesn't make much sense to allow the 'EpochLength' to go far beyond that bound. This might bite us later in rounding and overflowing. So, better keep the epoch length the same size as the slot number
We cannot generate 'SlotId' and 'EpochLength' independently, as this may generate invalid data..
Make sure the guard is triggered before we actually go fetch the wallet in the database.
ff73e0a
to
d0b97b4
Compare
{ startTime :: UTCTime | ||
, endTime :: UTCTime | ||
{ errStartTime :: UTCTime | ||
, errEndTime :: UTCTime |
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.
renamed to avoid name clash.
(SlotLength slotLength) | ||
slotsPerEpoch | ||
slotLength | ||
epochLength |
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.
renamed for consistency in naming with the Primitive.Types module.
@@ -753,17 +756,26 @@ newWalletLayer tracer bp db nw tl = do | |||
-> SortOrder | |||
-> ExceptT ErrListTransactions IO [TransactionInfo] | |||
_listTransactions wid mStart mEnd order = do | |||
guardRange (mStart, mEnd) |
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.
factored out for readability.
@paweljakubas I've picked this over @Anviking and finalized what he started. I think that is now ready to be reviewed and merged. Will remain: adding the |
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.
LGTM
Issue Number
#466
Overview
Previous PR #588 added filtering-support to
DB.readTxHistory
usingRange SlotId
. Here we do the final connecting to allowWalletLayer.listTransactions
filtering byRange UTCTime
.slotAtTime
mirroringslotStartTime
. I've added an unfinished roundtrip test for this.Range UTCTime
toRange SlotId
argumentlistTransactions
(MaybeRange
could be functor or something?)Comments
UTCTime -> SlotId
conversion might not be needed in the future, depending on how we deal with proper slotting and changing epoch/slot-lengths.