[go: nahoru, domu]

Skip to content
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 Remote Config dependency on Long JS #2614

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

erikeldridge
Copy link
Contributor
@erikeldridge erikeldridge commented Jun 26, 2024

Discussion

The conditional logic used by the Remote Config config fetch endpoint hashes randomization IDs into 64 bit numbers (via an algorithm called Farmhash). JS numbers are limited to 53 bits, so we used the long.js package to emulate the fetch endpoint logic in the Admin SDK.

#2603 migrated the Admin SDK to use a Farmhash library that produces BigInt, which supports 64 bit numbers natively, so we can remove the long.js dependency. Additionally, the SDK currently converts the BigInt to a string before converting the string to a longjs object, which is clunky.

Testing

Farmhash produces an unsigned 64 bit number, which we convert to a signed number. Longjs does this by default. For BigInt, we need to do this explicitly via BigInt.asIntN(64, unsignedNumber). I've extracted the hashing logic to a method we can test explicitly.

API Changes

None

@erikeldridge erikeldridge self-assigned this Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants