Skip to content

Commit b3f58fb

Browse files
committed
fix: exluced proxyAdmin when fuzzing
1 parent c852012 commit b3f58fb

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

lib/forge-std

src/contracts/StakingContract.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,6 @@ contract StakingContract {
984984
address _dispatcher
985985
) internal {
986986
bytes32 publicKeyRoot = _getPubKeyRoot(_publicKey);
987-
address withdrawer = _getWithdrawer(publicKeyRoot);
988987
_revertIfSanctioned(msg.sender);
989988
bytes32 feeRecipientSalt = sha256(abi.encodePacked(_prefix, publicKeyRoot));
990989
address implementation = StakingContractStorageLib.getFeeRecipientImplementation();
@@ -1002,7 +1001,7 @@ contract StakingContract {
10021001
}
10031002
}
10041003

1005-
function _revertIfSanctionedOrBlocked(address account) internal {
1004+
function _revertIfSanctionedOrBlocked(address account) internal view {
10061005
address sanctionsOracle = StakingContractStorageLib.getSanctionsOracle();
10071006
if (sanctionsOracle != address(0)) {
10081007
if (ISanctionsOracle(sanctionsOracle).isSanctioned(account)) {
@@ -1014,7 +1013,7 @@ contract StakingContract {
10141013
}
10151014
}
10161015

1017-
function _revertIfSanctioned(address account) internal {
1016+
function _revertIfSanctioned(address account) internal view {
10181017
address sanctionsOracle = StakingContractStorageLib.getSanctionsOracle();
10191018
if (sanctionsOracle != address(0)) {
10201019
if (ISanctionsOracle(sanctionsOracle).isSanctioned(account)) {

src/test/StakingContract.t.sol

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,7 @@ contract StakingContractBehindProxyTest is Test {
20512051

20522052
SanctionsOracle oracle;
20532053

2054+
address internal proxyAdmin = address(42);
20542055
event ExitRequest(address caller, bytes pubkey);
20552056

20562057
function setUp() public {
@@ -2065,17 +2066,17 @@ contract StakingContractBehindProxyTest is Test {
20652066
address cldImpl = address(new ConsensusLayerFeeDispatcher(1));
20662067
address stakingContractImpl = address(new StakingContract());
20672068

2068-
stakingContract = StakingContract(payable(address(new TUPProxy(stakingContractImpl, address(12345), ""))));
2069+
stakingContract = StakingContract(payable(address(new TUPProxy(stakingContractImpl, proxyAdmin, ""))));
20692070

20702071
eld = ExecutionLayerFeeDispatcher(
20712072
payable(
2072-
address(new TUPProxy(eldImpl, address(1), abi.encodeWithSignature("initELD(address)", stakingContract)))
2073+
address(new TUPProxy(eldImpl, proxyAdmin, abi.encodeWithSignature("initELD(address)", stakingContract)))
20732074
)
20742075
);
20752076

20762077
cld = ConsensusLayerFeeDispatcher(
20772078
payable(
2078-
address(new TUPProxy(cldImpl, address(1), abi.encodeWithSignature("initCLD(address)", stakingContract)))
2079+
address(new TUPProxy(cldImpl, proxyAdmin, abi.encodeWithSignature("initCLD(address)", stakingContract)))
20792080
)
20802081
);
20812082

@@ -2178,6 +2179,7 @@ contract StakingContractBehindProxyTest is Test {
21782179
}
21792180

21802181
function test_deposit_withsanctions_senderSanctioned(address user) public {
2182+
vm.assume(user != proxyAdmin);
21812183
oracle.setSanction(user, true);
21822184

21832185
vm.prank(admin);
@@ -2192,6 +2194,8 @@ contract StakingContractBehindProxyTest is Test {
21922194
}
21932195

21942196
function test_deposit_withSanctions_SenderClear(address user) public {
2197+
vm.assume(user != proxyAdmin);
2198+
21952199
vm.prank(admin);
21962200
stakingContract.setSanctionsOracle(address(oracle));
21972201

@@ -2203,6 +2207,8 @@ contract StakingContractBehindProxyTest is Test {
22032207
}
22042208

22052209
function test_deposit_BlockedUser(address user) public {
2210+
vm.assume(user != proxyAdmin);
2211+
22062212
vm.prank(admin);
22072213
stakingContract.blockAccount(user, "");
22082214

0 commit comments

Comments
 (0)