Skip to content

Commit

Permalink
Revert "fix: modify vote slash code to avoid reentry"
Browse files Browse the repository at this point in the history
This reverts commit 348fe40.
  • Loading branch information
cosinlink committed Sep 5, 2024
1 parent 348fe40 commit 7d172f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/SlashIndicator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7d172f2

Please sign in to comment.