Giovanni S | Flow (2024-09-12)
This may be a non-trivial question - can it be taken for granted that Flow addresses are uniformly distributed across the range of possible addresses?
9 Replies
I've created a thread for your message. Please continue any relevant discussion in this thread.
You can rename this thread using
/title <new title>
cc @Ramtin @tarakby
and similarly, can we assume the same for UUID assignments?
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
I see thank your for the info!
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
UUiDs for resources are sequential uint64s, with the caveat that some of the bytes in those uint64 are used for partitions (for future paralell execution).
very roughly that means that in a block with 3 transactions they will generate UUIDs like this:
TX1: 7000...00023, 7000...00024, 7000...00025
TX2: 8000...00047, 8000...00048, 8000...00049
TX3: 9000...00019, 9000...00020, 9000...00021
That is for the global UUIDs used resources.
For Capabilities you have account local UUID indexes which are sequential and start at 0 for each account.
DISCLAIMER!!!!
This is an internal detail of the FVM and no guarantee is given that this logic will stay the same. Do not rely on the fact that UUIDs are generated sequentially, because doing so might mean that that code will break.
@tarakby I think I understand what you mean by your answer, but I'm not certain.
Addresses on flow are an 8 byte number so they range from
0
to 2^64 - 1
.
Lets say I have a function f(a,b,N)
which returns the number of generated addresses on the interval between 0 <= a <= 2^64 - 1
and 0 <= b <= 2^64 - 1
after 0 < N <= 2^45
addresses have been generated in total.
Can I assume that if b-a = d-c
and N
is large that f(a,b,N) ≈ f(c,d,N)
?
I think if that is true, this should also hold right:
(b-a)/(2^64 - 1) ≈ f(a,b,N)/N
Wouldn't that constitute a uniform distribution?Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
So I'm going to change your function to f(a,b) which counts the number of valid Flow addresses between a and b , regardless of whether the address has been generated or not. Then you get back exactly to the notion of equidistribution.hm, I think a bit of information is lost this way.... so going back to
f(a,b,N)
if you look at the first half of the interval after N addresses have been generated f(0, 2^63 - 1, N)
you would expect it to have approximately N/2
addresses. But that is not necessarily true! it could be that the first half of the interval fills up with addresses first.
While the distribution of all addresses might be uniform, the distribution of the first N addresses might not be.Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View