Skip to content

Commit 2c020b8

Browse files
committed
fmt
1 parent e22988e commit 2c020b8

File tree

8 files changed

+58
-96
lines changed

8 files changed

+58
-96
lines changed

src/AccountConfiguration.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ contract AccountConfiguration is IAccountConfiguration {
115115
/// @notice Import an existing account to AccountConfiguration management.
116116
/// @dev Verifies via ERC-1271. Accounts must have bytecode.
117117
/// @dev Custom hash used to partially mitigate phishing attacks on eth_signTypedData.
118-
function importAccount(address account, Owner[] calldata initialOwners, bytes calldata signature)
119-
external
120-
{
118+
function importAccount(address account, Owner[] calldata initialOwners, bytes calldata signature) external {
121119
require(_accountState[account].localSequence == 0);
122120
_accountState[account].localSequence = 1;
123121

test/lib/AccountConfigurationTest.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ contract AccountConfigurationTest is Test {
4545

4646
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
4747
owners[0] = IAccountConfiguration.Owner({
48-
ownerId: ownerId,
49-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
48+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
5049
});
5150

5251
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);
@@ -59,8 +58,7 @@ contract AccountConfigurationTest is Test {
5958

6059
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
6160
owners[0] = IAccountConfiguration.Owner({
62-
ownerId: ownerId,
63-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
61+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
6462
});
6563

6664
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);

test/unit/AccountConfiguration/createAccount.t.sol

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ contract CreateAccountTest is AccountConfigurationTest {
1313

1414
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
1515
owners[0] = IAccountConfiguration.Owner({
16-
ownerId: ownerId,
17-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
16+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
1817
});
1918

2019
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);
@@ -67,8 +66,7 @@ contract CreateAccountTest is AccountConfigurationTest {
6766

6867
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
6968
owners[0] = IAccountConfiguration.Owner({
70-
ownerId: ownerId,
71-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
69+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
7270
});
7371

7472
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);
@@ -84,8 +82,7 @@ contract CreateAccountTest is AccountConfigurationTest {
8482

8583
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
8684
owners[0] = IAccountConfiguration.Owner({
87-
ownerId: ownerId,
88-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
85+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
8986
});
9087

9188
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);
@@ -107,12 +104,10 @@ contract CreateAccountTest is AccountConfigurationTest {
107104

108105
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](2);
109106
owners[0] = IAccountConfiguration.Owner({
110-
ownerId: larger,
111-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
107+
ownerId: larger, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
112108
});
113109
owners[1] = IAccountConfiguration.Owner({
114-
ownerId: smaller,
115-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
110+
ownerId: smaller, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
116111
});
117112

118113
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);
@@ -133,8 +128,7 @@ contract CreateAccountTest is AccountConfigurationTest {
133128

134129
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
135130
owners[0] = IAccountConfiguration.Owner({
136-
ownerId: ownerId,
137-
config: IAccountConfiguration.OwnerConfig({verifier: address(0), scopes: 0x00})
131+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(0), scopes: 0x00})
138132
});
139133

140134
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);
@@ -148,8 +142,7 @@ contract CreateAccountTest is AccountConfigurationTest {
148142

149143
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
150144
owners[0] = IAccountConfiguration.Owner({
151-
ownerId: ownerId,
152-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x03})
145+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x03})
153146
});
154147

155148
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);
@@ -173,8 +166,7 @@ contract CreateAccountTest is AccountConfigurationTest {
173166

174167
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
175168
owners[0] = IAccountConfiguration.Owner({
176-
ownerId: ownerId,
177-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
169+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
178170
});
179171

180172
bytes memory bytecode = _computeERC1167Bytecode(defaultAccountImplementation);

test/unit/accounts/DefaultAccount.t.sol

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ contract DefaultAccountTest is AccountConfigurationTest {
4545
(address account,) = _createK1Account(OWNER_PK);
4646

4747
vm.prank(account);
48-
DefaultAccount(payable(account)).executeBatch(
49-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (42)))
50-
);
48+
DefaultAccount(payable(account))
49+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (42))));
5150

