Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OZ][L-03] Unsafe ABI Encoding #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 security@fantom.foundation
*/
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
Loading