Skip to content

Commit 8c27d9b

Browse files
committed
feat: support for entrypoint v0.9
1 parent 59d744d commit 8c27d9b

File tree

6 files changed

+46
-34
lines changed

6 files changed

+46
-34
lines changed

foundry.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"lib/account-abstraction": {
33
"branch": {
4-
"name": "releases/v0.8",
5-
"rev": "4cbc06072cdc19fd60f285c5997f4f7f57a588de"
4+
"name": "releases/v0.9",
5+
"rev": "b36a1ed52ae00da6f8a4c8d50181e2877e4fa410"
66
}
77
},
88
"lib/forge-std": {

lib/account-abstraction

Submodule account-abstraction updated 70 files

test/LightAccount.t.sol

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ contract LightAccountTest is Test {
6161
);
6262
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
6363
ops[0] = op;
64-
entryPoint.handleOps(ops, BENEFICIARY);
64+
_handleOps(ops);
6565
assertTrue(lightSwitch.on());
6666
}
6767

@@ -74,7 +74,7 @@ contract LightAccountTest is Test {
7474
abi.encodePacked(BaseLightAccount.SignatureType.CONTRACT, contractOwner.sign(entryPoint.getUserOpHash(op)));
7575
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
7676
ops[0] = op;
77-
entryPoint.handleOps(ops, BENEFICIARY);
77+
_handleOps(ops);
7878
assertTrue(lightSwitch.on());
7979
}
8080

@@ -86,7 +86,7 @@ contract LightAccountTest is Test {
8686
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
8787
ops[0] = op;
8888
vm.expectRevert(abi.encodeWithSelector(IEntryPoint.FailedOp.selector, 0, "AA24 signature error"));
89-
entryPoint.handleOps(ops, BENEFICIARY);
89+
_handleOps(ops);
9090
}
9191

9292
function testFuzz_rejectsUserOpsWithInvalidSignatureType(uint8 signatureType) public {
@@ -106,7 +106,7 @@ contract LightAccountTest is Test {
106106
abi.encodePacked(BaseLightAccount.InvalidSignatureType.selector)
107107
)
108108
);
109-
entryPoint.handleOps(ops, BENEFICIARY);
109+
_handleOps(ops);
110110
}
111111

112112
function testRevertsUserOpsWithMalformedSignature() public {
@@ -125,7 +125,7 @@ contract LightAccountTest is Test {
125125
abi.encodeWithSelector(ECDSA.ECDSAInvalidSignatureLength.selector, (op.signature.length - 1))
126126
)
127127
);
128-
entryPoint.handleOps(ops, BENEFICIARY);
128+
_handleOps(ops);
129129

130130
op.signature = abi.encodePacked(uint8(3));
131131
vm.expectRevert(
@@ -136,7 +136,7 @@ contract LightAccountTest is Test {
136136
abi.encodeWithSelector(BaseLightAccount.InvalidSignatureType.selector)
137137
)
138138
);
139-
entryPoint.handleOps(ops, BENEFICIARY);
139+
_handleOps(ops);
140140

141141
op.signature = hex"";
142142
vm.expectRevert(
@@ -147,7 +147,7 @@ contract LightAccountTest is Test {
147147
abi.encodeWithSelector(BaseLightAccount.InvalidSignatureType.selector)
148148
)
149149
);
150-
entryPoint.handleOps(ops, BENEFICIARY);
150+
_handleOps(ops);
151151
}
152152