5251
assertEq(target.value(), 42);
5352
}
@@ -57,9 +56,8 @@ contract DefaultAccountTest is AccountConfigurationTest {
5756
vm.deal(account, 1 ether);
5857

5958
vm.prank(account);
60-
DefaultAccount(payable(account)).executeBatch(
61-
_singleCall(address(target), 0.5 ether, abi.encodeCall(MockTarget.setValue, (1)))
62-
);
59+
DefaultAccount(payable(account))
60+
.executeBatch(_singleCall(address(target), 0.5 ether, abi.encodeCall(MockTarget.setValue, (1))));
6361

6462
assertEq(address(target).balance, 0.5 ether);
6563
}
@@ -84,19 +82,17 @@ contract DefaultAccountTest is AccountConfigurationTest {
8482

8583
vm.prank(address(0xdead));
8684
vm.expectRevert();
87-
DefaultAccount(payable(account)).executeBatch(
88-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (1)))
89-
);
85+
DefaultAccount(payable(account))
86+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (1))));
9087
}
9188

9289
function test_executeBatch_revertsOnFailedCall() public {
9390
(address account,) = _createK1Account(OWNER_PK);
9491

9592
vm.prank(account);
9693
vm.expectRevert();
97-
DefaultAccount(payable(account)).executeBatch(
98-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.reverting, ()))
99-
);
94+
DefaultAccount(payable(account))
95+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.reverting, ())));
10096
}
10197

10298
// ── isValidSignature ──

test/unit/accounts/DefaultHighRateAccount.t.sol

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ contract DefaultHighRateAccountTest is AccountConfigurationTest {
3636

3737
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
3838
owners[0] = IAccountConfiguration.Owner({
39-
ownerId: ownerId,
40-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
39+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
4140
});
4241

4342
bytes memory bytecode = _computeERC1167Bytecode(highRateImplementation);
@@ -60,9 +59,8 @@ contract DefaultHighRateAccountTest is AccountConfigurationTest {
6059
(address account,) = _createHighRateK1Account(OWNER_PK);
6160

6261
vm.prank(account);
63-
DefaultHighRateAccount(payable(account)).executeBatch(
64-
_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.setValue, (42)))
65-
);
62+
DefaultHighRateAccount(payable(account))
63+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.setValue, (42))));
6664

6765
assertEq(target.value(), 42);
6866
}
@@ -72,9 +70,8 @@ contract DefaultHighRateAccountTest is AccountConfigurationTest {
7270
vm.deal(account, 1 ether);
7371

7472
vm.prank(account);
75-
DefaultHighRateAccount(payable(account)).executeBatch(
76-
_singleCall(address(target), 0.5 ether, abi.encodeCall(HighRateMockTarget.setValue, (1)))
77-
);
73+
DefaultHighRateAccount(payable(account))
74+
.executeBatch(_singleCall(address(target), 0.5 ether, abi.encodeCall(HighRateMockTarget.setValue, (1))));
7875

7976
assertEq(address(target).balance, 0.5 ether);
8077
}
@@ -99,19 +96,17 @@ contract DefaultHighRateAccountTest is AccountConfigurationTest {
9996

10097
vm.prank(address(0xdead));
10198
vm.expectRevert();
102-
DefaultHighRateAccount(payable(account)).executeBatch(
103-
_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.setValue, (1)))
104-
);
99+
DefaultHighRateAccount(payable(account))
100+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.setValue, (1))));
105101
}
106102

107103
function test_executeBatch_revertsOnFailedCall() public {
108104
(address account,) = _createHighRateK1Account(OWNER_PK);
109105

110106
vm.prank(account);
111107
vm.expectRevert();
112-
DefaultHighRateAccount(payable(account)).executeBatch(
113-
_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.reverting, ()))
114-
);
108+
DefaultHighRateAccount(payable(account))
109+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.reverting, ())));
115110
}
116111

