hyperledger-labs / SmartBFT

Implementation of the SmartBFT consensus library (https://arxiv.org/abs/2107.06922)
Apache License 2.0
98 stars 27 forks source link

fix two twice delivery on sync #560

Closed pfi79 closed 1 year ago

pfi79 commented 1 year ago

Proposal delivery can come from 2 goroutines: Controller and ViewChanger. 4 places:

Goroutines are fairly independent. It is required to ensure that delivery is not at the same time and that there is no twice delivery. To prevent at the same time delivery, all deliveries are performed from under the syncLock mutex. To prevent twice delivery, the Checkpoint parameter is implemented. Before delivery, the code reads Checkpoint and decides if the proposal should be delivered. After delivery, the code must set a new value in Checkpoint. Without this, double delivery is possible.

Found the last place where proposals can be delivered and Checkpoint is not set. This pull request fixes this error.

C0rWin commented 1 year ago

Can you please provide a unit-test which clearly demonstrates the issue you are addressing in the commit?

pfi79 commented 1 year ago

Can you please provide a unit-test which clearly demonstrates the issue you are addressing in the commit?

So far I have not been able to create a test in which this error always appears. But I will add the test.log of the test in which this error occurred

pfi79 commented 1 year ago

Can you please provide a unit-test which clearly demonstrates the issue you are addressing in the commit?

I added a test.