Skip to content

Commit

Permalink
fix: optimize LightAccountFactory's _getCombinedSalt
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypaik committed Mar 14, 2024
1 parent 8255b5f commit b4f2a46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/LightAccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ contract LightAccountFactory {
);
}

function _getCombinedSalt(address owner, uint256 salt) internal pure returns (bytes32) {
return keccak256(abi.encode(owner, salt));
function _getCombinedSalt(address owner, uint256 salt) internal pure returns (bytes32 combinedSalt) {
assembly ("memory-safe") {
mstore(0x00, owner)
mstore(0x20, salt)
combinedSalt := keccak256(0x00, 0x40)
}
}
}
2 changes: 1 addition & 1 deletion test/LightAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ contract LightAccountTest is Test {
bytes32(uint256(uint160(0x0000000071727De22E5E9d8BAf0edAc6f37da032)))
)
),
0x61ded19e9e86ff20a3a8822529fb98ef584c1e9f6e1457dcfdcd1f5e146d7d97
0xa677af8a16ab66d988856a88ea647c45da368a588b036126ce3e21645f7891ca
);
}

Expand Down

0 comments on commit b4f2a46

Please sign in to comment.