Skip to content

Commit

Permalink
Fix unsafe abi encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Dec 13, 2024
1 parent e86e5db commit 6cac3e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions contracts/interfaces/IStakeSubscriber.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.27;

/**
* @title Stake Subscriber Interface
* @notice Used to recount votes from delegators in the governance contract
* @custom:security-contact [email protected]
*/
interface IStakeSubscriber {
function announceStakeChange(address delegator, address validator) external;
}
3 changes: 2 additions & 1 deletion contracts/sfc/SFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {Decimal} from "../common/Decimal.sol";
import {NodeDriverAuth} from "./NodeDriverAuth.sol";
import {ConstantsManager} from "./ConstantsManager.sol";
import {Version} from "../version/Version.sol";
import {IStakeSubscriber} from "../interfaces/IStakeSubscriber.sol";

/**
* @title Special Fee Contract for Sonic network
Expand Down Expand Up @@ -1052,7 +1053,7 @@ contract SFC is OwnableUpgradeable, UUPSUpgradeable, Version {
// Don't allow announceStakeChange to use up all the gas
// solhint-disable-next-line avoid-low-level-calls
(bool success, ) = stakeSubscriberAddress.call{gas: 8000000}(
abi.encodeWithSignature("announceStakeChange(address,address)", delegator, validatorAuth)
abi.encodeCall(IStakeSubscriber.announceStakeChange, (delegator, validatorAuth))
);
// Don't revert if announceStakeChange failed unless strict mode enabled
if (!success && strict) {
Expand Down

0 comments on commit 6cac3e7

Please sign in to comment.