Skip to content

Update Proposal is not removed after expiry grace period (proposal_expiration) #79

Open
@dkijania

Description

@dkijania

UpdateState::process_proposals has bug in my opinion, which leads to problem in which proposal which was not accepted before proposal_expiration period won't be removed from proposal collection at all.

there are two conditions in mentioned method:

 if prev_date.epoch < new_date.epoch

and

else if proposal_state.proposal_date.epoch + settings.proposal_expiration
                    > new_date.epoch

if we apply proposal in the current epoch (let's say epoch 0 and our proposal_expiration is any value different than 0, then it's impossible to satisfy condition proposal_state.proposal_date.epoch + settings.proposal_expiration < new_date.epoch => 0 + 1 > 1 = false and then new_date.epoch will be increased i believe if we time proceeds, so above condition will be never met and therefore proposal will stay in collection forever).

In different scenario in which we apply proposal for epoch in the future let's say epoch 5 (while we are at epoch 0) then if proposal won't be accepted in epoch 0, then it will be immediately removed from proposals in process_proposals . (5 + 0 > 0 = true)

To fix this situation we need to reverse condition:

else if proposal_state.proposal_date.epoch + settings.proposal_expiration
                    < new_date.epoch

This will solve first scenario in epoch 2 (0+ 1 < 2 = true) and in second scenario proposal won't be removed from proposal before its time will come (5 + 0 < 0 =false )

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions