From 7d172f2d92f3a7f563ac78f48c201d13de33ed14 Mon Sep 17 00:00:00 2001 From: Ethan Date: Thu, 5 Sep 2024 14:37:14 +0800 Subject: [PATCH] Revert "fix: modify vote slash code to avoid reentry" This reverts commit 348fe4030ca6749af41d852530ed0a5813b3435e. --- contracts/SlashIndicator.sol | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contracts/SlashIndicator.sol b/contracts/SlashIndicator.sol index 62a4ea35..5aa10d53 100644 --- a/contracts/SlashIndicator.sol +++ b/contracts/SlashIndicator.sol @@ -252,19 +252,20 @@ contract SlashIndicator is ISlashIndicator, System, IParamSubscriber, IApplicati "verify signature failed" ); - IStakeHub(STAKE_HUB_ADDR).maliciousVoteSlash(_evidence.voteAddr); - // reward sender and felony validator if validator found + // TODO: after BC-fusion, we don't need to check if validator is living (address[] memory vals, bytes[] memory voteAddrs) = IBSCValidatorSet(VALIDATOR_CONTRACT_ADDR).getLivingValidators(); for (uint256 i; i < voteAddrs.length; ++i) { if (BytesLib.equal(voteAddrs[i], _evidence.voteAddr)) { uint256 amount = (address(SYSTEM_REWARD_ADDR).balance * felonySlashRewardRatio) / 100; - IBSCValidatorSet(VALIDATOR_CONTRACT_ADDR).felony(vals[i]); ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(msg.sender, amount); + IBSCValidatorSet(VALIDATOR_CONTRACT_ADDR).felony(vals[i]); break; } } + + IStakeHub(STAKE_HUB_ADDR).maliciousVoteSlash(_evidence.voteAddr); } function submitDoubleSignEvidence(bytes memory header1, bytes memory header2) public onlyInit {