117112
function test_executeBatch_blocksETHWhenLocked() public {
@@ -122,9 +117,8 @@ contract DefaultHighRateAccountTest is AccountConfigurationTest {
122117

123118
vm.prank(account);
124119
vm.expectRevert();
125-
DefaultHighRateAccount(payable(account)).executeBatch(
126-
_singleCall(address(target), 0.1 ether, abi.encodeCall(HighRateMockTarget.setValue, (1)))
127-
);
120+
DefaultHighRateAccount(payable(account))
121+
.executeBatch(_singleCall(address(target), 0.1 ether, abi.encodeCall(HighRateMockTarget.setValue, (1))));
128122
}
129123

130124
function test_executeBatch_allowsZeroValueCallsWhenLocked() public {
@@ -133,9 +127,8 @@ contract DefaultHighRateAccountTest is AccountConfigurationTest {
133127
_lockAccount(account, 1 hours);
134128

135129
vm.prank(account);
136-
DefaultHighRateAccount(payable(account)).executeBatch(
137-
_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.setValue, (99)))
138-
);
130+
DefaultHighRateAccount(payable(account))
131+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(HighRateMockTarget.setValue, (99))));
139132

140133
assertEq(target.value(), 99);
141134
}
@@ -145,9 +138,8 @@ contract DefaultHighRateAccountTest is AccountConfigurationTest {
145138
vm.deal(account, 1 ether);
146139

147140
vm.prank(account);
148-
DefaultHighRateAccount(payable(account)).executeBatch(
149-
_singleCall(address(target), 0.5 ether, abi.encodeCall(HighRateMockTarget.setValue, (1)))
150-
);
141+
DefaultHighRateAccount(payable(account))
142+
.executeBatch(_singleCall(address(target), 0.5 ether, abi.encodeCall(HighRateMockTarget.setValue, (1))));
151143

152144
assertEq(address(target).balance, 0.5 ether);
153145
}

test/unit/accounts/ERC4337Account.t.sol

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ contract ERC4337AccountTest is AccountConfigurationTest {
3636

3737
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
3838
owners[0] = IAccountConfiguration.Owner({
39-
ownerId: ownerId,
40-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
39+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
4140
});
4241

4342
bytes memory bytecode = _computeERC1167Bytecode(erc4337Implementation);
@@ -114,9 +113,8 @@ contract ERC4337AccountTest is AccountConfigurationTest {
114113
(address account,) = _create4337Account(OWNER_PK);
115114

116115
vm.prank(account);
117-
ERC4337Account(payable(account)).executeBatch(
118-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (42)))
119-
);
116+
ERC4337Account(payable(account))
117+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (42))));
120118

121119
assertEq(target.value(), 42);
122120
}
@@ -126,9 +124,8 @@ contract ERC4337AccountTest is AccountConfigurationTest {
126124
vm.deal(account, 1 ether);
127125

128126
vm.prank(account);
129-
ERC4337Account(payable(account)).executeBatch(
130-
_singleCall(address(target), 0.5 ether, abi.encodeCall(MockTarget.setValue, (1)))
131-
);
127+
ERC4337Account(payable(account))
128+
.executeBatch(_singleCall(address(target), 0.5 ether, abi.encodeCall(MockTarget.setValue, (1))));
132129

133130
assertEq(address(target).balance, 0.5 ether);
134131
}
@@ -137,9 +134,8 @@ contract ERC4337AccountTest is AccountConfigurationTest {
137134
(address account,) = _create4337Account(OWNER_PK);
138135

139136
vm.prank(ENTRY_POINT);
140-
ERC4337Account(payable(account)).executeBatch(
141-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (77)))
142-
);
137+
ERC4337Account(payable(account))
138+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (77))));
143139

144140
assertEq(target.value(), 77);
145141
}
@@ -149,19 +145,17 @@ contract ERC4337AccountTest is AccountConfigurationTest {
149145

150146
vm.prank(address(0xdead));
151147
vm.expectRevert();
152-
ERC4337Account(payable(account)).executeBatch(
153-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (1)))
154-
);
148+
ERC4337Account(payable(account))
149+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (1))));
155150
}
156151