153153
function testExecuteCannotBeCalledByRandos() public {
@@ -244,7 +244,7 @@ contract LightAccountTest is Test {
244244
_getSignedOp(abi.encodeCall(BaseLightAccount.withdrawDepositTo, (withdrawalAddress, 5)), EOA_PRIVATE_KEY);
245245
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
246246
ops[0] = op;
247-
entryPoint.handleOps(ops, BENEFICIARY);
247+
_handleOps(ops);
248248

249249
assertEq(withdrawalAddress.balance, 5);
250250
}
@@ -262,7 +262,7 @@ contract LightAccountTest is Test {
262262
);
263263
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
264264
ops[0] = op;
265-
entryPoint.handleOps(ops, BENEFICIARY);
265+
_handleOps(ops);
266266

267267
assertEq(withdrawalAddress.balance, 5);
268268
}
@@ -297,7 +297,7 @@ contract LightAccountTest is Test {
297297
ops[0] = op;
298298
vm.expectEmit(true, true, false, false);
299299
emit OwnershipTransferred(eoaAddress, newOwner);
300-
entryPoint.handleOps(ops, BENEFICIARY);
300+
_handleOps(ops);
301301
assertEq(account.owner(), newOwner);
302302
}
303303

@@ -314,7 +314,7 @@ contract LightAccountTest is Test {
314314
ops[0] = op;
315315
vm.expectEmit(true, true, false, false);
316316
emit OwnershipTransferred(eoaAddress, newOwner);
317-
entryPoint.handleOps(ops, BENEFICIARY);
317+
_handleOps(ops);
318318
assertEq(account.owner(), newOwner);
319319
}
320320

@@ -415,7 +415,7 @@ contract LightAccountTest is Test {
415415

416416
vm.expectEmit(true, true, false, false);
417417
emit SimpleAccountInitialized(newEntryPoint, address(this));
418-
entryPoint.handleOps(ops, BENEFICIARY);
418+
_handleOps(ops);
419419

420420
SimpleAccount upgradedAccount = SimpleAccount(payable(account));
421421
assertEq(address(upgradedAccount.entryPoint()), address(newEntryPoint));
@@ -444,7 +444,7 @@ contract LightAccountTest is Test {
444444

445445
vm.expectEmit(true, true, false, false);
446446
emit SimpleAccountInitialized(newEntryPoint, address(this));
447-
entryPoint.handleOps(ops, BENEFICIARY);
447+
_handleOps(ops);
448448

449449
SimpleAccount upgradedAccount = SimpleAccount(payable(account));
450450
assertEq(address(upgradedAccount.entryPoint()), address(newEntryPoint));
@@ -606,6 +606,11 @@ contract LightAccountTest is Test {
606606
)
607607
);
608608
}
609+
610+
function _handleOps(PackedUserOperation[] memory ops) internal {
611+
vm.prank(tx.origin);
612+
entryPoint.handleOps(ops, BENEFICIARY);
613+
}
609614
}
610615

611616
contract LightSwitch {

test/LightAccountFactory.t.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "forge-std/Test.sol";
55

66
import {EntryPoint} from "account-abstraction/core/EntryPoint.sol";
77
import {IEntryPoint} from "account-abstraction/interfaces/IEntryPoint.sol";
8+
import {IStakeManager} from "account-abstraction/interfaces/IStakeManager.sol";
89

910
import {BaseLightAccountFactory} from "../src/common/BaseLightAccountFactory.sol";
1011
import {LightAccount} from "../src/LightAccount.sol";
@@ -52,7 +53,7 @@ contract LightAccountFactoryTest is Test {
5253
function testWithdrawStake() public {
5354
testUnlockStake();
5455
vm.warp(10 hours);
55-
vm.expectRevert("Stake withdrawal is not due");
56+
vm.expectRevert(abi.encodeWithSelector(IStakeManager.WithdrawalNotDue.selector, 10 hours + 1, block.timestamp));
5657
factory.withdrawStake(payable(address(this)));
5758
assertEq(address(this).balance, 90 ether);
5859
vm.warp(10 hours + 1);

test/MultiOwnerLightAccount.t.sol

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ contract MultiOwnerLightAccountTest is Test {
6565
);
6666
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
6767
ops[0] = op;
68-
entryPoint.handleOps(ops, BENEFICIARY);
68+
_handleOps(ops);
6969
assertTrue(lightSwitch.on());
7070
}
7171

@@ -81,7 +81,7 @@ contract MultiOwnerLightAccountTest is Test {
8181
);
8282
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
8383
ops[0] = op;
84-
entryPoint.handleOps(ops, BENEFICIARY);
84+
_handleOps(ops);
8585
assertTrue(lightSwitch.on());
8686
}
8787

@@ -93,7 +93,7 @@ contract MultiOwnerLightAccountTest is Test {
9393
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
9494
ops[0] = op;
9595
vm.expectRevert(abi.encodeWithSelector(IEntryPoint.FailedOp.selector, 0, "AA24 signature error"));
96-
entryPoint.handleOps(ops, BENEFICIARY);
96+
_handleOps(ops);
9797
}
9898

9999
function testRejectsUserOpWithContractOwnerUnspecified() public {
@@ -114,7 +114,7 @@ contract MultiOwnerLightAccountTest is Test {
114114
abi.encodePacked(BaseLightAccount.InvalidSignatureType.selector)
115115
)
116116
);
117-
entryPoint.handleOps(ops, BENEFICIARY);
117+
_handleOps(ops);
118118
}
119119

