Why the path in Salty Creator does not need a separator #929
Replies: 1 comment
-
The analysis above is incomplete becasue it does analyze the possiblity of multisig > 16 which would require more than one hex digit for the code index The exact code is path = "{}{:x}{:x}".format(stem, ridx, kidx + i) For any given KEL the stem is assumed to unique (the default is the prefix index pidx, which monotonically increases in order of creation of a given identifier prefix for a kel, so we can ignore the stem portion. Basically the addition of each index adds 1 to the kidx which creates a new kidx but the properties of kidx relative to ridx still apply its just that we have multiple effective kidx for any ridx but they are still are strictly monotonic. Still the only way for two concatenated strings to match with ambiguity is if they do not have the same ridx. However just for the sake of completeness, what if there are more than 16 multisig codes at a given event which would mean that the effective kidx for any given ridx could be of two lengths. So in the following analysis I generalize to the case where instead of adding the index to increase the int value of kidx, I concatenate the hex value of the index i. This covers the worst-case scenario where the number of codes is large enough to change the length of the hex str representation of the kidx. Discussion: The This gives us the following properties:
This means that any subsequent Now we have the concatenated string.
Suppose we want to have two strings in the same KEL that are equal and that satsify all 9 properties. lets start with a simple case with the minimum size of 3 hex characters (separators added to show the parts)
Obviously there can only be one since by virtue of strict monotonicity the first two parts Let there be given two potential events So lets se if we can construct any two strings in the sequence for a given KEL that satisfy our constraints and could produce ambiguity. Consider for example:
But since the length of Indeed in general this means the length of So we try
So we try The only possible strings after Proof: |
Beta Was this translation helpful? Give feedback.
-
Why the path in Salty Creator does not need a separator
The two numbers
ridx
andkidx
when converted to hex strings with no zero pre-padding and concatened togther asridx+kidx
where+
represents concatenation have the following properties:Properties
For simplicity we abbreviate for any partition
j
, thatridxj.kidxj
be represented asrj
andkidxj
be represented bykj
. So we haverj.kj
.For all partitions
j
1 .
kj
andrj
are each non zero prepadded hex strings. So there are no interior zeros between the least significant hex digit ofrj
and the most significant hex digit ofkj
2.
kj
starts at 0 and is strictly monotonically increasing by at least 1 but may increase by more than 1.3.
rj
starts at 0 and is strictly montonically increasing by 1 and no more than 1..4. This means that for any pair of
rj
andkj
,kj >= rj
5. and for any two of partitions of the form
(r1, k1)
and(r2, k2)
wherer2 > r1
thenk2>k1
6. any set of two partitions
(r1, k1)
and(r2, k2)
then the length ofr1
<> length ofr2
and the length ofk1
<> length ofk2
otherwise 1 and 2 are the same partition.7. for any set of two partitions
(r1, k1)
and(r2, k2)
where the length ofr1
is greater than the length ofr2
then necessarily the length ofk1
must be less then the length ofk2
but this violates 5 above. QED. It is not possible to have two mutually ambiguous partitions and hence no separator is needed. Thus the code is not a bug. Its a feature because the path length is minimally sufficient in length and therefore follows the KERI design principle of minimally sufficient means.Discussion:
Every new establishment event after the inception must use at least one new key which increments
kidx
by at least one for every increment of 1 ofridx
. If the event is multisig thenkidx
is incremented by the number of sigs less one. The inception event hasridx ==0
. So at inceptionkidx >=0
and thereforekidx >= ridx
even for single sig. And every establishment event incrementskidx
at least by 1 and more if any are multisig.So given the properties above it means that for a path of a given length with separator shown as per the example given for this issue of 1.11 being ambiguous with 11.1 we have
1.11 is possible but
11.1 is impossible so there is no ambiguity when removing the separator.
This is true in general of
2.22 versus 22.2 etc.
To generalize the proof, Suppose us say we have some string of hex digits of any length , such as,
xxxxxx
.The question is for any given hex string made from concatenating two hex strings where neither of the hex strings has zero prepadding are there at least two different ways to partition that concatenated string into two parts where the front part is
ridx
and the back part iskidx
and the integer value of each part satisfies the properties above:The answer is no.
Proof:
Obviously any partition where the length of
ridx
is longer thankidx
violateskidx >= ridx
. So we only need to consider partitions where the length ofridx
<= length ofkidx
.Suppose we have the sequence
x1,x2,x3,x4
where eachxi
is a hex digit from[0-1,a-f]
and given any partition the most significant hex digit or each part must be not be0
.For a length of 4, we have the following two partition choices:
x1.x2x3x4
x1x2.x3x4
So because length of
r1
is less than length ofr2
then we haver2 > r1
but because the length ofk2
is less than the length ofk1
we have necessarily thatk2 < k1
which violates property5
above. Therefore both partitions can not be valid for the same KEL.To generalize, for any string of a given length that satisfies the properties above and given any two partitions of that string, then both partitions cannot satisfy all the properties above because an increase/decrease in the length of a given partition
rj
relative to the other partition commensurately results in a decrease/increase in the length ofkj
relative to the other partition such that property 5 is violated.So NOT a bug and no need to change the code.
Beta Was this translation helpful? Give feedback.
All reactions