openethereum/ethcore
Tomasz Drwięga c8f57315a8 [stable] Missing AuRa backports (#7499)
* Merge pull request #7368 from paritytech/td-future-blocks

Wait for future blocks in AuRa

* Advance AuRa step as far as we can and prevent invalid blocks. (#7451)

* Advance AuRa step as far as we can.

* Wait for future blocks.

* 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).

* Fix tests.

* detect different node, same-key signing in aura (#7245)

* detect different node, same-key signing in aura

* reduce scope of warning
2018-01-08 23:09:11 +01:00
..
benches [beta] Byzantium updates (#6529) 2017-09-16 12:21:35 +02:00
evm [stable] Refactor static context check in CREATE (#6889) 2017-10-25 11:52:32 +02:00
light [beta] Backports (#6563) 2017-09-21 11:42:58 +02:00
native_contracts updated serde to version 1.0 2017-07-06 11:36:15 +02:00
res [stable] backports (#7496) 2018-01-08 16:07:53 +01:00
src [stable] Missing AuRa backports (#7499) 2018-01-08 23:09:11 +01:00
types [beta] Backports (#6563) 2017-09-21 11:42:58 +02:00
build.rs Ethcore crate split part 1 (#6041) 2017-07-12 13:09:17 +02:00
Cargo.toml [beta] Backports (#6497) 2017-09-11 18:01:02 +02:00