120120
function testRejectsUserOpWithInvalidContractOwnerSpecified() public {
@@ -129,7 +129,7 @@ contract MultiOwnerLightAccountTest is Test {
129129
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
130130
ops[0] = op;
131131
vm.expectRevert(abi.encodeWithSelector(IEntryPoint.FailedOp.selector, 0, "AA24 signature error"));
132-
entryPoint.handleOps(ops, BENEFICIARY);
132+
_handleOps(ops);
133133
assertFalse(lightSwitch.on());
134134
}
135135

@@ -144,7 +144,7 @@ contract MultiOwnerLightAccountTest is Test {
144144
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
145145
ops[0] = op;
146146
vm.expectRevert(abi.encodeWithSelector(IEntryPoint.FailedOpWithRevert.selector, 0, "AA23 reverted", bytes("")));
147-
entryPoint.handleOps(ops, BENEFICIARY);
147+
_handleOps(ops);
148148
assertFalse(lightSwitch.on());
149149
}
150150

@@ -165,7 +165,7 @@ contract MultiOwnerLightAccountTest is Test {
165165
abi.encodePacked(BaseLightAccount.InvalidSignatureType.selector)
166166
)
167167
);
168-
entryPoint.handleOps(ops, BENEFICIARY);
168+
_handleOps(ops);
169169
}
170170

171171
function testRevertsUserOpsWithMalformedSignature() public {
@@ -184,7 +184,7 @@ contract MultiOwnerLightAccountTest is Test {
184184
abi.encodeWithSelector(ECDSA.ECDSAInvalidSignatureLength.selector, (op.signature.length - 1))
185185
)
186186
);
187-
entryPoint.handleOps(ops, BENEFICIARY);
187+
_handleOps(ops);
188188

189189
op.signature = abi.encodePacked(uint8(3));
190190
vm.expectRevert(
@@ -195,7 +195,7 @@ contract MultiOwnerLightAccountTest is Test {
195195
abi.encodeWithSelector(BaseLightAccount.InvalidSignatureType.selector)
196196
)
197197
);
198-
entryPoint.handleOps(ops, BENEFICIARY);
198+
_handleOps(ops);
199199

200200
op.signature = hex"";
201201
vm.expectRevert(
@@ -206,7 +206,7 @@ contract MultiOwnerLightAccountTest is Test {
206206
abi.encodeWithSelector(BaseLightAccount.InvalidSignatureType.selector)
207207
)
208208
);
209-
entryPoint.handleOps(ops, BENEFICIARY);
209+
_handleOps(ops);
210210
}
211211

