Skip to content

Commit

Permalink
test: add updateFallbackSignerData test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypaik committed Nov 26, 2024
1 parent 9c1ccda commit 5624f04
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/account/GlobalValidationTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/Messa

import {ModularAccount} from "../../src/account/ModularAccount.sol";
import {ModularAccountBase} from "../../src/account/ModularAccountBase.sol";
import {SemiModularAccountBase} from "../../src/account/SemiModularAccountBase.sol";
import {SemiModularAccountBytecode} from "../../src/account/SemiModularAccountBytecode.sol";

import {AccountTestBase} from "../utils/AccountTestBase.sol";

Expand Down Expand Up @@ -93,6 +95,26 @@ contract GlobalValidationTest is AccountTestBase {
assertEq(ethRecipient.balance, 2 wei);
}

function test_globalValidation_runtime_updateFallbackSignerData() public withSMATest {
if (_isSMATest) {
SemiModularAccountBytecode sma1 = SemiModularAccountBytecode(payable(address(account1)));
(address fallbackSigner, bool isDisabled) = sma1.getFallbackSignerData();
assertEq(fallbackSigner, owner1);
assertEq(isDisabled, false);

// Update the fallback signer
vm.prank(owner1);
account1.executeWithRuntimeValidation(
abi.encodeCall(SemiModularAccountBase.updateFallbackSignerData, (owner2, false)),
_encodeSignature(_signerValidation, GLOBAL_VALIDATION, "")
);

(fallbackSigner, isDisabled) = sma1.getFallbackSignerData();
assertEq(fallbackSigner, owner2);
assertEq(isDisabled, false);
}
}

function test_globalValidation_failsOnSelectorApplicability() public withSMATest {
PackedUserOperation memory userOp = PackedUserOperation({
sender: address(account2),
Expand Down

0 comments on commit 5624f04

Please sign in to comment.