-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use u32 for party & candidate numbers #985
Use u32 for party & candidate numbers #985
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #985 +/- ##
=======================================
Coverage 89.76% 89.77%
=======================================
Files 248 248
Lines 12987 12995 +8
Branches 1318 1318
=======================================
+ Hits 11658 11666 +8
Misses 1235 1235
Partials 94 94 ☔ View full report in Codecov by Sentry. |
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, lgtm! What do you think about adding a type alias type PGNumber = u32;
(or similarly named)?
90ce077
90ce077
to
42bfe84
Compare
Good suggestion! I've updated the PR to use type aliases |
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.
Could you run npm run gen:openapi
in the frontend
folder to make sure the openapi.ts
is also updated :)
Thanks for the reminder! Turns out I was missing |
As mentioned in #982, currently there cannot be more than 255 parties in Abacus because a
u8
is used to store the party number. In the OpenAPI specification thepg_number
is listed asint32
, likely because OpenAPI does not have smaller integer types by default. The same thing also holds for the candidate numbers.While it is unlikely there will be more than 255 parties in the Netherlands any time soon, using
u8
's is in my opinion unnecessarily restrictive. The couple of bytes saved by usingu8
s will in many cases remain empty anyways due to memory alignment.