Skip to content

Commit

Permalink
Simplify churn tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball committed Sep 18, 2024
1 parent 2faa0af commit eed92e4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion contracts/staking/ValidatorManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ abstract contract ValidatorManager is
"ValidatorManager: maximum churn rate exceeded"
);

churnTracker.totalWeight += newWeight - oldWeight;
// Two separate calculations because we're using uints and (newWeight - oldWeight) could underflow.
churnTracker.totalWeight += newWeight;
churnTracker.totalWeight -= oldWeight;

$._churnTracker = churnTracker;
}
Expand Down

0 comments on commit eed92e4

Please sign in to comment.