openethereum/json/src
Yurii Rashkovskii d5b81ead71 Problem: AuRa's unsafeties around step duration (#7282)
Firstly, `Step.duration_remaining` casts it to u32, unnecesarily
limiting it to 2^32. While theoretically this is "good enough" (at 3
seconds steps it provides room for a little over 400 years), it is
still a lossy way to calculate the remaining time until the next step.

Secondly, step duration might be zero, triggering division by zero
in `Step.calibrate`

Solution: rework the code around the fact that duration is
typically in single digits and never grows, hence, it can be represented
by a much narrower range (u16) and this highlights the fact that
multiplying u64 by u16 will only result in an overflow in even further
future, at which point we should panic informatively (if anybody's
still around)

Similarly, panic when it is detected that incrementing the step
counter wrapped around on the overflow of usize.

As for the division by zero, prevent it by making zero an invalid
value for step duration. This will make AuRa log the constraint
mismatch and panic (after all, what purpose would zero step duration
serve? it makes no sense within the definition of the protocol,
as finality can only be achieved as per the specification
if messages are received within the step duration, which would violate
the speed of light and other physical laws in this case).
2017-12-21 14:59:09 +01:00
..
blockchain Byzantium updates (#5855) 2017-09-15 21:07:54 +02:00
misc Proper default accounts RPCs (#4580) 2017-02-20 16:33:12 +01:00
spec Problem: AuRa's unsafeties around step duration (#7282) 2017-12-21 14:59:09 +01:00
state Byzantium updates (#5855) 2017-09-15 21:07:54 +02:00
test Difficulty tests 2017-10-10 14:51:12 +02:00
transaction Fix whitespace (#4299) 2017-01-25 18:51:41 +01:00
trie updated serde to version 1.0 2017-07-06 11:36:15 +02:00
vm Revert "Sync parity-ewf with parity" 2017-10-24 13:31:58 +01:00
bytes.rs updated serde to version 1.0 2017-07-06 11:36:15 +02:00
hash.rs Move more params to the common section. (#6134) 2017-07-31 12:34:29 +02:00
lib.rs Difficulty tests 2017-10-10 14:51:12 +02:00
maybe.rs Move more params to the common section. (#6134) 2017-07-31 12:34:29 +02:00
uint.rs Move more params to the common section. (#6134) 2017-07-31 12:34:29 +02:00