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

change(rc): Update Remote Config condition evaluation hashing #2760

Merged
merged 10 commits into from
Nov 7, 2024
Merged

Conversation

kjelko
Copy link
Contributor

@kjelko kjelko commented Nov 5, 2024

Update remote config condition evaluation hashing

@lahirumaramba lahirumaramba changed the title Update remote config condition evaluation hashing change(rc): Update Remote Config condition evaluation hashing Nov 5, 2024
@lahirumaramba lahirumaramba added release-note release:stage Stage a release candidate labels Nov 5, 2024
Copy link
Member

@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

src/remote-config/condition-evaluator-internal.ts Outdated Show resolved Hide resolved
}

return hash64;
const hex = createHash('sha256').update(seededRandomizationId).digest('hex');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking (no action req'd): we had a 64 bits hash before, so we don't need 256 bits, but sha256 is broadly available and there's no noticeable performance difference, so sha256 is fine.


// Manually negate the hash if its value is less than 0, since Math.abs doesn't
// support BigInt.
if (hash64 < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking (no action req'd): we're now directly instantiating the bigint with the hash, rather than coercing it to behave like a 64bit signed Java long, so it will always be positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:stage Stage a release candidate release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants