-
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
Create TxIx
that is backed by Word16
instead of an Int
#2637
Conversation
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!
@@ -17,7 +17,7 @@ transaction = | |||
, auxiliary_data / null | |||
] | |||
|
|||
transaction_index = uint | |||
transaction_index = uint .size 2 |
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.
cc @rooooooooob
66b09e6
to
981a04d
Compare
981a04d
to
da067ce
Compare
da067ce
to
d0130fd
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.
Left some very minor comments, otherwise this looks great!
. C.newStakeCred Cast.aliceSHK (Ptr (SlotNo 10) 0 0) | ||
. C.newStakeCred Cast.bobSHK (Ptr (SlotNo 10) 0 1) | ||
. C.newStakeCred Cast.carlSHK (Ptr (SlotNo 10) 0 2) | ||
. C.newStakeCred Cast.aliceSHK (Ptr (SlotNo 10) minBound (mkCertIxPartial 0)) |
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.
The inconsistent use of minBound
vs mkCertIxPartial 0
niggles at me, but is really irrelevant :-D
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.
lol. 😄 I had the same thought when I was writing it, but decided to force myself to ignore it as irrelevant.
deriving (Show, Eq, Ord, Generic, NFData, NoThunks) | ||
deriving (ToCBOR, FromCBOR) via CBORGroup Ptr | ||
|
||
-- | With this pattern synonym we assume that SlotNo increment rate isn't going | ||
-- to speed up in the near future because with current rate we should be fine | ||
-- for a few hundred years. |
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.
I might be inclined to expand upon this (how you're packing the slot and indices into a Word64, thus leaving only Word32 space for the slot)
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.
Very good suggestion. I expended on the compacting logic
Still LGTM! |
d0130fd
to
8bacafd
Compare
8bacafd
to
92c338c
Compare
Majority of the changes in this PR are to test suites, but the juice of it is in the
Cardano.Ledger.Credentials
module:TxIx
for type safety and memory optimizationCertIx
for type safety and memory optimizationPtr
into aWord64
, since we can assume thatSlotNo
isn't going to reach2^32 - 1
value any time soon and other members ofPtr
were switched toWord16
in the steps above.Left notes for future generations about the limits, hopefully they won't miss them.