trie -> [blake2b(pubKey): validator]index -> a key-value source [validatorIndex: pubKey]
Main problem of this proposal is that, after the refactoring, when we use the function getSnapshotTo, the validator could not be found from source index.
The main reason is that, trie got updated through getSnapshotTo but not the source of index. We can conclude that, validatorIndex is the data source we should also keep update. It means that, if we need to get access to validators through indices, the indices are always updated and correct.
New Proposal
As a result, I propose to make a small modification on two sources.
Original Problem #1186
Optimize TrieValidatorSet.
Currently, the two main sources are
trie
->[validatorIndex: Validator]
index
-> a key-value source[pubKey: validatorIndex]
Proposal of #1186
trie
->[blake2b(pubKey): validator]
index
-> a key-value source[validatorIndex: pubKey]
Main problem of this proposal is that, after the refactoring, when we use the function getSnapshotTo, the validator could not be found from source
index
.The main reason is that,
trie
got updated throughgetSnapshotTo
but not the source ofindex
. We can conclude that,validatorIndex
is the data source we should also keep update. It means that, if we need to get access to validators through indices, the indices are always updated and correct.New Proposal
As a result, I propose to make a small modification on two sources.
trie
->[validatorIndex: pubKey]
index
->[blake2b(pubKey): validator]
validatorIndex
is always updated; signature aggregation checks where validators are gonna be accessed by their indices can be processed correctly;pubKey
.