212212
function testExecuteCannotBeCalledByRandos() public {
@@ -310,7 +310,7 @@ contract MultiOwnerLightAccountTest is Test {
310310
_getSignedOp(abi.encodeCall(BaseLightAccount.withdrawDepositTo, (withdrawalAddress, 5)), EOA_PRIVATE_KEY);
311311
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
312312
ops[0] = op;
313-
entryPoint.handleOps(ops, BENEFICIARY);
313+
_handleOps(ops);
314314

315315
assertEq(withdrawalAddress.balance, 5);
316316
}
@@ -328,7 +328,7 @@ contract MultiOwnerLightAccountTest is Test {
328328
);
329329
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
330330
ops[0] = op;
331-
entryPoint.handleOps(ops, BENEFICIARY);
331+
_handleOps(ops);
332332

333333
assertEq(withdrawalAddress.balance, 5);
334334
}
@@ -364,7 +364,7 @@ contract MultiOwnerLightAccountTest is Test {
364364
ops[0] = op;
365365
vm.expectEmit(true, true, false, false);
366366
emit OwnersUpdated(ownersToAdd, ownersToRemove);
367-
entryPoint.handleOps(ops, BENEFICIARY);
367+
_handleOps(ops);
368368
assertEq(account.owners(), ownersToAdd);
369369
}
370370

@@ -388,7 +388,7 @@ contract MultiOwnerLightAccountTest is Test {
388388
ops[0] = op;
389389
vm.expectEmit(true, true, false, false);
390390
emit OwnersUpdated(ownersToAdd, ownersToRemove);
391-
entryPoint.handleOps(ops, BENEFICIARY);
391+
_handleOps(ops);
392392
assertEq(account.owners(), ownersToAdd);
393393
}
394394

@@ -559,7 +559,7 @@ contract MultiOwnerLightAccountTest is Test {
559559

560560
vm.expectEmit(true, true, false, false);
561561
emit SimpleAccountInitialized(newEntryPoint, address(this));
562-
entryPoint.handleOps(ops, BENEFICIARY);
562+
_handleOps(ops);
563563

564564
SimpleAccount upgradedAccount = SimpleAccount(payable(account));
565565
assertEq(address(upgradedAccount.entryPoint()), address(newEntryPoint));
@@ -588,7 +588,7 @@ contract MultiOwnerLightAccountTest is Test {
588588

589589
vm.expectEmit(true, true, false, false);
590590
emit SimpleAccountInitialized(newEntryPoint, address(this));
591-
entryPoint.handleOps(ops, BENEFICIARY);
591+
_handleOps(ops);
592592

593593
SimpleAccount upgradedAccount = SimpleAccount(payable(account));
594594
assertEq(address(upgradedAccount.entryPoint()), address(newEntryPoint));
@@ -693,6 +693,11 @@ contract MultiOwnerLightAccountTest is Test {
693693
)
694694
);
695695
}
696+
697+
function _handleOps(PackedUserOperation[] memory ops) internal {
698+
vm.prank(tx.origin);
699+
entryPoint.handleOps(ops, BENEFICIARY);
700+
}
696701
}
697702

698703
contract LightSwitch {

test/MultiOwnerLightAccountFactory.t.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "forge-std/Test.sol";
55

66
import {EntryPoint} from "account-abstraction/core/EntryPoint.sol";
77
import {IEntryPoint} from "account-abstraction/interfaces/IEntryPoint.sol";
8+
import {IStakeManager} from "account-abstraction/interfaces/IStakeManager.sol";
89

910
import {BaseLightAccountFactory} from "../src/common/BaseLightAccountFactory.sol";
1011
import {MultiOwnerLightAccount} from "../src/MultiOwnerLightAccount.sol";
@@ -128,7 +129,7 @@ contract MultiOwnerLightAccountFactoryTest is Test {
128129
function testWithdrawStake() public {
129130
testUnlockStake();
130131
vm.warp(10 hours);
131-
vm.expectRevert("Stake withdrawal is not due");
132+
vm.expectRevert(abi.encodeWithSelector(IStakeManager.WithdrawalNotDue.selector, 10 hours + 1, block.timestamp));
132133
factory.withdrawStake(payable(address(this)));
133134
assertEq(address(this).balance, 90 ether);
134135
vm.warp(10 hours + 1);

0 commit comments

Comments
 (0)