From 89c517d7ac108dea00a5070e5e05fa51b6f81b84 Mon Sep 17 00:00:00 2001 From: nxqbao Date: Fri, 10 Mar 2023 14:21:20 +0700 Subject: [PATCH] fix updating 0 length array --- contracts/ronin/validator/CandidateManager.sol | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contracts/ronin/validator/CandidateManager.sol b/contracts/ronin/validator/CandidateManager.sol index 364dfe82b..66afe0115 100644 --- a/contracts/ronin/validator/CandidateManager.sol +++ b/contracts/ronin/validator/CandidateManager.sol @@ -235,10 +235,11 @@ abstract contract CandidateManager is ICandidateManager, PercentageConsumer, Glo } } + assembly { + mstore(_unsatisfiedCandidates, _unsatisfiedCount) + } + if (_unsatisfiedCount > 0) { - assembly { - mstore(_unsatisfiedCandidates, _unsatisfiedCount) - } emit CandidatesRevoked(_unsatisfiedCandidates); _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod); }