leapdao / leap-node

LeapDAO validation node
https://docs.leapdao.org
Mozilla Public License 2.0
15 stars 11 forks source link

preserve pending periods in between restarts #359

Closed troggy closed 4 years ago

troggy commented 4 years ago

Bounty

leap-node keeps track of the current period object: new one is created every 32 blocks and filled with mined plasma blocks. When it is time to create a new period, we save the current one into bridgeState.previousPeriod so that later we can check if it is landed on the root chain or not. We do this check in a period handler aka checkBridge. If the check fails, we stop the consensus engine until the period is on the root chain.

The problem is that bridgeState.previousPeriod is created only in a block handler. If we restart the node, bridgeState.previousPeriod will be lost as block handler for that particular height won't be executed anymore (unless we rollback the local data or resync the chain). No previousPeriod — no ability to check if it is landed on the root chain. Essentially, in this situation period handler will just skip the check with ok and we lost the period.

Scope

Deliverables

Gain for the project

reliable node restarts, no lost submissions

Publicly visible delivery

Roles

bounty gardener: @troggy / 70 DAI bounty worker: @troggy / share bounty reviewer: name / share

Funded by

Dev Circle

troggy commented 4 years ago

upsizing to M

johannbarbie commented 4 years ago

what if a node starts a lot later, when the preserved period has no relevance any more. is that case covered?

troggy commented 4 years ago

has no relevance any more

how is that? If it wasn't submitted, it is still relevant, no? If it was submitted by someone else it will be handled during event replay (see Submission handler in bridgeState)

johannbarbie commented 4 years ago

it will be handled during event replay (see Submission handler in bridgeState)

that is what i wanted to know :)