Skip to content

Commit

Permalink
fix: [spearbit-107] [quantstamp-22] use memory safe revert instead in…
Browse files Browse the repository at this point in the history
… AccountExecutor
  • Loading branch information
fangting-alchemy committed Jan 11, 2024
1 parent 4629e8d commit 10bf294
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/account/AccountExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ abstract contract AccountExecutor {
)
case 0 {
// Bubble up the revert if the call reverts.
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
let m := mload(0x40)
returndatacopy(m, 0x00, returndatasize())
revert(m, returndatasize())
}
default {
// Otherwise, we return the first word of the return data as the validation data
Expand Down
5 changes: 2 additions & 3 deletions test/plugin/session/SessionKeyPluginWithMultiOwner.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ contract SessionKeyPluginWithMultiOwnerTest is Test {
function testFuzz_sessionKey_userOpValidation_invalidSig(uint8 sessionKeysSeed, uint64 signerSeed) public {
_createSessionKeys(sessionKeysSeed);

(address signer, uint256 signerPrivate) =
makeAddrAndKey(string.concat("Signer", vm.toString(uint32(signerSeed))));
(address signer,) = makeAddrAndKey(string.concat("Signer", vm.toString(uint32(signerSeed))));

// The signer should not be a session key of the plugin - this is exceedingly unlikely but checking
// anyways.
Expand Down Expand Up @@ -310,7 +309,7 @@ contract SessionKeyPluginWithMultiOwnerTest is Test {

vm.prank(address(account1));
vm.expectRevert(abi.encodeWithSelector(ISessionKeyPlugin.InvalidSignature.selector, signer));
uint256 result = sessionKeyPlugin.userOpValidationFunction(
sessionKeyPlugin.userOpValidationFunction(
uint8(ISessionKeyPlugin.FunctionId.USER_OP_VALIDATION_SESSION_KEY), userOp, userOpHash
);
}
Expand Down

0 comments on commit 10bf294

Please sign in to comment.