157152
function test_executeBatch_revertsOnFailedCall() public {
158153
(address account,) = _create4337Account(OWNER_PK);
159154

160155
vm.prank(account);
161156
vm.expectRevert();
162-
ERC4337Account(payable(account)).executeBatch(
163-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.reverting, ()))
164-
);
157+
ERC4337Account(payable(account))
158+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.reverting, ())));
165159
}
166160

167161
// ── validateUserOp ──

test/unit/accounts/UpgradeableAccount.t.sol

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ contract UpgradeableAccountTest is AccountConfigurationTest {
5151

5252
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
5353
owners[0] = IAccountConfiguration.Owner({
54-
ownerId: ownerId,
55-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
54+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
5655
});
5756

5857
bytes memory proxyBytecode = UpgradeableProxy.bytecode(upgradeableImpl);
@@ -87,8 +86,7 @@ contract UpgradeableAccountTest is AccountConfigurationTest {
8786

8887
IAccountConfiguration.Owner[] memory owners = new IAccountConfiguration.Owner[](1);
8988
owners[0] = IAccountConfiguration.Owner({
90-
ownerId: ownerId,
91-
config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
89+
ownerId: ownerId, config: IAccountConfiguration.OwnerConfig({verifier: address(k1Verifier), scopes: 0x00})
9290
});
9391

9492
bytes memory proxyBytecode = UpgradeableProxy.bytecode(upgradeableImpl);
@@ -111,9 +109,8 @@ contract UpgradeableAccountTest is AccountConfigurationTest {
111109
(address account,) = _createUpgradeableAccount(OWNER_PK);
112110

113111
vm.prank(account);
114-
UpgradeableAccount(payable(account)).executeBatch(
115-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (42)))
116-
);
112+
UpgradeableAccount(payable(account))
113+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (42))));
117114

118115
assertEq(target.value(), 42);
119116
}
@@ -123,9 +120,8 @@ contract UpgradeableAccountTest is AccountConfigurationTest {
123120
vm.deal(account, 1 ether);
124121

125122
vm.prank(account);
126-
UpgradeableAccount(payable(account)).executeBatch(
127-
_singleCall(address(target), 0.5 ether, abi.encodeCall(MockTarget.setValue, (1)))
128-
);
123+
UpgradeableAccount(payable(account))
124+
.executeBatch(_singleCall(address(target), 0.5 ether, abi.encodeCall(MockTarget.setValue, (1))));
129125

130126
assertEq(address(target).balance, 0.5 ether);
131127
}
@@ -135,19 +131,17 @@ contract UpgradeableAccountTest is AccountConfigurationTest {
135131

136132
vm.prank(address(0xdead));
137133
vm.expectRevert();
138-
UpgradeableAccount(payable(account)).executeBatch(
139-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (1)))
140-
);
134+
UpgradeableAccount(payable(account))
135+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (1))));
141136
}
142137

143138
function test_executeBatch_revertsOnFailedCall() public {
144139
(address account,) = _createUpgradeableAccount(OWNER_PK);
145140

146141
vm.prank(account);
147142
vm.expectRevert();
148-
UpgradeableAccount(payable(account)).executeBatch(
149-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.reverting, ()))
150-
);
143+
UpgradeableAccount(payable(account))
144+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.reverting, ())));
151145
}
152146

153147
// ── UUPS upgrade ──
@@ -180,9 +174,8 @@ contract UpgradeableAccountTest is AccountConfigurationTest {
180174
UpgradeableAccount(payable(account)).upgradeToAndCall(address(v2Impl), "");
181175

182176
vm.prank(account);
183-
UpgradeableAccount(payable(account)).executeBatch(
184-
_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (999)))
185-
);
177+
UpgradeableAccount(payable(account))
178+
.executeBatch(_singleCall(address(target), 0, abi.encodeCall(MockTarget.setValue, (999))));
186179

187180
assertEq(target.value(), 999);
188181
}

0 commit comments

Comments
 (0)