Skip to content

Commit

Permalink
fix(protocol): Fix ProverPool bug, clear proverId when exit (#14411)
Browse files Browse the repository at this point in the history
Co-authored-by: David <[email protected]>
  • Loading branch information
adaki2004 and davidtaikocha authored Aug 9, 2023
1 parent 364b09b commit 8dd7481
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/protocol/contracts/L1/ProverPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -380,19 +380,19 @@ contract ProverPool is EssentialContract, IProverPool {
// by keep rewardPerGas = 1
provers[staker.proverId] = Prover(0, 1, 0);

if (prover.stakedAmount > 0) {
if (
checkExitTimestamp
&& block.timestamp <= staker.exitRequestedAt + MIN_CHANGE_DELAY
) {
revert CHANGE_TOO_FREQUENT();
}

staker.exitAmount += prover.stakedAmount;
staker.exitRequestedAt = uint64(block.timestamp);
staker.proverId = 0;
// Clear data if there is an 'exit' anyway, regardless of
// staked amount.
if (
checkExitTimestamp
&& block.timestamp <= staker.exitRequestedAt + MIN_CHANGE_DELAY
) {
revert CHANGE_TOO_FREQUENT();
}

staker.exitAmount += prover.stakedAmount;
staker.exitRequestedAt = uint64(block.timestamp);
staker.proverId = 0;

emit Exited(addr, staker.exitAmount);
}

Expand Down

0 comments on commit 8dd7481

Please sign in to comment.