ui: Use BigInt to represent 64 bit addresses#1932
ui: Use BigInt to represent 64 bit addresses#1932javierhonduco merged 1 commit intoparca-dev:mainfrom
Conversation
This is necessary as the maximum number that JS can represent is 2^53 [0]. And show the addresses in the popover in hexadecimal. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt - [0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>
|
cc @manojVivek @yomete I think there was an option in protobuf-ts to use BigInt by default to represent integers? I suppose we should do that? |
Yeah looks like we can configure it and the default is |
|
Looks like we explicitly configure to not do that though Line 25 in 2b67154 |
|
Looks like I introduced that, if I recall correctly that was because that was how the previous protobuf library was doing it and it allowed me to do less work. We should probably change that. |
brancz
left a comment
There was a problem hiding this comment.
I do think we should switch the protobuf default, but better to merge this fix now and worry about the larger fix as a follow-up in the future. As far as I'm aware this should also be the only place where we care about this, so we might not need to do anything as a follow up, it just seems like the better thing to do long term.
|
Happy to either merge this PR as a quick fix, or close it if implementing the direct deserialisation of these values as BigInt isn't too hard 😄 |
|
We raced 😄 , let's merge this change and we can re-evaluate later on! |
Yup, I was reviewing that when I enabled TS strict mode, some browsers (Safari iirc) did not support it, but from the MDN link support looks good in recent versions FYI I also mention it here: #1664 (comment) It seems to me the cleanest way would to migrate from timostamm/protobuf-ts to bufbuild/protobuf-es. Maybe this can be extracted from the connect-web PR https://github.com/bufbuild/protobuf-es/blob/main/docs/migrating.md |
This is necessary as the maximum number that JS can represent is 2^53 [0].And show the addresses in the popover in hexadecimal.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
Test plan
Signed-off-by: Francisco Javier Honduvilla Coto javierhonduco@gmail.com