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

Range of GenerateRandomGuid is too small #4012

Open
OnedgeLee opened this issue Dec 19, 2024 · 1 comment
Open

Range of GenerateRandomGuid is too small #4012

OnedgeLee opened this issue Dec 19, 2024 · 1 comment

Comments

@OnedgeLee
Copy link
Contributor

OnedgeLee commented Dec 19, 2024

Libplanet offers pseudo-random GUID generator on RandomExtensions, but its range seems quite small for general use.

Above generates GUID, which codomain is 16-bytes, but its range is less than 4-bytes, since its domain is int.

GUID is designed to be have 2^128 diversity, but with current implementation, it can cover only 2^32

With estimation with Birthday Problem
(sqrt(-2 * N * log(1 - probability)) where N = 2^32, probability = 0.5, 0.95),
GUID collision can happen with 50% probability with 77,163 samples,
and 95% probability with 160,416 samples, which is quite easy to happen.

We need to generate GUID with larger domain, for example, result hash of SHA-256.

Belows are some candidates.

  • Proof of VRF (not merged on main branch yet)
  • PreEvaluationHash
  • StateRootHash
  • BlockHash

Seems like better to choose from above two, but since impossitility of manipulation is not so important for GUID feature, won't be matter so much.

@OnedgeLee
Copy link
Contributor Author

Found this issue on Aug 24, but we've not decided any plan for this, and this issue seems to be stale.
For refreshing, open this issue.

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

No branches or pull requests

1 participant