parallelchain-io / hotstuff_rs

Rust implementation of the HotStuff consensus algorithm.
34 stars 4 forks source link

`pending_validator_set_updates` never returns None and can panic #15

Closed karolinagrzeszkiewicz closed 8 months ago

karolinagrzeszkiewicz commented 9 months ago

pending_validator_set_updates should return None when the deserialized ValidatorSetUpdates turns out to be empty, or the deserializing fails: https://github.com/parallelchain-io/hotstuff_rs/blob/master/src/state.rs#L918

karolinagrzeszkiewicz commented 8 months ago

Edit: this has been falsely labelled as an issue. pending_validator_set_updates indeed breaks and returns None when self.get(...) fails: &mut &*self.get(&combine(&PENDING_VALIDATOR_SET_UPDATES, block))?. It also correctly throws an error if deserializing fails, since if getting the bytes from the key-value store succeeds, deserializing should also succeed.