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

Reduce bytes / hex conversions of content keys #628

Merged
merged 7 commits into from
Sep 20, 2024

Conversation

ScottyPoi
Copy link
Collaborator

Issue:

Excessive need to use hexToBytes and bytesToHex conversion methods on contentKey, contentId, blockHash, and more.

Cause:

Inconsistent design of functions. Some functions expected keys to be strings, others expected Uint8Arrays.

Solution:

Internally, contentKeys should always be Uint8Array, with the only conversion to and from strings happening in the DB manager.

contentId should always be an unprefixed hex string, matching the type of enr.nodeId, and the expected input of the imported distance function distance(nodeId, contentId)

Copy link
Collaborator

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

LGTM - I salute your attention to details

@acolytec3 acolytec3 merged commit 2eb82e9 into master Sep 20, 2024
4 checks passed
@acolytec3 acolytec3 deleted the conversion-reduction branch September 20, 2024 01:26
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.

2 participants