-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature request for hbbft: random numbers #34
Comments
The |
I'm working at least 50% of this at the moment. =) |
First half is here, I am still testing it though: #36. |
Given that, at least for these contracts, we only use the random numbers once per week, it seems wasteful to include them in every batch. To avoid this, we'd have to slightly change our criterion for calling (In the long term it would be nice to make the randomness available to all smart contracts; but I guess that'll be a bigger, separate issue anyway.) |
@afck Please use the naming |
Please expand the type of random number from |
Should we use 19 instead of 20 validators? Both can tolerate 6 failures, but 6 out of 20 failing is more likely than 6 out of 19 failing, so 19 would actually be more secure, I think. (In general, numbers 3 f + 1 are best suited.) I wonder whether we should even replace instead of remove malicious validators, to always keep the number exactly 19? That would require new random numbers, though, so we'd either have to just always include them, or wait for the next block before computing the new set, after someone has been found guilty. Also, when discussing this issue with @mbr, I kept insisting for some reason that we need 20 (or now 19) "proper" random numbers, even though this could be much more efficient if we just produced one truly random |
Technically there are no barriers to use 19 in the contract.
I think we could start a new epoch in this case, but the epoch in which the malicious validator is removed will be shorter than one week. I'm not sure about that, @igorbarinov what can you say? At the beginning of network's life there can be less than 19 validators, so the network has to work fine with less number of validators.
Anyway, we need to have MAX_VALIDATORS (20 or 19) random numbers in the contract (even when there're less active validators at the moment of numbers generation): https://github.com/poanetwork/pos-contracts/blob/6991d478662ca0e9a597cb3fd6996bf2d7ea9a8a/contracts/ReportingValidatorSet.sol#L346 - please take into account this requirement. |
The |
Parity should generate twenty
32-bit64-bit unsigned integer random numbers uniformly distributed in the range from 0 to0xffffffff0xffffffffffffffff and pass them intoReportingValidatorSet
smart contract calling itsstoreRandom
function. That function looks like the following:The
storeRandom
should be called right before a new validator set is requested (see the issue #33).The text was updated successfully, but these errors were encountered: