Skip to content

Commit

Permalink
fix: gas optimizations and minor improvements (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
ly0va authored Feb 13, 2025
1 parent faa4f88 commit 8d56a8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
19 changes: 5 additions & 14 deletions src/libraries/SsoStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,15 @@ library SsoStorage {
bytes32 private constant SSO_STORAGE_SLOT = 0x996e49e905bb2c30d677a2ad554e4b964a479b19a0509deafafca5126b88ba23;

struct Layout {
// ┌───────────────────┐
// │ Ownership Data │
// Ownership Data
EnumerableSet.AddressSet k1Owners;
uint256[50] __gap_0;
// └───────────────────┘

// ┌───────────────────┐
// │ Validation │
// Validation
EnumerableSet.AddressSet moduleValidators;
uint256[50] __gap_2;
// └───────────────────┘

// ┌───────────────────┐
// │ Hooks │
// Hooks
EnumerableSet.AddressSet validationHooks;
EnumerableSet.AddressSet executionHooks;
uint256[50] __gap_4;
// └───────────────────┘
// Storage slots reserved for future upgrades
uint256[256] __RESERVED;
}

function layout() internal pure returns (Layout storage l) {
Expand Down
2 changes: 1 addition & 1 deletion src/validators/SessionKeyValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ contract SessionKeyValidator is IModuleValidator {
}

/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) external view override returns (bool) {
function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {
return
interfaceId == type(IERC165).interfaceId ||
interfaceId == type(IModuleValidator).interfaceId ||
Expand Down
4 changes: 2 additions & 2 deletions src/validators/WebAuthValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ contract WebAuthValidator is VerifierCaller, IModuleValidator {
/// @param signedHash The hash of the signed message
/// @param signature The signature to validate
/// @return true if the signature is valid
function validateSignature(bytes32 signedHash, bytes memory signature) external view returns (bool) {
function validateSignature(bytes32 signedHash, bytes calldata signature) external view returns (bool) {
return webAuthVerify(signedHash, signature);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ contract WebAuthValidator is VerifierCaller, IModuleValidator {
);

// prevent signature replay https://yondon.blog/2019/01/01/how-not-to-use-ecdsa/
if (rs[0] <= 0 || rs[0] > HIGH_R_MAX || rs[1] <= 0 || rs[1] > LOW_S_MAX) {
if (rs[0] == 0 || rs[0] > HIGH_R_MAX || rs[1] == 0 || rs[1] > LOW_S_MAX) {
return false;
}

Expand Down

0 comments on commit 8d56a8b

Please sign in to comment.