Skip to content

Commit b4f2a46

Browse files
committed
fix: optimize LightAccountFactory's _getCombinedSalt
1 parent 8255b5f commit b4f2a46

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/LightAccountFactory.sol

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ contract LightAccountFactory {
4545
);
4646
}
4747

48-
function _getCombinedSalt(address owner, uint256 salt) internal pure returns (bytes32) {
49-
return keccak256(abi.encode(owner, salt));
48+
function _getCombinedSalt(address owner, uint256 salt) internal pure returns (bytes32 combinedSalt) {
49+
assembly ("memory-safe") {
50+
mstore(0x00, owner)
51+
mstore(0x20, salt)
52+
combinedSalt := keccak256(0x00, 0x40)
53+
}
5054
}
5155
}

test/LightAccount.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ contract LightAccountTest is Test {
288288
bytes32(uint256(uint160(0x0000000071727De22E5E9d8BAf0edAc6f37da032)))
289289
)
290290
),
291-
0x61ded19e9e86ff20a3a8822529fb98ef584c1e9f6e1457dcfdcd1f5e146d7d97
291+
0xa677af8a16ab66d988856a88ea647c45da368a588b036126ce3e21645f7891ca
292292
);
293293
}
294294

0 commit comments

Comments
 (0)