-
Notifications
You must be signed in to change notification settings - Fork 157
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
Remove compacting of TxIn. Add Keyed instances for hashes #2530
Conversation
@redxaxder Here is the reason why we need to remove compacted @TimSheard if you are ok with this PR feel free to "Squash and Merge| it, it is opened into your |
277388c
to
1a1496b
Compare
3ed31b6
to
02f85c1
Compare
1a1496b
to
835ce93
Compare
After some experiments we found out that using HashMap that was implemented in #2520 is qyuite a bit more memory efficient then other approaches that involved manual unpacking of
In order for us to be able and use the most efficient from the top of the list, this PR is needed. |
835ce93
to
d7dde93
Compare
d7dde93
to
fa20ff3
Compare
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.
Everything looks reasonable. I have two questions, but they're not really review comments:
- The comment about needing a
Keyed
instance doesn't really motivate the non-unpacking. - Why the change from
Word64
toInt
for the index? Is this motivated by wanting to useIntMap
?
{-# UNPACK #-} !Word64 -> -- Index | ||
TxIn crypto | ||
TxInCompactOther :: !(TxId crypto) -> {-# UNPACK #-} !Word64 -> TxIn crypto | ||
data TxIn crypto = TxInCompact !(TxId crypto) {-# UNPACK #-} !Int |
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.
Why the change to Int
here?
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.
Because we will use it with IntMap
, which needs an Int
, rather than a Word64
. I don't think it would a problem, right? Considering that max value on mainnet is 249 and I don't see tx index going larger than maxBound :: Int
any time in the foreseeable future 😄
Recent ledger changes (IntersectMBO/cardano-ledger#2530) have restricted the range for transaction input indices. Since these are unlikely to be large anyway, restrict the generated range.
Recent ledger changes (IntersectMBO/cardano-ledger#2530) have restricted the range for transaction input indices. Since these are unlikely to be large anyway, restrict the generated range.
Recent ledger changes (IntersectMBO/cardano-ledger#2530) have restricted the range for transaction input indices. Since these are unlikely to be large anyway, restrict the generated range.
Recent ledger changes (IntersectMBO/cardano-ledger#2530) have restricted the range for transaction input indices. Since these are unlikely to be large anyway, restrict the generated range.
Recent ledger changes (IntersectMBO/cardano-ledger#2530) have restricted the range for transaction input indices. Since these are unlikely to be large anyway, restrict the generated range.
Recent ledger changes (IntersectMBO/cardano-ledger#2530) have restricted the range for transaction input indices. Since these are unlikely to be large anyway, restrict the generated range.
This PR requires: IntersectMBO/cardano-base#243